Fusion.vue 14 KB

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