Lis.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  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. e.preventDefault();
  152. let formData = new FormData();
  153. formData.append('file', fileInfo);
  154. formData.append('type', 1);
  155. const header = {
  156. headers: {
  157. 'Content-Type': 'multipart/form-data'
  158. }
  159. };
  160. const loading = this.$loading({
  161. lock: true,
  162. text: '预匹配中...',
  163. spinner: 'el-icon-loading',
  164. background: 'rgba(0, 0, 0, 0.7)'
  165. });
  166. api.dataDiseaseVerify(formData, header).then(res => {
  167. if (res.data.code === '00020007' || res.data.code === '00020004') {
  168. loading.close();
  169. this.$alert(`${res.data.msg}`, '提示', {
  170. confirmButtonText: '确定',
  171. type: 'warning'
  172. })
  173. .then(() => {})
  174. .catch(() => {});
  175. } else {
  176. api.precDiseaseDataMatch(formData, header).then(res => {
  177. setTimeout(() => {
  178. loading.close();
  179. }, 800);
  180. if (res.status === 200) {
  181. utils.downloadExportedData(
  182. res.data,
  183. '检验关联数据(预匹配).xls'
  184. );
  185. }
  186. });
  187. }
  188. });
  189. let inp = document.getElementById('upFileMatch');
  190. inp.value = '';
  191. },
  192. handleSizeChange(val) {
  193. this.pageSize = val;
  194. this.currentPage = utils.getCurrentPage(
  195. this.currentPage,
  196. this.total,
  197. this.pageSize
  198. );
  199. this.getDataList();
  200. },
  201. // 获取列表数据
  202. getDataList(isTurnPage) {
  203. const params = this.getFilterItems(isTurnPage);
  204. this.searched = true;
  205. const loading = this.$loading({
  206. lock: true,
  207. text: 'Loading',
  208. spinner: 'el-icon-loading',
  209. background: 'rgba(0, 0, 0, 0.7)'
  210. });
  211. api.getLisPage(params).then(res => {
  212. loading.close();
  213. if (res.data.code === '0') {
  214. this.list = res.data.data && res.data.data.records;
  215. }
  216. this.total = res.data.data && res.data.data.total;
  217. if (this.inCurrentPage !== undefined) {
  218. this.currentPage = this.inCurrentPage;
  219. this.inCurrentPage = undefined;
  220. }
  221. });
  222. },
  223. // 处理列表请求数据参数
  224. getFilterItems(isTurnPage) {
  225. //翻页时筛选条件没点确定则清空
  226. if (isTurnPage && !this.searched) {
  227. this.clearFilter();
  228. }
  229. const param = {
  230. current: this.inCurrentPage || this.currentPage,
  231. size: this.pageSize,
  232. hisName: this.filter.hisName.trim(),
  233. uniqueName: this.filter.uniqueName.trim(),
  234. uniqueCode: '',
  235. hisDetailName: this.filter.hisDetailName.trim(),
  236. type: 1,
  237. isMatch: this.filter.match
  238. };
  239. return param;
  240. },
  241. filterDatas() {
  242. this.currentPage = 1;
  243. this.getDataList();
  244. },
  245. addRelation() {
  246. const pam = this.searched
  247. ? {
  248. currentPage: this.currentPage,
  249. pageSize: this.pageSize,
  250. filter: this.filter
  251. }
  252. : { currentPage: this.currentPage, pageSize: this.pageSize };
  253. this.data = {};
  254. this.showModal();
  255. // this.$router.push({ name: 'AddLis', params: pam });
  256. },
  257. // 修改诊断关联-跳转至编辑页面
  258. modifyRelation(row) {
  259. const item = Object.assign({}, row);
  260. const pam = this.searched
  261. ? {
  262. currentPage: this.currentPage,
  263. pageSize: this.pageSize,
  264. filter: this.filter
  265. }
  266. : { currentPage: this.currentPage, pageSize: this.pageSize };
  267. this.data = item;
  268. this.showModal();
  269. // this.$router.push({
  270. // name: 'AddLis',
  271. // params: Object.assign(pam, { isEdit: true, data: item })
  272. // });
  273. },
  274. currentChange(next) {
  275. this.currentPage = next;
  276. this.getDataList(true);
  277. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  278. // this.list = this.cacheData[next];
  279. // } else {
  280. // this.getDataList();
  281. // }
  282. },
  283. // 清空搜索参数
  284. clearFilter() {
  285. this.filter = {
  286. hisName: '',
  287. uniqueName: '',
  288. hisDetailName: ''
  289. };
  290. },
  291. indexMethod(index) {
  292. return (this.currentPage - 1) * this.pageSize + index + 1;
  293. },
  294. getTagType(val) {
  295. return val;
  296. },
  297. warning(msg, type) {
  298. this.$message({
  299. showClose: true,
  300. message: msg,
  301. type: type || 'warning'
  302. });
  303. },
  304. showConfirmDialog(msg, resolve) {
  305. this.$confirm(msg, '提示', {
  306. confirmButtonText: '删除',
  307. cancelButtonText: '取消',
  308. cancelButtonClass: 'cancelBtn',
  309. confirmButtonClass: 'confirmC',
  310. type: 'warning'
  311. })
  312. .then(() => {
  313. resolve();
  314. })
  315. .catch(() => {});
  316. },
  317. // 删除关联
  318. showDelDialog(id) {
  319. this.showConfirmDialog('是否删除该关联?', () => {
  320. api
  321. .deleteLisRecord({ id: id })
  322. .then(res => {
  323. if (res.data.code == '0') {
  324. if (!this.searched) {
  325. //未点确认时清空搜索条件
  326. this.clearFilter();
  327. }
  328. if (this.list.length == 1) {
  329. //当前在最后一页且只有一条数据时,删除后跳到前一页
  330. this.currentPage =
  331. this.currentPage === 1 ? 1 : this.currentPage - 1;
  332. }
  333. this.getDataList();
  334. this.warning(res.data.msg || '操作成功', 'success');
  335. } else {
  336. this.warning(res.data.msg);
  337. }
  338. })
  339. .catch(error => {
  340. if (error.code === '900010001') {
  341. return false;
  342. }
  343. this.warning(error);
  344. });
  345. });
  346. },
  347. // 导出数据
  348. exportData() {
  349. this.$confirm('确定要导出全部检验关联数据吗?', '', {
  350. confirmButtonText: '确定',
  351. cancelButtonText: '取消',
  352. cancelButtonClass: 'leftbtn',
  353. customClass: 'exportBox6',
  354. title: '提示',
  355. type: 'warning'
  356. // beforeClose: (action, instance, done) => {
  357. // if (action === 'confirm') {
  358. // // instance.confirmButtonLoading = true;
  359. // instance.confirmButtonText = '导出中...';
  360. // api.exportLisRecord().then(res => {
  361. // if (res.status === 200) {
  362. // setTimeout(() => {
  363. // utils.downloadExportedData(res.data, '检验数据.xls');
  364. // done();
  365. // }, 1500);
  366. // }
  367. // });
  368. // } else {
  369. // done();
  370. // }
  371. // }
  372. })
  373. .then(() => {
  374. api
  375. .exportLisRecord({
  376. type: 1,isMatch:this.filter.match
  377. })
  378. .then(res => {
  379. if (res.status === 200) {
  380. this.$message({ message: '导出成功', type: 'success' });
  381. utils.downloadExportedData(res.data, '检验数据.xls');
  382. }
  383. });
  384. })
  385. .catch(() => {
  386. // this.$message({ message: '导出失败', type: 'waring' });
  387. });
  388. },
  389. // 导入模板
  390. exportModule() {
  391. api.exportLisModule({type:1}).then(res => {
  392. if (res.status === 200) {
  393. setTimeout(() => {
  394. utils.downloadExportedData(res.data, '检验导入模板.xls');
  395. }, 1500);
  396. }
  397. });
  398. },
  399. // 点击导入
  400. importPage() {
  401. let inp = document.getElementById('upFile');
  402. inp.click();
  403. },
  404. // 导入数据
  405. uploadFile(e) {
  406. let fileInfo = e.target.files[0];
  407. e.preventDefault();
  408. let formData = new FormData();
  409. formData.append('file', fileInfo);
  410. formData.append('type', 1);
  411. formData.append('uesrId', localStorage.getItem('uesrId'));
  412. formData.append(
  413. 'hospitalId',
  414. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  415. );
  416. const header = {
  417. headers: {
  418. 'Content-Type': 'multipart/form-data'
  419. }
  420. };
  421. this.uploadInfo = '导入中...';
  422. api.importExcelDataVerify(formData, header).then(res => {
  423. if (res.data.code === '00020004') {
  424. this.$confirm(`${res.data.msg}`, '提示1', {
  425. confirmButtonText: '确定',
  426. cancelButtonText: '取消',
  427. type: 'warning'
  428. })
  429. .then(() => {
  430. this.importLisRecord(formData, header)
  431. })
  432. .catch(() => {
  433. setTimeout(() => {
  434. this.uploadInfo = '导入';
  435. }, 300);
  436. });
  437. } else if (res.data.data === true) {
  438. this.importLisRecord(formData, header)
  439. }else {
  440. this.$alert(`${res.data.msg}`, '提示', {
  441. confirmButtonText: '确定',
  442. // cancelButtonText: '取消',
  443. // cancelButtonClass: 'cancelSure',
  444. // confirmButtonClass: 'sure',
  445. // customClass: 'exportConfirm',
  446. type: 'warning'
  447. })
  448. .then(() => {})
  449. .catch(() => {});
  450. setTimeout(() => {
  451. this.uploadInfo = '导入';
  452. }, 300);
  453. }
  454. });
  455. //解决上传相同文件不触发change
  456. let inp = document.getElementById('upFile');
  457. inp.value = '';
  458. },
  459. importLisRecord(formData, header) {
  460. api.importLisRecord(formData, header).then(res => {
  461. if (res.data.code === '00000001') {
  462. this.$alert(`数据存在异常,导入失败,请修改后再试`, '提示', {
  463. confirmButtonText: '确定',
  464. // cancelButtonText: '取消',
  465. // cancelButtonClass: 'cancelSure',
  466. // confirmButtonClass: 'sure',
  467. // customClass: 'exportConfirm',
  468. type: 'warning'
  469. })
  470. .then(() => {})
  471. .catch(() => {});
  472. this.getDataList(); // 重新获取列表
  473. setTimeout(() => {
  474. this.uploadInfo = '导入';
  475. }, 300);
  476. } else if (res.data.data === true && res.status === 200) {
  477. this.$alert(`导入成功`, '提示', {
  478. confirmButtonText: '确定',
  479. // cancelButtonText: '取消',
  480. // cancelButtonClass: 'cancelSure',
  481. // confirmButtonClass: 'sure',
  482. // customClass: 'exportConfirm',
  483. type: 'success'
  484. })
  485. .then(() => {})
  486. .catch(() => {});
  487. this.getDataList(); // 重新获取列表
  488. setTimeout(() => {
  489. this.uploadInfo = '导入';
  490. }, 300);
  491. } else {
  492. this.$alert(`${res.data.msg}`, '提示', {
  493. confirmButtonText: '确定',
  494. // cancelButtonText: '取消',
  495. // cancelButtonClass: 'cancelSure',
  496. // confirmButtonClass: 'sure',
  497. // customClass: 'exportConfirm',
  498. type: 'warning'
  499. })
  500. .then(() => {})
  501. .catch(() => {});
  502. setTimeout(() => {
  503. this.uploadInfo = '导入';
  504. }, 300);
  505. }
  506. });
  507. },
  508. /********新增编辑弹窗**********/
  509. showModal() {
  510. this.modalVisiable = true;
  511. },
  512. getMsgFormSon(data) {
  513. if (data == 'close') {
  514. this.modalVisiable = false;
  515. } else {
  516. this.modalVisiable = false;
  517. this.getDataList();
  518. }
  519. }
  520. }
  521. };
  522. </script>
  523. <style lang="less" scoped>
  524. @import '../../../less/admin.less';
  525. /deep/ .container.knowledgeTitle {
  526. height: 80px;
  527. }
  528. /deep/ .contents.knowledgeContents {
  529. padding: 104px 20px 0;
  530. }
  531. /deep/ .secLine.el-form {
  532. float: right;
  533. display: block;
  534. position: relative;
  535. top: -5px;
  536. }
  537. .delete {
  538. color: red;
  539. }
  540. #upFileMatch {
  541. display: none;
  542. }
  543. .delete:hover {
  544. color: red;
  545. }
  546. .pagination {
  547. min-width: 1010px;
  548. }
  549. .downTemplate {
  550. margin-right: 8px;
  551. span {
  552. color: #02a7f0;
  553. }
  554. }
  555. #upFile {
  556. display: none !important;
  557. }
  558. .el-message-box {
  559. /deep/.cancelBtn {
  560. background-color: #d7d7d7;
  561. border-color: transparent;
  562. }
  563. /deep/.confirmC {
  564. background-color: #ff545b !important;
  565. border-color: transparent !important;
  566. }
  567. }
  568. .exportBox6 {
  569. /deep/ .el-message-box__btns {
  570. margin-top: 20px;
  571. }
  572. /deep/ .el-message-box__message {
  573. // text-align: center;
  574. }
  575. /deep/.leftbtn {
  576. background-color: #d7d7d7;
  577. border-color: transparent !important;
  578. }
  579. /deep/ .el-message-box__header {
  580. border-bottom: 1px solid #dcdfe6;
  581. }
  582. }
  583. </style>