Hemp.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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 class="selectMedicine" label="标准术语状态:">
  6. <el-select size="mini" v-model="filter.status" placeholder="请选择">
  7. <el-option
  8. v-for="item in statusList"
  9. :label="item.name"
  10. :value="item.id"
  11. :key="item.id"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="匹配状态:" class="selectMedicine">
  16. <el-select size="mini" v-model="filter.match" placeholder="请选择">
  17. <el-option v-for="item in matchList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="医院麻醉名称:">
  21. <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
  22. </el-form-item>
  23. <el-form-item label="标准麻醉名称:">
  24. <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button size="mini" @click="filterDatas">检索</el-button>
  28. </el-form-item>
  29. </el-form>
  30. <el-form class="secLine" :inline="true">
  31. <el-form-item>
  32. <el-button type="text" class="downTemplate" @click="exportModule">导入模板下载</el-button>
  33. <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" />
  34. <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
  35. <el-button size="mini" @click="handleMatchData">预匹配</el-button>
  36. <el-button size="mini" @click="importPage" style="margin:0 10px">{{uploadInfo}}</el-button>
  37. <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
  38. <el-button size="mini" @click="exportData">导出</el-button>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  42. </el-form-item>
  43. </el-form>
  44. </crumbs>
  45. <div class="contents knowledgeContents">
  46. <el-table :data="list" border style="width: 100%">
  47. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
  48. <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
  49. <el-table-column :resizable="false" prop="hisName" 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
  54. v-if="scope.row.uniqueName && scope.row.uniqueName!=''"
  55. >{{scope.row.status == 0?'禁用':'启用'}}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column :resizable="false" prop="operate" label="匹配状态">
  59. <template slot-scope="scope">
  60. <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column :resizable="false" prop="operate" label="操作">
  64. <template slot-scope="scope">
  65. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  66. <span style="margin:0 3px;">|</span>
  67. <el-button
  68. @click="showDelDialog(scope.row.id)"
  69. class="delete"
  70. type="text"
  71. size="small"
  72. >删除</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <div class="pagination pagepage">
  77. <el-pagination
  78. :current-page.sync="currentPage"
  79. @current-change="currentChange"
  80. background
  81. :page-size="pageSize"
  82. :page-sizes="pageSizeArr"
  83. @size-change="handleSizeChange"
  84. :layout="pageLayout"
  85. :total="total"
  86. ></el-pagination>
  87. </div>
  88. </div>
  89. <LtModal
  90. v-if="modalVisiable"
  91. @func="getMsgFormSon"
  92. :meal="'麻醉类型'"
  93. :standard="'麻醉类型'"
  94. :tip="'麻醉关联'"
  95. :type="14"
  96. :data="data"
  97. ></LtModal>
  98. </div>
  99. </template>
  100. <script>
  101. import api from '@api/icss.js';
  102. import config from '@api/config.js';
  103. import utils from '@api/utils.js';
  104. import LtModal from '@components/common/LtModal';
  105. export default {
  106. name: 'Fusion', //化验大小项和公表维护
  107. data: function() {
  108. return {
  109. list: [],
  110. matchList: [
  111. { id: '', name: '全部' },
  112. { id: 1, name: '已匹配' },
  113. { id: 0, name: '未匹配' },
  114. { id: 2, name: '多项匹配' }
  115. ],
  116. statusList: [
  117. { id: '', name: '全部' },
  118. { id: 1, name: '启用' },
  119. { id: 0, name: '禁用' }
  120. ],
  121. searched: false,
  122. filter: {
  123. hisName: '', // 医院诊断名称
  124. uniqueName: '', //标准诊断名称
  125. match: '',
  126. status: ''
  127. },
  128. currentPage: 1,
  129. pageSize: config.pageSize,
  130. pageSizeArr: config.pageSizeArr,
  131. pageLayout: config.pageLayout,
  132. total: 0,
  133. uploadInfo: '导入',
  134. modalVisiable: false,
  135. data: {}
  136. };
  137. },
  138. components: {
  139. LtModal
  140. },
  141. created() {
  142. const param = this.$route.params;
  143. if (param.currentPage) {
  144. this.inCurrentPage = param.currentPage;
  145. }
  146. if (param.filter) {
  147. this.filter = param.filter;
  148. }
  149. //返回时避免参数未赋值就获取列表
  150. setTimeout(() => {
  151. this.getDataList();
  152. });
  153. },
  154. watch: {
  155. filter: {
  156. handler: function() {
  157. this.searched = false;
  158. },
  159. deep: true
  160. }
  161. },
  162. methods: {
  163. // 预匹配
  164. handleMatchData() {
  165. let inp = document.getElementById('upFileMatch');
  166. inp.click();
  167. },
  168. // 导入数据
  169. uploadFileMatch(e) {
  170. let fileInfo = e.target.files[0];
  171. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  172. if (extend != 'xls' && extend != 'xlsx') {
  173. this.$message({ message: '请根据模板进行导入', type: 'error' });
  174. return;
  175. }
  176. e.preventDefault();
  177. let formData = new FormData();
  178. formData.append('file', fileInfo);
  179. formData.append('type', 14);
  180. const header = {
  181. headers: {
  182. 'Content-Type': 'multipart/form-data'
  183. }
  184. };
  185. const loading = this.$loading({
  186. lock: true,
  187. text: '预匹配中...',
  188. spinner: 'el-icon-loading',
  189. background: 'rgba(0, 0, 0, 0.7)'
  190. });
  191. api.dataDiseaseVerify(formData, header).then(res => {
  192. if (res.data.code === '00020007' || res.data.code === '00020004') {
  193. loading.close();
  194. this.$alert(`${res.data.msg}`, '提示', {
  195. confirmButtonText: '确定',
  196. type: 'warning'
  197. })
  198. .then(() => {})
  199. .catch(() => {})
  200. } else {
  201. api.precDiseaseDataMatch(formData, header).then(res => {
  202. setTimeout(() => {
  203. loading.close();
  204. }, 800);
  205. if (res.status === 200) {
  206. utils.downloadExportedData(
  207. res.data,
  208. '麻醉关联数据(预匹配).xls'
  209. );
  210. }
  211. });
  212. }
  213. });
  214. let inp = document.getElementById('upFileMatch');
  215. inp.value = '';
  216. },
  217. handleSizeChange(val) {
  218. this.pageSize = val;
  219. this.currentPage = utils.getCurrentPage(
  220. this.currentPage,
  221. this.total,
  222. this.pageSize
  223. );
  224. this.getDataList();
  225. },
  226. // 获取列表数据
  227. getDataList(isTurnPage) {
  228. const params = this.getFilterItems(isTurnPage);
  229. this.searched = true;
  230. const loading = this.$loading({
  231. lock: true,
  232. text: 'Loading',
  233. spinner: 'el-icon-loading',
  234. background: 'rgba(0, 0, 0, 0.7)'
  235. });
  236. api.getFusionPage(params).then(res => {
  237. loading.close();
  238. if (res.data.code === '0') {
  239. this.list = res.data.data && res.data.data.records;
  240. console.log('麻醉列表数据:', this.list);
  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. //翻页时筛选条件没点确定则清空
  252. if (isTurnPage && !this.searched) {
  253. this.clearFilter();
  254. }
  255. const param = {
  256. current: this.inCurrentPage || this.currentPage,
  257. size: this.pageSize,
  258. hisName: this.filter.hisName.trim(),
  259. uniqueName: this.filter.uniqueName.trim(),
  260. uniqueCode: '',
  261. type: 14,
  262. isMatch: this.filter.match,
  263. status: this.filter.status
  264. };
  265. return param;
  266. },
  267. filterDatas() {
  268. this.currentPage = 1;
  269. this.getDataList();
  270. },
  271. addRelation() {
  272. const pam = this.searched
  273. ? {
  274. currentPage: this.currentPage,
  275. pageSize: this.pageSize,
  276. filter: this.filter
  277. }
  278. : { currentPage: this.currentPage, pageSize: this.pageSize };
  279. // this.$router.push({ name: 'AddFusion', params: pam });
  280. this.data = {};
  281. this.showModal();
  282. },
  283. // 修改诊断关联-跳转至编辑页面
  284. modifyRelation(row) {
  285. const item = Object.assign({}, row);
  286. const pam = this.searched
  287. ? {
  288. currentPage: this.currentPage,
  289. pageSize: this.pageSize,
  290. filter: this.filter
  291. }
  292. : { currentPage: this.currentPage, pageSize: this.pageSize };
  293. // this.$router.push({
  294. // name: 'AddFusion',
  295. // params: Object.assign(pam, { isEdit: true, data: item })
  296. // });
  297. this.data = item;
  298. this.showModal();
  299. },
  300. currentChange(next) {
  301. this.currentPage = next;
  302. this.getDataList(true);
  303. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  304. // this.list = this.cacheData[next];
  305. // } else {
  306. // this.getDataList();
  307. // }
  308. },
  309. // 清空搜索参数
  310. clearFilter() {
  311. this.filter = {
  312. hisName: '',
  313. uniqueName: ''
  314. };
  315. },
  316. indexMethod(index) {
  317. return (this.currentPage - 1) * this.pageSize + index + 1;
  318. },
  319. getTagType(val) {
  320. return val;
  321. },
  322. warning(msg, type) {
  323. this.$message({
  324. showClose: true,
  325. message: msg,
  326. type: type || 'warning'
  327. });
  328. },
  329. showConfirmDialog(msg, resolve) {
  330. this.$confirm(msg, '提示', {
  331. confirmButtonText: '删除',
  332. cancelButtonText: '取消',
  333. cancelButtonClass: 'cancelBtn',
  334. confirmButtonClass: 'confirmC',
  335. type: 'warning'
  336. })
  337. .then(() => {
  338. resolve();
  339. })
  340. .catch(() => {});
  341. },
  342. // 删除关联
  343. showDelDialog(id) {
  344. this.showConfirmDialog('是否删除该关联?', () => {
  345. api
  346. .deleteFusionRecord({ id: id })
  347. .then(res => {
  348. if (res.data.code == '0') {
  349. if (!this.searched) {
  350. //未点确认时清空搜索条件
  351. this.clearFilter();
  352. }
  353. if (this.list.length == 1) {
  354. //当前在最后一页且只有一条数据时,删除后跳到前一页
  355. this.currentPage =
  356. this.currentPage === 1 ? 1 : this.currentPage - 1;
  357. }
  358. this.getDataList();
  359. this.warning(res.data.msg || '操作成功', 'success');
  360. } else {
  361. this.warning(res.data.msg);
  362. }
  363. })
  364. .catch(error => {
  365. if (error.code === '900010001') {
  366. return false;
  367. }
  368. this.warning(error);
  369. });
  370. });
  371. },
  372. // 导出数据
  373. exportData() {
  374. this.$confirm('确定要导出全部麻醉关联数据吗?', '', {
  375. confirmButtonText: '确定',
  376. cancelButtonText: '取消',
  377. cancelButtonClass: 'leftbtn',
  378. customClass: 'exportBox6',
  379. title: '提示',
  380. type: 'warning'
  381. // beforeClose: (action, instance, done) => {
  382. // if (action === 'confirm') {
  383. // // instance.confirmButtonLoading = true;
  384. // instance.confirmButtonText = '导出中...';
  385. // api.exportFusionRecord().then(res => {
  386. // if (res.status === 200) {
  387. // setTimeout(() => {
  388. // utils.downloadExportedData(res.data, '麻醉关联数据.xls');
  389. // done();
  390. // }, 1500);
  391. // }
  392. // });
  393. // } else {
  394. // done();
  395. // }
  396. // }
  397. })
  398. .then(() => {
  399. api
  400. .exportFusionRecord({ type: 14, isMatch: this.filter.match })
  401. .then(res => {
  402. if (res.status === 200) {
  403. this.$message({ message: '导出成功', type: 'success' });
  404. utils.downloadExportedData(res.data, '麻醉关联数据.xls');
  405. }
  406. });
  407. })
  408. .catch(() => {
  409. // this.$message({ message: '导出失败', type: 'waring' });
  410. });
  411. },
  412. // 导入模板
  413. exportModule() {
  414. api.exportFusionModule({ type: 14 }).then(res => {
  415. if (res.status === 200) {
  416. setTimeout(() => {
  417. utils.downloadExportedData(res.data, '麻醉导入模板.xls');
  418. }, 1500);
  419. }
  420. });
  421. },
  422. // 点击导入
  423. importPage() {
  424. let inp = document.getElementById('upFile');
  425. inp.click();
  426. },
  427. // 导入数据
  428. uploadFile(e) {
  429. let fileInfo = e.target.files[0];
  430. let extend = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);
  431. if (extend != 'xls' && extend != 'xlsx') {
  432. this.$message({ message: '请根据模板进行导入', type: 'error' });
  433. return;
  434. }
  435. e.preventDefault();
  436. let formData = new FormData();
  437. formData.append('file', fileInfo);
  438. formData.append('type', 14);
  439. formData.append('uesrId', localStorage.getItem('uesrId'));
  440. formData.append(
  441. 'hospitalId',
  442. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  443. );
  444. const header = {
  445. headers: {
  446. 'Content-Type': 'multipart/form-data'
  447. }
  448. };
  449. this.importFusionRecord(formData, header);
  450. // this.uploadInfo = '导入中...';
  451. // api.importExcelDataVerify(formData, header).then(res => {
  452. // if (res.data.code === '00020001') {
  453. // this.$confirm(`${res.data.msg}`, '提示', {
  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. let that = this;
  490. api.importFusionRecord(formData, header).then(res => {
  491. if (res.headers['content-disposition']) {
  492. this.downloadUrl(res);
  493. this.getDataList();
  494. } else {
  495. let r = new FileReader();
  496. r.onload = function() {
  497. if (this.result) {
  498. const code = JSON.parse(this.result);
  499. if (code.code === '00020004' || code.code === '00020007') {
  500. that
  501. .$alert(`${code.msg}`, '提示', {
  502. confirmButtonText: '确定',
  503. // cancelButtonText: '取消',
  504. // cancelButtonClass: 'cancelSure',
  505. // confirmButtonClass: 'sure',
  506. // customClass: 'exportConfirm',
  507. type: 'warning'
  508. })
  509. .then(() => {})
  510. .catch(() => {});
  511. }
  512. } else {
  513. that.$alert(`导入成功`, '提示', {
  514. confirmButtonText: '确定',
  515. // cancelButtonText: '取消',
  516. // cancelButtonClass: 'cancelSure',
  517. // confirmButtonClass: 'sure',
  518. // customClass: 'exportConfirm',
  519. type: 'success'
  520. });
  521. that.getDataList();
  522. }
  523. };
  524. r.readAsText(res.data);
  525. }
  526. // if (res.data.code === '00000001') {
  527. // this.$confirm(`医院术语字符数超出最大数量,请修改后再试`, '提示', {
  528. // confirmButtonText: '确定',
  529. // // cancelButtonText: '取消',
  530. // cancelButtonClass: 'cancelSure',
  531. // confirmButtonClass: 'sure',
  532. // customClass: 'exportConfirm',
  533. // type: 'warning'
  534. // })
  535. // .then(() => {})
  536. // .catch(() => {});
  537. // this.getDataList(); // 重新获取列表
  538. // setTimeout(() => {
  539. // this.uploadInfo = '导入';
  540. // }, 300);
  541. // } else if (res.data.data === true && res.status === 200) {
  542. // this.$confirm(`导入成功`, '提示', {
  543. // confirmButtonText: '确定',
  544. // // cancelButtonText: '取消',
  545. // cancelButtonClass: 'cancelSure',
  546. // confirmButtonClass: 'sure',
  547. // customClass: 'exportConfirm',
  548. // type: 'success'
  549. // })
  550. // .then(() => {})
  551. // .catch(() => {});
  552. // this.getDataList(); // 重新获取列表
  553. // setTimeout(() => {
  554. // this.uploadInfo = '导入';
  555. // }, 300);
  556. // } else {
  557. // this.$confirm(`${res.data.msg}`, '提示', {
  558. // confirmButtonText: '确定',
  559. // // cancelButtonText: '取消',
  560. // cancelButtonClass: 'cancelSure',
  561. // confirmButtonClass: 'sure',
  562. // customClass: 'exportConfirm',
  563. // type: 'warning'
  564. // })
  565. // .then(() => {})
  566. // .catch(() => {});
  567. // setTimeout(() => {
  568. // this.uploadInfo = '导入';
  569. // }, 300);
  570. // }
  571. });
  572. },
  573. downloadUrl(res) {
  574. var disposition = res.headers['content-disposition'];
  575. var fileName = decodeURI(
  576. disposition.split('filename=')[1].split(';filename*=')[0]
  577. );
  578. let blob = new Blob([res.data], { type: 'application/.xls' }); //.xls是我和后台约定好的文件格式
  579. let link = document.createElement('a');
  580. link.href = window.URL.createObjectURL(blob);
  581. link.download = fileName;
  582. link.click();
  583. link.remove();
  584. },
  585. /********新增编辑弹窗**********/
  586. showModal() {
  587. this.modalVisiable = true;
  588. },
  589. getMsgFormSon(data) {
  590. if (data == 'close') {
  591. this.modalVisiable = false;
  592. } else {
  593. this.modalVisiable = false;
  594. this.getDataList();
  595. }
  596. }
  597. }
  598. };
  599. </script>
  600. <style lang="less" scoped>
  601. @import '../../../less/admin.less';
  602. /deep/ .container.knowledgeTitle {
  603. height: 80px;
  604. }
  605. /deep/ .contents.knowledgeContents {
  606. padding: 104px 20px 0;
  607. }
  608. /deep/ .secLine.el-form {
  609. float: right;
  610. display: block;
  611. position: relative;
  612. top: -5px;
  613. }
  614. .delete {
  615. color: red;
  616. }
  617. .delete:hover {
  618. color: red;
  619. }
  620. .pagination {
  621. min-width: 1010px;
  622. }
  623. .downTemplate {
  624. margin-right: 8px;
  625. span {
  626. color: #02a7f0;
  627. }
  628. }
  629. #upFile {
  630. display: none !important;
  631. }
  632. .el-message-box {
  633. /deep/.cancelBtn {
  634. background-color: #d7d7d7;
  635. border-color: transparent;
  636. }
  637. /deep/.confirmC {
  638. background-color: #ff545b !important;
  639. border-color: transparent !important;
  640. }
  641. }
  642. .exportBox6 {
  643. /deep/ .el-message-box__btns {
  644. margin-top: 20px;
  645. }
  646. /deep/ .el-message-box__message {
  647. // text-align: center;
  648. }
  649. /deep/.leftbtn {
  650. background-color: #d7d7d7;
  651. border-color: transparent !important;
  652. }
  653. /deep/ .el-message-box__header {
  654. border-bottom: 1px solid #dcdfe6;
  655. }
  656. }
  657. #upFileMatch {
  658. display: none;
  659. }
  660. </style>