讲师管理bug

This commit is contained in:
zhangsir
2024-11-18 12:18:35 +08:00
parent 35ea32332e
commit 5e56362539
4 changed files with 64 additions and 22 deletions

View File

@@ -42,7 +42,7 @@
v-for="(item, index) in treeAddData"
:key="index"
>
<div class="tag_text" :title="`${item?.orgName} - (原:${item?.updateName || '-'})`">{{ item?.orgName }} - ({{ item?.updateName || '-' }})</div>
<div class="tag_text" :title="`${item?.name} - (原:${item?.orgName || '-'})`">{{ item?.name }} - ({{ item?.orgName || '-' }})</div>
<div @click="deleteTree(item)" class="tag_delete">+</div>
</div>
</div>
@@ -105,6 +105,7 @@ import * as lecturerApi from "@/api/Lecturer.js";
console.log(props.AddContentList,'xixiixix')
getNot()
treeAddData.value = props?.AddContentList
orgLists.value = props?.AddContentList
checkedKeys.value = props?.AddContentList?.map(item=>item.orgId)
}
});
@@ -113,32 +114,47 @@ import * as lecturerApi from "@/api/Lecturer.js";
console.log(res,'ressss')
})
}
const onCheck = (checkedKeys, {checked: bool, checkedNodes, node, event}) => {
const orgLists = ref([])
const onCheck = async (checkedKeys, {checked: bool, checkedNodes, node, event}) => {
// "965356037047586816"
let length = treeAddData.value.length
if(checkedNodes.length > length){
lecturerApi.getSelectOrg(node.id).then(res=>{
console.log(res,'ressssss')
const targetNode = checkedNodes.find(item=>item.id === res?.data[0]?.orgId)
await lecturerApi.getSelectOrg(node.id).then(res=>{
const targetNode = checkedNodes.find(item=>item.id == res?.data?.data[0]?.orgId)
if(targetNode){
Object.assign(targetNode,res.data[0]);
orgLists.value.push(Object.assign(targetNode,res?.data?.data[0]));
}
}).catch(err=>{
message.error('获取被占用组织失败,请重新尝试')
})
}
checkedNodes = checkedNodes.map(item=>{
treeAddData.value = checkedNodes.map(item => {
if (!item || !item.id) {
return item;
}
try {
const orgItem = orgLists.value?.find(i => i && i.id == item.id);
if (orgItem) {
item.isSelect = orgItem.isSelect;
item.orgName = orgItem.orgName;
item.leaders = orgItem.leaders;
}
return {
orgId: item.id,
orgName: item.name,
affiliationId: item.id,
...item
};
} catch (err) {
return item;
}
})
treeAddData.value = checkedNodes;
console.log(treeAddData.value,'checkedNodes')
});
// treeAddData.value = checkedNodes;
console.log(treeAddData.value,'checkedNodes',orgLists.value)
}
const clearTree = () => {
treeAddData.value = [];
checkedKeys.value = [];
orgLists.value = [];
}
const deleteTree = (item) => {
treeAddData.value = treeAddData.value.filter(node => node.orgId !== item.orgId);

View File

@@ -83,7 +83,7 @@
</a-drawer>
</template>
<script setup>
<script setup lang="jsx">
import {defineEmits, defineProps, ref,watch} from "vue";
import * as api from '@/api/Lecturer'
const props = defineProps({
@@ -112,9 +112,25 @@ const columns = [
},
{
title: '状态',
dataIndex: 'address',
key: 'address',
dataIndex: 'status',
key: 'status',
align: 'center',
customRender: ({text})=>{
switch (text) {
case 1:
return <span>待审核</span>;
case 2:
return <span>审核中</span>;
case 3:
return <span>已完成</span>;
case 4:
return <span>审核失败</span>;
case 5:
return <span>待审核</span>;
default:
return <span>-</span>;
}
},
},
];
const formData = ref({})

View File

@@ -118,7 +118,7 @@
<a-space >
<a-button type="link" @click="() => handleLook(record, String(record.courseform))">查看</a-button>
<!-- :disabled="record.createFrom==1 ?false :true" -->
<a-button type="link" :disabled="record.createFrom==1 ?false :true" @click="() => handleModify(record, String(record.courseform))">编辑</a-button>
<a-button type="link" :disabled="record.createFrom!=1 ?false :true" @click="() => handleModify(record, String(record.courseform))">编辑</a-button>
<!-- <a-button :disabled="record.status==='A20' || record.status==='A30'||record.status==='S20' ?true :false" type="link" @click="() => handleOperate(record, String(record.courseform))">提交</a-button>
<a-button :disabled="record.status==='A10' && record.status!=='A20' || record.status==='A30'||record.status==='S20' ||record.status==='E10' ?true :false" type="link" @click="() => handleOperate(record, String(record.courseform))">撤回</a-button> -->
<!-- <a-button type="link" @click="() => deleteModal(record, String(record.courseform))">删除</a-button> -->

View File

@@ -200,7 +200,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="formParam?.affiliationOrgList" :columns="orgColumns"/>
<a-table :dataSource="formParam?.affiliationOrgList" :scroll="{ x: '600' }" :columns="orgColumns"/>
</a-form-item>
</a-col>
</a-row>
@@ -391,15 +391,21 @@ const orgColumns = ref([
title: '组织名称',
dataIndex: 'orgName',
key: 'orgName',
ellipsis: true,
width: '20%',
align: 'center',
},
{
title: '是否被培训发生组织选择',
dataIndex: 'isSelect',
key: 'isSelect',
ellipsis: true,
align: 'center',
width: '30%',
customRender: (text) => {
return (
<div>
{text.record.isSelect == 1 ? `${text.record.isSelect} (${text.record.orgName})` : "否 (-)"}
{text.record.isSelect == 1 ? ` (${text.record.orgName})` : "否 (-)"}
</div>
)
}
@@ -408,6 +414,9 @@ const orgColumns = ref([
title: '担当',
dataIndex: 'leaders',
key: 'leaders',
ellipsis: true,
align: 'center',
width: '60%',
customRender: (text) => {
return (
<div>
@@ -572,6 +581,7 @@ const getTableDate = (obj) => {
};
});
state.formParam.leveThreeValue = state.formParam.leveThreeArray.map(item => item.label).join(',');
state.formParam.orglistName = state.formParam.affiliationOrgList?.map(item=>item.id).join(',')
state.teacherdialog = true;
state.teacherdialogtitle = '编辑培训发生组织'
state.vf = false
@@ -629,7 +639,7 @@ const getTableDate = (obj) => {
console.log(state.formParam,'state.formParam')
state.formParam.affiliationName = state.formParam.affiliationName?.trim()
state.formParam.affiliationUserList = [...state.formParam?.actArray,...state.formParam?.leveOneArray,...state.formParam?.leveTwoArray,...state.formParam?.leveThreeArray]
state.formParam.orglistName = state.formParam.affiliationOrgList?.map(item=>item.name).join(',')
state.formParam.orglistName = state.formParam.affiliationOrgList?.map(item=>item.id).join(',')
const formItemNames = Object.keys(rules);
for(let i=0;i<formItemNames.length;i++){
const result = await validateField(formItemNames[i]);