From 84760ba32c36cdc6d947ac60d849b5d433ab0793 Mon Sep 17 00:00:00 2001
From: jjLv <1981429112@qq.com>
Date: Wed, 11 Dec 2024 16:05:45 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=A3=85=E5=A4=87=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E5=B1=9E=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/user/contract-manage/index.vue | 12 ++-
src/views/user/goodsManagement/index.vue | 132 ++++++++++++++---------
2 files changed, 90 insertions(+), 54 deletions(-)
diff --git a/src/views/user/contract-manage/index.vue b/src/views/user/contract-manage/index.vue
index d345fce..f48a21f 100644
--- a/src/views/user/contract-manage/index.vue
+++ b/src/views/user/contract-manage/index.vue
@@ -124,6 +124,16 @@
>
+
+
+ 查看
+
+
@@ -157,7 +167,7 @@
:total="total"
/> -->
-
+
{
- propertyNames.value.push({'propertyName':item,'propertyValue':null})
- options.value.push({'label':item,'value':item})
+ propertyNames.value = deviceTypeList[0].data.maTypeProperties;
+ deviceTypeList[0].data.maTypeProperties.forEach((item:any) =>{
+ options.value.push({'label':item.propertyName,'value':item.propertyName})
})
console.log(propertyNames.value)
}
@@ -539,6 +536,44 @@ const equipRules = ref({
// ],
})
+const maTypeRules = ref({
+ propertyName: [
+ {
+ required: true,
+ message: '请输入属性描述',
+ trigger: 'blur',
+ },
+ ],
+ propertyValue: [
+ {
+ required: true,
+ message: '请输入属性值',
+ trigger: 'blur',
+ },
+ ],
+
+})
+
+const getProertyNameRules = (item:any)=>{
+ if(item.mustHave ==1){
+ return [
+ {required: true, message: '请输入属性描述',trigger: 'blur',}
+ ]
+ }else{
+ return []
+ }
+}
+
+const getProertyValueRules = (item:any)=>{
+ if(item.mustHave ==1){
+ return [
+ {required: true, message: '请输入属性值',trigger: 'blur',}
+ ]
+ }else{
+ return []
+ }
+}
+
const descriptionRules = ref({
insurancePdfs: [{ required: true, message: '请上传合格证', trigger: 'change' }],
examinationPdfs: [{ required: true, message: '请上传检测证明', trigger: 'change' }],
@@ -611,7 +646,7 @@ const submitFun = (type: any) => {
...addAndEditForm.detailsFileList,
...addAndEditForm.detailsFileTempList,
]
-
+ addAndEditForm.devInfoProperties = propertyNames.value;
addAndEditFormRef.value.validate(async (valid: any) => {
if (valid) {
let isDescription = false
@@ -639,11 +674,29 @@ const submitFun = (type: any) => {
} catch (error) {}
}
+ // for(let index = 0;index < propertyNames.value.length;index++){
+ // try {
+ // const result = await new Promise((resolve,reject) => {
+ // addAndEditFormRef.value.validateField(`propertyNames[${index}].propertyValue`,(error) => {
+ // if(error){
+ // reject(error);
+ // }else{
+ // resolve(true);
+ // }
+ // })
+ // })
+
+ // if (!result) {
+ // isDescription = true
+ // throw new Error('表单校验失败')
+ // }
+ // } catch (error) {}
+ // }
if (isDescription) return
addAndEditForm.typeId =
addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1]
- addAndEditForm.devInfoProperties = propertyNamesTwo.value;
+
let SEND_FUN_API: any = null
if (type == 1) {
SEND_FUN_API = equipmentAddApi
@@ -1021,16 +1074,6 @@ const options = ref([
// }
])
- //新增属性
- const addPartItem = () => {
- propertyNamesTwo.value.push({'propertyName':null,'propertyValue':null});
- }
-
- const removePartItem = (index:any)=> {
- if (propertyNamesTwo.value.length > 1) {
- propertyNamesTwo.value.splice(index, 1);
- }
- }
@@ -1445,27 +1488,27 @@ const options = ref([
-->
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
+
([
style="width: 350px;"
>
-
-
-
-
-
-
- 新增属性
-
- 删除属性
-
+
From 871fa7ff277dc120758842d0ac46a1e02212b1ef Mon Sep 17 00:00:00 2001
From: jjLv <1981429112@qq.com>
Date: Wed, 11 Dec 2024 18:09:23 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=A3=85=E5=A4=87=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E5=B1=9E=E6=80=A7=E5=BF=85=E5=A1=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/user/goodsManagement/index.vue | 84 ++++--------------------
1 file changed, 14 insertions(+), 70 deletions(-)
diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue
index ef6523b..5a4f311 100644
--- a/src/views/user/goodsManagement/index.vue
+++ b/src/views/user/goodsManagement/index.vue
@@ -71,12 +71,6 @@ const getSelectId = (list: any, id: any) => {
for (let i in list) {
if (list[i].id == id) {
//查询到就返回该数组对象的value
- console.log('21',list[i].propertyNames)
- if( list[i].propertyNames!=null){
- list[i].propertyNames.forEach((item:any) =>{
- options.value.push({'label':item,'value':item})
- })
- }
return [list[i].id]
}
if (list[i].children) {
@@ -180,11 +174,7 @@ const maId: any = ref('')
const editRowInfo = (row: any) => {
settleinTitle.value = '装备编辑'
getDetailData(row)
- if(row.devInfoProperties!=null){
- row.devInfoProperties.forEach((item:any)=>{
- propertyNamesTwo.value.push({'propertyName':item.propertyName,'propertyValue':item.propertyValue})
- })
- }
+
disabledForm.value = false
isEditDisabled.value = true
isViewForm.value = false
@@ -291,11 +281,7 @@ const getDetailData = async (row: any) => {
descriptionFormList.value[0].examinationPdfs = examinationPdf
options.value=[]
addAndEditForm.deviceTypeList = getSelectId(deviceTypeTree.value, addAndEditForm.typeId)
- if(res.devInfoProperties!=null){
- res.devInfoProperties.forEach((item:any)=>{
- propertyNamesTwo.value.push({'propertyName':item.propertyName,'propertyValue':item.propertyValue})
- })
- }
+ propertyNames.value = addAndEditForm.devInfoProperties
// addAndEditForm.deviceTypeList[0].data.propertyNames.forEach((item:any) =>{
// options.value.push({'label':item,'value':item})
// })
@@ -536,23 +522,6 @@ const equipRules = ref({
// ],
})
-const maTypeRules = ref({
- propertyName: [
- {
- required: true,
- message: '请输入属性描述',
- trigger: 'blur',
- },
- ],
- propertyValue: [
- {
- required: true,
- message: '请输入属性值',
- trigger: 'blur',
- },
- ],
-
-})
const getProertyNameRules = (item:any)=>{
if(item.mustHave ==1){
@@ -646,7 +615,7 @@ const submitFun = (type: any) => {
...addAndEditForm.detailsFileList,
...addAndEditForm.detailsFileTempList,
]
- addAndEditForm.devInfoProperties = propertyNames.value;
+
addAndEditFormRef.value.validate(async (valid: any) => {
if (valid) {
let isDescription = false
@@ -674,26 +643,9 @@ const submitFun = (type: any) => {
} catch (error) {}
}
- // for(let index = 0;index < propertyNames.value.length;index++){
- // try {
- // const result = await new Promise((resolve,reject) => {
- // addAndEditFormRef.value.validateField(`propertyNames[${index}].propertyValue`,(error) => {
- // if(error){
- // reject(error);
- // }else{
- // resolve(true);
- // }
- // })
- // })
-
- // if (!result) {
- // isDescription = true
- // throw new Error('表单校验失败')
- // }
- // } catch (error) {}
- // }
if (isDescription) return
+ addAndEditForm.devInfoProperties = propertyNames.value;
addAndEditForm.typeId =
addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1]
@@ -715,7 +667,7 @@ const submitFun = (type: any) => {
message: '保存成功',
duration: 1000,
})
- propertyNamesTwo.value = []
+ propertyNames.value = []
dialogFormVisibleSettlein.value = false
getList()
}
@@ -736,13 +688,16 @@ const saveTemp = async () => {
/* 关闭按钮 */
const closeDialogBtn = () => {
// ruleFormRef.value.resetFields()
+ propertyNames.value = []
+ // 获取装备树
+ getTypeTreeData()
dialogFormVisibleSettlein.value = false
}
/* 关闭对话框 */
const handleClose = (done: () => void) => {
// ruleFormRef.value.resetFields()
done()
- propertyNamesTwo.value = []
+ propertyNames.value = []
dialogFormVisibleSettlein.value = false
}
@@ -779,6 +734,7 @@ const successResultCallBackFnDevicePic = (val: any) => {
const mainFileList: any = ref([]) //主展示
const detailsFileList: any = ref([]) //详情展示
+const maTypeProperties: any = ref([]) //属性
const insurancePdf: any = ref([]) //合格证
const examinationPdf: any = ref([]) //检测证明
//图片查看弹窗
@@ -944,6 +900,7 @@ const addAndEditForm = reactive({
examinationPdf: [],
insurancePdfs: [],
examinationPdfs: [],
+ devInfoProperties:[],
})
const addAndEditFormTemp = reactive({
deviceName: '',
@@ -1059,20 +1016,7 @@ const propertyNames = ref([
])
const propertyNamesTwo = ref([
])
-const options = ref([
- // {
- // label:'重量',
- // value:1
- // },
- // {
- // label:'宽度',
- // value:2
- // },
- // {
- // label:'长度',
- // value:3
- // }
-])
+const options = ref([])
@@ -1496,7 +1440,7 @@ const options = ref([
>
-
+
([
-
+