Переглянути джерело

查询列表设置数据字典样式回显

RuoYi 4 роки тому
батько
коміт
34a6f2e1f1

+ 5 - 15
ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm

@@ -106,7 +106,11 @@
106 106
         </template>
107 107
       </el-table-column>
108 108
 #elseif($column.list && "" != $column.dictType)
109
-      <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
109
+      <el-table-column label="${comment}" align="center" prop="${javaField}">
110
+        <template slot-scope="scope">
111
+          <dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/>
112
+        </template>
113
+      </el-table-column>
110 114
 #elseif($column.list && "" != $javaField)
111 115
 #if(${foreach.index} == 1)
112 116
       <el-table-column label="${comment}" prop="${javaField}" />
@@ -378,20 +382,6 @@ export default {
378 382
         this.${businessName}Options.push(data);
379 383
       });
380 384
     },
381
-#foreach ($column in $columns)
382
-#if(${column.dictType} != '')
383
-#set($parentheseIndex=$column.columnComment.indexOf("("))
384
-#if($parentheseIndex != -1)
385
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
386
-#else
387
-#set($comment=$column.columnComment)
388
-#end
389
-    // $comment字典翻译
390
-    ${column.javaField}Format(row, column) {
391
-      return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
392
-    },
393
-#end
394
-#end
395 385
     // 取消按钮
396 386
     cancel() {
397 387
       this.open = false;

+ 5 - 15
ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm

@@ -134,7 +134,11 @@
134 134
         </template>
135 135
       </el-table-column>
136 136
 #elseif($column.list && "" != $column.dictType)
137
-      <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
137
+      <el-table-column label="${comment}" align="center" prop="${javaField}">
138
+        <template slot-scope="scope">
139
+          <dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/>
140
+        </template>
141
+      </el-table-column>
138 142
 #elseif($column.list && "" != $javaField)
139 143
       <el-table-column label="${comment}" align="center" prop="${javaField}" />
140 144
 #end
@@ -423,20 +427,6 @@ export default {
423 427
         this.loading = false;
424 428
       });
425 429
     },
426
-#foreach ($column in $columns)
427
-#if(${column.dictType} != '')
428
-#set($parentheseIndex=$column.columnComment.indexOf("("))
429
-#if($parentheseIndex != -1)
430
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
431
-#else
432
-#set($comment=$column.columnComment)
433
-#end
434
-    // $comment字典翻译
435
-    ${column.javaField}Format(row, column) {
436
-      return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
437
-    },
438
-#end
439
-#end
440 430
     // 取消按钮
441 431
     cancel() {
442 432
       this.open = false;

+ 5 - 5
ruoyi-ui/src/views/monitor/job/index.vue

@@ -96,7 +96,11 @@
96 96
       <el-table-column type="selection" width="55" align="center" />
97 97
       <el-table-column label="任务编号" align="center" prop="jobId" />
98 98
       <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
99
-      <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" />
99
+      <el-table-column label="任务组名" align="center" prop="jobGroup">
100
+        <template slot-scope="scope">
101
+          <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/>
102
+        </template>
103
+      </el-table-column>
100 104
       <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
101 105
       <el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
102 106
       <el-table-column label="状态" align="center">
@@ -356,10 +360,6 @@ export default {
356 360
     jobGroupFormat(row, column) {
357 361
       return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
358 362
     },
359
-    // 状态字典翻译
360
-    statusFormat(row, column) {
361
-      return this.selectDictLabel(this.statusOptions, row.status);
362
-    },
363 363
     // 取消按钮
364 364
     cancel() {
365 365
       this.open = false;

+ 12 - 12
ruoyi-ui/src/views/monitor/job/log.vue

@@ -109,10 +109,18 @@
109 109
       <el-table-column type="selection" width="55" align="center" />
110 110
       <el-table-column label="日志编号" width="80" align="center" prop="jobLogId" />
111 111
       <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
112
-      <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" />
112
+      <el-table-column label="任务组名" align="center" prop="jobGroup" :show-overflow-tooltip="true">
113
+        <template slot-scope="scope">
114
+          <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/>
115
+        </template>
116
+      </el-table-column>
113 117
       <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
114 118
       <el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" />
115
-      <el-table-column label="执行状态" align="center" prop="status" :formatter="statusFormat" />
119
+      <el-table-column label="执行状态" align="center" prop="status">
120
+        <template slot-scope="scope">
121
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
122
+        </template>
123
+      </el-table-column>
116 124
       <el-table-column label="执行时间" align="center" prop="createTime" width="180">
117 125
         <template slot-scope="scope">
118 126
           <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -244,14 +252,6 @@ export default {
244 252
         }
245 253
       );
246 254
     },
247
-    // 执行状态字典翻译
248
-    statusFormat(row, column) {
249
-      return this.selectDictLabel(this.statusOptions, row.status);
250
-    },
251
-    // 任务组名字典翻译
252
-    jobGroupFormat(row, column) {
253
-      return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
254
-    },
255 255
     // 返回按钮
256 256
     handleClose() {
257 257
       this.$store.dispatch("tagsView/delView", this.$route);
@@ -290,7 +290,7 @@ export default {
290 290
         }).then(() => {
291 291
           this.getList();
292 292
           this.msgSuccess("删除成功");
293
-        })
293
+        }).catch(() => {});
294 294
     },
