|
@@ -15,6 +15,20 @@
|
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row :gutter="100">
|
|
<el-row :gutter="100">
|
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
|
|
|
|
|
+ <!-- <el-form-item label="所在部门" prop="groupName">
|
|
|
|
|
+ <el-tree-select
|
|
|
|
|
+ v-model="form.groupName"
|
|
|
|
|
+ :data="deptList"
|
|
|
|
|
+ :props="defaultProps"
|
|
|
|
|
+ check-strictly
|
|
|
|
|
+ node-key="id"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ placeholder="请选择所在部门"
|
|
|
|
|
+ @change="handleDeptChange"
|
|
|
|
|
+ :disabled="form.status == 2 || form.isOwner == 0"
|
|
|
|
|
+
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item> -->
|
|
|
<el-form-item :label="t('product.product-edit473153-1')" prop="productName">
|
|
<el-form-item :label="t('product.product-edit473153-1')" prop="productName">
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="form.productName"
|
|
v-model="form.productName"
|
|
@@ -65,13 +79,10 @@
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item v-if="form.deviceType !== 3 && tempOpen">
|
|
<el-form-item v-if="form.deviceType !== 3 && tempOpen">
|
|
|
-
|
|
|
|
|
- <el-alert
|
|
|
|
|
- description="当前通讯协议为modbus协议,请选择采集点模板,默认添加设备为网关设备"
|
|
|
|
|
- type="success"
|
|
|
|
|
-
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <el-alert
|
|
|
|
|
+ description="当前通讯协议为modbus协议,请选择采集点模板,默认添加设备为网关设备"
|
|
|
|
|
+ type="success"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item v-if="tempOpen && selectRowData" prop="templateId">
|
|
<el-form-item v-if="tempOpen && selectRowData" prop="templateId">
|
|
|
<template #label>
|
|
<template #label>
|
|
@@ -905,7 +916,7 @@ import configSip from '../sip/sipconfig.vue'
|
|
|
import productScada from './product-scada.vue'
|
|
import productScada from './product-scada.vue'
|
|
|
import { listProtocol } from '@/api/pms/video/protocol'
|
|
import { listProtocol } from '@/api/pms/video/protocol'
|
|
|
|
|
|
|
|
-import { listShortCategory,listCategory } from '@/api/pms/video/category'
|
|
|
|
|
|
|
+import { listShortCategory, listCategory } from '@/api/pms/video/category'
|
|
|
import { getDicts } from '@/api/pms/video/dicts'
|
|
import { getDicts } from '@/api/pms/video/dicts'
|
|
|
import {
|
|
import {
|
|
|
addProduct,
|
|
addProduct,
|
|
@@ -921,6 +932,10 @@ import Crontab from './components/Crontab/index.vue'
|
|
|
import { getAccessToken } from '@/utils/auth'
|
|
import { getAccessToken } from '@/utils/auth'
|
|
|
import { View, QuestionFilled, Timer, Minus, Plus, Search, Refresh } from '@element-plus/icons-vue'
|
|
import { View, QuestionFilled, Timer, Minus, Plus, Search, Refresh } from '@element-plus/icons-vue'
|
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
|
|
|
+import DeptTree from '@/views/system/user/DeptTree.vue'
|
|
|
|
|
+import { defaultProps, handleTree } from '@/utils/tree'
|
|
|
|
|
+import * as DeptApi from '@/api/system/dept'
|
|
|
|
|
+import { IotDeviceApi } from '@/api/pms/device'
|
|
|
|
|
|
|
|
// 定义组件名称和属性
|
|
// 定义组件名称和属性
|
|
|
defineOptions({
|
|
defineOptions({
|
|
@@ -1007,9 +1022,34 @@ const userRule = {
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const deptList = ref([]) // 树形结构
|
|
|
|
|
+let selectedDeptId = ref(null)
|
|
|
|
|
+// 新增时部门改变时获取设备列表
|
|
|
|
|
+const handleDeptChange = async (deptId) => {
|
|
|
|
|
+ if (deptId) {
|
|
|
|
|
+ selectedDeptId.value = deptId
|
|
|
|
|
+ getDeviceList(deptId)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+// 获取设备列表
|
|
|
|
|
+const deviceOptions = ref([])
|
|
|
|
|
+const getDeviceList = async (deptId) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await IotDeviceApi.getIotDeviceSetOptions(deptId)
|
|
|
|
|
+ deviceOptions.value = res.map((item) => ({
|
|
|
|
|
+ key: item.id, // 始终使用id作为key
|
|
|
|
|
+ label: `${item.deviceName} (${item.deviceCode})`,
|
|
|
|
|
+ ...item
|
|
|
|
|
+ }))
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error(err)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const form = reactive({
|
|
const form = reactive({
|
|
|
networkMethod: 1,
|
|
networkMethod: 1,
|
|
|
deviceType: 1,
|
|
deviceType: 1,
|
|
|
|
|
+ groupName:'',
|
|
|
vertificateMethod: 3,
|
|
vertificateMethod: 3,
|
|
|
transport: 'MQTT',
|
|
transport: 'MQTT',
|
|
|
imgUrl: '',
|
|
imgUrl: '',
|
|
@@ -1065,6 +1105,7 @@ const tempOpen = ref(false)
|
|
|
|
|
|
|
|
// 表单校验
|
|
// 表单校验
|
|
|
const rules = {
|
|
const rules = {
|
|
|
|
|
+ groupName: [{ required: true, message: '请选择部门', trigger: 'change' }],
|
|
|
productName: [
|
|
productName: [
|
|
|
{
|
|
{
|
|
|
required: true,
|
|
required: true,
|
|
@@ -1228,8 +1269,6 @@ const handleDelete = (xh, row) => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// 获取简短分类列表
|
|
// 获取简短分类列表
|
|
|
const getShortCategory = () => {
|
|
const getShortCategory = () => {
|
|
|
listCategory().then((response) => {
|
|
listCategory().then((response) => {
|
|
@@ -1252,7 +1291,7 @@ const goBack = () => {
|
|
|
const getProductInfo = () => {
|
|
const getProductInfo = () => {
|
|
|
getProduct(form.productId).then((response) => {
|
|
getProduct(form.productId).then((response) => {
|
|
|
Object.assign(form, response)
|
|
Object.assign(form, response)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (form.transport === 'HTTP') {
|
|
if (form.transport === 'HTTP') {
|
|
|
Object.assign(userParmas, form.userParmas)
|
|
Object.assign(userParmas, form.userParmas)
|
|
|
form.bodyDataTable = []
|
|
form.bodyDataTable = []
|
|
@@ -1262,7 +1301,7 @@ const getProductInfo = () => {
|
|
|
|
|
|
|
|
if (form.contentTypeNumber === 2 || form.contentTypeNumber === 3) {
|
|
if (form.contentTypeNumber === 2 || form.contentTypeNumber === 3) {
|
|
|
let data1 = JSON.parse(form.data)
|
|
let data1 = JSON.parse(form.data)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
var dataJSONObj = data1
|
|
var dataJSONObj = data1
|
|
|
if (Object.prototype.toString.call(data1) !== '[object Object]') {
|
|
if (Object.prototype.toString.call(data1) !== '[object Object]') {
|
|
|
dataJSONObj = JSON.parse(data1)
|
|
dataJSONObj = JSON.parse(data1)
|
|
@@ -1499,9 +1538,7 @@ const changeProductStatusAsync = async (status) => {
|
|
|
/** 选择分类 */
|
|
/** 选择分类 */
|
|
|
const selectCategory = (val) => {
|
|
const selectCategory = (val) => {
|
|
|
for (let i = 0; i < categoryShortList.value.length; i++) {
|
|
for (let i = 0; i < categoryShortList.value.length; i++) {
|
|
|
-
|
|
|
|
|
if (categoryShortList.value[i].categoryId == val) {
|
|
if (categoryShortList.value[i].categoryId == val) {
|
|
|
-
|
|
|
|
|
form.categoryName = categoryShortList.value[i].categoryName
|
|
form.categoryName = categoryShortList.value[i].categoryName
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -1524,8 +1561,10 @@ const changeInputType = (name) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const isInitialized = ref(false)
|
|
|
// 授权码状态修改
|
|
// 授权码状态修改
|
|
|
const changeIsAuthorize = () => {
|
|
const changeIsAuthorize = () => {
|
|
|
|
|
+ if (!isInitialized.value) return
|
|
|
let text =
|
|
let text =
|
|
|
form.isAuthorize == '1'
|
|
form.isAuthorize == '1'
|
|
|
? t('product.product-edit473153-72')
|
|
? t('product.product-edit473153-72')
|
|
@@ -1599,7 +1638,6 @@ const getTempList = () => {
|
|
|
|
|
|
|
|
const getList = () => {
|
|
const getList = () => {
|
|
|
getAllPoints(pointsParams).then((response) => {
|
|
getAllPoints(pointsParams).then((response) => {
|
|
|
-
|
|
|
|
|
pointList.value = response
|
|
pointList.value = response
|
|
|
total.value = response.length || 0
|
|
total.value = response.length || 0
|
|
|
})
|
|
})
|
|
@@ -1612,7 +1650,6 @@ const submitSelect = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getCurrentRow = (val) => {
|
|
const getCurrentRow = (val) => {
|
|
|
-
|
|
|
|
|
if (val != null) {
|
|
if (val != null) {
|
|
|
selectRowData.value = val
|
|
selectRowData.value = val
|
|
|
}
|
|
}
|
|
@@ -1685,7 +1722,7 @@ const updateModel = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Lifecycle hooks
|
|
// Lifecycle hooks
|
|
|
-onMounted(() => {
|
|
|
|
|
|
|
+onMounted(async() => {
|
|
|
// 获取产品信息
|
|
// 获取产品信息
|
|
|
const productId = route.query && route.query.productId
|
|
const productId = route.query && route.query.productId
|
|
|
form.productId = productId
|
|
form.productId = productId
|
|
@@ -1716,7 +1753,6 @@ onMounted(() => {
|
|
|
|
|
|
|
|
// iot_network_method
|
|
// iot_network_method
|
|
|
getDicts('iot_network_method').then((response) => {
|
|
getDicts('iot_network_method').then((response) => {
|
|
|
-
|
|
|
|
|
iot_network_method.value = response
|
|
iot_network_method.value = response
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -1732,6 +1768,11 @@ onMounted(() => {
|
|
|
getDicts('sub_gateway_type').then((response) => {
|
|
getDicts('sub_gateway_type').then((response) => {
|
|
|
sub_gateway_type.value = response
|
|
sub_gateway_type.value = response
|
|
|
})
|
|
})
|
|
|
|
|
+ deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
|
|
|
|
+
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ isInitialized.value = true
|
|
|
|
|
+ }, 0)
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -1757,6 +1798,6 @@ onMounted(() => {
|
|
|
transform: translate(0, -50%);
|
|
transform: translate(0, -50%);
|
|
|
}
|
|
}
|
|
|
::v-deep .el-alert__description {
|
|
::v-deep .el-alert__description {
|
|
|
- font-size: 12px;
|
|
|
|
|
|
|
+ font-size: 12px;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|