系统字典删除多余文件

This commit is contained in:
于晏彭 2023-03-14 09:53:25 +08:00
parent f7382a44ea
commit c5383269ee

View File

@ -1,207 +0,0 @@
<template>
<div class="table-box">
<ProTable
ref="proTable"
title="用户列表"
:columns="columns"
:requestApi="getTableList"
:initParam="initParam"
:dataCallback="dataCallback"
:tool-button="false"
:pagination="true"
background
>
<template #formButton="scope">
<el-button type="primary" @click="handleAddItem()">新增</el-button>
</template>
<!-- 表格操作 -->
<template #operation="scope">
<el-button type="primary" link :icon="EditPen" @click="handleEditItem('edit', scope.row)">编辑</el-button>
<el-button type="primary" link :icon="Delete" @click="deleteAccount(scope.row)">删除</el-button>
</template>
</ProTable>
<DialogForm
:title="title"
:formConfig="formConfig"
:formData="formData"
v-model:visible="visible"
append-to-body
width="700px"
@confirm="saveItem"
>
</DialogForm>
</div>
</template>
<script setup lang="tsx" name="jxjDictionary">
import { ref, reactive } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
import { User } from "@/api/interface";
import { ColumnProps } from "@/components/ProTable/interface";
import { useHandleData } from "@/hooks/useHandleData";
import { useDownload } from "@/hooks/useDownload";
import ProTable from "@/components/ProTable/index.vue";
import DialogForm from "@/components/DialogForm/index.vue";
import { CirclePlus, Delete, EditPen } from "@element-plus/icons-vue";
import { getDictionaryList, deleteDictionary, editDictionary, addDictionary } from "@/api/modules/jxjview";
const router = useRouter();
const visible = ref(false);
const title = ref("");
const formData = ref({});
const mode = ref("");
// ProTable 便
const proTable = ref();
//
const handleAddItem = () => {
mode.value = "add";
visible.value = true;
title.value = "新增";
formData.value = reactive({});
};
//
function handleEditItem(index: string, row: any) {
mode.value = "edit";
visible.value = true;
title.value = "编辑";
formData.value = reactive(row);
}
//
const columns: ColumnProps[] = [
{
prop: "dictCode",
label: "序号"
},
{
prop: "dictValue",
label: "字典名称",
// enum:dictType,
search: { el: "input" }
// fieldNames: { label: "genderLabel", value: "genderValue" }
},
// prop
{
prop: "dictLabel",
label: "字典键值"
// search: { el: "input" }
},
{
prop: "dictSort",
label: "字典排序"
// search: { el: "input" }
},
{
prop: "status",
label: "状态",
enum: [
{ label: "正常", value: "1" },
{ label: "停用", value: "0" }
]
// search: { el: "select" }
},
{ prop: "remark", label: "备注" },
{
prop: "createTime",
label: "创建时间"
// search: {
// el: "date-picker",
// span: 2,
// props: { type: "datetimerange", valueFormat: "YYYY-MM-DD HH:mm:ss" },
// defaultValue: ["", ""]
// }
},
{ prop: "operation", label: "操作", fixed: "right", width: 330 }
];
//
const formConfig = {
formItemConfig: [
{
label: "字典名称",
prop: "dictValue",
type: "input"
},
{
label: "字典类型",
prop: "dictType",
type: "input"
},
{
label: "状态",
prop: "status",
type: "radio",
data: [
{ label: "正常", value: "1" },
{ label: "停用", value: "0" }
]
},
{
label: "备注",
prop: "remark",
type: "input"
}
],
rules: {
configKey: [
{
required: true,
message: "请输入类型名",
trigger: "blur"
}
]
}
};
// ProTable()
const initParam = reactive({
type: 1
});
// dataCallback list && total && pageNum && pageSize
// hooks/useTable.ts
const dataCallback = (data: any) => {
// console.log(data);
return {
list: data.records,
total: Number(data.total),
pageNo: Number(data.current),
pageSize: Number(data.size)
};
};
// params
// ProTable :requestApi="getUserList"
const getTableList = (params: any) => {
let newParams = JSON.parse(JSON.stringify(params));
// console.log(newParams);
newParams.endTime = newParams.createTime[1];
newParams.createTime = newParams.createTime[0];
return getDictionaryList(newParams);
};
//
const saveItem = async (form: any) => {
if (form.dictCode) {
// console.log(form.dictCode);
const res = await editDictionary(form);
proTable.value.getTableList();
ElMessage.success("编辑成功");
} else {
const res = await addDictionary(form);
ElMessage.success("新增成功");
proTable.value.getTableList();
}
visible.value = false;
};
//
const deleteAccount = async (params: User.ResUserList) => {
await useHandleData(deleteDictionary, { id: params.dictCode }, `删除【${params.username}】用户`);
proTable.value.getTableList();
};
</script>