Operation.vue 21 KB

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