Lis.vue 20 KB

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