Lis.vue 18 KB

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