Pacs.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <div>
  3. <crumbs title="检查关联维护" style="min-width: 980px">
  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. accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  13. />
  14. <el-button size="mini" @click="importPage">{{uploadInfo}}</el-button>
  15. <el-button size="mini" @click="exportData">导出</el-button>
  16. </el-form-item>
  17. <el-form-item label="医院检查项目:">
  18. <el-input size="mini" v-model="filter.hisName" placeholder="请输入" clearable></el-input>
  19. </el-form-item>
  20. <el-form-item label="标准检查项目:">
  21. <el-input size="mini" v-model="filter.uniqueName" placeholder="请输入" clearable></el-input>
  22. </el-form-item>
  23. <el-form-item class="dododo">
  24. <el-button size="mini" @click="filterDatas">检索</el-button>
  25. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  26. </el-form-item>
  27. </el-form>
  28. </crumbs>
  29. <div class="contents">
  30. <el-table :data="list" border style="width: 100%">
  31. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  32. <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
  33. <!-- <el-table-column :resizable="false" prop="mealName" label="化验大项" show-overflow-tooltip></el-table-column> -->
  34. <el-table-column :resizable="false" prop="hisName" label="医院检查项目" show-overflow-tooltip></el-table-column>
  35. <!-- <el-table-column :resizable="false" prop="uniqueCode" label="对应项编码" show-overflow-tooltip></el-table-column> -->
  36. <el-table-column :resizable="false" prop="uniqueName" label="标准检查项目" show-overflow-tooltip></el-table-column>
  37. <el-table-column :resizable="false" prop="operate" label="操作">
  38. <template slot-scope="scope">
  39. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  40. <span style="margin:0 3px;">|</span>
  41. <el-button
  42. @click="showDelDialog(scope.row.id)"
  43. class="delete"
  44. type="text"
  45. size="small"
  46. >删除</el-button>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <div class="pagination pagepage">
  51. <el-pagination
  52. :current-page.sync="currentPage"
  53. @current-change="currentChange"
  54. background
  55. :page-size="pageSize"
  56. :page-sizes="pageSizeArr"
  57. @size-change="handleSizeChange"
  58. :layout="pageLayout"
  59. :total="total"
  60. ></el-pagination>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import api from '@api/icss.js';
  67. import config from '@api/config.js';
  68. import utils from '@api/utils.js';
  69. export default {
  70. name: 'Pacs', //化验大小项和公表维护
  71. data: function() {
  72. return {
  73. list: [],
  74. searched: false,
  75. filter: {
  76. hisName: '', // 医院诊断名称
  77. uniqueName: '' //标准诊断名称
  78. },
  79. currentPage: 1,
  80. pageSize: config.pageSize,
  81. pageSizeArr: config.pageSizeArr,
  82. pageLayout: config.pageLayout,
  83. total: 0,
  84. uploadInfo: '导入'
  85. };
  86. },
  87. created() {
  88. const that = this;
  89. //返回时避免参数未赋值就获取列表
  90. setTimeout(function() {
  91. that.getDataList();
  92. });
  93. // 非首页 编辑页返回 设置 this.currentPage
  94. if (Object.keys(this.$route.params).length !== 0) {
  95. this.currentPage = this.$route.params.currentPage;
  96. }
  97. },
  98. watch: {
  99. filter: {
  100. handler: function() {
  101. this.searched = false;
  102. },
  103. deep: true
  104. }
  105. },
  106. beforeRouteEnter(to, from, next) {
  107. next(vm => {
  108. //const pm = to.param;
  109. Object.assign(vm, to.params);
  110. vm.inCurrentPage = to.params.currentPage;
  111. });
  112. },
  113. methods: {
  114. handleSizeChange(val) {
  115. this.pageSize = val;
  116. this.currentPage = utils.getCurrentPage(
  117. this.currentPage,
  118. this.total,
  119. this.pageSize
  120. );
  121. this.getDataList();
  122. },
  123. // 获取列表数据
  124. getDataList(isTurnPage) {
  125. const params = this.getFilterItems(isTurnPage);
  126. this.searched = true;
  127. const loading = this.$loading({
  128. lock: true,
  129. text: 'Loading',
  130. spinner: 'el-icon-loading',
  131. background: 'rgba(0, 0, 0, 0.7)'
  132. });
  133. api.getpacsPage(params).then(res => {
  134. loading.close();
  135. if (res.data.code === '0') {
  136. this.list = res.data.data && res.data.data.records;
  137. }
  138. this.total = res.data.data && res.data.data.total;
  139. if (this.inCurrentPage !== undefined) {
  140. this.currentPage = this.inCurrentPage;
  141. this.inCurrentPage = undefined;
  142. }
  143. });
  144. },
  145. // 处理列表请求数据参数
  146. getFilterItems(isTurnPage) {
  147. //翻页时筛选条件没点确定则清空
  148. if (isTurnPage && !this.searched) {
  149. this.clearFilter();
  150. }
  151. const param = {
  152. current: this.inCurrentPage || this.currentPage,
  153. size: this.pageSize,
  154. hisName: this.filter.hisName.trim(),
  155. uniqueName: this.filter.uniqueName.trim(),
  156. uniqueCode: ''
  157. };
  158. return param;
  159. },
  160. filterDatas() {
  161. this.currentPage = 1;
  162. this.getDataList();
  163. },
  164. addRelation() {
  165. const pam = this.searched
  166. ? {
  167. currentPage: this.currentPage,
  168. pageSize: this.pageSize,
  169. filter: this.filter
  170. }
  171. : { currentPage: this.currentPage, pageSize: this.pageSize };
  172. this.$router.push({ name: 'AddPacs', params: pam });
  173. },
  174. // 修改诊断关联-跳转至编辑页面
  175. modifyRelation(row) {
  176. const item = Object.assign({}, row);
  177. const pam = this.searched
  178. ? {
  179. currentPage: this.currentPage,
  180. pageSize: this.pageSize,
  181. filter: this.filter
  182. }
  183. : { currentPage: this.currentPage, pageSize: this.pageSize };
  184. this.$router.push({
  185. name: 'AddPacs',
  186. params: Object.assign(pam, { isEdit: true, data: item })
  187. });
  188. },
  189. currentChange(next) {
  190. this.currentPage = next;
  191. this.getDataList(true);
  192. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  193. // this.list = this.cacheData[next];
  194. // } else {
  195. // this.getDataList();
  196. // }
  197. },
  198. // 清空搜索参数
  199. clearFilter() {
  200. this.filter = {
  201. hisName: '',
  202. uniqueName: ''
  203. };
  204. },
  205. indexMethod(index) {
  206. return (this.currentPage - 1) * this.pageSize + index + 1;
  207. },
  208. getTagType(val) {
  209. return val;
  210. },
  211. warning(msg, type) {
  212. this.$message({
  213. showClose: true,
  214. message: msg,
  215. type: type || 'warning'
  216. });
  217. },
  218. showConfirmDialog(msg, resolve) {
  219. this.$confirm(msg, '提示', {
  220. confirmButtonText: '删除',
  221. cancelButtonText: '取消',
  222. cancelButtonClass: 'cancelBtn',
  223. confirmButtonClass: 'confirmC',
  224. type: 'warning'
  225. })
  226. .then(() => {
  227. resolve();
  228. })
  229. .catch(() => {});
  230. },
  231. // 删除关联
  232. showDelDialog(id) {
  233. this.showConfirmDialog('是否删除该关联?', () => {
  234. api
  235. .deletePacsRecord({ id: id })
  236. .then(res => {
  237. if (res.data.code == '0') {
  238. if (!this.searched) {
  239. //未点确认时清空搜索条件
  240. this.clearFilter();
  241. }
  242. if (this.list.length == 1) {
  243. //当前在最后一页且只有一条数据时,删除后跳到前一页
  244. this.currentPage =
  245. this.currentPage === 1 ? 1 : this.currentPage - 1;
  246. }
  247. this.getDataList();
  248. this.warning(res.data.msg || '操作成功', 'success');
  249. } else {
  250. this.warning(res.data.msg);
  251. }
  252. })
  253. .catch(error => {
  254. if (error.code === '900010001') {
  255. return false;
  256. }
  257. this.warning(error);
  258. });
  259. });
  260. },
  261. // 导出数据
  262. exportData() {
  263. this.$confirm('确定要导出全部检查关联数据吗?', '', {
  264. confirmButtonText: '确定',
  265. cancelButtonText: '取消',
  266. cancelButtonClass: 'leftbtn',
  267. customClass: 'exportBox6',
  268. title: '提示',
  269. type: 'warning'
  270. // beforeClose: (action, instance, done) => {
  271. // if (action === 'confirm') {
  272. // // instance.confirmButtonLoading = true;
  273. // instance.confirmButtonText = '导出中...';
  274. // api.exportPacsRecord().then(res => {
  275. // if (res.status === 200) {
  276. // setTimeout(() => {
  277. // utils.downloadExportedData(res.data, '检查关联数据.xls');
  278. // done();
  279. // }, 1500);
  280. // }
  281. // });
  282. // } else {
  283. // done();
  284. // }
  285. // }
  286. })
  287. .then(() => {
  288. api.exportPacsRecord().then(res => {
  289. if (res.status === 200) {
  290. this.$message({ message: '导出成功', type: 'success' });
  291. utils.downloadExportedData(res.data, '检查关联数据.xls');
  292. }
  293. });
  294. })
  295. .catch(() => {
  296. // this.$message({ message: '导出失败', type: 'waring' });
  297. });
  298. },
  299. // 导入模板
  300. exportModule() {
  301. api.exportPacsModule().then(res => {
  302. if (res.status === 200) {
  303. setTimeout(() => {
  304. utils.downloadExportedData(res.data, '检查导入模板.xls');
  305. }, 1500);
  306. }
  307. });
  308. },
  309. // 点击导入
  310. importPage() {
  311. let inp = document.getElementById('upFile');
  312. inp.click();
  313. },
  314. // 导入数据
  315. uploadFile(e) {
  316. let fileInfo = e.target.files[0];
  317. e.preventDefault();
  318. let formData = new FormData();
  319. formData.append('file', fileInfo);
  320. const header = {
  321. headers: {
  322. 'Content-Type': 'multipart/form-data'
  323. }
  324. };
  325. this.uploadInfo = '导入中...';
  326. api.importPacsRecord(formData, header).then(res => {
  327. if (res.data === '' && res.status === 200) {
  328. this.$confirm(`导入成功`, '', {
  329. confirmButtonText: '确定',
  330. // cancelButtonText: '取消',
  331. cancelButtonClass: 'cancelSure',
  332. confirmButtonClass: 'sure',
  333. customClass: 'exportConfirm'
  334. })
  335. .then(() => {})
  336. .catch(() => {});
  337. this.getDataList(); // 重新获取列表
  338. setTimeout(() => {
  339. this.uploadInfo = '导入';
  340. }, 300);
  341. } else {
  342. this.$confirm(`${res.data.msg}`, '提示', {
  343. confirmButtonText: '确定',
  344. // cancelButtonText: '取消',
  345. cancelButtonClass: 'cancelSure',
  346. confirmButtonClass: 'sure',
  347. customClass: 'exportConfirm',
  348. type: 'warning'
  349. })
  350. .then(() => {})
  351. .catch(() => {});
  352. setTimeout(() => {
  353. this.uploadInfo = '导入';
  354. }, 300);
  355. }
  356. });
  357. //解决上传相同文件不触发change
  358. let inp = document.getElementById('upFile');
  359. inp.value = '';
  360. }
  361. }
  362. };
  363. </script>
  364. <style lang="less">
  365. @import '../../../less/admin.less';
  366. .delete {
  367. color: red;
  368. }
  369. .delete:hover {
  370. color: red;
  371. }
  372. .pagination {
  373. min-width: 1010px;
  374. }
  375. .downTemplate {
  376. margin-right: 8px;
  377. span {
  378. color: #02a7f0;
  379. }
  380. }
  381. #upFile {
  382. display: none !important;
  383. }
  384. .el-message-box {
  385. /deep/.cancelBtn {
  386. background-color: #d7d7d7;
  387. border-color: transparent;
  388. }
  389. /deep/.confirmC {
  390. background-color: #ff545b !important;
  391. border-color: transparent !important;
  392. }
  393. }
  394. .exportBox6 {
  395. /deep/ .el-message-box__btns {
  396. margin-top: 20px;
  397. }
  398. /deep/ .el-message-box__message {
  399. // text-align: center;
  400. }
  401. /deep/.leftbtn {
  402. background-color: #d7d7d7;
  403. border-color: transparent !important;
  404. }
  405. }
  406. </style>