Operation.vue 16 KB

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