Pacs.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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 size="mini" @click="importPage">导入</el-button>
  7. <el-button size="mini" @click="exportData">导出</el-button>
  8. </el-form-item>
  9. <el-form-item label="医院检查名称:">
  10. <el-input size="mini" v-model="filter.hisName" placeholder="医院检查名称" clearable></el-input>
  11. </el-form-item>
  12. <el-form-item label="标准检查名称:">
  13. <el-input size="mini" v-model="filter.uniqueName" placeholder="标准检查名称" clearable></el-input>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button size="mini" @click="filterDatas">检索</el-button>
  17. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  18. </el-form-item>
  19. </el-form>
  20. </crumbs>
  21. <div class="contents">
  22. <el-table :data="list" border style="width: 100%">
  23. <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  24. <el-table-column :resizable="false" prop="gmtModified" label="操作时间" width="180"></el-table-column>
  25. <!-- <el-table-column :resizable="false" prop="mealName" label="化验大项" show-overflow-tooltip></el-table-column> -->
  26. <el-table-column :resizable="false" prop="hisName" label="医院检查项目" show-overflow-tooltip></el-table-column>
  27. <el-table-column
  28. :resizable="false"
  29. prop="uniqueCode"
  30. label="对应项编码"
  31. show-overflow-tooltip
  32. ></el-table-column>
  33. <el-table-column :resizable="false" prop="uniqueName" label="标准检查项" show-overflow-tooltip></el-table-column>
  34. <el-table-column :resizable="false" prop="operate" label="操作">
  35. <template slot-scope="scope">
  36. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  37. <el-button
  38. @click="showDelDialog(scope.row.id)"
  39. class="delete"
  40. type="text"
  41. size="small"
  42. >删除</el-button>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <div class="pagination">
  47. <el-pagination
  48. :current-page.sync="currentPage"
  49. @current-change="currentChange"
  50. background
  51. :page-size="pageSize"
  52. :page-sizes="pageSizeArr"
  53. @size-change="handleSizeChange"
  54. :layout="pageLayout"
  55. :total="total"
  56. ></el-pagination>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import api from '@api/icss.js';
  63. import config from '@api/config.js';
  64. import utils from '@api/utils.js';
  65. export default {
  66. name: 'Pacs', //化验大小项和公表维护
  67. data: function() {
  68. return {
  69. list: [],
  70. searched: false,
  71. filter: {
  72. hisName: '', // 医院诊断名称
  73. uniqueName: '' //标准诊断名称
  74. },
  75. currentPage: 1,
  76. pageSize: config.pageSize,
  77. pageSizeArr: config.pageSizeArr,
  78. pageLayout: config.pageLayout,
  79. total: 0
  80. };
  81. },
  82. created() {
  83. const that = this;
  84. //返回时避免参数未赋值就获取列表
  85. setTimeout(function() {
  86. that.getDataList();
  87. });
  88. },
  89. watch: {
  90. filter: {
  91. handler: function() {
  92. this.searched = false;
  93. },
  94. deep: true
  95. }
  96. },
  97. beforeRouteEnter(to, from, next) {
  98. next(vm => {
  99. //const pm = to.param;
  100. Object.assign(vm, to.params);
  101. vm.inCurrentPage = to.params.currentPage;
  102. });
  103. },
  104. methods: {
  105. handleSizeChange(val) {
  106. this.pageSize = val;
  107. this.currentPage = utils.getCurrentPage(
  108. this.currentPage,
  109. this.total,
  110. this.pageSize
  111. );
  112. this.getDataList();
  113. },
  114. // 获取列表数据
  115. getDataList(isTurnPage) {
  116. const params = this.getFilterItems(isTurnPage);
  117. this.searched = true;
  118. const loading = this.$loading({
  119. lock: true,
  120. text: 'Loading',
  121. spinner: 'el-icon-loading',
  122. background: 'rgba(0, 0, 0, 0.7)'
  123. });
  124. api.getpacsPage(params).then(res => {
  125. loading.close();
  126. if (res.data.code === '0') {
  127. this.list = res.data.data && res.data.data.records;
  128. }
  129. this.total = res.data.data && res.data.data.total;
  130. if (this.inCurrentPage !== undefined) {
  131. this.currentPage = this.inCurrentPage;
  132. this.inCurrentPage = undefined;
  133. }
  134. });
  135. },
  136. // 处理列表请求数据参数
  137. getFilterItems(isTurnPage) {
  138. //翻页时筛选条件没点确定则清空
  139. if (isTurnPage && !this.searched) {
  140. this.clearFilter();
  141. }
  142. const param = {
  143. current: this.inCurrentPage || this.currentPage,
  144. size: this.pageSize,
  145. hisName: this.filter.hisName.trim(),
  146. uniqueName: this.filter.uniqueName.trim(),
  147. uniqueCode: ''
  148. };
  149. return param;
  150. },
  151. filterDatas() {
  152. this.currentPage = 1;
  153. this.getDataList();
  154. },
  155. addRelation() {
  156. const pam = this.searched
  157. ? {
  158. currentPage: this.currentPage,
  159. pageSize: this.pageSize,
  160. filter: this.filter
  161. }
  162. : { currentPage: this.currentPage, pageSize: this.pageSize };
  163. this.$router.push({ name: 'AddPacs', params: pam });
  164. },
  165. // 修改诊断关联-跳转至编辑页面
  166. modifyRelation(row) {
  167. const item = Object.assign({}, row);
  168. const pam = this.searched
  169. ? {
  170. currentPage: this.currentPage,
  171. pageSize: this.pageSize,
  172. filter: this.filter
  173. }
  174. : { currentPage: this.currentPage, pageSize: this.pageSize };
  175. this.$router.push({
  176. name: 'AddPacs',
  177. params: Object.assign(pam, { isEdit: true, data: item })
  178. });
  179. },
  180. currentChange(next) {
  181. this.currentPage = next;
  182. this.getDataList(true);
  183. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  184. // this.list = this.cacheData[next];
  185. // } else {
  186. // this.getDataList();
  187. // }
  188. },
  189. // 清空搜索参数
  190. clearFilter() {
  191. this.filter = {
  192. hisName: '',
  193. uniqueName: ''
  194. };
  195. },
  196. indexMethod(index) {
  197. return (this.currentPage - 1) * this.pageSize + index + 1;
  198. },
  199. getTagType(val) {
  200. return val;
  201. },
  202. warning(msg, type) {
  203. this.$message({
  204. showClose: true,
  205. message: msg,
  206. type: type || 'warning'
  207. });
  208. },
  209. showConfirmDialog(msg, resolve) {
  210. this.$alert(msg, '提示', {
  211. confirmButtonText: '确定',
  212. type: 'warning'
  213. })
  214. .then(() => {
  215. resolve();
  216. })
  217. .catch(() => {});
  218. },
  219. // 删除关联
  220. showDelDialog(id) {
  221. this.showConfirmDialog('是否删除该关联?', () => {
  222. api
  223. .deletePacsRecord({ id: id })
  224. .then(res => {
  225. if (res.data.code == '0') {
  226. if (!this.searched) {
  227. //未点确认时清空搜索条件
  228. this.clearFilter();
  229. }
  230. if (this.list.length == 1) {
  231. //当前在最后一页且只有一条数据时,删除后跳到前一页
  232. this.currentPage =
  233. this.currentPage === 1 ? 1 : this.currentPage - 1;
  234. }
  235. this.getDataList();
  236. this.warning(res.data.msg || '操作成功', 'success');
  237. } else {
  238. this.warning(res.data.msg);
  239. }
  240. })
  241. .catch(error => {
  242. this.warning(error);
  243. });
  244. });
  245. },
  246. // 导出数据
  247. exportData() {
  248. this.$confirm('确定要导出全部检查关联数据吗?', '', {
  249. confirmButtonText: '确定',
  250. cancelButtonText: '取消',
  251. cancelButtonClass: 'leftbtn',
  252. customClass: 'exportBox',
  253. title: '导出数据',
  254. beforeClose: (action, instance, done) => {
  255. if (action === 'confirm') {
  256. // instance.confirmButtonLoading = true;
  257. instance.confirmButtonText = '导出中...';
  258. api.exportPacsRecord().then(res => {
  259. if (res.status === 200) {
  260. setTimeout(() => {
  261. utils.downloadExportedData(res.data, '检查关联数据.xls');
  262. done();
  263. }, 1500);
  264. }
  265. });
  266. } else {
  267. done();
  268. }
  269. }
  270. })
  271. .then(() => {
  272. this.$message({ message: '导出成功', type: 'success' });
  273. })
  274. .catch(() => {
  275. this.$message({ message: '导出失败', type: 'waring' });
  276. });
  277. },
  278. // 跳转至导入页面
  279. importPage() {
  280. const pam = this.searched
  281. ? {
  282. currentPage: this.currentPage,
  283. pageSize: this.pageSize,
  284. filter: this.filter
  285. }
  286. : { currentPage: this.currentPage, pageSize: this.pageSize };
  287. this.$router.push({ name: 'ImportPacsRecord', params: pam });
  288. // this.$router.push({ name: 'ImportDiseaseRecord'});
  289. }
  290. }
  291. };
  292. </script>
  293. <style lang="less">
  294. @import '../../../less/admin.less';
  295. .delete {
  296. color: red;
  297. }
  298. .delete:hover {
  299. color: red;
  300. }
  301. .pagination {
  302. min-width: 1010px;
  303. }
  304. .exportBox {
  305. /deep/ .el-message-box__btns {
  306. margin-top: 20px;
  307. }
  308. /deep/ .el-message-box__message {
  309. text-align: center;
  310. }
  311. /deep/ .el-message-box__btns {
  312. text-align: center;
  313. margin-bottom: 24px;
  314. }
  315. /deep/ .leftbtn {
  316. margin-right: 46px;
  317. background-color: #d7d7d7;
  318. border-color: transparent;
  319. }
  320. }
  321. </style>