From 34a6f2e1f12786d2da4e2db1edd92163e7e5be62 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Wed, 01 Sep 2021 14:03:59 +0800
Subject: [PATCH] 查询列表设置数据字典样式回显
---
ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm | 20 +---
ruoyi-ui/src/views/monitor/job/log.vue | 24 +++---
ruoyi-ui/src/views/system/logininfor/index.vue | 10 +-
ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm | 20 +---
ruoyi-ui/src/views/system/notice/index.vue | 32 ++-----
ruoyi-ui/src/views/system/operlog/index.vue | 16 ++-
ruoyi-ui/src/views/system/menu/index.vue | 36 +++-----
ruoyi-ui/src/views/system/dept/index.vue | 26 +++---
ruoyi-ui/src/views/monitor/job/index.vue | 10 +-
ruoyi-ui/src/views/system/config/index.vue | 10 +-
ruoyi-ui/src/views/system/post/index.vue | 12 +-
11 files changed, 89 insertions(+), 127 deletions(-)
diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm
index f7105cb..51c447e 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm
+++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index-tree.vue.vm
@@ -106,7 +106,11 @@
</template>
</el-table-column>
#elseif($column.list && "" != $column.dictType)
- <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
+ <el-table-column label="${comment}" align="center" prop="${javaField}">
+ <template slot-scope="scope">
+ <dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/>
+ </template>
+ </el-table-column>
#elseif($column.list && "" != $javaField)
#if(${foreach.index} == 1)
<el-table-column label="${comment}" prop="${javaField}" />
@@ -378,20 +382,6 @@
this.${businessName}Options.push(data);
});
},
-#foreach ($column in $columns)
-#if(${column.dictType} != '')
-#set($parentheseIndex=$column.columnComment.indexOf("("))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
- // $comment字典翻译
- ${column.javaField}Format(row, column) {
- return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
- },
-#end
-#end
// 取消按钮
cancel() {
this.open = false;
diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm
index 3bf618a..ca68f62 100644
--- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm
+++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm
@@ -134,7 +134,11 @@
</template>
</el-table-column>
#elseif($column.list && "" != $column.dictType)
- <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
+ <el-table-column label="${comment}" align="center" prop="${javaField}">
+ <template slot-scope="scope">
+ <dict-tag :options="${javaField}Options" :value="scope.row.${javaField}"/>
+ </template>
+ </el-table-column>
#elseif($column.list && "" != $javaField)
<el-table-column label="${comment}" align="center" prop="${javaField}" />
#end
@@ -423,20 +427,6 @@
this.loading = false;
});
},
-#foreach ($column in $columns)
-#if(${column.dictType} != '')
-#set($parentheseIndex=$column.columnComment.indexOf("("))
-#if($parentheseIndex != -1)
-#set($comment=$column.columnComment.substring(0, $parentheseIndex))
-#else
-#set($comment=$column.columnComment)
-#end
- // $comment字典翻译
- ${column.javaField}Format(row, column) {
- return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
- },
-#end
-#end
// 取消按钮
cancel() {
this.open = false;
diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue
index 9583f70..f6f0966 100644
--- a/ruoyi-ui/src/views/monitor/job/index.vue
+++ b/ruoyi-ui/src/views/monitor/job/index.vue
@@ -96,7 +96,11 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="任务编号" align="center" prop="jobId" />
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
- <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" />
+ <el-table-column label="任务组名" align="center" prop="jobGroup">
+ <template slot-scope="scope">
+ <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/>
+ </template>
+ </el-table-column>
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
<el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
<el-table-column label="状态" align="center">
@@ -355,10 +359,6 @@
// 任务组名字典翻译
jobGroupFormat(row, column) {
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
- },
- // 状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
},
// 取消按钮
cancel() {
diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue
index 5aa102d..e45e4fe 100644
--- a/ruoyi-ui/src/views/monitor/job/log.vue
+++ b/ruoyi-ui/src/views/monitor/job/log.vue
@@ -109,10 +109,18 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="日志编号" width="80" align="center" prop="jobLogId" />
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
- <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" />
+ <el-table-column label="任务组名" align="center" prop="jobGroup" :show-overflow-tooltip="true">
+ <template slot-scope="scope">
+ <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/>
+ </template>
+ </el-table-column>
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
<el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" />
- <el-table-column label="执行状态" align="center" prop="status" :formatter="statusFormat" />
+ <el-table-column label="执行状态" align="center" prop="status">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="执行时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -244,14 +252,6 @@
}
);
},
- // 执行状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
- },
- // 任务组名字典翻译
- jobGroupFormat(row, column) {
- return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
- },
// 返回按钮
handleClose() {
this.$store.dispatch("tagsView/delView", this.$route);
@@ -290,7 +290,7 @@
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
- })
+ }).catch(() => {});
},
/** 清空按钮操作 */
handleClean() {
@@ -303,7 +303,7 @@
}).then(() => {
this.getList();
this.msgSuccess("清空成功");
- })
+ }).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue
index b692d2c..8658d1a 100644
--- a/ruoyi-ui/src/views/system/config/index.vue
+++ b/ruoyi-ui/src/views/system/config/index.vue
@@ -111,7 +111,11 @@
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
<el-table-column label="参数键值" align="center" prop="configValue" />
- <el-table-column label="系统内置" align="center" prop="configType" :formatter="typeFormat" />
+ <el-table-column label="系统内置" align="center" prop="configType">
+ <template slot-scope="scope">
+ <dict-tag :options="typeOptions" :value="scope.row.configType"/>
+ </template>
+ </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
@@ -248,10 +252,6 @@
this.loading = false;
}
);
- },
- // 参数系统内置字典翻译
- typeFormat(row, column) {
- return this.selectDictLabel(this.typeOptions, row.configType);
},
// 取消按钮
cancel() {
diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue
index 2d58f64..96cbcaf 100644
--- a/ruoyi-ui/src/views/system/dept/index.vue
+++ b/ruoyi-ui/src/views/system/dept/index.vue
@@ -49,7 +49,11 @@
>
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
- <el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
+ <el-table-column prop="status" label="状态" width="100">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -57,17 +61,17 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:dept:edit']"
>修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-plus"
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['system:dept:add']"
>新增</el-button>
@@ -222,10 +226,6 @@
label: node.deptName,
children: node.children
};
- },
- // 字典状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
},
// 取消按钮
cancel() {
diff --git a/ruoyi-ui/src/views/system/logininfor/index.vue b/ruoyi-ui/src/views/system/logininfor/index.vue
index a0e9569..6d039b3 100644
--- a/ruoyi-ui/src/views/system/logininfor/index.vue
+++ b/ruoyi-ui/src/views/system/logininfor/index.vue
@@ -95,7 +95,11 @@
<el-table-column label="访问编号" align="center" prop="infoId" />
<el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" />
<el-table-column label="地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
- <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
+ <el-table-column label="登录状态" align="center" prop="status">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="描述" align="center" prop="msg" />
<el-table-column label="访问时间" align="center" prop="accessTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
<template slot-scope="scope">
@@ -165,10 +169,6 @@
this.loading = false;
}
);
- },
- // 登录状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
},
/** 搜索按钮操作 */
handleQuery() {
diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue
index b0ea59a..8055969 100644
--- a/ruoyi-ui/src/views/system/menu/index.vue
+++ b/ruoyi-ui/src/views/system/menu/index.vue
@@ -55,7 +55,11 @@
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
- <el-table-column prop="status" label="状态" :formatter="statusFormat" width="80"></el-table-column>
+ <el-table-column prop="status" label="状态" width="80">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -63,16 +67,16 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button size="mini"
- type="text"
- icon="el-icon-edit"
+ <el-button size="mini"
+ type="text"
+ icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:menu:edit']"
>修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-plus"
+ <el-button
+ size="mini"
+ type="text"
+ icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['system:menu:add']"
>新增</el-button>
@@ -338,20 +342,6 @@
this.menuOptions.push(menu);
});
},
- // 显示状态字典翻译
- visibleFormat(row, column) {
- if (row.menuType == "F") {
- return "";
- }
- return this.selectDictLabel(this.visibleOptions, row.visible);
- },
- // 菜单状态字典翻译
- statusFormat(row, column) {
- if (row.menuType == "F") {
- return "";
- }
- return this.selectDictLabel(this.statusOptions, row.status);
- },
// 取消按钮
cancel() {
this.open = false;
@@ -439,4 +429,4 @@
}
}
};
-</script>
\ No newline at end of file
+</script>
diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue
index cfbe761..971412c 100644
--- a/ruoyi-ui/src/views/system/notice/index.vue
+++ b/ruoyi-ui/src/views/system/notice/index.vue
@@ -80,20 +80,16 @@
prop="noticeTitle"
:show-overflow-tooltip="true"
/>
- <el-table-column
- label="公告类型"
- align="center"
- prop="noticeType"
- :formatter="typeFormat"
- width="100"
- />
- <el-table-column
- label="状态"
- align="center"
- prop="status"
- :formatter="statusFormat"
- width="100"
- />
+ <el-table-column label="公告类型" align="center" prop="noticeType" width="100">
+ <template slot-scope="scope">
+ <dict-tag :options="typeOptions" :value="scope.row.noticeType"/>
+ </template>
+ </el-table-column>
+ <el-table-column label="状态" align="center" prop="status" width="100">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="创建者" align="center" prop="createBy" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template slot-scope="scope">
@@ -243,14 +239,6 @@
this.total = response.total;
this.loading = false;
});
- },
- // 公告状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
- },
- // 公告状态字典翻译
- typeFormat(row, column) {
- return this.selectDictLabel(this.typeOptions, row.noticeType);
},
// 取消按钮
cancel() {
diff --git a/ruoyi-ui/src/views/system/operlog/index.vue b/ruoyi-ui/src/views/system/operlog/index.vue
index 19b3556..8d86f33 100644
--- a/ruoyi-ui/src/views/system/operlog/index.vue
+++ b/ruoyi-ui/src/views/system/operlog/index.vue
@@ -110,11 +110,19 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="日志编号" align="center" prop="operId" />
<el-table-column label="系统模块" align="center" prop="title" />
- <el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" />
+ <el-table-column label="操作类型" align="center" prop="businessType">
+ <template slot-scope="scope">
+ <dict-tag :options="typeOptions" :value="scope.row.businessType"/>
+ </template>
+ </el-table-column>
<el-table-column label="请求方式" align="center" prop="requestMethod" />
<el-table-column label="操作人员" align="center" prop="operName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" width="100"/>
<el-table-column label="主机" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" />
- <el-table-column label="操作状态" align="center" prop="status" :formatter="statusFormat" />
+ <el-table-column label="操作状态" align="center" prop="status">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.operTime) }}</span>
@@ -246,10 +254,6 @@
this.loading = false;
}
);
- },
- // 操作日志状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
},
// 操作日志类型字典翻译
typeFormat(row, column) {
diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue
index d3a686f..ab5ee30 100644
--- a/ruoyi-ui/src/views/system/post/index.vue
+++ b/ruoyi-ui/src/views/system/post/index.vue
@@ -87,7 +87,11 @@
<el-table-column label="岗位编码" align="center" prop="postCode" />
<el-table-column label="岗位名称" align="center" prop="postName" />
<el-table-column label="岗位排序" align="center" prop="postSort" />
- <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
+ <el-table-column label="状态" align="center" prop="status">
+ <template slot-scope="scope">
+ <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ </template>
+ </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -112,7 +116,7 @@
</template>
</el-table-column>
</el-table>
-
+
<pagination
v-show="total>0"
:total="total"
@@ -220,10 +224,6 @@
this.total = response.total;
this.loading = false;
});
- },
- // 岗位状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
},
// 取消按钮
cancel() {
--
Gitblit v1.9.3