Browse Source

‘设备信息和参数临时代码的测试版’

pull/1/head
ljlong_2630 1 year ago
parent
commit
eac8eee9d0
  1. 57
      src/views/model/device/index.vue
  2. 62
      src/views/model/params/index.vue

57
src/views/model/device/index.vue

@ -64,12 +64,15 @@
/>
</el-form-item>
<el-form-item label="所属组织名称" prop="orgName">
<el-input
<!-- <el-input
v-model="queryParams.orgName"
placeholder="请输入所属组织名称"
clearable
@keyup.enter="handleQuery"
/>
/> -->
<el-tree-select v-model="queryParams.orgName" :data="deptOptions"
:props="{ value: 'label', label: 'label', children: 'children' }" value-key="id" placeholder="请选择组织名称"
check-strictly :default-expand-all="true"/>
</el-form-item>
<el-form-item label="位置编码" prop="locationCode">
<el-input
@ -271,7 +274,7 @@
<!-- 添加或修改设备信息对话框 -->
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
<el-form ref="deviceRef" :model="form" :rules="rules" label-width="120px">
<el-form ref="deviceRef" :model="form" :rules="rules" label-width="125px">
<el-row>
<el-col :span="12">
<el-form-item label="中台设备编码" prop="centerDeviceCode">
@ -318,13 +321,15 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属组织编码" prop="orgCode">
<el-input v-model="form.orgCode" placeholder="请输入所属组织编码" />
<el-form-item label="所属组织名称" prop="orgName">
<el-tree-select v-model="form.orgName" :data="deptOptions"
:props="{ value: 'label', label: 'label', children: 'children' }" value-key="id" placeholder="请选择"
check-strictly :default-expand-all="true" @node-click="selectDept"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属组织名称" prop="orgName">
<el-input v-model="form.orgName" placeholder="请输入所属组织名称" />
<el-form-item label="所属组织编码" prop="orgCode">
<el-input v-model="form.orgCode" placeholder="请选择组织名称" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -414,7 +419,7 @@
</style>
<script setup name="Device">
import { getUuid, listDevice, getDevice, delDevice, addDevice, updateDevice } from "@/api/model/device";
import { deptTreeSelect } from "@/api/system/user";
const { proxy } = getCurrentInstance();
const { dc_device_type } = proxy.useDict('dc_device_type');
const router = useRouter();
@ -430,6 +435,7 @@ const total = ref(0);
const title = ref("");
const collapseVisible = ref(false);
const editName = ref("更多筛选项");
const deptOptions = ref([]);
const enabledFlag = ref([
{label: '可用', value: true, elTagType: 'default', elTagClass: null},
{label: '不可用', value: false, elTagType: 'default', elTagClass: null}
@ -475,6 +481,27 @@ const data = reactive({
deviceGroupId: null
},
rules: {
deviceName: [
{ required: true, message: "设备名称不能为空", trigger: "change" }
],
orgCode: [
{ required: true, message: "设备编号不能为空", trigger: "change" }
],
deviceSource: [
{ required: true, message: "通信来源类型不能为空", trigger: "change" }
],
deviceSourceId: [
{ required: true, message: "通讯来源设备ID不能为空", trigger: "change" }
],
deviceType: [
{ required: true, message: "设备类型不能为空", trigger: "change" }
],
orgName: [
{ required: true, message: "所属组织名称", trigger: "change" }
],
orgCode: [
{ required: true, message: "所属组织编码", trigger: "change" }
],
}
});
@ -558,6 +585,7 @@ function handleAdd() {
loading.value = true;
getUuid().then(response=>{
form.value.centerDeviceCode = response.msg;
form.value.enabledFlag = true;
loading.value = false;
});
reset();
@ -645,5 +673,18 @@ function toggleCollapse() {
}
}
function getDeptTree() {
deptTreeSelect().then(response => {
deptOptions.value = response.data;
console.log("deptOptions");
console.log(deptOptions.value);
});
};
function selectDept(val){
form.value.orgCode=val.id;
}
getDeptTree();
getList();
</script>

62
src/views/model/params/index.vue

@ -107,11 +107,6 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="queryParams.controllab" placeholder="请选择是/否可控制" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</div>
</el-collapse-transition>
<el-form-item class="childTextAlignCenter">
@ -190,7 +185,6 @@
</el-table-column>
<el-table-column label="分区(字典)" align="center" prop="partion" :width="120"/>
<el-table-column label="plc地址" align="center" prop="plcAdr" :width="120"/>
<el-table-column label="是/否可控制" align="center" prop="controllab" :width="120"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" fixed="right">
<template #default="scope">
<el-button
@ -330,18 +324,6 @@
<el-input v-model="form.plcAdr" placeholder="请输入plc地址" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是/否可控制" prop="controllab">
<el-select v-model="form.controllab" placeholder="请选择是/否可控制">
<el-option
v-for="dict in controllab"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
@ -418,7 +400,49 @@ const data = reactive({
controllab: null
},
rules: {
}
deviceUuid: [
{ required: true, message: "中台设备UUID不能为空", trigger: "blur" }
],
paramName: [
{ required: true, message: "参数名称不能为空", trigger: "blur" }
],
paramCode: [
{ required: true, message: "参数编码不能为空", trigger: "blur" }
],
paramType: [
{ required: true, message: "数据类型不能为空", trigger: "change" }
],
contrlFlag: [
{ required: true, message: "是否可控不能为空", trigger: "change" }
],
contrlType: [
{ required: true, message: "参数单位不能为空", trigger: "change" }
],
enabled: [
{ required: true, message: "是否有效不能为空", trigger: "change" }
],
// setDefautvalue: [
// { required: true, message: "", trigger: "blur" }
// ],
// setAdjustvalue: [
// { required: true, message: "", trigger: "blur" }
// ],
// validateScope: [
// { required: true, message: ";0.0-100.00", trigger: "blur" }
// ],
globalCode: [
{ required: true, message: "全局统一编码不能为空", trigger: "blur" }
],
paramModelId: [
{ required: true, message: "参数模版ID不能为空", trigger: "change" }
],
partion: [
{ required: true, message: "分区(字典)不能为空", trigger: "change" }
],
plcAdr: [
{ required: true, message: "plc地址不能为空", trigger: "blur" }
],
},
});
const { queryParams, form, rules } = toRefs(data);

Loading…
Cancel
Save