Lis.vue 18 KB

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