|
|
|
@ -5,7 +5,7 @@ |
|
|
|
<view class="flex-col group_9"> |
|
|
|
<view class="flex-row group_10"> |
|
|
|
<text class="text_18">*</text> |
|
|
|
<text class="text_19">设备图片</text> |
|
|
|
<text class="text_19">产品图片</text> |
|
|
|
<text class="tip">(图片单张大小不超过2M,数量最多5张)</text> |
|
|
|
</view> |
|
|
|
<view class="flex-row"> |
|
|
|
@ -23,7 +23,7 @@ |
|
|
|
<view class="justify-between group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_1">*</text> |
|
|
|
<text class="text_2">设备名称</text> |
|
|
|
<text class="text_2">产品名称</text> |
|
|
|
</view> |
|
|
|
<qn-easyinput |
|
|
|
:maxlength="20" |
|
|
|
@ -31,98 +31,24 @@ |
|
|
|
:inputBorder="false" |
|
|
|
text="right" |
|
|
|
placeholderStyle="fontSize: 28rpx" |
|
|
|
placeholder="请输入设备名称" |
|
|
|
placeholder="请输入产品名称" |
|
|
|
></qn-easyinput> |
|
|
|
</view> |
|
|
|
<view class="divider"></view> |
|
|
|
<view class="justify-between group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_2">设备类型</text> |
|
|
|
</view> |
|
|
|
<view style="width: 400rpx; z-index: 2"> |
|
|
|
<qn-select |
|
|
|
:placeholderStyle="placeholderStyle" |
|
|
|
contentStyle="background: none; padding: 0;text-align: right;" |
|
|
|
:options="deviceTypeList" |
|
|
|
v-model="form.type" |
|
|
|
placeholder="请选择设备类型" |
|
|
|
></qn-select> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="divider"></view> |
|
|
|
<view class="justify-between group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_2">生产工艺</text> |
|
|
|
</view> |
|
|
|
<view style="width: 400rpx; z-index: 1"> |
|
|
|
<qn-select |
|
|
|
:placeholderStyle="placeholderStyle" |
|
|
|
contentStyle="background: none; padding: 0;text-align: right;" |
|
|
|
:options="technicsTypeList" |
|
|
|
v-model="form.technicsTypeList" |
|
|
|
placeholder="请选择设备支持的生产类型" |
|
|
|
multiple |
|
|
|
></qn-select> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="divider"></view> |
|
|
|
<view class="group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_1">*</text> |
|
|
|
<text class="text_2">设备描述</text> |
|
|
|
<text class="text_2">产品描述</text> |
|
|
|
</view> |
|
|
|
<qn-easyinput |
|
|
|
:maxlength="200" |
|
|
|
v-model="form.machineDescribe" |
|
|
|
v-model="form.produceDescribe" |
|
|
|
type="textarea" |
|
|
|
placeholderStyle="fontSize: 28rpx " |
|
|
|
placeholder="请输入设备介绍" |
|
|
|
placeholder="请输入产品介绍" |
|
|
|
style="background-color: rgb(247, 248, 250); margin-top: 16rpx" |
|
|
|
></qn-easyinput> |
|
|
|
</view> |
|
|
|
<view class="divider"></view> |
|
|
|
<view class="justify-between group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_2">摄像头ID</text> |
|
|
|
</view> |
|
|
|
<qn-easyinput |
|
|
|
:maxlength="20" |
|
|
|
v-model="form.cameraId" |
|
|
|
:inputBorder="false" |
|
|
|
text="right" |
|
|
|
placeholderStyle=" fontSize: 28rpx" |
|
|
|
placeholder="请输入摄像头ID" |
|
|
|
></qn-easyinput> |
|
|
|
</view> |
|
|
|
<view class="divider"></view> |
|
|
|
<view class="justify-between group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_2">摄像头渠道号</text> |
|
|
|
</view> |
|
|
|
<qn-easyinput |
|
|
|
:maxlength="20" |
|
|
|
v-model="form.channelNum" |
|
|
|
:inputBorder="false" |
|
|
|
text="right" |
|
|
|
type="number" |
|
|
|
placeholderStyle=" fontSize: 28rpx" |
|
|
|
placeholder="请输入摄像头渠道号" |
|
|
|
></qn-easyinput> |
|
|
|
</view> |
|
|
|
<view class="divider"></view> |
|
|
|
<view class="justify-between group"> |
|
|
|
<view class="flex-row"> |
|
|
|
<text class="text_2">云盒ID</text> |
|
|
|
</view> |
|
|
|
<qn-easyinput |
|
|
|
:maxlength="20" |
|
|
|
v-model="form.cloudBoxId" |
|
|
|
:inputBorder="false" |
|
|
|
text="right" |
|
|
|
placeholderStyle=" fontSize: 28rpx" |
|
|
|
placeholder="请输入云盒ID" |
|
|
|
></qn-easyinput> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<qn-footer fixed> |
|
|
|
<view class="flex-col items-center text-wrapper_1" @click="save"> |
|
|
|
@ -136,7 +62,7 @@ |
|
|
|
import { go2, back, uploadImage } from '@/utils/hook.js' |
|
|
|
import { validateField } from '@/utils/index.js' |
|
|
|
import { fileType } from '@/enums/index.js' |
|
|
|
import { getDeviceTypeList, getTechnicsList, changeDevice, getEquipmentInfo } from '@/apis/deviceApi.js' |
|
|
|
import { changeProduction, getProductionInfo } from '@/apis/productionApi.js' |
|
|
|
|
|
|
|
const validateFields = [ |
|
|
|
{ |
|
|
|
@ -148,7 +74,7 @@ const validateFields = [ |
|
|
|
rules: [{ required: true, message: '请输入设备名称' }] |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'machineDescribe', |
|
|
|
name: 'produceDescribe', |
|
|
|
rules: [{ required: true, message: '请输入设备描述' }] |
|
|
|
} |
|
|
|
] |
|
|
|
@ -161,16 +87,9 @@ export default { |
|
|
|
form: { |
|
|
|
id: null, |
|
|
|
imgItemList: [], |
|
|
|
machineDescribe: '', |
|
|
|
cameraId: '', |
|
|
|
channelNum: '', |
|
|
|
cloudBoxId: '', |
|
|
|
name: '', |
|
|
|
type: '', |
|
|
|
technicsTypeList: [] |
|
|
|
produceDescribe: '', |
|
|
|
name: '' |
|
|
|
}, |
|
|
|
deviceTypeList: [], |
|
|
|
technicsTypeList: [], |
|
|
|
placeholderStyle: 'font-size: 28rpx;font-weight:400;' |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -194,18 +113,6 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
getDeviceTypeList().then((res) => { |
|
|
|
if (res) { |
|
|
|
this.deviceTypeList = res.map((item) => ({ label: item.name, value: item.id })) |
|
|
|
} |
|
|
|
}) |
|
|
|
getTechnicsList().then((res) => { |
|
|
|
if (res) { |
|
|
|
this.technicsTypeList = res.map((item) => ({ label: item.name, value: item.id })) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
go2, |
|
|
|
back, |
|
|
|
@ -214,12 +121,11 @@ export default { |
|
|
|
}, |
|
|
|
// 编辑初始化 |
|
|
|
init(id) { |
|
|
|
getEquipmentInfo({ id }).then((res) => { |
|
|
|
getProductionInfo({ id }).then((res) => { |
|
|
|
if (res) { |
|
|
|
Object.keys(this.form).forEach((key) => { |
|
|
|
this.form[key] = res[key] |
|
|
|
}) |
|
|
|
this.form.technicsTypeList = res.technicsTypeList.map((item) => item.id) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -260,19 +166,7 @@ export default { |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.form.cameraId) { |
|
|
|
if (!this.form.channelNum) { |
|
|
|
uni.showToast({ |
|
|
|
title: '请输入摄像头渠道号', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
let list = this.technicsTypeList.filter((item) => this.form.technicsTypeList.includes(item.value)) |
|
|
|
let technicsTypeList = list.map((item) => ({ id: item.value, name: item.label })) |
|
|
|
this.form.typeName = this.deviceTypeList.find((item) => item.value == this.form.type).label |
|
|
|
changeDevice({ ...this.form, technicsTypeList }).then((res) => { |
|
|
|
changeProduction({ ...this.form }).then((res) => { |
|
|
|
if (res) { |
|
|
|
uni.showToast({ |
|
|
|
title: '保存成功', |
|
|
|
|