295 295
     /** 清空按钮操作 */
296 296
     handleClean() {
@@ -303,7 +303,7 @@ export default {
303 303
         }).then(() => {
304 304
           this.getList();
305 305
           this.msgSuccess("清空成功");
306
-        })
306
+        }).catch(() => {});
307 307
     },
308 308
     /** 导出按钮操作 */
309 309
     handleExport() {

+ 5 - 5
ruoyi-ui/src/views/system/config/index.vue

@@ -111,7 +111,11 @@
111 111
       <el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
112 112
       <el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
113 113
       <el-table-column label="参数键值" align="center" prop="configValue" />
114
-      <el-table-column label="系统内置" align="center" prop="configType" :formatter="typeFormat" />
114
+      <el-table-column label="系统内置" align="center" prop="configType">
115
+        <template slot-scope="scope">
116
+          <dict-tag :options="typeOptions" :value="scope.row.configType"/>
117
+        </template>
118
+      </el-table-column>
115 119
       <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
116 120
       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
117 121
         <template slot-scope="scope">
@@ -249,10 +253,6 @@ export default {
249 253
         }
250 254
       );
251 255
     },
252
-    // 参数系统内置字典翻译
253
-    typeFormat(row, column) {
254
-      return this.selectDictLabel(this.typeOptions, row.configType);
255
-    },
256 256
     // 取消按钮
257 257
     cancel() {
258 258
       this.open = false;

+ 13 - 13
ruoyi-ui/src/views/system/dept/index.vue

@@ -49,7 +49,11 @@
49 49
     >
50 50
       <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
51 51
       <el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
52
-      <el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
52
+      <el-table-column prop="status" label="状态" width="100">
53
+        <template slot-scope="scope">
54
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
55
+        </template>
56
+      </el-table-column>
53 57
       <el-table-column label="创建时间" align="center" prop="createTime" width="200">
54 58
         <template slot-scope="scope">
55 59
           <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -57,17 +61,17 @@
57 61
       </el-table-column>
58 62
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
59 63
         <template slot-scope="scope">
60
-          <el-button 
61
-            size="mini" 
62
-            type="text" 
63
-            icon="el-icon-edit" 
64
+          <el-button
65
+            size="mini"
66
+            type="text"
67
+            icon="el-icon-edit"
64 68
             @click="handleUpdate(scope.row)"
65 69
             v-hasPermi="['system:dept:edit']"
66 70
           >修改</el-button>
67
-          <el-button 
68
-            size="mini" 
69
-            type="text" 
70
-            icon="el-icon-plus" 
71
+          <el-button
72
+            size="mini"
73
+            type="text"
74
+            icon="el-icon-plus"
71 75
             @click="handleAdd(scope.row)"
72 76
             v-hasPermi="['system:dept:add']"
73 77
           >新增</el-button>
@@ -223,10 +227,6 @@ export default {
223 227
         children: node.children
224 228
       };
225 229
     },
226
-    // 字典状态字典翻译
227
-    statusFormat(row, column) {
228
-      return this.selectDictLabel(this.statusOptions, row.status);
229
-    },
230 230
     // 取消按钮
231 231
     cancel() {
232 232
       this.open = false;

+ 5 - 5
ruoyi-ui/src/views/system/logininfor/index.vue

@@ -95,7 +95,11 @@
95 95
       <el-table-column label="访问编号" align="center" prop="infoId" />
96 96
       <el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" />
97 97
       <el-table-column label="地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
98
-      <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
98
+      <el-table-column label="登录状态" align="center" prop="status">
99
+        <template slot-scope="scope">
100
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
101
+        </template>
102
+      </el-table-column>
99 103
       <el-table-column label="描述" align="center" prop="msg" />
100 104
       <el-table-column label="访问时间" align="center" prop="accessTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
101 105
         <template slot-scope="scope">
@@ -166,10 +170,6 @@ export default {
166 170
         }
167 171
       );
168 172
     },
169
-    // 登录状态字典翻译
170
-    statusFormat(row, column) {
171
-      return this.selectDictLabel(this.statusOptions, row.status);
172
-    },
173 173
     /** 搜索按钮操作 */
174 174
     handleQuery() {
175 175
       this.queryParams.pageNum = 1;

+ 13 - 23
ruoyi-ui/src/views/system/menu/index.vue

@@ -55,7 +55,11 @@
55 55
       <el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
56 56
       <el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
57 57
       <el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
58
-      <el-table-column prop="status" label="状态" :formatter="statusFormat" width="80"></el-table-column>
58
+      <el-table-column prop="status" label="状态" width="80">
59
+        <template slot-scope="scope">
60
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
61
+        </template>
62
+      </el-table-column>
59 63
       <el-table-column label="创建时间" align="center" prop="createTime">
60 64
         <template slot-scope="scope">
61 65
           <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -63,16 +67,16 @@
63 67
       </el-table-column>
64 68
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
65 69
         <template slot-scope="scope">
66
-          <el-button size="mini" 
67
-            type="text" 
68
-            icon="el-icon-edit" 
70
+          <el-button size="mini"
71
+            type="text"
72
+            icon="el-icon-edit"
69 73
             @click="handleUpdate(scope.row)"
70 74
             v-hasPermi="['system:menu:edit']"
71 75
           >修改</el-button>
72
-          <el-button 
73
-            size="mini" 
74
-            type="text" 
75
-            icon="el-icon-plus" 
76
+          <el-button
77
+            size="mini"
78
+            type="text"
79
+            icon="el-icon-plus"
76 80
             @click="handleAdd(scope.row)"
77 81
             v-hasPermi="['system:menu:add']"
78 82
           >新增</el-button>
@@ -338,20 +342,6 @@ export default {
338 342
         this.menuOptions.push(menu);
339 343
       });
340 344
     },
341
-    // 显示状态字典翻译
342
-    visibleFormat(row, column) {
343
-      if (row.menuType == "F") {
344
-        return "";
345
-      }
346
-      return this.selectDictLabel(this.visibleOptions, row.visible);
347
-    },
348
-    // 菜单状态字典翻译
349
-    statusFormat(row, column) {
350
-      if (row.menuType == "F") {
351
-        return "";
352
-      }
353
-      return this.selectDictLabel(this.statusOptions, row.status);
354
-    },
355 345
     // 取消按钮
356 346
     cancel() {
357 347
       this.open = false;
@@ -439,4 +429,4 @@ export default {
439 429
     }
440 430
   }
441 431
 };
442
-</script>
432
+</script>

+ 10 - 22
ruoyi-ui/src/views/system/notice/index.vue

@@ -80,20 +80,16 @@
80 80
         prop="noticeTitle"
81 81
         :show-overflow-tooltip="true"
82 82
       />
