Lis.vue 16 KB

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