|
|
|
|
@@ -69,11 +69,11 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script lang='ts' setup>
|
|
|
|
|
import { addNodeApi, editNodeApi } from '@/api/project/node';
|
|
|
|
|
import { addNodeApi, editNodeApi, getNodeDetailApi } from '@/api/project/node';
|
|
|
|
|
import Dialog from '@/components/common/dialog/index.vue';
|
|
|
|
|
import { getTagKeyMap, NODE_TYPE } from '@/utils/enum/node';
|
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
|
import { computed, nextTick, ref, watch } from 'vue';
|
|
|
|
|
import { computed, reactive, ref, watch } from 'vue';
|
|
|
|
|
import { getProjectExeStatus, getTagMapList } from '@/views/task/projectDetail/components/project';
|
|
|
|
|
import TableForm from '@/components/common/table/tableForm.vue';
|
|
|
|
|
import { PROJECT_EXE_STATUS_CODE } from '@/utils/enum/project';
|
|
|
|
|
@@ -81,10 +81,8 @@ import { getMemberListStr } from '@/utils/task';
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
modelValue: boolean;
|
|
|
|
|
dialogType: string;
|
|
|
|
|
nodeLevel1List: Array<any>;
|
|
|
|
|
exeStatus?: string;
|
|
|
|
|
currentRow?: any;
|
|
|
|
|
projectId?: string;
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const tableFormRef = ref();
|
|
|
|
|
@@ -110,7 +108,7 @@ const addOrEditProject = async () => {
|
|
|
|
|
if (await tableFormRef.value.validateFun()) {
|
|
|
|
|
if (hasSameValue()) return;
|
|
|
|
|
loadingInterface.value = true;
|
|
|
|
|
if (props.dialogType === 'create') {
|
|
|
|
|
if (props?.projectId) {
|
|
|
|
|
await createProject();
|
|
|
|
|
} else {
|
|
|
|
|
// console.log('编辑项目', projectForm);
|
|
|
|
|
@@ -202,19 +200,20 @@ const closeFun = () => {
|
|
|
|
|
// emits('nextPageFun', 'basePage');
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
const setEditForm = (val: any) => {
|
|
|
|
|
console.log('val', val, tableFormRef.value);
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
const memberStr = getMemberListStr(val?.memberList);
|
|
|
|
|
tableFormRef.value.setFormDataFun({ ...val, memberList: memberStr });
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// const setEditForm = (val: any) => {
|
|
|
|
|
// console.log('val', val, tableFormRef.value);
|
|
|
|
|
// nextTick(() => {
|
|
|
|
|
// const memberStr = getMemberListStr(val?.memberList);
|
|
|
|
|
// tableFormRef.value.setFormDataFun({ ...val, memberList: memberStr });
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
const setOptionsFun = (key: string, options: any[]) => {
|
|
|
|
|
console.log('key options', key, options);
|
|
|
|
|
tableFormRef.value.setOptionsFun(key, options);
|
|
|
|
|
};
|
|
|
|
|
const loadFun = () => {
|
|
|
|
|
const loadFun = async() => {
|
|
|
|
|
await getNodeDetailFun();
|
|
|
|
|
initTableForm();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -222,22 +221,45 @@ const initTableForm = () => {
|
|
|
|
|
console.log('tableFormRef.value', tableFormRef.value);
|
|
|
|
|
if (tableFormRef.value) {
|
|
|
|
|
let statusList = [];
|
|
|
|
|
if (props.dialogType === 'create') {
|
|
|
|
|
if (!props?.projectId) {
|
|
|
|
|
statusList = [{ label: '未开始', value: PROJECT_EXE_STATUS_CODE.NOT_STARTED }];
|
|
|
|
|
tableFormRef.value.resetFun();
|
|
|
|
|
setEditForm({ exeStatus: PROJECT_EXE_STATUS_CODE.NOT_STARTED });
|
|
|
|
|
// setEditForm({ exeStatus: PROJECT_EXE_STATUS_CODE.NOT_STARTED });
|
|
|
|
|
} else {
|
|
|
|
|
setEditForm({ ...props.currentRow });
|
|
|
|
|
statusList = getProjectExeStatus(props.exeStatus as PROJECT_EXE_STATUS_CODE);
|
|
|
|
|
// setEditForm({ ...props.currentRow });
|
|
|
|
|
statusList = getProjectExeStatus(projectInfo.exeStatus as PROJECT_EXE_STATUS_CODE);
|
|
|
|
|
}
|
|
|
|
|
tableFormRef.value.setOptionsFun('exeStatus', statusList);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const projectInfo = reactive<any>({});
|
|
|
|
|
|
|
|
|
|
const getNodeDetailFun = async() => {
|
|
|
|
|
if (tableFormRef.value) {
|
|
|
|
|
if (!props?.projectId ) {
|
|
|
|
|
for (const key in projectInfo) {
|
|
|
|
|
projectInfo[key] = '';
|
|
|
|
|
}
|
|
|
|
|
tableFormRef.value.setFormDataFun({ exeStatus: PROJECT_EXE_STATUS_CODE.NOT_STARTED });
|
|
|
|
|
} else {
|
|
|
|
|
const res:any = await getNodeDetailApi({ projectNodeId: props.projectId });
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
for (const key in res.data) {
|
|
|
|
|
projectInfo[key] = res.data[key];
|
|
|
|
|
}
|
|
|
|
|
console.log('123', { ...projectInfo, memberList: getMemberListStr(projectInfo.memberList) });
|
|
|
|
|
tableFormRef.value.setFormDataFun({ ...projectInfo, memberList: getMemberListStr(projectInfo.memberList) });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => props.modelValue,
|
|
|
|
|
(val: any) => {
|
|
|
|
|
async (val: any) => {
|
|
|
|
|
if (val) {
|
|
|
|
|
await getNodeDetailFun();
|
|
|
|
|
initTableForm();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|