From dc0308d8f66c34cdf90f926af1455f865285b0e5 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: 星期四, 27 十一月 2025 09:00:29 +0800
Subject: [PATCH] 修改新增
---
src/views/work/qualityManage/productAndServe/finalInspecte/index.vue | 58 +++++++++++++++++-
src/views/work/qualityManage/productAndServe/processInspecte/index.vue | 61 ++++++++++++++++++--
src/views/work/qualityManage/productAndServe/finalInspecte/components/editDialog.vue | 9 ++-
src/views/work/qualityManage/productAndServe/processInspecte/components/editDialog.vue | 9 ++-
4 files changed, 119 insertions(+), 18 deletions(-)
diff --git a/src/views/work/qualityManage/productAndServe/finalInspecte/components/editDialog.vue b/src/views/work/qualityManage/productAndServe/finalInspecte/components/editDialog.vue
index 0c09e07..d7eb270 100644
--- a/src/views/work/qualityManage/productAndServe/finalInspecte/components/editDialog.vue
+++ b/src/views/work/qualityManage/productAndServe/finalInspecte/components/editDialog.vue
@@ -83,7 +83,8 @@
format: '',
companyId: null,
deptId:null,
- type:2
+ type:2,
+ itemId: null
},
formRules:{
companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
@@ -105,13 +106,14 @@
});
-const openDialog = async (type, value,companyId, isAdmin, companyList) => {
+const openDialog = async (type, value,companyId, isAdmin, companyList,itemId) => {
state.isAdmin = isAdmin
if(isAdmin){
state.companyList = companyList
}
state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
state.form.companyId = companyId
+ state.form.itemId = itemId
if(state.title == '编辑'||state.title == '查看'){
Object.keys(state.form).forEach(key => {
if (key in value) {
@@ -229,7 +231,8 @@
format: '',
companyId: null,
deptId:null,
- type:2
+ type:2,
+ itemId: null
}
state.fileList = []
superRef.value.clearValidate();
diff --git a/src/views/work/qualityManage/productAndServe/finalInspecte/index.vue b/src/views/work/qualityManage/productAndServe/finalInspecte/index.vue
index 37da7db..b88d466 100644
--- a/src/views/work/qualityManage/productAndServe/finalInspecte/index.vue
+++ b/src/views/work/qualityManage/productAndServe/finalInspecte/index.vue
@@ -21,6 +21,20 @@
</el-option>
</el-select>
</el-form-item>
+ <el-form-item style="margin-left: 15px" label="项目名称:">
+ <el-select v-model="queryParams.itemId"
+ filterable
+ placeholder="请选择"
+ clearable style="width: 100%"
+ >
+ <el-option
+ v-for="item in projectList"
+ :key="item.id"
+ :label="item.itemName"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
<el-form-item >
<el-button v-if="isAdmin" type="primary" @click="getList">查询</el-button>
<el-button v-if="isAdmin" type="primary" plain @click="reset">重置</el-button>
@@ -67,6 +81,7 @@
import {getStandardTemp,delStandardTemp} from "@/api/standardSys/standardSys";
import { renderAsync } from "docx-preview";
import {delInspection, getInspection} from "@/api/productAndServe";
+import {getProductSet} from "@/api/selfProblems/productFile";
const userStore = useUserStore()
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -76,15 +91,18 @@
pageNum: 1,
pageSize: 10,
companyId: null,
- type:2
+ type:2,
+ itemId: null
},
total: 0,
dataList: [],
companyList: [],
- isAdmin: false
+ isAdmin: false,
+ projectList: [],
+ userId: null,
});
-const { queryParams, total, dataList,companyList, isAdmin } = toRefs(data);
+const { queryParams, total, dataList,companyList, isAdmin, projectList } = toRefs(data);
const userInfo = ref()
onMounted(async ()=>{
if(userStore.roles.includes('admin')){
@@ -94,7 +112,9 @@
data.isAdmin = false
data.queryParams.companyId = userStore.companyId
}
+ data.userId = userStore.id
await getList()
+ await getProjectList()
})
onUnmounted(()=>{
@@ -176,12 +196,39 @@
}
}
+const getProjectList = async () => {
+ const param = {
+ companyId: data.queryParams.companyId,
+ userId: data.isAdmin ? null : data.userId
+ }
+ const res = await getProductSet(param);
+ if(res.code === 200){
+ data.projectList = res.data
+ // if(res.data && res.data.length >0 ){
+ // data.queryParams.itemId = res.data[0].id
+ // }
+ }else{
+ ElMessage.warning(res.message)
+ }
+
+}
+
const downloadFile = (path)=>{
window.open(import.meta.env.VITE_APP_BASE_API + '/' + path)
}
const openDialog = (type, value) => {
- dialogRef.value.openDialog(type, value, data.queryParams.companyId, data.isAdmin, data.companyList);
+ if(type === 'add' ){
+ if(!data.queryParams.companyId){
+ ElMessage.warning('请选择单位')
+ return
+ }
+ if(!data.queryParams.itemId){
+ ElMessage.warning('请先选择项目!')
+ return
+ }
+ }
+ dialogRef.value.openDialog(type, value, data.queryParams.companyId, data.isAdmin, data.companyList,data.queryParams.itemId);
}
/** 重置新增的表单以及其他数据 */
@@ -190,7 +237,8 @@
pageNum: 1,
pageSize: 10,
companyId: null,
- type:2
+ type:2,
+ itemId: null
}
await getCompanyList()
await getList()
diff --git a/src/views/work/qualityManage/productAndServe/processInspecte/components/editDialog.vue b/src/views/work/qualityManage/productAndServe/processInspecte/components/editDialog.vue
index 7a41fb3..fdf564c 100644
--- a/src/views/work/qualityManage/productAndServe/processInspecte/components/editDialog.vue
+++ b/src/views/work/qualityManage/productAndServe/processInspecte/components/editDialog.vue
@@ -83,7 +83,8 @@
format: '',
companyId: null,
deptId:null,
- type: 1
+ type: 1,
+ itemId: null
},
formRules:{
companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
@@ -105,13 +106,14 @@
});
-const openDialog = async (type, value,companyId, isAdmin, companyList) => {
+const openDialog = async (type, value,companyId, isAdmin, companyList,itemId) => {
state.isAdmin = isAdmin
if(isAdmin){
state.companyList = companyList
}
state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
state.form.companyId = companyId
+ state.form.itemId = itemId
if(state.title == '编辑'||state.title == '查看'){
Object.keys(state.form).forEach(key => {
if (key in value) {
@@ -229,7 +231,8 @@
format: '',
companyId: null,
deptId:null,
- type: 1
+ type: 1,
+ itemId: null
}
state.fileList = []
superRef.value.clearValidate();
diff --git a/src/views/work/qualityManage/productAndServe/processInspecte/index.vue b/src/views/work/qualityManage/productAndServe/processInspecte/index.vue
index 11cf688..d664acb 100644
--- a/src/views/work/qualityManage/productAndServe/processInspecte/index.vue
+++ b/src/views/work/qualityManage/productAndServe/processInspecte/index.vue
@@ -12,11 +12,25 @@
>新增</el-button>
</el-form-item>
<el-form-item v-if="isAdmin" label="单位:" >
- <el-select v-model="data.queryParams.companyId" placeholder="请选择" clearable>
+ <el-select v-model="queryParams.companyId" placeholder="请选择" clearable>
<el-option
v-for="item in companyList"
:key="item.id"
:label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item style="margin-left: 15px" label="项目名称:">
+ <el-select v-model="queryParams.itemId"
+ filterable
+ placeholder="请选择"
+ clearable style="width: 100%"
+ >
+ <el-option
+ v-for="item in projectList"
+ :key="item.id"
+ :label="item.itemName"
:value="item.id">
</el-option>
</el-select>
@@ -67,6 +81,7 @@
import {getStandardTemp,delStandardTemp} from "@/api/standardSys/standardSys";
import { renderAsync } from "docx-preview";
import {delInspection, getInspection} from "@/api/productAndServe";
+import {getProductSet} from "@/api/selfProblems/productFile";
const userStore = useUserStore()
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -76,15 +91,18 @@
pageNum: 1,
pageSize: 10,
companyId: null,
- type: 1
+ type: 1,
+ itemId: null
},
total: 0,
dataList: [],
companyList: [],
- isAdmin: false
+ projectList: [],
+ isAdmin: false,
+ userId: null,
});
-const { queryParams, total, dataList,companyList, isAdmin } = toRefs(data);
+const { queryParams, total, dataList,companyList, isAdmin, projectList } = toRefs(data);
const userInfo = ref()
onMounted(async ()=>{
if(userStore.roles.includes('admin')){
@@ -94,7 +112,9 @@
data.isAdmin = false
data.queryParams.companyId = userStore.companyId
}
+ data.userId = userStore.id
await getList()
+ await getProjectList()
})
onUnmounted(()=>{
@@ -147,7 +167,6 @@
loading.value = true
const res = await getInspection(data.queryParams)
if(res.code == 200){
- console.log(res.data,'data')
data.dataList = res.data.list || []
data.dataList = data.dataList.map(item => {
return {
@@ -160,6 +179,23 @@
ElMessage.warning(res.message)
}
loading.value = false
+}
+
+const getProjectList = async () => {
+ const param = {
+ companyId: data.queryParams.companyId,
+ userId: data.isAdmin ? null : data.userId
+ }
+ const res = await getProductSet(param);
+ if(res.code === 200){
+ data.projectList = res.data
+ // if(res.data && res.data.length >0 ){
+ // data.queryParams.itemId = res.data[0].id
+ // }
+ }else{
+ ElMessage.warning(res.message)
+ }
+
}
const getCompanyList = async ()=>{
@@ -181,7 +217,17 @@
}
const openDialog = (type, value) => {
- dialogRef.value.openDialog(type, value, data.queryParams.companyId, data.isAdmin, data.companyList);
+ if(type === 'add' ){
+ if(!data.queryParams.companyId){
+ ElMessage.warning('请选择单位')
+ return
+ }
+ if(!data.queryParams.itemId){
+ ElMessage.warning('请先选择项目!')
+ return
+ }
+ }
+ dialogRef.value.openDialog(type, value, data.queryParams.companyId, data.isAdmin, data.companyList, data.queryParams.itemId)
}
/** 重置新增的表单以及其他数据 */
@@ -190,7 +236,8 @@
pageNum: 1,
pageSize: 10,
companyId: null,
- type: 1
+ type: 1,
+ itemId: null
}
await getCompanyList()
await getList()
--
Gitblit v1.9.2