DeptManage.vue 17 KB

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