|
@@ -26,11 +26,11 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="品牌" prop="brand">
|
|
|
+ <el-form-item label="品牌" prop="brandName">
|
|
|
<el-select
|
|
|
clearable
|
|
|
- v-model="formData.brand"
|
|
|
- :model-value="brandLabel"
|
|
|
+ v-model="formData.brandName"
|
|
|
+ @clear="brandClear"
|
|
|
placeholder="请输入品牌"
|
|
|
@click="openForm"
|
|
|
/>
|
|
@@ -39,15 +39,21 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="所在部门" prop="deptId">
|
|
|
<el-tree-select
|
|
|
- clearable
|
|
|
v-model="formData.deptId"
|
|
|
:data="deptList"
|
|
|
:props="defaultProps"
|
|
|
check-strictly
|
|
|
node-key="id"
|
|
|
- filterable
|
|
|
placeholder="请选择所在部门"
|
|
|
/>
|
|
|
+<!-- <el-tree-select-->
|
|
|
+<!-- v-model="formData.deptId"-->
|
|
|
+<!-- :data="deptList"-->
|
|
|
+<!-- :props="defaultProps"-->
|
|
|
+<!-- check-strictly-->
|
|
|
+<!-- node-key="id"-->
|
|
|
+<!-- placeholder="请选择归属部门"-->
|
|
|
+<!-- />-->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
@@ -90,7 +96,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8" >
|
|
|
<div style="display: flex;flex-direction: row">
|
|
|
- <el-form-item label="规格型号" prop="model" style="width: 85%">
|
|
|
+ <el-form-item label="规格型号" prop="model" style="width: 86%">
|
|
|
<el-input
|
|
|
clearable
|
|
|
v-model="formData.model"
|
|
@@ -129,8 +135,9 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="制造商" prop="manufacturerId">
|
|
|
<el-select
|
|
|
- v-model="formData.manufacturerId"
|
|
|
- :model-value="zzLabel"
|
|
|
+ clearable
|
|
|
+ @clear="zzClear"
|
|
|
+ v-model="formData.manufacturerName"
|
|
|
placeholder="请输入制造商"
|
|
|
@click="openCustomerZz"
|
|
|
/>
|
|
@@ -150,9 +157,10 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="供应商" prop="supplierId">
|
|
|
<el-select
|
|
|
- v-model="formData.supplierId"
|
|
|
+ clearable
|
|
|
+ @clear="supplierClear"
|
|
|
+ v-model="formData.supplierName"
|
|
|
placeholder="请输入供应商"
|
|
|
- :model-value="supplierLabel"
|
|
|
@click="openCustomerSupplier"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -364,6 +372,8 @@ const { params, name } = useRoute() // 查询参数
|
|
|
const { currentRoute, push } = useRouter()
|
|
|
|
|
|
const id = params.id
|
|
|
+const type = params.type
|
|
|
+const deptId = params.deptId
|
|
|
const isDetail = params.isDetail
|
|
|
const { t } = useI18n() // 国际化
|
|
|
const message = useMessage() // 消息弹窗
|
|
@@ -379,6 +389,7 @@ const formData = ref({
|
|
|
deviceCode: undefined,
|
|
|
deviceName: undefined,
|
|
|
brand: undefined,
|
|
|
+ brandName: undefined,
|
|
|
model: undefined,
|
|
|
deptId: undefined,
|
|
|
deviceStatus: undefined,
|
|
@@ -386,7 +397,9 @@ const formData = ref({
|
|
|
picUrl: undefined,
|
|
|
remark: undefined,
|
|
|
manufacturerId: undefined,
|
|
|
+ manufacturerName: undefined,
|
|
|
supplierId: undefined,
|
|
|
+ supplierName: undefined,
|
|
|
manDate: undefined,
|
|
|
nameplate: undefined,
|
|
|
expires: undefined,
|
|
@@ -421,7 +434,6 @@ const list = ref([])
|
|
|
|
|
|
const assetclasschange = () => {
|
|
|
const assetClass = formData.value.assetClass
|
|
|
- debugger
|
|
|
DeviceAttrModelApi.getDeviceAttrModelListByDeviceCategoryId(assetClass).then(res => {
|
|
|
if (res){
|
|
|
res.forEach((item) => {
|
|
@@ -432,7 +444,6 @@ const assetclasschange = () => {
|
|
|
}
|
|
|
})
|
|
|
list.value = res
|
|
|
- debugger
|
|
|
} else {
|
|
|
list.value = []
|
|
|
}
|
|
@@ -441,19 +452,33 @@ const assetclasschange = () => {
|
|
|
|
|
|
const brandChoose = (row) => {
|
|
|
formData.value.brand = row.id
|
|
|
- brandLabel.value = row.value
|
|
|
-
|
|
|
+ // brandLabel.value = row.value
|
|
|
+ formData.value.brandName = row.label
|
|
|
+}
|
|
|
+const brandClear = () =>{
|
|
|
+ formData.value.brand = undefined
|
|
|
+ formData.value.brandName = undefined
|
|
|
}
|
|
|
const modelChoose = (row) => {
|
|
|
formData.value.model = row.name
|
|
|
}
|
|
|
const customerSupplierChoose = (row) => {
|
|
|
formData.value.supplierId = row.id
|
|
|
- supplierLabel.value = row.name
|
|
|
+ formData.value.supplierName = row.name
|
|
|
+ // supplierLabel.value = row.name
|
|
|
+}
|
|
|
+const supplierClear = (row) => {
|
|
|
+ formData.value.supplierId = undefined
|
|
|
+ formData.value.supplierName = undefined
|
|
|
}
|
|
|
const customerZzChoose = (row) => {
|
|
|
formData.value.manufacturerId = row.id
|
|
|
- zzLabel.value = row.name
|
|
|
+ // zzLabel.value = row.name
|
|
|
+ formData.value.manufacturerName = row.name
|
|
|
+}
|
|
|
+const zzClear = () =>{
|
|
|
+ formData.value.manufacturerId = undefined
|
|
|
+ formData.value.manufacturerName = undefined
|
|
|
}
|
|
|
/** 添加/修改操作 */
|
|
|
const brandFormRef = ref()
|
|
@@ -545,10 +570,8 @@ const submitForm = async () => {
|
|
|
...item,
|
|
|
value: formData.value[item.code] // 自定义属性生成逻辑
|
|
|
}))
|
|
|
- debugger
|
|
|
formData.value.templateJson = JSON.stringify(list.value)
|
|
|
}
|
|
|
- debugger
|
|
|
const data = formData.value as unknown as IotDeviceVO
|
|
|
if (formType.value === 'create') {
|
|
|
await IotDeviceApi.createIotDevice(data)
|
|
@@ -560,12 +583,7 @@ const submitForm = async () => {
|
|
|
dialogVisible.value = false
|
|
|
// 发送操作成功的事件
|
|
|
//emit('success')
|
|
|
- delView(unref(currentRoute))
|
|
|
- await push({
|
|
|
- name: 'IotDevicePms', query: {
|
|
|
- date: new Date().getTime(),
|
|
|
- }
|
|
|
- })
|
|
|
+ close()
|
|
|
} finally {
|
|
|
formLoading.value = false
|
|
|
}
|
|
@@ -584,9 +602,9 @@ onMounted(async () => {
|
|
|
try {
|
|
|
const iotDevice = await IotDeviceApi.getIotDevice(id);
|
|
|
formData.value = iotDevice
|
|
|
- brandLabel.value = iotDevice.brandName;
|
|
|
- zzLabel.value = iotDevice.zzName;
|
|
|
- supplierLabel.value = iotDevice.supplierName;
|
|
|
+ formData.value.brandName = iotDevice.brandName;
|
|
|
+ formData.value.manufacturerName = iotDevice.zzName;
|
|
|
+ formData.value.supplierName = iotDevice.supplierName;
|
|
|
list.value = JSON.parse(iotDevice.templateJson);
|
|
|
list.value.forEach((item) => {
|
|
|
formData.value[item.code] = item.value;
|
|
@@ -595,6 +613,7 @@ onMounted(async () => {
|
|
|
formLoading.value = false
|
|
|
}
|
|
|
} else {
|
|
|
+ formData.value.deptId = Number(deptId)
|
|
|
formType.value = 'create';
|
|
|
}
|
|
|
})
|