83
-      <el-table-column
84
-        label="公告类型"
85
-        align="center"
86
-        prop="noticeType"
87
-        :formatter="typeFormat"
88
-        width="100"
89
-      />
90
-      <el-table-column
91
-        label="状态"
92
-        align="center"
93
-        prop="status"
94
-        :formatter="statusFormat"
95
-        width="100"
96
-      />
83
+      <el-table-column label="公告类型" align="center" prop="noticeType" width="100">
84
+        <template slot-scope="scope">
85
+          <dict-tag :options="typeOptions" :value="scope.row.noticeType"/>
86
+        </template>
87
+      </el-table-column>
88
+      <el-table-column label="状态" align="center" prop="status" width="100">
89
+        <template slot-scope="scope">
90
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
91
+        </template>
92
+      </el-table-column>
97 93
       <el-table-column label="创建者" align="center" prop="createBy" width="100" />
98 94
       <el-table-column label="创建时间" align="center" prop="createTime" width="100">
99 95
         <template slot-scope="scope">
@@ -244,14 +240,6 @@ export default {
244 240
         this.loading = false;
245 241
       });
246 242
     },
247
-    // 公告状态字典翻译
248
-    statusFormat(row, column) {
249
-      return this.selectDictLabel(this.statusOptions, row.status);
250
-    },
251
-    // 公告状态字典翻译
252
-    typeFormat(row, column) {
253
-      return this.selectDictLabel(this.typeOptions, row.noticeType);
254
-    },
255 243
     // 取消按钮
256 244
     cancel() {
257 245
       this.open = false;

+ 10 - 6
ruoyi-ui/src/views/system/operlog/index.vue

@@ -110,11 +110,19 @@
110 110
       <el-table-column type="selection" width="55" align="center" />
111 111
       <el-table-column label="日志编号" align="center" prop="operId" />
112 112
       <el-table-column label="系统模块" align="center" prop="title" />
113
-      <el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" />
113
+      <el-table-column label="操作类型" align="center" prop="businessType">
114
+        <template slot-scope="scope">
115
+          <dict-tag :options="typeOptions" :value="scope.row.businessType"/>
116
+        </template>
117
+      </el-table-column>
114 118
       <el-table-column label="请求方式" align="center" prop="requestMethod" />
115 119
       <el-table-column label="操作人员" align="center" prop="operName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" width="100"/>
116 120
       <el-table-column label="主机" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" />
117
-      <el-table-column label="操作状态" align="center" prop="status" :formatter="statusFormat" />
121
+      <el-table-column label="操作状态" align="center" prop="status">
122
+        <template slot-scope="scope">
123
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
124
+        </template>
125
+      </el-table-column>
118 126
       <el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
119 127
         <template slot-scope="scope">
120 128
           <span>{{ parseTime(scope.row.operTime) }}</span>
@@ -247,10 +255,6 @@ export default {
247 255
         }
248 256
       );
249 257
     },
250
-    // 操作日志状态字典翻译
251
-    statusFormat(row, column) {
252
-      return this.selectDictLabel(this.statusOptions, row.status);
253
-    },
254 258
     // 操作日志类型字典翻译
255 259
     typeFormat(row, column) {
256 260
       return this.selectDictLabel(this.typeOptions, row.businessType);

+ 6 - 6
ruoyi-ui/src/views/system/post/index.vue

@@ -87,7 +87,11 @@
87 87
       <el-table-column label="岗位编码" align="center" prop="postCode" />
88 88
       <el-table-column label="岗位名称" align="center" prop="postName" />
89 89
       <el-table-column label="岗位排序" align="center" prop="postSort" />
90
-      <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
90
+      <el-table-column label="状态" align="center" prop="status">
91
+        <template slot-scope="scope">
92
+          <dict-tag :options="statusOptions" :value="scope.row.status"/>
93
+        </template>
94
+      </el-table-column>
91 95
       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
92 96
         <template slot-scope="scope">
93 97
           <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -112,7 +116,7 @@
112 116
         </template>
113 117
       </el-table-column>
114 118
     </el-table>
115
-    
119
+
116 120
     <pagination
117 121
       v-show="total>0"
118 122
       :total="total"
@@ -221,10 +225,6 @@ export default {
221 225
         this.loading = false;
222 226
       });
223 227
     },
224
-    // 岗位状态字典翻译
225
-    statusFormat(row, column) {
226
-      return this.selectDictLabel(this.statusOptions, row.status);
227
-    },
228 228
     // 取消按钮
229 229
     cancel() {
230 230
       this.open = false;