fix: 修复pure问题
This commit is contained in:
@@ -12,7 +12,8 @@ const props = withDefaults(defineProps<FormProps>(), {
|
||||
configValue: "",
|
||||
configKey: "",
|
||||
configType: "",
|
||||
remark: ""
|
||||
remark: "",
|
||||
creationTime: ""
|
||||
})
|
||||
});
|
||||
const ruleFormRef = ref();
|
||||
@@ -31,35 +32,59 @@ defineExpose({ getRef });
|
||||
ref="ruleFormRef"
|
||||
:model="newFormInline"
|
||||
:rules="formRules"
|
||||
label-width="82px">
|
||||
label-width="82px"
|
||||
>
|
||||
<el-row :gutter="30">
|
||||
<re-col :value="12" :xs="24" :sm="24">
|
||||
<el-form-item label="参数名称" prop="configName">
|
||||
<el-input v-model="newFormInline.configName" clearable placeholder="请输入参数名称" />
|
||||
<el-input
|
||||
v-model="newFormInline.configName"
|
||||
clearable
|
||||
placeholder="请输入参数名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</re-col>
|
||||
|
||||
<re-col :value="12" :xs="24" :sm="24">
|
||||
<el-form-item label="参数键名" prop="configKey">
|
||||
<el-input v-model="newFormInline.configKey" clearable placeholder="请输入参数键名" />
|
||||
<el-input
|
||||
v-model="newFormInline.configKey"
|
||||
clearable
|
||||
placeholder="请输入参数键名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</re-col>
|
||||
|
||||
<re-col :value="12" :xs="24" :sm="24">
|
||||
<el-form-item label="参数键值" prop="configValue">
|
||||
<el-input v-model="newFormInline.configValue" clearable placeholder="请输入参数键值" />
|
||||
<el-input
|
||||
v-model="newFormInline.configValue"
|
||||
clearable
|
||||
placeholder="请输入参数键值"
|
||||
/>
|
||||
</el-form-item>
|
||||
</re-col>
|
||||
<re-col :value="12" :xs="24" :sm="24">
|
||||
<el-form-item label="系统内置">
|
||||
<el-switch v-model="newFormInline.configType" inline-prompt :active-value="true" :inactive-value="false"
|
||||
active-text="是" inactive-text="否" :style="switchStyle" />
|
||||
<el-switch
|
||||
v-model="newFormInline.configType"
|
||||
inline-prompt
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
:style="switchStyle"
|
||||
/>
|
||||
</el-form-item>
|
||||
</re-col>
|
||||
|
||||
<re-col>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="newFormInline.remark" placeholder="请输入备注信息" type="textarea" />
|
||||
<el-input
|
||||
v-model="newFormInline.remark"
|
||||
placeholder="请输入备注信息"
|
||||
type="textarea"
|
||||
/>
|
||||
</el-form-item>
|
||||
</re-col>
|
||||
</el-row>
|
||||
|
||||
@@ -32,23 +32,46 @@ const {
|
||||
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-form ref="formRef" :inline="true"
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
||||
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto"
|
||||
>
|
||||
<el-form-item label="参数名称:" prop="name">
|
||||
<el-input v-model="form.configName" placeholder="请输入参数名称" clearable class="!w-[180px]" />
|
||||
<el-input
|
||||
v-model="form.configName"
|
||||
placeholder="请输入参数名称"
|
||||
clearable
|
||||
class="!w-[180px]"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="参数键名:" prop="key">
|
||||
<el-input v-model="form.configKey" placeholder="请输入参数名称" clearable class="!w-[180px]" />
|
||||
<el-input
|
||||
v-model="form.configKey"
|
||||
placeholder="请输入参数名称"
|
||||
clearable
|
||||
class="!w-[180px]"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否内置:" prop="state">
|
||||
<el-select v-model="form.configType" placeholder="" clearable class="!w-[180px]">
|
||||
<el-select
|
||||
v-model="form.configType"
|
||||
placeholder=""
|
||||
clearable
|
||||
class="!w-[180px]"
|
||||
>
|
||||
<el-option label="是" :value="true" />
|
||||
<el-option label="否" :value="false" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="useRenderIcon('ri:search-line')" :loading="loading" @click="onSearch">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="useRenderIcon('ri:search-line')"
|
||||
:loading="loading"
|
||||
@click="onSearch"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
|
||||
@@ -57,9 +80,18 @@ const {
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<PureTableBar title="参数设置" :columns="columns" :tableRef="tableRef?.getTableRef()" @refresh="onSearch" >
|
||||
<PureTableBar
|
||||
title="参数设置"
|
||||
:columns="columns"
|
||||
:tableRef="tableRef?.getTableRef()"
|
||||
@refresh="onSearch"
|
||||
>
|
||||
<template #buttons>
|
||||
<el-button type="primary" :icon="useRenderIcon(AddFill)" @click="openDialog()">
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="useRenderIcon(AddFill)"
|
||||
@click="openDialog()"
|
||||
>
|
||||
新增参数
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -80,15 +112,31 @@ const {
|
||||
background: 'var(--el-fill-color-light)',
|
||||
color: 'var(--el-text-color-primary)'
|
||||
}"
|
||||
@selection-change="handleSelectionChange">
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #operation="{ row }">
|
||||
<el-button class="reset-margin" link type="primary" :size="size" :icon="useRenderIcon(EditPen)"
|
||||
@click="openDialog('修改', row)">
|
||||
<el-button
|
||||
class="reset-margin"
|
||||
link
|
||||
type="primary"
|
||||
:size="size"
|
||||
:icon="useRenderIcon(EditPen)"
|
||||
@click="openDialog('修改', row)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-popconfirm :title="`是否确认删除 ? 参数: ${row.configName}`" @confirm="handleDelete(row)">
|
||||
<el-popconfirm
|
||||
:title="`是否确认删除 ? 参数: ${row.configName}`"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button class="reset-margin" link type="primary" :size="size" :icon="useRenderIcon(Delete)">
|
||||
<el-button
|
||||
class="reset-margin"
|
||||
link
|
||||
type="primary"
|
||||
:size="size"
|
||||
:icon="useRenderIcon(Delete)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
import editForm from "../form.vue";
|
||||
import { handleTree } from "@/utils/tree";
|
||||
import { message } from "@/utils/message";
|
||||
import { usePublicHooks } from "../../hooks";
|
||||
import { addDialog } from "@/components/ReDialog";
|
||||
import { reactive, ref, onMounted, h, toRaw } from "vue";
|
||||
import type { FormItemProps } from "../utils/types";
|
||||
import type { PaginationProps } from "@pureadmin/table";
|
||||
import { cloneDeep, isAllEmpty, deviceDetection } from "@pureadmin/utils";
|
||||
import { addConfig, delConfig, getConfig, getConfigList, updateConfig } from "@/api/system/config";
|
||||
import { getPlatformConfig } from "@/config/index";
|
||||
import { deviceDetection } from "@pureadmin/utils";
|
||||
import {
|
||||
addConfig,
|
||||
delConfig,
|
||||
getConfig,
|
||||
getConfigList,
|
||||
updateConfig
|
||||
} from "@/api/system/config";
|
||||
|
||||
export function useConfig() {
|
||||
const form = reactive({
|
||||
configName: "",
|
||||
configKey:"",
|
||||
configType:"",
|
||||
configKey: "",
|
||||
configType: ""
|
||||
});
|
||||
|
||||
const pagination = reactive<PaginationProps>({
|
||||
@@ -36,7 +39,6 @@ export function useConfig() {
|
||||
const formRef = ref();
|
||||
const dataList = ref([]);
|
||||
const loading = ref(true);
|
||||
const { tagStyle } = usePublicHooks();
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
@@ -107,7 +109,6 @@ export function useConfig() {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
|
||||
async function openDialog(title = "新增", row?: FormItemProps) {
|
||||
let data: any = null;
|
||||
if (title == "修改") {
|
||||
@@ -118,11 +119,11 @@ export function useConfig() {
|
||||
title: `${title}参数`,
|
||||
props: {
|
||||
formInline: {
|
||||
configName:data?.configName?? "",
|
||||
configKey:data?.configKey?? "",
|
||||
configValue:data?.configValue?? "",
|
||||
configTYpe:data?.configType?? "",
|
||||
remark:data?.remark?? "",
|
||||
configName: data?.configName ?? "",
|
||||
configKey: data?.configKey ?? "",
|
||||
configValue: data?.configValue ?? "",
|
||||
configTYpe: data?.configType ?? "",
|
||||
remark: data?.remark ?? ""
|
||||
}
|
||||
},
|
||||
width: "40%",
|
||||
@@ -146,13 +147,13 @@ export function useConfig() {
|
||||
// 表单规则校验通过
|
||||
if (title === "新增") {
|
||||
// 实际开发先调用新增接口,再进行下面操作
|
||||
console.log('新增参数');
|
||||
console.log("新增参数");
|
||||
await addConfig(curData);
|
||||
chores();
|
||||
} else {
|
||||
// 实际开发先调用修改接口,再进行下面操作
|
||||
curData.id = row.id
|
||||
curData.creationTime = row.creationTime
|
||||
curData.id = row.id;
|
||||
curData.creationTime = row.creationTime;
|
||||
await updateConfig(row.id, curData);
|
||||
chores();
|
||||
}
|
||||
@@ -164,7 +165,9 @@ export function useConfig() {
|
||||
|
||||
async function handleDelete(row) {
|
||||
await delConfig([row.id]);
|
||||
message(`您删除了参数名称为 ${row.configName} 的这条数据`, { type: "success" });
|
||||
message(`您删除了参数名称为 ${row.configName} 的这条数据`, {
|
||||
type: "success"
|
||||
});
|
||||
onSearch();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ interface FormItemProps {
|
||||
configKey: string;
|
||||
configType: string;
|
||||
remark: string;
|
||||
creationTime:string;
|
||||
creationTime: string;
|
||||
}
|
||||
interface FormProps {
|
||||
formInline: FormItemProps;
|
||||
|
||||
@@ -9,7 +9,7 @@ const props = withDefaults(defineProps<FormProps>(), {
|
||||
formInline: () => ({
|
||||
title: "新增",
|
||||
higherDeptOptions: [],
|
||||
deptId: "",
|
||||
deptId: null,
|
||||
nick: "",
|
||||
userName: "",
|
||||
password: "",
|
||||
@@ -31,6 +31,10 @@ const sexOptions = [
|
||||
{
|
||||
value: "Woman",
|
||||
label: "女"
|
||||
},
|
||||
{
|
||||
value: "Unknown",
|
||||
label: "未知"
|
||||
}
|
||||
];
|
||||
const ruleFormRef = ref();
|
||||
|
||||
@@ -303,13 +303,13 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
||||
const resetForm = formEl => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
form.deptId = "";
|
||||
form.deptId = null;
|
||||
treeRef.value.onTreeReset();
|
||||
onSearch();
|
||||
};
|
||||
|
||||
function onTreeSelect({ id, selected }) {
|
||||
form.deptId = selected ? id : "";
|
||||
form.deptId = selected ? id : null;
|
||||
onSearch();
|
||||
}
|
||||
|
||||
@@ -338,13 +338,13 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
||||
formInline: {
|
||||
title,
|
||||
higherDeptOptions: formatHigherDeptOptions(higherDeptOptions.value),
|
||||
deptId: data?.deptId ?? 0,
|
||||
deptId: data?.deptId ?? null,
|
||||
nick: data?.nick ?? "",
|
||||
userName: data?.userName ?? "",
|
||||
password: data?.password ?? "",
|
||||
phone: data?.phone ?? "",
|
||||
phone: data?.phone ?? null,
|
||||
email: data?.email ?? "",
|
||||
sex: data?.sex ?? "",
|
||||
sex: data?.sex ?? "Unknown",
|
||||
state: data?.state ?? true,
|
||||
remark: data?.remark ?? "",
|
||||
roleIds: data?.roles?.map(r => r.id),
|
||||
@@ -362,7 +362,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
|
||||
const curData = options.props.formInline as FormItemProps;
|
||||
|
||||
function chores() {
|
||||
message(`您${title}了用户名称为${curData.userName}的这条数据`, {
|
||||
message(`您${title}了用户名称为${curData.userName}的用户`, {
|
||||
type: "success"
|
||||
});
|
||||
done(); // 关闭弹框
|
||||
|
||||
@@ -8,6 +8,7 @@ export const formRules = reactive(<FormRules>{
|
||||
userName: [{ required: true, message: "用户名称为必填项", trigger: "blur" }],
|
||||
password: [{ required: true, message: "用户密码为必填项", trigger: "blur" }],
|
||||
phone: [
|
||||
{ required: true, message: "手机号为必填项", trigger: "blur" },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
|
||||
Reference in New Issue
Block a user