fNW={$Wtq9_TaKAuwY?lX;9^M^
z9AoHrd>Q_zV_hKlcdt(08kDJ5_0mx9Z*}%iDEq}ikxI8=vmScGWE(AAEpVQ5-d8$_
zRzr-Mg{#Xo2yP*!wjE{khS43tjDF)I0P6JcGBr-^H{;3`&AB3XneI|=3?dElg&K#4
z@@oLP;;HH5qHfAMnPw~}+PLal)piap<>mU~Yd^7>_pcp2IL=bhbLaesiaX?q3F9DE
z32$x9%|?8f*?U}!^%2iCcjd%Ts0CF*2j@kvR$gDs5Bqf#@rpq`DM5SaGMkm?*KP)z
zmFV*RK!tJR2ho>-@drLJo)qf$R`TI!n|BZo3?L9FDnKe65gp(eE*TXVFzrOlUeJeJWZ^FEb|o>T2dozM5Cug)e{)dT
zzA22=*G~`&UiFaRQJpo#-oI2o2B%AVluXNJDjd34|AYyVNFF*JN<5P@DLKRS^~=e%
zdkaB?zvpp!+s+@ozwx6lx@;d9nSH!lM}Di@{WOu-Wnw=EC**yN>}e(*m;USshNP5;
zQ&wz8n&88q*T#BL{ydr~?3=nYAcyaccC)Xb5MM-zmM5=-^x4s?2+#D>ANN#z9e7r@
z$uz=jdKNEp<#)jx1M_&lXhV%<&2{NOTOpof>SyA{RJ9im##_erskG&Qw(LMW3ZsOMfBuyD|)JR!E#lDBUdWqXWsxuA??9tAayA2@M&SSN~9!Jq5xWg+kgRH=xF*45GdSW${L
z?I-)}pLp!5-~L)Hlq%Q2JvTMhNHEp9q;U1l;2oHsatpX+%Pn^Z-~+NP8WFyNIxQ-`
zRcyZT7oDQqdNlF$0!aO)*|39xOHGOW4vO4zv}~ucty!}jhP$0#rkTAN#Tc=Zwx?dd<&s@D^gY>VKvhU6;VE?&ESrjtzR>9%~P6AZI~(Hm|}w+Oib|-b>Fln|^EFvHrvV(!oBLKyXn<1~~x$?&`IEQSSO~6uSqD`*wQAE)rQ;18eKn
zk;HOkP1CI?Pjvhd-U7B5#&6ef0;w&g(|(9R%#W^G^0c=_{O8#su3d~a8zo^;WN`oe
zsqn*`7*wT;73dM#7bYM;IYZru%muM!AAQu<%ybG8xWf0-RNV7!1aX{CMjfKZS_su>
zHqn_dK^#_B+8$Y2OEt2u9yD#djZD|l-#oyi=2Q%EXr=PGUxGZcp4Hz3Dlzjz<{p?_
z=#YHpVq6V
zrLVsF!6?o-lP;mrrs|UdbdlF_*mI~8KeSBmbCG0U=PC23cvB7GCkPPq%~8e>%F0b8
zH?^&rjyS0{73dPTCE0|Qj(;zzIS&JxtM*y6l6kg4-gL8r!M3d6^;j!X09(ux^sTJeG>48W|0
zoa8G82xR%6=yYd=i*>m2SgmPI+w0hFFDciw?}*kWXwnG-Mo(k;{q;<4FW3b~#AKlCsj;
zQPei>fOzljcE%heC-eoVib{@Cl}^-|q178yvPL5>TgqAfTvInHW9{h9TPdbyz(zF_
z*3XFf@L+j8m(N7&$A;q9eT?^{@Q;BGA^tXfyud;tF^@vEMaC=Z%bVW9(QBE&Ip+Nd
zz=}*{poc_{D=&FoCKR9V5`N8@xskEyh*9^^%E33MuQ?~=5SA}P(S?>=Bxk(%hoW)f
ztC}D92|j!FcPt1$k)v7)l0U%TGOdHabrFbN+RZ6X~Ls^%cd!Py>}39qn`_Z3|Ck
zNJ(D1(-U*?d0SkK%ilbvM>W!BW4#>cx&cUWqz|hLCO}j*duq)tZk!+8M=n1zQ~%{}
zoJK37eQPPWY#i}(<@D>VzHHIG06uMg#Kj>2k6K*+&g#rnR#nyJ2~`KuuhZn{MM
zEs`xV(ow!TICl!6R7%E&|CtB1S>8$TC)KjBWHX5flNn5MGT~2H5eYO+pDIjibDjbP
z`YSA8rl2#gcKqCNrwlvZ<`oQ{TVRh&%n}
zt2N-R$?oP#I`y9HTPDxUE?4g+Z9UkQQm<&C6u7Q*DYT;CH9vcGNxS|%U-Ryktc9hNuwiL
zPx4#zs|qqan=kWVydmWHo9UxgFU%Ehcqu@=ZvWNo4NWHxnf%oa3fOY;+a~10Fn%|@
zRx+%}MrvbHT32M~N>3>Q{@J)UltOGIQ~c*v0{5)>?!Y&ZJz8Ay6!)R4Bvn8+Gp63T
zA|MJF+0pvfncGO0Te`zOOhp>x64Yt#hl5@Y!TTS1^5Fs+Y(=a8G%
zK%qKxU`$?YV6=?aqrM<(+d=os0^bvOcKUHf~*cOaH3XAB1J&=JS
LaH@HMf875A5y46x
diff --git a/src/api/materials/batchPlan/index.ts b/src/api/materials/batchPlan/index.ts
index c9231af..5b9690b 100644
--- a/src/api/materials/batchPlan/index.ts
+++ b/src/api/materials/batchPlan/index.ts
@@ -160,3 +160,13 @@ export const obtainTheVersion = (query: any) => {
params: query
});
};
+/**
+ * 获取到物资剩余量
+ */
+export const mrpBaseRemaining = (query: any) => {
+ return request({
+ url: '/cailiaoshebei/mrpBase/remaining',
+ method: 'get',
+ params: query
+ });
+};
diff --git a/src/views/design/Professional/index.vue b/src/views/design/Professional/index.vue
index 017ce41..27952ed 100644
--- a/src/views/design/Professional/index.vue
+++ b/src/views/design/Professional/index.vue
@@ -38,7 +38,14 @@
审核
- 导出导出
-
{{ scope.row.fileName }}
-
+ -->
+ {{ scope.row.fileName }}
diff --git a/src/views/design/Professional/indexEdit.vue b/src/views/design/Professional/indexEdit.vue
index fae1a5e..ffa705e 100644
--- a/src/views/design/Professional/indexEdit.vue
+++ b/src/views/design/Professional/indexEdit.vue
@@ -445,7 +445,9 @@ const getMajor = async () => {
let res = await extractUserMajor({ userId: userId.value, projectId: currentProject.value?.id });
if (res.code == 200) {
des_user_major.value = res.data;
- console.log(des_user_major.value);
+ if (res.data.length > 0) {
+ form.user_major = res.data[0].userMajor;
+ }
}
};
/** 回显表单数据(编辑/查看/审批场景) */
diff --git a/src/views/design/received/index.vue b/src/views/design/received/index.vue
index e6fa601..b28478f 100644
--- a/src/views/design/received/index.vue
+++ b/src/views/design/received/index.vue
@@ -434,7 +434,7 @@ const onLoad = async () => {
return;
}
try {
- proxy?.download('design/collect/exportWord', { id: form.id }, `收资清单_${new Date().getTime()}.zip`);
+ proxy?.download('design/collect/exportWord', { id: form.id }, `收资清单_${new Date().getTime()}.doc`);
} catch (error) {
ElMessage.error('导出失败,请重试');
console.error('文件导出错误:', error);
diff --git a/src/views/materials/batchPlan/index.vue b/src/views/materials/batchPlan/index.vue
index 8d8bdb1..115763f 100644
--- a/src/views/materials/batchPlan/index.vue
+++ b/src/views/materials/batchPlan/index.vue
@@ -6,8 +6,8 @@
-
+ 新增
-
+
+
+ 删除
+ >
+
@@ -75,14 +75,11 @@
>审核
-
-
-
@@ -103,7 +100,7 @@
-
+
基础信息
@@ -125,63 +122,91 @@
主要信息
-
-
+
+
+
+
- selectNameVersion(val, scope.row)">
+ selectNameVersion(val, scope.row, scope.$index)">
-
+
+
selectName(val, scope.row)"
+ @change="(val) => selectName(val, scope.row, scope.$index)"
>
-
+
+
-
+ {{ scope.row.Remaining }}
+
-
+
+
-
+ {{ scope.row.specification }}
+
-
+
+
-
+ {{ scope.row.unit }}
+
-
- * 质量标准
+
+
+
+
+
+ {{ scope.row.quantityError }}
+
+
+
+
+ * 质量标准
-
- * 需求到货时间
-
+
+
+ * 需求到货时间
-
+
+
+
-
-
+
+
@@ -206,10 +231,47 @@ import {
listSelectCailiaoshebei,
obtainTheVersion,
getDictList,
- coryEngineeringList
+ coryEngineeringList,
+ mrpBaseRemaining
} from '@/api/materials/batchPlan';
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/batchPlan/types';
import { useUserStoreHook } from '@/store/modules/user';
+import { getCurrentInstance, ComponentInternalInstance, watch, onMounted, onUnmounted } from 'vue';
+import type { ElFormInstance } from 'element-plus';
+
+// 类型定义补充
+interface DialogOption {
+ visible: boolean;
+ title: string;
+}
+
+interface PlanListItem {
+ id?: number | undefined;
+ name?: string | undefined;
+ specification?: string | undefined;
+ unit?: string | undefined;
+ suppliespriceId?: number | undefined;
+ demandQuantity?: number | undefined;
+ qs?: string | undefined;
+ arrivalTime?: string | undefined;
+ remark?: string | undefined;
+ Remaining: number; // 剩余量(必存在)
+ quantityError: string; // 数量错误提示
+ versions?: string | undefined; // 版本号
+ duplicateError: string; // 重复错误提示
+}
+
+interface FormData {
+ mrpBaseBo: {
+ id?: number | undefined;
+ preparedDate?: string | undefined;
+ planCode?: string | undefined;
+ matCat?: string | undefined;
+ status?: string | undefined;
+ projectId?: number | undefined;
+ };
+ planList: PlanListItem[];
+}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 获取用户 store
@@ -227,17 +289,17 @@ const multiple = ref(true);
const total = ref(0);
const mainTotal = ref(0);
const batchOptions = ref([]);
-const { wf_business_status } = toRefs(proxy?.useDict('wf_business_status'));
+const { wf_business_status } = toRefs(proxy?.useDict('wf_business_status') || {});
const route = useRoute();
const queryFormRef = ref();
const cailiaoshebeiFormRef = ref();
-
const dialog = reactive({
visible: false,
title: ''
});
-const initFormData: any = {
+// 初始化表单数据(补充版本号、重复错误提示字段)
+const initFormData: FormData = {
mrpBaseBo: {
id: undefined,
preparedDate: undefined,
@@ -246,7 +308,6 @@ const initFormData: any = {
status: undefined,
projectId: currentProject.value?.id
},
-
planList: [
{
id: undefined,
@@ -257,18 +318,22 @@ const initFormData: any = {
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
- remark: undefined
+ remark: undefined,
+ Remaining: 0, // 初始化剩余量
+ quantityError: '', // 初始化数量错误提示
+ versions: undefined, // 初始化版本号
+ duplicateError: '' // 初始化重复错误提示
}
]
};
+
const data = reactive({
- form: { ...initFormData },
+ form: { ...initFormData } as FormData,
queryParams: {
batchData: {
pageNum: 1,
pageSize: 10,
planCode: undefined,
-
projectId: currentProject.value?.id
},
mainData: {
@@ -285,77 +350,184 @@ const data = reactive({
'mrpBaseBo.matCat': [{ required: true, message: '物资分类不能为空', trigger: 'blur' }]
}
});
+
const batchNumber = ref('');
const { queryParams, form, rules } = toRefs(data);
-const nameList = ref([]);
-const versionList = ref([]);
+const nameList = ref([]);
+const versionList = ref([]);
+
/** 查询物资-材料设备列表 */
const getList = async (type?: string) => {
loading.value = true;
- const res = await listBatch(queryParams.value.batchData);
- batchOptions.value = res.rows;
- if (res.rows && res.rows.length > 0 && !queryParams.value.mainData.mrpBaseId) {
- batchTreeRef.value.setCurrentKey(res.rows[0].id);
- queryParams.value.mainData.mrpBaseId = res.rows[0].id;
- form.value.mrpBaseBo.status = res.rows[0].status;
+ try {
+ const res = await listBatch(queryParams.value.batchData);
+ batchOptions.value = res.rows || [];
+ // 自动选中第一条数据(如果存在且未选中)
+ if (batchOptions.value.length > 0 && !queryParams.value.mainData.mrpBaseId) {
+ batchTreeRef.value?.setCurrentKey(batchOptions.value[0].id);
+ queryParams.value.mainData.mrpBaseId = batchOptions.value[0].id;
+ form.value.mrpBaseBo.status = batchOptions.value[0].status;
+ }
+ total.value = res.total || 0;
+ } catch (error) {
+ proxy?.$modal.msgError('获取批次列表失败');
+ } finally {
+ loading.value = false;
+ // 非搜索场景下同步加载主列表
+ if (type !== 'search') {
+ getMainList();
+ }
}
- total.value = res.total;
- loading.value = false;
- if (type === 'search') return;
- getMainList();
};
-const selectName = (val: any, row: any) => {
- const selected = nameList.value.find((item) => item.id === val);
- if (selected) {
- row.name = selected.name;
- row.specification = selected.specification;
- row.unit = selected.unit;
- row.qs = selected.qs;
- row.demandQuantity = selected.quantity;
- row.remark = selected.remark;
- row.arrivalTime = selected.arrivalTime;
+/** 数量校验:必须≤剩余量,且为合法数字 */
+const validateDemandQuantity = (row: PlanListItem, index: number) => {
+ // 1. 清除之前的错误信息
+ row.quantityError = '';
+
+ // 2. 处理空值(若需必填可补充:row.quantityError = '数量不能为空')
+ if (row.demandQuantity === null || row.demandQuantity === undefined || row.demandQuantity === '') {
+ return;
}
+
+ // 3. 处理非数字
+ if (typeof row.demandQuantity !== 'number' || isNaN(row.demandQuantity)) {
+ row.quantityError = '请输入合法数字';
+ return;
+ }
+
+ // 4. 处理负数
+ if (row.demandQuantity < 0) {
+ row.quantityError = '数量不能为负数';
+ return;
+ }
+
+ // 5. 核心校验:数量≤剩余量
+ if (row.demandQuantity > row.Remaining) {
+ row.quantityError = `数量不能超过剩余量${row.Remaining}`;
+ }
+};
+
+/** 获取剩余量 */
+const getMrpBaseRemaining = async (suppliespriceId: number, row: PlanListItem) => {
+ try {
+ const res = await mrpBaseRemaining({ suppliespriceId });
+ row.Remaining = res.data || 0;
+ // 剩余量更新后,重新校验当前数量
+ validateDemandQuantity(row, 0);
+ } catch (error) {
+ proxy?.$modal.msgError('获取剩余量失败');
+ row.Remaining = 0;
+ }
+};
+
+/** 校验重复数据:版本号+物资名称不能重复 */
+const checkDuplicate = () => {
+ const planList = form.value.planList;
+ let hasDuplicate = false;
+
+ // 1. 清除所有重复错误提示
+ planList.forEach((item) => {
+ item.duplicateError = '';
+ });
+
+ // 2. 遍历校验重复(只校验版本号和物资名称都存在的行)
+ for (let i = 0; i < planList.length; i++) {
+ const current = planList[i];
+ // 跳过版本号或物资名称为空的行
+ if (!current.versions || !current.suppliespriceId) continue;
+
+ for (let j = i + 1; j < planList.length; j++) {
+ const compare = planList[j];
+ if (!compare.versions || !compare.suppliespriceId) continue;
+
+ // 版本号和物资ID都相同则判定为重复
+ if (current.versions === compare.versions && current.suppliespriceId === compare.suppliespriceId) {
+ current.duplicateError = `与第${j + 1}行重复(同版本+同物资)`;
+ compare.duplicateError = `与第${i + 1}行重复(同版本+同物资)`;
+ hasDuplicate = true;
+ }
+ }
+ }
+
+ return hasDuplicate;
+};
+
+/** 选择物资名称触发(新增索引参数,用于触发重复校验) */
+const selectName = (val: number, row: PlanListItem, index: number) => {
+ // 1. 获取剩余量并更新基础信息
+ getMrpBaseRemaining(val, row).then(() => {
+ const selected = nameList.value.find((item: any) => item.id === val);
+ if (selected) {
+ row.name = selected.name;
+ row.specification = selected.specification;
+ row.unit = selected.unit;
+ row.qs = selected.qs || '';
+ row.remark = selected.remark || '';
+ row.arrivalTime = selected.arrivalTime || '';
+ }
+
+ // 2. 触发重复校验
+ checkDuplicate();
+ });
};
/** 节点单击事件 */
const handleNodeClick = (data: any) => {
queryParams.value.mainData.mrpBaseId = data.id;
form.value.mrpBaseBo.status = data.status;
-
getMainList();
};
+/** 获取主列表数据 */
const getMainList = async () => {
if (!queryParams.value.mainData.mrpBaseId) return;
- const res = await getBatch(queryParams.value.mainData);
- cailiaoshebeiList.value = res.rows;
- mainTotal.value = res.total;
+ loading.value = true;
+ try {
+ const res = await getBatch(queryParams.value.mainData);
+ cailiaoshebeiList.value = res.rows || [];
+ mainTotal.value = res.total || 0;
+ } catch (error) {
+ proxy?.$modal.msgError('获取物资列表失败');
+ } finally {
+ loading.value = false;
+ }
};
+/** 搜索批次列表 */
const searchBatchList = async () => {
queryParams.value.batchData.planCode = batchNumber.value;
getList('search');
};
-//删除
+/** 删除表格行 */
const delRow = (index: number) => {
- if (form.value.planList.length <= 1) return proxy?.$modal.msgWarning('请至少保留一项');
+ if (form.value.planList.length <= 1) {
+ return proxy?.$modal.msgWarning('请至少保留一项物资数据');
+ }
form.value.planList.splice(index, 1);
+ // 删除后重新校验重复(避免删除重复行后错误提示残留)
+ checkDuplicate();
};
-//新增
+/** 新增表格行 */
const addRow = () => {
- form.value.planList.push({
+ const newRow: PlanListItem = {
name: undefined,
specification: undefined,
unit: undefined,
+ suppliespriceId: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
- remark: undefined
- });
+ remark: undefined,
+ Remaining: 0,
+ quantityError: '',
+ versions: undefined,
+ duplicateError: ''
+ };
+ form.value.planList.push(newRow);
};
/** 取消按钮 */
@@ -367,41 +539,22 @@ const cancel = () => {
/** 表单重置 */
const reset = () => {
const status = form.value.mrpBaseBo.status;
- form.value = { ...initFormData, status }; // 重置但保留
+ // 重置表单(保留状态字段)
+ form.value = {
+ ...JSON.parse(JSON.stringify(initFormData)),
+ mrpBaseBo: { ...initFormData.mrpBaseBo, status }
+ };
+ // 重置表单验证状态
cailiaoshebeiFormRef.value?.resetFields();
+ // 重置项目ID
form.value.mrpBaseBo.projectId = currentProject.value?.id;
- form.value.planList = [
- {
- name: undefined,
- specification: undefined,
- unit: undefined,
- suppliespriceId: undefined,
-
- demandQuantity: undefined,
- qs: undefined,
- arrivalTime: undefined,
- remark: undefined
- }
- ];
};
-// /** 搜索按钮操作 */
-// const handleQuery = () => {
-// queryParams.value.pageNum = 1;
-// getList();
-// };
-
-// /** 重置按钮操作 */
-// const resetQuery = () => {
-// queryFormRef.value?.resetFields();
-// handleQuery();
-// };
-
/** 多选框选中数据 */
const handleSelectionChange = (selection: CailiaoshebeiVO[]) => {
ids.value = selection.map((item) => item.id);
- single.value = selection.length != 1;
- multiple.value = !selection.length;
+ single.value = selection.length !== 1;
+ multiple.value = selection.length === 0;
};
/** 新增按钮操作 */
@@ -411,93 +564,154 @@ const handleAdd = () => {
dialog.title = '新增物资-需求';
};
+/** 修改按钮操作 */
const handleUpdata = () => {
- reset();
- getCailiaoshebei(queryParams.value.mainData.mrpBaseId).then((res: any) => {
- form.value.mrpBaseBo = res.data.mrpBaseBo;
- const allowedKeys = Object.keys(initFormData.planList[0]);
- form.value.planList = res.data.planList.map((item) => {
- return allowedKeys.reduce((obj, key) => {
- obj[key] = item[key] ?? undefined;
- return obj;
- }, {});
- });
-
- console.log(form.value.planList);
- });
- dialog.visible = true;
- dialog.title = '修改物资-需求';
-};
-
-/** 提交数据 */
-const submitTransferForm = async () => {
- const result = validateAndClean(form.value.planList);
- if (!result.valid) {
- proxy?.$modal.msgError(result.message);
- return;
+ if (!queryParams.value.mainData.mrpBaseId) {
+ return proxy?.$modal.msgError('请先选择批次');
}
+ reset();
+ loading.value = true;
+ getCailiaoshebei(queryParams.value.mainData.mrpBaseId)
+ .then((res: any) => {
+ // 1. 更新基础信息
+ form.value.mrpBaseBo = res.data.mrpBaseBo || initFormData.mrpBaseBo;
+ // 2. 更新表格数据(补充缺失字段)
+ form.value.planList = (res.data.planList || []).map((item: any) => ({
+ id: item.id,
+ name: item.name,
+ specification: item.specification,
+ unit: item.unit,
+ suppliespriceId: item.suppliespriceId,
+ demandQuantity: item.demandQuantity,
+ qs: item.qs,
+ arrivalTime: item.arrivalTime,
+ remark: item.remark,
+ Remaining: item.Remaining || 0,
+ quantityError: '',
+ versions: item.versions,
+ duplicateError: ''
+ }));
+ // 3. 打开对话框
+ dialog.visible = true;
+ dialog.title = '修改物资-需求';
+ })
+ .catch(() => {
+ proxy?.$modal.msgError('获取详情失败');
+ })
+ .finally(() => {
+ loading.value = false;
+ });
+};
+
+/** 提交数据(整合所有校验) */
+const submitTransferForm = async () => {
+ // 1. 先校验重复数据
+ const hasDuplicate = checkDuplicate();
+ if (hasDuplicate) {
+ return proxy?.$modal.msgError('存在重复的版本号+物资组合,请修正后提交');
+ }
+
+ // 2. 校验数量合法性(检查是否有数量错误)
+ const hasQuantityError = form.value.planList.some((row) => row.quantityError);
+ if (hasQuantityError) {
+ return proxy?.$modal.msgError('存在非法数量,请修正后提交');
+ }
+
+ // 3. 执行表单基础验证
+ const result = validateAndClean(form.value.planList);
+ if (!result.valid) {
+ return proxy?.$modal.msgError(result.message);
+ }
+
+ // 4. 表单组件验证
cailiaoshebeiFormRef.value?.validate(async (valid: boolean) => {
- if (valid) {
- buttonLoading.value = true;
- form.value.planList = result.data;
- await updateCailiaoshebei(form.value).finally(() => (buttonLoading.value = false));
+ if (!valid) return;
+
+ buttonLoading.value = true;
+ try {
+ // 5. 提交数据
+ await updateCailiaoshebei({
+ ...form.value,
+ planList: result.data // 使用清洗后的数据
+ });
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
+ // 6. 刷新列表
await getList();
+ } catch (error) {
+ proxy?.$modal.msgError('操作失败,请重试');
+ } finally {
+ buttonLoading.value = false;
}
});
};
+
/** 删除批次 */
const handleDeleteBatch = async () => {
- const _ids = batchTreeRef.value.getCurrentNode()?.id;
- await proxy?.$modal.confirm('是否确认删除批次编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
- await delBatch(_ids);
- proxy?.$modal.msgSuccess('删除成功');
- queryParams.value.mainData.mrpBaseId = undefined;
- await getList();
+ const _id = batchTreeRef.value?.getCurrentNode()?.id;
+ if (!_id) {
+ return proxy?.$modal.msgError('请先选择批次');
+ }
+
+ try {
+ await proxy?.$modal.confirm('是否确认删除该批次?删除后不可恢复!');
+ await delBatch(_id);
+ proxy?.$modal.msgSuccess('删除成功');
+ // 重置选中状态并刷新列表
+ queryParams.value.mainData.mrpBaseId = undefined;
+ form.value.mrpBaseBo.status = undefined;
+ await getList();
+ } catch (error) {
+ // 取消确认时不提示错误
+ if (error !== 'cancel') {
+ proxy?.$modal.msgError('删除失败');
+ }
+ }
};
-interface ValidateResult {
- valid: boolean;
- data: any[];
- errors: { index: number; field: string; message: string }[];
-}
+/** 数据清洗与基础校验 */
+function validateAndClean(arr: PlanListItem[]) {
+ // 1. 过滤掉全空的数据项
+ const cleanedArr = arr.filter((item) => !Object.values(item).every((v) => v === '' || v == null || v === undefined));
-function validateAndClean(arr: any[]) {
- // 过滤掉全空的数据项
- const cleanedArr = arr.filter((item) => !Object.values(item).every((v) => v === '' || v == null));
-
- let hasFullItem = false; // 是否有至少一条全填数据
+ let hasFullItem = false; // 是否有至少一条完整数据
+ // 2. 逐行校验必填项
for (let idx = 0; idx < cleanedArr.length; idx++) {
const item = cleanedArr[idx];
- const keys = Object.keys(item).filter((k) => k !== 'remark' && k !== 'id');
- const allFilled = keys.every((k) => item[k] !== '' && item[k] != null);
- const allEmpty = Object.values(item).every((v) => v === '' || v == null);
+ // 校验版本号
+ if (!item.versions) {
+ return { valid: false, message: `第${idx + 1}行:版本号不能为空`, data: cleanedArr };
+ }
- // 单独检查 qs 和 arrivalTime
+ // 校验物资选择
+ if (!item.suppliespriceId) {
+ return { valid: false, message: `第${idx + 1}行:请选择物资名称`, data: cleanedArr };
+ }
+
+ // 校验质量标准
if (!item.qs) {
return { valid: false, message: `第${idx + 1}行:质量标准不能为空`, data: cleanedArr };
}
+
+ // 校验需求到货时间
if (!item.arrivalTime) {
return { valid: false, message: `第${idx + 1}行:需求到货时间不能为空`, data: cleanedArr };
}
- // 检查其他字段是否部分填
- if (!allFilled && !allEmpty) {
- return { valid: false, message: `第${idx + 1}行:主要信息存在部分字段缺失的数据项`, data: cleanedArr };
+ // 校验数量(必填且≥0)
+ if (item.demandQuantity === null || item.demandQuantity === undefined || item.demandQuantity < 0) {
+ return { valid: false, message: `第${idx + 1}行:请输入合法的需求数量`, data: cleanedArr };
}
- if (allFilled) {
- hasFullItem = true;
- }
+ hasFullItem = true;
}
- // 检查是否至少有一条完整的数据
+ // 3. 检查是否至少有一条完整数据
if (!hasFullItem) {
- return { valid: false, message: '至少需要一条完整的数据', data: cleanedArr };
+ return { valid: false, message: '至少需要填写一条完整的物资数据', data: cleanedArr };
}
return { valid: true, message: '', data: cleanedArr };
@@ -506,54 +720,95 @@ function validateAndClean(arr: any[]) {
/** 审核按钮操作 */
const handleAudit = async () => {
if (!form.value.mrpBaseBo.status) {
- proxy?.$modal.msgError('请选择批次号');
- return;
+ return proxy?.$modal.msgError('请选择批次号');
}
+ if (!queryParams.value.mainData.mrpBaseId) {
+ return proxy?.$modal.msgError('请选择批次号');
+ }
+
+ // 关闭当前页并打开审核页
proxy?.$tab.closePage(route);
proxy?.$tab.openPage('/approval/batchPlan/indexEdit', '审核物资设备批次需求计划', {
id: queryParams.value.mainData.mrpBaseId,
- status: form.value.mrpBaseBo.status + '_batchRequirements',
+ status: `${form.value.mrpBaseBo.status}_batchRequirements`,
type: 'update'
});
};
-const getNameList = (versions) => {
- coryEngineeringList({ projectId: currentProject.value?.id, versions }).then((res) => {
- nameList.value = res.data;
- });
-};
-// 获取版本号
-const getVersion = () => {
- obtainTheVersion({ projectId: currentProject.value?.id }).then((res) => {
- versionList.value = res.data;
- });
-};
-const selectNameVersion = (val, row) => {
- row.suppliespriceId = undefined;
- getNameList(val);
+/** 获取物资列表(按版本号筛选) */
+const getNameList = (versions: string) => {
+ coryEngineeringList({
+ projectId: currentProject.value?.id,
+ versions
+ })
+ .then((res: any) => {
+ nameList.value = res.data || [];
+ })
+ .catch(() => {
+ nameList.value = [];
+ proxy?.$modal.msgError('获取物资列表失败');
+ });
};
+/** 获取版本号列表 */
+const getVersion = () => {
+ obtainTheVersion({ projectId: currentProject.value?.id })
+ .then((res: any) => {
+ versionList.value = res.data || [];
+ })
+ .catch(() => {
+ versionList.value = [];
+ proxy?.$modal.msgError('获取版本号失败');
+ });
+};
+
+/** 选择版本号触发(新增索引参数,用于触发重复校验) */
+const selectNameVersion = (val: string, row: PlanListItem, index: number) => {
+ row.versions = val;
+ row.suppliespriceId = undefined; // 切换版本号时清空物资选择
+ row.name = undefined;
+ row.specification = undefined;
+ row.unit = undefined;
+ row.qs = undefined;
+ row.remark = undefined;
+ row.arrivalTime = undefined;
+ row.demandQuantity = undefined;
+ row.quantityError = '';
+ row.duplicateError = '';
+
+ // 1. 获取对应版本的物资列表
+ getNameList(val);
+
+ // 2. 触发重复校验(清空物资后可能消除重复)
+ checkDuplicate();
+};
+
+/** 页面挂载时初始化 */
onMounted(() => {
getList();
- // getNameList();
getVersion();
});
-//监听项目id刷新数据
+/** 监听项目ID变化,刷新数据 */
const listeningProject = watch(
() => currentProject.value?.id,
- (nid, oid) => {
- queryParams.value.mainData.projectId = nid;
- queryParams.value.batchData.projectId = nid;
- form.value.mrpBaseBo.projectId = nid;
- getList();
+ (newId, oldId) => {
+ if (newId !== oldId && newId) {
+ queryParams.value.mainData.projectId = newId;
+ queryParams.value.batchData.projectId = newId;
+ form.value.mrpBaseBo.projectId = newId;
+ getList();
+ getVersion(); // 重新获取对应项目的版本号
+ }
}
);
+/** 页面卸载时清理监听 */
onUnmounted(() => {
listeningProject();
});
+
diff --git a/src/views/materials/materialsEquipment/materialIssue/index.vue b/src/views/materials/materialsEquipment/materialIssue/index.vue
index ec1364d..88837ff 100644
--- a/src/views/materials/materialsEquipment/materialIssue/index.vue
+++ b/src/views/materials/materialsEquipment/materialIssue/index.vue
@@ -156,18 +156,38 @@
-
+
-
+
@@ -176,7 +196,7 @@
:prop="`itemList.${index}.remainingQuantity`"
:rules="[{ required: true, message: '剩余数量不能为空', trigger: 'blur' }]"
>
-
+
@@ -248,6 +268,9 @@ import {
import { MaterialIssueVO, MaterialIssueQuery, MaterialIssueForm } from '@/api/materials/materialIssue/types';
import { useUserStoreHook } from '@/store/modules/user';
import wordllssue from './word/index.vue';
+import { watch, onMounted, onUnmounted, ref, reactive, computed, getCurrentInstance } from 'vue';
+import type { ComponentInternalInstance, ElFormInstance, DialogOption } from 'element-plus';
+
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
// 获取用户 store
const userStore = useUserStoreHook();
@@ -265,6 +288,8 @@ const total = ref(0);
const wordllssueRef = ref>();
const queryFormRef = ref();
const materialIssueFormRef = ref();
+// 存储每个条目的watch停止函数
+const itemWatchStopFns = ref void>>([]);
const dialog = reactive({
visible: false,
@@ -303,12 +328,14 @@ const getInitFormData = () => {
issuedQuantity: undefined,
remainingQuantity: undefined,
name: undefined,
- remark: undefined
+ remark: undefined,
+ materialsId: undefined
}
]
};
};
-const data = reactive>({
+
+const data = reactive({
form: getInitFormData(),
queryParams: {
pageNum: 1,
@@ -326,7 +353,13 @@ const data = reactive>({
params: {}
},
rules: {
- id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
+ formCode: [{ required: true, message: '请输入表单编号', trigger: 'blur' }],
+ projectName: [{ required: true, message: '请输入工程名称', trigger: 'blur' }],
+ materialName: [{ required: true, message: '请输入设备材料名称', trigger: 'blur' }],
+ orderingUnit: [{ required: true, message: '请输入订货单位', trigger: 'blur' }],
+ supplierUnit: [{ required: true, message: '请输入供货单位', trigger: 'blur' }],
+ issueUnit: [{ required: true, message: '请输入领料单位', trigger: 'blur' }],
+ storageUnit: [{ required: true, message: '请输入保管单位', trigger: 'blur' }]
}
});
@@ -335,34 +368,94 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询物料领料单列表 */
const getList = async () => {
loading.value = true;
- const res = await listMaterialIssue(queryParams.value);
- materialIssueList.value = res.rows;
- total.value = res.total;
- loading.value = false;
-};
-const optionsName: any = ref([]);
-
-//获取一起名称
-const getName = async () => {
- const res = await getMaterialName(currentProject.value.id);
- console.log(res);
- if (res.code == 200) {
- optionsName.value = res.data;
+ try {
+ const res = await listMaterialIssue(queryParams.value);
+ materialIssueList.value = res.rows;
+ total.value = res.total;
+ } finally {
+ loading.value = false;
}
};
+const optionsName: any = ref([]);
+
+// 获取材料名称列表
+const getName = async () => {
+ try {
+ const res = await getMaterialName(currentProject.value.id);
+ if (res.code == 200) {
+ optionsName.value = res.data;
+ }
+ } catch (error) {
+ proxy?.$modal.msgError('获取材料名称失败');
+ }
+};
+
+// 材料名称选择变化处理
const getNameChange = (value, index, item) => {
- // 这里可以添加处理逻辑
- console.log(value);
-
const data = optionsName.value.find((item) => item.id == value);
- console.log(data);
+ if (data) {
+ form.value.itemList[index].name = data.materialsName;
+ form.value.itemList[index].materialsId = data.id;
+ form.value.itemList[index].specification = data.typeSpecificationName;
+ form.value.itemList[index].unit = data.weightId;
+ form.value.itemList[index].stockQuantity = data.inventoryNumber;
+ // 触发剩余数量计算
+ calculateRemaining(index);
+ }
+};
- form.value.itemList[index].name = data.materialsName;
- form.value.itemList[index].materialsId = data.id;
- form.value.itemList[index].specification = data.typeSpecificationName;
- form.value.itemList[index].unit = data.weightId;
- form.value.itemList[index].stockQuantity = data.inventoryNumber;
+/** 验证领取数量不能超过库存 */
+const validateIssuedQuantity = (rule, value, callback, index) => {
+ const item = form.value.itemList[index];
+ const stock = Number(item.stockQuantity) || 0;
+ const issued = Number(value) || 0;
+
+ if (stock === 0) {
+ callback();
+ return;
+ }
+
+ if (issued > stock) {
+ callback(new Error(`领取数量不能超过库存(${stock})`));
+ } else {
+ callback();
+ }
+};
+
+/** 计算剩余数量(库存 - 领取数量) */
+const calculateRemaining = (index: number) => {
+ const item = form.value.itemList[index];
+ const stock = Number(item.stockQuantity) || 0;
+ const issued = Number(item.issuedQuantity) || 0;
+
+ // 确保领取数量不超过库存
+ if (issued > stock) {
+ item.issuedQuantity = stock;
+ proxy?.$modal.msgWarning(`领取数量不能超过库存(${stock}),已自动调整`);
+ }
+
+ // 计算剩余数量
+ item.remainingQuantity = stock - (item.issuedQuantity || 0);
+};
+
+/** 库存变化时重新计算剩余数量 */
+const handleStockChange = (index: number) => {
+ calculateRemaining(index);
+ // 触发验证
+ if (materialIssueFormRef.value) {
+ materialIssueFormRef.value.validateField(`itemList.${index}.issuedQuantity`);
+ materialIssueFormRef.value.validateField(`itemList.${index}.remainingQuantity`);
+ }
+};
+
+/** 领取数量变化时重新计算剩余数量 */
+const handleIssuedChange = (index: number) => {
+ calculateRemaining(index);
+ // 触发验证
+ if (materialIssueFormRef.value) {
+ materialIssueFormRef.value.validateField(`itemList.${index}.remainingQuantity`);
+ }
};
/** 取消按钮 */
@@ -373,8 +466,36 @@ const cancel = () => {
/** 表单重置 */
const reset = () => {
+ // 停止所有监听
+ itemWatchStopFns.value.forEach((stop) => stop());
+ itemWatchStopFns.value = [];
+
form.value = getInitFormData();
materialIssueFormRef.value?.resetFields();
+
+ // 重新监听初始条目
+ if (form.value.itemList.length > 0) {
+ watchItemChanges(0);
+ }
+};
+
+/** 监听条目变化,自动计算剩余数量 */
+const watchItemChanges = (index: number) => {
+ // 停止已有监听
+ if (itemWatchStopFns.value[index]) {
+ itemWatchStopFns.value[index]();
+ }
+
+ // 监听库存和领取数量变化
+ const stop = watch(
+ () => [form.value.itemList[index].stockQuantity, form.value.itemList[index].issuedQuantity],
+ () => {
+ calculateRemaining(index);
+ },
+ { immediate: true }
+ );
+
+ itemWatchStopFns.value[index] = stop;
};
/** 搜索按钮操作 */
@@ -407,10 +528,42 @@ const handleAdd = () => {
const handleUpdate = async (row?: MaterialIssueVO) => {
reset();
const _id = row?.id || ids.value[0];
- const res = await getMaterialIssue(_id);
- Object.assign(form.value, res.data);
- dialog.visible = true;
- dialog.title = '修改物料领料单';
+ try {
+ const res = await getMaterialIssue(_id);
+ Object.assign(form.value, res.data);
+
+ // 确保itemList存在
+ if (!form.value.itemList) {
+ form.value.itemList = [];
+ }
+
+ // 转换数据类型并计算剩余数量(关键修复)
+ form.value.itemList = form.value.itemList.map((item) => ({
+ ...item,
+ stockQuantity: Number(item.stockQuantity) || 0,
+ issuedQuantity: Number(item.issuedQuantity) || 0,
+ remainingQuantity: Number(item.remainingQuantity) || 0
+ }));
+
+ // 为每个条目添加监听并强制计算剩余数量
+ form.value.itemList.forEach((_, index) => {
+ watchItemChanges(index);
+ calculateRemaining(index); // 强制计算确保数据一致性
+ });
+ // 手动触发一次验证(关键修复)
+ setTimeout(() => {
+ if (materialIssueFormRef.value) {
+ form.value.itemList.forEach((_, index) => {
+ materialIssueFormRef.value.validateField(`itemList.${index}.issuedQuantity`);
+ materialIssueFormRef.value.validateField(`itemList.${index}.remainingQuantity`);
+ });
+ }
+ }, 0);
+ dialog.visible = true;
+ dialog.title = '修改物料领料单';
+ } catch (error) {
+ proxy?.$modal.msgError('获取详情失败');
+ }
};
/** 提交按钮 */
@@ -418,21 +571,38 @@ const submitForm = () => {
materialIssueFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
- if (form.value.id) {
- await updateMaterialIssue(form.value).finally(() => (buttonLoading.value = false));
- } else {
- await addMaterialIssue(form.value).finally(() => (buttonLoading.value = false));
+ try {
+ // 处理提交数据,确保数量为数字类型
+ const submitData = {
+ ...form.value,
+ itemList: form.value.itemList.map((item) => ({
+ ...item,
+ stockQuantity: Number(item.stockQuantity),
+ issuedQuantity: Number(item.issuedQuantity),
+ remainingQuantity: Number(item.remainingQuantity)
+ }))
+ };
+
+ if (form.value.id) {
+ await updateMaterialIssue(submitData);
+ } else {
+ await addMaterialIssue(submitData);
+ }
+ proxy?.$modal.msgSuccess('操作成功');
+ dialog.visible = false;
+ await getList();
+ } catch (error) {
+ proxy?.$modal.msgError('操作失败');
+ } finally {
+ buttonLoading.value = false;
}
- proxy?.$modal.msgSuccess('操作成功');
- dialog.visible = false;
- await getList();
}
});
};
// 添加数量验收条目
const addItem = () => {
- form.value.itemList.push({
+ const newItem = {
id: undefined,
specification: undefined,
unit: undefined,
@@ -440,46 +610,68 @@ const addItem = () => {
issuedQuantity: undefined,
remainingQuantity: undefined,
name: undefined,
- remark: undefined
- });
+ remark: undefined,
+ materialsId: undefined
+ };
+ form.value.itemList.push(newItem);
+ // 监听新条目
+ watchItemChanges(form.value.itemList.length - 1);
};
// 删除数量验收条目
const removeItem = (index: number) => {
if (form.value.itemList.length > 1) {
+ // 停止该条目的监听
+ if (itemWatchStopFns.value[index]) {
+ itemWatchStopFns.value[index]();
+ }
form.value.itemList.splice(index, 1);
+ itemWatchStopFns.value.splice(index, 1);
} else {
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
}
};
+
/** 删除按钮操作 */
const handleDelete = async (row?: MaterialIssueVO) => {
const _ids = row?.id || ids.value;
- await proxy?.$modal.confirm('是否确认删除物料领料单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
- await delMaterialIssue(_ids);
- proxy?.$modal.msgSuccess('删除成功');
- await getList();
+ try {
+ await proxy?.$modal.confirm(`是否确认删除物料领料单编号为"${_ids}"的数据项?`);
+ await delMaterialIssue(_ids);
+ proxy?.$modal.msgSuccess('删除成功');
+ await getList();
+ } catch (error) {
+ // 取消删除不提示
+ } finally {
+ loading.value = false;
+ }
};
+
const handleView = (row) => {
// 查看详情
wordllssueRef.value?.openDialog(row);
};
+
onMounted(() => {
getList();
getName();
});
-//监听项目id刷新数据
+
+// 监听项目id刷新数据
const listeningProject = watch(
() => currentProject.value?.id,
- (nid, oid) => {
+ (nid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
+ getName();
}
);
onUnmounted(() => {
listeningProject();
+ // 清理所有监听
+ itemWatchStopFns.value.forEach((stop) => stop());
});
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index a4f20d0..582b20f 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -13,7 +13,7 @@
:collapse-transition="false"
mode="vertical"
>
-
+
diff --git a/src/views/design/designChange/indexEdit.vue b/src/views/design/designChange/indexEdit.vue
index f5d0508..d10fdca 100644
--- a/src/views/design/designChange/indexEdit.vue
+++ b/src/views/design/designChange/indexEdit.vue
@@ -36,7 +36,7 @@
-
@@ -254,7 +254,7 @@ const initFormData = {
id: undefined,
projectId: currentProject.value?.id,
formNo: undefined,
- projectName: undefined,
+ projectName: currentProject.value?.name,
submitUnit: undefined,
specialty: undefined,
specialtyName: undefined,
diff --git a/src/views/materials/materialsEquipment/materialIssue/index.vue b/src/views/materials/materialsEquipment/materialIssue/index.vue
index 88837ff..31175fc 100644
--- a/src/views/materials/materialsEquipment/materialIssue/index.vue
+++ b/src/views/materials/materialsEquipment/materialIssue/index.vue
@@ -85,9 +85,10 @@
-
+
+
-
+
@@ -130,7 +131,7 @@
:rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"
>
getNameChange(value, index, item)">
-
+
@@ -200,7 +201,7 @@
-
+
@@ -304,7 +305,7 @@ const getInitFormData = () => {
materialSource: '1',
formCode: undefined,
projectName: undefined,
- materialName: undefined,
+ materialName: '', // 初始化为空字符串
orderingUnit: undefined,
supplierUnit: undefined,
issueUnit: undefined,
@@ -327,7 +328,7 @@ const getInitFormData = () => {
stockQuantity: undefined,
issuedQuantity: undefined,
remainingQuantity: undefined,
- name: undefined,
+ name: undefined, // 数量验收的名称
remark: undefined,
materialsId: undefined
}
@@ -355,7 +356,7 @@ const data = reactive({
rules: {
formCode: [{ required: true, message: '请输入表单编号', trigger: 'blur' }],
projectName: [{ required: true, message: '请输入工程名称', trigger: 'blur' }],
- materialName: [{ required: true, message: '请输入设备材料名称', trigger: 'blur' }],
+ materialName: [{ required: true, message: '请先在数量验收列表中选择名称', trigger: 'blur' }], // 确保有名称生成
orderingUnit: [{ required: true, message: '请输入订货单位', trigger: 'blur' }],
supplierUnit: [{ required: true, message: '请输入供货单位', trigger: 'blur' }],
issueUnit: [{ required: true, message: '请输入领料单位', trigger: 'blur' }],
@@ -364,6 +365,24 @@ const data = reactive({
});
const { queryParams, form, rules } = toRefs(data);
+const optionsName: any = ref([]);
+
+/**
+ * 核心函数:从数量验收列表提取名称,用逗号拼接生成设备材料名称
+ */
+const computeMaterialName = () => {
+ if (!form.value.itemList || form.value.itemList.length === 0) {
+ form.value.materialName = '';
+ return;
+ }
+ // 过滤空名称,去重(可选,根据业务需求决定是否去重)
+ const validNames = form.value.itemList
+ .filter((item) => item.name && item.name.trim() !== '')
+ .map((item) => item.name.trim())
+ .filter((name, index, self) => self.indexOf(name) === index); // 去重(如需保留重复则删除这行)
+
+ form.value.materialName = validNames.join(',');
+};
/** 查询物料领料单列表 */
const getList = async () => {
@@ -377,8 +396,6 @@ const getList = async () => {
}
};
-const optionsName: any = ref([]);
-
// 获取材料名称列表
const getName = async () => {
try {
@@ -391,17 +408,16 @@ const getName = async () => {
}
};
-// 材料名称选择变化处理
+// 材料名称选择变化处理(修改select的value为名称,而非ID)
const getNameChange = (value, index, item) => {
- const data = optionsName.value.find((item) => item.id == value);
- if (data) {
- form.value.itemList[index].name = data.materialsName;
- form.value.itemList[index].materialsId = data.id;
- form.value.itemList[index].specification = data.typeSpecificationName;
- form.value.itemList[index].unit = data.weightId;
- form.value.itemList[index].stockQuantity = data.inventoryNumber;
- // 触发剩余数量计算
- calculateRemaining(index);
+ const selected = optionsName.value.find((opt) => opt.materialsName === value);
+ if (selected) {
+ item.name = selected.materialsName; // 直接赋值名称
+ item.materialsId = selected.id; // 保留ID用于后端
+ item.specification = selected.typeSpecificationName;
+ item.unit = selected.weightId;
+ item.stockQuantity = Number(selected.inventoryNumber) || 0;
+ calculateRemaining(index); // 计算剩余数量
}
};
@@ -477,6 +493,8 @@ const reset = () => {
if (form.value.itemList.length > 0) {
watchItemChanges(0);
}
+ // 初始计算一次材料名称
+ computeMaterialName();
};
/** 监听条目变化,自动计算剩余数量 */
@@ -522,6 +540,8 @@ const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加物料领料单';
+ // 新增时初始计算材料名称
+ computeMaterialName();
};
/** 修改按钮操作 */
@@ -532,33 +552,41 @@ const handleUpdate = async (row?: MaterialIssueVO) => {
const res = await getMaterialIssue(_id);
Object.assign(form.value, res.data);
- // 确保itemList存在
+ // 确保itemList存在且格式正确
if (!form.value.itemList) {
form.value.itemList = [];
}
- // 转换数据类型并计算剩余数量(关键修复)
+ // 转换数据类型并计算剩余数量
form.value.itemList = form.value.itemList.map((item) => ({
...item,
stockQuantity: Number(item.stockQuantity) || 0,
issuedQuantity: Number(item.issuedQuantity) || 0,
- remainingQuantity: Number(item.remainingQuantity) || 0
+ remainingQuantity: Number(item.remainingQuantity) || 0,
+ name: item.name || '' // 确保名称不为undefined
}));
// 为每个条目添加监听并强制计算剩余数量
form.value.itemList.forEach((_, index) => {
watchItemChanges(index);
- calculateRemaining(index); // 强制计算确保数据一致性
+ calculateRemaining(index);
});
- // 手动触发一次验证(关键修复)
+
+ // 关键:编辑时从itemList重新计算设备材料名称(覆盖后端返回的旧值)
+ computeMaterialName();
+
+ // 手动触发一次验证
setTimeout(() => {
if (materialIssueFormRef.value) {
form.value.itemList.forEach((_, index) => {
materialIssueFormRef.value.validateField(`itemList.${index}.issuedQuantity`);
materialIssueFormRef.value.validateField(`itemList.${index}.remainingQuantity`);
});
+ // 验证设备材料名称
+ materialIssueFormRef.value.validateField('materialName');
}
}, 0);
+
dialog.visible = true;
dialog.title = '修改物料领料单';
} catch (error) {
@@ -616,6 +644,8 @@ const addItem = () => {
form.value.itemList.push(newItem);
// 监听新条目
watchItemChanges(form.value.itemList.length - 1);
+ // 添加后重新计算材料名称
+ computeMaterialName();
};
// 删除数量验收条目
@@ -627,6 +657,8 @@ const removeItem = (index: number) => {
}
form.value.itemList.splice(index, 1);
itemWatchStopFns.value.splice(index, 1);
+ // 删除后重新计算材料名称
+ computeMaterialName();
} else {
proxy?.$modal.msgWarning('至少需要保留一条数量验收记录');
}
@@ -652,6 +684,15 @@ const handleView = (row) => {
wordllssueRef.value?.openDialog(row);
};
+// 关键:监听数量验收列表变化,实时更新设备材料名称
+watch(
+ () => form.value.itemList,
+ () => {
+ computeMaterialName();
+ },
+ { deep: true, immediate: true } // deep监听数组内部变化,immediate初始执行
+);
+
onMounted(() => {
getList();
getName();
diff --git a/src/views/workflows/task/taskWaiting.vue b/src/views/workflows/task/taskWaiting.vue
index 02aac32..e678401 100644
--- a/src/views/workflows/task/taskWaiting.vue
+++ b/src/views/workflows/task/taskWaiting.vue
@@ -4,11 +4,11 @@
-
+
From 6f73a308ba5a8d55975262f66fdd27aa48b4899b Mon Sep 17 00:00:00 2001
From: taoge1020
Date: Wed, 27 Aug 2025 22:21:53 +0800
Subject: [PATCH 10/21] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
src/utils/sse.ts | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.env.development b/.env.development
index c1b3fa0..2524c8a 100644
--- a/.env.development
+++ b/.env.development
@@ -12,7 +12,7 @@ VITE_APP_ENV = 'development'
# 罗成
# VITE_APP_BASE_API = 'http://192.168.110.213:8899'
# 朱银
-VITE_APP_BASE_API = 'http://192.168.110.149:8899'
+VITE_APP_BASE_API = 'http://192.168.110.180:8899'
#曾涛
# VITE_APP_BASE_API = 'http://192.168.110.171:8899'
diff --git a/src/utils/sse.ts b/src/utils/sse.ts
index 04103f7..897d3ac 100644
--- a/src/utils/sse.ts
+++ b/src/utils/sse.ts
@@ -20,12 +20,10 @@ export const initSSE = (url: any) => {
});
watch(error, () => {
- console.log('SSE connection error:', error.value);
error.value = null;
});
watch(data, () => {
- console.log('🚀 ~ initSSE ~ data:', JSON.parse(data.value));
let label = '';
let route1 = '';
let detailId = '';
@@ -33,6 +31,9 @@ export const initSSE = (url: any) => {
if (JSON.parse(data.value)) {
const obj = JSON.parse(data.value);
route1 = obj.type;
+ if (obj.type == 'count') {
+ return;
+ }
label = obj.content;
// detailId = obj.detailId;
data.value = null;
From b59bd89e43396f7d4c1f43bd9a678f064e6418d5 Mon Sep 17 00:00:00 2001
From: Teo <2642673902@qq.com>
Date: Thu, 28 Aug 2025 03:35:18 +0800
Subject: [PATCH 11/21] =?UTF-8?q?=E6=9D=83=E9=99=90=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 4 +-
src/App.vue | 8 ++
src/api/menu.ts | 4 +-
src/api/project/project/index.ts | 11 ++
src/api/system/menu/index.ts | 8 ++
src/api/system/post/index.ts | 8 ++
src/api/system/user/types.ts | 5 +-
src/components/ProjectSelector/index.vue | 67 ++++++++-
src/permission.ts | 6 +-
src/router/index.ts | 21 ++-
src/store/modules/permission.ts | 3 +-
src/store/modules/user.ts | 84 ++++++++----
src/views/login.vue | 2 +
src/views/progress/progressCategory/index.vue | 24 ++--
src/views/system/user/index.vue | 127 +++++++++++++-----
15 files changed, 293 insertions(+), 89 deletions(-)
diff --git a/.env.development b/.env.development
index 4c056ae..500d6b0 100644
--- a/.env.development
+++ b/.env.development
@@ -6,9 +6,9 @@ VITE_APP_ENV = 'development'
# 开发环境
# 李陈杰 209
-# VITE_APP_BASE_API = 'http://192.168.110.209:8899'
+VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 曾涛
-VITE_APP_BASE_API = 'http://192.168.110.180:8899'
+# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 罗成
# VITE_APP_BASE_API = 'http://192.168.110.213:8899'
# 朱银
diff --git a/src/App.vue b/src/App.vue
index c641c7d..a0780e4 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -19,3 +19,11 @@ onMounted(() => {
});
});
+
diff --git a/src/api/menu.ts b/src/api/menu.ts
index a3ae80e..fc1d542 100644
--- a/src/api/menu.ts
+++ b/src/api/menu.ts
@@ -3,9 +3,9 @@ import { AxiosPromise } from 'axios';
import { RouteRecordRaw } from 'vue-router';
// 获取路由
-export function getRouters(): AxiosPromise {
+export function getRouters(id: string): AxiosPromise {
return request({
- url: '/system/menu/getRouters',
+ url: '/system/menu/getRouters/' + id,
method: 'get'
});
}
diff --git a/src/api/project/project/index.ts b/src/api/project/project/index.ts
index 5b76894..04d5b65 100644
--- a/src/api/project/project/index.ts
+++ b/src/api/project/project/index.ts
@@ -186,3 +186,14 @@ export const uploadProjectFile = (data: any) => {
data: data
});
};
+
+/**
+ * 切换项目
+ * @param id
+ */
+export const changeProject = (id: string | number) => {
+ return request({
+ url: '/project/project/changeProject/' + id,
+ method: 'get'
+ });
+};
diff --git a/src/api/system/menu/index.ts b/src/api/system/menu/index.ts
index 7a0cf74..15cf1b5 100644
--- a/src/api/system/menu/index.ts
+++ b/src/api/system/menu/index.ts
@@ -68,3 +68,11 @@ export const delMenu = (menuId: string | number) => {
method: 'delete'
});
};
+
+// 获取所有路由
+export const getAllRouters = () => {
+ return request({
+ url: '/system/menu/getAllRouters',
+ method: 'get'
+ });
+};
diff --git a/src/api/system/post/index.ts b/src/api/system/post/index.ts
index a910be8..54a64b2 100644
--- a/src/api/system/post/index.ts
+++ b/src/api/system/post/index.ts
@@ -75,3 +75,11 @@ export function getRoleList(deptId?: number | string): AxiosPromise {
}
});
}
+
+// 获取部门下的项目列表
+export function getProjectByDeptId(deptId?: number | string): AxiosPromise {
+ return request({
+ url: '/system/dept/projectIdList/' + deptId,
+ method: 'get'
+ });
+}
diff --git a/src/api/system/user/types.ts b/src/api/system/user/types.ts
index 4bdca11..88461ad 100644
--- a/src/api/system/user/types.ts
+++ b/src/api/system/user/types.ts
@@ -60,19 +60,20 @@ export interface UserForm {
nickName?: string;
password: string;
phonenumber?: string;
+ projectRoles?: any[];
email?: string;
sex?: string;
status: string;
remark?: string;
postIds: string[];
- roleIds: string[];
filePath?: string;
}
export interface UserInfoVO {
user: UserVO;
roles: RoleVO[];
- roleIds: string[];
+
+ projectRoles: any[];
posts: PostVO[];
postIds: string[];
roleGroup: string;
diff --git a/src/components/ProjectSelector/index.vue b/src/components/ProjectSelector/index.vue
index 5ba301d..5884a27 100644
--- a/src/components/ProjectSelector/index.vue
+++ b/src/components/ProjectSelector/index.vue
@@ -1,5 +1,5 @@
-
+
[
// { id: '', name: '全部工程项目' }, // 添加空选项
...userStore.projects
]);
+const proxy = getCurrentInstance()?.proxy as any;
const selectedProjectId = ref(userStore.selectedProject?.id || '');
@@ -37,13 +43,60 @@ watch(
{ deep: true }
);
-const handleSelect = (projectId: string) => {
+/** 切换项目逻辑 */
+const handleSelect = async (projectId: string) => {
+ proxy.$cache.local.setJSON('isCheckRole', 'true');
+
+ const userStore = useUserStore();
+ const permissionStore = usePermissionStore();
const selectedProject = projects.value.find((p) => p.id === projectId);
- if (selectedProject) {
- userStore.setSelectedProject(selectedProject);
- console.log(userStore.selectedProject); // 打印选中的项目
- }
+ if (!selectedProject) return;
+ const loadingInstance = ElLoading.service({
+ lock: true,
+ text: '项目切换中...',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
+ await changeProject(projectId);
+
+ // 更新项目 & 权限
+ userStore.setSelectedProject(selectedProject);
+ await userStore.setInfo();
+ await userStore.setRoles(); // 这里会刷新 permissions/roles
+ // 重新生成路由
+ permissionStore.generateRoutes().then((routeList) => {
+ const currentPath = router.currentRoute.value.fullPath;
+ const exist = currentPath == '/' || currentPath == '/index' ? true : routeExists(currentPath, routeList);
+ if (exist) return loadingInstance.close();
+
+ proxy?.$tab.closeAllPage();
+ router.push('/index');
+ loadingInstance.close();
+
+ // 刷新当前路由
+ });
};
+function routeExists(fullPath: string, routes: any[], parentPath = ''): boolean {
+ for (const route of routes) {
+ // 拼接完整 path
+ let currentPath = route.path.startsWith('/') ? route.path : `${parentPath}/${route.path}`;
+
+ // 处理多余的 "//"
+ currentPath = currentPath.replace(/\/+/g, '/');
+
+ // 判断
+ if (currentPath === fullPath) {
+ return true;
+ }
+
+ // 递归子路由
+ if (route.children && route.children.length > 0) {
+ if (routeExists(fullPath, route.children, currentPath)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue
index 648eba2..8703d66 100644
--- a/src/layout/components/Sidebar/SidebarItem.vue
+++ b/src/layout/components/Sidebar/SidebarItem.vue
@@ -57,7 +57,9 @@ const props = defineProps({
});
const total = ref(0);
onMounted(() => {
- if (onlyOneChild.value.meta?.title == '我的待办') {
+ if (onlyOneChild.value.meta?.title == '我的待办' || props.item.meta?.title == '我的任务') {
+ console.log(44444444);
+
getWaitingList();
}
});
@@ -123,7 +125,8 @@ watch(
() => noticeStore.state.value.notices,
(newVal) => {
if (onlyOneChild.value.meta?.title == '我的待办') {
- // 延迟1秒
+ console.log(121212121);
+
let time = setTimeout(() => {
getWaitingList();
clearTimeout(time);
diff --git a/src/permission.ts b/src/permission.ts
index b3a14d7..4a7ff0e 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -45,7 +45,6 @@ router.beforeEach(async (to, from, next) => {
accessRoutes.forEach((route) => {
if (!isHttp(route.path)) {
router.addRoute(route); // 动态添加可访问路由表
- console.log('🚀 ~ route:', route);
}
});
$cache.local.remove('isCheckRole');
diff --git a/src/views/materials/batchPlan/index.vue b/src/views/materials/batchPlan/index.vue
index b301a4e..a21a726 100644
--- a/src/views/materials/batchPlan/index.vue
+++ b/src/views/materials/batchPlan/index.vue
@@ -136,7 +136,9 @@
+
{
qs: item.qs,
arrivalTime: item.arrivalTime,
remark: item.remark,
- Remaining: item.Remaining || 0,
+ Remaining: Number(item.remaining) || 0,
+ // remaining:
quantityError: '',
batchNumber: item.batchNumber,
duplicateError: '',
From c0338033b444c6c068bbdf9fc88cf2bc4ed9841c Mon Sep 17 00:00:00 2001
From: ljx <15723110242@139.com>
Date: Thu, 28 Aug 2025 18:20:24 +0800
Subject: [PATCH 16/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 6 +-
src/views/contract/division/index.vue | 33 ++-
src/views/tender/plan/comm/planPage.vue | 279 +++++------------------
src/views/tender/plan/comm/winTheBid.vue | 99 ++++++++
src/views/tender/plan/index.vue | 37 ++-
5 files changed, 215 insertions(+), 239 deletions(-)
create mode 100644 src/views/tender/plan/comm/winTheBid.vue
diff --git a/.env.development b/.env.development
index d557820..0269bac 100644
--- a/.env.development
+++ b/.env.development
@@ -6,15 +6,15 @@ VITE_APP_ENV = 'development'
# 开发环境
# 李陈杰 209
-VITE_APP_BASE_API = 'http://192.168.110.180:8899'
+# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 曾涛
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 罗成
# VITE_APP_BASE_API = 'http://192.168.110.213:8899'
# 朱银
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
-#曾涛
-# VITE_APP_BASE_API = 'http://192.168.110.171:8899'
+
+VITE_APP_BASE_API = 'http://192.168.110.149:8899'
# 无人机接口地址
diff --git a/src/views/contract/division/index.vue b/src/views/contract/division/index.vue
index afb7c94..3f80b55 100644
--- a/src/views/contract/division/index.vue
+++ b/src/views/contract/division/index.vue
@@ -118,7 +118,8 @@
-
+
+
-
-
+
+
+
+
+
+ {{
+ ((scope.row.quantity ? Number(scope.row.quantity) : 0) - (scope.row.useQuantity ? Number(scope.row.useQuantity) : 0)) *
+ Number(scope.row.unitPrice) ==
+ 0
+ ? ''
+ : (
+ ((scope.row.quantity ? Number(scope.row.quantity) : 0) - (scope.row.useQuantity ? Number(scope.row.useQuantity) : 0)) *
+ Number(scope.row.unitPrice)
+ ).toFixed(2)
+ }}
+
+
diff --git a/src/views/tender/plan/comm/planPage.vue b/src/views/tender/plan/comm/planPage.vue
index b4b156c..4562ebc 100644
--- a/src/views/tender/plan/comm/planPage.vue
+++ b/src/views/tender/plan/comm/planPage.vue
@@ -1,245 +1,78 @@
-
-
-
-
-
-
-
-
-
-
- {{ isExpandAll ? '一键收起' : '一键展开' }}
-
-
-
-
- 导入excel
-
-
-
-
- 导出excel
-
-
-
-
-
-
-
-
-
-
-
-
- (scope.row.unitPrice = val)"
- :precision="2"
- :step="0.1"
- :controls="false"
- v-if="scope.row.quantity && scope.row.quantity != 0"
- />
-
-
-
-
- {{ scope.row.price }}
-
-
-
-
- 修改
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/views/tender/plan/comm/winTheBid.vue b/src/views/tender/plan/comm/winTheBid.vue
new file mode 100644
index 0000000..67eac5f
--- /dev/null
+++ b/src/views/tender/plan/comm/winTheBid.vue
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/tender/plan/index.vue b/src/views/tender/plan/index.vue
index 8265b8c..dfc29b3 100644
--- a/src/views/tender/plan/index.vue
+++ b/src/views/tender/plan/index.vue
@@ -189,7 +189,8 @@
-
+
+
-
-
+
+
+
+
+
+ {{
+ ((scope.row.quantity ? Number(scope.row.quantity) : 0) - (scope.row.useQuantity ? Number(scope.row.useQuantity) : 0)) *
+ Number(scope.row.unitPrice) ==
+ 0
+ ? ''
+ : (
+ ((scope.row.quantity ? Number(scope.row.quantity) : 0) - (scope.row.useQuantity ? Number(scope.row.useQuantity) : 0)) *
+ Number(scope.row.unitPrice)
+ ).toFixed(2)
+ }}
+
+
@@ -266,6 +287,9 @@ import { useUserStoreHook } from '@/store/modules/user';
import { getDicts } from '@/api/system/dict/data';
import { Plus } from '@element-plus/icons-vue';
import { FormInstance } from 'element-plus';
+import winTheBid from './comm/winTheBid.vue';
+import information from './comm/planPage.vue';
+
import {
sheetList,
tenderPlanList,
@@ -279,7 +303,6 @@ import {
delBiddView,
editStatus
} from '@/api/tender/index';
-import { it } from 'element-plus/es/locale/index.mjs';
const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject);
From 9ec6b9818c2df812ce086472093ff6ce9cff01ba Mon Sep 17 00:00:00 2001
From: Teo <2642673902@qq.com>
Date: Thu, 28 Aug 2025 20:10:46 +0800
Subject: [PATCH 17/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E4=BB=A5=E5=8F=8A=E4=BE=9B=E5=BA=94=E5=95=86=E5=85=A5=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/project/contractor/types.ts | 16 ++-
src/api/supplierInput/supplierInput/index.ts | 2 +-
src/components/ProjectSelector/index.vue | 6 ++
src/permission.ts | 105 ++++++++++---------
src/store/modules/user.ts | 1 +
src/views/materials/purchaseDoc/index.vue | 12 ++-
src/views/project/contractor/index.vue | 31 ++++--
src/views/tender/supplierInput/index.vue | 1 +
8 files changed, 108 insertions(+), 66 deletions(-)
diff --git a/src/api/project/contractor/types.ts b/src/api/project/contractor/types.ts
index f041fa6..0d4ab3f 100644
--- a/src/api/project/contractor/types.ts
+++ b/src/api/project/contractor/types.ts
@@ -28,10 +28,10 @@ export interface ContractorVO {
* 管理人联系电话
*/
custodianPhone: string;
- /**
+ /**
* 分包类型
*/
- contractorType?: string;
+ contractorType?: string;
/**
* 公司相关文件
@@ -54,6 +54,14 @@ export interface ContractorForm extends BaseEntity {
* 主键id
*/
id?: string | number;
+ /**
+ * 供应商id
+ */
+ supplierId?: string | number;
+ /**
+ * 供应商
+ */
+ supplier?: string;
/**
* 主键id
@@ -127,10 +135,10 @@ export interface ContractorQuery extends PageQuery {
* 管理人联系电话
*/
custodianPhone?: string;
- /**
+ /**
* 分包类型
*/
- contractorType?: string;
+ contractorType?: string;
/**
* 日期范围参数
diff --git a/src/api/supplierInput/supplierInput/index.ts b/src/api/supplierInput/supplierInput/index.ts
index 719aa11..834b072 100644
--- a/src/api/supplierInput/supplierInput/index.ts
+++ b/src/api/supplierInput/supplierInput/index.ts
@@ -8,7 +8,7 @@ import { SupplierInputVO, SupplierInputForm, SupplierInputQuery } from '@/api/su
* @returns {*}
*/
-export const listSupplierInput = (query?: SupplierInputQuery): AxiosPromise => {
+export const listSupplierInput = (query?: any): AxiosPromise => {
return request({
url: '/supplierInput/supplierInput/list',
method: 'get',
diff --git a/src/components/ProjectSelector/index.vue b/src/components/ProjectSelector/index.vue
index 5884a27..1259482 100644
--- a/src/components/ProjectSelector/index.vue
+++ b/src/components/ProjectSelector/index.vue
@@ -56,7 +56,13 @@ const handleSelect = async (projectId: string) => {
text: '项目切换中...',
background: 'rgba(0, 0, 0, 0.7)'
});
+ setTimeout(() => {
+ if (loadingInstance && loadingInstance.visible) {
+ loadingInstance.close();
+ }
+ }, 3000);
await changeProject(projectId);
+ console.log('切换项目', selectedProject);
// 更新项目 & 权限
userStore.setSelectedProject(selectedProject);
diff --git a/src/permission.ts b/src/permission.ts
index b3a14d7..6162675 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -10,6 +10,8 @@ import useUserStore from '@/store/modules/user';
import useSettingsStore from '@/store/modules/settings';
import usePermissionStore from '@/store/modules/permission';
+let isFirst = false;
+
NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*', '/materials/purchaseDoc/uploadCode'];
@@ -17,57 +19,64 @@ const isWhiteList = (path: string) => {
return whiteList.some((pattern) => isPathMatch(pattern, path));
};
-router.beforeEach(async (to, from, next) => {
+router.beforeEach(async (to, from) => {
NProgress.start();
- if (to.path == '/indexEquipment' || to.path == '/materials/purchaseDoc/uploadCode' || to.path == '/codeDetail') {
- next();
- } else if (getToken()) {
- to.meta.title && useSettingsStore().setTitle(to.meta.title);
- /* has token*/
- if (to.path === '/login') {
- next({ path: '/' });
- NProgress.done();
- } else if (isWhiteList(to.path)) {
- next();
- } else {
- if (useUserStore().roles.length === 0 || $cache.local.getJSON('isCheckRole')) {
- isRelogin.show = true;
- // 判断当前用户是否已拉取完user_info信息
- const [err] = await tos(useUserStore().getInfo());
- if (err) {
- await useUserStore().logout();
- ElMessage.error(err);
- next({ path: '/' });
- } else {
- isRelogin.show = false;
- const accessRoutes = await usePermissionStore().generateRoutes();
- // 根据roles权限生成可访问的路由表
- accessRoutes.forEach((route) => {
- if (!isHttp(route.path)) {
- router.addRoute(route); // 动态添加可访问路由表
- console.log('🚀 ~ route:', route);
- }
- });
- $cache.local.remove('isCheckRole');
- // @ts-expect-error hack方法 确保addRoutes已完成
- next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
- }
- } else {
- next();
- }
- }
- } else {
- // 没有token
- if (isWhiteList(to.path)) {
- // 在免登录白名单,直接进入
- next();
- } else {
- const redirect = encodeURIComponent(to.fullPath || '/');
- next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页
- NProgress.done();
- }
+ // 特殊页面放行
+ if (['/indexEquipment', '/materials/purchaseDoc/uploadCode', '/codeDetail'].includes(to.path)) {
+ return true;
}
+
+ // 已登录
+ if (getToken()) {
+ if (to.meta.title) useSettingsStore().setTitle(to.meta.title);
+
+ if (to.path === '/login') {
+ NProgress.done();
+ return { path: '/' };
+ }
+
+ if (isWhiteList(to.path)) {
+ return true;
+ }
+ if ((!isFirst && useUserStore().roles.length === 0) || $cache.local.getJSON('isCheckRole') === 'true') {
+ isFirst = true;
+ isRelogin.show = true;
+
+ const [err] = await tos(useUserStore().getInfo());
+
+ if (err) {
+ await useUserStore().logout();
+ ElMessage.error(err);
+ NProgress.done();
+ return { path: '/' };
+ }
+
+ isRelogin.show = false;
+ const accessRoutes = await usePermissionStore().generateRoutes();
+ accessRoutes.forEach((route) => {
+ if (!isHttp(route.path)) router.addRoute(route);
+ });
+
+ $cache.local.remove('isCheckRole');
+
+ // 确保路由已添加后再跳转
+ return { ...to, replace: true };
+ }
+
+ return true;
+ } else {
+ isFirst = false;
+ }
+
+ // 未登录
+ if (isWhiteList(to.path)) {
+ return true;
+ }
+
+ const redirect = encodeURIComponent(to.fullPath || '/');
+ NProgress.done();
+ return { path: `/login?redirect=${redirect}` };
});
router.afterEach(() => {
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index a2a9836..178ac33 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -88,6 +88,7 @@ export const useUserStore = defineStore('user', () => {
}
}
const [err, res] = await to(getUserInfo());
+ console.log(111111111111);
if (res) {
const data = res.data;
diff --git a/src/views/materials/purchaseDoc/index.vue b/src/views/materials/purchaseDoc/index.vue
index b1523aa..a1bc27a 100644
--- a/src/views/materials/purchaseDoc/index.vue
+++ b/src/views/materials/purchaseDoc/index.vue
@@ -133,8 +133,8 @@
>
-
-
+
+
{
form.value.associationList = form.value.planId?.map((item: any) => ({
planId: item
}));
+ form.value.supplier = supplierOptions.value.find((item) => item.id == form.value.supplierId)?.supplierName;
if (form.value.id) {
await updatePurchaseDoc(form.value).finally(() => (buttonLoading.value = false));
@@ -514,10 +518,10 @@ const getBatchList = async () => {
};
const getSupplierList = async () => {
- const res = await listContractor({
+ const res = await listSupplierInput({
projectId: currentProject.value?.id,
pageNum: 1,
- contractorType: 4,
+ state: 'finish',
pageSize: 10000
});
supplierOptions.value = res.rows;
diff --git a/src/views/project/contractor/index.vue b/src/views/project/contractor/index.vue
index 4bfcdc8..6b8953b 100644
--- a/src/views/project/contractor/index.vue
+++ b/src/views/project/contractor/index.vue
@@ -81,6 +81,11 @@
+
+
+
+
+
@@ -121,6 +126,7 @@ import { ContractorForm, ContractorQuery, ContractorVO } from '@/api/project/con
import ContractorFileDialog from '@/views/project/contractor/component/ContractorFileDialog.vue';
import { useUserStoreHook } from '@/store/modules/user';
import { getDicts, listData } from '@/api/system/dict/data';
+import { listSupplierInput } from '@/api/supplierInput/supplierInput';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -152,6 +158,8 @@ const initFormData: ContractorForm = {
principalPhone: undefined,
custodian: undefined,
custodianPhone: undefined,
+ supplierId: undefined,
+ supplier: undefined,
contractorType: undefined,
fileMap: undefined,
remark: undefined,
@@ -257,6 +265,8 @@ const submitForm = () => {
if (valid) {
form.value.projectId = currentProject.value?.id;
buttonLoading.value = true;
+ form.value.supplier = supplierOptions.value.find((item) => item.id == form.value.supplierId)?.supplierName;
+
if (form.value.id) {
await updateContractor(form.value).finally(() => (buttonLoading.value = false));
} else {
@@ -278,15 +288,16 @@ const handleDelete = async (row?: ContractorVO) => {
await getList();
};
-/** 导出按钮操作 */
-const handleExport = () => {
- proxy?.download(
- 'project/contractor/export',
- {
- ...queryParams.value
- },
- `contractor_${new Date().getTime()}.xlsx`
- );
+/** 获取供应商 */
+const supplierOptions = ref([]);
+const getSupplierList = async () => {
+ const res = await listSupplierInput({
+ projectId: currentProject.value?.id,
+ pageNum: 1,
+ state: 'finish',
+ pageSize: 10000
+ });
+ supplierOptions.value = res.rows;
};
/** 文件操作 **/
@@ -304,6 +315,7 @@ const listeningProject = watch(
queryParams.value.projectId = nid;
form.value.projectId = nid;
console.log('监听项目id', queryParams.value.projectId, form.value.projectId);
+ getSupplierList();
getList();
}
);
@@ -314,5 +326,6 @@ onUnmounted(() => {
onMounted(() => {
getDictList();
getList();
+ getSupplierList();
});
diff --git a/src/views/tender/supplierInput/index.vue b/src/views/tender/supplierInput/index.vue
index bbebc86..680aaf1 100644
--- a/src/views/tender/supplierInput/index.vue
+++ b/src/views/tender/supplierInput/index.vue
@@ -275,6 +275,7 @@
+ * 入库资料
Date: Thu, 28 Aug 2025 20:32:12 +0800
Subject: [PATCH 18/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/formalities/formalitiesAreConsolidated/index.vue | 2 +-
src/views/tender/plan/comm/winTheBid.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/views/formalities/formalitiesAreConsolidated/index.vue b/src/views/formalities/formalitiesAreConsolidated/index.vue
index e30a2a7..728c60a 100644
--- a/src/views/formalities/formalitiesAreConsolidated/index.vue
+++ b/src/views/formalities/formalitiesAreConsolidated/index.vue
@@ -259,7 +259,7 @@
-
+
diff --git a/src/views/tender/plan/comm/winTheBid.vue b/src/views/tender/plan/comm/winTheBid.vue
index 67eac5f..f0056d8 100644
--- a/src/views/tender/plan/comm/winTheBid.vue
+++ b/src/views/tender/plan/comm/winTheBid.vue
@@ -1,5 +1,5 @@
-
+
From 211b94d76b7bb1dc979dfd4b40662bcb0e2441f8 Mon Sep 17 00:00:00 2001
From: Teo <2642673902@qq.com>
Date: Thu, 28 Aug 2025 22:00:23 +0800
Subject: [PATCH 19/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B7=E6=96=B0?=
=?UTF-8?q?=E4=B8=A2=E5=A4=B1=E6=9D=83=E9=99=90bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
src/store/modules/user.ts | 12 +-----
src/views/system/dept/index.vue | 76 ++++++++++++---------------------
3 files changed, 30 insertions(+), 60 deletions(-)
diff --git a/.env.development b/.env.development
index 99e7d78..500d6b0 100644
--- a/.env.development
+++ b/.env.development
@@ -12,7 +12,7 @@ VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 罗成
# VITE_APP_BASE_API = 'http://192.168.110.213:8899'
# 朱银
-# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
+# VITE_APP_BASE_API = 'http://192.168.110.149:8899'
#曾涛
# VITE_APP_BASE_API = 'http://192.168.110.171:8899'
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 178ac33..fcdc115 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -75,9 +75,7 @@ export const useUserStore = defineStore('user', () => {
id: p.projectId,
name: p.projectName || '未知项目'
}));
-
setProjects(projectList);
-
// 如果有缓存的选中项目,且该项目在当前项目列表中存在,则使用缓存的项目
const storedProject = getSelectedProjectFromStorage();
if (storedProject && projectList.some((p) => p.id === storedProject.id)) {
@@ -88,17 +86,14 @@ export const useUserStore = defineStore('user', () => {
}
}
const [err, res] = await to(getUserInfo());
- console.log(111111111111);
-
if (res) {
const data = res.data;
const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
-
if (data.roles && data.roles.length > 0) {
- setRoles();
permissionList.value = data.permissions;
roleList.value = data.roles;
+ setRoles();
} else {
roles.value = ['ROLE_DEFAULT'];
}
@@ -113,19 +108,16 @@ export const useUserStore = defineStore('user', () => {
}
return Promise.reject(err);
};
-
const setInfo = async () => {
const [err, res] = await to(getUserInfo());
-
if (res) {
const data = res.data;
const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
-
if (data.roles && data.roles.length > 0) {
- setRoles();
permissionList.value = data.permissions;
roleList.value = data.roles;
+ setRoles();
} else {
roles.value = ['ROLE_DEFAULT'];
}
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index c9d9247..e8c763e 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -1,7 +1,6 @@
-
+
@@ -9,13 +8,11 @@
-
+
-
+
@@ -31,8 +28,7 @@
- 新增
-
+ 新增
展开/折叠
@@ -41,8 +37,14 @@
-
+
@@ -64,16 +66,13 @@
-
+
-
-
+
+
-
+
@@ -85,9 +84,14 @@
-
+
@@ -108,8 +112,7 @@
-
+
@@ -126,32 +129,17 @@
- {{ dict.label
- }}
+ {{ dict.label }}
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -336,16 +324,6 @@ const handleUpdate = async (row: DeptVO) => {
dialog.title = '修改部门';
};
-const changeProject = async (val: any) => {
- if (val == '4' && (!projectList.value || !projectList.value.length)) {
- const res = await getDeptList();
- projectList.value = res.data;
- } else if (val == '5' && (!contractorList.value || !contractorList.value.length)) {
- const res = await optionProjectSelect(form.value.rowProjectId);
- contractorList.value = res;
- }
-};
-
/** 提交按钮 */
const submitForm = () => {
deptFormRef.value?.validate(async (valid: boolean) => {
From b0a05519f01e044401b33eff95cdc62dd941bb28 Mon Sep 17 00:00:00 2001
From: Teo <2642673902@qq.com>
Date: Thu, 28 Aug 2025 22:24:49 +0800
Subject: [PATCH 20/21] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/store/modules/user.ts | 1 -
src/views/system/user/index.vue | 7 +++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index fcdc115..086d45c 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -28,7 +28,6 @@ const getSelectedProjectFromStorage = () => {
const getProjectTeamListFromStorage = () => {
const stored = $cache.local.getJSON('ProjectTeamList');
console.log('获取缓存的项目班组列表:', stored);
-
return stored ? stored : null;
};
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 3fcf274..da397cf 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -324,6 +324,7 @@ import { globalHeaders } from '@/utils/request';
import { to } from 'await-to-js';
import { getProjectByDeptId, getRoleList, optionselect } from '@/api/system/post';
import ShuttleFrame from '../../project/projectRelevancy/component/ShuttleFrame.vue';
+import { listProject } from '@/api/project/project';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -484,6 +485,8 @@ const getDeptTree = async () => {
const res = await api.deptTreeSelect({ isShow: '1' });
deptOptions.value = res.data;
enabledDeptOptions.value = filterDisabledDept(res.data);
+ const projectList = await listProject();
+ projectOptions.value = projectList.rows;
};
/** 过滤禁用的部门 */
@@ -672,8 +675,6 @@ const handleUpdate = async (row?: UserForm) => {
form.value.projectRoles = data.projectRoles;
form.value.password = '';
const roleList = await getRoleList(form.value.deptId);
- const projectList = await getProjectByDeptId(form.value.deptId);
- projectOptions.value = projectList.data;
roleOptions.value = roleList.data;
};
@@ -736,8 +737,6 @@ onMounted(() => {
async function handleDeptChange(value: number | string) {
const response = await optionselect(value);
const roleList = await getRoleList(value);
- const projectList = await getProjectByDeptId(value);
- projectOptions.value = projectList.data;
roleOptions.value = roleList.data;
postOptions.value = response.data;
From ade11772948c04886a1a47517c4d401712a2165a Mon Sep 17 00:00:00 2001
From: taoge1020
Date: Thu, 28 Aug 2025 23:32:17 +0800
Subject: [PATCH 21/21] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/design/appointment/index.ts | 8 +
src/api/design/drawingreview/index.ts | 9 +-
src/api/materials/materialIssue/index.ts | 7 +
src/components/Process/submitVerify.vue | 10 +
src/layout/components/Sidebar/SidebarItem.vue | 3 +-
src/views/design/appointment/index copy 2.vue | 804 ++++++++++
src/views/design/appointment/index.vue | 1294 ++++++++++-------
src/views/design/designChange/index.vue | 53 +-
src/views/design/designChange/indexEdit.vue | 44 +-
src/views/design/drawing/indexEdit.vue | 11 +-
src/views/design/drawingreview/detailForm.vue | 167 ++-
.../design/volumeCatalog/blueprintEdit.vue | 12 +-
src/views/design/volumeCatalog/index.vue | 1 -
src/views/design/volumeCatalog/indexEdit.vue | 16 +-
.../materialIssue/index.vue | 58 +-
.../landTransferLedger/index.vue | 81 +-
16 files changed, 1929 insertions(+), 649 deletions(-)
create mode 100644 src/views/design/appointment/index copy 2.vue
diff --git a/src/api/design/appointment/index.ts b/src/api/design/appointment/index.ts
index 61fdca8..9deefc3 100644
--- a/src/api/design/appointment/index.ts
+++ b/src/api/design/appointment/index.ts
@@ -27,3 +27,11 @@ export const systemUserList = (query) => {
params: query
});
};
+// 查询
+export const desUserList = (query) => {
+ return request({
+ url: '/design/drawingreviewReceipts/desUser/list',
+ method: 'get',
+ params: query
+ });
+};
diff --git a/src/api/design/drawingreview/index.ts b/src/api/design/drawingreview/index.ts
index d28e0be..7ed39e6 100644
--- a/src/api/design/drawingreview/index.ts
+++ b/src/api/design/drawingreview/index.ts
@@ -56,7 +56,7 @@ export const fillOutTheDesignVerificationForm = (data) => {
export const drawingreviewReceipts = (data) => {
return request({
url: '/design/drawingreviewReceipts',
- method: 'post',
+ method: 'put',
data
});
};
@@ -96,3 +96,10 @@ export const drawingreview = (id) => {
method: 'get'
});
};
+// 获取单据
+export const getDrawingreviewReceipts = (id) => {
+ return request({
+ url: '/design/drawingreviewReceipts/review/' + id,
+ method: 'get'
+ });
+};
diff --git a/src/api/materials/materialIssue/index.ts b/src/api/materials/materialIssue/index.ts
index a366fa6..99af31a 100644
--- a/src/api/materials/materialIssue/index.ts
+++ b/src/api/materials/materialIssue/index.ts
@@ -68,3 +68,10 @@ export const getMaterialName = (id: any) => {
method: 'get'
});
};
+//获取出库记录
+export const inventoryList = (id: any) => {
+ return request({
+ url: '/materials/materialIssue/inventory/list/' + id,
+ method: 'get'
+ });
+};
diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue
index 03000a9..f678b11 100644
--- a/src/components/Process/submitVerify.vue
+++ b/src/components/Process/submitVerify.vue
@@ -185,6 +185,10 @@ const props = defineProps({
taskVariables: {
type: Object as () => Record,
default: () => {}
+ },
+ businessId1: {
+ type: String,
+ default: ''
}
});
//遮罩层
@@ -336,6 +340,9 @@ const handleCompleteTask = async () => {
}
if (isDrawing.value) {
isShowSubmit.value = true;
+ nextTick(() => {
+ detailFormTeRef.value.getInfo(props.businessId1);
+ });
return;
}
await proxy?.$modal.confirm('是否确认提交?');
@@ -538,6 +545,9 @@ const handleTermination = async () => {
const handleTerminationTask = async () => {
if (isDrawing.value) {
isShowTermination.value = true;
+ nextTick(() => {
+ detailFormTeRef.value.getInfo(props.businessId);
+ });
return;
}
const params = {
diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue
index 8703d66..d1e745a 100644
--- a/src/layout/components/Sidebar/SidebarItem.vue
+++ b/src/layout/components/Sidebar/SidebarItem.vue
@@ -16,7 +16,7 @@
- {{ total }}
+
{
if (onlyOneChild.value.meta?.title == '我的待办' || props.item.meta?.title == '我的任务') {
console.log(44444444);
-
getWaitingList();
}
});
diff --git a/src/views/design/appointment/index copy 2.vue b/src/views/design/appointment/index copy 2.vue
new file mode 100644
index 0000000..d87d820
--- /dev/null
+++ b/src/views/design/appointment/index copy 2.vue
@@ -0,0 +1,804 @@
+
+
+
+
+
+
人员配置
+
请配置项目相关负责人员信息
+
+ 点击编辑
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
专业人员配置
+
+
+
+ 新增专业
+
+
+
+
+
+
+ 专业
+ 设计人员(可多选)
+ 校审人员(可多选)
+
+
+
+
+
+
+
+
+
+
+
+
+ handleMajorChange(val, configIndex)"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ checkDuplicate(person, 'designers', configIndex, personIndex)"
+ >
+
+
+
+
+
+
+
+
+
+ 暂无设计人员,请点击"添加设计人员"
+
+
+
+
+
+
+
+
+
+
+
+ checkDuplicate(person, 'reviewers', configIndex, personIndex)"
+ >
+
+
+
+
+
+
+
+
+
+ 暂无校审人员,请点击"添加校审人员"
+
+
+
+
+
+
+
+
+ 删除专业
+
+
+
+
+
+
+
+
+
+ 确认提交
+
+
+ 重置
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/design/appointment/index.vue b/src/views/design/appointment/index.vue
index 7e58d1f..644b26b 100644
--- a/src/views/design/appointment/index.vue
+++ b/src/views/design/appointment/index.vue
@@ -1,251 +1,365 @@
-
-
-
-
人员配置
-
请配置项目相关负责人员信息
-
- 点击编辑
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
人员配置
+
请配置项目相关负责人员信息
+
+ 点击编辑
+
-
-
-
-
专业人员配置
-
-
-
- 新增专业
-
-
-
-
-
-
- 专业
- 设计人员(可多选)
- 校审人员(可多选)
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
handleMajorChange(val, configIndex)"
+ v-model="form.designLeader"
+ placeholder="请选择设计负责人"
+ class="w-full transition-all duration-300 border-gray-300 focus:border-blue-400 focus:ring-1 focus:ring-blue-400"
>
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
- checkDuplicate(person, 'designers', configIndex, personIndex)"
- >
-
-
-
-
-
-
-
-
-
- 暂无设计人员,请点击"添加设计人员"
-
-
-
-
-
-
-
-
-
-
-
- checkDuplicate(person, 'reviewers', configIndex, personIndex)"
- >
-
-
-
-
-
-
-
-
-
- 暂无校审人员,请点击"添加校审人员"
-
-
-
-
-
-
-
-
- 删除专业
-
-
-
-
-
-
- 确认提交
-
-
- 重置
-
-
-
+
+
+
+
专业人员配置
+
+
+
+ 新增专业
+
+
+
+
+
+
+ 专业
+ 设计人员(可多选)
+ 校审人员(可多选)
+ 审定人员(可多选)
+ 审核人员(可多选)
+
+
+
+
+
+
+
+
+
+
+
+
+ handleMajorChange(val, configIndex)"
+ clearable
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ checkDuplicate(person, 'designers', configIndex, personIndex)"
+ >
+
+
+
+
+
+
+
+ 点击"添加"
+
+
+
+
+
+
+
+
+
+
+ checkDuplicate(person, 'reviewers', configIndex, personIndex)"
+ >
+
+
+
+
+
+
+
+ 点击"添加"
+
+
+
+
+
+
+
+
+
+
+ checkDuplicate(person, 'approved', configIndex, personIndex)"
+ >
+
+
+
+
+
+
+
+ 点击"添加"
+
+
+
+
+
+
+
+
+
+
+ checkDuplicate(person, 'auditor', configIndex, personIndex)"
+ >
+
+
+
+
+
+
+
+ 点击"添加"
+
+
+
+
+
+
+
+ 删除专业
+
+
+
+
+
+
+
+
+
+ 确认提交
+
+
+ 重置
+
+
+
+
diff --git a/src/views/design/designChange/index.vue b/src/views/design/designChange/index.vue
index d744c51..7ec17a6 100644
--- a/src/views/design/designChange/index.vue
+++ b/src/views/design/designChange/index.vue
@@ -44,7 +44,7 @@
-
+
@@ -64,19 +64,16 @@
+
+
+
+
+
- 上传
查看
- 通知单 0"
+ link
+ icon="plus"
+ v-hasPermi="['design:designChange:query']"
+ @click="handleViewUpdate(scope.row)"
+ >审核通知单
+ 查看通知单
+ 上传图纸
{
});
};
/** 查看详情 */
+const handleViewUpdate = (row) => {
+ proxy.$tab.closePage(proxy.$route);
+ proxy.$router.push({
+ path: `/approval/designChange/indexEdit`,
+ query: {
+ id: row.id,
+ type: 'update'
+ }
+ });
+};
+/** 查看详情 */
const handleViewDetail = (row) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
diff --git a/src/views/design/designChange/indexEdit.vue b/src/views/design/designChange/indexEdit.vue
index d10fdca..428be39 100644
--- a/src/views/design/designChange/indexEdit.vue
+++ b/src/views/design/designChange/indexEdit.vue
@@ -145,7 +145,7 @@
>
-
@@ -348,8 +348,11 @@ const getInfo = () => {
loading.value = true;
buttonLoading.value = false;
nextTick(async () => {
- const res = await getDesignChange(routeParams.value.id);
+ let id = routeParams.value.id.split('_')[0];
+ const res = await getDesignChange(id);
Object.assign(form.value, res.data);
+ console.log(form.value);
+
if (form.value.changeReason.length > 0) {
form.value.changeReason = form.value.changeReason.split(',');
}
@@ -374,24 +377,26 @@ const submitForm = (status1: string) => {
if (form.value.saveFile && form.value.saveFile.length > 0) {
saveFile = form.value.saveFile.join(',');
}
- }
- leaveFormRef.value?.validate(async (valid: boolean) => {
- if (valid) {
- buttonLoading.value = true;
- var res;
- res = await addDesignChange({ ...form.value, changeReason, saveFile }).finally(() => (buttonLoading.value = false));
- if (res.code == 200) {
- if (form.value.costEstimation == '0') {
- ElMessage.success('通知成功');
- goBack();
+ leaveFormRef.value?.validate(async (valid: boolean) => {
+ if (valid) {
+ buttonLoading.value = true;
+ var res;
+ res = await addDesignChange({ ...form.value, changeReason, saveFile }).finally(() => (buttonLoading.value = false));
+ if (res.code == 200) {
+ if (form.value.costEstimation == '0') {
+ ElMessage.success('通知成功');
+ goBack();
+ } else {
+ submit(status.value, res.data);
+ }
} else {
- submit(status.value, res.data);
+ ElMessage.error(res.msg);
}
- } else {
- ElMessage.error(res.msg);
}
- }
- });
+ });
+ } else {
+ submit(status.value, form.value);
+ }
};
const submitFlow = async () => {
@@ -429,14 +434,15 @@ const submitCallback = async () => {
};
//审批
const approvalVerifyOpen = async () => {
- submitVerifyRef.value.openDialog(routeParams.value.taskId, true, routeParams.value.businessId);
- // submitVerifyRef.value.openDialog(routeParams.value.taskId);
+ // submitVerifyRef.value.openDialog(routeParams.value.taskId, true, routeParams.value.businessId);
+ submitVerifyRef.value.openDialog(routeParams.value.taskId);
};
// 图纸上传成功之后 开始提交
const route = useRoute();
const router = useRouter();
const submit = async (status, data) => {
form.value = data;
+ form.value.id = form.value.id + '_audit';
if (status === 'draft') {
buttonLoading.value = false;
proxy?.$modal.msgSuccess('暂存成功');
diff --git a/src/views/design/drawing/indexEdit.vue b/src/views/design/drawing/indexEdit.vue
index 0f5489d..42b1999 100644
--- a/src/views/design/drawing/indexEdit.vue
+++ b/src/views/design/drawing/indexEdit.vue
@@ -36,7 +36,7 @@
-
+
{
};
//审批
const approvalVerifyOpen = async () => {
- submitVerifyRef.value.openDialog(routeParams.value.taskId, true, routeParams.value.businessId);
- // submitVerifyRef.value.openDialog(routeParams.value.taskId);
+ // 判断是否还需要设计验证
+ if (form.value.isWindow) {
+ submitVerifyRef.value.openDialog(routeParams.value.taskId, true, routeParams.value.businessId);
+ } else {
+ submitVerifyRef.value.openDialog(routeParams.value.taskId);
+ }
};
// 图纸上传成功之后 开始提交
const submit = async (status, data) => {
form.value = data;
- form.value.id = routeParams.value.type == 'add' ? form.value.id + '_' : form.value.id.split('_')[0];
form.value.status = data.auditStatus ? data.auditStatus : data.status;
if (status === 'draft') {
buttonLoading.value = false;
diff --git a/src/views/design/drawingreview/detailForm.vue b/src/views/design/drawingreview/detailForm.vue
index b836c41..e997e12 100644
--- a/src/views/design/drawingreview/detailForm.vue
+++ b/src/views/design/drawingreview/detailForm.vue
@@ -11,12 +11,17 @@
-
+
-
-
+
+
+
+
+
+
+
@@ -24,14 +29,8 @@
-
-
-
-
-
-