|
@@ -1,6 +1,12 @@
|
|
|
<template>
|
|
<template>
|
|
|
<ContentWrap v-loading="formLoading">
|
|
<ContentWrap v-loading="formLoading">
|
|
|
- <el-form ref="formRef" :model="formData" :rules="formRules" style="margin-right: 4em;margin-left: 0.5em" label-width="130px">
|
|
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="formRef"
|
|
|
|
|
+ :model="formData"
|
|
|
|
|
+ :rules="formRules"
|
|
|
|
|
+ style="margin-right: 4em; margin-left: 0.5em"
|
|
|
|
|
+ label-width="130px"
|
|
|
|
|
+ >
|
|
|
<div class="title-div">
|
|
<div class="title-div">
|
|
|
<el-button @click="baseInfoClick" class="title-button">
|
|
<el-button @click="baseInfoClick" class="title-button">
|
|
|
<Icon color="black" icon="ep:set-up" :size="18" class="cursor-pointer first-icon" />
|
|
<Icon color="black" icon="ep:set-up" :size="18" class="cursor-pointer first-icon" />
|
|
@@ -18,24 +24,33 @@
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('iotDevice.yfClass')" prop="yfClass">
|
|
<el-form-item :label="t('iotDevice.yfClass')" prop="yfClass">
|
|
|
<el-cascader
|
|
<el-cascader
|
|
|
- :disabled="formType==='update'&&formData.yfDeviceCode"
|
|
|
|
|
|
|
+ :disabled="formType === 'update' && formData.yfDeviceCode"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
v-model="formData.yfClass"
|
|
v-model="formData.yfClass"
|
|
|
:options="yfclasses"
|
|
:options="yfclasses"
|
|
|
:props="{ expandTrigger: 'hover' }"
|
|
:props="{ expandTrigger: 'hover' }"
|
|
|
clearable
|
|
clearable
|
|
|
filterable
|
|
filterable
|
|
|
- @change="handleYfClassChange" />
|
|
|
|
|
|
|
+ @change="handleYfClassChange"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('iotDevice.yfCode')" prop="yfDeviceCode">
|
|
<el-form-item :label="t('iotDevice.yfCode')" prop="yfDeviceCode">
|
|
|
- <el-input v-model="formData.yfDeviceCode" :disabled="formData.yfDeviceCode" placeholder="请输入油服设备编码" />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.yfDeviceCode"
|
|
|
|
|
+ :disabled="formData.yfDeviceCode"
|
|
|
|
|
+ placeholder="请输入油服设备编码"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('iotDevice.code')" prop="deviceCode">
|
|
<el-form-item :label="t('iotDevice.code')" prop="deviceCode">
|
|
|
- <el-input v-model="formData.deviceCode" :disabled="formType==='update'" placeholder="请输入设备编码" />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.deviceCode"
|
|
|
|
|
+ :disabled="formType === 'update'"
|
|
|
|
|
+ placeholder="请输入设备编码"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
@@ -46,7 +61,7 @@
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('iotDevice.dept')" prop="deptId">
|
|
<el-form-item :label="t('iotDevice.dept')" prop="deptId">
|
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
- :disabled="formType==='update'"
|
|
|
|
|
|
|
+ :disabled="formType === 'update'"
|
|
|
v-model="formData.deptId"
|
|
v-model="formData.deptId"
|
|
|
:data="deptList"
|
|
:data="deptList"
|
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
@@ -55,20 +70,20 @@
|
|
|
filterable
|
|
filterable
|
|
|
placeholder="请选择所在部门"
|
|
placeholder="请选择所在部门"
|
|
|
/>
|
|
/>
|
|
|
-<!-- <el-tree-select-->
|
|
|
|
|
-<!-- v-model="formData.deptId"-->
|
|
|
|
|
-<!-- :data="deptList"-->
|
|
|
|
|
-<!-- :props="defaultProps"-->
|
|
|
|
|
-<!-- check-strictly-->
|
|
|
|
|
-<!-- node-key="id"-->
|
|
|
|
|
-<!-- placeholder="请选择归属部门"-->
|
|
|
|
|
-<!-- />-->
|
|
|
|
|
|
|
+ <!-- <el-tree-select-->
|
|
|
|
|
+ <!-- v-model="formData.deptId"-->
|
|
|
|
|
+ <!-- :data="deptList"-->
|
|
|
|
|
+ <!-- :props="defaultProps"-->
|
|
|
|
|
+ <!-- check-strictly-->
|
|
|
|
|
+ <!-- node-key="id"-->
|
|
|
|
|
+ <!-- placeholder="请选择归属部门"-->
|
|
|
|
|
+ <!-- />-->
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('deviceForm.category')" prop="assetClass">
|
|
<el-form-item :label="t('deviceForm.category')" prop="assetClass">
|
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
- :disabled="formType==='update'&&username!=='超级管理员'"
|
|
|
|
|
|
|
+ :disabled="formType === 'update' && username !== '超级管理员'"
|
|
|
v-model="formData.assetClass"
|
|
v-model="formData.assetClass"
|
|
|
:data="productClassifyList"
|
|
:data="productClassifyList"
|
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
@@ -82,7 +97,12 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('iotDevice.status')" prop="deviceStatus">
|
|
<el-form-item :label="t('iotDevice.status')" prop="deviceStatus">
|
|
|
- <el-select v-model="formData.deviceStatus" :placeholder="t('deviceForm.choose')" :disabled="formType==='update'" clearable>
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="formData.deviceStatus"
|
|
|
|
|
+ :placeholder="t('deviceForm.choose')"
|
|
|
|
|
+ :disabled="formType === 'update'"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ >
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
|
|
|
:key="dict.label"
|
|
:key="dict.label"
|
|
@@ -115,8 +135,19 @@
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
- <el-col :span="8" >
|
|
|
|
|
- <div style="display: flex;flex-direction: row">
|
|
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="车牌号" prop="carNo">
|
|
|
|
|
+ <el-input clearable v-model="formData.carNo" placeholder="请输入车牌号" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item label="设备号" prop="deviceNo">
|
|
|
|
|
+ <el-input clearable v-model="formData.deviceNo" placeholder="请输入设备号" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <div style="display: flex; flex-direction: row">
|
|
|
<el-form-item :label="t('deviceForm.model')" prop="model" style="width: 86%">
|
|
<el-form-item :label="t('deviceForm.model')" prop="model" style="width: 86%">
|
|
|
<el-input
|
|
<el-input
|
|
|
clearable
|
|
clearable
|
|
@@ -144,7 +175,11 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('deviceForm.remark')" prop="remark">
|
|
<el-form-item :label="t('deviceForm.remark')" prop="remark">
|
|
|
- <el-input v-model="formData.remark" type="textarea" :placeholder="t('deviceForm.remarkHolder')" />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.remark"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :placeholder="t('deviceForm.remarkHolder')"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -220,7 +255,11 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item :label="t('deviceForm.ni')" prop="nameplate">
|
|
<el-form-item :label="t('deviceForm.ni')" prop="nameplate">
|
|
|
- <el-input v-model="formData.nameplate" type="textarea" :placeholder="t('deviceForm.niHolder')"/>
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.nameplate"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :placeholder="t('deviceForm.niHolder')"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -240,56 +279,82 @@
|
|
|
<div class="cw-expandable-content" :class="{ 'is-expanded': cwIsExpanded }">
|
|
<div class="cw-expandable-content" :class="{ 'is-expanded': cwIsExpanded }">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
- <el-form-item :label="formData.assetProperty==='zy'?'采购价格':'租赁价格'" prop="plPrice">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ :label="formData.assetProperty === 'zy' ? '采购价格' : '租赁价格'"
|
|
|
|
|
+ prop="plPrice"
|
|
|
|
|
+ >
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="formData.plPrice"
|
|
v-model="formData.plPrice"
|
|
|
@input="handleInput(formData.plPrice, 'plPrice')"
|
|
@input="handleInput(formData.plPrice, 'plPrice')"
|
|
|
- :placeholder="formData.assetProperty==='zy'?'请输入采购价格':'请输入租赁价格'"
|
|
|
|
|
|
|
+ :placeholder="formData.assetProperty === 'zy' ? '请输入采购价格' : '请输入租赁价格'"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
- <el-form-item :label="formData.assetProperty==='zy'?'采购日期':'租赁日期'" prop="plDate">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ :label="formData.assetProperty === 'zy' ? '采购日期' : '租赁日期'"
|
|
|
|
|
+ prop="plDate"
|
|
|
|
|
+ >
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
style="width: 150%"
|
|
style="width: 150%"
|
|
|
v-model="formData.plDate"
|
|
v-model="formData.plDate"
|
|
|
type="date"
|
|
type="date"
|
|
|
value-format="x"
|
|
value-format="x"
|
|
|
- :placeholder="formData.assetProperty==='zy'?'请输入采购日期':'请输入租赁日期'"
|
|
|
|
|
|
|
+ :placeholder="formData.assetProperty === 'zy' ? '请输入采购日期' : '请输入租赁日期'"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
- <el-form-item :label="formData.assetProperty==='zy'?'折旧年限':'租赁年限'" prop="plYear">
|
|
|
|
|
- <el-input v-model="formData.plYear" type="number" :placeholder="formData.assetProperty==='zy'?'请输入折旧年限':'请输入租赁年限'" />
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ :label="formData.assetProperty === 'zy' ? '折旧年限' : '租赁年限'"
|
|
|
|
|
+ prop="plYear"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="formData.plYear"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :placeholder="formData.assetProperty === 'zy' ? '请输入折旧年限' : '请输入租赁年限'"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
- <el-form-item :label="formData.assetProperty==='zy'?'折旧开始日期':'租赁开始日期'" prop="plStartDate">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ :label="formData.assetProperty === 'zy' ? '折旧开始日期' : '租赁开始日期'"
|
|
|
|
|
+ prop="plStartDate"
|
|
|
|
|
+ >
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
style="width: 150%"
|
|
style="width: 150%"
|
|
|
v-model="formData.plStartDate"
|
|
v-model="formData.plStartDate"
|
|
|
type="date"
|
|
type="date"
|
|
|
value-format="x"
|
|
value-format="x"
|
|
|
- :placeholder="formData.assetProperty==='zy'?'请选择折旧开始日期':'请选择租赁开始日期'"
|
|
|
|
|
|
|
+ :placeholder="
|
|
|
|
|
+ formData.assetProperty === 'zy' ? '请选择折旧开始日期' : '请选择租赁开始日期'
|
|
|
|
|
+ "
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
- <el-form-item :label="formData.assetProperty==='zy'?'已提折旧月数':'已租赁月数'" prop="plMonthed">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ :label="formData.assetProperty === 'zy' ? '已提折旧月数' : '已租赁月数'"
|
|
|
|
|
+ prop="plMonthed"
|
|
|
|
|
+ >
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="formData.plMonthed"
|
|
v-model="formData.plMonthed"
|
|
|
type="number"
|
|
type="number"
|
|
|
- :placeholder="formData.assetProperty==='zy'?'请输入已提折旧月数':'请输入已租赁月数'"
|
|
|
|
|
|
|
+ :placeholder="
|
|
|
|
|
+ formData.assetProperty === 'zy' ? '请输入已提折旧月数' : '请输入已租赁月数'
|
|
|
|
|
+ "
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
- <el-form-item :label="formData.assetProperty==='zy'?'已提折旧金额':'已租赁金额'" prop="plAmounted">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ :label="formData.assetProperty === 'zy' ? '已提折旧金额' : '已租赁金额'"
|
|
|
|
|
+ prop="plAmounted"
|
|
|
|
|
+ >
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="formData.plAmounted"
|
|
v-model="formData.plAmounted"
|
|
|
@input="handleInput(formData.plAmounted, 'plAmounted')"
|
|
@input="handleInput(formData.plAmounted, 'plAmounted')"
|
|
|
- :placeholder="formData.assetProperty==='zy'?'请输入已提折旧金额':'已租赁金额'"
|
|
|
|
|
|
|
+ :placeholder="formData.assetProperty === 'zy' ? '请输入已提折旧金额' : '已租赁金额'"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -319,7 +384,12 @@
|
|
|
<div class="qt-expandable-content" :class="{ 'is-expanded': qtIsExpanded }">
|
|
<div class="qt-expandable-content" :class="{ 'is-expanded': qtIsExpanded }">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col v-for="field in list" :key="field.sort" :span="8">
|
|
<el-col v-for="field in list" :key="field.sort" :span="8">
|
|
|
- <el-form-item label-width="180px" :label="field.name" :prop="field.code" :rules="field.rules">
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label-width="180px"
|
|
|
|
|
+ :label="field.name"
|
|
|
|
|
+ :prop="field.code"
|
|
|
|
|
+ :rules="field.rules"
|
|
|
|
|
+ >
|
|
|
<!-- 文本输入 -->
|
|
<!-- 文本输入 -->
|
|
|
<el-input
|
|
<el-input
|
|
|
v-if="field.type === 'text'"
|
|
v-if="field.type === 'text'"
|
|
@@ -331,7 +401,7 @@
|
|
|
<el-select
|
|
<el-select
|
|
|
v-else-if="field.type === 'enum'"
|
|
v-else-if="field.type === 'enum'"
|
|
|
v-model="formData[field.code]"
|
|
v-model="formData[field.code]"
|
|
|
- :placeholder="'请输入'+field.name"
|
|
|
|
|
|
|
+ :placeholder="'请输入' + field.name"
|
|
|
clearable
|
|
clearable
|
|
|
filterable
|
|
filterable
|
|
|
>
|
|
>
|
|
@@ -382,7 +452,7 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
|
<BrandList ref="brandFormRef" @choose="brandChoose" />
|
|
<BrandList ref="brandFormRef" @choose="brandChoose" />
|
|
|
- <ModelList ref="modelFormRef" @choose="modelChoose" :brand = "formData.brand" />
|
|
|
|
|
|
|
+ <ModelList ref="modelFormRef" @choose="modelChoose" :brand="formData.brand" />
|
|
|
<CustomerList ref="customerZzFormRef" @choose="customerZzChoose" />
|
|
<CustomerList ref="customerZzFormRef" @choose="customerZzChoose" />
|
|
|
<CustomerList ref="customerSupplierFormRef" @choose="customerSupplierChoose" />
|
|
<CustomerList ref="customerSupplierFormRef" @choose="customerSupplierChoose" />
|
|
|
</template>
|
|
</template>
|
|
@@ -396,10 +466,11 @@ import * as DeptApi from '@/api/system/dept'
|
|
|
import * as ProductClassifyApi from '@/api/pms/productclassify'
|
|
import * as ProductClassifyApi from '@/api/pms/productclassify'
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
|
-import {DeviceAttrModelApi} from "@/api/pms/deviceattrmodel";
|
|
|
|
|
|
|
+import { DeviceAttrModelApi } from '@/api/pms/deviceattrmodel'
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
|
-import {IotYfClassifyApi} from "@/api/pms/yfclass";
|
|
|
|
|
-import { useRefreshStore } from '@/store/modules/pms/refreshStore';
|
|
|
|
|
|
|
+import { IotYfClassifyApi } from '@/api/pms/yfclass'
|
|
|
|
|
+import { useRefreshStore } from '@/store/modules/pms/refreshStore'
|
|
|
|
|
+import { watch } from 'vue'
|
|
|
|
|
|
|
|
/** 设备台账 表单 */
|
|
/** 设备台账 表单 */
|
|
|
defineOptions({ name: 'DeviceDetailAdd' })
|
|
defineOptions({ name: 'DeviceDetailAdd' })
|
|
@@ -412,7 +483,7 @@ const username = ref('')
|
|
|
const deptList = ref<Tree[]>([]) // 树形结构
|
|
const deptList = ref<Tree[]>([]) // 树形结构
|
|
|
const productClassifyList = ref<Tree[]>([]) // 树形结构
|
|
const productClassifyList = ref<Tree[]>([]) // 树形结构
|
|
|
const { delView } = useTagsViewStore() // 视图操作
|
|
const { delView } = useTagsViewStore() // 视图操作
|
|
|
-const { params, name,query } = useRoute() // 查询参数
|
|
|
|
|
|
|
+const { params, name, query } = useRoute() // 查询参数
|
|
|
const { currentRoute, push } = useRouter()
|
|
const { currentRoute, push } = useRouter()
|
|
|
const { wsCache } = useCache()
|
|
const { wsCache } = useCache()
|
|
|
const id = params.id
|
|
const id = params.id
|
|
@@ -429,7 +500,7 @@ const brandLabel = ref('') // 表单的类型:create - 新增;update - 修
|
|
|
const zzLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const zzLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
const supplierLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const supplierLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
const yfclasses = ref([])
|
|
const yfclasses = ref([])
|
|
|
-const refreshStore = useRefreshStore();
|
|
|
|
|
|
|
+const refreshStore = useRefreshStore()
|
|
|
|
|
|
|
|
const formData = ref({
|
|
const formData = ref({
|
|
|
id: undefined,
|
|
id: undefined,
|
|
@@ -468,10 +539,24 @@ const formData = ref({
|
|
|
infoRemark: undefined,
|
|
infoRemark: undefined,
|
|
|
infoUrl: undefined,
|
|
infoUrl: undefined,
|
|
|
templateJson: undefined,
|
|
templateJson: undefined,
|
|
|
- assetClass: undefined
|
|
|
|
|
|
|
+ assetClass: undefined,
|
|
|
|
|
+ carNo: undefined,
|
|
|
|
|
+ deviceNo: undefined
|
|
|
})
|
|
})
|
|
|
const formRules = reactive({
|
|
const formRules = reactive({
|
|
|
- yfClass: [{ required: true, message: '编码类别不能为空', trigger: 'blur' }],
|
|
|
|
|
|
|
+ yfClass: [
|
|
|
|
|
+ {
|
|
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
|
|
+ // 当资产性质为租赁('zl')时,yfClass非必填;否则必填
|
|
|
|
|
+ if (formData.value.assetProperty === 'zl' || value) {
|
|
|
|
|
+ callback() // 租赁资产或有值时通过验证
|
|
|
|
|
+ } else {
|
|
|
|
|
+ callback(new Error('编码类别不能为空')) // 非租赁资产且无值时失败
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
yfDeviceCode: [{ required: true, message: '油服编码不能为空', trigger: 'blur' }],
|
|
yfDeviceCode: [{ required: true, message: '油服编码不能为空', trigger: 'blur' }],
|
|
|
assetClass: [{ required: true, message: '资产类别不能为空', trigger: 'blur' }],
|
|
assetClass: [{ required: true, message: '资产类别不能为空', trigger: 'blur' }],
|
|
|
deviceCode: [{ required: true, message: '设备编码不能为空', trigger: 'blur' }],
|
|
deviceCode: [{ required: true, message: '设备编码不能为空', trigger: 'blur' }],
|
|
@@ -485,19 +570,19 @@ const formRules = reactive({
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const list = ref([])
|
|
const list = ref([])
|
|
|
-const handleYfClassChange = async (value) =>{
|
|
|
|
|
|
|
+const handleYfClassChange = async (value) => {
|
|
|
console.log(value)
|
|
console.log(value)
|
|
|
const prefix = value.join('')
|
|
const prefix = value.join('')
|
|
|
const last = await IotDeviceApi.getMaxCode(prefix)
|
|
const last = await IotDeviceApi.getMaxCode(prefix)
|
|
|
- formData.value.yfDeviceCode = prefix+last
|
|
|
|
|
|
|
+ formData.value.yfDeviceCode = prefix + last
|
|
|
}
|
|
}
|
|
|
const assetclasschange = () => {
|
|
const assetclasschange = () => {
|
|
|
const assetClass = formData.value.assetClass
|
|
const assetClass = formData.value.assetClass
|
|
|
- DeviceAttrModelApi.getDeviceAttrModelListByDeviceCategoryId(assetClass).then(res => {
|
|
|
|
|
- if (res){
|
|
|
|
|
|
|
+ DeviceAttrModelApi.getDeviceAttrModelListByDeviceCategoryId(assetClass).then((res) => {
|
|
|
|
|
+ if (res) {
|
|
|
res.forEach((item) => {
|
|
res.forEach((item) => {
|
|
|
if (item.requiredFlag) {
|
|
if (item.requiredFlag) {
|
|
|
- const rule = {required: true, message: item.name+'不能为空', trigger: 'blur'}
|
|
|
|
|
|
|
+ const rule = { required: true, message: item.name + '不能为空', trigger: 'blur' }
|
|
|
item.rules = []
|
|
item.rules = []
|
|
|
item.rules.push(rule)
|
|
item.rules.push(rule)
|
|
|
}
|
|
}
|
|
@@ -509,12 +594,25 @@ const assetclasschange = () => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => formData.value.assetProperty,
|
|
|
|
|
+ (newVal) => {
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ if (formRef.value) {
|
|
|
|
|
+ // 重新验证 yfClass 和 yfCode 字段
|
|
|
|
|
+ formRef.value.validateField('yfClass')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ { immediate: true }
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
const brandChoose = (row) => {
|
|
const brandChoose = (row) => {
|
|
|
formData.value.brand = row.id
|
|
formData.value.brand = row.id
|
|
|
// brandLabel.value = row.value
|
|
// brandLabel.value = row.value
|
|
|
formData.value.brandName = row.label
|
|
formData.value.brandName = row.label
|
|
|
}
|
|
}
|
|
|
-const brandClear = () =>{
|
|
|
|
|
|
|
+const brandClear = () => {
|
|
|
formData.value.brand = undefined
|
|
formData.value.brand = undefined
|
|
|
formData.value.brandName = undefined
|
|
formData.value.brandName = undefined
|
|
|
}
|
|
}
|
|
@@ -535,7 +633,7 @@ const customerZzChoose = (row) => {
|
|
|
// zzLabel.value = row.name
|
|
// zzLabel.value = row.name
|
|
|
formData.value.manufacturerName = row.name
|
|
formData.value.manufacturerName = row.name
|
|
|
}
|
|
}
|
|
|
-const zzClear = () =>{
|
|
|
|
|
|
|
+const zzClear = () => {
|
|
|
formData.value.manufacturerId = undefined
|
|
formData.value.manufacturerId = undefined
|
|
|
formData.value.manufacturerName = undefined
|
|
formData.value.manufacturerName = undefined
|
|
|
}
|
|
}
|
|
@@ -545,7 +643,7 @@ const openForm = () => {
|
|
|
brandFormRef.value.open()
|
|
brandFormRef.value.open()
|
|
|
}
|
|
}
|
|
|
const modelFormRef = ref()
|
|
const modelFormRef = ref()
|
|
|
-const openModelForm = () =>{
|
|
|
|
|
|
|
+const openModelForm = () => {
|
|
|
modelFormRef.value.open()
|
|
modelFormRef.value.open()
|
|
|
}
|
|
}
|
|
|
const customerSupplierFormRef = ref()
|
|
const customerSupplierFormRef = ref()
|
|
@@ -594,7 +692,7 @@ const handleInput = (value, obj) => {
|
|
|
|
|
|
|
|
const close = () => {
|
|
const close = () => {
|
|
|
delView(unref(currentRoute))
|
|
delView(unref(currentRoute))
|
|
|
- push({ name: 'IotDevicePms', params:{}})
|
|
|
|
|
|
|
+ push({ name: 'IotDevicePms', params: {} })
|
|
|
// delView(unref(currentRoute))
|
|
// delView(unref(currentRoute))
|
|
|
// push({
|
|
// push({
|
|
|
// name: 'IotDevicePms',
|
|
// name: 'IotDevicePms',
|
|
@@ -625,13 +723,13 @@ const submitForm = async () => {
|
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
|
try {
|
|
try {
|
|
|
if (list.value) {
|
|
if (list.value) {
|
|
|
- list.value = list.value.map(item => ({
|
|
|
|
|
|
|
+ list.value = list.value.map((item) => ({
|
|
|
...item,
|
|
...item,
|
|
|
value: formData.value[item.code] // 自定义属性生成逻辑
|
|
value: formData.value[item.code] // 自定义属性生成逻辑
|
|
|
}))
|
|
}))
|
|
|
formData.value.templateJson = JSON.stringify(list.value)
|
|
formData.value.templateJson = JSON.stringify(list.value)
|
|
|
}
|
|
}
|
|
|
- formData.value.yfClass = formData.value.yfClass.join(',');
|
|
|
|
|
|
|
+ formData.value.yfClass = formData.value.yfClass.join(',')
|
|
|
const data = formData.value as unknown as IotDeviceVO
|
|
const data = formData.value as unknown as IotDeviceVO
|
|
|
if (formType.value === 'create') {
|
|
if (formType.value === 'create') {
|
|
|
await IotDeviceApi.createIotDevice(data)
|
|
await IotDeviceApi.createIotDevice(data)
|
|
@@ -643,11 +741,11 @@ const submitForm = async () => {
|
|
|
dialogVisible.value = false
|
|
dialogVisible.value = false
|
|
|
// 发送操作成功的事件
|
|
// 发送操作成功的事件
|
|
|
//emit('success')
|
|
//emit('success')
|
|
|
- const sourcePage = query.source as string;
|
|
|
|
|
|
|
+ const sourcePage = query.source as string
|
|
|
|
|
|
|
|
// 如果有来源页面标识,触发原页面的刷新
|
|
// 如果有来源页面标识,触发原页面的刷新
|
|
|
if (sourcePage) {
|
|
if (sourcePage) {
|
|
|
- refreshStore.triggerRefresh(sourcePage);
|
|
|
|
|
|
|
+ refreshStore.triggerRefresh(sourcePage)
|
|
|
}
|
|
}
|
|
|
close()
|
|
close()
|
|
|
} finally {
|
|
} finally {
|
|
@@ -666,20 +764,22 @@ onMounted(async () => {
|
|
|
formData.value.assetProperty = 'zy'
|
|
formData.value.assetProperty = 'zy'
|
|
|
// 修改时,设置数据
|
|
// 修改时,设置数据
|
|
|
if (id) {
|
|
if (id) {
|
|
|
- formType.value = 'update';
|
|
|
|
|
|
|
+ formType.value = 'update'
|
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
|
try {
|
|
try {
|
|
|
- const iotDevice = await IotDeviceApi.getIotDevice(id);
|
|
|
|
|
|
|
+ const iotDevice = await IotDeviceApi.getIotDevice(id)
|
|
|
formData.value = iotDevice
|
|
formData.value = iotDevice
|
|
|
- formData.value.brandName = iotDevice.brandName;
|
|
|
|
|
- formData.value.manufacturerName = iotDevice.zzName;
|
|
|
|
|
- formData.value.supplierName = iotDevice.supplierName;
|
|
|
|
|
|
|
+ formData.value.brandName = iotDevice.brandName
|
|
|
|
|
+ formData.value.manufacturerName = iotDevice.zzName
|
|
|
|
|
+ formData.value.supplierName = iotDevice.supplierName
|
|
|
|
|
+ formData.value.carNo = iotDevice.carNo
|
|
|
|
|
+ formData.value.deviceNo = iotDevice.deviceNo
|
|
|
if (iotDevice.yfClass) {
|
|
if (iotDevice.yfClass) {
|
|
|
- formData.value.yfClass = iotDevice.yfClass.split(',');
|
|
|
|
|
|
|
+ formData.value.yfClass = iotDevice.yfClass.split(',')
|
|
|
}
|
|
}
|
|
|
- list.value = JSON.parse(iotDevice.templateJson);
|
|
|
|
|
|
|
+ list.value = JSON.parse(iotDevice.templateJson)
|
|
|
list.value.forEach((item) => {
|
|
list.value.forEach((item) => {
|
|
|
- formData.value[item.code] = item.value;
|
|
|
|
|
|
|
+ formData.value[item.code] = item.value
|
|
|
})
|
|
})
|
|
|
} finally {
|
|
} finally {
|
|
|
formLoading.value = false
|
|
formLoading.value = false
|
|
@@ -688,11 +788,11 @@ onMounted(async () => {
|
|
|
if (deptId) {
|
|
if (deptId) {
|
|
|
formData.value.deptId = Number(deptId)
|
|
formData.value.deptId = Number(deptId)
|
|
|
}
|
|
}
|
|
|
- formType.value = 'create';
|
|
|
|
|
|
|
+ formType.value = 'create'
|
|
|
}
|
|
}
|
|
|
- await IotYfClassifyApi.getChildrenList().then(res => {
|
|
|
|
|
|
|
+ await IotYfClassifyApi.getChildrenList().then((res) => {
|
|
|
yfclasses.value = res
|
|
yfclasses.value = res
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
/** 重置表单 */
|
|
/** 重置表单 */
|
|
|
const resetForm = () => {
|
|
const resetForm = () => {
|
|
@@ -725,8 +825,7 @@ const resetForm = () => {
|
|
|
infoRemark: undefined,
|
|
infoRemark: undefined,
|
|
|
infoUrl: undefined,
|
|
infoUrl: undefined,
|
|
|
templateJson: undefined,
|
|
templateJson: undefined,
|
|
|
- assetClass: undefined,
|
|
|
|
|
-
|
|
|
|
|
|
|
+ assetClass: undefined
|
|
|
}
|
|
}
|
|
|
formRef.value?.resetFields()
|
|
formRef.value?.resetFields()
|
|
|
}
|
|
}
|
|
@@ -769,18 +868,18 @@ const resetForm = () => {
|
|
|
.qt-expandable-content.is-expanded {
|
|
.qt-expandable-content.is-expanded {
|
|
|
max-height: 1200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
max-height: 1200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
}
|
|
}
|
|
|
-.title-button{
|
|
|
|
|
|
|
+.title-button {
|
|
|
font-size: 18px;
|
|
font-size: 18px;
|
|
|
border: none;
|
|
border: none;
|
|
|
}
|
|
}
|
|
|
-.title-div{
|
|
|
|
|
|
|
+.title-div {
|
|
|
margin-bottom: 20px;
|
|
margin-bottom: 20px;
|
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
|
}
|
|
}
|
|
|
-.cursor-pointer{
|
|
|
|
|
|
|
+.cursor-pointer {
|
|
|
vertical-align: middle;
|
|
vertical-align: middle;
|
|
|
}
|
|
}
|
|
|
-.first-icon{
|
|
|
|
|
|
|
+.first-icon {
|
|
|
margin-bottom: 2px;
|
|
margin-bottom: 2px;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|