ChemicalAndCommonMapping.vue 10 KB

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