ChemicalAndCommonMapping.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. type: 'warning'
  216. })
  217. .then(() => {
  218. resolve();
  219. })
  220. .catch(() => {});
  221. },
  222. // 删除关联
  223. showDelDialog(id) {
  224. this.showConfirmDialog('是否删除该关联?', () => {
  225. api
  226. .deleteDiseaseRecord({ id: id })
  227. .then(res => {
  228. if (res.data.code == '0') {
  229. if (!this.searched) {
  230. //未点确认时清空搜索条件
  231. this.clearFilter();
  232. }
  233. if (this.list.length == 1) {
  234. //当前在最后一页且只有一条数据时,删除后跳到前一页
  235. this.currentPage =
  236. this.currentPage === 1 ? 1 : this.currentPage - 1;
  237. }
  238. this.getDataList();
  239. this.warning(res.data.msg || '操作成功', 'success');
  240. } else {
  241. this.warning(res.data.msg);
  242. }
  243. })
  244. .catch(error => {
  245. this.warning(error);
  246. });
  247. });
  248. },
  249. // 导出数据
  250. exportData() {
  251. this.$confirm('确定要导出全部诊断关联数据吗?', '', {
  252. confirmButtonText: '确定',
  253. cancelButtonText: '取消',
  254. cancelButtonClass: 'leftbtn',
  255. customClass: 'exportBox',
  256. title: '导出数据',
  257. beforeClose: (action, instance, done) => {
  258. if (action === 'confirm') {
  259. // instance.confirmButtonLoading = true;
  260. instance.confirmButtonText = '导出中...';
  261. api.exportDiseaseRecord().then(res => {
  262. if (res.status === 200) {
  263. setTimeout(() => {
  264. utils.downloadExportedData(res.data, '诊断关联数据.xls');
  265. done();
  266. }, 1500);
  267. }
  268. });
  269. } else {
  270. done();
  271. }
  272. }
  273. })
  274. .then(() => {
  275. this.$message({ message: '导出成功', type: 'success' });
  276. })
  277. .catch(() => {
  278. // this.$message({ message: '导出失败', type: 'waring' });
  279. });
  280. },
  281. // 跳转至导入页面
  282. importPage() {
  283. const pam = this.searched
  284. ? {
  285. currentPage: this.currentPage,
  286. pageSize: this.pageSize,
  287. filter: this.filter
  288. }
  289. : { currentPage: this.currentPage, pageSize: this.pageSize };
  290. this.$router.push({ name: 'ImportDiseaseRecord', params: pam });
  291. // this.$router.push({ name: 'ImportDiseaseRecord'});
  292. }
  293. }
  294. };
  295. </script>
  296. <style lang="less">
  297. @import '../../../less/admin.less';
  298. .delete {
  299. color: red;
  300. }
  301. .delete:hover {
  302. color: red;
  303. }
  304. .pagination {
  305. min-width: 1010px;
  306. }
  307. .el-message-box{
  308. /deep/.cancelBtn{
  309. background-color: #d7d7d7;
  310. border-color: transparent;
  311. }
  312. }
  313. .exportBox {
  314. /deep/ .el-message-box__btns {
  315. margin-top: 20px;
  316. }
  317. /deep/ .el-message-box__message {
  318. text-align: center;
  319. }
  320. /deep/ .el-message-box__btns {
  321. text-align: center;
  322. margin-bottom: 24px;
  323. }
  324. /deep/ .leftbtn {
  325. margin-right: 46px;
  326. background-color: #d7d7d7;
  327. border-color: transparent;
  328. }
  329. }
  330. </style>