|
@@ -15,11 +15,11 @@
|
|
|
<el-table :data="comdata" border class="datatable">
|
|
|
<el-table-column type="index" width="40" label="" />
|
|
|
<el-table-column prop="name" label="属性"> </el-table-column>
|
|
|
- <el-table-column prop="val" label="值">
|
|
|
+ <el-table-column prop="value" label="值">
|
|
|
<template #default="{ row }">
|
|
|
<el-select
|
|
|
v-if="row.valueType === 1"
|
|
|
- v-model="row.val"
|
|
|
+ v-model="row.value"
|
|
|
placeholder="请选择"
|
|
|
class="full-width-select"
|
|
|
>
|
|
@@ -33,13 +33,14 @@
|
|
|
</el-select>
|
|
|
<el-input
|
|
|
v-else-if="row.valueType === 2"
|
|
|
- v-model="row.val"
|
|
|
+ v-model="row.value"
|
|
|
class="full-width-input"
|
|
|
/>
|
|
|
<el-button
|
|
|
v-else-if="row.valueType === 3"
|
|
|
@click="handleClick(row)"
|
|
|
></el-button>
|
|
|
+ <div v-else>{{ row.valueDef }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="unit" label="单位" width="100">
|
|
@@ -83,8 +84,8 @@
|
|
|
</el-tab-pane> -->
|
|
|
</el-tabs>
|
|
|
</el-main>
|
|
|
-
|
|
|
- <!-- 用于数据按钮table -->
|
|
|
+
|
|
|
+ <!-- 用于数据按钮键值对 -->
|
|
|
<el-dialog
|
|
|
v-model="paneTabledialog"
|
|
|
align-center
|
|
@@ -103,20 +104,20 @@
|
|
|
<el-table-colum prop="name" label="属性"></el-table-colum>
|
|
|
<el-table-colum prop="" label="值"></el-table-colum>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<template #footer>
|
|
|
<span class="lastbtn">
|
|
|
<el-button @click="paneTabledialog = false">{{
|
|
|
$t("dialog.cancel")
|
|
|
}}</el-button>
|
|
|
- <el-button type="primary" >
|
|
|
+ <el-button type="primary">
|
|
|
{{ $t("dialog.ok") }}
|
|
|
</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- 用于数据按钮键值对 -->
|
|
|
+ <!-- 用于数据按钮table -->
|
|
|
<el-dialog
|
|
|
v-model="paneKVdialog"
|
|
|
align-center
|
|
@@ -141,19 +142,18 @@
|
|
|
:min-width="100"
|
|
|
/>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<template #footer>
|
|
|
<span class="lastbtn">
|
|
|
<el-button @click="paneKVdialog = false">{{
|
|
|
$t("dialog.cancel")
|
|
|
}}</el-button>
|
|
|
- <el-button type="primary" >
|
|
|
+ <el-button type="primary">
|
|
|
{{ $t("dialog.ok") }}
|
|
|
</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
</el-container>
|
|
|
</template>
|
|
|
<script setup>
|
|
@@ -173,14 +173,14 @@ const activename = ref("data")
|
|
|
|
|
|
const emit = defineEmits(["close"])
|
|
|
|
|
|
-const titlename = ref();
|
|
|
+const titlename = ref()
|
|
|
const comdata = ref()
|
|
|
const paneTabledialog = ref(false)
|
|
|
const paneKVdialog = ref(false)
|
|
|
|
|
|
// data表格按钮点击弹窗表格
|
|
|
-const tableColumns = ref([]);
|
|
|
-const tableData = ref([]);
|
|
|
+const tableColumns = ref([])
|
|
|
+const tableData = ref([])
|
|
|
|
|
|
const closePanel = () => {
|
|
|
emit("close")
|
|
@@ -208,8 +208,8 @@ const getcomdata = (pcId) => {
|
|
|
|
|
|
if (item.unitType !== "无") {
|
|
|
getlistopt(item, "unit")
|
|
|
- }else {
|
|
|
- item.unit = '无';
|
|
|
+ } else {
|
|
|
+ item.unit = "无"
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -220,7 +220,7 @@ const getcomdata = (pcId) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const getbtnvalue = (pcaId,dataType) => {
|
|
|
+const getbtnvalue = (pcaId, dataType) => {
|
|
|
const params = {
|
|
|
transCode: "ES0010",
|
|
|
pcaId: pcaId
|
|
@@ -228,12 +228,10 @@ const getbtnvalue = (pcaId,dataType) => {
|
|
|
request(params)
|
|
|
.then((res) => {
|
|
|
console.log(`值获取成功 [${pcaId}]:`, res)
|
|
|
- if(dataType === 1){
|
|
|
- tableColumns.value = res.headers || [];
|
|
|
- tableData.value = res.datas || [];
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
+ if (dataType === 1) {
|
|
|
+ tableColumns.value = res.headers || []
|
|
|
+ tableData.value = res.datas || []
|
|
|
+ } else {
|
|
|
}
|
|
|
})
|
|
|
.catch((err) => {
|
|
@@ -259,10 +257,14 @@ const getlistopt = (item, gettype) => {
|
|
|
console.log("选项获取成功", res)
|
|
|
|
|
|
if (gettype === "value") {
|
|
|
- item.val = res.rows[0].val
|
|
|
+ if (item.value === undefined || item.value === null) {
|
|
|
+ item.value = res.rows?.[0]?.val ?? ""
|
|
|
+ }
|
|
|
item.options = res.rows || []
|
|
|
} else {
|
|
|
- item.unit = res.rows[0].val
|
|
|
+ if (item.unit === undefined || item.unit === null) {
|
|
|
+ item.unit = res.rows?.[0]?.val ?? ""
|
|
|
+ }
|
|
|
item.unitoptions = res.rows || []
|
|
|
}
|
|
|
})
|
|
@@ -273,31 +275,31 @@ const getlistopt = (item, gettype) => {
|
|
|
}
|
|
|
|
|
|
const handleClick = (row) => {
|
|
|
- paneTabledialog.value = true;
|
|
|
- const pcaId = row.pcaId;
|
|
|
- const dataType = row.dataType;
|
|
|
- getbtnvalue(pcaId,dataType)
|
|
|
+ paneTabledialog.value = true
|
|
|
+ const pcaId = row.pcaId
|
|
|
+ const dataType = row.dataType
|
|
|
+ getbtnvalue(pcaId, dataType)
|
|
|
}
|
|
|
|
|
|
const savecomvalue = () => {
|
|
|
- console.log('comdata:',comdata.value)
|
|
|
+ console.log("comdata:", comdata.value)
|
|
|
// dataType 为 -1 的数据
|
|
|
- const validItems = comdata.value.filter(item => item.dataType === -1);
|
|
|
+ const validItems = comdata.value.filter((item) => item.dataType === -1)
|
|
|
const pcavals = validItems
|
|
|
- .map(item => {
|
|
|
- const pcaId = item.pcaId ?? "";
|
|
|
- const val = item.val ?? "";
|
|
|
- const unit = item.unit ?? "";
|
|
|
- return `${pcaId},${val},${unit}`;
|
|
|
- })
|
|
|
- .join(';');
|
|
|
+ .map((item) => {
|
|
|
+ const pcaId = item.pcaId ?? ""
|
|
|
+ const value = item.value ?? ""
|
|
|
+ const unit = item.unit ?? ""
|
|
|
+ return `${pcaId},${value},${unit}`
|
|
|
+ })
|
|
|
+ .join(";")
|
|
|
const params = {
|
|
|
transCode: "ES0008",
|
|
|
- pcavals:pcavals
|
|
|
+ pcavals: pcavals
|
|
|
}
|
|
|
request(params)
|
|
|
.then((res) => {
|
|
|
- ElMessage.success("保存成功");
|
|
|
+ ElMessage.success("保存成功")
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
console.error("err", err)
|