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