Operation.vue 21 KB

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