DisAndScaleRelation.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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.scaleName" placeholder="量表名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="关联标签:">
  9. <el-input size="mini" v-model="filter.disName" placeholder="关联标签" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button size="mini" @click="filterDatas">确认</el-button>
  13. <el-button size="mini" type="warning" @click="addRelation">添加关联</el-button>
  14. </el-form-item>
  15. </el-form>
  16. </crumbs>
  17. <div class="contents">
  18. <el-table
  19. :data="list"
  20. border
  21. style="width: 100%">
  22. <el-table-column
  23. :resizable = "false"
  24. type="index"
  25. :index = 'indexMethod'
  26. label="编号"
  27. width="60">
  28. </el-table-column>
  29. <el-table-column
  30. :resizable = "false"
  31. prop="gmtModified"
  32. label="操作时间"
  33. width="180">
  34. </el-table-column>
  35. <el-table-column
  36. :resizable = "false"
  37. prop="disName"
  38. label="关联标签"
  39. show-overflow-tooltip>
  40. </el-table-column>
  41. <el-table-column
  42. :resizable = "false"
  43. prop="scaleName"
  44. label="量表名称"
  45. show-overflow-tooltip>
  46. </el-table-column>
  47. <el-table-column
  48. :resizable = "false"
  49. prop="userName"
  50. label="操作人">
  51. </el-table-column>
  52. <el-table-column
  53. :resizable = "false"
  54. prop="operate"
  55. label="操作">
  56. <template slot-scope="scope">
  57. <el-button @click="modifyRelation(scope.row)" type="text" size="small">修改</el-button>
  58. <span style="margin:0 3px;">|</span>
  59. <el-button @click="showDelDialog(scope.row.id)" class="delete" type="text" size="small">删除</el-button>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <div class="pagination">
  64. <el-pagination v-if="total>pageSize"
  65. :current-page.sync="currentPage"
  66. @current-change="currentChange"
  67. background
  68. :page-size="pageSize"
  69. layout="total,prev, pager, next, jumper"
  70. :total="total">
  71. </el-pagination>
  72. </div>
  73. </div>
  74. <!-- <div class="pagination">
  75. <el-pagination v-if="total>pageSize"
  76. :current-page.sync="currentPage"
  77. @current-change="currentChange"
  78. background
  79. :page-size="pageSize"
  80. layout="total,prev, pager, next, jumper"
  81. :total="total">
  82. </el-pagination>
  83. </div> -->
  84. </div>
  85. </template>
  86. <script>
  87. import api from '@api/icss.js';
  88. export default {
  89. name: 'DisAndScaleRelation', //诊断量表关联维护
  90. data: function() {
  91. return {
  92. list: [],
  93. filter: {
  94. disName: '',
  95. scaleName: '',
  96. },
  97. currentPage: 1,
  98. pageSize: 10,
  99. total: 0,
  100. }
  101. },
  102. created() {
  103. this.getDataList()
  104. },
  105. methods: {
  106. getDataList() {
  107. const param = this.getFilterItems();
  108. api.getDisScaleAllInfo(param).then((res) => {
  109. if(res.data.code == '0') {
  110. this.list = res.data.data.records
  111. this.total = res.data.data.total;
  112. }
  113. })
  114. },
  115. filterDatas() {
  116. this.currentPage = 1;
  117. this.getDataList();
  118. },
  119. addRelation() {
  120. this.$router.push({name:'AddDisAndScaleRelation'})
  121. },
  122. modifyRelation(row) {
  123. console.log(row,'row')
  124. const param = {
  125. disId: row.disId
  126. }
  127. api.getDisScaleByDisId(param).then((res) => {
  128. if(res.data.code=='0'){
  129. const { data } = res.data
  130. const item = Object.assign({},row, {data: data});
  131. this.$router.push({name:'AddDisAndScaleRelation',params:{isEdit:true,data:item}});
  132. } else {
  133. this.warning(res.data.msg);
  134. }
  135. }).catch((error)=>{
  136. this.warning(error)
  137. })
  138. },
  139. currentChange(next) {
  140. this.currentPage = next;
  141. this.getDataList();
  142. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  143. // this.list = this.cacheData[next];
  144. // } else {
  145. // this.getDataList();
  146. // }
  147. },
  148. getFilterItems() {
  149. const param = {
  150. current: this.currentPage,
  151. size: this.pageSize,
  152. disName:this.filter.disName,
  153. scaleName: this.filter.scaleName
  154. };
  155. return param;
  156. },
  157. indexMethod(index) {
  158. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  159. },
  160. getTagType(val) {
  161. return val
  162. },
  163. warning(msg,type){
  164. this.$message({
  165. showClose: true,
  166. message:msg,
  167. type:type||'warning'
  168. })
  169. },
  170. showConfirmDialog(msg,resolve){
  171. this.$alert(msg, '提示', {
  172. confirmButtonText: '确定',
  173. type: 'warning'
  174. }).then(() => {
  175. resolve();
  176. }).catch(() => {});
  177. },
  178. showDelDialog(id){
  179. this.showConfirmDialog('是否删除该关联?',()=>{
  180. api.delDisScaleInfo({id:id}).then((res)=>{
  181. if(res.data.code=='0'){
  182. this.getDataList();
  183. this.warning(res.data.msg || '操作成功','success');
  184. }else{
  185. this.warning(res.data.msg);
  186. }
  187. }).catch((error)=>{
  188. this.warning(error);
  189. })
  190. });
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="less">
  196. @import "../../less/admin.less";
  197. .delete{
  198. color: red;
  199. }
  200. .delete:hover {
  201. color: red;
  202. }
  203. .pagination {
  204. min-width: 1010px;
  205. }
  206. </style>