Fusion.vue 16 KB

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