CallRecordManager.vue 16 KB

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