Fusion.vue 19 KB

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