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