Operation.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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="importPage">{{uploadInfo}}</el-button>
  9. <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
  10. <el-button size="mini" @click="handleMatchData" style="marginLeft: 10px">预匹配</el-button>
  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. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  55. <span style="margin:0 3px;">|</span>
  56. <el-button
  57. @click="showDelDialog(scope.row.id)"
  58. class="delete"
  59. type="text"
  60. size="small"
  61. >删除</el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <div class="pagination pagepage">
  66. <el-pagination
  67. :current-page.sync="currentPage"
  68. @current-change="currentChange"
  69. background
  70. :page-size="pageSize"
  71. :page-sizes="pageSizeArr"
  72. @size-change="handleSizeChange"
  73. :layout="pageLayout"
  74. :total="total"
  75. ></el-pagination>
  76. </div>
  77. </div>
  78. <LtModal
  79. v-if="modalVisiable"
  80. @func="getMsgFormSon"
  81. :meal="'手术/操作名称'"
  82. :standard="'手术/操作名称'"
  83. :type="6"
  84. :hospitalId="hospitalId"
  85. :data="data"
  86. ></LtModal>
  87. </div>
  88. </template>
  89. <script>
  90. import api from '@api/cdss.js';
  91. import config from '@api/config.js';
  92. import utils from '@api/utils.js';
  93. import LtModal from '@base/LtModal';
  94. export default {
  95. name: 'Operation', //化验大小项和公表维护
  96. data: function() {
  97. return {
  98. list: [],
  99. searched: false,
  100. filter: {
  101. hisName: '', // 医院诊断名称
  102. uniqueName: '', //标准诊断名称
  103. match:''
  104. },
  105. matchList: [
  106. { id: '', name: '全部' },
  107. { id: 1, name: '已匹配' },
  108. { id: 0, name: '未匹配' },
  109. { id: 2, name: '多项匹配' }
  110. ],
  111. currentPage: 1,
  112. pageSize: config.pageSize,
  113. pageSizeArr: config.pageSizeArr,
  114. pageLayout: config.pageLayout,
  115. total: 0,
  116. uploadInfo: '导入',
  117. title: '手术/操作关联维护 | ',
  118. hospitaiName: '',
  119. hospitalId: '',
  120. modalVisiable: false,
  121. data: {}
  122. };
  123. },
  124. components: {
  125. LtModal
  126. },
  127. created() {
  128. const { data } = this.$route.params;
  129. this.hospitaiName = (data && data.name) || '';
  130. this.hospitalId = data && data.hospitalId;
  131. const that = this;
  132. //返回时避免参数未赋值就获取列表
  133. setTimeout(function() {
  134. that.getDataList();
  135. });
  136. // 非首页 编辑页返回 设置 this.currentPage
  137. if (Object.keys(this.$route.params).length !== 0) {
  138. this.currentPage = this.$route.params.currentPage;
  139. }
  140. },
  141. watch: {
  142. filter: {
  143. handler: function() {
  144. this.searched = false;
  145. },
  146. deep: true
  147. }
  148. },
  149. beforeRouteEnter(to, from, next) {
  150. next(vm => {
  151. //const pm = to.param;
  152. Object.assign(vm, to.params);
  153. vm.inCurrentPage = to.params.currentPage;
  154. });
  155. },
  156. methods: {
  157. // 预匹配
  158. handleMatchData() {
  159. let inp = document.getElementById('upFileMatch');
  160. inp.click();
  161. },
  162. // 导入数据
  163. uploadFileMatch(e) {
  164. let fileInfo = e.target.files[0];
  165. e.preventDefault();
  166. let formData = new FormData();
  167. formData.append('file', fileInfo);
  168. formData.append('type', 6);
  169. const header = {
  170. headers: {
  171. 'Content-Type': 'multipart/form-data'
  172. }
  173. };
  174. const loading = this.$loading({
  175. lock: true,
  176. text: '预匹配中...',
  177. spinner: 'el-icon-loading',
  178. background: 'rgba(0, 0, 0, 0.7)'
  179. });
  180. api.dataOperationVerify(formData, header).then(res => {
  181. if (res.data.code === '00020007') {
  182. loading.close();
  183. this.$alert(`${res.data.msg}`, '提示', {
  184. confirmButtonText: '确定',
  185. type: 'warning'
  186. })
  187. .then(() => {})
  188. .catch(() => {});
  189. } else {
  190. api.precOperationDataMatch(formData, header).then(res => {
  191. setTimeout(() => {
  192. loading.close();
  193. }, 800);
  194. if (res.status === 200) {
  195. utils.downloadExportedData(
  196. res.data,
  197. '手术/操作关联数据(预匹配).xls'
  198. );
  199. }
  200. });
  201. }
  202. });
  203. let inp = document.getElementById('upFileMatch');
  204. inp.value = '';
  205. },
  206. handleSizeChange(val) {
  207. this.pageSize = val;
  208. this.currentPage = utils.getCurrentPage(
  209. this.currentPage,
  210. this.total,
  211. this.pageSize
  212. );
  213. this.getDataList();
  214. },
  215. // 获取列表数据
  216. getDataList(isTurnPage) {
  217. const params = this.getFilterItems(isTurnPage);
  218. this.searched = true;
  219. const loading = this.$loading({
  220. lock: true,
  221. text: 'Loading',
  222. spinner: 'el-icon-loading',
  223. background: 'rgba(0, 0, 0, 0.7)'
  224. });
  225. api.getOperationPage(params).then(res => {
  226. loading.close();
  227. if (res.data.code === '0') {
  228. this.list = res.data.data && res.data.data.records;
  229. }
  230. this.total = res.data.data && res.data.data.total;
  231. if (this.inCurrentPage !== undefined) {
  232. this.currentPage = this.inCurrentPage;
  233. this.inCurrentPage = undefined;
  234. }
  235. });
  236. },
  237. // 处理列表请求数据参数
  238. getFilterItems(isTurnPage) {
  239. const { data } = this.$route.params;
  240. //翻页时筛选条件没点确定则清空
  241. if (isTurnPage && !this.searched) {
  242. this.clearFilter();
  243. }
  244. const param = {
  245. current: this.inCurrentPage || this.currentPage,
  246. size: this.pageSize,
  247. hisName: this.filter.hisName.trim(),
  248. uniqueName: this.filter.uniqueName.trim(),
  249. uniqueCode: '',
  250. hospitalId: data && data.hospitalId,
  251. type: 6,
  252. isMatch:this.filter.match
  253. };
  254. return param;
  255. },
  256. filterDatas() {
  257. this.currentPage = 1;
  258. this.getDataList();
  259. },
  260. addRelation() {
  261. const pam = this.searched
  262. ? {
  263. currentPage: this.currentPage,
  264. pageSize: this.pageSize,
  265. filter: this.filter
  266. }
  267. : { currentPage: this.currentPage, pageSize: this.pageSize };
  268. // this.$router.push({
  269. // name: 'AddOperation',
  270. // params: Object.assign(pam, {
  271. // isEdit: false,
  272. // data: { hospitalId: this.hospitalId },
  273. // hospitaiName: this.hospitaiName
  274. // })
  275. // });
  276. this.data={}
  277. this.showModal()
  278. },
  279. // 修改诊断关联-跳转至编辑页面
  280. modifyRelation(row) {
  281. const item = Object.assign({}, row);
  282. const pam = this.searched
  283. ? {
  284. currentPage: this.currentPage,
  285. pageSize: this.pageSize,
  286. filter: this.filter
  287. }
  288. : { currentPage: this.currentPage, pageSize: this.pageSize };
  289. // this.$router.push({
  290. // name: 'AddOperation',
  291. // params: Object.assign(pam, {
  292. // isEdit: true,
  293. // data: { ...item, hospitalId: this.hospitalId },
  294. // hospitaiName: this.hospitaiName
  295. // })
  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.$alert(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. .deleteOperationRecord({ 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.$alert('确定要导出全部手术/操作关联数据吗?', '', {
  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.exportOperationRecord().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. .exportOperationRecord({ hospitalId: this.hospitalId,type:6 })
  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.exportOperationModule({type:6}).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. e.preventDefault();
  431. let formData = new FormData();
  432. formData.append('file', fileInfo);
  433. formData.append('hospitalId', this.hospitalId);
  434. formData.append('type', 6);
  435. formData.append('uesrId', localStorage.getItem('uesrId'));
  436. const header = {
  437. headers: {
  438. 'Content-Type': 'multipart/form-data'
  439. }
  440. };
  441. this.uploadInfo = '导入中...';
  442. api.importOperationRecord(formData, header).then(res => {
  443. if (res.data.code === '00000001') {
  444. this.$alert(`数据存在异常,导入失败,请修改后再试`, '提示', {
  445. confirmButtonText: '确定',
  446. // cancelButtonText: '取消',
  447. // cancelButtonClass: 'cancelSure',
  448. // confirmButtonClass: 'sure',
  449. // customClass: 'exportConfirm',
  450. type: 'warning'
  451. })
  452. .then(() => {})
  453. .catch(() => {});
  454. this.getDataList(); // 重新获取列表
  455. setTimeout(() => {
  456. this.uploadInfo = '导入';
  457. }, 300);
  458. } else if (res.data === '' && res.status === 200) {
  459. this.$alert(`导入成功`, '提示', {
  460. confirmButtonText: '确定',
  461. // cancelButtonText: '取消',
  462. // cancelButtonClass: 'cancelSure',
  463. // confirmButtonClass: 'sure',
  464. // customClass: 'exportConfirm',
  465. type: 'success'
  466. })
  467. .then(() => {})
  468. .catch(() => {});
  469. this.getDataList(); // 重新获取列表
  470. setTimeout(() => {
  471. this.uploadInfo = '导入';
  472. }, 300);
  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. /********新增编辑弹窗**********/
  494. showModal() {
  495. this.modalVisiable = true;
  496. },
  497. getMsgFormSon(data) {
  498. if (data == 'close') {
  499. this.modalVisiable = false;
  500. } else {
  501. this.modalVisiable = false;
  502. this.getDataList();
  503. }
  504. }
  505. }
  506. };
  507. </script>
  508. <style lang="less" scoped>
  509. @import '../../../less/admin.less';
  510. .delete {
  511. color: red;
  512. }
  513. .delete:hover {
  514. color: red;
  515. }
  516. .pagination {
  517. min-width: 1010px;
  518. }
  519. .downTemplate {
  520. margin-right: 8px;
  521. span {
  522. color: #02a7f0;
  523. }
  524. }
  525. #upFile {
  526. display: none !important;
  527. }
  528. #upFileMatch {
  529. display: none;
  530. }
  531. .el-message-box {
  532. /deep/.cancelBtn {
  533. background-color: #d7d7d7;
  534. border-color: transparent;
  535. }
  536. /deep/.confirmC {
  537. background-color: #ff545b !important;
  538. border-color: transparent !important;
  539. }
  540. }
  541. .exportBox6 {
  542. /deep/ .el-message-box__btns {
  543. margin-top: 20px;
  544. }
  545. /deep/ .el-message-box__message {
  546. // text-align: center;
  547. }
  548. /deep/.leftbtn {
  549. background-color: #d7d7d7;
  550. border-color: transparent !important;
  551. }
  552. /deep/ .el-message-box__header {
  553. border-bottom: 1px solid #dcdfe6;
  554. }
  555. }
  556. .searchBar {
  557. min-width: 980px;
  558. height: 60px;
  559. display: flex;
  560. justify-content: center;
  561. align-items: center;
  562. background-color: #dee2ea;
  563. z-index: 9999;
  564. padding: 40px 20px 0;
  565. .searchContent {
  566. height: 40px;
  567. flex: 1;
  568. background-color: #fff;
  569. display: flex;
  570. justify-content: flex-end;
  571. float: right;
  572. }
  573. }
  574. .contentsOther {
  575. padding: 0 20px;
  576. }
  577. </style>