|
@@ -1,6 +1,14 @@
|
|
|
+<!-- 系统管理 字典管理 -->
|
|
|
+
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryForm"
|
|
|
+ :inline="true"
|
|
|
+ v-show="showSearch"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
<el-form-item label="字典名称" prop="dictName">
|
|
|
<el-input
|
|
|
v-model="queryParams.dictName"
|
|
@@ -50,8 +58,16 @@
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="mini"
|
|
|
+ @click="handleQuery"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
+ >重置</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
@@ -64,7 +80,8 @@
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
v-hasPermi="['system:dict:add']"
|
|
|
- >新增</el-button>
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -75,7 +92,8 @@
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
v-hasPermi="['system:dict:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -86,7 +104,8 @@
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
v-hasPermi="['system:dict:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -96,7 +115,8 @@
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
v-hasPermi="['system:dict:export']"
|
|
|
- >导出</el-button>
|
|
|
+ >导出</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -106,34 +126,71 @@
|
|
|
size="mini"
|
|
|
@click="handleRefreshCache"
|
|
|
v-hasPermi="['system:dict:remove']"
|
|
|
- >刷新缓存</el-button>
|
|
|
+ >刷新缓存</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ <right-toolbar
|
|
|
+ :showSearch.sync="showSearch"
|
|
|
+ @queryTable="getList"
|
|
|
+ ></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="typeList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="字典编号" align="center" prop="dictId" />
|
|
|
- <el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
|
|
|
+ <el-table-column
|
|
|
+ label="字典名称"
|
|
|
+ align="center"
|
|
|
+ prop="dictName"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="字典类型"
|
|
|
+ align="center"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
- <router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
|
|
|
+ <router-link
|
|
|
+ :to="'/system/dict-data/index/' + scope.row.dictId"
|
|
|
+ class="link-type"
|
|
|
+ >
|
|
|
<span>{{ scope.row.dictType }}</span>
|
|
|
</router-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
|
<template slot-scope="scope">
|
|
|
- <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
|
|
+ <dict-tag
|
|
|
+ :options="dict.type.sys_normal_disable"
|
|
|
+ :value="scope.row.status"
|
|
|
+ />
|
|
|
</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">
|
|
|
+ <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">
|
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ class-name="small-padding fixed-width"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -141,20 +198,22 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['system:dict:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['system:dict:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<pagination
|
|
|
- v-show="total>0"
|
|
|
+ v-show="total > 0"
|
|
|
:total="total"
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
:limit.sync="queryParams.pageSize"
|
|
@@ -176,11 +235,16 @@
|
|
|
v-for="dict in dict.type.sys_normal_disable"
|
|
|
:key="dict.value"
|
|
|
:label="dict.value"
|
|
|
- >{{dict.label}}</el-radio>
|
|
|
+ >{{ dict.label }}</el-radio
|
|
|
+ >
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="form.remark"
|
|
|
+ type="textarea"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -192,11 +256,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
|
|
|
+import {
|
|
|
+addType,
|
|
|
+delType,
|
|
|
+getType,
|
|
|
+listType,
|
|
|
+refreshCache,
|
|
|
+updateType,
|
|
|
+} from "@/api/system/dict/type";
|
|
|
|
|
|
export default {
|
|
|
- name: "Dict",
|
|
|
- dicts: ['sys_normal_disable'],
|
|
|
+ name: "SystemDict",
|
|
|
+ dicts: ["sys_normal_disable"],
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -225,19 +296,19 @@ export default {
|
|
|
pageSize: 10,
|
|
|
dictName: undefined,
|
|
|
dictType: undefined,
|
|
|
- status: undefined
|
|
|
+ status: undefined,
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
dictName: [
|
|
|
- { required: true, message: "字典名称不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: "字典名称不能为空", trigger: "blur" },
|
|
|
],
|
|
|
dictType: [
|
|
|
- { required: true, message: "字典类型不能为空", trigger: "blur" }
|
|
|
- ]
|
|
|
- }
|
|
|
+ { required: true, message: "字典类型不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -247,7 +318,8 @@ export default {
|
|
|
/** 查询字典类型列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
+ listType(this.addDateRange(this.queryParams, this.dateRange)).then(
|
|
|
+ (response) => {
|
|
|
this.typeList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
@@ -266,7 +338,7 @@ export default {
|
|
|
dictName: undefined,
|
|
|
dictType: undefined,
|
|
|
status: "0",
|
|
|
- remark: undefined
|
|
|
+ remark: undefined,
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -289,32 +361,32 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.dictId)
|
|
|
- this.single = selection.length!=1
|
|
|
- this.multiple = !selection.length
|
|
|
+ this.ids = selection.map((item) => item.dictId);
|
|
|
+ this.single = selection.length != 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
- const dictId = row.dictId || this.ids
|
|
|
- getType(dictId).then(response => {
|
|
|
+ const dictId = row.dictId || this.ids;
|
|
|
+ getType(dictId).then((response) => {
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
|
this.title = "修改字典类型";
|
|
|
});
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
- submitForm: function() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
+ submitForm: function () {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.form.dictId != undefined) {
|
|
|
- updateType(this.form).then(response => {
|
|
|
+ updateType(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- addType(this.form).then(response => {
|
|
|
+ addType(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
@@ -326,25 +398,33 @@ export default {
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const dictIds = row.dictId || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
|
|
|
- return delType(dictIds);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- }).catch(() => {});
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delType(dictIds);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
- this.download('system/dict/type/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `type_${new Date().getTime()}.xlsx`)
|
|
|
+ this.download(
|
|
|
+ "system/dict/type/export",
|
|
|
+ {
|
|
|
+ ...this.queryParams,
|
|
|
+ },
|
|
|
+ `type_${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
},
|
|
|
/** 刷新缓存按钮操作 */
|
|
|
handleRefreshCache() {
|
|
|
refreshCache().then(() => {
|
|
|
this.$modal.msgSuccess("刷新成功");
|
|
|
});
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|