mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-09-19 10:11:36 +08:00
refactor: rename Attribute.displayName to attributeName and use attributeCode as form key
This commit is contained in:
+2
-2
@@ -22,7 +22,7 @@
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
||||
|
||||
<meta content="telephone=no" name="format-detection" />
|
||||
<meta content="yes" name="apple-mobile-web-app-capable" />
|
||||
<meta content="yes" name="mobile-web-app-capable">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
|
||||
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0" name="viewport" />
|
||||
<meta
|
||||
@@ -40,7 +40,7 @@
|
||||
<noscript>
|
||||
<strong>很抱歉, 如果没有 JavaScript 支持, IoT DC3 WEB 将不能正常工作。请启用浏览器的 JavaScript 然后继续。</strong>
|
||||
</noscript>
|
||||
<script charset="utf-8" src="/js/prefixfree.min.js" type="text/javascript"></script>
|
||||
<script charset="utf-8" src="/js/prefix.min.js" type="text/javascript"></script>
|
||||
|
||||
<div id="app">
|
||||
<div class="base">
|
||||
|
||||
+10
-10
@@ -30,7 +30,7 @@
|
||||
"clipboard": "^2.0.11",
|
||||
"core-js": "^3.40.0",
|
||||
"echarts": "^5.6.0",
|
||||
"element-plus": "^2.9.3",
|
||||
"element-plus": "^2.9.4",
|
||||
"highlight.js": "^11.11.1",
|
||||
"js-base64": "^3.7.7",
|
||||
"js-cookie": "^3.0.5",
|
||||
@@ -47,17 +47,17 @@
|
||||
"vuex": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2.2.5",
|
||||
"@tauri-apps/cli": "^2.2.7",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/json-bigint": "^1.0.4",
|
||||
"@types/node": "^22.10.7",
|
||||
"@types/node": "^22.13.1",
|
||||
"@types/nprogress": "^0.2.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
||||
"@typescript-eslint/parser": "^8.21.0",
|
||||
"@vitejs/plugin-legacy": "^6.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
||||
"@typescript-eslint/parser": "^8.23.0",
|
||||
"@vitejs/plugin-legacy": "^6.0.1",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"dotenv": "^16.4.7",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint": "^9.20.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-prettier": "^5.2.3",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
@@ -65,12 +65,12 @@
|
||||
"path": "^0.12.7",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-eslint": "^16.3.0",
|
||||
"sass": "^1.83.4",
|
||||
"terser": "^5.37.0",
|
||||
"sass": "^1.84.0",
|
||||
"terser": "^5.38.1",
|
||||
"typescript": "~5.7.3",
|
||||
"unplugin-auto-import": "^19.0.0",
|
||||
"unplugin-vue-components": "^28.0.0",
|
||||
"vite": "^6.0.11",
|
||||
"vite": "^6.1.0",
|
||||
"vue-class-component": "^8.0.0-0",
|
||||
"vue-template-compiler": "^2.7.16",
|
||||
"vue-tsc": "^2.2.0"
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface Login {
|
||||
export interface Attribute {
|
||||
id: string
|
||||
name: string
|
||||
displayName: string
|
||||
attributeName: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -142,12 +142,12 @@
|
||||
<el-form ref="driverFormRef" :inline="true" :model="reactiveData.driverFormData" :v-if="reactiveData.driverFormData.length > 0">
|
||||
<div class="edit-form-item">
|
||||
<el-row>
|
||||
<el-form-item v-for="attribute in reactiveData.driverAttributes" :key="attribute.id" :label="attribute.displayName" :prop="attribute.attributeName">
|
||||
<el-form-item v-for="attribute in reactiveData.driverAttributes" :key="attribute.id" :label="attribute.attributeName" :prop="attribute.attributeCode">
|
||||
<el-input
|
||||
v-if="reactiveData.driverFormData[attribute.attributeName]"
|
||||
:key="reactiveData.driverFormData[attribute.attributeName].id"
|
||||
v-model="reactiveData.driverFormData[attribute.attributeName].configValue"
|
||||
:placeholder="'请输入' + attribute.displayName"
|
||||
v-if="reactiveData.driverFormData[attribute.attributeCode]"
|
||||
:key="reactiveData.driverFormData[attribute.attributeCode].id"
|
||||
v-model="reactiveData.driverFormData[attribute.attributeCode].configValue"
|
||||
:placeholder="'请输入' + attribute.attributeName"
|
||||
class="edit-form-default"
|
||||
clearable
|
||||
@keyup.enter="driverUpdate"
|
||||
@@ -174,12 +174,12 @@
|
||||
</div>
|
||||
<div class="edit-form-item">
|
||||
<el-row>
|
||||
<el-form-item v-for="attribute in reactiveData.pointAttributes" :key="attribute.id" :label="attribute.displayName" :prop="attribute.attributeName">
|
||||
<el-form-item v-for="attribute in reactiveData.pointAttributes" :key="attribute.id" :label="attribute.attributeName" :prop="attribute.attributeCode">
|
||||
<el-input
|
||||
v-if="reactiveData.pointFormData[attribute.attributeName]"
|
||||
:key="reactiveData.pointFormData[attribute.attributeName].id"
|
||||
v-model="reactiveData.pointFormData[attribute.attributeName].configValue"
|
||||
:placeholder="'请输入' + attribute.displayName"
|
||||
v-if="reactiveData.pointFormData[attribute.attributeCode]"
|
||||
:key="reactiveData.pointFormData[attribute.attributeCode].id"
|
||||
v-model="reactiveData.pointFormData[attribute.attributeCode].configValue"
|
||||
:placeholder="'请输入' + attribute.attributeName"
|
||||
class="edit-form-default"
|
||||
clearable
|
||||
@keyup.enter="pointUpdate"
|
||||
|
||||
@@ -240,13 +240,13 @@ export default defineComponent({
|
||||
.then((res) => {
|
||||
reactiveData.driverAttributes = res.data
|
||||
reactiveData.driverAttributeTable = reactiveData.driverAttributes.reduce((pre, cur) => {
|
||||
pre[cur.id] = cur.attributeName
|
||||
pre[cur.id] = cur.attributeCode
|
||||
return pre
|
||||
}, {})
|
||||
|
||||
const driverFormData = {}
|
||||
reactiveData.driverAttributes.forEach((attribute) => {
|
||||
driverFormData[attribute.attributeName] = {
|
||||
driverFormData[attribute.attributeCode] = {
|
||||
id: null,
|
||||
configValue: ''
|
||||
}
|
||||
@@ -264,7 +264,7 @@ export default defineComponent({
|
||||
.then((res) => {
|
||||
reactiveData.pointAttributes = res.data
|
||||
reactiveData.pointAttributeTable = reactiveData.pointAttributes.reduce((pre, cur) => {
|
||||
pre[cur.id] = cur.attributeName
|
||||
pre[cur.id] = cur.attributeCode
|
||||
return pre
|
||||
}, {})
|
||||
|
||||
@@ -282,8 +282,8 @@ export default defineComponent({
|
||||
getDriverInfoByDeviceId(reactiveData.id)
|
||||
.then((res) => {
|
||||
const formData = reactiveData.driverFormData
|
||||
res.data.forEach((info: { driverAttributeId: string | number; id: any; configValue: any }) => {
|
||||
formData[reactiveData.driverAttributeTable[info.driverAttributeId]] = {
|
||||
res.data.forEach((info: { attributeId: string | number; id: any; configValue: any }) => {
|
||||
formData[reactiveData.driverAttributeTable[info.attributeId]] = {
|
||||
id: info.id,
|
||||
configValue: info.configValue
|
||||
}
|
||||
@@ -308,7 +308,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
reactiveData.pointAttributes.forEach((attribute) => {
|
||||
pointInfo[attribute.attributeName] = {
|
||||
pointInfo[attribute.attributeCode] = {
|
||||
id: null,
|
||||
configValue: ''
|
||||
}
|
||||
@@ -318,10 +318,10 @@ export default defineComponent({
|
||||
|
||||
getPointInfoByDeviceId(reactiveData.id)
|
||||
.then((res) => {
|
||||
res.data.forEach((info: { pointId: any; pointAttributeId: string | number; id: any; configValue: any }) => {
|
||||
res.data.forEach((info: { pointId: any; attributeId: string | number; id: any; configValue: any }) => {
|
||||
reactiveData.pointInfoData.forEach((pointInfo) => {
|
||||
if (pointInfo.id === info.pointId) {
|
||||
pointInfo[reactiveData.pointAttributeTable[info.pointAttributeId]] = {
|
||||
pointInfo[reactiveData.pointAttributeTable[info.attributeId]] = {
|
||||
id: info.id,
|
||||
configValue: info.configValue
|
||||
}
|
||||
@@ -361,10 +361,10 @@ export default defineComponent({
|
||||
const driverFormData = {}
|
||||
reactiveData.driverAttributes.forEach((attribute) => {
|
||||
const driverInfo = {
|
||||
id: reactiveData.driverFormData[attribute.attributeName].id,
|
||||
driverAttributeId: attribute.id,
|
||||
id: reactiveData.driverFormData[attribute.attributeCode].id,
|
||||
attributeId: attribute.id,
|
||||
deviceId: reactiveData.id,
|
||||
configValue: reactiveData.driverFormData[attribute.attributeName].configValue
|
||||
configValue: reactiveData.driverFormData[attribute.attributeCode].configValue
|
||||
}
|
||||
|
||||
driverInfo.id
|
||||
@@ -379,8 +379,8 @@ export default defineComponent({
|
||||
// nothing to do
|
||||
})
|
||||
|
||||
function loadFormData(res: { id: any; driverAttributeId?: any; deviceId?: string; configValue: any }) {
|
||||
driverFormData[attribute.attributeName] = {
|
||||
function loadFormData(res: { id: any; attributeId?: any; deviceId?: string; configValue: any }) {
|
||||
driverFormData[attribute.attributeCode] = {
|
||||
id: res.id,
|
||||
configValue: res.configValue
|
||||
}
|
||||
@@ -397,11 +397,11 @@ export default defineComponent({
|
||||
if (valid) {
|
||||
reactiveData.pointAttributes.forEach((attribute) => {
|
||||
const pointInfo = {
|
||||
id: reactiveData.pointFormData[attribute.attributeName].id,
|
||||
pointAttributeId: attribute.id,
|
||||
id: reactiveData.pointFormData[attribute.attributeCode].id,
|
||||
attributeId: attribute.id,
|
||||
deviceId: reactiveData.id,
|
||||
pointId: reactiveData.pointFormData.id,
|
||||
configValue: reactiveData.pointFormData[attribute.attributeName].configValue
|
||||
configValue: reactiveData.pointFormData[attribute.attributeCode].configValue
|
||||
}
|
||||
|
||||
pointInfo.id
|
||||
@@ -416,10 +416,10 @@ export default defineComponent({
|
||||
// nothing to do
|
||||
})
|
||||
|
||||
function loadFormData(res: { id: any; pointAttributeId?: any; deviceId?: string; pointId?: any; configValue: any }) {
|
||||
function loadFormData(res: { id: any; attributeId?: any; deviceId?: string; pointId?: any; configValue: any }) {
|
||||
reactiveData.pointInfoData.forEach((pointInfo) => {
|
||||
if (pointInfo.id === reactiveData.pointFormData.id) {
|
||||
pointInfo[attribute.attributeName] = {
|
||||
pointInfo[attribute.attributeCode] = {
|
||||
id: res.id,
|
||||
configValue: res.configValue
|
||||
}
|
||||
@@ -435,8 +435,8 @@ export default defineComponent({
|
||||
|
||||
const selectPoint = (row: { [x: string]: { id: null; configValue: string }; id: any }) => {
|
||||
reactiveData.pointAttributes.forEach((attribute) => {
|
||||
if (!row[attribute.attributeName]) {
|
||||
row[attribute.attributeName] = {
|
||||
if (!row[attribute.attributeCode]) {
|
||||
row[attribute.attributeCode] = {
|
||||
id: null,
|
||||
configValue: ''
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<el-icon>
|
||||
<Goblet />
|
||||
</el-icon>
|
||||
{{ attribute.displayName }}: {{ data[attribute.attributeName].configValue }}
|
||||
{{ attribute.attributeName }}: {{ data[attribute.attributeCode].configValue }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@ export default defineComponent({
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
attributeName: '',
|
||||
attributeCode: '',
|
||||
defaultValue: '',
|
||||
remark: '',
|
||||
createTime: '',
|
||||
@@ -53,7 +53,7 @@ export default defineComponent({
|
||||
const isConfig = computed(() => {
|
||||
for (let i = 0; i < props.attributes.length; i++) {
|
||||
const attribute = props.attributes[i] as any
|
||||
if (props.data[attribute.attributeName].configValue === '') {
|
||||
if (props.data[attribute.attributeCode].configValue === '') {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user