产值管理审批流
This commit is contained in:
@ -53,14 +53,16 @@
|
||||
</transition>-->
|
||||
<el-row :gutter="20">
|
||||
<!-- 流程分类树 -->
|
||||
<el-col :lg="4" :xs="24" style="">
|
||||
<el-col style="" :span="5">
|
||||
<el-card shadow="hover">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5" :offset="0"
|
||||
><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col
|
||||
>
|
||||
<el-col :span="1.5" :offset="0"><el-button type="danger" size="default" @click="" icon="FolderDelete" plain>删除</el-button></el-col>
|
||||
<el-col :span="1.5" :offset="0"
|
||||
><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col
|
||||
>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
@ -82,10 +84,11 @@
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getBatchList"
|
||||
layout="prev, pager, next,jumper"
|
||||
/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :lg="20" :xs="24">
|
||||
<el-col :span="19">
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
@ -114,10 +117,13 @@
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['cailiaoshebei:cailiaoshebei:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['out:monthPlan:remove']">审核</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -186,7 +192,7 @@
|
||||
<el-input v-model="form.supplierId" placeholder="请输入供货商ID" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="供货商" prop="supplier">
|
||||
<el-select v-model="form.supplierId" value-key="id" placeholder="请选择供货商" clearable filterable @change="handleChange">
|
||||
<el-select v-model="selectValue" value-key="id" multiple placeholder="请选择供货商" clearable filterable>
|
||||
<el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -246,7 +252,8 @@ import {
|
||||
addCailiaoshebei,
|
||||
updateCailiaoshebei,
|
||||
listBatch,
|
||||
getBatch
|
||||
getBatch,
|
||||
delBatch
|
||||
} from '@/api/materials/cailiaoshebei';
|
||||
import { CailiaoshebeiVO, CailiaoshebeiQuery, CailiaoshebeiForm } from '@/api/materials/cailiaoshebei/types';
|
||||
import { listContractor } from '@/api/project/contractor';
|
||||
@ -292,6 +299,7 @@ const initFormData: CailiaoshebeiForm = {
|
||||
unit: undefined,
|
||||
plan: undefined,
|
||||
realQuantity: undefined,
|
||||
approvalDesign: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
remark: undefined
|
||||
};
|
||||
@ -335,11 +343,14 @@ const getList = async () => {
|
||||
//查询批次列表
|
||||
const getBatchList = async () => {
|
||||
const res = await listBatch(queryParams.value);
|
||||
console.log('🚀 ~ getBatchList ~ res:', res);
|
||||
batchOptions.value = res.rows;
|
||||
total.value = res.total;
|
||||
try {
|
||||
batchTreeRef.value.setCurrentKey(res.rows[0].batchNumber);
|
||||
queryParams.value.batchNumber = res.rows[0].batchNumber;
|
||||
form.value.batchNumber = res.rows[0].batchNumber;
|
||||
form.value.batchId = res.rows[0].id;
|
||||
} catch (error) {
|
||||
form.value.batchNumber = '';
|
||||
}
|
||||
@ -351,7 +362,7 @@ const getBatchList = async () => {
|
||||
const handleNodeClick = (data: any) => {
|
||||
queryParams.value.batchNumber = data.batchNumber;
|
||||
form.value.batchNumber = data.batchNumber;
|
||||
console.log('🚀 ~ handleNodeClick ~ form.value:', form.value);
|
||||
form.value.batchId = data.id;
|
||||
if (data.batchNumber === '0') {
|
||||
queryParams.value.batchNumber = '';
|
||||
}
|
||||
@ -403,10 +414,20 @@ const handleUpdate = async (row?: CailiaoshebeiVO) => {
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getCailiaoshebei(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
selectValue.value = (form.value.supplierId as string).split(',');
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改物资-材料设备';
|
||||
};
|
||||
|
||||
/** 审核按钮操作 */
|
||||
const handleAudit = async () => {
|
||||
proxy?.$tab.openPage('/materials-management/cailiaoshebei/indexEdit', '审核材料设备设计', {
|
||||
id: form.value.batchId,
|
||||
number: form.value.batchNumber,
|
||||
type: 'update'
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
console.log('🚀 ~ submitForm ~ form.value:', form.value);
|
||||
@ -428,12 +449,22 @@ const submitForm = () => {
|
||||
/** 新增批次 */
|
||||
const addBatch = async () => {
|
||||
await proxy?.$modal.confirm('是否确认新增批次?').finally(() => (loading.value = false));
|
||||
const res = await getBatch({
|
||||
projectId: currentProject.value.id
|
||||
});
|
||||
const res = await getBatch({ projectId: currentProject.value.id });
|
||||
console.log('🚀 ~ addBatch ~ res:', res);
|
||||
await getBatchList();
|
||||
|
||||
proxy?.$modal.msgSuccess('新增成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 删除批次 */
|
||||
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.batchNumber = '';
|
||||
|
||||
await getBatchList();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
@ -467,14 +498,37 @@ const getSupplierList = async () => {
|
||||
supplierOptions.value = res.rows;
|
||||
};
|
||||
|
||||
/** 供货商选择器改变事件 */
|
||||
const handleChange = (value: string) => {
|
||||
const selectedOption = supplierOptions.value.find((item) => item.id === value);
|
||||
form.value.supplier = selectedOption?.name || '';
|
||||
};
|
||||
// 中间数组变量供 el-select 使用
|
||||
const selectValue = ref<string[]>([]);
|
||||
|
||||
// 监听 selectValue,每次变化时同步更新 form.supplierId 和 form.supplier
|
||||
watch(
|
||||
selectValue,
|
||||
(newVal) => {
|
||||
form.value.supplierId = newVal.join(',');
|
||||
const selectedNames = supplierOptions.value.filter((opt) => newVal.includes(opt.id)).map((opt) => opt.name);
|
||||
form.value.supplier = selectedNames.join(',');
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
getBatchList();
|
||||
getSupplierList();
|
||||
});
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getBatchList();
|
||||
getSupplierList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user