tcmdrome.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  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 class="selectMedicine" label="标准术语状态:">
  6. <el-select size="mini" v-model="filter.status" placeholder="请选择" clearable>
  7. <el-option
  8. v-for="item in statusList"
  9. :label="item.name"
  10. :value="item.id"
  11. :key="item.id"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="匹配状态:" class="selectMedicine">
  16. <el-select size="mini" v-model="filter.match" placeholder="请选择" clearable>
  17. <el-option v-for="item in matchList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="医院中医证候名称:">
  21. <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
  22. </el-form-item>
  23. <el-form-item label="标准中医证候名称:">
  24. <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button size="mini" @click="filterDatas">检索</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <el-form class="secLine" :inline="true">
  31. <el-form-item>
  32. <el-button type="text" class="downTemplate" @click="exportModule">导入模板下载</el-button>
  33. <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" />
  34. <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
  35. <el-button size="mini" @click="handleMatchData">预匹配</el-button>
  36. <el-button size="mini" @click="importPage" style="margin:0 10px">{{uploadInfo}}</el-button>
  37. <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
  38. <el-button size="mini" @click="exportData">导出</el-button>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  42. </el-form-item>
  43. </el-form>
  44. </crumbs>
  45. <div class="contents knowledgeContents">
  46. <el-table :data="list" border style="width: 100%">
  47. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
  48. <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
  49. <el-table-column :resizable="false" prop="hisName" label="医院中医证候名称" show-overflow-tooltip></el-table-column>
  50. <el-table-column :resizable="false" prop="code" label="中医证候代码" show-overflow-tooltip></el-table-column>
  51. <el-table-column
  52. :resizable="false"
  53. prop="uniqueName"
  54. label="标准中医证候名称"
  55. show-overflow-tooltip
  56. ></el-table-column>
  57. <el-table-column :resizable="false" prop="operate" label="匹配状态:">
  58. <template slot-scope="scope">
  59. <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column :resizable="false" prop="operate" label="标准术语状态">
  63. <template slot-scope="scope">
  64. <span v-if="scope.row.uniqueName && scope.row.uniqueName!=''">{{scope.row.status == 0?'禁用':'启用'}}</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column :resizable="false" prop="operate" label="操作">
  68. <template slot-scope="scope">
  69. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  70. <span style="margin:0 3px;">|</span>
  71. <el-button
  72. @click="showDelDialog(scope.row.id)"
  73. class="delete"
  74. type="text"
  75. size="small"
  76. >删除</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <div class="pagination pagepage">
  81. <el-pagination
  82. :current-page.sync="currentPage"
  83. @current-change="currentChange"
  84. background
  85. :page-size="pageSize"
  86. :page-sizes="pageSizeArr"
  87. @size-change="handleSizeChange"
  88. :layout="pageLayout"
  89. :total="total"
  90. ></el-pagination>
  91. </div>
  92. </div>
  93. <LtModal
  94. v-if="modalVisiable"
  95. @func="getMsgFormSon"
  96. :meal="'中医证候名称'"
  97. :standard="'中医证候名称'"
  98. :detail="'中医证候代码'"
  99. :tip="'中医证候关联'"
  100. :type="13"
  101. :data="data"
  102. ></LtModal>
  103. </div>
  104. </template>
  105. <script>
  106. import api from '@api/icss.js';
  107. import config from '@api/config.js';
  108. import utils from '@api/utils.js';
  109. import LtModal from '@components/common/LtModal';
  110. export default {
  111. name: 'Tcmdrome',
  112. data: function() {
  113. return {
  114. list: [],
  115. searched: false,
  116. filter: {
  117. hisName: '', // 医院诊断名称
  118. uniqueName: '', //标准诊断名称
  119. match: '',
  120. status:''
  121. },
  122. statusList: [
  123. { id: '', name: '全部' },
  124. { id: 1, name: '启用' },
  125. { id: 0, name: '禁用' },
  126. ],
  127. matchList: [
  128. { id: '', name: '全部' },
  129. { id: 1, name: '已匹配' },
  130. { id: 0, name: '未匹配' },
  131. { id: 2, name: '多项匹配' }
  132. ],
  133. currentPage: 1,
  134. pageSize: config.pageSize,
  135. pageSizeArr: config.pageSizeArr,
  136. pageLayout: config.pageLayout,
  137. total: 0,
  138. fileName: '',
  139. formData: {},
  140. headers: {},
  141. uploadInfo: '导入',
  142. modalVisiable: false,
  143. data: {}
  144. };
  145. },
  146. components: {
  147. LtModal
  148. },
  149. created() {
  150. const param = this.$route.params;
  151. if (param.currentPage) {
  152. this.inCurrentPage = param.currentPage;
  153. }
  154. if (param.filter) {
  155. this.filter = param.filter;
  156. }
  157. //返回时避免参数未赋值就获取列表
  158. setTimeout(() => {
  159. this.getDataList();
  160. });
  161. // 非首页 编辑页返回 设置 this.currentPage
  162. if (Object.keys(this.$route.params).length !== 0) {
  163. this.currentPage = this.$route.params.currentPage;
  164. }
  165. },
  166. watch: {
  167. filter: {
  168. handler: function() {
  169. this.searched = false;
  170. },
  171. deep: true
  172. }
  173. },
  174. methods: {
  175. // 预匹配
  176. handleMatchData() {
  177. let inp = document.getElementById('upFileMatch');
  178. inp.click();
  179. },
  180. // 导入数据
  181. uploadFileMatch(e) {
  182. let fileInfo = e.target.files[0];
  183. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  184. if (extend != 'xls' && extend != 'xlsx') {
  185. this.$message({ message: '请根据模板进行导入', type: 'error' });
  186. return;
  187. }
  188. e.preventDefault();
  189. let formData = new FormData();
  190. formData.append('file', fileInfo);
  191. formData.append('type', 13);
  192. const header = {
  193. headers: {
  194. 'Content-Type': 'multipart/form-data'
  195. }
  196. };
  197. const loading = this.$loading({
  198. lock: true,
  199. text: '预匹配中...',
  200. spinner: 'el-icon-loading',
  201. background: 'rgba(0, 0, 0, 0.7)'
  202. });
  203. api.dataDiseaseVerify(formData, header).then(res => {
  204. if (res.data.code === '00020007' || res.data.code === '00020004') {
  205. loading.close();
  206. this.$alert(`${res.data.msg}`, '提示', {
  207. confirmButtonText: '确定',
  208. type: 'warning'
  209. })
  210. .then(() => {})
  211. .catch(() => {});
  212. } else {
  213. api.precDiseaseDataMatch(formData, header).then(res => {
  214. setTimeout(() => {
  215. loading.close();
  216. }, 800);
  217. if (res.status === 200) {
  218. utils.downloadExportedData(
  219. res.data,
  220. '中医证候关联数据(预匹配).xls'
  221. );
  222. }
  223. });
  224. }
  225. });
  226. let inp = document.getElementById('upFileMatch');
  227. inp.value = '';
  228. },
  229. handleSizeChange(val) {
  230. this.pageSize = val;
  231. this.currentPage = utils.getCurrentPage(
  232. this.currentPage,
  233. this.total,
  234. this.pageSize
  235. );
  236. this.getDataList();
  237. },
  238. // 获取列表数据
  239. getDataList(isTurnPage) {
  240. const params = this.getFilterItems(isTurnPage);
  241. this.searched = true;
  242. const loading = this.$loading({
  243. lock: true,
  244. text: 'Loading',
  245. spinner: 'el-icon-loading',
  246. background: 'rgba(0, 0, 0, 0.7)'
  247. });
  248. api.getTcmsyndromePage(params).then(res => {
  249. loading.close();
  250. if (res.data.code === '0') {
  251. this.list = res.data.data && res.data.data.records;
  252. }
  253. this.total = res.data.data && res.data.data.total;
  254. if (this.inCurrentPage !== undefined) {
  255. this.currentPage = this.inCurrentPage;
  256. this.inCurrentPage = undefined;
  257. }
  258. });
  259. },
  260. // 处理列表请求数据参数
  261. getFilterItems(isTurnPage) {
  262. //翻页时筛选条件没点确定则清空
  263. if (isTurnPage && !this.searched) {
  264. this.clearFilter();
  265. }
  266. const param = {
  267. current: this.inCurrentPage || this.currentPage,
  268. size: this.pageSize,
  269. hisName: this.filter.hisName.trim(),
  270. uniqueName: this.filter.uniqueName.trim(),
  271. uniqueCode: '',
  272. type: 13,
  273. isMatch: this.filter.match,
  274. status:this.filter.status
  275. };
  276. return param;
  277. },
  278. filterDatas() {
  279. this.currentPage = 1;
  280. this.getDataList();
  281. },
  282. addRelation() {
  283. const pam = this.searched
  284. ? {
  285. currentPage: this.currentPage,
  286. pageSize: this.pageSize,
  287. filter: this.filter
  288. }
  289. : { currentPage: this.currentPage, pageSize: this.pageSize };
  290. this.data = {};
  291. this.showModal();
  292. // this.$router.push({ name: 'AddTcmdrome', params: pam });
  293. },
  294. // 修改诊断关联-跳转至编辑页面
  295. modifyRelation(row) {
  296. const item = Object.assign({}, row);
  297. const pam = this.searched
  298. ? {
  299. currentPage: this.currentPage,
  300. pageSize: this.pageSize,
  301. filter: this.filter
  302. }
  303. : { currentPage: this.currentPage, pageSize: this.pageSize };
  304. this.data = item;
  305. this.showModal();
  306. // this.$router.push({
  307. // name: 'AddTcmdrome',
  308. // params: Object.assign(pam, { isEdit: true, data: item })
  309. // });
  310. },
  311. currentChange(next) {
  312. this.currentPage = next;
  313. this.getDataList(true);
  314. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  315. // this.list = this.cacheData[next];
  316. // } else {
  317. // this.getDataList();
  318. // }
  319. },
  320. // 清空搜索参数
  321. clearFilter() {
  322. this.filter = {
  323. hisName: '',
  324. uniqueName: ''
  325. };
  326. },
  327. indexMethod(index) {
  328. return (this.currentPage - 1) * this.pageSize + index + 1;
  329. },
  330. getTagType(val) {
  331. return val;
  332. },
  333. warning(msg, type) {
  334. this.$message({
  335. showClose: true,
  336. message: msg,
  337. type: type || 'warning'
  338. });
  339. },
  340. showConfirmDialog(msg, resolve) {
  341. this.$confirm(msg, '提示', {
  342. confirmButtonText: '删除',
  343. cancelButtonText: '取消',
  344. cancelButtonClass: 'cancelBtn',
  345. confirmButtonClass: 'confirmC',
  346. type: 'warning'
  347. })
  348. .then(() => {
  349. resolve();
  350. })
  351. .catch(() => {});
  352. },
  353. // 删除关联
  354. showDelDialog(id) {
  355. this.showConfirmDialog('是否删除该关联?', () => {
  356. api
  357. .deleteTcmdromeRecord({ id: id })
  358. .then(res => {
  359. if (res.data.code == '0') {
  360. if (!this.searched) {
  361. //未点确认时清空搜索条件
  362. this.clearFilter();
  363. }
  364. if (this.list.length == 1) {
  365. //当前在最后一页且只有一条数据时,删除后跳到前一页
  366. this.currentPage =
  367. this.currentPage === 1 ? 1 : this.currentPage - 1;
  368. }
  369. this.getDataList();
  370. this.warning(res.data.msg || '操作成功', 'success');
  371. } else {
  372. this.warning(res.data.msg);
  373. }
  374. })
  375. .catch(error => {
  376. if (error.code === '900010001') {
  377. return false;
  378. }
  379. this.warning(error);
  380. });
  381. });
  382. },
  383. // 导出数据
  384. exportData() {
  385. this.$confirm('确定要导出全部中医证候关联数据吗?', '', {
  386. confirmButtonText: '确定',
  387. cancelButtonText: '取消',
  388. cancelButtonClass: 'leftbtn',
  389. customClass: 'exportBox6',
  390. title: '提示',
  391. type: 'warning'
  392. // beforeClose: (action, instance, done) => {
  393. // if (action === 'confirm') {
  394. // // instance.confirmButtonLoading = true;
  395. // // instance.confirmButtonText = '导出中...';
  396. // done()
  397. // api.exportDeptRecord().then(res => {
  398. // if (res.status === 200) {
  399. // setTimeout(() => {
  400. // utils.downloadExportedData(res.data, '科室关联数据.xls');
  401. // // done();
  402. // }, 1500);
  403. // }
  404. // });
  405. // } else {
  406. // done();
  407. // }
  408. // }
  409. })
  410. .then(() => {
  411. api
  412. .exportTcmdromeRecord({ type: 13, isMatch: this.filter.match })
  413. .then(res => {
  414. if (res.status === 200) {
  415. this.$message({ message: '导出成功', type: 'success' });
  416. utils.downloadExportedData(res.data, '中医证候关联数据.xls');
  417. }
  418. });
  419. })
  420. .catch(() => {});
  421. },
  422. // 导入模板
  423. exportModule() {
  424. api.exportTcmdromeModule({ type: 13 }).then(res => {
  425. if (res.status === 200) {
  426. setTimeout(() => {
  427. utils.downloadExportedData(res.data, '中医证候导入模板.xls');
  428. }, 1500);
  429. }
  430. });
  431. },
  432. // 点击导入
  433. importPage() {
  434. let inp = document.getElementById('upFile');
  435. inp.click();
  436. },
  437. // 导入数据
  438. uploadFile(e) {
  439. let fileInfo = e.target.files[0];
  440. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  441. if (extend != 'xls' && extend != 'xlsx') {
  442. this.$message({ message: '请根据模板进行导入', type: 'error' });
  443. return;
  444. }
  445. // this.fileName = e.target.files[0].name; // 表单同步显示
  446. e.preventDefault();
  447. let formData = new FormData();
  448. formData.append('file', fileInfo);
  449. formData.append('type', 13);
  450. formData.append('uesrId', localStorage.getItem('uesrId'));
  451. formData.append(
  452. 'hospitalId',
  453. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  454. );
  455. const header = {
  456. headers: {
  457. 'Content-Type': 'multipart/form-data'
  458. }
  459. };
  460. this.importTcmdromeRecord(formData, header);
  461. // this.uploadInfo = '导入中...';
  462. // api.importExcelDataVerify(formData, header).then(res => {
  463. // if (res.data.code === '00020001') {
  464. // this.$confirm(`${res.data.msg}`, '提示', {
  465. // confirmButtonText: '确定',
  466. // cancelButtonText: '取消',
  467. // type: 'warning'
  468. // })
  469. // .then(() => {
  470. // this.importTcmdromeRecord(formData, header);
  471. // })
  472. // .catch(() => {
  473. // setTimeout(() => {
  474. // this.uploadInfo = '导入';
  475. // }, 300);
  476. // });
  477. // } else if (res.data.data === true) {
  478. // this.importTcmdromeRecord(formData, header);
  479. // }else {
  480. // this.$alert(`${res.data.msg}`, '提示', {
  481. // confirmButtonText: '确定',
  482. // // cancelButtonText: '取消',
  483. // // cancelButtonClass: 'cancelSure',
  484. // // confirmButtonClass: 'sure',
  485. // // customClass: 'exportConfirm',
  486. // type: 'warning'
  487. // })
  488. // .then(() => {})
  489. // .catch(() => {});
  490. // setTimeout(() => {
  491. // this.uploadInfo = '导入';
  492. // }, 300);
  493. // }
  494. // });
  495. //解决上传相同文件不触发change
  496. let inp = document.getElementById('upFile');
  497. inp.value = '';
  498. },
  499. importTcmdromeRecord(formData, header) {
  500. let that = this
  501. api.importTcmdromeRecord(formData, header).then(res => {
  502. if (res.headers['content-disposition']) {
  503. this.downloadUrl(res);
  504. this.getDataList();
  505. } else {
  506. let r = new FileReader();
  507. r.onload = function() {
  508. const code = JSON.parse(this.result);
  509. if (code.code === '00020004') {
  510. that
  511. .$alert(`${code.msg}`, '提示', {
  512. confirmButtonText: '确定',
  513. // cancelButtonText: '取消',
  514. // cancelButtonClass: 'cancelSure',
  515. // confirmButtonClass: 'sure',
  516. // customClass: 'exportConfirm',
  517. type: 'warning'
  518. })
  519. .then(() => {})
  520. .catch(() => {});
  521. } else {
  522. that.$alert(`导入成功`, '提示', {
  523. confirmButtonText: '确定',
  524. // cancelButtonText: '取消',
  525. // cancelButtonClass: 'cancelSure',
  526. // confirmButtonClass: 'sure',
  527. // customClass: 'exportConfirm',
  528. type: 'success'
  529. });
  530. that.getDataList();
  531. }
  532. };
  533. r.readAsText(res.data);
  534. }
  535. // if (res.data.code === '00000001') {
  536. // this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
  537. // confirmButtonText: '确定',
  538. // // cancelButtonText: '取消',
  539. // cancelButtonClass: 'cancelSure',
  540. // confirmButtonClass: 'sure',
  541. // customClass: 'exportConfirm',
  542. // type: 'warning'
  543. // })
  544. // .then(() => {})
  545. // .catch(() => {});
  546. // this.getDataList(); // 重新获取列表
  547. // setTimeout(() => {
  548. // this.uploadInfo = '导入';
  549. // }, 300);
  550. // } else if (res.data.data === true && res.status === 200) {
  551. // this.$confirm(`导入成功`, '提示', {
  552. // confirmButtonText: '确定',
  553. // // cancelButtonText: '取消',
  554. // cancelButtonClass: 'cancelSure',
  555. // confirmButtonClass: 'sure',
  556. // customClass: 'exportConfirm',
  557. // type: 'success'
  558. // })
  559. // .then(() => {})
  560. // .catch(() => {});
  561. // this.getDataList(); // 重新获取列表
  562. // setTimeout(() => {
  563. // this.uploadInfo = '导入';
  564. // }, 300);
  565. // } else {
  566. // this.$confirm(`${res.data.msg}`, '提示', {
  567. // confirmButtonText: '确定',
  568. // // cancelButtonText: '取消',
  569. // cancelButtonClass: 'cancelSure',
  570. // confirmButtonClass: 'sure',
  571. // customClass: 'exportConfirm',
  572. // type: 'warning'
  573. // })
  574. // .then(() => {})
  575. // .catch(() => {});
  576. // setTimeout(() => {
  577. // this.uploadInfo = '导入';
  578. // }, 300);
  579. // }
  580. });
  581. },
  582. downloadUrl(res) {
  583. var disposition = res.headers['content-disposition'];
  584. var fileName = decodeURI(
  585. disposition.split('filename=')[1].split(';filename*=')[0]
  586. );
  587. let blob = new Blob([res.data], { type: 'application/.xls' }); //.xls是我和后台约定好的文件格式
  588. let link = document.createElement('a');
  589. link.href = window.URL.createObjectURL(blob);
  590. link.download = fileName;
  591. link.click();
  592. link.remove();
  593. },
  594. /********新增编辑弹窗**********/
  595. showModal() {
  596. this.modalVisiable = true;
  597. },
  598. getMsgFormSon(data) {
  599. if (data == 'close') {
  600. this.modalVisiable = false;
  601. } else {
  602. this.modalVisiable = false;
  603. this.getDataList();
  604. }
  605. }
  606. }
  607. };
  608. </script>
  609. <style lang="less" scoped>
  610. @import '../../../less/admin.less';
  611. /deep/ .container.knowledgeTitle {
  612. height: 80px;
  613. }
  614. /deep/ .contents.knowledgeContents {
  615. padding: 104px 20px 0;
  616. }
  617. /deep/ .secLine.el-form {
  618. float: right;
  619. display: block;
  620. position: relative;
  621. top: -5px;
  622. }
  623. .delete {
  624. color: red;
  625. }
  626. .delete:hover {
  627. color: red;
  628. }
  629. .pagination {
  630. min-width: 1010px;
  631. }
  632. .downTemplate {
  633. margin-right: 8px;
  634. span {
  635. color: #02a7f0;
  636. }
  637. }
  638. #upFile {
  639. display: none !important;
  640. }
  641. .el-message-box {
  642. /deep/.cancelBtn {
  643. background-color: #d7d7d7;
  644. border-color: transparent;
  645. }
  646. /deep/.confirmC {
  647. background-color: #ff545b !important;
  648. border-color: transparent !important;
  649. }
  650. /deep/.el-message-box__header {
  651. border-bottom: 1px solid #dcdfe6;
  652. }
  653. }
  654. .exportBox6 {
  655. /deep/ .el-message-box__btns {
  656. margin-top: 20px;
  657. }
  658. /deep/ .el-message-box__message {
  659. // text-align: center;
  660. }
  661. /deep/.leftbtn {
  662. background-color: #d7d7d7;
  663. border-color: transparent !important;
  664. }
  665. /deep/ .el-message-box__header {
  666. border-bottom: 1px solid #dcdfe6;
  667. }
  668. }
  669. .exportConfirm {
  670. .cancelSure {
  671. display: none;
  672. }
  673. }
  674. #upFileMatch {
  675. display: none;
  676. }
  677. </style>