|
@@ -1,23 +1,13 @@
|
|
<template>
|
|
<template>
|
|
<ContentWrap v-loading="formLoading">
|
|
<ContentWrap v-loading="formLoading">
|
|
- <el-form
|
|
|
|
- ref="formRef"
|
|
|
|
- :model="formData"
|
|
|
|
- :rules="formRules"
|
|
|
|
- label-width="100px"
|
|
|
|
- >
|
|
|
|
- <div style="margin-bottom: 20px;margin-top: 10px;margin-left: 15px">
|
|
|
|
- <el-button @click="baseInfoClick" style="font-size: 18px;border:none">
|
|
|
|
- <Icon
|
|
|
|
- color="black"
|
|
|
|
- icon="ep:expand"
|
|
|
|
- :size="18"
|
|
|
|
- class="cursor-pointer"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
|
|
|
+ <div style="margin-bottom: 20px; margin-top: 10px; margin-left: 15px">
|
|
|
|
+ <el-button @click="baseInfoClick" style="font-size: 18px; border: none">
|
|
|
|
+ <Icon color="black" icon="ep:expand" :size="18" class="cursor-pointer" />
|
|
基本信息
|
|
基本信息
|
|
<Icon
|
|
<Icon
|
|
color="black"
|
|
color="black"
|
|
- :icon="baseIsExpanded?'fa-solid:angle-double-down':'fa-solid:angle-double-right'"
|
|
|
|
|
|
+ :icon="baseIsExpanded ? 'fa-solid:angle-double-down' : 'fa-solid:angle-double-right'"
|
|
:size="18"
|
|
:size="18"
|
|
class="cursor-pointer"
|
|
class="cursor-pointer"
|
|
/>
|
|
/>
|
|
@@ -37,7 +27,12 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="品牌" prop="brand">
|
|
<el-form-item label="品牌" prop="brand">
|
|
- <el-select v-model="formData.brand" placeholder="请输入品牌" @click="openForm"/>
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="formData.brand"
|
|
|
|
+ :model-value="brandLabel"
|
|
|
|
+ placeholder="请输入品牌"
|
|
|
|
+ @click="openForm"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
@@ -55,11 +50,24 @@
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
- <el-form-item label="设备状态">
|
|
|
|
|
|
+ <el-form-item label="资产类别" prop="assetClass">
|
|
|
|
+ <el-tree-select
|
|
|
|
+ v-model="formData.assetClass"
|
|
|
|
+ :data="productClassifyList"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ check-strictly
|
|
|
|
+ node-key="id"
|
|
|
|
+ placeholder="请选择资产类别"
|
|
|
|
+ @change="assetclasschange"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="设备状态" prop="deviceStatus">
|
|
<el-select v-model="formData.deviceStatus" placeholder="请选择">
|
|
<el-select v-model="formData.deviceStatus" placeholder="请选择">
|
|
<el-option
|
|
<el-option
|
|
- v-for="dict in getIntDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
|
|
|
|
- :key="dict.id"
|
|
|
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.PMS_DEVICE_STATUS)"
|
|
|
|
+ :key="dict.label"
|
|
:label="dict.label"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
:value="dict.value"
|
|
/>
|
|
/>
|
|
@@ -67,15 +75,10 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
- <el-form-item label="规格型号" prop="model">
|
|
|
|
- <el-input v-model="formData.model" placeholder="请输入规格型号" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="6">
|
|
|
|
- <el-form-item label="资产性质">
|
|
|
|
|
|
+ <el-form-item label="资产性质" prop="deviceStatus">
|
|
<el-select v-model="formData.assetProperty" placeholder="请选择">
|
|
<el-select v-model="formData.assetProperty" placeholder="请选择">
|
|
<el-option
|
|
<el-option
|
|
- v-for="dict in getIntDictOptions(DICT_TYPE.PMS_ASSET_PROPERTY)"
|
|
|
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.PMS_ASSET_PROPERTY)"
|
|
:key="dict.id"
|
|
:key="dict.id"
|
|
:label="dict.label"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
:value="dict.value"
|
|
@@ -83,6 +86,11 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="6">
|
|
|
|
+ <el-form-item label="规格型号" prop="model">
|
|
|
|
+ <el-input v-model="formData.model" placeholder="请输入规格型号" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
@@ -91,24 +99,19 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="18">
|
|
<el-col :span="18">
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
|
- <el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
|
+ <el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
|
|
|
+ </el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
- <div style="margin-bottom: 20px;margin-top: 10px;margin-left: 15px">
|
|
|
|
- <el-button @click="zzInfoClick" style="font-size: 18px;border: none">
|
|
|
|
- <Icon
|
|
|
|
- color="black"
|
|
|
|
- icon="ep:expand"
|
|
|
|
- :size="18"
|
|
|
|
- class="cursor-pointer"
|
|
|
|
- />
|
|
|
|
|
|
+ <div style="margin-bottom: 20px; margin-top: 10px; margin-left: 15px">
|
|
|
|
+ <el-button @click="zzInfoClick" style="font-size: 18px; border: none">
|
|
|
|
+ <Icon color="black" icon="ep:expand" :size="18" class="cursor-pointer" />
|
|
制造信息
|
|
制造信息
|
|
<Icon
|
|
<Icon
|
|
color="black"
|
|
color="black"
|
|
- :icon="zzIsExpanded?'fa-solid:angle-double-down':'fa-solid:angle-double-right'"
|
|
|
|
|
|
+ :icon="zzIsExpanded ? 'fa-solid:angle-double-down' : 'fa-solid:angle-double-right'"
|
|
:size="18"
|
|
:size="18"
|
|
class="cursor-pointer"
|
|
class="cursor-pointer"
|
|
/>
|
|
/>
|
|
@@ -118,11 +121,16 @@
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="制造商" prop="manufacturerId">
|
|
<el-form-item label="制造商" prop="manufacturerId">
|
|
- <el-select v-model="formData.manufacturerId" placeholder="请输入制造商" @click="openCustomer('manufacturer')"/>
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="formData.manufacturerId"
|
|
|
|
+ :model-value="zzLabel"
|
|
|
|
+ placeholder="请输入制造商"
|
|
|
|
+ @click="openCustomer('manufacturer')"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
- <el-form-item label="生产日期" prop="manDate" >
|
|
|
|
|
|
+ <el-form-item label="生产日期" prop="manDate">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
style="width: 150%"
|
|
style="width: 150%"
|
|
v-model="formData.manDate"
|
|
v-model="formData.manDate"
|
|
@@ -134,7 +142,12 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="供应商" prop="supplierId">
|
|
<el-form-item label="供应商" prop="supplierId">
|
|
- <el-select v-model="formData.supplierId" placeholder="请输入供应商" @click="openCustomer('supplier')"/>
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="formData.supplierId"
|
|
|
|
+ placeholder="请输入供应商"
|
|
|
|
+ :model-value="supplierLabel"
|
|
|
|
+ @click="openCustomer('supplier')"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
@@ -157,18 +170,13 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
- <div style="margin-bottom: 20px;margin-top: 10px;margin-left: 15px">
|
|
|
|
- <el-button @click="cwInfoClick" style=" font-size: 18px;border: none">
|
|
|
|
- <Icon
|
|
|
|
- color="black"
|
|
|
|
- icon="ep:expand"
|
|
|
|
- :size="18"
|
|
|
|
- class="cursor-pointer"
|
|
|
|
- />
|
|
|
|
|
|
+ <div style="margin-bottom: 20px; margin-top: 10px; margin-left: 15px">
|
|
|
|
+ <el-button @click="cwInfoClick" style="font-size: 18px; border: none">
|
|
|
|
+ <Icon color="black" icon="ep:expand" :size="18" class="cursor-pointer" />
|
|
财务信息
|
|
财务信息
|
|
<Icon
|
|
<Icon
|
|
color="black"
|
|
color="black"
|
|
- :icon="cwIsExpanded?'fa-solid:angle-double-down':'fa-solid:angle-double-right'"
|
|
|
|
|
|
+ :icon="cwIsExpanded ? 'fa-solid:angle-double-down' : 'fa-solid:angle-double-right'"
|
|
:size="18"
|
|
:size="18"
|
|
class="cursor-pointer"
|
|
class="cursor-pointer"
|
|
/>
|
|
/>
|
|
@@ -178,7 +186,11 @@
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="采购价格" prop="plPrice">
|
|
<el-form-item label="采购价格" prop="plPrice">
|
|
- <el-input v-model="formData.plPrice" @input="handleInput(formData.plPrice, 'plPrice')" placeholder="请输入采购/租赁价格" />
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="formData.plPrice"
|
|
|
|
+ @input="handleInput(formData.plPrice, 'plPrice')"
|
|
|
|
+ placeholder="请输入采购/租赁价格"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
@@ -213,93 +225,147 @@
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="已提折旧月数" prop="plMonthed">
|
|
<el-form-item label="已提折旧月数" prop="plMonthed">
|
|
- <el-input v-model="formData.plMonthed" type="number" placeholder="请输入已提折旧月数" />
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="formData.plMonthed"
|
|
|
|
+ type="number"
|
|
|
|
+ placeholder="请输入已提折旧月数"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="已提折旧金额" prop="plAmounted">
|
|
<el-form-item label="已提折旧金额" prop="plAmounted">
|
|
- <el-input v-model="formData.plAmounted" @input="handleInput(formData.plAmounted, 'plAmounted')" placeholder="请输入已提折旧金额" />
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="formData.plAmounted"
|
|
|
|
+ @input="handleInput(formData.plAmounted, 'plAmounted')"
|
|
|
|
+ placeholder="请输入已提折旧金额"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="剩余金额" prop="remainAmount">
|
|
<el-form-item label="剩余金额" prop="remainAmount">
|
|
- <el-input v-model="formData.remainAmount" @input="handleInput(formData.remainAmount, 'remainAmount')" placeholder="请输入剩余金额" />
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="formData.remainAmount"
|
|
|
|
+ @input="handleInput(formData.remainAmount, 'remainAmount')"
|
|
|
|
+ placeholder="请输入剩余金额"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
- <div style="margin-bottom: 20px;margin-top: 10px;margin-left: 15px">
|
|
|
|
- <el-button @click="qtInfoClick" style="font-size: 18px;border: none">
|
|
|
|
- <Icon
|
|
|
|
- color="black"
|
|
|
|
- icon="ep:expand"
|
|
|
|
- :size="18"
|
|
|
|
- class="cursor-pointer"
|
|
|
|
- />其它信息
|
|
|
|
|
|
+ <div style="margin-bottom: 20px; margin-top: 10px; margin-left: 15px">
|
|
|
|
+ <el-button @click="qtInfoClick" style="font-size: 18px; border: none">
|
|
|
|
+ <Icon color="black" icon="ep:expand" :size="18" class="cursor-pointer" />其它信息
|
|
<Icon
|
|
<Icon
|
|
color="black"
|
|
color="black"
|
|
- :icon="qtIsExpanded?'fa-solid:angle-double-down':'fa-solid:angle-double-right'"
|
|
|
|
|
|
+ :icon="qtIsExpanded ? 'fa-solid:angle-double-down' : 'fa-solid:angle-double-right'"
|
|
:size="18"
|
|
:size="18"
|
|
class="cursor-pointer"
|
|
class="cursor-pointer"
|
|
/>
|
|
/>
|
|
</el-button>
|
|
</el-button>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
<div class="qt-expandable-content" :class="{ 'is-expanded': qtIsExpanded }">
|
|
<div class="qt-expandable-content" :class="{ 'is-expanded': qtIsExpanded }">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col v-for="field in list" :key="field.id" :span="6">
|
|
|
|
+ <el-form-item :label="field.label" :prop="field.model" :rules="field.rules">
|
|
|
|
+ <!-- 文本输入 -->
|
|
|
|
+ <el-input
|
|
|
|
+ v-if="field.type === 'input'"
|
|
|
|
+ v-model="formData[field.prop]"
|
|
|
|
+ :placeholder="'请输入' + field.label"
|
|
|
|
+ :type="field.type || 'text'"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
|
|
+ <!-- <template v-if="field.prepend" #prepend>-->
|
|
|
|
+ <!-- {{ field.prepend }}-->
|
|
|
|
+ <!-- </template>-->
|
|
|
|
+ </el-input>
|
|
|
|
|
|
|
|
+ <!-- 下拉选择 -->
|
|
|
|
+ <!-- <el-select-->
|
|
|
|
+ <!-- v-else-if="field.type === 'select'"-->
|
|
|
|
+ <!-- v-model="formData[field.model]"-->
|
|
|
|
+ <!-- :placeholder="'请输入'+field.label"-->
|
|
|
|
+ <!-- clearable-->
|
|
|
|
+ <!-- filterable-->
|
|
|
|
+ <!-- >-->
|
|
|
|
+ <!-- <el-option-->
|
|
|
|
+ <!-- v-for="item in field.options"-->
|
|
|
|
+ <!-- :key="item.value"-->
|
|
|
|
+ <!-- :label="item.label"-->
|
|
|
|
+ <!-- :value="item.value"-->
|
|
|
|
+ <!-- />-->
|
|
|
|
+ <!-- </el-select>-->
|
|
|
|
|
|
- <el-form-item label="动态模板信息" prop="templateJson">
|
|
|
|
- <el-input v-model="formData.templateJson" placeholder="请输入动态模板信息" />
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <!-- 数字输入 -->
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-else-if="field.type === 'number'"
|
|
|
|
+ v-model="formData[field.prop]"
|
|
|
|
+ :min="field.min || 0"
|
|
|
|
+ :max="field.max || 100"
|
|
|
|
+ :step="field.step || 1"
|
|
|
|
+ />
|
|
|
|
+
|
|
|
|
+ <!-- 日期选择 -->
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-else-if="field.type === 'date'"
|
|
|
|
+ v-model="formData[field.prop]"
|
|
|
|
+ :type="field.type || 'date'"
|
|
|
|
+ :placeholder="'请输入' + field.label"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ style="width: 150%"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
</el-form>
|
|
-<!-- <template #footer>-->
|
|
|
|
-<!-- <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>-->
|
|
|
|
-<!-- <el-button @click="dialogVisible = false">取 消</el-button>-->
|
|
|
|
-<!-- </template>-->
|
|
|
|
- <el-form>
|
|
|
|
- <el-form-item style="float: right">
|
|
|
|
- <el-button type="success" @click="allzhankai">一键展开</el-button>
|
|
|
|
- <el-button type="info" @click="allshouqi">一键收起</el-button>
|
|
|
|
- <el-button v-if="!isDetail" :loading="formLoading" type="warning" @click="submitForm">
|
|
|
|
- 保存
|
|
|
|
- </el-button>
|
|
|
|
- <el-button @click="close" type="primary">返回</el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
|
|
+ <el-form>
|
|
|
|
+ <el-form-item style="float: right">
|
|
|
|
+ <el-button type="success" @click="allzhankai">一键展开</el-button>
|
|
|
|
+ <el-button type="info" @click="allshouqi">一键收起</el-button>
|
|
|
|
+ <el-button v-if="!isDetail" :loading="formLoading" type="warning" @click="submitForm">
|
|
|
|
+ 保存
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button @click="close" type="primary">返回</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
<BrandList ref="brandFormRef" @choose="brandChoose" />
|
|
<BrandList ref="brandFormRef" @choose="brandChoose" />
|
|
- <CustomerList ref="customerFormRef" @choose="customerChoose"/>
|
|
|
|
|
|
+ <CustomerList ref="customerFormRef" @choose="customerChoose" />
|
|
</template>
|
|
</template>
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
-import BrandList from "@/views/pms/device/BrandList.vue";
|
|
|
|
-import CustomerList from "@/views/pms/device/CustomerList.vue";
|
|
|
|
-import {defaultProps, handleTree} from "@/utils/tree";
|
|
|
|
-import * as DeptApi from "@/api/system/dept";
|
|
|
|
-import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
|
|
|
|
|
|
+import BrandList from '@/views/pms/device/BrandList.vue'
|
|
|
|
+import CustomerList from '@/views/pms/device/CustomerList.vue'
|
|
|
|
+import { defaultProps, handleTree } from '@/utils/tree'
|
|
|
|
+import * as DeptApi from '@/api/system/dept'
|
|
|
|
+import * as ProductClassifyApi from '@/api/pms/productclassify'
|
|
|
|
+import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
|
|
|
|
/** 设备台账 表单 */
|
|
/** 设备台账 表单 */
|
|
defineOptions({ name: 'IotDeviceForm' })
|
|
defineOptions({ name: 'IotDeviceForm' })
|
|
-const baseIsExpanded = ref(true); // 控制表单是否展开的变量
|
|
|
|
-const zzIsExpanded = ref(false); // 控制表单是否展开的变量
|
|
|
|
-const cwIsExpanded = ref(false); // 控制表单是否展开的变量
|
|
|
|
-const qtIsExpanded = ref(false); // 控制表单是否展开的变量
|
|
|
|
|
|
+const baseIsExpanded = ref(true) // 控制表单是否展开的变量
|
|
|
|
+const zzIsExpanded = ref(false) // 控制表单是否展开的变量
|
|
|
|
+const cwIsExpanded = ref(false) // 控制表单是否展开的变量
|
|
|
|
+const qtIsExpanded = ref(false) // 控制表单是否展开的变量
|
|
|
|
|
|
const deptList = ref<Tree[]>([]) // 树形结构
|
|
const deptList = ref<Tree[]>([]) // 树形结构
|
|
|
|
+const productClassifyList = ref<Tree[]>([]) // 树形结构
|
|
const { delView } = useTagsViewStore() // 视图操作
|
|
const { delView } = useTagsViewStore() // 视图操作
|
|
-const { params, name} = useRoute() // 查询参数
|
|
|
|
-const {currentRoute, push} = useRouter()
|
|
|
|
-const id = params.id;
|
|
|
|
-const isDetail = params.isDetail;
|
|
|
|
|
|
+const { params, name } = useRoute() // 查询参数
|
|
|
|
+const { currentRoute, push } = useRouter()
|
|
|
|
+const id = params.id
|
|
|
|
+const isDetail = params.isDetail
|
|
const { t } = useI18n() // 国际化
|
|
const { t } = useI18n() // 国际化
|
|
const message = useMessage() // 消息弹窗
|
|
const message = useMessage() // 消息弹窗
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
-const customerType = ref('')
|
|
|
|
|
|
+const brandLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
+const zzLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
+const supplierLabel = ref('') // 表单的类型:create - 新增;update - 修改
|
|
const formData = ref({
|
|
const formData = ref({
|
|
id: undefined,
|
|
id: undefined,
|
|
deviceCode: undefined,
|
|
deviceCode: undefined,
|
|
@@ -329,8 +395,10 @@ const formData = ref({
|
|
infoRemark: undefined,
|
|
infoRemark: undefined,
|
|
infoUrl: undefined,
|
|
infoUrl: undefined,
|
|
templateJson: undefined,
|
|
templateJson: undefined,
|
|
|
|
+ assetClass: undefined
|
|
})
|
|
})
|
|
const formRules = reactive({
|
|
const formRules = reactive({
|
|
|
|
+ assetClass: [{ required: true, message: '资产类别不能为空', trigger: 'blur' }],
|
|
deviceCode: [{ required: true, message: '资产编码不能为空', trigger: 'blur' }],
|
|
deviceCode: [{ required: true, message: '资产编码不能为空', trigger: 'blur' }],
|
|
deviceName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
|
deviceName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
|
brand: [{ required: true, message: '品牌不能为空', trigger: 'blur' }],
|
|
brand: [{ required: true, message: '品牌不能为空', trigger: 'blur' }],
|
|
@@ -338,16 +406,40 @@ const formRules = reactive({
|
|
deviceStatus: [{ required: true, message: '设备状态不能为空', trigger: 'blur' }],
|
|
deviceStatus: [{ required: true, message: '设备状态不能为空', trigger: 'blur' }],
|
|
assetProperty: [{ required: true, message: '资产性质不能为空', trigger: 'blur' }],
|
|
assetProperty: [{ required: true, message: '资产性质不能为空', trigger: 'blur' }],
|
|
manufacturerId: [{ required: true, message: '制造商id不能为空', trigger: 'blur' }],
|
|
manufacturerId: [{ required: true, message: '制造商id不能为空', trigger: 'blur' }],
|
|
- manDate: [{ required: true, message: '生产日期不能为空', trigger: 'blur' }],
|
|
|
|
|
|
+ manDate: [{ required: true, message: '生产日期不能为空', trigger: 'blur' }]
|
|
})
|
|
})
|
|
|
|
|
|
-const brandChoose = (row) =>{
|
|
|
|
- console.log(JSON.stringify(row.value))
|
|
|
|
- formData.value.brand = row.value;
|
|
|
|
|
|
+const list = [
|
|
|
|
+ {
|
|
|
|
+ id: 1,
|
|
|
|
+ label: '姓名',
|
|
|
|
+ prop: 'name',
|
|
|
|
+ type: 'input',
|
|
|
|
+ value: null,
|
|
|
|
+ rules: [{ required: true, message: '姓名不能为空', trigger: 'blur' }]
|
|
|
|
+ },
|
|
|
|
+ { id: 2, label: '邮件', prop: 'email', type: 'date' },
|
|
|
|
+ { id: 3, label: '邮件', prop: 'email', type: 'date' },
|
|
|
|
+ { id: 4, label: '邮件', prop: 'email', type: 'date' },
|
|
|
|
+ { id: 5, label: '邮件', prop: 'email', type: 'date' }
|
|
|
|
+]
|
|
|
|
+
|
|
|
|
+const assetclasschange = () => {
|
|
|
|
+ const assetClass = formData.value.assetClass
|
|
|
|
+ // todo 调用获取动态模板接口
|
|
}
|
|
}
|
|
-const customerChoose = (row) =>{
|
|
|
|
- console.log(JSON.stringify(row))
|
|
|
|
- formData.value[row.customerNature+'Id'] = row.name;
|
|
|
|
|
|
+
|
|
|
|
+const brandChoose = (row) => {
|
|
|
|
+ formData.value.brand = row.id
|
|
|
|
+ brandLabel.value = row.value
|
|
|
|
+}
|
|
|
|
+const customerChoose = (row) => {
|
|
|
|
+ formData.value[row.customerNature + 'Id'] = row.id
|
|
|
|
+ if (row.customerNature == 'supplier') {
|
|
|
|
+ supplierLabel.value = row.name
|
|
|
|
+ } else {
|
|
|
|
+ zzLabel.value = row.name
|
|
|
|
+ }
|
|
}
|
|
}
|
|
/** 添加/修改操作 */
|
|
/** 添加/修改操作 */
|
|
const brandFormRef = ref()
|
|
const brandFormRef = ref()
|
|
@@ -358,7 +450,7 @@ const customerFormRef = ref()
|
|
const openCustomer = (type) => {
|
|
const openCustomer = (type) => {
|
|
customerFormRef.value.open(type)
|
|
customerFormRef.value.open(type)
|
|
}
|
|
}
|
|
-const allshouqi = () =>{
|
|
|
|
|
|
+const allshouqi = () => {
|
|
baseIsExpanded.value = false
|
|
baseIsExpanded.value = false
|
|
zzIsExpanded.value = false
|
|
zzIsExpanded.value = false
|
|
cwIsExpanded.value = false
|
|
cwIsExpanded.value = false
|
|
@@ -371,73 +463,79 @@ const allzhankai = () => {
|
|
qtIsExpanded.value = true
|
|
qtIsExpanded.value = true
|
|
}
|
|
}
|
|
/** 打开弹窗 */
|
|
/** 打开弹窗 */
|
|
-const open = async (type: string, id?: number) => {
|
|
|
|
- dialogVisible.value = true
|
|
|
|
- dialogTitle.value = t('action.' + type)
|
|
|
|
- formType.value = type
|
|
|
|
- resetForm()
|
|
|
|
- // 修改时,设置数据
|
|
|
|
- if (id) {
|
|
|
|
- formLoading.value = true
|
|
|
|
- try {
|
|
|
|
- formData.value = await IotDeviceApi.getIotDevice(id)
|
|
|
|
- } finally {
|
|
|
|
- formLoading.value = false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
+// const open = async (id?: number,isDetail: boolean, type: string) => {
|
|
|
|
+// debugger
|
|
|
|
+// formType.value = type
|
|
|
|
+// resetForm()
|
|
|
|
+// // 修改时,设置数据
|
|
|
|
+// if (id) {
|
|
|
|
+// formLoading.value = true
|
|
|
|
+// try {
|
|
|
|
+// formData.value = await IotDeviceApi.getIotDevice(id)
|
|
|
|
+// } finally {
|
|
|
|
+// formLoading.value = false
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
|
|
|
|
-const handleInput = (value,obj) => {
|
|
|
|
|
|
+const handleInput = (value, obj) => {
|
|
// 1. 过滤非法字符(只允许数字和小数点)
|
|
// 1. 过滤非法字符(只允许数字和小数点)
|
|
- let filtered = value.replace(/[^\d.]/g, '');
|
|
|
|
|
|
+ let filtered = value.replace(/[^\d.]/g, '')
|
|
|
|
|
|
// 2. 处理多个小数点的情况
|
|
// 2. 处理多个小数点的情况
|
|
- filtered = filtered.replace(/\.{2,}/g, '.');
|
|
|
|
|
|
+ filtered = filtered.replace(/\.{2,}/g, '.')
|
|
|
|
|
|
// 3. 限制小数点后最多两位
|
|
// 3. 限制小数点后最多两位
|
|
- let decimalParts = filtered.split('.');
|
|
|
|
|
|
+ let decimalParts = filtered.split('.')
|
|
if (decimalParts.length > 1) {
|
|
if (decimalParts.length > 1) {
|
|
- decimalParts = decimalParts.slice(0, 2);
|
|
|
|
- filtered = decimalParts.join('.');
|
|
|
|
|
|
+ decimalParts = decimalParts.slice(0, 2)
|
|
|
|
+ filtered = decimalParts.join('.')
|
|
}
|
|
}
|
|
|
|
|
|
// 4. 处理以小数点开头的情况(自动补0)
|
|
// 4. 处理以小数点开头的情况(自动补0)
|
|
if (filtered.startsWith('.')) {
|
|
if (filtered.startsWith('.')) {
|
|
- filtered = '0' + filtered;
|
|
|
|
|
|
+ filtered = '0' + filtered
|
|
}
|
|
}
|
|
|
|
|
|
// 5. 更新绑定值(同时处理连续输入多个0的情况)
|
|
// 5. 更新绑定值(同时处理连续输入多个0的情况)
|
|
- formData.value[obj] = filtered.replace(/^0+(?=\d)/, '');
|
|
|
|
-
|
|
|
|
-};
|
|
|
|
|
|
+ formData.value[obj] = filtered.replace(/^0+(?=\d)/, '')
|
|
|
|
+}
|
|
|
|
|
|
const close = () => {
|
|
const close = () => {
|
|
delView(unref(currentRoute))
|
|
delView(unref(currentRoute))
|
|
- push({ name: 'IotDevicePms',query: {
|
|
|
|
- date: new Date().getTime(),
|
|
|
|
- } })
|
|
|
|
|
|
+ push({
|
|
|
|
+ name: 'IotDevicePms',
|
|
|
|
+ query: {
|
|
|
|
+ date: new Date().getTime()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
-const baseInfoClick = ()=> {
|
|
|
|
- baseIsExpanded.value = !baseIsExpanded.value; // 切换展开状态
|
|
|
|
|
|
+const baseInfoClick = () => {
|
|
|
|
+ baseIsExpanded.value = !baseIsExpanded.value // 切换展开状态
|
|
}
|
|
}
|
|
-const zzInfoClick = ()=> {
|
|
|
|
- zzIsExpanded.value = !zzIsExpanded.value; // 切换展开状态
|
|
|
|
|
|
+const zzInfoClick = () => {
|
|
|
|
+ zzIsExpanded.value = !zzIsExpanded.value // 切换展开状态
|
|
}
|
|
}
|
|
-const cwInfoClick = ()=> {
|
|
|
|
- cwIsExpanded.value = !cwIsExpanded.value; // 切换展开状态
|
|
|
|
|
|
+const cwInfoClick = () => {
|
|
|
|
+ cwIsExpanded.value = !cwIsExpanded.value // 切换展开状态
|
|
}
|
|
}
|
|
-const qtInfoClick = ()=> {
|
|
|
|
- qtIsExpanded.value = !qtIsExpanded.value; // 切换展开状态
|
|
|
|
|
|
+const qtInfoClick = () => {
|
|
|
|
+ qtIsExpanded.value = !qtIsExpanded.value // 切换展开状态
|
|
}
|
|
}
|
|
/** 提交表单 */
|
|
/** 提交表单 */
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
|
|
+const formRef = ref()
|
|
const submitForm = async () => {
|
|
const submitForm = async () => {
|
|
// 校验表单
|
|
// 校验表单
|
|
await formRef.value.validate()
|
|
await formRef.value.validate()
|
|
// 提交请求
|
|
// 提交请求
|
|
formLoading.value = true
|
|
formLoading.value = true
|
|
try {
|
|
try {
|
|
|
|
+ list.forEach((item) => {
|
|
|
|
+ item.value = formData.value[item.prop]
|
|
|
|
+ })
|
|
|
|
+ formData.value.templateJson = JSON.stringify(list)
|
|
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)
|
|
@@ -448,14 +546,40 @@ const submitForm = async () => {
|
|
}
|
|
}
|
|
dialogVisible.value = false
|
|
dialogVisible.value = false
|
|
// 发送操作成功的事件
|
|
// 发送操作成功的事件
|
|
- emit('success')
|
|
|
|
|
|
+ //emit('success')
|
|
|
|
+ delView(unref(currentRoute))
|
|
|
|
+ await push({
|
|
|
|
+ name: 'IotDevicePms', query: {
|
|
|
|
+ date: new Date().getTime(),
|
|
|
|
+ }
|
|
|
|
+ })
|
|
} finally {
|
|
} finally {
|
|
formLoading.value = false
|
|
formLoading.value = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-onMounted(async ()=>{
|
|
|
|
|
|
+onMounted(async () => {
|
|
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
|
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
|
|
|
+ productClassifyList.value = handleTree(
|
|
|
|
+ await ProductClassifyApi.IotProductClassifyApi.getSimpleProductClassifyList()
|
|
|
|
+ )
|
|
|
|
+ console.log(JSON.stringify(productClassifyList.value))
|
|
|
|
+ // 修改时,设置数据
|
|
|
|
+ if (id) {
|
|
|
|
+ formType.value = 'update';
|
|
|
|
+ formLoading.value = true
|
|
|
|
+ try {
|
|
|
|
+ const iotDevice = await IotDeviceApi.getIotDevice(id);
|
|
|
|
+ formData.value = iotDevice
|
|
|
|
+ brandLabel.value = iotDevice.brandName;
|
|
|
|
+ zzLabel.value = iotDevice.zzName;
|
|
|
|
+ supplierLabel.value = iotDevice.supplierName;
|
|
|
|
+ } finally {
|
|
|
|
+ formLoading.value = false
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ formType.value = 'create';
|
|
|
|
+ }
|
|
})
|
|
})
|
|
/** 重置表单 */
|
|
/** 重置表单 */
|
|
const resetForm = () => {
|
|
const resetForm = () => {
|
|
@@ -488,47 +612,48 @@ const resetForm = () => {
|
|
infoRemark: undefined,
|
|
infoRemark: undefined,
|
|
infoUrl: undefined,
|
|
infoUrl: undefined,
|
|
templateJson: undefined,
|
|
templateJson: undefined,
|
|
|
|
+ assetClass: undefined,
|
|
|
|
+
|
|
}
|
|
}
|
|
formRef.value?.resetFields()
|
|
formRef.value?.resetFields()
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
- .base-expandable-content {
|
|
|
|
- max-height: 0; /* 初始高度为0 */
|
|
|
|
- overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
- transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .base-expandable-content.is-expanded {
|
|
|
|
- max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
- }
|
|
|
|
- .zz-expandable-content {
|
|
|
|
- max-height: 0; /* 初始高度为0 */
|
|
|
|
- overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
- transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
- }
|
|
|
|
|
|
+.base-expandable-content {
|
|
|
|
+ max-height: 0; /* 初始高度为0 */
|
|
|
|
+ overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
+ transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
+}
|
|
|
|
|
|
- .zz-expandable-content.is-expanded {
|
|
|
|
- max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
- }
|
|
|
|
- .cw-expandable-content {
|
|
|
|
- max-height: 0; /* 初始高度为0 */
|
|
|
|
- overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
- transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
- }
|
|
|
|
|
|
+.base-expandable-content.is-expanded {
|
|
|
|
+ max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
+}
|
|
|
|
+.zz-expandable-content {
|
|
|
|
+ max-height: 0; /* 初始高度为0 */
|
|
|
|
+ overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
+ transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
+}
|
|
|
|
|
|
- .cw-expandable-content.is-expanded {
|
|
|
|
- max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
- }
|
|
|
|
- .qt-expandable-content {
|
|
|
|
- max-height: 0; /* 初始高度为0 */
|
|
|
|
- overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
- transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
- }
|
|
|
|
|
|
+.zz-expandable-content.is-expanded {
|
|
|
|
+ max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
+}
|
|
|
|
+.cw-expandable-content {
|
|
|
|
+ max-height: 0; /* 初始高度为0 */
|
|
|
|
+ overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
+ transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
+}
|
|
|
|
|
|
- .qt-expandable-content.is-expanded {
|
|
|
|
- max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
- }
|
|
|
|
|
|
+.cw-expandable-content.is-expanded {
|
|
|
|
+ max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
+}
|
|
|
|
+.qt-expandable-content {
|
|
|
|
+ max-height: 0; /* 初始高度为0 */
|
|
|
|
+ overflow: hidden; /* 隐藏溢出的内容 */
|
|
|
|
+ transition: max-height 0.3s ease; /* 平滑过渡效果 */
|
|
|
|
+}
|
|
|
|
|
|
|
|
+.qt-expandable-content.is-expanded {
|
|
|
|
+ max-height: 200px; /* 或者根据内容设定一个合适的最大高度 */
|
|
|
|
+}
|
|
</style>
|
|
</style>
|