diff --git a/package.json b/package.json index 7942d44..6e95f62 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "type": "module", "scripts": { - "dev": "set NODE_OPTIONS=--no-experimental-strip-types && vite serve --mode development", + "dev": "vite serve --mode development", "build:prod": "vite build --mode production", "build:dev": "vite build --mode development", "preview": "vite preview", diff --git a/src/api/oa/erp/projectInfo/index.ts b/src/api/oa/erp/projectInfo/index.ts index fc38532..3c68c65 100644 --- a/src/api/oa/erp/projectInfo/index.ts +++ b/src/api/oa/erp/projectInfo/index.ts @@ -86,15 +86,3 @@ export function getErpProjectInfoList(query) { params: query }); } -/** - * 根据部门id查询项目信息 - * @param query - * @returns {*} - */ -export const listProjectInfoByDept = (query?: ProjectInfoQuery): AxiosPromise => { - return request({ - url: '/oa/erp/projectInfo/listByDept', - method: 'get', - params: query - }); -}; diff --git a/src/api/oa/erp/projectInfo/types.ts b/src/api/oa/erp/projectInfo/types.ts index d1b3094..7a4c874 100644 --- a/src/api/oa/erp/projectInfo/types.ts +++ b/src/api/oa/erp/projectInfo/types.ts @@ -104,6 +104,13 @@ export interface ProjectInfoVO { */ activeFlag: string; + deptName?: string; + + managerName?: string; + + chargeName?: string; + + deputyName?: string; } export interface ProjectInfoForm extends BaseEntity { @@ -227,10 +234,16 @@ export interface ProjectInfoForm extends BaseEntity { */ bizExt?: any; + deptName?: string; + + managerName?: string; + + chargeName?: string; + + deputyName?: string; } export interface ProjectInfoQuery extends PageQuery { - /** * 有无合同(1有 2无) */ @@ -330,7 +343,12 @@ export interface ProjectInfoQuery extends PageQuery { * 日期范围参数 */ params?: any; + + deptName?: string; + + managerName?: string; + + chargeName?: string; + + deputyName?: string; } - - - diff --git a/src/api/oa/erp/projectReport/index.ts b/src/api/oa/erp/projectReport/index.ts index 6501553..d69f945 100644 --- a/src/api/oa/erp/projectReport/index.ts +++ b/src/api/oa/erp/projectReport/index.ts @@ -15,6 +15,19 @@ export const listProjectReport = (query?: ProjectReportQuery): AxiosPromise => { + return request({ + url: '/oa/erp/projectReport/listByDept', + method: 'get', + params: query + }); +}; /** * 查询项目周报信息详细 diff --git a/src/api/oa/erp/projectReport/types.ts b/src/api/oa/erp/projectReport/types.ts index 1ea48f7..bc153e2 100644 --- a/src/api/oa/erp/projectReport/types.ts +++ b/src/api/oa/erp/projectReport/types.ts @@ -1,4 +1,4 @@ -export interface ProjectReportVO { +export interface ProjectReportVO extends extraInfo { /** * 项目周报ID */ @@ -67,10 +67,9 @@ export interface ProjectReportVO { /** * 项目编码 */ - projectCode: string; } -export interface ProjectReportForm extends BaseEntity { +export interface ProjectReportForm extends BaseEntity, extraInfo { /** * 项目周报ID */ @@ -142,7 +141,7 @@ export interface ProjectReportForm extends BaseEntity { projectCode?: string; } -export interface ProjectReportQuery extends PageQuery { +export interface ProjectReportQuery extends PageQuery, extraInfo { /** * 项目ID */ @@ -208,3 +207,13 @@ export interface ProjectReportQuery extends PageQuery { */ params?: any; } + +export interface extraInfo { + deptName?: string; + + managerName?: string; + + chargeName?: string; + + deputyName?: string; +} diff --git a/src/components/ProjectSelect/index.vue b/src/components/ProjectSelect/index.vue index 0c8cf4b..8fabfe0 100644 --- a/src/components/ProjectSelect/index.vue +++ b/src/components/ProjectSelect/index.vue @@ -24,21 +24,9 @@ - - - - - - - + + + + + @@ -91,7 +79,7 @@ import { VxeTableInstance } from 'vxe-table'; import useDialog from '@/hooks/useDialog'; import { ProjectInfoVO, ProjectInfoQuery, ProjectInfoForm } from '@/api/oa/erp/projectInfo/types'; -import { listProjectInfoByDept, listProjectInfo, getProjectInfo, delProjectInfo, addProjectInfo, updateProjectInfo } from '@/api/oa/erp/projectInfo'; +import { listProjectInfo } from '@/api/oa/erp/projectInfo'; interface PropType { modelValue?: ProjectInfoVO[] | ProjectInfoVO | undefined; @@ -107,17 +95,17 @@ const prop = withDefaults(defineProps(), { const emit = defineEmits(['update:modelValue', 'confirmCallBack']); const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const { active_flag } = toRefs(proxy?.useDict('active_flag')); -const materialInfoList = ref([]); -const projectInfoList = ref([]); const loading = ref(true); const showSearch = ref(true); const total = ref(0); -const selectMaterialList = ref([]); +// 所有项目数据 +const projectInfoList = ref([]); +// 选中项目数据 +const selectProjectList = ref([]); const queryFormRef = ref(); -const tableRef = ref>(); +const tableRef = ref>(); const projectSelectDialog = useDialog({ title: '项目选择' @@ -172,50 +160,11 @@ const projectSelectData = reactive>( activeFlag: undefined, params: {} }, - rules: { - contractFlag: [{ required: true, message: '有无合同不能为空', trigger: 'change' }], - projectCode: [{ required: true, message: '项目编号不能为空', trigger: 'blur' }], - projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }], - businessDirection: [{ required: true, message: '业务方向不能为空', trigger: 'change' }], - projectCategory: [{ required: true, message: '项目类别不能为空', trigger: 'change' }] - } + rules: {} }); const { queryParams, form, rules } = toRefs(projectSelectData); -const defaultSelectMaterialIds = computed(() => computedIds(prop.data)); - -const confirm = () => { - emit('update:modelValue', selectMaterialList.value); - emit('confirmCallBack', selectMaterialList.value); - projectSelectDialog.closeDialog(); -}; - -const computedIds = (data) => { - if (data === '' || data === null || data === undefined) { - return []; - } - if (data instanceof Array) { - return data.map((item) => String(item)); - } else if (typeof data === 'string') { - return data.split(','); - } else if (typeof data === 'number') { - return [String(data)]; - } else { - console.warn(' The data type of data should be array or string or number, but I received other'); - return []; - } -}; - -/** 根据部门id查询项目信息 */ -const getList = async () => { - loading.value = true; - const res = await listProjectInfoByDept(queryParams.value); - projectInfoList.value = res.rows; - total.value = res.total; - loading.value = false; -}; - /** 搜索按钮操作 */ const handleQuery = () => { queryParams.value.pageNum = 1; @@ -229,81 +178,78 @@ const resetQuery = (refresh = true) => { refresh && handleQuery(); }; -const pageList = async () => { - await getList(); - const materials = materialInfoList.value.filter((item) => { - return selectMaterialList.value.some((material) => material.relationMaterialId === item.relationMaterialId); - }); - await tableRef.value.setCheckboxRow(materials, true); -}; - +// 处理单行选中 const handleCheckboxChange = (checked) => { + // 单选模式且用户已选中时取消已选中的 if (!prop.multiple && checked.checked) { - tableRef.value.setCheckboxRow(selectMaterialList.value, false); - selectMaterialList.value = []; + tableRef.value.setCheckboxRow(selectProjectList.value, false); + selectProjectList.value = []; } const row = checked.row; if (checked.checked) { - selectMaterialList.value.push(row); + selectProjectList.value.push(row); } else { - selectMaterialList.value = selectMaterialList.value.filter((item) => { - return item.relationMaterialId !== row.relationMaterialId; + selectProjectList.value = selectProjectList.value.filter((item) => { + return item.projectId !== row.projectId; }); } }; const handleCheckboxAll = (checked) => { - const rows = materialInfoList.value; + const rows = projectInfoList.value; if (checked.checked) { rows.forEach((row) => { - if (!selectMaterialList.value.some((item) => item.relationMaterialId === row.relationMaterialId)) { - selectMaterialList.value.push(row); + if (!selectProjectList.value.some((item) => item.projectId === row.projectId)) { + selectProjectList.value.push(row); } }); } else { - selectMaterialList.value = selectMaterialList.value.filter((item) => { - return !rows.some((row) => row.relationMaterialId === item.relationMaterialId); + selectProjectList.value = selectProjectList.value.filter((item) => { + return !rows.some((row) => row.projectId === item.projectId); }); } }; -const handleCloseTag = (material: RelationMaterialVO) => { - const relationMaterialId = material.relationMaterialId; - // 使用splice删除物料 - const index = selectMaterialList.value.findIndex((item) => item.relationMaterialId === relationMaterialId); - const rows = selectMaterialList.value[index]; - tableRef.value?.setCheckboxRow(rows, false); - selectMaterialList.value.splice(index, 1); -}; - -const initSelectMaterial = async () => { - if (defaultSelectMaterialIds.value.length > 0) { - // 从当前列表中筛选已选择的物料 - const materials = materialInfoList.value.filter((item) => { - return defaultSelectMaterialIds.value.includes(String(item.relationMaterialId)); - }); - selectMaterialList.value = materials; - await nextTick(() => { - tableRef.value.setCheckboxRow(materials, true); - }); - } +// 分页以及让表格显示选中某行 +const pageList = async () => { + await getList(); + const projectInfo = projectInfoList.value.filter((item) => { + return selectProjectList.value.some((projectInfo) => projectInfo.projectId === item.projectId); + }); + await tableRef.value.setCheckboxRow(projectInfo, true); }; const close = () => { + emit('confirmCallBack', []); projectSelectDialog.closeDialog(); }; +// 选择框确定 +const confirm = () => { + emit('update:modelValue', selectProjectList.value); + emit('confirmCallBack', selectProjectList.value); + projectSelectDialog.closeDialog(); +}; + +/** 查询项目信息 */ +const getList = async () => { + loading.value = true; + const res = await listProjectInfo(queryParams.value); + projectInfoList.value = res.rows; + total.value = res.total; + loading.value = false; +}; + watch( () => projectSelectDialog.visible.value, async (newValue: boolean) => { if (newValue) { await getList(); // 初始化列表数据 - await initSelectMaterial(); } else { tableRef.value.clearCheckboxReserve(); tableRef.value.clearCheckboxRow(); resetQuery(false); - selectMaterialList.value = []; + selectProjectList.value = []; } } ); diff --git a/src/router/index.ts b/src/router/index.ts index da5fa4f..967a39b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -102,7 +102,7 @@ export const constantRoutes: RouteRecordRaw[] = [ { path: 'contractInfo/edit', component: () => import('@/views/oa/erp/contractInfo/edit.vue'), - name: 'ContractInfoEdit', + name: 'ContractInfoEdit' }, { path: 'erpProjectPlan/edit/:projectPlanId', @@ -123,18 +123,18 @@ export const constantRoutes: RouteRecordRaw[] = [ name: 'ErpProjectPlanGantt', meta: { title: '项目计划甘特图', activeMenu: '/oa/erp/erpProjectPlan' } }, - { - path: 'erpProjectChange/edit', - component: () => import('@/views/oa/erp/erpProjectChange/edit.vue'), - name: 'ErpProjectChangeEdit', - meta: { title: '项目变更', activeMenu: '/oa/erp/erpProjectPlan' } - }, - { - path: 'erpProjectChange/edit/:projectChangeId', - component: () => import('@/views/oa/erp/erpProjectChange/edit.vue'), - name: 'ErpProjectChangeEditById', - meta: { title: '项目变更编辑', activeMenu: '/oa/erp/erpProjectPlan' } - } + { + path: 'erpProjectChange/edit', + component: () => import('@/views/oa/erp/erpProjectChange/edit.vue'), + name: 'ErpProjectChangeEdit', + meta: { title: '项目变更', activeMenu: '/oa/erp/erpProjectPlan' } + }, + { + path: 'erpProjectChange/edit/:projectChangeId', + component: () => import('@/views/oa/erp/erpProjectChange/edit.vue'), + name: 'ErpProjectChangeEditById', + meta: { title: '项目变更编辑', activeMenu: '/oa/erp/erpProjectPlan' } + } ] }, { @@ -153,7 +153,7 @@ export const constantRoutes: RouteRecordRaw[] = [ component: () => import('@/views/oa/crm/crmQuoteInfo/edit.vue'), name: 'crmQuoteInfoView', meta: { title: '报价单查看', activeMenu: '/oa/crm/crmQuoteInfo' } - }, + } ] }, { @@ -168,14 +168,11 @@ export const constantRoutes: RouteRecordRaw[] = [ meta: { title: '项目预算申请', activeMenu: '/erp/budgetInfo' } } ] - }, - + } ]; // 动态路由,基于用户权限动态去加载 -export const dynamicRoutes: RouteRecordRaw[] = [ - -]; +export const dynamicRoutes: RouteRecordRaw[] = []; /** * 创建路由 diff --git a/src/views/oa/erp/contractInfo/contract.vue b/src/views/oa/erp/contractInfo/contract.vue index c3a5260..8a32479 100644 --- a/src/views/oa/erp/contractInfo/contract.vue +++ b/src/views/oa/erp/contractInfo/contract.vue @@ -82,7 +82,7 @@ const options = ref({ // 常量赋值 const renderTemplate = (str, data) => { return str.replace(/#\{(.*?)\}/g, (_, path) => { - let arr = path.split('.'); + const arr = path.split('.'); if (arr.length > 0) { arr[0] = `#{${arr[0]}}`; } @@ -96,7 +96,7 @@ const rowRenderTemplate = (str, index) => { return templateData[`^{${path}}`][index] || ' '; }); res = res.replace(/#\{(.*?)\}/g, (_, path) => { - let arr = path.split('.'); + const arr = path.split('.'); if (arr.length > 0) { arr[0] = `#{${arr[0]}}`; } @@ -143,12 +143,12 @@ const fillRowData = (e, index) => { // 表格处理 const tableTemplate = (table) => { - let data = JSON.parse(JSON.stringify(table)); - let arr = []; + const data = JSON.parse(JSON.stringify(table)); + const arr = []; data.forEach((item) => { - let [bol, length] = hasCaretPattern(JSON.parse(JSON.stringify(item.content))); + const [bol, length] = hasCaretPattern(JSON.parse(JSON.stringify(item.content))); if (bol) { - let obj = JSON.parse(JSON.stringify(item)); + const obj = JSON.parse(JSON.stringify(item)); Array(length) .fill(0) .forEach((_, index) => { @@ -212,8 +212,8 @@ onMounted(async () => { getPrintTemplate(route.query.templateId).then((e) => { template.value = e.data; const editor = editorRef.value; - let docData = JSON.parse(e.data.templateData || '{}'); - let data = fillData(docData); + const docData = JSON.parse(e.data.templateData || '{}'); + const data = fillData(docData); // console.log(data); // console.log(JSON.parse(e.data.templateData || '{}')); // editor.setContent(JSON.parse(e.data.templateData || '{}')); diff --git a/src/views/oa/erp/projectReport/edit.vue b/src/views/oa/erp/projectReport/edit.vue new file mode 100644 index 0000000..0ae6c11 --- /dev/null +++ b/src/views/oa/erp/projectReport/edit.vue @@ -0,0 +1,851 @@ + + + diff --git a/src/views/oa/erp/projectReport/index.vue b/src/views/oa/erp/projectReport/index.vue index 73d8df4..8e6a125 100644 --- a/src/views/oa/erp/projectReport/index.vue +++ b/src/views/oa/erp/projectReport/index.vue @@ -18,31 +18,81 @@ - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -65,65 +115,49 @@ - - + + - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -131,61 +165,39 @@ - + - - - + + + - - + + - - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - - - - - - - - - - -