ChronicAndIndexRelation.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div>
  3. <crumbs title="慢病指标值关联维护" style="min-width: 980px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="慢病名称:">
  6. <el-input size="mini" v-model="filter.diseaseName" placeholder="慢病名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item>
  9. <el-button size="mini" @click="filterDatas">确认</el-button>
  10. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  11. </el-form-item>
  12. </el-form>
  13. </crumbs>
  14. <div class="contents">
  15. <el-table
  16. :data="list"
  17. border
  18. style="width: 100%">
  19. <el-table-column
  20. :resizable = "false"
  21. type="index"
  22. :index = 'indexMethod'
  23. label="编号"
  24. width="60">
  25. </el-table-column>
  26. <el-table-column
  27. :resizable = "false"
  28. prop="gmtModified"
  29. label="操作时间"
  30. width="180">
  31. </el-table-column>
  32. <el-table-column
  33. :resizable = "false"
  34. prop="diseaseName"
  35. label="慢病名称"
  36. show-overflow-tooltip>
  37. </el-table-column>
  38. <el-table-column
  39. :resizable = "false"
  40. label="状态"
  41. show-overflow-tooltip>
  42. <template slot-scope="scope">
  43. <span :class="scope.row.state == 'N'?'':'delete'">
  44. {{scope.row.state == 'N'?'启用中':'已删除'}}
  45. </span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column
  49. :resizable = "false"
  50. prop="modifier"
  51. label="操作人">
  52. </el-table-column>
  53. <el-table-column
  54. :resizable = "false"
  55. prop="operate"
  56. label="操作">
  57. <template slot-scope="scope">
  58. <el-button :disabled="scope.row.state != 'N'" @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  59. <span style="margin:0 3px;">|</span>
  60. <el-button type="text" size="small" :class="scope.row.state == 'N'?'delete':'review'" @click="showDelDialog(scope.row)">{{scope.row.state == 'N'?'删除':'恢复'}}</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <div class="pagination">
  65. <el-pagination :current-page.sync="currentPage"
  66. @current-change="currentChange"
  67. background
  68. :page-size="pageSize"
  69. :page-sizes="pageSizeArr"
  70. @size-change="handleSizeChange"
  71. :layout="pageLayout"
  72. :total="total">
  73. </el-pagination>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import api from '@api/icss.js';
  80. import config from '@api/config.js';
  81. export default {
  82. name: 'ChronicAndIndexRelation', //慢病指标值关联维护
  83. data: function() {
  84. return {
  85. list: [],
  86. searched: false,
  87. filter: {
  88. diseaseName: ''
  89. },
  90. currentPage: 1,
  91. pageSize: config.pageSize,
  92. pageSizeArr:config.pageSizeArr,
  93. pageLayout:config.pageLayout,
  94. total: 0,
  95. }
  96. },
  97. created() {
  98. const that = this;
  99. setTimeout(function(){
  100. that.getDataList();
  101. });
  102. },
  103. watch: {
  104. 'filter': {
  105. handler: function () {
  106. this.searched = false;
  107. },
  108. deep: true
  109. }
  110. },
  111. beforeRouteEnter(to, from, next) {
  112. next(vm => {
  113. //const pm = to.param;
  114. Object.assign(vm, to.params);
  115. })
  116. },
  117. methods: {
  118. handleSizeChange(val){
  119. this.pageSize = val;
  120. this.getDataList();
  121. },
  122. getDataList(isTurnPage) {
  123. const param = this.getFilterItems(isTurnPage);
  124. this.searched = true;
  125. api.queryIndexConfigPages(param).then((res) => {
  126. if(res.data.code == '0') {
  127. this.list = res.data.data.records;
  128. this.total = res.data.data.total;
  129. }
  130. })
  131. },
  132. filterDatas() {
  133. this.currentPage = 1;
  134. this.getDataList();
  135. },
  136. addRelation() {
  137. const pam = this.searched ? {
  138. currentPage: this.currentPage,
  139. pageSize:this.pageSize,
  140. filter: this.filter
  141. } : {currentPage: this.currentPage,
  142. pageSize:this.pageSize};
  143. this.$router.push({name:'AddChronicAndIndexRelation', params: pam})
  144. },
  145. modifyRelation(row) {
  146. const param = {
  147. diseaseId: row.diseaseId
  148. };
  149. api.getIndexConfigLists(param).then((res) => {
  150. if(res.data.code == '0') {
  151. const pam = this.searched ? {
  152. currentPage: this.currentPage,
  153. pageSize:this.pageSize,
  154. filter: this.filter
  155. } : {currentPage: this.currentPage,
  156. pageSize:this.pageSize};
  157. const item = Object.assign({},row,{data: res.data.data});
  158. this.$router.push({name:'AddChronicAndIndexRelation',params:Object.assign(pam, {isEdit:true,data:item})});
  159. }
  160. })
  161. },
  162. currentChange(next) {
  163. this.currentPage = next;
  164. this.getDataList(true);
  165. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  166. // this.list = this.cacheData[next];
  167. // } else {
  168. // this.getDataList();
  169. // }
  170. },
  171. getFilterItems(isTurnPage) {
  172. //翻页时筛选条件没点确定则清空
  173. if(isTurnPage&&!this.searched){
  174. this.filter.diseaseName='';
  175. };
  176. const param = {
  177. current: this.currentPage,
  178. size: this.pageSize,
  179. diseaseName:this.filter.diseaseName.trim(),
  180. };
  181. return param;
  182. },
  183. indexMethod(index) {
  184. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  185. },
  186. getTagType(val) {
  187. return val
  188. },
  189. warning(msg,type){
  190. this.$message({
  191. showClose: true,
  192. message:msg,
  193. type:type||'warning'
  194. })
  195. },
  196. showConfirmDialog(msg,resolve){
  197. this.$alert(msg, '提示', {
  198. confirmButtonText: '确定',
  199. type: 'warning'
  200. }).then(() => {
  201. resolve();
  202. }).catch(() => {});
  203. },
  204. showDelDialog(row){
  205. const param = {
  206. diseaseId:row.diseaseId,
  207. state:row.state === 'N'?'Y':'N',
  208. }
  209. let warntTxt = row.state === 'N' ? '是否删除该关联?': '是否恢复该关联?';
  210. this.showConfirmDialog(warntTxt,()=>{
  211. api.cancelIndexConfigAlls(param).then((res)=>{
  212. if(res.data.code=='0'){
  213. if(!this.searched){
  214. //未点确认时清空搜索条件
  215. this.filter={
  216. diseaseName: ''
  217. };
  218. }
  219. if(row.state !== 'N'){ //恢复成功后跳转到筛选条件的首页
  220. this.currentPage = 1;
  221. }
  222. this.getDataList();
  223. this.warning(res.data.msg || '操作成功','success');
  224. }else{
  225. this.warning(res.data.msg);
  226. }
  227. }).catch((error)=>{
  228. this.warning(error);
  229. })
  230. });
  231. }
  232. }
  233. }
  234. </script>
  235. <style lang="less" scoped>
  236. @import "../../less/admin.less";
  237. .delete{
  238. color: red;
  239. }
  240. .delete:hover {
  241. color: red;
  242. }
  243. .review{
  244. color: #22ccc8;
  245. }
  246. .pagination {
  247. min-width: 1010px;
  248. }
  249. </style>