Operation.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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
  47. :resizable="false"
  48. prop="code"
  49. label="手术/操作代码"
  50. show-overflow-tooltip
  51. ></el-table-column>
  52. <el-table-column
  53. :resizable="false"
  54. prop="uniqueName"
  55. label="标准手术/操作名称"
  56. show-overflow-tooltip
  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="6"
  96. :hospitalId="hospitalId"
  97. :data="data"
  98. ></LtModal>
  99. </div>
  100. </template>
  101. <script>
  102. import api from '@api/cdss.js';
  103. import config from '@api/config.js';
  104. import utils from '@api/utils.js';
  105. import LtModal from '@base/LtModal';
  106. export default {
  107. name: 'Operation', //化验大小项和公表维护
  108. data: function() {
  109. return {
  110. list: [],
  111. searched: false,
  112. filter: {
  113. hisName: '', // 医院诊断名称
  114. uniqueName: '', //标准诊断名称
  115. match: ''
  116. },
  117. matchList: [
  118. { id: '', name: '全部' },
  119. { id: 1, name: '已匹配' },
  120. { id: 0, name: '未匹配' },
  121. { id: 2, name: '多项匹配' }
  122. ],
  123. currentPage: 1,
  124. pageSize: config.pageSize,
  125. pageSizeArr: config.pageSizeArr,
  126. pageLayout: config.pageLayout,
  127. total: 0,
  128. uploadInfo: '导入',
  129. title: '手术/操作关联维护 | ',
  130. hospitaiName: '',
  131. hospitalId: '',
  132. modalVisiable: false,
  133. data: {}
  134. };
  135. },
  136. components: {
  137. LtModal
  138. },
  139. created() {
  140. const { data } = this.$route.params;
  141. this.hospitaiName = (data && data.name) || '';
  142. this.hospitalId = data && data.hospitalId;
  143. const that = this;
  144. //返回时避免参数未赋值就获取列表
  145. setTimeout(function() {
  146. that.getDataList();
  147. });
  148. // 非首页 编辑页返回 设置 this.currentPage
  149. if (Object.keys(this.$route.params).length !== 0) {
  150. this.currentPage = this.$route.params.currentPage;
  151. }
  152. },
  153. watch: {
  154. filter: {
  155. handler: function() {
  156. this.searched = false;
  157. },
  158. deep: true
  159. }
  160. },
  161. beforeRouteEnter(to, from, next) {
  162. next(vm => {
  163. //const pm = to.param;
  164. Object.assign(vm, to.params);
  165. vm.inCurrentPage = to.params.currentPage;
  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. e.preventDefault();
  178. let formData = new FormData();
  179. formData.append('file', fileInfo);
  180. formData.append('type', 6);
  181. const header = {
  182. headers: {
  183. 'Content-Type': 'multipart/form-data'
  184. }
  185. };
  186. const loading = this.$loading({
  187. lock: true,
  188. text: '预匹配中...',
  189. spinner: 'el-icon-loading',
  190. background: 'rgba(0, 0, 0, 0.7)'
  191. });
  192. api.dataOperationVerify(formData, header).then(res => {
  193. if (res.data.code === '00020007' || res.data.code === '00020004') {
  194. loading.close();
  195. this.$alert(`${res.data.msg}`, '提示', {
  196. confirmButtonText: '确定',
  197. type: 'warning'
  198. })
  199. .then(() => {})
  200. .catch(() => {});
  201. } else {
  202. api.precOperationDataMatch(formData, header).then(res => {
  203. setTimeout(() => {
  204. loading.close();
  205. }, 800);
  206. if (res.status === 200) {
  207. utils.downloadExportedData(
  208. res.data,
  209. '手术/操作关联数据(预匹配).xls'
  210. );
  211. }
  212. });
  213. }
  214. });
  215. let inp = document.getElementById('upFileMatch');
  216. inp.value = '';
  217. },
  218. handleSizeChange(val) {
  219. this.pageSize = val;
  220. this.currentPage = utils.getCurrentPage(
  221. this.currentPage,
  222. this.total,
  223. this.pageSize
  224. );
  225. this.getDataList();
  226. },
  227. // 获取列表数据
  228. getDataList(isTurnPage) {
  229. const params = this.getFilterItems(isTurnPage);
  230. this.searched = true;
  231. const loading = this.$loading({
  232. lock: true,
  233. text: 'Loading',
  234. spinner: 'el-icon-loading',
  235. background: 'rgba(0, 0, 0, 0.7)'
  236. });
  237. api.getOperationPage(params).then(res => {
  238. loading.close();
  239. if (res.data.code === '0') {
  240. this.list = res.data.data && res.data.data.records;
  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. const { data } = this.$route.params;
  252. //翻页时筛选条件没点确定则清空
  253. if (isTurnPage && !this.searched) {
  254. this.clearFilter();
  255. }
  256. const param = {
  257. current: this.inCurrentPage || this.currentPage,
  258. size: this.pageSize,
  259. hisName: this.filter.hisName.trim(),
  260. uniqueName: this.filter.uniqueName.trim(),
  261. uniqueCode: '',
  262. hospitalId: data && data.hospitalId,
  263. type: 6,
  264. isMatch: this.filter.match
  265. };
  266. return param;
  267. },
  268. filterDatas() {
  269. this.currentPage = 1;
  270. this.getDataList();
  271. },
  272. addRelation() {
  273. const pam = this.searched
  274. ? {
  275. currentPage: this.currentPage,
  276. pageSize: this.pageSize,
  277. filter: this.filter
  278. }
  279. : { currentPage: this.currentPage, pageSize: this.pageSize };
  280. // this.$router.push({
  281. // name: 'AddOperation',
  282. // params: Object.assign(pam, {
  283. // isEdit: false,
  284. // data: { hospitalId: this.hospitalId },
  285. // hospitaiName: this.hospitaiName
  286. // })
  287. // });
  288. this.data = {};
  289. this.showModal();
  290. },
  291. // 修改诊断关联-跳转至编辑页面
  292. modifyRelation(row) {
  293. const item = Object.assign({}, row);
  294. const pam = this.searched
  295. ? {
  296. currentPage: this.currentPage,
  297. pageSize: this.pageSize,
  298. filter: this.filter
  299. }
  300. : { currentPage: this.currentPage, pageSize: this.pageSize };
  301. // this.$router.push({
  302. // name: 'AddOperation',
  303. // params: Object.assign(pam, {
  304. // isEdit: true,
  305. // data: { ...item, hospitalId: this.hospitalId },
  306. // hospitaiName: this.hospitaiName
  307. // })
  308. // });
  309. this.data = item;
  310. this.showModal();
  311. },
  312. currentChange(next) {
  313. this.currentPage = next;
  314. this.getDataList(true);
  315. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  316. // this.list = this.cacheData[next];
  317. // } else {
  318. // this.getDataList();
  319. // }
  320. },
  321. // 清空搜索参数
  322. clearFilter() {
  323. this.filter = {
  324. hisName: '',
  325. uniqueName: ''
  326. };
  327. },
  328. indexMethod(index) {
  329. return (this.currentPage - 1) * this.pageSize + index + 1;
  330. },
  331. getTagType(val) {
  332. return val;
  333. },
  334. warning(msg, type) {
  335. this.$message({
  336. showClose: true,
  337. message: msg,
  338. type: type || 'warning'
  339. });
  340. },
  341. showConfirmDialog(msg, resolve) {
  342. this.$alert(msg, '提示', {
  343. confirmButtonText: '删除',
  344. // cancelButtonText: '取消',
  345. // cancelButtonClass: 'cancelBtn',
  346. // confirmButtonClass: 'confirmC',
  347. type: 'warning'
  348. })
  349. .then(() => {
  350. resolve();
  351. })
  352. .catch(() => {});
  353. },
  354. // 删除关联
  355. showDelDialog(id) {
  356. this.showConfirmDialog('是否删除该关联?', () => {
  357. api
  358. .deleteOperationRecord({ id: id })
  359. .then(res => {
  360. if (res.data.code == '0') {
  361. if (!this.searched) {
  362. //未点确认时清空搜索条件
  363. this.clearFilter();
  364. }
  365. if (this.list.length == 1) {
  366. //当前在最后一页且只有一条数据时,删除后跳到前一页
  367. this.currentPage =
  368. this.currentPage === 1 ? 1 : this.currentPage - 1;
  369. }
  370. this.getDataList();
  371. this.warning(res.data.msg || '操作成功', 'success');
  372. } else {
  373. this.warning(res.data.msg);
  374. }
  375. })
  376. .catch(error => {
  377. if (error.code === '900010001') {
  378. return false;
  379. }
  380. this.warning(error);
  381. });
  382. });
  383. },
  384. // 导出数据
  385. exportData() {
  386. this.$alert('确定要导出全部手术/操作关联数据吗?', '', {
  387. confirmButtonText: '确定',
  388. // cancelButtonText: '取消',
  389. // cancelButtonClass: 'leftbtn',
  390. // customClass: 'exportBox6',
  391. title: '提示',
  392. type: 'warning'
  393. // beforeClose: (action, instance, done) => {
  394. // if (action === 'confirm') {
  395. // // instance.confirmButtonLoading = true;
  396. // instance.confirmButtonText = '导出中...';
  397. // api.exportOperationRecord().then(res => {
  398. // if (res.status === 200) {
  399. // setTimeout(() => {
  400. // utils.downloadExportedData(res.data, '手术/操作关联数据.xls');
  401. // done();
  402. // }, 1500);
  403. // }
  404. // });
  405. // } else {
  406. // done();
  407. // }
  408. // }
  409. })
  410. .then(() => {
  411. api
  412. .exportOperationRecord({
  413. hospitalId: this.hospitalId,
  414. type: 6,
  415. isMatch: this.filter.match
  416. })
  417. .then(res => {
  418. if (res.status === 200) {
  419. this.$message({ message: '导出成功', type: 'success' });
  420. utils.downloadExportedData(res.data, '手术/操作关联数据.xls');
  421. }
  422. });
  423. })
  424. .catch(() => {
  425. // this.$message({ message: '导出失败', type: 'waring' });
  426. });
  427. },
  428. // 导入模板
  429. exportModule() {
  430. api.exportOperationModule({ type: 6 }).then(res => {
  431. if (res.status === 200) {
  432. setTimeout(() => {
  433. utils.downloadExportedData(res.data, '手术/操作导入模板.xls');
  434. }, 1500);
  435. }
  436. });
  437. },
  438. // 点击导入
  439. importPage() {
  440. let inp = document.getElementById('upFile');
  441. inp.click();
  442. },
  443. // 导入数据
  444. uploadFile(e) {
  445. let fileInfo = e.target.files[0];
  446. e.preventDefault();
  447. let formData = new FormData();
  448. formData.append('file', fileInfo);
  449. formData.append('hospitalId', this.hospitalId);
  450. formData.append('type', 6);
  451. formData.append('uesrId', localStorage.getItem('uesrId'));
  452. const header = {
  453. headers: {
  454. 'Content-Type': 'multipart/form-data'
  455. }
  456. };
  457. this.uploadInfo = '导入中...';
  458. api.importOperationRecord(formData, header).then(res => {
  459. if (res.data.code === '00000001') {
  460. this.$alert(`数据存在异常,导入失败,请修改后再试`, '提示', {
  461. confirmButtonText: '确定',
  462. // cancelButtonText: '取消',
  463. // cancelButtonClass: 'cancelSure',
  464. // confirmButtonClass: 'sure',
  465. // customClass: 'exportConfirm',
  466. type: 'warning'
  467. })
  468. .then(() => {})
  469. .catch(() => {});
  470. this.getDataList(); // 重新获取列表
  471. setTimeout(() => {
  472. this.uploadInfo = '导入';
  473. }, 300);
  474. } else if (res.data.data === true && res.status === 200) {
  475. this.$alert(`导入成功`, '提示', {
  476. confirmButtonText: '确定',
  477. // cancelButtonText: '取消',
  478. // cancelButtonClass: 'cancelSure',
  479. // confirmButtonClass: 'sure',
  480. // customClass: 'exportConfirm',
  481. type: 'success'
  482. })
  483. .then(() => {})
  484. .catch(() => {});
  485. this.getDataList(); // 重新获取列表
  486. setTimeout(() => {
  487. this.uploadInfo = '导入';
  488. }, 300);
  489. } else {
  490. this.$alert(`${res.data.msg}`, '提示', {
  491. confirmButtonText: '确定',
  492. // // cancelButtonText: '取消',
  493. // cancelButtonClass: 'cancelSure',
  494. // confirmButtonClass: 'sure',
  495. // customClass: 'exportConfirm',
  496. type: 'warning'
  497. })
  498. .then(() => {})
  499. .catch(() => {});
  500. setTimeout(() => {
  501. this.uploadInfo = '导入';
  502. }, 300);
  503. }
  504. });
  505. //解决上传相同文件不触发change
  506. let inp = document.getElementById('upFile');
  507. inp.value = '';
  508. },
  509. /********新增编辑弹窗**********/
  510. showModal() {
  511. this.modalVisiable = true;
  512. },
  513. getMsgFormSon(data) {
  514. if (data == 'close') {
  515. this.modalVisiable = false;
  516. } else {
  517. this.modalVisiable = false;
  518. this.getDataList();
  519. }
  520. }
  521. }
  522. };
  523. </script>
  524. <style lang="less" scoped>
  525. @import '../../../less/admin.less';
  526. .delete {
  527. color: red;
  528. }
  529. .delete:hover {
  530. color: red;
  531. }
  532. .pagination {
  533. min-width: 1010px;
  534. }
  535. .downTemplate {
  536. margin-right: 8px;
  537. span {
  538. color: #02a7f0;
  539. }
  540. }
  541. #upFile {
  542. display: none !important;
  543. }
  544. #upFileMatch {
  545. display: none;
  546. }
  547. .el-message-box {
  548. /deep/.cancelBtn {
  549. background-color: #d7d7d7;
  550. border-color: transparent;
  551. }
  552. /deep/.confirmC {
  553. background-color: #ff545b !important;
  554. border-color: transparent !important;
  555. }
  556. }
  557. .exportBox6 {
  558. /deep/ .el-message-box__btns {
  559. margin-top: 20px;
  560. }
  561. /deep/ .el-message-box__message {
  562. // text-align: center;
  563. }
  564. /deep/.leftbtn {
  565. background-color: #d7d7d7;
  566. border-color: transparent !important;
  567. }
  568. /deep/ .el-message-box__header {
  569. border-bottom: 1px solid #dcdfe6;
  570. }
  571. }
  572. .searchBar {
  573. min-width: 980px;
  574. height: 60px;
  575. display: flex;
  576. justify-content: center;
  577. align-items: center;
  578. background-color: #dee2ea;
  579. z-index: 9999;
  580. padding: 40px 20px 0;
  581. .searchContent {
  582. height: 40px;
  583. flex: 1;
  584. background-color: #fff;
  585. display: flex;
  586. justify-content: flex-end;
  587. float: right;
  588. }
  589. }
  590. .contentsOther {
  591. padding: 0 20px;
  592. }
  593. </style>