正在显示
28 个修改的文件
包含
503 行增加
和
325 行删除
| @@ -58,6 +58,7 @@ public class VelocityUtils | @@ -58,6 +58,7 @@ public class VelocityUtils | ||
| 58 | velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); | 58 | velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); |
| 59 | velocityContext.put("columns", genTable.getColumns()); | 59 | velocityContext.put("columns", genTable.getColumns()); |
| 60 | velocityContext.put("table", genTable); | 60 | velocityContext.put("table", genTable); |
| 61 | + velocityContext.put("dicts", getDicts(genTable)); | ||
| 61 | setMenuVelocityContext(velocityContext, genTable); | 62 | setMenuVelocityContext(velocityContext, genTable); |
| 62 | if (GenConstants.TPL_TREE.equals(tplCategory)) | 63 | if (GenConstants.TPL_TREE.equals(tplCategory)) |
| 63 | { | 64 | { |
| @@ -261,6 +262,27 @@ public class VelocityUtils | @@ -261,6 +262,27 @@ public class VelocityUtils | ||
| 261 | } | 262 | } |
| 262 | 263 | ||
| 263 | /** | 264 | /** |
| 265 | + * 根据列类型获取字典组 | ||
| 266 | + * | ||
| 267 | + * @param genTable 业务表对象 | ||
| 268 | + * @return 返回字典组 | ||
| 269 | + */ | ||
| 270 | + public static String getDicts(GenTable genTable) | ||
| 271 | + { | ||
| 272 | + List<GenTableColumn> columns = genTable.getColumns(); | ||
| 273 | + List<String> dicts = new ArrayList<String>(); | ||
| 274 | + for (GenTableColumn column : columns) | ||
| 275 | + { | ||
| 276 | + if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( | ||
| 277 | + column.getHtmlType(), new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO })) | ||
| 278 | + { | ||
| 279 | + dicts.add("'" + column.getDictType() + "'"); | ||
| 280 | + } | ||
| 281 | + } | ||
| 282 | + return StringUtils.join(dicts, ", "); | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + /** | ||
| 264 | * 获取权限前缀 | 286 | * 获取权限前缀 |
| 265 | * | 287 | * |
| 266 | * @param moduleName 模块名称 | 288 | * @param moduleName 模块名称 |
| @@ -25,10 +25,10 @@ | @@ -25,10 +25,10 @@ | ||
| 25 | <el-form-item label="${comment}" prop="${column.javaField}"> | 25 | <el-form-item label="${comment}" prop="${column.javaField}"> |
| 26 | <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> | 26 | <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> |
| 27 | <el-option | 27 | <el-option |
| 28 | - v-for="dict in ${column.javaField}Options" | ||
| 29 | - :key="dict.dictValue" | ||
| 30 | - :label="dict.dictLabel" | ||
| 31 | - :value="dict.dictValue" | 28 | + v-for="dict in dict.type.${dictType}" |
| 29 | + :key="dict.value" | ||
| 30 | + :label="dict.label" | ||
| 31 | + :value="dict.value" | ||
| 32 | /> | 32 | /> |
| 33 | </el-select> | 33 | </el-select> |
| 34 | </el-form-item> | 34 | </el-form-item> |
| @@ -108,7 +108,7 @@ | @@ -108,7 +108,7 @@ | ||
| 108 | #elseif($column.list && "" != $column.dictType) | 108 | #elseif($column.list && "" != $column.dictType) |
| 109 | <el-table-column label="${comment}" align="center" prop="${javaField}"> | 109 | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| 110 | <template slot-scope="scope"> | 110 | <template slot-scope="scope"> |
| 111 | - <dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/> | 111 | + <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> |
| 112 | </template> | 112 | </template> |
| 113 | </el-table-column> | 113 | </el-table-column> |
| 114 | #elseif($column.list && "" != $javaField) | 114 | #elseif($column.list && "" != $javaField) |
| @@ -184,10 +184,10 @@ | @@ -184,10 +184,10 @@ | ||
| 184 | <el-form-item label="${comment}" prop="${field}"> | 184 | <el-form-item label="${comment}" prop="${field}"> |
| 185 | <el-select v-model="form.${field}" placeholder="请选择${comment}"> | 185 | <el-select v-model="form.${field}" placeholder="请选择${comment}"> |
| 186 | <el-option | 186 | <el-option |
| 187 | - v-for="dict in ${field}Options" | ||
| 188 | - :key="dict.dictValue" | ||
| 189 | - :label="dict.dictLabel" | ||
| 190 | - #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end | 187 | + v-for="dict in dict.type.${dictType}" |
| 188 | + :key="dict.value" | ||
| 189 | + :label="dict.label" | ||
| 190 | + #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end | ||
| 191 | 191 | ||
| 192 | ></el-option> | 192 | ></el-option> |
| 193 | </el-select> | 193 | </el-select> |
| @@ -202,10 +202,10 @@ | @@ -202,10 +202,10 @@ | ||
| 202 | <el-form-item label="${comment}"> | 202 | <el-form-item label="${comment}"> |
| 203 | <el-checkbox-group v-model="form.${field}"> | 203 | <el-checkbox-group v-model="form.${field}"> |
| 204 | <el-checkbox | 204 | <el-checkbox |
| 205 | - v-for="dict in ${field}Options" | ||
| 206 | - :key="dict.dictValue" | ||
| 207 | - :label="dict.dictValue"> | ||
| 208 | - {{dict.dictLabel}} | 205 | + v-for="dict in dict.type.${dictType}" |
| 206 | + :key="dict.value" | ||
| 207 | + :label="dict.value"> | ||
| 208 | + {{dict.label}} | ||
| 209 | </el-checkbox> | 209 | </el-checkbox> |
| 210 | </el-checkbox-group> | 210 | </el-checkbox-group> |
| 211 | </el-form-item> | 211 | </el-form-item> |
| @@ -219,11 +219,11 @@ | @@ -219,11 +219,11 @@ | ||
| 219 | <el-form-item label="${comment}"> | 219 | <el-form-item label="${comment}"> |
| 220 | <el-radio-group v-model="form.${field}"> | 220 | <el-radio-group v-model="form.${field}"> |
| 221 | <el-radio | 221 | <el-radio |
| 222 | - v-for="dict in ${field}Options" | ||
| 223 | - :key="dict.dictValue" | ||
| 224 | - #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end | 222 | + v-for="dict in dict.type.${dictType}" |
| 223 | + :key="dict.value" | ||
| 224 | + #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end | ||
| 225 | 225 | ||
| 226 | - >{{dict.dictLabel}}</el-radio> | 226 | + >{{dict.label}}</el-radio> |
| 227 | </el-radio-group> | 227 | </el-radio-group> |
| 228 | </el-form-item> | 228 | </el-form-item> |
| 229 | #elseif($column.htmlType == "radio" && $dictType) | 229 | #elseif($column.htmlType == "radio" && $dictType) |
| @@ -265,6 +265,9 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"; | @@ -265,6 +265,9 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"; | ||
| 265 | 265 | ||
| 266 | export default { | 266 | export default { |
| 267 | name: "${BusinessName}", | 267 | name: "${BusinessName}", |
| 268 | +#if(${dicts} != '') | ||
| 269 | + dicts: [${dicts}], | ||
| 270 | +#end | ||
| 268 | components: { | 271 | components: { |
| 269 | Treeselect | 272 | Treeselect |
| 270 | }, | 273 | }, |
| @@ -283,16 +286,7 @@ export default { | @@ -283,16 +286,7 @@ export default { | ||
| 283 | // 是否显示弹出层 | 286 | // 是否显示弹出层 |
| 284 | open: false, | 287 | open: false, |
| 285 | #foreach ($column in $columns) | 288 | #foreach ($column in $columns) |
| 286 | -#set($parentheseIndex=$column.columnComment.indexOf("(")) | ||
| 287 | -#if($parentheseIndex != -1) | ||
| 288 | -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) | ||
| 289 | -#else | ||
| 290 | -#set($comment=$column.columnComment) | ||
| 291 | -#end | ||
| 292 | -#if(${column.dictType} != '') | ||
| 293 | - // $comment字典 | ||
| 294 | - ${column.javaField}Options: [], | ||
| 295 | -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") | 289 | +#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| 296 | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 290 | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 297 | // $comment时间范围 | 291 | // $comment时间范围 |
| 298 | daterange${AttrName}: [], | 292 | daterange${AttrName}: [], |
| @@ -330,13 +324,6 @@ export default { | @@ -330,13 +324,6 @@ export default { | ||
| 330 | }, | 324 | }, |
| 331 | created() { | 325 | created() { |
| 332 | this.getList(); | 326 | this.getList(); |
| 333 | -#foreach ($column in $columns) | ||
| 334 | -#if(${column.dictType} != '') | ||
| 335 | - this.getDicts("${column.dictType}").then(response => { | ||
| 336 | - this.${column.javaField}Options = response.data; | ||
| 337 | - }); | ||
| 338 | -#end | ||
| 339 | -#end | ||
| 340 | }, | 327 | }, |
| 341 | methods: { | 328 | methods: { |
| 342 | /** 查询${functionName}列表 */ | 329 | /** 查询${functionName}列表 */ |
| @@ -25,10 +25,10 @@ | @@ -25,10 +25,10 @@ | ||
| 25 | <el-form-item label="${comment}" prop="${column.javaField}"> | 25 | <el-form-item label="${comment}" prop="${column.javaField}"> |
| 26 | <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> | 26 | <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> |
| 27 | <el-option | 27 | <el-option |
| 28 | - v-for="dict in ${column.javaField}Options" | ||
| 29 | - :key="dict.dictValue" | ||
| 30 | - :label="dict.dictLabel" | ||
| 31 | - :value="dict.dictValue" | 28 | + v-for="dict in dict.type.${dictType}" |
| 29 | + :key="dict.value" | ||
| 30 | + :label="dict.label" | ||
| 31 | + :value="dict.value" | ||
| 32 | /> | 32 | /> |
| 33 | </el-select> | 33 | </el-select> |
| 34 | </el-form-item> | 34 | </el-form-item> |
| @@ -137,7 +137,7 @@ | @@ -137,7 +137,7 @@ | ||
| 137 | #elseif($column.list && "" != $column.dictType) | 137 | #elseif($column.list && "" != $column.dictType) |
| 138 | <el-table-column label="${comment}" align="center" prop="${javaField}"> | 138 | <el-table-column label="${comment}" align="center" prop="${javaField}"> |
| 139 | <template slot-scope="scope"> | 139 | <template slot-scope="scope"> |
| 140 | - <dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/> | 140 | + <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/> |
| 141 | </template> | 141 | </template> |
| 142 | </el-table-column> | 142 | </el-table-column> |
| 143 | #elseif($column.list && "" != $javaField) | 143 | #elseif($column.list && "" != $javaField) |
| @@ -206,10 +206,10 @@ | @@ -206,10 +206,10 @@ | ||
| 206 | <el-form-item label="${comment}" prop="${field}"> | 206 | <el-form-item label="${comment}" prop="${field}"> |
| 207 | <el-select v-model="form.${field}" placeholder="请选择${comment}"> | 207 | <el-select v-model="form.${field}" placeholder="请选择${comment}"> |
| 208 | <el-option | 208 | <el-option |
| 209 | - v-for="dict in ${field}Options" | ||
| 210 | - :key="dict.dictValue" | ||
| 211 | - :label="dict.dictLabel" | ||
| 212 | - #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end | 209 | + v-for="dict in dict.type.${dictType}" |
| 210 | + :key="dict.value" | ||
| 211 | + :label="dict.label" | ||
| 212 | + #if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end | ||
| 213 | 213 | ||
| 214 | ></el-option> | 214 | ></el-option> |
| 215 | </el-select> | 215 | </el-select> |
| @@ -224,10 +224,10 @@ | @@ -224,10 +224,10 @@ | ||
| 224 | <el-form-item label="${comment}"> | 224 | <el-form-item label="${comment}"> |
| 225 | <el-checkbox-group v-model="form.${field}"> | 225 | <el-checkbox-group v-model="form.${field}"> |
| 226 | <el-checkbox | 226 | <el-checkbox |
| 227 | - v-for="dict in ${field}Options" | ||
| 228 | - :key="dict.dictValue" | ||
| 229 | - :label="dict.dictValue"> | ||
| 230 | - {{dict.dictLabel}} | 227 | + v-for="dict in dict.type.${dictType}" |
| 228 | + :key="dict.value" | ||
| 229 | + :label="dict.value"> | ||
| 230 | + {{dict.label}} | ||
| 231 | </el-checkbox> | 231 | </el-checkbox> |
| 232 | </el-checkbox-group> | 232 | </el-checkbox-group> |
| 233 | </el-form-item> | 233 | </el-form-item> |
| @@ -241,11 +241,11 @@ | @@ -241,11 +241,11 @@ | ||
| 241 | <el-form-item label="${comment}"> | 241 | <el-form-item label="${comment}"> |
| 242 | <el-radio-group v-model="form.${field}"> | 242 | <el-radio-group v-model="form.${field}"> |
| 243 | <el-radio | 243 | <el-radio |
| 244 | - v-for="dict in ${field}Options" | ||
| 245 | - :key="dict.dictValue" | ||
| 246 | - #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end | 244 | + v-for="dict in dict.type.${dictType}" |
| 245 | + :key="dict.value" | ||
| 246 | + #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end | ||
| 247 | 247 | ||
| 248 | - >{{dict.dictLabel}}</el-radio> | 248 | + >{{dict.label}}</el-radio> |
| 249 | </el-radio-group> | 249 | </el-radio-group> |
| 250 | </el-form-item> | 250 | </el-form-item> |
| 251 | #elseif($column.htmlType == "radio" && $dictType) | 251 | #elseif($column.htmlType == "radio" && $dictType) |
| @@ -317,6 +317,9 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${Busin | @@ -317,6 +317,9 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${Busin | ||
| 317 | 317 | ||
| 318 | export default { | 318 | export default { |
| 319 | name: "${BusinessName}", | 319 | name: "${BusinessName}", |
| 320 | +#if(${dicts} != '') | ||
| 321 | + dicts: [${dicts}], | ||
| 322 | +#end | ||
| 320 | data() { | 323 | data() { |
| 321 | return { | 324 | return { |
| 322 | // 遮罩层 | 325 | // 遮罩层 |
| @@ -348,16 +351,7 @@ export default { | @@ -348,16 +351,7 @@ export default { | ||
| 348 | // 是否显示弹出层 | 351 | // 是否显示弹出层 |
| 349 | open: false, | 352 | open: false, |
| 350 | #foreach ($column in $columns) | 353 | #foreach ($column in $columns) |
| 351 | -#set($parentheseIndex=$column.columnComment.indexOf("(")) | ||
| 352 | -#if($parentheseIndex != -1) | ||
| 353 | -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) | ||
| 354 | -#else | ||
| 355 | -#set($comment=$column.columnComment) | ||
| 356 | -#end | ||
| 357 | -#if(${column.dictType} != '') | ||
| 358 | - // $comment字典 | ||
| 359 | - ${column.javaField}Options: [], | ||
| 360 | -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") | 354 | +#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
| 361 | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 355 | #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 362 | // $comment时间范围 | 356 | // $comment时间范围 |
| 363 | daterange${AttrName}: [], | 357 | daterange${AttrName}: [], |
| @@ -397,13 +391,6 @@ export default { | @@ -397,13 +391,6 @@ export default { | ||
| 397 | }, | 391 | }, |
| 398 | created() { | 392 | created() { |
| 399 | this.getList(); | 393 | this.getList(); |
| 400 | -#foreach ($column in $columns) | ||
| 401 | -#if(${column.dictType} != '') | ||
| 402 | - this.getDicts("${column.dictType}").then(response => { | ||
| 403 | - this.${column.javaField}Options = response.data; | ||
| 404 | - }); | ||
| 405 | -#end | ||
| 406 | -#end | ||
| 407 | }, | 394 | }, |
| 408 | methods: { | 395 | methods: { |
| 409 | /** 查询${functionName}列表 */ | 396 | /** 查询${functionName}列表 */ |
ruoyi-ui/src/components/DictData/index.js
0 → 100644
| 1 | +import Vue from 'vue' | ||
| 2 | +import DataDict from '@/utils/dict' | ||
| 3 | +import { getDicts as getDicts } from '@/api/system/dict/data' | ||
| 4 | + | ||
| 5 | +function install() { | ||
| 6 | + Vue.use(DataDict, { | ||
| 7 | + metas: { | ||
| 8 | + '*': { | ||
| 9 | + labelField: 'dictLabel', | ||
| 10 | + valueField: 'dictValue', | ||
| 11 | + request(dictMeta) { | ||
| 12 | + return getDicts(dictMeta.type).then(res => res.data) | ||
| 13 | + }, | ||
| 14 | + }, | ||
| 15 | + }, | ||
| 16 | + }) | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +export default { | ||
| 20 | + install, | ||
| 21 | +} |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | <template v-for="(item, index) in options"> | 3 | <template v-for="(item, index) in options"> |
| 4 | - <template v-if="values.includes(item.dictValue)"> | 4 | + <template v-if="values.includes(item.value)"> |
| 5 | <span | 5 | <span |
| 6 | - v-if="item.listClass == 'default' || item.listClass == ''" | ||
| 7 | - :key="item.dictValue" | 6 | + v-if="item.raw.listClass == 'default' || item.raw.listClass == ''" |
| 7 | + :key="item.value" | ||
| 8 | :index="index" | 8 | :index="index" |
| 9 | - :class="item.cssClass" | ||
| 10 | - >{{ item.dictLabel }}</span | 9 | + :class="item.raw.cssClass" |
| 10 | + >{{ item.label }}</span | ||
| 11 | > | 11 | > |
| 12 | <el-tag | 12 | <el-tag |
| 13 | v-else | 13 | v-else |
| 14 | :disable-transitions="true" | 14 | :disable-transitions="true" |
| 15 | - :key="item.dictValue" | 15 | + :key="item.value" |
| 16 | :index="index" | 16 | :index="index" |
| 17 | - :type="item.listClass == 'primary' ? '' : item.listClass" | ||
| 18 | - :class="item.cssClass" | 17 | + :type="item.raw.listClass == 'primary' ? '' : item.raw.listClass" |
| 18 | + :class="item.raw.cssClass" | ||
| 19 | > | 19 | > |
| 20 | - {{ item.dictLabel }} | 20 | + {{ item.label }} |
| 21 | </el-tag> | 21 | </el-tag> |
| 22 | </template> | 22 | </template> |
| 23 | </template> | 23 | </template> |
| @@ -49,4 +49,4 @@ export default { | @@ -49,4 +49,4 @@ export default { | ||
| 49 | .el-tag + .el-tag { | 49 | .el-tag + .el-tag { |
| 50 | margin-left: 10px; | 50 | margin-left: 10px; |
| 51 | } | 51 | } |
| 52 | -</style> | 52 | +</style> |
| @@ -30,6 +30,8 @@ import ImageUpload from "@/components/ImageUpload" | @@ -30,6 +30,8 @@ import ImageUpload from "@/components/ImageUpload" | ||
| 30 | import DictTag from '@/components/DictTag' | 30 | import DictTag from '@/components/DictTag' |
| 31 | // 头部标签组件 | 31 | // 头部标签组件 |
| 32 | import VueMeta from 'vue-meta' | 32 | import VueMeta from 'vue-meta' |
| 33 | +// 字典数据组件 | ||
| 34 | +import DictData from '@/components/DictData' | ||
| 33 | 35 | ||
| 34 | // 全局方法挂载 | 36 | // 全局方法挂载 |
| 35 | Vue.prototype.getDicts = getDicts | 37 | Vue.prototype.getDicts = getDicts |
| @@ -64,6 +66,7 @@ Vue.component('ImageUpload', ImageUpload) | @@ -64,6 +66,7 @@ Vue.component('ImageUpload', ImageUpload) | ||
| 64 | 66 | ||
| 65 | Vue.use(directive) | 67 | Vue.use(directive) |
| 66 | Vue.use(VueMeta) | 68 | Vue.use(VueMeta) |
| 69 | +DictData.install() | ||
| 67 | 70 | ||
| 68 | /** | 71 | /** |
| 69 | * If you don't want to use mock-server | 72 | * If you don't want to use mock-server |
ruoyi-ui/src/utils/dict/Dict.js
0 → 100644
| 1 | +import Vue from 'vue' | ||
| 2 | +import { mergeRecursive } from "@/utils/ruoyi"; | ||
| 3 | +import DictMeta from './DictMeta' | ||
| 4 | +import DictData from './DictData' | ||
| 5 | + | ||
| 6 | +const DEFAULT_DICT_OPTIONS = { | ||
| 7 | + types: [], | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @classdesc 字典 | ||
| 12 | + * @property {Object} label 标签对象,内部属性名为字典类型名称 | ||
| 13 | + * @property {Object} dict 字段数组,内部属性名为字典类型名称 | ||
| 14 | + * @property {Array.<DictMeta>} _dictMetas 字典元数据数组 | ||
| 15 | + */ | ||
| 16 | +export default class Dict { | ||
| 17 | + constructor() { | ||
| 18 | + this.owner = null | ||
| 19 | + this.label = {} | ||
| 20 | + this.type = {} | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + init(options) { | ||
| 24 | + if (options instanceof Array) { | ||
| 25 | + options = { types: options } | ||
| 26 | + } | ||
| 27 | + const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options) | ||
| 28 | + if (opts.types === undefined) { | ||
| 29 | + throw new Error('need dict types') | ||
| 30 | + } | ||
| 31 | + const ps = [] | ||
| 32 | + this._dictMetas = opts.types.map(t => DictMeta.parse(t)) | ||
| 33 | + this._dictMetas.forEach(dictMeta => { | ||
| 34 | + const type = dictMeta.type | ||
| 35 | + Vue.set(this.label, type, {}) | ||
| 36 | + Vue.set(this.type, type, []) | ||
| 37 | + if (dictMeta.lazy) { | ||
| 38 | + return | ||
| 39 | + } | ||
| 40 | + ps.push(loadDict(this, dictMeta)) | ||
| 41 | + }) | ||
| 42 | + return Promise.all(ps) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 重新加载字典 | ||
| 47 | + * @param {String} type 字典类型 | ||
| 48 | + */ | ||
| 49 | + reloadDict(type) { | ||
| 50 | + const dictMeta = this._dictMetas.find(e => e.type === type) | ||
| 51 | + if (dictMeta === undefined) { | ||
| 52 | + return Promise.reject(`the dict meta of ${type} was not found`) | ||
| 53 | + } | ||
| 54 | + return loadDict(this, dictMeta) | ||
| 55 | + } | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +/** | ||
| 59 | + * 加载字典 | ||
| 60 | + * @param {Dict} dict 字典 | ||
| 61 | + * @param {DictMeta} dictMeta 字典元数据 | ||
| 62 | + * @returns {Promise} | ||
| 63 | + */ | ||
| 64 | +function loadDict(dict, dictMeta) { | ||
| 65 | + return dictMeta.request(dictMeta) | ||
| 66 | + .then(response => { | ||
| 67 | + const type = dictMeta.type | ||
| 68 | + let dicts = dictMeta.responseConverter(response, dictMeta) | ||
| 69 | + if (!(dicts instanceof Array)) { | ||
| 70 | + console.error('the return of responseConverter must be Array.<DictData>') | ||
| 71 | + dicts = [] | ||
| 72 | + } else if (dicts.filter(d => d instanceof DictData).length !== dicts.length) { | ||
| 73 | + console.error('the type of elements in dicts must be DictData') | ||
| 74 | + dicts = [] | ||
| 75 | + } | ||
| 76 | + dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts) | ||
| 77 | + dicts.forEach(d => { | ||
| 78 | + Vue.set(dict.label[type], d.value, d.label) | ||
| 79 | + }) | ||
| 80 | + return dicts | ||
| 81 | + }) | ||
| 82 | +} |
ruoyi-ui/src/utils/dict/DictConverter.js
0 → 100644
| 1 | +import DictOptions from './DictOptions' | ||
| 2 | +import DictData from './DictData' | ||
| 3 | + | ||
| 4 | +export default function(dict, dictMeta) { | ||
| 5 | + const label = determineDictField(dict, dictMeta.labelField, ...DictOptions.DEFAULT_LABEL_FIELDS) | ||
| 6 | + const value = determineDictField(dict, dictMeta.valueField, ...DictOptions.DEFAULT_VALUE_FIELDS) | ||
| 7 | + return new DictData(dict[label], dict[value], dict) | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 确定字典字段 | ||
| 12 | + * @param {DictData} dict | ||
| 13 | + * @param {...String} fields | ||
| 14 | + */ | ||
| 15 | +function determineDictField(dict, ...fields) { | ||
| 16 | + return fields.find(f => Object.prototype.hasOwnProperty.call(dict, f)) | ||
| 17 | +} |
ruoyi-ui/src/utils/dict/DictData.js
0 → 100644
ruoyi-ui/src/utils/dict/DictMeta.js
0 → 100644
| 1 | +import { mergeRecursive } from "@/utils/ruoyi"; | ||
| 2 | +import DictOptions from './DictOptions' | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * @classdesc 字典元数据 | ||
| 6 | + * @property {String} type 类型 | ||
| 7 | + * @property {Function} request 请求 | ||
| 8 | + * @property {String} label 标签字段 | ||
| 9 | + * @property {String} value 值字段 | ||
| 10 | + */ | ||
| 11 | +export default class DictMeta { | ||
| 12 | + constructor(options) { | ||
| 13 | + this.type = options.type | ||
| 14 | + this.request = options.request, | ||
| 15 | + this.responseConverter = options.responseConverter | ||
| 16 | + this.labelField = options.labelField | ||
| 17 | + this.valueField = options.valueField | ||
| 18 | + this.lazy = options.lazy === true | ||
| 19 | + } | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * 解析字典元数据 | ||
| 25 | + * @param {Object} options | ||
| 26 | + * @returns {DictMeta} | ||
| 27 | + */ | ||
| 28 | +DictMeta.parse= function(options) { | ||
| 29 | + let opts = null | ||
| 30 | + if (typeof options === 'string') { | ||
| 31 | + opts = DictOptions.metas[options] || {} | ||
| 32 | + opts.type = options | ||
| 33 | + } else if (typeof options === 'object') { | ||
| 34 | + opts = options | ||
| 35 | + } | ||
| 36 | + opts = mergeRecursive(DictOptions.metas['*'], opts) | ||
| 37 | + return new DictMeta(opts) | ||
| 38 | +} |
ruoyi-ui/src/utils/dict/DictOptions.js
0 → 100644
| 1 | +import { mergeRecursive } from "@/utils/ruoyi"; | ||
| 2 | +import dictConverter from './DictConverter' | ||
| 3 | + | ||
| 4 | +export const options = { | ||
| 5 | + metas: { | ||
| 6 | + '*': { | ||
| 7 | + /** | ||
| 8 | + * 字典请求,方法签名为function(dictMeta: DictMeta): Promise | ||
| 9 | + */ | ||
| 10 | + request: (dictMeta) => { | ||
| 11 | + console.log(`load dict ${dictMeta.type}`) | ||
| 12 | + return Promise.resolve([]) | ||
| 13 | + }, | ||
| 14 | + /** | ||
| 15 | + * 字典响应数据转换器,方法签名为function(response: Object, dictMeta: DictMeta): DictData | ||
| 16 | + */ | ||
| 17 | + responseConverter, | ||
| 18 | + labelField: 'label', | ||
| 19 | + valueField: 'value', | ||
| 20 | + }, | ||
| 21 | + }, | ||
| 22 | + /** | ||
| 23 | + * 默认标签字段 | ||
| 24 | + */ | ||
| 25 | + DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'], | ||
| 26 | + /** | ||
| 27 | + * 默认值字段 | ||
| 28 | + */ | ||
| 29 | + DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'], | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * 映射字典 | ||
| 34 | + * @param {Object} response 字典数据 | ||
| 35 | + * @param {DictMeta} dictMeta 字典元数据 | ||
| 36 | + * @returns {DictData} | ||
| 37 | + */ | ||
| 38 | +function responseConverter(response, dictMeta) { | ||
| 39 | + const dicts = response.content instanceof Array ? response.content : response | ||
| 40 | + if (dicts === undefined) { | ||
| 41 | + console.warn(`no dict data of "${dictMeta.type}" found in the response`) | ||
| 42 | + return [] | ||
| 43 | + } | ||
| 44 | + return dicts.map(d => dictConverter(d, dictMeta)) | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +export function mergeOptions(src) { | ||
| 48 | + mergeRecursive(options, src) | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +export default options |
ruoyi-ui/src/utils/dict/index.js
0 → 100644
| 1 | +import Dict from './Dict' | ||
| 2 | +import { mergeOptions } from './DictOptions' | ||
| 3 | + | ||
| 4 | +export default function(Vue, options) { | ||
| 5 | + mergeOptions(options) | ||
| 6 | + Vue.mixin({ | ||
| 7 | + data() { | ||
| 8 | + if (this.$options.dicts === undefined || this.$options.dicts === null) { | ||
| 9 | + return {} | ||
| 10 | + } | ||
| 11 | + const dict = new Dict() | ||
| 12 | + dict.owner = this | ||
| 13 | + return { | ||
| 14 | + dict | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + created() { | ||
| 18 | + if (!(this.dict instanceof Dict)) { | ||
| 19 | + return | ||
| 20 | + } | ||
| 21 | + options.onCreated && options.onCreated(this.dict) | ||
| 22 | + this.dict.init(this.$options.dicts).then(() => { | ||
| 23 | + options.onReady && options.onReady(this.dict) | ||
| 24 | + this.$nextTick(() => { | ||
| 25 | + this.$emit('dictReady', this.dict) | ||
| 26 | + if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) { | ||
| 27 | + this.$options.methods.onDictReady.call(this, this.dict) | ||
| 28 | + } | ||
| 29 | + }) | ||
| 30 | + }) | ||
| 31 | + }, | ||
| 32 | + }) | ||
| 33 | +} |
| @@ -72,8 +72,8 @@ export function addDateRange(params, dateRange, propName) { | @@ -72,8 +72,8 @@ export function addDateRange(params, dateRange, propName) { | ||
| 72 | export function selectDictLabel(datas, value) { | 72 | export function selectDictLabel(datas, value) { |
| 73 | var actions = []; | 73 | var actions = []; |
| 74 | Object.keys(datas).some((key) => { | 74 | Object.keys(datas).some((key) => { |
| 75 | - if (datas[key].dictValue == ('' + value)) { | ||
| 76 | - actions.push(datas[key].dictLabel); | 75 | + if (datas[key].value == ('' + value)) { |
| 76 | + actions.push(datas[key].label); | ||
| 77 | return true; | 77 | return true; |
| 78 | } | 78 | } |
| 79 | }) | 79 | }) |
| @@ -122,6 +122,22 @@ export function praseStrEmpty(str) { | @@ -122,6 +122,22 @@ export function praseStrEmpty(str) { | ||
| 122 | return str; | 122 | return str; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | +// 数据合并 | ||
| 126 | +export function mergeRecursive(source, target) { | ||
| 127 | + for (var p in target) { | ||
| 128 | + try { | ||
| 129 | + if (target[p].constructor == Object) { | ||
| 130 | + source[p] = mergeRecursive(source[p], target[p]); | ||
| 131 | + } else { | ||
| 132 | + source[p] = target[p]; | ||
| 133 | + } | ||
| 134 | + } catch(e) { | ||
| 135 | + source[p] = target[p]; | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + return source; | ||
| 139 | +}; | ||
| 140 | + | ||
| 125 | /** | 141 | /** |
| 126 | * 构造树型结构数据 | 142 | * 构造树型结构数据 |
| 127 | * @param {*} data 数据源 | 143 | * @param {*} data 数据源 |
| @@ -13,20 +13,20 @@ | @@ -13,20 +13,20 @@ | ||
| 13 | <el-form-item label="任务组名" prop="jobGroup"> | 13 | <el-form-item label="任务组名" prop="jobGroup"> |
| 14 | <el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small"> | 14 | <el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small"> |
| 15 | <el-option | 15 | <el-option |
| 16 | - v-for="dict in jobGroupOptions" | ||
| 17 | - :key="dict.dictValue" | ||
| 18 | - :label="dict.dictLabel" | ||
| 19 | - :value="dict.dictValue" | 16 | + v-for="dict in dict.type.sys_job_group" |
| 17 | + :key="dict.value" | ||
| 18 | + :label="dict.label" | ||
| 19 | + :value="dict.value" | ||
| 20 | /> | 20 | /> |
| 21 | </el-select> | 21 | </el-select> |
| 22 | </el-form-item> | 22 | </el-form-item> |
| 23 | <el-form-item label="任务状态" prop="status"> | 23 | <el-form-item label="任务状态" prop="status"> |
| 24 | <el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small"> | 24 | <el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small"> |
| 25 | <el-option | 25 | <el-option |
| 26 | - v-for="dict in statusOptions" | ||
| 27 | - :key="dict.dictValue" | ||
| 28 | - :label="dict.dictLabel" | ||
| 29 | - :value="dict.dictValue" | 26 | + v-for="dict in dict.type.sys_job_status" |
| 27 | + :key="dict.value" | ||
| 28 | + :label="dict.label" | ||
| 29 | + :value="dict.value" | ||
| 30 | /> | 30 | /> |
| 31 | </el-select> | 31 | </el-select> |
| 32 | </el-form-item> | 32 | </el-form-item> |
| @@ -99,7 +99,7 @@ | @@ -99,7 +99,7 @@ | ||
| 99 | <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> | 99 | <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> |
| 100 | <el-table-column label="任务组名" align="center" prop="jobGroup"> | 100 | <el-table-column label="任务组名" align="center" prop="jobGroup"> |
| 101 | <template slot-scope="scope"> | 101 | <template slot-scope="scope"> |
| 102 | - <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/> | 102 | + <dict-tag :options="dict.type.sys_job_group" :value="scope.row.jobGroup"/> |
| 103 | </template> | 103 | </template> |
| 104 | </el-table-column> | 104 | </el-table-column> |
| 105 | <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> | 105 | <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> |
| @@ -168,10 +168,10 @@ | @@ -168,10 +168,10 @@ | ||
| 168 | <el-form-item label="任务分组" prop="jobGroup"> | 168 | <el-form-item label="任务分组" prop="jobGroup"> |
| 169 | <el-select v-model="form.jobGroup" placeholder="请选择"> | 169 | <el-select v-model="form.jobGroup" placeholder="请选择"> |
| 170 | <el-option | 170 | <el-option |
| 171 | - v-for="dict in jobGroupOptions" | ||
| 172 | - :key="dict.dictValue" | ||
| 173 | - :label="dict.dictLabel" | ||
| 174 | - :value="dict.dictValue" | 171 | + v-for="dict in dict.type.sys_job_group" |
| 172 | + :key="dict.value" | ||
| 173 | + :label="dict.label" | ||
| 174 | + :value="dict.value" | ||
| 175 | ></el-option> | 175 | ></el-option> |
| 176 | </el-select> | 176 | </el-select> |
| 177 | </el-form-item> | 177 | </el-form-item> |
| @@ -225,10 +225,10 @@ | @@ -225,10 +225,10 @@ | ||
| 225 | <el-form-item label="状态"> | 225 | <el-form-item label="状态"> |
| 226 | <el-radio-group v-model="form.status"> | 226 | <el-radio-group v-model="form.status"> |
| 227 | <el-radio | 227 | <el-radio |
| 228 | - v-for="dict in statusOptions" | ||
| 229 | - :key="dict.dictValue" | ||
| 230 | - :label="dict.dictValue" | ||
| 231 | - >{{dict.dictLabel}}</el-radio> | 228 | + v-for="dict in dict.type.sys_job_status" |
| 229 | + :key="dict.value" | ||
| 230 | + :label="dict.value" | ||
| 231 | + >{{dict.label}}</el-radio> | ||
| 232 | </el-radio-group> | 232 | </el-radio-group> |
| 233 | </el-form-item> | 233 | </el-form-item> |
| 234 | </el-col> | 234 | </el-col> |
| @@ -301,6 +301,7 @@ import Crontab from '@/components/Crontab' | @@ -301,6 +301,7 @@ import Crontab from '@/components/Crontab' | ||
| 301 | export default { | 301 | export default { |
| 302 | components: { Crontab }, | 302 | components: { Crontab }, |
| 303 | name: "Job", | 303 | name: "Job", |
| 304 | + dicts: ['sys_job_group', 'sys_job_status'], | ||
| 304 | data() { | 305 | data() { |
| 305 | return { | 306 | return { |
| 306 | // 遮罩层 | 307 | // 遮罩层 |
| @@ -329,10 +330,6 @@ export default { | @@ -329,10 +330,6 @@ export default { | ||
| 329 | openCron: false, | 330 | openCron: false, |
| 330 | // 传入的表达式 | 331 | // 传入的表达式 |
| 331 | expression: "", | 332 | expression: "", |
| 332 | - // 任务组名字典 | ||
| 333 | - jobGroupOptions: [], | ||
| 334 | - // 状态字典 | ||
| 335 | - statusOptions: [], | ||
| 336 | // 查询参数 | 333 | // 查询参数 |
| 337 | queryParams: { | 334 | queryParams: { |
| 338 | pageNum: 1, | 335 | pageNum: 1, |
| @@ -359,12 +356,6 @@ export default { | @@ -359,12 +356,6 @@ export default { | ||
| 359 | }, | 356 | }, |
| 360 | created() { | 357 | created() { |
| 361 | this.getList(); | 358 | this.getList(); |
| 362 | - this.getDicts("sys_job_group").then(response => { | ||
| 363 | - this.jobGroupOptions = response.data; | ||
| 364 | - }); | ||
| 365 | - this.getDicts("sys_job_status").then(response => { | ||
| 366 | - this.statusOptions = response.data; | ||
| 367 | - }); | ||
| 368 | }, | 359 | }, |
| 369 | methods: { | 360 | methods: { |
| 370 | /** 查询定时任务列表 */ | 361 | /** 查询定时任务列表 */ |
| @@ -378,7 +369,7 @@ export default { | @@ -378,7 +369,7 @@ export default { | ||
| 378 | }, | 369 | }, |
| 379 | // 任务组名字典翻译 | 370 | // 任务组名字典翻译 |
| 380 | jobGroupFormat(row, column) { | 371 | jobGroupFormat(row, column) { |
| 381 | - return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); | 372 | + return this.selectDictLabel(this.dict.type.sys_job_group, row.jobGroup); |
| 382 | }, | 373 | }, |
| 383 | // 取消按钮 | 374 | // 取消按钮 |
| 384 | cancel() { | 375 | cancel() { |
| @@ -20,10 +20,10 @@ | @@ -20,10 +20,10 @@ | ||
| 20 | style="width: 240px" | 20 | style="width: 240px" |
| 21 | > | 21 | > |
| 22 | <el-option | 22 | <el-option |
| 23 | - v-for="dict in jobGroupOptions" | ||
| 24 | - :key="dict.dictValue" | ||
| 25 | - :label="dict.dictLabel" | ||
| 26 | - :value="dict.dictValue" | 23 | + v-for="dict in dict.type.sys_job_group" |
| 24 | + :key="dict.value" | ||
| 25 | + :label="dict.label" | ||
| 26 | + :value="dict.value" | ||
| 27 | /> | 27 | /> |
| 28 | </el-select> | 28 | </el-select> |
| 29 | </el-form-item> | 29 | </el-form-item> |
| @@ -36,10 +36,10 @@ | @@ -36,10 +36,10 @@ | ||
| 36 | style="width: 240px" | 36 | style="width: 240px" |
| 37 | > | 37 | > |
| 38 | <el-option | 38 | <el-option |
| 39 | - v-for="dict in statusOptions" | ||
| 40 | - :key="dict.dictValue" | ||
| 41 | - :label="dict.dictLabel" | ||
| 42 | - :value="dict.dictValue" | 39 | + v-for="dict in dict.type.sys_common_status" |
| 40 | + :key="dict.value" | ||
| 41 | + :label="dict.label" | ||
| 42 | + :value="dict.value" | ||
| 43 | /> | 43 | /> |
| 44 | </el-select> | 44 | </el-select> |
| 45 | </el-form-item> | 45 | </el-form-item> |
| @@ -112,14 +112,14 @@ | @@ -112,14 +112,14 @@ | ||
| 112 | <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> | 112 | <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> |
| 113 | <el-table-column label="任务组名" align="center" prop="jobGroup" :show-overflow-tooltip="true"> | 113 | <el-table-column label="任务组名" align="center" prop="jobGroup" :show-overflow-tooltip="true"> |
| 114 | <template slot-scope="scope"> | 114 | <template slot-scope="scope"> |
| 115 | - <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/> | 115 | + <dict-tag :options="dict.type.sys_job_group" :value="scope.row.jobGroup"/> |
| 116 | </template> | 116 | </template> |
| 117 | </el-table-column> | 117 | </el-table-column> |
| 118 | <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> | 118 | <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> |
| 119 | <el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" /> | 119 | <el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" /> |
| 120 | <el-table-column label="执行状态" align="center" prop="status"> | 120 | <el-table-column label="执行状态" align="center" prop="status"> |
| 121 | <template slot-scope="scope"> | 121 | <template slot-scope="scope"> |
| 122 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 122 | + <dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/> |
| 123 | </template> | 123 | </template> |
| 124 | </el-table-column> | 124 | </el-table-column> |
| 125 | <el-table-column label="执行时间" align="center" prop="createTime" width="180"> | 125 | <el-table-column label="执行时间" align="center" prop="createTime" width="180"> |
| @@ -190,6 +190,7 @@ import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/ | @@ -190,6 +190,7 @@ import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/ | ||
| 190 | 190 | ||
| 191 | export default { | 191 | export default { |
| 192 | name: "JobLog", | 192 | name: "JobLog", |
| 193 | + dicts: ['sys_common_status', 'sys_job_group'], | ||
| 193 | data() { | 194 | data() { |
| 194 | return { | 195 | return { |
| 195 | // 遮罩层 | 196 | // 遮罩层 |
| @@ -212,10 +213,6 @@ export default { | @@ -212,10 +213,6 @@ export default { | ||
| 212 | dateRange: [], | 213 | dateRange: [], |
| 213 | // 表单参数 | 214 | // 表单参数 |
| 214 | form: {}, | 215 | form: {}, |
| 215 | - // 执行状态字典 | ||
| 216 | - statusOptions: [], | ||
| 217 | - // 任务组名字典 | ||
| 218 | - jobGroupOptions: [], | ||
| 219 | // 查询参数 | 216 | // 查询参数 |
| 220 | queryParams: { | 217 | queryParams: { |
| 221 | pageNum: 1, | 218 | pageNum: 1, |
| @@ -237,12 +234,6 @@ export default { | @@ -237,12 +234,6 @@ export default { | ||
| 237 | } else { | 234 | } else { |
| 238 | this.getList(); | 235 | this.getList(); |
| 239 | } | 236 | } |
| 240 | - this.getDicts("sys_common_status").then(response => { | ||
| 241 | - this.statusOptions = response.data; | ||
| 242 | - }); | ||
| 243 | - this.getDicts("sys_job_group").then(response => { | ||
| 244 | - this.jobGroupOptions = response.data; | ||
| 245 | - }); | ||
| 246 | }, | 237 | }, |
| 247 | methods: { | 238 | methods: { |
| 248 | /** 查询调度日志列表 */ | 239 | /** 查询调度日志列表 */ |
| @@ -30,10 +30,10 @@ | @@ -30,10 +30,10 @@ | ||
| 30 | style="width: 240px" | 30 | style="width: 240px" |
| 31 | > | 31 | > |
| 32 | <el-option | 32 | <el-option |
| 33 | - v-for="dict in statusOptions" | ||
| 34 | - :key="dict.dictValue" | ||
| 35 | - :label="dict.dictLabel" | ||
| 36 | - :value="dict.dictValue" | 33 | + v-for="dict in dict.type.sys_common_status" |
| 34 | + :key="dict.value" | ||
| 35 | + :label="dict.label" | ||
| 36 | + :value="dict.value" | ||
| 37 | /> | 37 | /> |
| 38 | </el-select> | 38 | </el-select> |
| 39 | </el-form-item> | 39 | </el-form-item> |
| @@ -101,7 +101,7 @@ | @@ -101,7 +101,7 @@ | ||
| 101 | <el-table-column label="操作系统" align="center" prop="os" /> | 101 | <el-table-column label="操作系统" align="center" prop="os" /> |
| 102 | <el-table-column label="登录状态" align="center" prop="status"> | 102 | <el-table-column label="登录状态" align="center" prop="status"> |
| 103 | <template slot-scope="scope"> | 103 | <template slot-scope="scope"> |
| 104 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 104 | + <dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/> |
| 105 | </template> | 105 | </template> |
| 106 | </el-table-column> | 106 | </el-table-column> |
| 107 | <el-table-column label="操作信息" align="center" prop="msg" /> | 107 | <el-table-column label="操作信息" align="center" prop="msg" /> |
| @@ -127,6 +127,7 @@ import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/mo | @@ -127,6 +127,7 @@ import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/mo | ||
| 127 | 127 | ||
| 128 | export default { | 128 | export default { |
| 129 | name: "Logininfor", | 129 | name: "Logininfor", |
| 130 | + dicts: ['sys_common_status'], | ||
| 130 | data() { | 131 | data() { |
| 131 | return { | 132 | return { |
| 132 | // 遮罩层 | 133 | // 遮罩层 |
| @@ -143,8 +144,6 @@ export default { | @@ -143,8 +144,6 @@ export default { | ||
| 143 | total: 0, | 144 | total: 0, |
| 144 | // 表格数据 | 145 | // 表格数据 |
| 145 | list: [], | 146 | list: [], |
| 146 | - // 状态数据字典 | ||
| 147 | - statusOptions: [], | ||
| 148 | // 日期范围 | 147 | // 日期范围 |
| 149 | dateRange: [], | 148 | dateRange: [], |
| 150 | // 默认排序 | 149 | // 默认排序 |
| @@ -161,9 +160,6 @@ export default { | @@ -161,9 +160,6 @@ export default { | ||
| 161 | }, | 160 | }, |
| 162 | created() { | 161 | created() { |
| 163 | this.getList(); | 162 | this.getList(); |
| 164 | - this.getDicts("sys_common_status").then(response => { | ||
| 165 | - this.statusOptions = response.data; | ||
| 166 | - }); | ||
| 167 | }, | 163 | }, |
| 168 | methods: { | 164 | methods: { |
| 169 | /** 查询登录日志列表 */ | 165 | /** 查询登录日志列表 */ |
| @@ -30,10 +30,10 @@ | @@ -30,10 +30,10 @@ | ||
| 30 | style="width: 240px" | 30 | style="width: 240px" |
| 31 | > | 31 | > |
| 32 | <el-option | 32 | <el-option |
| 33 | - v-for="dict in typeOptions" | ||
| 34 | - :key="dict.dictValue" | ||
| 35 | - :label="dict.dictLabel" | ||
| 36 | - :value="dict.dictValue" | 33 | + v-for="dict in dict.type.sys_oper_type" |
| 34 | + :key="dict.value" | ||
| 35 | + :label="dict.label" | ||
| 36 | + :value="dict.value" | ||
| 37 | /> | 37 | /> |
| 38 | </el-select> | 38 | </el-select> |
| 39 | </el-form-item> | 39 | </el-form-item> |
| @@ -46,10 +46,10 @@ | @@ -46,10 +46,10 @@ | ||
| 46 | style="width: 240px" | 46 | style="width: 240px" |
| 47 | > | 47 | > |
| 48 | <el-option | 48 | <el-option |
| 49 | - v-for="dict in statusOptions" | ||
| 50 | - :key="dict.dictValue" | ||
| 51 | - :label="dict.dictLabel" | ||
| 52 | - :value="dict.dictValue" | 49 | + v-for="dict in dict.type.sys_common_status" |
| 50 | + :key="dict.value" | ||
| 51 | + :label="dict.label" | ||
| 52 | + :value="dict.value" | ||
| 53 | /> | 53 | /> |
| 54 | </el-select> | 54 | </el-select> |
| 55 | </el-form-item> | 55 | </el-form-item> |
| @@ -113,7 +113,7 @@ | @@ -113,7 +113,7 @@ | ||
| 113 | <el-table-column label="系统模块" align="center" prop="title" /> | 113 | <el-table-column label="系统模块" align="center" prop="title" /> |
| 114 | <el-table-column label="操作类型" align="center" prop="businessType"> | 114 | <el-table-column label="操作类型" align="center" prop="businessType"> |
| 115 | <template slot-scope="scope"> | 115 | <template slot-scope="scope"> |
| 116 | - <dict-tag :options="typeOptions" :value="scope.row.businessType"/> | 116 | + <dict-tag :options="dict.type.sys_oper_type" :value="scope.row.businessType"/> |
| 117 | </template> | 117 | </template> |
| 118 | </el-table-column> | 118 | </el-table-column> |
| 119 | <el-table-column label="请求方式" align="center" prop="requestMethod" /> | 119 | <el-table-column label="请求方式" align="center" prop="requestMethod" /> |
| @@ -122,7 +122,7 @@ | @@ -122,7 +122,7 @@ | ||
| 122 | <el-table-column label="操作地点" align="center" prop="operLocation" :show-overflow-tooltip="true" /> | 122 | <el-table-column label="操作地点" align="center" prop="operLocation" :show-overflow-tooltip="true" /> |
| 123 | <el-table-column label="操作状态" align="center" prop="status"> | 123 | <el-table-column label="操作状态" align="center" prop="status"> |
| 124 | <template slot-scope="scope"> | 124 | <template slot-scope="scope"> |
| 125 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 125 | + <dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/> |
| 126 | </template> | 126 | </template> |
| 127 | </el-table-column> | 127 | </el-table-column> |
| 128 | <el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> | 128 | <el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180"> |
| @@ -200,6 +200,7 @@ import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/ope | @@ -200,6 +200,7 @@ import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/ope | ||
| 200 | 200 | ||
| 201 | export default { | 201 | export default { |
| 202 | name: "Operlog", | 202 | name: "Operlog", |
| 203 | + dicts: ['sys_oper_type', 'sys_common_status'], | ||
| 203 | data() { | 204 | data() { |
| 204 | return { | 205 | return { |
| 205 | // 遮罩层 | 206 | // 遮罩层 |
| @@ -218,10 +219,6 @@ export default { | @@ -218,10 +219,6 @@ export default { | ||
| 218 | list: [], | 219 | list: [], |
| 219 | // 是否显示弹出层 | 220 | // 是否显示弹出层 |
| 220 | open: false, | 221 | open: false, |
| 221 | - // 类型数据字典 | ||
| 222 | - typeOptions: [], | ||
| 223 | - // 类型数据字典 | ||
| 224 | - statusOptions: [], | ||
| 225 | // 日期范围 | 222 | // 日期范围 |
| 226 | dateRange: [], | 223 | dateRange: [], |
| 227 | // 默认排序 | 224 | // 默认排序 |
| @@ -241,12 +238,6 @@ export default { | @@ -241,12 +238,6 @@ export default { | ||
| 241 | }, | 238 | }, |
| 242 | created() { | 239 | created() { |
| 243 | this.getList(); | 240 | this.getList(); |
| 244 | - this.getDicts("sys_oper_type").then(response => { | ||
| 245 | - this.typeOptions = response.data; | ||
| 246 | - }); | ||
| 247 | - this.getDicts("sys_common_status").then(response => { | ||
| 248 | - this.statusOptions = response.data; | ||
| 249 | - }); | ||
| 250 | }, | 241 | }, |
| 251 | methods: { | 242 | methods: { |
| 252 | /** 查询登录日志 */ | 243 | /** 查询登录日志 */ |
| @@ -261,7 +252,7 @@ export default { | @@ -261,7 +252,7 @@ export default { | ||
| 261 | }, | 252 | }, |
| 262 | // 操作日志类型字典翻译 | 253 | // 操作日志类型字典翻译 |
| 263 | typeFormat(row, column) { | 254 | typeFormat(row, column) { |
| 264 | - return this.selectDictLabel(this.typeOptions, row.businessType); | 255 | + return this.selectDictLabel(this.dict.type.sys_oper_type, row.businessType); |
| 265 | }, | 256 | }, |
| 266 | /** 搜索按钮操作 */ | 257 | /** 搜索按钮操作 */ |
| 267 | handleQuery() { | 258 | handleQuery() { |
| @@ -24,10 +24,10 @@ | @@ -24,10 +24,10 @@ | ||
| 24 | <el-form-item label="系统内置" prop="configType"> | 24 | <el-form-item label="系统内置" prop="configType"> |
| 25 | <el-select v-model="queryParams.configType" placeholder="系统内置" clearable size="small"> | 25 | <el-select v-model="queryParams.configType" placeholder="系统内置" clearable size="small"> |
| 26 | <el-option | 26 | <el-option |
| 27 | - v-for="dict in typeOptions" | ||
| 28 | - :key="dict.dictValue" | ||
| 29 | - :label="dict.dictLabel" | ||
| 30 | - :value="dict.dictValue" | 27 | + v-for="dict in dict.type.sys_yes_no" |
| 28 | + :key="dict.value" | ||
| 29 | + :label="dict.label" | ||
| 30 | + :value="dict.value" | ||
| 31 | /> | 31 | /> |
| 32 | </el-select> | 32 | </el-select> |
| 33 | </el-form-item> | 33 | </el-form-item> |
| @@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
| 114 | <el-table-column label="参数键值" align="center" prop="configValue" /> | 114 | <el-table-column label="参数键值" align="center" prop="configValue" /> |
| 115 | <el-table-column label="系统内置" align="center" prop="configType"> | 115 | <el-table-column label="系统内置" align="center" prop="configType"> |
| 116 | <template slot-scope="scope"> | 116 | <template slot-scope="scope"> |
| 117 | - <dict-tag :options="typeOptions" :value="scope.row.configType"/> | 117 | + <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/> |
| 118 | </template> | 118 | </template> |
| 119 | </el-table-column> | 119 | </el-table-column> |
| 120 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> | 120 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> |
| @@ -166,10 +166,10 @@ | @@ -166,10 +166,10 @@ | ||
| 166 | <el-form-item label="系统内置" prop="configType"> | 166 | <el-form-item label="系统内置" prop="configType"> |
| 167 | <el-radio-group v-model="form.configType"> | 167 | <el-radio-group v-model="form.configType"> |
| 168 | <el-radio | 168 | <el-radio |
| 169 | - v-for="dict in typeOptions" | ||
| 170 | - :key="dict.dictValue" | ||
| 171 | - :label="dict.dictValue" | ||
| 172 | - >{{dict.dictLabel}}</el-radio> | 169 | + v-for="dict in dict.type.sys_yes_no" |
| 170 | + :key="dict.value" | ||
| 171 | + :label="dict.value" | ||
| 172 | + >{{dict.label}}</el-radio> | ||
| 173 | </el-radio-group> | 173 | </el-radio-group> |
| 174 | </el-form-item> | 174 | </el-form-item> |
| 175 | <el-form-item label="备注" prop="remark"> | 175 | <el-form-item label="备注" prop="remark"> |
| @@ -189,6 +189,7 @@ import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig | @@ -189,6 +189,7 @@ import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig | ||
| 189 | 189 | ||
| 190 | export default { | 190 | export default { |
| 191 | name: "Config", | 191 | name: "Config", |
| 192 | + dicts: ['sys_yes_no'], | ||
| 192 | data() { | 193 | data() { |
| 193 | return { | 194 | return { |
| 194 | // 遮罩层 | 195 | // 遮罩层 |
| @@ -211,8 +212,6 @@ export default { | @@ -211,8 +212,6 @@ export default { | ||
| 211 | title: "", | 212 | title: "", |
| 212 | // 是否显示弹出层 | 213 | // 是否显示弹出层 |
| 213 | open: false, | 214 | open: false, |
| 214 | - // 类型数据字典 | ||
| 215 | - typeOptions: [], | ||
| 216 | // 日期范围 | 215 | // 日期范围 |
| 217 | dateRange: [], | 216 | dateRange: [], |
| 218 | // 查询参数 | 217 | // 查询参数 |
| @@ -241,9 +240,6 @@ export default { | @@ -241,9 +240,6 @@ export default { | ||
| 241 | }, | 240 | }, |
| 242 | created() { | 241 | created() { |
| 243 | this.getList(); | 242 | this.getList(); |
| 244 | - this.getDicts("sys_yes_no").then(response => { | ||
| 245 | - this.typeOptions = response.data; | ||
| 246 | - }); | ||
| 247 | }, | 243 | }, |
| 248 | methods: { | 244 | methods: { |
| 249 | /** 查询参数列表 */ | 245 | /** 查询参数列表 */ |
| @@ -13,10 +13,10 @@ | @@ -13,10 +13,10 @@ | ||
| 13 | <el-form-item label="状态" prop="status"> | 13 | <el-form-item label="状态" prop="status"> |
| 14 | <el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small"> | 14 | <el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small"> |
| 15 | <el-option | 15 | <el-option |
| 16 | - v-for="dict in statusOptions" | ||
| 17 | - :key="dict.dictValue" | ||
| 18 | - :label="dict.dictLabel" | ||
| 19 | - :value="dict.dictValue" | 16 | + v-for="dict in dict.type.sys_normal_disable" |
| 17 | + :key="dict.value" | ||
| 18 | + :label="dict.label" | ||
| 19 | + :value="dict.value" | ||
| 20 | /> | 20 | /> |
| 21 | </el-select> | 21 | </el-select> |
| 22 | </el-form-item> | 22 | </el-form-item> |
| @@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
| 61 | <el-table-column prop="orderNum" label="排序" width="200"></el-table-column> | 61 | <el-table-column prop="orderNum" label="排序" width="200"></el-table-column> |
| 62 | <el-table-column prop="status" label="状态" width="100"> | 62 | <el-table-column prop="status" label="状态" width="100"> |
| 63 | <template slot-scope="scope"> | 63 | <template slot-scope="scope"> |
| 64 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 64 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 65 | </template> | 65 | </template> |
| 66 | </el-table-column> | 66 | </el-table-column> |
| 67 | <el-table-column label="创建时间" align="center" prop="createTime" width="200"> | 67 | <el-table-column label="创建时间" align="center" prop="createTime" width="200"> |
| @@ -135,10 +135,10 @@ | @@ -135,10 +135,10 @@ | ||
| 135 | <el-form-item label="部门状态"> | 135 | <el-form-item label="部门状态"> |
| 136 | <el-radio-group v-model="form.status"> | 136 | <el-radio-group v-model="form.status"> |
| 137 | <el-radio | 137 | <el-radio |
| 138 | - v-for="dict in statusOptions" | ||
| 139 | - :key="dict.dictValue" | ||
| 140 | - :label="dict.dictValue" | ||
| 141 | - >{{dict.dictLabel}}</el-radio> | 138 | + v-for="dict in dict.type.sys_normal_disable" |
| 139 | + :key="dict.value" | ||
| 140 | + :label="dict.value" | ||
| 141 | + >{{dict.label}}</el-radio> | ||
| 142 | </el-radio-group> | 142 | </el-radio-group> |
| 143 | </el-form-item> | 143 | </el-form-item> |
| 144 | </el-col> | 144 | </el-col> |
| @@ -159,6 +159,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"; | @@ -159,6 +159,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"; | ||
| 159 | 159 | ||
| 160 | export default { | 160 | export default { |
| 161 | name: "Dept", | 161 | name: "Dept", |
| 162 | + dicts: ['sys_normal_disable'], | ||
| 162 | components: { Treeselect }, | 163 | components: { Treeselect }, |
| 163 | data() { | 164 | data() { |
| 164 | return { | 165 | return { |
| @@ -180,8 +181,6 @@ export default { | @@ -180,8 +181,6 @@ export default { | ||
| 180 | refreshTable: true, | 181 | refreshTable: true, |
| 181 | // 是否展开 | 182 | // 是否展开 |
| 182 | expand: false, | 183 | expand: false, |
| 183 | - // 状态数据字典 | ||
| 184 | - statusOptions: [], | ||
| 185 | // 查询参数 | 184 | // 查询参数 |
| 186 | queryParams: { | 185 | queryParams: { |
| 187 | deptName: undefined, | 186 | deptName: undefined, |
| @@ -219,9 +218,6 @@ export default { | @@ -219,9 +218,6 @@ export default { | ||
| 219 | }, | 218 | }, |
| 220 | created() { | 219 | created() { |
| 221 | this.getList(); | 220 | this.getList(); |
| 222 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 223 | - this.statusOptions = response.data; | ||
| 224 | - }); | ||
| 225 | }, | 221 | }, |
| 226 | methods: { | 222 | methods: { |
| 227 | /** 查询部门列表 */ | 223 | /** 查询部门列表 */ |
| @@ -23,10 +23,10 @@ | @@ -23,10 +23,10 @@ | ||
| 23 | <el-form-item label="状态" prop="status"> | 23 | <el-form-item label="状态" prop="status"> |
| 24 | <el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small"> | 24 | <el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small"> |
| 25 | <el-option | 25 | <el-option |
| 26 | - v-for="dict in statusOptions" | ||
| 27 | - :key="dict.dictValue" | ||
| 28 | - :label="dict.dictLabel" | ||
| 29 | - :value="dict.dictValue" | 26 | + v-for="dict in dict.type.sys_normal_disable" |
| 27 | + :key="dict.value" | ||
| 28 | + :label="dict.label" | ||
| 29 | + :value="dict.value" | ||
| 30 | /> | 30 | /> |
| 31 | </el-select> | 31 | </el-select> |
| 32 | </el-form-item> | 32 | </el-form-item> |
| @@ -96,7 +96,7 @@ | @@ -96,7 +96,7 @@ | ||
| 96 | <el-table-column label="字典排序" align="center" prop="dictSort" /> | 96 | <el-table-column label="字典排序" align="center" prop="dictSort" /> |
| 97 | <el-table-column label="状态" align="center" prop="status"> | 97 | <el-table-column label="状态" align="center" prop="status"> |
| 98 | <template slot-scope="scope"> | 98 | <template slot-scope="scope"> |
| 99 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 99 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 100 | </template> | 100 | </template> |
| 101 | </el-table-column> | 101 | </el-table-column> |
| 102 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> | 102 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> |
| @@ -164,10 +164,10 @@ | @@ -164,10 +164,10 @@ | ||
| 164 | <el-form-item label="状态" prop="status"> | 164 | <el-form-item label="状态" prop="status"> |
| 165 | <el-radio-group v-model="form.status"> | 165 | <el-radio-group v-model="form.status"> |
| 166 | <el-radio | 166 | <el-radio |
| 167 | - v-for="dict in statusOptions" | ||
| 168 | - :key="dict.dictValue" | ||
| 169 | - :label="dict.dictValue" | ||
| 170 | - >{{dict.dictLabel}}</el-radio> | 167 | + v-for="dict in dict.type.sys_normal_disable" |
| 168 | + :key="dict.value" | ||
| 169 | + :label="dict.value" | ||
| 170 | + >{{dict.label}}</el-radio> | ||
| 171 | </el-radio-group> | 171 | </el-radio-group> |
| 172 | </el-form-item> | 172 | </el-form-item> |
| 173 | <el-form-item label="备注" prop="remark"> | 173 | <el-form-item label="备注" prop="remark"> |
| @@ -188,6 +188,7 @@ import { listType, getType } from "@/api/system/dict/type"; | @@ -188,6 +188,7 @@ import { listType, getType } from "@/api/system/dict/type"; | ||
| 188 | 188 | ||
| 189 | export default { | 189 | export default { |
| 190 | name: "Data", | 190 | name: "Data", |
| 191 | + dicts: ['sys_normal_disable'], | ||
| 191 | data() { | 192 | data() { |
| 192 | return { | 193 | return { |
| 193 | // 遮罩层 | 194 | // 遮罩层 |
| @@ -239,8 +240,6 @@ export default { | @@ -239,8 +240,6 @@ export default { | ||
| 239 | label: "危险" | 240 | label: "危险" |
| 240 | } | 241 | } |
| 241 | ], | 242 | ], |
| 242 | - // 状态数据字典 | ||
| 243 | - statusOptions: [], | ||
| 244 | // 类型数据字典 | 243 | // 类型数据字典 |
| 245 | typeOptions: [], | 244 | typeOptions: [], |
| 246 | // 查询参数 | 245 | // 查询参数 |
| @@ -271,9 +270,6 @@ export default { | @@ -271,9 +270,6 @@ export default { | ||
| 271 | const dictId = this.$route.params && this.$route.params.dictId; | 270 | const dictId = this.$route.params && this.$route.params.dictId; |
| 272 | this.getType(dictId); | 271 | this.getType(dictId); |
| 273 | this.getTypeList(); | 272 | this.getTypeList(); |
| 274 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 275 | - this.statusOptions = response.data; | ||
| 276 | - }); | ||
| 277 | }, | 273 | }, |
| 278 | methods: { | 274 | methods: { |
| 279 | /** 查询字典类型详细 */ | 275 | /** 查询字典类型详细 */ |
| @@ -30,10 +30,10 @@ | @@ -30,10 +30,10 @@ | ||
| 30 | style="width: 240px" | 30 | style="width: 240px" |
| 31 | > | 31 | > |
| 32 | <el-option | 32 | <el-option |
| 33 | - v-for="dict in statusOptions" | ||
| 34 | - :key="dict.dictValue" | ||
| 35 | - :label="dict.dictLabel" | ||
| 36 | - :value="dict.dictValue" | 33 | + v-for="dict in dict.type.sys_normal_disable" |
| 34 | + :key="dict.value" | ||
| 35 | + :label="dict.label" | ||
| 36 | + :value="dict.value" | ||
| 37 | /> | 37 | /> |
| 38 | </el-select> | 38 | </el-select> |
| 39 | </el-form-item> | 39 | </el-form-item> |
| @@ -125,7 +125,7 @@ | @@ -125,7 +125,7 @@ | ||
| 125 | </el-table-column> | 125 | </el-table-column> |
| 126 | <el-table-column label="状态" align="center" prop="status"> | 126 | <el-table-column label="状态" align="center" prop="status"> |
| 127 | <template slot-scope="scope"> | 127 | <template slot-scope="scope"> |
| 128 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 128 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 129 | </template> | 129 | </template> |
| 130 | </el-table-column> | 130 | </el-table-column> |
| 131 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> | 131 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> |
| @@ -174,10 +174,10 @@ | @@ -174,10 +174,10 @@ | ||
| 174 | <el-form-item label="状态" prop="status"> | 174 | <el-form-item label="状态" prop="status"> |
| 175 | <el-radio-group v-model="form.status"> | 175 | <el-radio-group v-model="form.status"> |
| 176 | <el-radio | 176 | <el-radio |
| 177 | - v-for="dict in statusOptions" | ||
| 178 | - :key="dict.dictValue" | ||
| 179 | - :label="dict.dictValue" | ||
| 180 | - >{{dict.dictLabel}}</el-radio> | 177 | + v-for="dict in dict.type.sys_normal_disable" |
| 178 | + :key="dict.value" | ||
| 179 | + :label="dict.value" | ||
| 180 | + >{{dict.label}}</el-radio> | ||
| 181 | </el-radio-group> | 181 | </el-radio-group> |
| 182 | </el-form-item> | 182 | </el-form-item> |
| 183 | <el-form-item label="备注" prop="remark"> | 183 | <el-form-item label="备注" prop="remark"> |
| @@ -197,6 +197,7 @@ import { listType, getType, delType, addType, updateType, exportType, refreshCac | @@ -197,6 +197,7 @@ import { listType, getType, delType, addType, updateType, exportType, refreshCac | ||
| 197 | 197 | ||
| 198 | export default { | 198 | export default { |
| 199 | name: "Dict", | 199 | name: "Dict", |
| 200 | + dicts: ['sys_normal_disable'], | ||
| 200 | data() { | 201 | data() { |
| 201 | return { | 202 | return { |
| 202 | // 遮罩层 | 203 | // 遮罩层 |
| @@ -219,8 +220,6 @@ export default { | @@ -219,8 +220,6 @@ export default { | ||
| 219 | title: "", | 220 | title: "", |
| 220 | // 是否显示弹出层 | 221 | // 是否显示弹出层 |
| 221 | open: false, | 222 | open: false, |
| 222 | - // 状态数据字典 | ||
| 223 | - statusOptions: [], | ||
| 224 | // 日期范围 | 223 | // 日期范围 |
| 225 | dateRange: [], | 224 | dateRange: [], |
| 226 | // 查询参数 | 225 | // 查询参数 |
| @@ -246,9 +245,6 @@ export default { | @@ -246,9 +245,6 @@ export default { | ||
| 246 | }, | 245 | }, |
| 247 | created() { | 246 | created() { |
| 248 | this.getList(); | 247 | this.getList(); |
| 249 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 250 | - this.statusOptions = response.data; | ||
| 251 | - }); | ||
| 252 | }, | 248 | }, |
| 253 | methods: { | 249 | methods: { |
| 254 | /** 查询字典类型列表 */ | 250 | /** 查询字典类型列表 */ |
| @@ -13,10 +13,10 @@ | @@ -13,10 +13,10 @@ | ||
| 13 | <el-form-item label="状态" prop="status"> | 13 | <el-form-item label="状态" prop="status"> |
| 14 | <el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small"> | 14 | <el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small"> |
| 15 | <el-option | 15 | <el-option |
| 16 | - v-for="dict in statusOptions" | ||
| 17 | - :key="dict.dictValue" | ||
| 18 | - :label="dict.dictLabel" | ||
| 19 | - :value="dict.dictValue" | 16 | + v-for="dict in dict.type.sys_normal_disable" |
| 17 | + :key="dict.value" | ||
| 18 | + :label="dict.label" | ||
| 19 | + :value="dict.value" | ||
| 20 | /> | 20 | /> |
| 21 | </el-select> | 21 | </el-select> |
| 22 | </el-form-item> | 22 | </el-form-item> |
| @@ -68,7 +68,7 @@ | @@ -68,7 +68,7 @@ | ||
| 68 | <el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column> | 68 | <el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column> |
| 69 | <el-table-column prop="status" label="状态" width="80"> | 69 | <el-table-column prop="status" label="状态" width="80"> |
| 70 | <template slot-scope="scope"> | 70 | <template slot-scope="scope"> |
| 71 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 71 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 72 | </template> | 72 | </template> |
| 73 | </el-table-column> | 73 | </el-table-column> |
| 74 | <el-table-column label="创建时间" align="center" prop="createTime"> | 74 | <el-table-column label="创建时间" align="center" prop="createTime"> |
| @@ -240,10 +240,10 @@ | @@ -240,10 +240,10 @@ | ||
| 240 | </span> | 240 | </span> |
| 241 | <el-radio-group v-model="form.visible"> | 241 | <el-radio-group v-model="form.visible"> |
| 242 | <el-radio | 242 | <el-radio |
| 243 | - v-for="dict in visibleOptions" | ||
| 244 | - :key="dict.dictValue" | ||
| 245 | - :label="dict.dictValue" | ||
| 246 | - >{{dict.dictLabel}}</el-radio> | 243 | + v-for="dict in dict.type.sys_show_hide" |
| 244 | + :key="dict.value" | ||
| 245 | + :label="dict.value" | ||
| 246 | + >{{dict.label}}</el-radio> | ||
| 247 | </el-radio-group> | 247 | </el-radio-group> |
| 248 | </el-form-item> | 248 | </el-form-item> |
| 249 | </el-col> | 249 | </el-col> |
| @@ -257,10 +257,10 @@ | @@ -257,10 +257,10 @@ | ||
| 257 | </span> | 257 | </span> |
| 258 | <el-radio-group v-model="form.status"> | 258 | <el-radio-group v-model="form.status"> |
| 259 | <el-radio | 259 | <el-radio |
| 260 | - v-for="dict in statusOptions" | ||
| 261 | - :key="dict.dictValue" | ||
| 262 | - :label="dict.dictValue" | ||
| 263 | - >{{dict.dictLabel}}</el-radio> | 260 | + v-for="dict in dict.type.sys_normal_disable" |
| 261 | + :key="dict.value" | ||
| 262 | + :label="dict.value" | ||
| 263 | + >{{dict.label}}</el-radio> | ||
| 264 | </el-radio-group> | 264 | </el-radio-group> |
| 265 | </el-form-item> | 265 | </el-form-item> |
| 266 | </el-col> | 266 | </el-col> |
| @@ -282,6 +282,7 @@ import IconSelect from "@/components/IconSelect"; | @@ -282,6 +282,7 @@ import IconSelect from "@/components/IconSelect"; | ||
| 282 | 282 | ||
| 283 | export default { | 283 | export default { |
| 284 | name: "Menu", | 284 | name: "Menu", |
| 285 | + dicts: ['sys_show_hide', 'sys_normal_disable'], | ||
| 285 | components: { Treeselect, IconSelect }, | 286 | components: { Treeselect, IconSelect }, |
| 286 | data() { | 287 | data() { |
| 287 | return { | 288 | return { |
| @@ -301,10 +302,6 @@ export default { | @@ -301,10 +302,6 @@ export default { | ||
| 301 | isExpandAll: false, | 302 | isExpandAll: false, |
| 302 | // 重新渲染表格状态 | 303 | // 重新渲染表格状态 |
| 303 | refreshTable: true, | 304 | refreshTable: true, |
| 304 | - // 显示状态数据字典 | ||
| 305 | - visibleOptions: [], | ||
| 306 | - // 菜单状态数据字典 | ||
| 307 | - statusOptions: [], | ||
| 308 | // 查询参数 | 305 | // 查询参数 |
| 309 | queryParams: { | 306 | queryParams: { |
| 310 | menuName: undefined, | 307 | menuName: undefined, |
| @@ -328,12 +325,6 @@ export default { | @@ -328,12 +325,6 @@ export default { | ||
| 328 | }, | 325 | }, |
| 329 | created() { | 326 | created() { |
| 330 | this.getList(); | 327 | this.getList(); |
| 331 | - this.getDicts("sys_show_hide").then(response => { | ||
| 332 | - this.visibleOptions = response.data; | ||
| 333 | - }); | ||
| 334 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 335 | - this.statusOptions = response.data; | ||
| 336 | - }); | ||
| 337 | }, | 328 | }, |
| 338 | methods: { | 329 | methods: { |
| 339 | // 选择图标 | 330 | // 选择图标 |
| @@ -22,10 +22,10 @@ | @@ -22,10 +22,10 @@ | ||
| 22 | <el-form-item label="类型" prop="noticeType"> | 22 | <el-form-item label="类型" prop="noticeType"> |
| 23 | <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small"> | 23 | <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small"> |
| 24 | <el-option | 24 | <el-option |
| 25 | - v-for="dict in typeOptions" | ||
| 26 | - :key="dict.dictValue" | ||
| 27 | - :label="dict.dictLabel" | ||
| 28 | - :value="dict.dictValue" | 25 | + v-for="dict in dict.type.sys_notice_type" |
| 26 | + :key="dict.value" | ||
| 27 | + :label="dict.label" | ||
| 28 | + :value="dict.value" | ||
| 29 | /> | 29 | /> |
| 30 | </el-select> | 30 | </el-select> |
| 31 | </el-form-item> | 31 | </el-form-item> |
| @@ -82,12 +82,12 @@ | @@ -82,12 +82,12 @@ | ||
| 82 | /> | 82 | /> |
| 83 | <el-table-column label="公告类型" align="center" prop="noticeType" width="100"> | 83 | <el-table-column label="公告类型" align="center" prop="noticeType" width="100"> |
| 84 | <template slot-scope="scope"> | 84 | <template slot-scope="scope"> |
| 85 | - <dict-tag :options="typeOptions" :value="scope.row.noticeType"/> | 85 | + <dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/> |
| 86 | </template> | 86 | </template> |
| 87 | </el-table-column> | 87 | </el-table-column> |
| 88 | <el-table-column label="状态" align="center" prop="status" width="100"> | 88 | <el-table-column label="状态" align="center" prop="status" width="100"> |
| 89 | <template slot-scope="scope"> | 89 | <template slot-scope="scope"> |
| 90 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 90 | + <dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/> |
| 91 | </template> | 91 | </template> |
| 92 | </el-table-column> | 92 | </el-table-column> |
| 93 | <el-table-column label="创建者" align="center" prop="createBy" width="100" /> | 93 | <el-table-column label="创建者" align="center" prop="createBy" width="100" /> |
| @@ -137,10 +137,10 @@ | @@ -137,10 +137,10 @@ | ||
| 137 | <el-form-item label="公告类型" prop="noticeType"> | 137 | <el-form-item label="公告类型" prop="noticeType"> |
| 138 | <el-select v-model="form.noticeType" placeholder="请选择"> | 138 | <el-select v-model="form.noticeType" placeholder="请选择"> |
| 139 | <el-option | 139 | <el-option |
| 140 | - v-for="dict in typeOptions" | ||
| 141 | - :key="dict.dictValue" | ||
| 142 | - :label="dict.dictLabel" | ||
| 143 | - :value="dict.dictValue" | 140 | + v-for="dict in dict.type.sys_notice_type" |
| 141 | + :key="dict.value" | ||
| 142 | + :label="dict.label" | ||
| 143 | + :value="dict.value" | ||
| 144 | ></el-option> | 144 | ></el-option> |
| 145 | </el-select> | 145 | </el-select> |
| 146 | </el-form-item> | 146 | </el-form-item> |
| @@ -149,10 +149,10 @@ | @@ -149,10 +149,10 @@ | ||
| 149 | <el-form-item label="状态"> | 149 | <el-form-item label="状态"> |
| 150 | <el-radio-group v-model="form.status"> | 150 | <el-radio-group v-model="form.status"> |
| 151 | <el-radio | 151 | <el-radio |
| 152 | - v-for="dict in statusOptions" | ||
| 153 | - :key="dict.dictValue" | ||
| 154 | - :label="dict.dictValue" | ||
| 155 | - >{{dict.dictLabel}}</el-radio> | 152 | + v-for="dict in dict.type.sys_notice_status" |
| 153 | + :key="dict.value" | ||
| 154 | + :label="dict.value" | ||
| 155 | + >{{dict.label}}</el-radio> | ||
| 156 | </el-radio-group> | 156 | </el-radio-group> |
| 157 | </el-form-item> | 157 | </el-form-item> |
| 158 | </el-col> | 158 | </el-col> |
| @@ -176,6 +176,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api | @@ -176,6 +176,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api | ||
| 176 | 176 | ||
| 177 | export default { | 177 | export default { |
| 178 | name: "Notice", | 178 | name: "Notice", |
| 179 | + dicts: ['sys_notice_status', 'sys_notice_type'], | ||
| 179 | data() { | 180 | data() { |
| 180 | return { | 181 | return { |
| 181 | // 遮罩层 | 182 | // 遮罩层 |
| @@ -196,10 +197,6 @@ export default { | @@ -196,10 +197,6 @@ export default { | ||
| 196 | title: "", | 197 | title: "", |
| 197 | // 是否显示弹出层 | 198 | // 是否显示弹出层 |
| 198 | open: false, | 199 | open: false, |
| 199 | - // 类型数据字典 | ||
| 200 | - statusOptions: [], | ||
| 201 | - // 状态数据字典 | ||
| 202 | - typeOptions: [], | ||
| 203 | // 查询参数 | 200 | // 查询参数 |
| 204 | queryParams: { | 201 | queryParams: { |
| 205 | pageNum: 1, | 202 | pageNum: 1, |
| @@ -223,12 +220,6 @@ export default { | @@ -223,12 +220,6 @@ export default { | ||
| 223 | }, | 220 | }, |
| 224 | created() { | 221 | created() { |
| 225 | this.getList(); | 222 | this.getList(); |
| 226 | - this.getDicts("sys_notice_status").then(response => { | ||
| 227 | - this.statusOptions = response.data; | ||
| 228 | - }); | ||
| 229 | - this.getDicts("sys_notice_type").then(response => { | ||
| 230 | - this.typeOptions = response.data; | ||
| 231 | - }); | ||
| 232 | }, | 223 | }, |
| 233 | methods: { | 224 | methods: { |
| 234 | /** 查询公告列表 */ | 225 | /** 查询公告列表 */ |
| @@ -22,10 +22,10 @@ | @@ -22,10 +22,10 @@ | ||
| 22 | <el-form-item label="状态" prop="status"> | 22 | <el-form-item label="状态" prop="status"> |
| 23 | <el-select v-model="queryParams.status" placeholder="岗位状态" clearable size="small"> | 23 | <el-select v-model="queryParams.status" placeholder="岗位状态" clearable size="small"> |
| 24 | <el-option | 24 | <el-option |
| 25 | - v-for="dict in statusOptions" | ||
| 26 | - :key="dict.dictValue" | ||
| 27 | - :label="dict.dictLabel" | ||
| 28 | - :value="dict.dictValue" | 25 | + v-for="dict in dict.type.sys_normal_disable" |
| 26 | + :key="dict.value" | ||
| 27 | + :label="dict.label" | ||
| 28 | + :value="dict.value" | ||
| 29 | /> | 29 | /> |
| 30 | </el-select> | 30 | </el-select> |
| 31 | </el-form-item> | 31 | </el-form-item> |
| @@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
| 90 | <el-table-column label="岗位排序" align="center" prop="postSort" /> | 90 | <el-table-column label="岗位排序" align="center" prop="postSort" /> |
| 91 | <el-table-column label="状态" align="center" prop="status"> | 91 | <el-table-column label="状态" align="center" prop="status"> |
| 92 | <template slot-scope="scope"> | 92 | <template slot-scope="scope"> |
| 93 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 93 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 94 | </template> | 94 | </template> |
| 95 | </el-table-column> | 95 | </el-table-column> |
| 96 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | 96 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| @@ -141,10 +141,10 @@ | @@ -141,10 +141,10 @@ | ||
| 141 | <el-form-item label="岗位状态" prop="status"> | 141 | <el-form-item label="岗位状态" prop="status"> |
| 142 | <el-radio-group v-model="form.status"> | 142 | <el-radio-group v-model="form.status"> |
| 143 | <el-radio | 143 | <el-radio |
| 144 | - v-for="dict in statusOptions" | ||
| 145 | - :key="dict.dictValue" | ||
| 146 | - :label="dict.dictValue" | ||
| 147 | - >{{dict.dictLabel}}</el-radio> | 144 | + v-for="dict in dict.type.sys_normal_disable" |
| 145 | + :key="dict.value" | ||
| 146 | + :label="dict.value" | ||
| 147 | + >{{dict.label}}</el-radio> | ||
| 148 | </el-radio-group> | 148 | </el-radio-group> |
| 149 | </el-form-item> | 149 | </el-form-item> |
| 150 | <el-form-item label="备注" prop="remark"> | 150 | <el-form-item label="备注" prop="remark"> |
| @@ -164,6 +164,7 @@ import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/a | @@ -164,6 +164,7 @@ import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/a | ||
| 164 | 164 | ||
| 165 | export default { | 165 | export default { |
| 166 | name: "Post", | 166 | name: "Post", |
| 167 | + dicts: ['sys_normal_disable'], | ||
| 167 | data() { | 168 | data() { |
| 168 | return { | 169 | return { |
| 169 | // 遮罩层 | 170 | // 遮罩层 |
| @@ -186,8 +187,6 @@ export default { | @@ -186,8 +187,6 @@ export default { | ||
| 186 | title: "", | 187 | title: "", |
| 187 | // 是否显示弹出层 | 188 | // 是否显示弹出层 |
| 188 | open: false, | 189 | open: false, |
| 189 | - // 状态数据字典 | ||
| 190 | - statusOptions: [], | ||
| 191 | // 查询参数 | 190 | // 查询参数 |
| 192 | queryParams: { | 191 | queryParams: { |
| 193 | pageNum: 1, | 192 | pageNum: 1, |
| @@ -214,9 +213,6 @@ export default { | @@ -214,9 +213,6 @@ export default { | ||
| 214 | }, | 213 | }, |
| 215 | created() { | 214 | created() { |
| 216 | this.getList(); | 215 | this.getList(); |
| 217 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 218 | - this.statusOptions = response.data; | ||
| 219 | - }); | ||
| 220 | }, | 216 | }, |
| 221 | methods: { | 217 | methods: { |
| 222 | /** 查询岗位列表 */ | 218 | /** 查询岗位列表 */ |
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> | 69 | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> |
| 70 | <el-table-column label="状态" align="center" prop="status"> | 70 | <el-table-column label="状态" align="center" prop="status"> |
| 71 | <template slot-scope="scope"> | 71 | <template slot-scope="scope"> |
| 72 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 72 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 73 | </template> | 73 | </template> |
| 74 | </el-table-column> | 74 | </el-table-column> |
| 75 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | 75 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| @@ -107,6 +107,7 @@ import selectUser from "./selectUser"; | @@ -107,6 +107,7 @@ import selectUser from "./selectUser"; | ||
| 107 | 107 | ||
| 108 | export default { | 108 | export default { |
| 109 | name: "AuthUser", | 109 | name: "AuthUser", |
| 110 | + dicts: ['sys_normal_disable'], | ||
| 110 | components: { selectUser }, | 111 | components: { selectUser }, |
| 111 | data() { | 112 | data() { |
| 112 | return { | 113 | return { |
| @@ -122,8 +123,6 @@ export default { | @@ -122,8 +123,6 @@ export default { | ||
| 122 | total: 0, | 123 | total: 0, |
| 123 | // 用户表格数据 | 124 | // 用户表格数据 |
| 124 | userList: [], | 125 | userList: [], |
| 125 | - // 状态数据字典 | ||
| 126 | - statusOptions: [], | ||
| 127 | // 查询参数 | 126 | // 查询参数 |
| 128 | queryParams: { | 127 | queryParams: { |
| 129 | pageNum: 1, | 128 | pageNum: 1, |
| @@ -139,9 +138,6 @@ export default { | @@ -139,9 +138,6 @@ export default { | ||
| 139 | if (roleId) { | 138 | if (roleId) { |
| 140 | this.queryParams.roleId = roleId; | 139 | this.queryParams.roleId = roleId; |
| 141 | this.getList(); | 140 | this.getList(); |
| 142 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 143 | - this.statusOptions = response.data; | ||
| 144 | - }); | ||
| 145 | } | 141 | } |
| 146 | }, | 142 | }, |
| 147 | methods: { | 143 | methods: { |
| @@ -30,10 +30,10 @@ | @@ -30,10 +30,10 @@ | ||
| 30 | style="width: 240px" | 30 | style="width: 240px" |
| 31 | > | 31 | > |
| 32 | <el-option | 32 | <el-option |
| 33 | - v-for="dict in statusOptions" | ||
| 34 | - :key="dict.dictValue" | ||
| 35 | - :label="dict.dictLabel" | ||
| 36 | - :value="dict.dictValue" | 33 | + v-for="dict in dict.type.sys_normal_disable" |
| 34 | + :key="dict.value" | ||
| 35 | + :label="dict.label" | ||
| 36 | + :value="dict.value" | ||
| 37 | /> | 37 | /> |
| 38 | </el-select> | 38 | </el-select> |
| 39 | </el-form-item> | 39 | </el-form-item> |
| @@ -183,10 +183,10 @@ | @@ -183,10 +183,10 @@ | ||
| 183 | <el-form-item label="状态"> | 183 | <el-form-item label="状态"> |
| 184 | <el-radio-group v-model="form.status"> | 184 | <el-radio-group v-model="form.status"> |
| 185 | <el-radio | 185 | <el-radio |
| 186 | - v-for="dict in statusOptions" | ||
| 187 | - :key="dict.dictValue" | ||
| 188 | - :label="dict.dictValue" | ||
| 189 | - >{{dict.dictLabel}}</el-radio> | 186 | + v-for="dict in dict.type.sys_normal_disable" |
| 187 | + :key="dict.value" | ||
| 188 | + :label="dict.value" | ||
| 189 | + >{{dict.label}}</el-radio> | ||
| 190 | </el-radio-group> | 190 | </el-radio-group> |
| 191 | </el-form-item> | 191 | </el-form-item> |
| 192 | <el-form-item label="菜单权限"> | 192 | <el-form-item label="菜单权限"> |
| @@ -265,6 +265,7 @@ import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/d | @@ -265,6 +265,7 @@ import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/d | ||
| 265 | 265 | ||
| 266 | export default { | 266 | export default { |
| 267 | name: "Role", | 267 | name: "Role", |
| 268 | + dicts: ['sys_normal_disable'], | ||
| 268 | data() { | 269 | data() { |
| 269 | return { | 270 | return { |
| 270 | // 遮罩层 | 271 | // 遮罩层 |
| @@ -295,8 +296,6 @@ export default { | @@ -295,8 +296,6 @@ export default { | ||
| 295 | deptNodeAll: false, | 296 | deptNodeAll: false, |
| 296 | // 日期范围 | 297 | // 日期范围 |
| 297 | dateRange: [], | 298 | dateRange: [], |
| 298 | - // 状态数据字典 | ||
| 299 | - statusOptions: [], | ||
| 300 | // 数据范围选项 | 299 | // 数据范围选项 |
| 301 | dataScopeOptions: [ | 300 | dataScopeOptions: [ |
| 302 | { | 301 | { |
| @@ -354,9 +353,6 @@ export default { | @@ -354,9 +353,6 @@ export default { | ||
| 354 | }, | 353 | }, |
| 355 | created() { | 354 | created() { |
| 356 | this.getList(); | 355 | this.getList(); |
| 357 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 358 | - this.statusOptions = response.data; | ||
| 359 | - }); | ||
| 360 | }, | 356 | }, |
| 361 | methods: { | 357 | methods: { |
| 362 | /** 查询角色列表 */ | 358 | /** 查询角色列表 */ |
| @@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
| 34 | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> | 34 | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> |
| 35 | <el-table-column label="状态" align="center" prop="status"> | 35 | <el-table-column label="状态" align="center" prop="status"> |
| 36 | <template slot-scope="scope"> | 36 | <template slot-scope="scope"> |
| 37 | - <dict-tag :options="statusOptions" :value="scope.row.status"/> | 37 | + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| 38 | </template> | 38 | </template> |
| 39 | </el-table-column> | 39 | </el-table-column> |
| 40 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | 40 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| @@ -61,6 +61,7 @@ | @@ -61,6 +61,7 @@ | ||
| 61 | <script> | 61 | <script> |
| 62 | import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"; | 62 | import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"; |
| 63 | export default { | 63 | export default { |
| 64 | + dicts: ['sys_normal_disable'], | ||
| 64 | props: { | 65 | props: { |
| 65 | // 角色编号 | 66 | // 角色编号 |
| 66 | roleId: { | 67 | roleId: { |
| @@ -77,8 +78,6 @@ export default { | @@ -77,8 +78,6 @@ export default { | ||
| 77 | total: 0, | 78 | total: 0, |
| 78 | // 未授权用户数据 | 79 | // 未授权用户数据 |
| 79 | userList: [], | 80 | userList: [], |
| 80 | - // 状态数据字典 | ||
| 81 | - statusOptions: [], | ||
| 82 | // 查询参数 | 81 | // 查询参数 |
| 83 | queryParams: { | 82 | queryParams: { |
| 84 | pageNum: 1, | 83 | pageNum: 1, |
| @@ -89,11 +88,6 @@ export default { | @@ -89,11 +88,6 @@ export default { | ||
| 89 | } | 88 | } |
| 90 | }; | 89 | }; |
| 91 | }, | 90 | }, |
| 92 | - created() { | ||
| 93 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 94 | - this.statusOptions = response.data; | ||
| 95 | - }); | ||
| 96 | - }, | ||
| 97 | methods: { | 91 | methods: { |
| 98 | // 显示弹框 | 92 | // 显示弹框 |
| 99 | show() { | 93 | show() { |
| @@ -57,10 +57,10 @@ | @@ -57,10 +57,10 @@ | ||
| 57 | style="width: 240px" | 57 | style="width: 240px" |
| 58 | > | 58 | > |
| 59 | <el-option | 59 | <el-option |
| 60 | - v-for="dict in statusOptions" | ||
| 61 | - :key="dict.dictValue" | ||
| 62 | - :label="dict.dictLabel" | ||
| 63 | - :value="dict.dictValue" | 60 | + v-for="dict in dict.type.sys_normal_disable" |
| 61 | + :key="dict.value" | ||
| 62 | + :label="dict.label" | ||
| 63 | + :value="dict.value" | ||
| 64 | /> | 64 | /> |
| 65 | </el-select> | 65 | </el-select> |
| 66 | </el-form-item> | 66 | </el-form-item> |
| @@ -251,10 +251,10 @@ | @@ -251,10 +251,10 @@ | ||
| 251 | <el-form-item label="用户性别"> | 251 | <el-form-item label="用户性别"> |
| 252 | <el-select v-model="form.sex" placeholder="请选择"> | 252 | <el-select v-model="form.sex" placeholder="请选择"> |
| 253 | <el-option | 253 | <el-option |
| 254 | - v-for="dict in sexOptions" | ||
| 255 | - :key="dict.dictValue" | ||
| 256 | - :label="dict.dictLabel" | ||
| 257 | - :value="dict.dictValue" | 254 | + v-for="dict in dict.type.sys_user_sex" |
| 255 | + :key="dict.value" | ||
| 256 | + :label="dict.label" | ||
| 257 | + :value="dict.value" | ||
| 258 | ></el-option> | 258 | ></el-option> |
| 259 | </el-select> | 259 | </el-select> |
| 260 | </el-form-item> | 260 | </el-form-item> |
| @@ -263,10 +263,10 @@ | @@ -263,10 +263,10 @@ | ||
| 263 | <el-form-item label="状态"> | 263 | <el-form-item label="状态"> |
| 264 | <el-radio-group v-model="form.status"> | 264 | <el-radio-group v-model="form.status"> |
| 265 | <el-radio | 265 | <el-radio |
| 266 | - v-for="dict in statusOptions" | ||
| 267 | - :key="dict.dictValue" | ||
| 268 | - :label="dict.dictValue" | ||
| 269 | - >{{dict.dictLabel}}</el-radio> | 266 | + v-for="dict in dict.type.sys_normal_disable" |
| 267 | + :key="dict.value" | ||
| 268 | + :label="dict.value" | ||
| 269 | + >{{dict.label}}</el-radio> | ||
| 270 | </el-radio-group> | 270 | </el-radio-group> |
| 271 | </el-form-item> | 271 | </el-form-item> |
| 272 | </el-col> | 272 | </el-col> |
| @@ -354,6 +354,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"; | @@ -354,6 +354,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"; | ||
| 354 | 354 | ||
| 355 | export default { | 355 | export default { |
| 356 | name: "User", | 356 | name: "User", |
| 357 | + dicts: ['sys_normal_disable', 'sys_user_sex'], | ||
| 357 | components: { Treeselect }, | 358 | components: { Treeselect }, |
| 358 | data() { | 359 | data() { |
| 359 | return { | 360 | return { |
| @@ -385,10 +386,6 @@ export default { | @@ -385,10 +386,6 @@ export default { | ||
| 385 | initPassword: undefined, | 386 | initPassword: undefined, |
| 386 | // 日期范围 | 387 | // 日期范围 |
| 387 | dateRange: [], | 388 | dateRange: [], |
| 388 | - // 状态数据字典 | ||
| 389 | - statusOptions: [], | ||
| 390 | - // 性别状态字典 | ||
| 391 | - sexOptions: [], | ||
| 392 | // 岗位选项 | 389 | // 岗位选项 |
| 393 | postOptions: [], | 390 | postOptions: [], |
| 394 | // 角色选项 | 391 | // 角色选项 |
| @@ -472,12 +469,6 @@ export default { | @@ -472,12 +469,6 @@ export default { | ||
| 472 | created() { | 469 | created() { |
| 473 | this.getList(); | 470 | this.getList(); |
| 474 | this.getTreeselect(); | 471 | this.getTreeselect(); |
| 475 | - this.getDicts("sys_normal_disable").then(response => { | ||
| 476 | - this.statusOptions = response.data; | ||
| 477 | - }); | ||
| 478 | - this.getDicts("sys_user_sex").then(response => { | ||
| 479 | - this.sexOptions = response.data; | ||
| 480 | - }); | ||
| 481 | this.getConfigKey("sys.user.initPassword").then(response => { | 472 | this.getConfigKey("sys.user.initPassword").then(response => { |
| 482 | this.initPassword = response.msg; | 473 | this.initPassword = response.msg; |
| 483 | }); | 474 | }); |
-
请 注册 或 登录 后发表评论