CallRecordManager.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <div>
  3. <crumbs title="调用记录" style="min-width: 980px" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="接收时间: ">
  6. &nbsp;&nbsp;
  7. <el-date-picker
  8. v-model="filter.recepDate"
  9. type="datetimerange"
  10. align="right"
  11. size="small"
  12. start-placeholder="开始时间"
  13. end-placeholder="结束时间"
  14. style="width: 310px"
  15. :default-time="['00:00:00', '23:59:59']"
  16. format="yyyy-MM-dd HH:mm"
  17. value-format="yyyy-MM-dd HH:mm"
  18. :class="filter.recepDate === null ? 'active' : ''"
  19. >
  20. </el-date-picker>
  21. </el-form-item>
  22. <el-form-item label="响应时间: "
  23. >&nbsp;&nbsp;
  24. <el-date-picker
  25. v-model="filter.resDate"
  26. type="datetimerange"
  27. align="right"
  28. size="small"
  29. start-placeholder="开始时间"
  30. end-placeholder="结束时间"
  31. style="width: 310px"
  32. :default-time="['00:00:00', '23:59:59']"
  33. format="yyyy-MM-dd HH:mm"
  34. value-format="yyyy-MM-dd HH:mm"
  35. unlink-panels
  36. >
  37. </el-date-picker>
  38. </el-form-item>
  39. <!-- <el-form-item label="状态:">
  40. <el-select
  41. v-model="filter.successFlag"
  42. clearable
  43. placeholder="请选择"
  44. size="mini"
  45. >
  46. <el-option
  47. v-for="item in stateSelect"
  48. :key="item.successFlag"
  49. :label="item.name"
  50. :value="item.successFlag"
  51. ></el-option>
  52. </el-select>
  53. </el-form-item> -->
  54. <!-- <el-form-item label="院区:" prop="subHospitalName">
  55. <el-input
  56. size="mini"
  57. v-model="filter.subHospitalName"
  58. placeholder="输入规则名称"
  59. clearable
  60. ></el-input>
  61. </el-form-item> -->
  62. <!-- <el-form-item>
  63. <el-button size="mini" @click="filterDatas">确认</el-button>
  64. </el-form-item> -->
  65. </el-form>
  66. <el-form class="secLine" :inline="true">
  67. <el-form-item label="患者标识:" prop="patientId">
  68. <el-input
  69. size="mini"
  70. v-model="filter.patientId"
  71. placeholder="请输入患者标识"
  72. clearable
  73. maxlength="50"
  74. ></el-input>
  75. </el-form-item>
  76. <el-form-item label="服务名:" prop="sceneName">
  77. <el-input
  78. size="mini"
  79. v-model="filter.sceneName"
  80. placeholder="请输入服务名"
  81. clearable
  82. maxlength="50"
  83. ></el-input>
  84. </el-form-item>
  85. <el-form-item label="状态:">
  86. <el-select
  87. v-model="filter.successFlag"
  88. clearable
  89. placeholder="请选择"
  90. size="mini"
  91. >
  92. <el-option
  93. v-for="item in stateSelect"
  94. :key="item.successFlag"
  95. :label="item.name"
  96. :value="item.successFlag"
  97. ></el-option>
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item label="子院区:" prop="subHospitalName">
  101. <el-input
  102. size="mini"
  103. v-model="filter.subHospitalName"
  104. placeholder="请输入子院区"
  105. clearable
  106. maxlength="50"
  107. ></el-input>
  108. </el-form-item>
  109. <el-form-item>
  110. <el-button size="mini" @click="filterDatas">检索</el-button>
  111. </el-form-item>
  112. </el-form>
  113. </crumbs>
  114. <div class="contents knowledgeContents">
  115. <el-table :data="list" border style="width: 100%">
  116. <!-- <el-table-column type="index" :index="indexMethod" label="编号" width="60"></el-table-column> -->
  117. <el-table-column label="患者标识" align="center" width="200">
  118. <template slot-scope="scope">
  119. <!--<el-tooltip
  120. v-if="scope.row.parDescription.length>8"
  121. class="item"
  122. effect="dark"
  123. :content="scope.row.parDescription"
  124. placement="top"
  125. >
  126. <span>{{scope.row.parDescription.slice(0,8)+'...'}}</span>
  127. </el-tooltip>-->
  128. <span>{{
  129. scope.row.patientId === null ? "-" : scope.row.patientId
  130. }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="服务名" align="center">
  134. <template slot-scope="scope">{{ scope.row.sceneName }}</template>
  135. </el-table-column>
  136. <el-table-column
  137. prop="parConceptName"
  138. label="请求内容"
  139. align="center"
  140. width="100"
  141. >
  142. <template slot-scope="scope">
  143. <el-button type="text" size="small" @click="reqData(scope.row)"
  144. >详情</el-button
  145. >
  146. <!--<el-tooltip
  147. v-if="scope.row.parConceptName.length>8"
  148. class="item"
  149. effect="dark"
  150. :content="scope.row.parConceptName"
  151. placement="top"
  152. >
  153. <span>{{scope.row.parConceptName.slice(0,8)+'...'}}</span>
  154. </el-tooltip>-->
  155. <!-- <span>{{scope.row.parConceptName}}</span> -->
  156. </template>
  157. </el-table-column>
  158. <el-table-column
  159. prop="parLibTypeName"
  160. label="响应内容"
  161. align="center"
  162. width="100"
  163. >
  164. <template slot-scope="scope">
  165. <el-button type="text" size="small" @click="respData(scope.row)"
  166. >详情</el-button
  167. >
  168. </template>
  169. </el-table-column>
  170. <el-table-column
  171. prop="gmtReq"
  172. label="接收时间"
  173. align="center"
  174. ></el-table-column>
  175. <el-table-column
  176. prop="gmtResp"
  177. label="响应时间"
  178. align="center"
  179. ></el-table-column>
  180. <!-- <el-table-column prop="modifierName" label="操作人">
  181. <template slot-scope="scope">
  182. <el-tooltip
  183. v-if="scope.row.modifierName&&scope.row.modifierName.length>8"
  184. class="item"
  185. effect="dark"
  186. :content="scope.row.modifierName"
  187. placement="top"
  188. >
  189. <span>{{(scope.row.modifierName||'').slice(0,8)+'...'}}</span>
  190. </el-tooltip>
  191. <span
  192. v-if="scope.row.modifierName&&scope.row.modifierName.length<9"
  193. >{{scope.row.modifierName}}</span>
  194. </template>
  195. </el-table-column> -->
  196. <el-table-column
  197. prop="execTime"
  198. label="耗时(ms)"
  199. align="center"
  200. width="100"
  201. ></el-table-column>
  202. <el-table-column label="状态" width="100" align="center">
  203. <template slot-scope="scope">
  204. <span>
  205. {{ scope.row.successFlag === 1 ? "成功" : "失败" }}
  206. </span>
  207. </template>
  208. </el-table-column>
  209. <el-table-column
  210. prop="subHospitalName"
  211. label="子院区"
  212. align="center"
  213. width="180"
  214. show-overflow-tooltip
  215. >
  216. <template slot-scope="scope">
  217. <span>
  218. {{
  219. scope.row.subHospitalName === null
  220. ? "-"
  221. : scope.row.subHospitalName
  222. }}
  223. </span>
  224. </template>
  225. </el-table-column>
  226. <el-table-column
  227. prop="subHospitalCode"
  228. label="子院区编码"
  229. align="center"
  230. width="100"
  231. >
  232. <template slot-scope="scope">
  233. <span>
  234. {{
  235. scope.row.subHospitalCode === null
  236. ? "-"
  237. : scope.row.subHospitalCode
  238. }}
  239. </span>
  240. </template>
  241. </el-table-column>
  242. </el-table>
  243. <el-pagination
  244. :current-page.sync="currentPage"
  245. @current-change="currentChange"
  246. background
  247. :page-size="pageSize"
  248. :page-sizes="pageSizeArr"
  249. @size-change="handleSizeChange"
  250. :layout="pageLayout"
  251. :total="total"
  252. ></el-pagination>
  253. <!-- 请求弹出框 -->
  254. <el-dialog title="请求日志信息" :visible.sync="reqVisible" width="660px">
  255. <div class="request-item">
  256. {{ params }}
  257. </div>
  258. </el-dialog>
  259. <!-- 响应内容弹出框 -->
  260. <el-dialog title="响应日志信息" :visible.sync="respVisible" width="660px">
  261. <div class="request-item">{{ result }}</div>
  262. </el-dialog>
  263. </div>
  264. </div>
  265. </template>
  266. <script>
  267. import api from "@api/knowledgeLib.js";
  268. import config from "@api/config.js";
  269. import utils from "@api/utils.js";
  270. export default {
  271. name: "ZskRuleManager",
  272. data: function () {
  273. return {
  274. list: [],
  275. value2: "",
  276. stateSelect: [
  277. { successFlag: "", name: "全部" },
  278. { successFlag: 1, name: "成功" },
  279. { successFlag: 0, name: "失败" },
  280. ],
  281. ruleTypeList: [],
  282. searched: false,
  283. filter: {
  284. successFlag: "",
  285. patientId: "",
  286. sceneName: "",
  287. subHospitalName: "", // 子院区
  288. recepDate: null, // 接收日期
  289. resDate: null, // 响应日期
  290. },
  291. cacheData: {},
  292. currentPage: 1,
  293. pageSize: config.pageSize,
  294. pageSizeArr: config.pageSizeArr,
  295. pageLayout: config.pageLayout,
  296. total: 0,
  297. titleWidth: "970px", //头部最小宽度
  298. reqVisible: false,
  299. respVisible: false,
  300. params: "",
  301. result: "",
  302. gmtReq: ''
  303. };
  304. },
  305. created() {
  306. let that = this;
  307. //返回时避免参数未赋值就获取列表
  308. setTimeout(function () {
  309. that.getDataList();
  310. });
  311. },
  312. computed: {
  313. // pickerOptions: {
  314. // disabledDate(time) {
  315. // return time.getTime() > Date.now()
  316. // }
  317. // }
  318. },
  319. watch: {
  320. filter: {
  321. handler: function () {
  322. this.searched = false;
  323. },
  324. deep: true,
  325. },
  326. },
  327. // beforeRouteEnter(to, from, next) {
  328. // next(vm => {
  329. // //const pm = to.param;
  330. // Object.assign(vm, to.params);
  331. // vm.inCurrentPage=to.params.currentPage;
  332. // })
  333. // },
  334. methods: {
  335. // 请求内容展示
  336. reqData(row) {
  337. console.log("请求内容:", row);
  338. this.reqVisible = true;
  339. this.params = row.params;
  340. console.log("请求内容:", this.params);
  341. },
  342. // 响应内容展示
  343. respData(row) {
  344. console.log("响应内容:", row);
  345. this.respVisible = true;
  346. this.result = row.result;
  347. },
  348. statusTrans(type) {
  349. const obj = this.ruleTypeList.find((it) => it.type === type);
  350. return obj && obj.name;
  351. },
  352. handleSizeChange(val) {
  353. this.pageSize = val;
  354. this.currentPage = utils.getCurrentPage(
  355. this.currentPage,
  356. this.total,
  357. this.pageSize
  358. );
  359. this.getDataList();
  360. },
  361. filterDatas() {
  362. this.currentPage = 1;
  363. this.getDataList(1);
  364. },
  365. getDataList(flag, isTurnPage) {
  366. const params = this.getFilterItems(isTurnPage);
  367. this.searched = true;
  368. const loading = this.$loading({
  369. lock: true,
  370. text: "Loading",
  371. spinner: "el-icon-loading",
  372. background: "rgba(0, 0, 0, 0.7)",
  373. });
  374. api
  375. .getCallRecord(params)
  376. .then((res) => {
  377. loading.close();
  378. if (res.data.code == "0") {
  379. const data = res.data.data;
  380. for (let j = 0; j < data.records.length; j++) {
  381. data.records[j].successFlag == "1" ? "成功" : "失败";
  382. }
  383. this.list = data.records;
  384. console.log("调用接口数据:", this.list);
  385. if (!flag) {
  386. //搜索时不缓存
  387. this.cacheData[params.current] = data.records;
  388. } else {
  389. this.cacheData = {};
  390. }
  391. this.total = data.total;
  392. if (this.inCurrentPage !== undefined) {
  393. this.currentPage = this.inCurrentPage;
  394. this.inCurrentPage = undefined;
  395. }
  396. } else {
  397. this.warning(res.data.msg || "获取列表数据失败");
  398. }
  399. })
  400. .catch((error) => {
  401. loading.close();
  402. console.log(error);
  403. });
  404. },
  405. getFilterItems(isTurnPage) {
  406. //翻页时筛选条件没点确定则清空
  407. if (isTurnPage && !this.searched) {
  408. this.clearFilter();
  409. }
  410. // 接收时间 开始时间补0 结束时间补59
  411. let startGmtReq, endGmtReq, startGmtResp, endGmtResp;
  412. if (this.filter.recepDate) {
  413. console.log(this.filter.recepDate[0].split(" "));
  414. if (this.filter.recepDate[0].split(0, 9) === this.filter.recepDate[1].split(0, 9)) {
  415. if (this.filter.recepDate[0]) {
  416. startGmtReq = this.filter.recepDate[0] + ":00";
  417. endGmtReq = this.filter.recepDate[1] + ":59";
  418. }
  419. } else {
  420. startGmtReq = this.filter.recepDate[0] + ":00";
  421. endGmtReq = this.filter.recepDate[1] + ":59";
  422. }
  423. }
  424. // 响应时间 开始时间补0 结束时间补59
  425. if (this.filter.resDate) {
  426. if (
  427. this.filter.resDate[0].split(0, 9) ===
  428. this.filter.resDate[1].split(0, 9)
  429. ) {
  430. if (this.filter.resDate[0]) {
  431. startGmtResp = this.filter.resDate[0] + ":00";
  432. endGmtResp = this.filter.resDate[1] + ":59";
  433. }
  434. } else {
  435. startGmtResp = this.filter.resDate[0] + ":00";
  436. endGmtResp = this.filter.resDate[1] + ":59";
  437. }
  438. }
  439. const param = {
  440. current: this.inCurrentPage || this.currentPage,
  441. size: this.pageSize,
  442. patientId: this.filter.patientId.trim(), // 患者标识
  443. sceneName: this.filter.sceneName.trim(), // 服务名
  444. successFlag: this.filter.successFlag,
  445. startGmtReq: startGmtReq ? startGmtReq : null,
  446. endGmtReq: endGmtReq ? endGmtReq : null,
  447. startGmtResp: startGmtResp ? startGmtResp : null,
  448. endGmtResp: endGmtResp ? endGmtResp : null,
  449. subHospitalName: this.filter.subHospitalName.trim(), // 子院区
  450. };
  451. return param;
  452. },
  453. indexMethod(index) {
  454. return (this.currentPage - 1) * this.pageSize + index + 1;
  455. },
  456. currentChange(next) {
  457. this.currentPage = next;
  458. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  459. this.list = this.cacheData[next];
  460. } else {*/
  461. this.getDataList(1, true);
  462. //}
  463. },
  464. warning(msg, type) {
  465. this.$message({
  466. showClose: true,
  467. message: msg,
  468. type: type || "warning",
  469. });
  470. },
  471. showConfirmDialog(msg, resolve) {
  472. this.$alert(msg, "提示", {
  473. confirmButtonText: "确定",
  474. type: "warning",
  475. })
  476. .then(() => {
  477. resolve();
  478. })
  479. .catch(() => {});
  480. },
  481. showDelDialog(row, isDelete) {
  482. const params = {
  483. id: row.parId,
  484. };
  485. const txt = row.parStatus === 0 ? "重新启用" : "禁用";
  486. const warningTxt = isDelete
  487. ? "是否删除该规则?可能对现有系统造成影响"
  488. : "是否" + txt + "该条数据?";
  489. const handleFn = isDelete
  490. ? api.deleteRule
  491. : row.parStatus === 0
  492. ? api.saveRuleApply
  493. : api.deleteRuleApply;
  494. this.showConfirmDialog(warningTxt, () => {
  495. handleFn(params)
  496. .then((res) => {
  497. if (res.data.code == "0") {
  498. if (!this.searched) {
  499. //未点确认时清空搜索条件
  500. this.clearFilter();
  501. }
  502. if (isDelete) {
  503. //恢复成功后跳转到筛选条件的首页
  504. this.currentPage = 1;
  505. } else {
  506. if (this.filter.parStatus !== "" && this.list.length === 1) {
  507. //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
  508. this.currentPage =
  509. this.currentPage === 1 ? 1 : this.currentPage - 1;
  510. }
  511. }
  512. this.warning(res.data.msg || "操作成功", "success");
  513. this.getDataList();
  514. } else {
  515. this.warning(res.data.msg);
  516. }
  517. })
  518. .catch((error) => {
  519. this.warning(error);
  520. });
  521. });
  522. },
  523. clearFilter() {
  524. this.filter = {
  525. successFlag: "",
  526. patientId: "",
  527. sceneName: "",
  528. subHospitalName: "",
  529. recepDate: "", // 接收日期
  530. resDate: "", // 响应日期
  531. };
  532. },
  533. update() {
  534. const loading = this.$loading({
  535. lock: true,
  536. text: "Loading",
  537. spinner: "el-icon-loading",
  538. background: "rgba(0, 0, 0, 0.7)",
  539. });
  540. api
  541. .zskUpdateAll()
  542. .then((res) => {
  543. loading.close();
  544. if (res.data.code == "0") {
  545. this.warning("更新成功", "success");
  546. this.getDataList();
  547. } else {
  548. this.warning(res.data.msg || "更新失败,请重试");
  549. }
  550. })
  551. .catch((error) => {
  552. loading.close();
  553. this.warning("更新失败,请重试");
  554. });
  555. },
  556. },
  557. };
  558. </script>
  559. <style lang="less" scoped>
  560. @import "../../less/admin.less";
  561. /deep/ .container.knowledgeTitle {
  562. height: 80px;
  563. }
  564. /deep/ .contents.knowledgeContents {
  565. padding: 104px 20px 0;
  566. }
  567. /deep/ .secLine.el-form {
  568. float: right;
  569. display: block;
  570. position: relative;
  571. top: -5px;
  572. }
  573. .delete {
  574. color: red;
  575. }
  576. .review {
  577. color: #22ccc8;
  578. }
  579. .el-table .cell {
  580. overflow: hidden;
  581. white-space: nowrap;
  582. }
  583. #upFile {
  584. display: none !important;
  585. }
  586. .unvailable {
  587. color: #fe7d3d;
  588. &:hover {
  589. color: #f19061;
  590. }
  591. }
  592. .demo-form-inline {
  593. display: flex;
  594. justify-content: flex-end;
  595. .el-form-item:nth-child(1) {
  596. margin-right: 10px;
  597. }
  598. .el-input--mini {
  599. /deep/.el-input__inner {
  600. width: 100%;
  601. }
  602. }
  603. }
  604. .el-date-editor {
  605. .el-input {
  606. width: 150px !important;
  607. }
  608. }
  609. .secLine.el-form {
  610. position: relative;
  611. top: -10px;
  612. color: #ff0000;
  613. }
  614. .code-name {
  615. display: -webkit-box;
  616. -webkit-box-orient: vertical;
  617. -webkit-line-clamp: 1;
  618. overflow: hidden;
  619. white-space: nowrap;
  620. text-overflow: ellipsis;
  621. -o-text-overflow: ellipsis;
  622. }
  623. /deep/.el-dialog {
  624. width: 700px !important;
  625. }
  626. /deep/.el-dialog__body {
  627. overflow-y: auto;
  628. height: 505px;
  629. width: 700px;
  630. padding: 20px 0 30px;
  631. }
  632. .request-item {
  633. padding: 0 20px;
  634. }
  635. .el-time-panel__footer {
  636. /deep/.confirm{
  637. color: #48c5d7 !important;
  638. }
  639. }
  640. .active {
  641. color: #ff0000;
  642. }
  643. </style>