Lis.vue 19 KB

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