Fusion.vue 18 KB

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