装备新增属性
This commit is contained in:
parent
31ffdd2b3c
commit
84760ba32c
|
|
@ -124,6 +124,16 @@
|
|||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="qcTime" label="合同附件">
|
||||
<template #default="{ row }">
|
||||
<a
|
||||
:href="row.url"
|
||||
target="_blank"
|
||||
style="color: #00a288; text-decoration: underline"
|
||||
>查看</a
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="publishUser" label="创建时间" />
|
||||
<el-table-column align="center" prop="orderUser" label="更新时间" />
|
||||
<el-table-column align="center" label="操作" :width="220">
|
||||
|
|
@ -157,7 +167,7 @@
|
|||
:total="total"
|
||||
/> -->
|
||||
|
||||
<!-- 装备弹框 -->
|
||||
<!-- 新增和修改弹框 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisibleSettlein"
|
||||
:title="settleinTitle"
|
||||
|
|
|
|||
|
|
@ -426,17 +426,14 @@ const dialogTypeCascader = ref()
|
|||
// equipmentDeploymentParams.value.deviceCount = 1
|
||||
// countDisabled.value = true
|
||||
// }
|
||||
console.log('deviceTypeList',deviceTypeList[0].data.propertyNames)
|
||||
if(deviceTypeList[0].data.propertyNames==null){
|
||||
console.log('deviceTypeList',deviceTypeList[0].data.maTypeProperties)
|
||||
if(deviceTypeList[0].data.maTypeProperties==null){
|
||||
propertyNames.value=[]
|
||||
propertyNamesTwo.value=[]
|
||||
}else{
|
||||
propertyNames.value=[]
|
||||
propertyNamesTwo.value=[]
|
||||
propertyNamesTwo.value.push({'propertyName':null,'propertyValue':null})
|
||||
deviceTypeList[0].data.propertyNames.forEach((item:any) =>{
|
||||
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<any>([
|
|||
// }
|
||||
])
|
||||
|
||||
//新增属性
|
||||
const addPartItem = () => {
|
||||
propertyNamesTwo.value.push({'propertyName':null,'propertyValue':null});
|
||||
}
|
||||
|
||||
const removePartItem = (index:any)=> {
|
||||
if (propertyNamesTwo.value.length > 1) {
|
||||
propertyNamesTwo.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -1445,27 +1488,27 @@ const options = ref<any>([
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
|
||||
<div
|
||||
v-for="(item, index) in propertyNamesTwo"
|
||||
v-for="(item, index) in propertyNames"
|
||||
:key="index"
|
||||
:model="item"
|
||||
class="dynamic-item"
|
||||
>
|
||||
<el-row :gutter="20" style="display: flex;margin-top:10px;justify-content: left;">
|
||||
<el-col :span="14" >
|
||||
<el-form-item >
|
||||
<el-col :span="7" style="justify-content: left;">
|
||||
<el-select v-model="item.propertyName" placeholder="请选择" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="属性描述:" :rules="getProertyNameRules(item)" prop="propertyName">
|
||||
<el-input
|
||||
v-model="item.propertyName"
|
||||
placeholder="请输入"
|
||||
maxlength="20"
|
||||
style="width: 350px;"
|
||||
disabled
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="7" >
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="属性值:" :rules="getProertyValueRules(item)" prop="propertyValue">
|
||||
<el-input
|
||||
v-model="item.propertyValue"
|
||||
placeholder="请输入"
|
||||
|
|
@ -1473,24 +1516,7 @@ const options = ref<any>([
|
|||
style="width: 350px;"
|
||||
>
|
||||
</el-input>
|
||||
</el-col>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="6"
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
"
|
||||
>
|
||||
<div style="">
|
||||
<el-button @click="addPartItem" type="success"> 新增属性</el-button>
|
||||
<el-button @click="removePartItem(index)" v-if="index != 0" type="danger">
|
||||
删除属性</el-button
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue