|
|
|
@ -1,6 +1,13 @@
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { reactive, ref, watch } from "vue";
|
|
|
|
|
import { onMounted, reactive, ref, watch } from "vue";
|
|
|
|
|
import { FormInstance, FormRules, type CheckboxValueType } from "element-plus";
|
|
|
|
|
import {
|
|
|
|
|
getOptionalBaseList,
|
|
|
|
|
getRoleManageList,
|
|
|
|
|
getUserList,
|
|
|
|
|
createProcess
|
|
|
|
|
} from "@/api/business";
|
|
|
|
|
import { message } from "@/utils/message";
|
|
|
|
|
defineOptions({
|
|
|
|
|
name: "CreateForm"
|
|
|
|
|
});
|
|
|
|
@ -25,86 +32,64 @@ watch(
|
|
|
|
|
);
|
|
|
|
|
const ruleFormRef = ref<FormInstance>();
|
|
|
|
|
const processForm = reactive({
|
|
|
|
|
title: "",
|
|
|
|
|
sublibraryName: [],
|
|
|
|
|
dataType: "",
|
|
|
|
|
id: "",
|
|
|
|
|
flowName: "",
|
|
|
|
|
baseIdList: [],
|
|
|
|
|
flowType: "",
|
|
|
|
|
link: [
|
|
|
|
|
{
|
|
|
|
|
linkName: "",
|
|
|
|
|
directorRole: "",
|
|
|
|
|
directorName: ""
|
|
|
|
|
nodeName: "",
|
|
|
|
|
roleId: null,
|
|
|
|
|
userIdList: []
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
desc: ""
|
|
|
|
|
remark: ""
|
|
|
|
|
});
|
|
|
|
|
const checkAll = ref(false);
|
|
|
|
|
const indeterminate = ref(false);
|
|
|
|
|
const value = ref<CheckboxValueType[]>([]);
|
|
|
|
|
const cities = ref([
|
|
|
|
|
{
|
|
|
|
|
value: "Beijing",
|
|
|
|
|
label: "Beijing"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "Shanghai",
|
|
|
|
|
label: "Shanghai"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "Nanjing",
|
|
|
|
|
label: "Nanjing"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "Chengdu",
|
|
|
|
|
label: "Chengdu"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "Shenzhen",
|
|
|
|
|
label: "Shenzhen"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "Guangzhou",
|
|
|
|
|
label: "Guangzhou"
|
|
|
|
|
}
|
|
|
|
|
]);
|
|
|
|
|
const subLibraryIdList = ref([]);
|
|
|
|
|
const roleNameList = ref([]);
|
|
|
|
|
const userNameList = ref([]);
|
|
|
|
|
const rules = reactive<FormRules>({
|
|
|
|
|
title: [{ required: true, message: "请输入", trigger: "blur" }],
|
|
|
|
|
sublibraryName: [
|
|
|
|
|
flowName: [{ required: true, message: "请输入", trigger: "blur" }],
|
|
|
|
|
baseIdList: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请选择",
|
|
|
|
|
trigger: "change"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
dataType: [
|
|
|
|
|
flowType: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请选择",
|
|
|
|
|
trigger: "change"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
linkName: [{ required: true, message: "请输入", trigger: "blur" }],
|
|
|
|
|
directorRole: [
|
|
|
|
|
nodeName: [{ required: true, message: "请输入", trigger: "blur" }],
|
|
|
|
|
roleId: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请选择",
|
|
|
|
|
trigger: "change"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
directorName: [
|
|
|
|
|
userIdList: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请选择",
|
|
|
|
|
trigger: "change"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
desc: [{ required: true, message: "请输入", trigger: "blur" }]
|
|
|
|
|
remark: [{ required: true, message: "请输入", trigger: "blur" }]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(value, val => {
|
|
|
|
|
if (val.length === 0) {
|
|
|
|
|
checkAll.value = false;
|
|
|
|
|
indeterminate.value = false;
|
|
|
|
|
} else if (val.length === cities.value.length) {
|
|
|
|
|
} else if (val.length === subLibraryIdList.value.length) {
|
|
|
|
|
checkAll.value = true;
|
|
|
|
|
indeterminate.value = false;
|
|
|
|
|
} else {
|
|
|
|
@ -115,9 +100,9 @@ watch(value, val => {
|
|
|
|
|
const handleCheckAll = (val: CheckboxValueType) => {
|
|
|
|
|
indeterminate.value = false;
|
|
|
|
|
if (val) {
|
|
|
|
|
processForm.sublibraryName = cities.value.map(_ => _.value);
|
|
|
|
|
processForm.baseIdList = subLibraryIdList.value.map(_ => _.value);
|
|
|
|
|
} else {
|
|
|
|
|
processForm.sublibraryName = [];
|
|
|
|
|
processForm.baseIdList = [];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// const submitForm = () => {
|
|
|
|
@ -127,7 +112,31 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
|
|
if (!formEl) return;
|
|
|
|
|
await formEl.validate((valid, fields) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
console.log("submit!");
|
|
|
|
|
console.log(processForm);
|
|
|
|
|
// console.log("submit!");
|
|
|
|
|
const createForm = {
|
|
|
|
|
id: "",
|
|
|
|
|
flowName: processForm.flowName,
|
|
|
|
|
remark: processForm.remark,
|
|
|
|
|
flowType: processForm.flowType,
|
|
|
|
|
baseIdList: processForm.baseIdList,
|
|
|
|
|
nodeInfoList: processForm.link.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
id: "",
|
|
|
|
|
userIdList: item.userIdList,
|
|
|
|
|
order: "",
|
|
|
|
|
roleId: item.roleId,
|
|
|
|
|
nodeName: item.nodeName
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
console.log(createForm);
|
|
|
|
|
createProcess(createForm).then(res => {
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
message("新建成功", { type: "success" });
|
|
|
|
|
props.closeDrawer();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log("error submit!", fields);
|
|
|
|
|
}
|
|
|
|
@ -142,11 +151,64 @@ const handleDrawerClosed = () => {
|
|
|
|
|
};
|
|
|
|
|
const addLink = () => {
|
|
|
|
|
processForm.link.push({
|
|
|
|
|
linkName: "",
|
|
|
|
|
directorRole: "",
|
|
|
|
|
directorName: ""
|
|
|
|
|
nodeName: "",
|
|
|
|
|
roleId: null,
|
|
|
|
|
userIdList: []
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const getOptionalBaseLists = async () => {
|
|
|
|
|
const res: any = await getOptionalBaseList({
|
|
|
|
|
flowType: ""
|
|
|
|
|
});
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
subLibraryIdList.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const getRoleManageLists = async () => {
|
|
|
|
|
const res: any = await getRoleManageList({
|
|
|
|
|
roleName: "",
|
|
|
|
|
pageNum: "1",
|
|
|
|
|
pageSize: "10"
|
|
|
|
|
});
|
|
|
|
|
// console.log(res);
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
roleNameList.value = res.data.records;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const getUserLists = async () => {
|
|
|
|
|
const res: any = await getUserList({
|
|
|
|
|
userName: "",
|
|
|
|
|
deptId: "",
|
|
|
|
|
roleId: "",
|
|
|
|
|
pageNum: "1",
|
|
|
|
|
pageSize: "10"
|
|
|
|
|
});
|
|
|
|
|
// console.log(res);
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
userNameList.value = res.data.records;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleSelect = async (value: any) => {
|
|
|
|
|
console.log(value);
|
|
|
|
|
// const selectItem = JSON.parse(value);
|
|
|
|
|
const res: any = await getUserList({
|
|
|
|
|
userName: "",
|
|
|
|
|
deptId: "",
|
|
|
|
|
roleId: value,
|
|
|
|
|
pageNum: "1",
|
|
|
|
|
pageSize: "10"
|
|
|
|
|
});
|
|
|
|
|
console.log(res);
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
userNameList.value = res.data.records;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getOptionalBaseLists();
|
|
|
|
|
getRoleManageLists();
|
|
|
|
|
getUserLists();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
@ -168,16 +230,16 @@ const addLink = () => {
|
|
|
|
|
ref="ruleFormRef"
|
|
|
|
|
>
|
|
|
|
|
<div class="text-[20px] text-[#333] font-bold mb-6">基本信息</div>
|
|
|
|
|
<el-form-item label="流程名称" prop="title">
|
|
|
|
|
<el-form-item label="流程名称" prop="flowName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="processForm.title"
|
|
|
|
|
v-model="processForm.flowName"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="子库名称" prop="sublibraryName">
|
|
|
|
|
<el-form-item label="子库名称" prop="baseIdList">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="processForm.sublibraryName"
|
|
|
|
|
v-model="processForm.baseIdList"
|
|
|
|
|
multiple
|
|
|
|
|
clearable
|
|
|
|
|
collapse-tags
|
|
|
|
@ -187,10 +249,10 @@ const addLink = () => {
|
|
|
|
|
class="w-[80%]"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in cities"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
v-for="item in subLibraryIdList"
|
|
|
|
|
:key="item.baseId"
|
|
|
|
|
:label="item.baseName"
|
|
|
|
|
:value="item.baseId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-checkbox
|
|
|
|
@ -202,8 +264,8 @@ const addLink = () => {
|
|
|
|
|
全部
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="数据类型" prop="dataType">
|
|
|
|
|
<el-radio-group v-model="processForm.dataType">
|
|
|
|
|
<el-form-item label="数据类型" prop="flowType">
|
|
|
|
|
<el-radio-group v-model="processForm.flowType">
|
|
|
|
|
<el-radio label="1">知识报送</el-radio>
|
|
|
|
|
<el-radio label="2">知识删除</el-radio>
|
|
|
|
|
<el-radio label="3">知识撤回</el-radio>
|
|
|
|
@ -213,7 +275,7 @@ const addLink = () => {
|
|
|
|
|
<div v-for="(item, index) in processForm.link" :key="index">
|
|
|
|
|
<el-form-item
|
|
|
|
|
label="环节名称"
|
|
|
|
|
:prop="'link.' + index + '.linkName'"
|
|
|
|
|
:prop="'link.' + index + '.nodeName'"
|
|
|
|
|
:rules="{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入',
|
|
|
|
@ -221,7 +283,7 @@ const addLink = () => {
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="item.linkName"
|
|
|
|
|
v-model="item.nodeName"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
/>
|
|
|
|
@ -229,7 +291,7 @@ const addLink = () => {
|
|
|
|
|
<el-form-item label="负责人" required>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item
|
|
|
|
|
:prop="'link.' + index + '.directorRole'"
|
|
|
|
|
:prop="'link.' + index + '.roleId'"
|
|
|
|
|
:rules="{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择',
|
|
|
|
@ -237,17 +299,18 @@ const addLink = () => {
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="item.directorRole"
|
|
|
|
|
v-model="item.roleId"
|
|
|
|
|
clearable
|
|
|
|
|
popper-class="custom-header"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
class="w-[100%]"
|
|
|
|
|
@change="handleSelect"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in cities"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
v-for="item in roleNameList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.roleName"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -255,7 +318,7 @@ const addLink = () => {
|
|
|
|
|
<el-col :span="2" class="text-center" />
|
|
|
|
|
<el-col :span="14">
|
|
|
|
|
<el-form-item
|
|
|
|
|
:prop="'link.' + index + '.directorName'"
|
|
|
|
|
:prop="'link.' + index + '.userIdList'"
|
|
|
|
|
:rules="{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择',
|
|
|
|
@ -263,17 +326,20 @@ const addLink = () => {
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="item.directorName"
|
|
|
|
|
v-model="item.userIdList"
|
|
|
|
|
multiple
|
|
|
|
|
clearable
|
|
|
|
|
collapse-tags
|
|
|
|
|
popper-class="custom-header"
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
:max-collapse-tags="2"
|
|
|
|
|
class="w-[100%]"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in cities"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
v-for="item in userNameList"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.username"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -287,8 +353,8 @@ const addLink = () => {
|
|
|
|
|
<el-form-item label=" ">
|
|
|
|
|
<el-button @click="addLink">+添加审批环节</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="desc">
|
|
|
|
|
<el-input v-model="processForm.desc" type="textarea" />
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="processForm.remark" type="textarea" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div class="drawer_footer">
|
|
|
|
|