Operation.vue 18 KB

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