Lis.vue 22 KB

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