tcmdrome.vue 17 KB

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