保存接口

This commit is contained in:
zhangsir
2024-10-26 11:29:40 +08:00
parent 996143f721
commit 7d510a2c25
2 changed files with 27 additions and 35 deletions

View File

@@ -101,10 +101,13 @@ import * as lecturerApi from "@/api/Lecturer.js";
expandedKeys.value = []
selectedKeys.value = []
checkedKeys.value = []
}else{
console.log(props.AddContentList,'xixiixix')
treeAddData.value = props?.AddContentList
checkedKeys.value = props?.AddContentList?.map(item=>item.id)
}
});
const onCheck = (checkedKeys, {checked: bool, checkedNodes, node, event}) => {
console.log(checkedKeys.value,'选中的id值')
// "965356037047586816"
let length = treeAddData.value.length
if(checkedNodes.length > length){
@@ -131,7 +134,7 @@ import * as lecturerApi from "@/api/Lecturer.js";
clearTree()
};
const queryCreate = () => {
emit("AddContentList", treeAddData.value);
emit("update:AddContentList", treeAddData.value);
closeCodeModal()
}
const expandedKeys = ref([]);

View File

@@ -102,14 +102,14 @@
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="是否为根节点:" name="parentId">
<a-form-item label="是否为根节点:" name="code">
<div style="display: flex;align-items: center;">
<a-radio-group style="min-width:126px;" @change="selectRadio" v-model:value="formParam.status" name="radioGroup">
<a-radio :value="0"></a-radio>
<a-radio :value="1"></a-radio>
<a-radio-group style="min-width:126px;" @change="selectRadio" v-model:value="formParam.isParent" name="radioGroup">
<a-radio :value="1"></a-radio>
<a-radio :value="0"></a-radio>
</a-radio-group>
<a-select v-model:value="formParam.parentId" placeholder="请选择根节点"
:options="formParam.status?PlaceOfPayList:PlaceOfPayListTwo" allowClear showSearch/>
<a-select v-model:value="formParam.code" placeholder="请选择根节点"
:options="!formParam.isParent?PlaceOfPayList:PlaceOfPayListTwo" allowClear showSearch/>
</div>
</a-form-item>
</a-col>
@@ -121,7 +121,7 @@
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16" v-if="!formParam.status">
<a-row :gutter="16" v-if="formParam.isParent">
<a-col :span="12">
<a-form-item label="一级审批人" name="leveOneValue">
<!-- <a-select v-model:value="formParam.yjspr" placeholder="请选择一级审批人"
@@ -138,7 +138,7 @@
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12" v-if="!formParam.status">
<a-col :span="12" v-if="formParam.isParent">
<a-form-item label="三级审批人" >
<!-- <a-select v-model:value="formParam.sjspr" placeholder="请选择三级审批人"
:options="PlaceOfPayList" allowClear showSearch/> -->
@@ -169,7 +169,7 @@
<a-form-item label="">
<!-- <a-textarea v-model:value="formParam.remark" showCount :maxlength="200"
style="width: 100%; height: 100px; border-radius: 8px" placeholder="请输入" /> -->
<a-table :dataSource="orgList" :columns="orgColumns"/>
<a-table :dataSource="formParam?.affiliationOrgList" :columns="orgColumns"/>
</a-form-item>
</a-col>
</a-row>
@@ -193,7 +193,7 @@
</a-button>
</div>
</a-drawer>
<AddOrgContent :Addtitle="'选择组织'" v-model:showContent="showContent" @AddContentList="AddContentList" />
<AddOrgContent :Addtitle="'选择组织'" v-model:showContent="showContent" v-model:AddContentList="formParam.affiliationOrgList" />
</div>
</template>
@@ -234,7 +234,7 @@ export default{
formParam:{
trainOrgId:null,
trainOrgName:null,
status: 0,
isParent: 1,
remark:null,
orgName: null,
orgId: null,
@@ -244,31 +244,25 @@ export default{
leveOneArray: [],
leveTwoArray: [],
leveThreeArray: [],
parentId: null,
code: null,
affiliationOrgList: [],
},
orgList: [],
})
const PlaceOfPayList = ref([
{ value: 1, label: "一级审批人" },
{ value: 2, label: "二级审批人" },
{ value: 3, label: "三级审批人" },
{ value: '1', label: "一级审批人" },
{ value: '2', label: "二级审批人" },
{ value: '3', label: "三级审批人" },
])
const PlaceOfPayListTwo = ref([
{ value: 1, label: "一级审批人" },
{ value: '1', label: "一级审批人" },
])
const AddContentList = (val) => {
console.log(val,'val')
state.orgList = val
state.formParam.affiliationOrgList = val
}
const selectRadio = (val)=>{
if(val.target.value == 1){
state.formParam.leveOneArray = []
state.formParam.leveTwoArray = []
state.formParam.leveThreeArray = []
}
state.formParam.parentId = null
state.formParam.code = null
}
const columns = ref([
{
@@ -343,7 +337,7 @@ const orgColumns = ref([
customRender: (text) => {
return (
<div>
{isSelect == 1 ? `${text.record.isSelect} (${text.record.orgName})` : "否 (-)"}
{text.record.isSelect == 1 ? `${text.record.isSelect} (${text.record.orgName})` : "否 (-)"}
</div>
)
}
@@ -451,7 +445,7 @@ const getTableDate = (obj) => {
state.formParam={
trainOrgId:null,
trainOrgName:null,
status: 0,
isParent: 0,
remark:null,
orgName: null,
orgId: null,
@@ -461,7 +455,7 @@ const getTableDate = (obj) => {
leveOneArray: [],
leveTwoArray: [],
leveThreeArray: [],
parentId: null,
code: null,
affiliationOrgList: []
}
}
@@ -478,12 +472,8 @@ const getTableDate = (obj) => {
}
//保存
const createTeacherDialog = async () => {
if(state.formParam.status){
state.formParam.status = state.formParam.parentId
}
console.log(state.formParam,'state.formParam')
state.formParam.affiliationUserList = [...state.formParam?.actArray,...state.formParam?.leveOneArray,...state.formParam?.leveTwoArray,...state.formParam?.leveThreeArray]
state.formParam.orgId = state.orgList?.map(item=>item.id).join(',')
state.formParam.orgName = state.orgList?.map(item=>item.name).join(',')
const formItemNames = Object.keys(rules);
for(let i=0;i<formItemNames.length;i++){
const result = await validateField(formItemNames[i]);
@@ -515,7 +505,7 @@ const getTableDate = (obj) => {
const rules = {
trainOrgId: [{ required: true, message: '',log:'培训发生组织编号不能为空' }],
trainOrgName: [{ required: true, message: '',log:'培训发生组织名称不能为空' }],
parentId: [{ required: true, message: '',log:'根节点不能为空' }],
code: [{ required: true, message: '',log:'根节点不能为空' }],
actValue: [{ required: true, message: '',log:'组织担当不能为空' }],
leveOneValue: [{ required: true, message: '"',log:'一级审批人不能为空' }],
@@ -531,7 +521,6 @@ const getTableDate = (obj) => {
getTableDate,
searchSubmit,
selectRadio,
AddContentList,
PlaceOfPayList,
PlaceOfPayListTwo,
searchReset,