tcmdrome.vue 17 KB

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