tcmdisease.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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>
  6. <el-button type="text" class="downTemplate" @click="exportModule">导入模板下载</el-button>
  7. <input
  8. type="file"
  9. name="uploadfile "
  10. id="upFile"
  11. @change="uploadFile($event)"
  12. />
  13. <!-- accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -->
  14. <el-button size="mini" @click="handleMatchData">预匹配</el-button>
  15. <el-button size="mini" @click="importPage" style="margin:0 10px">{{uploadInfo}}</el-button>
  16. <input type="file" name="uploadfile " id="upFileMatch" @change="uploadFileMatch($event)" />
  17. <el-button size="mini" @click="exportData">导出</el-button>
  18. </el-form-item>
  19. <el-form-item label class="selectMedicine">
  20. <el-select size="mini" v-model="filter.match" placeholder="请选择" clearable>
  21. <el-option v-for="item in matchList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="医院中医疾病名称:">
  25. <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
  26. </el-form-item>
  27. <el-form-item label="标准中医疾病名称:">
  28. <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
  29. </el-form-item>
  30. </el-form>
  31. <el-form class="secLine">
  32. <el-form-item>
  33. <el-button size="mini" @click="filterDatas">检索</el-button>
  34. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </crumbs>
  38. <div class="contents knowledgeContents">
  39. <el-table :data="list" border style="width: 100%">
  40. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
  41. <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
  42. <el-table-column :resizable="false" prop="hisName" label="医院中医疾病名称" show-overflow-tooltip></el-table-column>
  43. <el-table-column :resizable="false" prop="code" label="中医疾病代码" show-overflow-tooltip></el-table-column>
  44. <el-table-column :resizable="false" prop="uniqueName" label="标准中医疾病名称" show-overflow-tooltip></el-table-column>
  45. <el-table-column :resizable="false" prop="operate" label="状态">
  46. <template slot-scope="scope">
  47. <span>{{scope.row.isMatch == 0?'未匹配':'已匹配'}}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column :resizable="false" prop="operate" label="操作">
  51. <template slot-scope="scope">
  52. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  53. <span style="margin:0 3px;">|</span>
  54. <el-button
  55. @click="showDelDialog(scope.row.id)"
  56. class="delete"
  57. type="text"
  58. size="small"
  59. >删除</el-button>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <div class="pagination pagepage">
  64. <el-pagination
  65. :current-page.sync="currentPage"
  66. @current-change="currentChange"
  67. background
  68. :page-size="pageSize"
  69. :page-sizes="pageSizeArr"
  70. @size-change="handleSizeChange"
  71. :layout="pageLayout"
  72. :total="total"
  73. ></el-pagination>
  74. </div>
  75. </div>
  76. <LtModal
  77. v-if="modalVisiable"
  78. @func="getMsgFormSon"
  79. :meal="'中医疾病名称'"
  80. :standard="'中医疾病名称'"
  81. :detail="'中医疾病代码'"
  82. :tip="'中医疾病关联'"
  83. :type="12"
  84. :data="data"
  85. ></LtModal>
  86. </div>
  87. </template>
  88. <script>
  89. import api from '@api/icss.js';
  90. import config from '@api/config.js';
  91. import utils from '@api/utils.js';
  92. import LtModal from '@components/common/LtModal';
  93. export default {
  94. name: 'Tcmdisease',
  95. data: function() {
  96. return {
  97. list: [],
  98. searched: false,
  99. filter: {
  100. hisName: '', // 医院诊断名称
  101. uniqueName: '', //标准诊断名称
  102. match:''
  103. },
  104. matchList: [
  105. { id: '', name: '全部' },
  106. { id: 1, name: '已匹配' },
  107. { id: 0, name: '未匹配' },
  108. { id: 2, name: '多项匹配' }
  109. ],
  110. currentPage: 1,
  111. pageSize: config.pageSize,
  112. pageSizeArr: config.pageSizeArr,
  113. pageLayout: config.pageLayout,
  114. total: 0,
  115. fileName: '',
  116. formData: {},
  117. headers: {},
  118. uploadInfo: '导入',
  119. modalVisiable: false,
  120. data: {}
  121. };
  122. },
  123. components: {
  124. LtModal
  125. },
  126. created() {
  127. const param = this.$route.params;
  128. if(param.currentPage){
  129. this.inCurrentPage = param.currentPage
  130. }
  131. if(param.filter){
  132. this.filter = param.filter
  133. }
  134. //返回时避免参数未赋值就获取列表
  135. setTimeout(()=> {
  136. this.getDataList();
  137. });
  138. // 非首页 编辑页返回 设置 this.currentPage
  139. if (Object.keys(this.$route.params).length !== 0) {
  140. this.currentPage = this.$route.params.currentPage;
  141. }
  142. },
  143. watch: {
  144. filter: {
  145. handler: function() {
  146. this.searched = false;
  147. },
  148. deep: true
  149. }
  150. },
  151. methods: {
  152. // 预匹配
  153. handleMatchData() {
  154. let inp = document.getElementById('upFileMatch');
  155. inp.click();
  156. },
  157. // 导入数据
  158. uploadFileMatch(e) {
  159. let fileInfo = e.target.files[0];
  160. e.preventDefault();
  161. let formData = new FormData();
  162. formData.append('file', fileInfo);
  163. formData.append('type', 12);
  164. const header = {
  165. headers: {
  166. 'Content-Type': 'multipart/form-data'
  167. }
  168. };
  169. const loading = this.$loading({
  170. lock: true,
  171. text: '预匹配中...',
  172. spinner: 'el-icon-loading',
  173. background: 'rgba(0, 0, 0, 0.7)'
  174. });
  175. api.dataDiseaseVerify(formData, header).then(res => {
  176. if (res.data.code === '00020007' || res.data.code === '00020004') {
  177. loading.close();
  178. this.$alert(`${res.data.msg}`, '提示', {
  179. confirmButtonText: '确定',
  180. type: 'warning'
  181. })
  182. .then(() => {})
  183. .catch(() => {});
  184. } else {
  185. api.precDiseaseDataMatch(formData, header).then(res => {
  186. setTimeout(() => {
  187. loading.close();
  188. }, 800);
  189. if (res.status === 200) {
  190. utils.downloadExportedData(
  191. res.data,
  192. '中医疾病关联数据(预匹配).xls'
  193. );
  194. }
  195. });
  196. }
  197. });
  198. let inp = document.getElementById('upFileMatch');
  199. inp.value = '';
  200. },
  201. handleSizeChange(val) {
  202. this.pageSize = val;
  203. this.currentPage = utils.getCurrentPage(
  204. this.currentPage,
  205. this.total,
  206. this.pageSize
  207. );
  208. this.getDataList();
  209. },
  210. // 获取列表数据
  211. getDataList(isTurnPage) {
  212. const params = this.getFilterItems(isTurnPage);
  213. this.searched = true;
  214. const loading = this.$loading({
  215. lock: true,
  216. text: 'Loading',
  217. spinner: 'el-icon-loading',
  218. background: 'rgba(0, 0, 0, 0.7)'
  219. });
  220. api.getTcmdiseasePage(params).then(res => {
  221. loading.close();
  222. if (res.data.code === '0') {
  223. this.list = res.data.data && res.data.data.records;
  224. }
  225. this.total = res.data.data && res.data.data.total;
  226. if (this.inCurrentPage !== undefined) {
  227. this.currentPage = this.inCurrentPage;
  228. this.inCurrentPage = undefined;
  229. }
  230. });
  231. },
  232. // 处理列表请求数据参数
  233. getFilterItems(isTurnPage) {
  234. //翻页时筛选条件没点确定则清空
  235. if (isTurnPage && !this.searched) {
  236. this.clearFilter();
  237. }
  238. const param = {
  239. current: this.inCurrentPage || this.currentPage,
  240. size: this.pageSize,
  241. hisName: this.filter.hisName.trim(),
  242. uniqueName: this.filter.uniqueName.trim(),
  243. uniqueCode: '',
  244. type: 12,
  245. isMatch: this.filter.match
  246. };
  247. return param;
  248. },
  249. filterDatas() {
  250. this.currentPage = 1;
  251. this.getDataList();
  252. },
  253. addRelation() {
  254. const pam = this.searched
  255. ? {
  256. currentPage: this.currentPage,
  257. pageSize: this.pageSize,
  258. filter: this.filter
  259. }
  260. : { currentPage: this.currentPage, pageSize: this.pageSize };
  261. // this.$router.push({ name: 'AddTcmdisease', params: pam });
  262. this.data = {}
  263. this.showModal()
  264. },
  265. // 修改诊断关联-跳转至编辑页面
  266. modifyRelation(row) {
  267. const item = Object.assign({}, row);
  268. const pam = this.searched
  269. ? {
  270. currentPage: this.currentPage,
  271. pageSize: this.pageSize,
  272. filter: this.filter
  273. }
  274. : { currentPage: this.currentPage, pageSize: this.pageSize };
  275. // this.$router.push({
  276. // name: 'AddTcmdisease',
  277. // params: Object.assign(pam, { isEdit: true, data: item })
  278. // });
  279. this.data = item
  280. this.showModal()
  281. },
  282. currentChange(next) {
  283. this.currentPage = next;
  284. this.getDataList(true);
  285. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  286. // this.list = this.cacheData[next];
  287. // } else {
  288. // this.getDataList();
  289. // }
  290. },
  291. // 清空搜索参数
  292. clearFilter() {
  293. this.filter = {
  294. hisName: '',
  295. uniqueName: ''
  296. };
  297. },
  298. indexMethod(index) {
  299. return (this.currentPage - 1) * this.pageSize + index + 1;
  300. },
  301. getTagType(val) {
  302. return val;
  303. },
  304. warning(msg, type) {
  305. this.$message({
  306. showClose: true,
  307. message: msg,
  308. type: type || 'warning'
  309. });
  310. },
  311. showConfirmDialog(msg, resolve) {
  312. this.$confirm(msg, '提示', {
  313. confirmButtonText: '删除',
  314. cancelButtonText: '取消',
  315. cancelButtonClass: 'cancelBtn',
  316. confirmButtonClass: 'confirmC',
  317. type: 'warning'
  318. })
  319. .then(() => {
  320. resolve();
  321. })
  322. .catch(() => {});
  323. },
  324. // 删除关联
  325. showDelDialog(id) {
  326. this.showConfirmDialog('是否删除该关联?', () => {
  327. api
  328. .deleteTcmRecord({ id: id })
  329. .then(res => {
  330. if (res.data.code == '0') {
  331. if (!this.searched) {
  332. //未点确认时清空搜索条件
  333. this.clearFilter();
  334. }
  335. if (this.list.length == 1) {
  336. //当前在最后一页且只有一条数据时,删除后跳到前一页
  337. this.currentPage =
  338. this.currentPage === 1 ? 1 : this.currentPage - 1;
  339. }
  340. this.getDataList();
  341. this.warning(res.data.msg || '操作成功', 'success');
  342. } else {
  343. this.warning(res.data.msg);
  344. }
  345. })
  346. .catch(error => {
  347. if (error.code === '900010001') {
  348. return false;
  349. }
  350. this.warning(error);
  351. });
  352. });
  353. },
  354. // 导出数据
  355. exportData() {
  356. this.$confirm('确定要导出全部中医疾病关联数据吗?', '', {
  357. confirmButtonText: '确定',
  358. cancelButtonText: '取消',
  359. cancelButtonClass: 'leftbtn',
  360. customClass: 'exportBox6',
  361. title: '提示',
  362. type: 'warning'
  363. // beforeClose: (action, instance, done) => {
  364. // if (action === 'confirm') {
  365. // // instance.confirmButtonLoading = true;
  366. // // instance.confirmButtonText = '导出中...';
  367. // done()
  368. // api.exportDeptRecord().then(res => {
  369. // if (res.status === 200) {
  370. // setTimeout(() => {
  371. // utils.downloadExportedData(res.data, '科室关联数据.xls');
  372. // // done();
  373. // }, 1500);
  374. // }
  375. // });
  376. // } else {
  377. // done();
  378. // }
  379. // }
  380. })
  381. .then(() => {
  382. api.exportTcmRecord({type:12,isMatch:this.filter.match}).then(res => {
  383. if (res.status === 200) {
  384. this.$message({ message: '导出成功', type: 'success' });
  385. utils.downloadExportedData(res.data, '中医疾病关联数据.xls');
  386. }
  387. });
  388. })
  389. .catch(() => {});
  390. },
  391. // 导入模板
  392. exportModule() {
  393. api.exportTcmModule({type:12}).then(res => {
  394. if (res.status === 200) {
  395. setTimeout(() => {
  396. utils.downloadExportedData(res.data, '中医疾病导入模板.xls');
  397. }, 1500);
  398. }
  399. });
  400. },
  401. // 点击导入
  402. importPage() {
  403. let inp = document.getElementById('upFile');
  404. inp.click();
  405. },
  406. // 导入数据
  407. uploadFile(e) {
  408. let fileInfo = e.target.files[0];
  409. // this.fileName = e.target.files[0].name; // 表单同步显示
  410. e.preventDefault();
  411. let formData = new FormData();
  412. formData.append('file', fileInfo);
  413. formData.append('type', 12);
  414. formData.append('uesrId', localStorage.getItem('uesrId'));
  415. formData.append(
  416. 'hospitalId',
  417. JSON.parse(localStorage.getItem('hospitalLoginDTO')).id
  418. );
  419. const header = {
  420. headers: {
  421. 'Content-Type': 'multipart/form-data'
  422. }
  423. };
  424. this.uploadInfo = '导入中...';
  425. api.importTcmRecord(formData, header).then(res => {
  426. // console.log('导入文件结果', '===================', res);
  427. if (res.data.code === '00000001') {
  428. this.$confirm(`数据存在异常,导入失败,请修改后再试`, '提示', {
  429. confirmButtonText: '确定',
  430. // cancelButtonText: '取消',
  431. cancelButtonClass: 'cancelSure',
  432. confirmButtonClass: 'sure',
  433. customClass: 'exportConfirm',
  434. type: 'warning'
  435. })
  436. .then(() => {})
  437. .catch(() => {});
  438. this.getDataList(); // 重新获取列表
  439. setTimeout(() => {
  440. this.uploadInfo = '导入';
  441. }, 300);
  442. } else if (res.data.data === true && res.status === 200) {
  443. this.$confirm(`导入成功`, '提示', {
  444. confirmButtonText: '确定',
  445. // cancelButtonText: '取消',
  446. cancelButtonClass: 'cancelSure',
  447. confirmButtonClass: 'sure',
  448. customClass: 'exportConfirm',
  449. type: 'success'
  450. })
  451. .then(() => {})
  452. .catch(() => {});
  453. this.getDataList(); // 重新获取列表
  454. setTimeout(() => {
  455. this.uploadInfo = '导入';
  456. }, 300);
  457. } else {
  458. this.$confirm(`${res.data.msg}`, '提示', {
  459. confirmButtonText: '确定',
  460. // cancelButtonText: '取消',
  461. cancelButtonClass: 'cancelSure',
  462. confirmButtonClass: 'sure',
  463. customClass: 'exportConfirm',
  464. type: 'warning'
  465. })
  466. .then(() => {})
  467. .catch(() => {});
  468. setTimeout(() => {
  469. this.uploadInfo = '导入';
  470. }, 300);
  471. }
  472. });
  473. //解决上传相同文件不触发change
  474. let inp = document.getElementById('upFile');
  475. inp.value = '';
  476. },
  477. /********新增编辑弹窗**********/
  478. showModal() {
  479. this.modalVisiable = true;
  480. },
  481. getMsgFormSon(data) {
  482. if (data == 'close') {
  483. this.modalVisiable = false;
  484. } else {
  485. this.modalVisiable = false;
  486. this.getDataList();
  487. }
  488. }
  489. }
  490. };
  491. </script>
  492. <style lang="less" scoped>
  493. @import '../../../less/admin.less';
  494. /deep/ .container.knowledgeTitle {
  495. height: 80px;
  496. }
  497. /deep/ .contents.knowledgeContents {
  498. padding: 104px 20px 0;
  499. }
  500. /deep/ .secLine.el-form {
  501. float: right;
  502. display: block;
  503. position: relative;
  504. top: -5px;
  505. }
  506. .delete {
  507. color: red;
  508. }
  509. .delete:hover {
  510. color: red;
  511. }
  512. .pagination {
  513. min-width: 1010px;
  514. }
  515. .downTemplate {
  516. margin-right: 8px;
  517. span {
  518. color: #02a7f0;
  519. }
  520. }
  521. #upFile {
  522. display: none !important;
  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. #upFileMatch{
  558. display: none;
  559. }
  560. </style>