|
@@ -19,34 +19,35 @@
|
|
|
<div class="value">
|
|
|
<t-input
|
|
|
v-if="item.type === 'integer'"
|
|
|
- v-model.number="pen[item.key]"
|
|
|
+ v-model.number="props.pen[item.key]"
|
|
|
placeholder="整数"
|
|
|
@change="changeValue(item.key)"
|
|
|
/>
|
|
|
<t-input-number
|
|
|
v-else-if="item.type === 'float'"
|
|
|
- v-model="pen[item.key]"
|
|
|
+ v-model="props.pen[item.key]"
|
|
|
placeholder="浮点数"
|
|
|
theme="normal"
|
|
|
@change="changeValue(item.key)"
|
|
|
/>
|
|
|
<t-switch
|
|
|
v-else-if="item.type === 'bool'"
|
|
|
- v-model="pen[item.key]"
|
|
|
+ v-model="props.pen[item.key]"
|
|
|
class="ml-8"
|
|
|
size="small"
|
|
|
@change="changeValue(item.key)"
|
|
|
/>
|
|
|
- <div
|
|
|
+ <t-button
|
|
|
v-else-if="item.type === 'array' || item.type === 'object'"
|
|
|
- class="gray ellipsis"
|
|
|
- style="height: 30px"
|
|
|
+ variant="outline"
|
|
|
+ style="padding: 0px 2px 0 4px; margin: 0 4px"
|
|
|
+ @click="editObject(item)"
|
|
|
>
|
|
|
- {{ JSON.stringify(pen[item.key]) }}
|
|
|
- </div>
|
|
|
+ <t-icon name="ellipsis" />
|
|
|
+ </t-button>
|
|
|
<t-input
|
|
|
v-else
|
|
|
- v-model="pen[item.key]"
|
|
|
+ v-model="props.pen[item.key]"
|
|
|
placeholder="字符串"
|
|
|
@change="changeValue(item.key)"
|
|
|
/>
|
|
@@ -406,6 +407,23 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</t-dialog>
|
|
|
+
|
|
|
+ <t-dialog
|
|
|
+ v-if="ojbectDialog.show"
|
|
|
+ :visible="true"
|
|
|
+ header="数据编辑"
|
|
|
+ @confirm="onOkEditOjbect"
|
|
|
+ @close="ojbectDialog.show = false"
|
|
|
+ :width="700"
|
|
|
+ >
|
|
|
+ <div class="py-8">
|
|
|
+ <CodeEditor
|
|
|
+ :json="true"
|
|
|
+ v-model="ojbectDialog.data"
|
|
|
+ style="height: 300px"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </t-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
@@ -449,25 +467,25 @@ const options = ref<any>([
|
|
|
{
|
|
|
value: 'x',
|
|
|
content: 'X',
|
|
|
- type: 'number',
|
|
|
+ type: 'float',
|
|
|
keywords: true,
|
|
|
},
|
|
|
{
|
|
|
value: 'y',
|
|
|
content: 'Y',
|
|
|
- type: 'number',
|
|
|
+ type: 'float',
|
|
|
keywords: true,
|
|
|
},
|
|
|
{
|
|
|
value: 'width',
|
|
|
content: '宽',
|
|
|
- type: 'number',
|
|
|
+ type: 'float',
|
|
|
keywords: true,
|
|
|
},
|
|
|
{
|
|
|
value: 'height',
|
|
|
content: '高',
|
|
|
- type: 'number',
|
|
|
+ type: 'float',
|
|
|
keywords: true,
|
|
|
},
|
|
|
{
|
|
@@ -484,19 +502,19 @@ const options = ref<any>([
|
|
|
{
|
|
|
value: 'progress',
|
|
|
content: '进度',
|
|
|
- type: 'number',
|
|
|
+ type: 'float',
|
|
|
keywords: true,
|
|
|
},
|
|
|
{
|
|
|
value: 'showChild',
|
|
|
content: '状态',
|
|
|
- type: 'number',
|
|
|
+ type: 'integer',
|
|
|
keywords: true,
|
|
|
},
|
|
|
{
|
|
|
value: 'rotate',
|
|
|
content: '旋转',
|
|
|
- type: 'number',
|
|
|
+ type: 'integer',
|
|
|
keywords: true,
|
|
|
},
|
|
|
]);
|
|
@@ -522,6 +540,11 @@ const dataBindDialog = reactive<any>({
|
|
|
data: undefined,
|
|
|
});
|
|
|
|
|
|
+const ojbectDialog = reactive<any>({
|
|
|
+ show: false,
|
|
|
+ data: undefined,
|
|
|
+});
|
|
|
+
|
|
|
const dataSetColumns = [
|
|
|
{
|
|
|
colKey: 'row-select',
|
|
@@ -531,13 +554,11 @@ const dataSetColumns = [
|
|
|
{
|
|
|
colKey: 'label',
|
|
|
title: '数据点名称',
|
|
|
- width: 200,
|
|
|
ellipsis: { theme: 'light', trigger: 'context-menu' },
|
|
|
},
|
|
|
{
|
|
|
colKey: 'id',
|
|
|
title: '数据点ID',
|
|
|
- width: 200,
|
|
|
ellipsis: { theme: 'light', trigger: 'context-menu' },
|
|
|
},
|
|
|
{
|
|
@@ -545,6 +566,11 @@ const dataSetColumns = [
|
|
|
title: '类型',
|
|
|
width: 100,
|
|
|
},
|
|
|
+ {
|
|
|
+ colKey: 'mock',
|
|
|
+ title: '值范围',
|
|
|
+ ellipsis: true,
|
|
|
+ },
|
|
|
];
|
|
|
|
|
|
const operatorOptions = ref<any>([
|
|
@@ -590,7 +616,7 @@ onBeforeMount(() => {
|
|
|
});
|
|
|
|
|
|
const addRealTime = (e: any) => {
|
|
|
- if (e.keywords) {
|
|
|
+ if (e.keywords || e.value === 'text') {
|
|
|
if (!props.pen.realTimes) {
|
|
|
props.pen.realTimes = [];
|
|
|
}
|
|
@@ -745,6 +771,7 @@ const onSelectBindsChange = (value: string[], options: any) => {
|
|
|
if (options.type === 'check') {
|
|
|
dataBindDialog.selectedIds = value;
|
|
|
dataBindDialog.data.bind = toRaw(options.selectedRowData[0]);
|
|
|
+ dataBindDialog.data.mock = dataBindDialog.data.bind.mock;
|
|
|
doBindInit();
|
|
|
} else if (options.type === 'uncheck') {
|
|
|
dataBindDialog.selectedIds = [];
|
|
@@ -888,6 +915,32 @@ const onInput = (item: any) => {
|
|
|
item.label = item.value;
|
|
|
};
|
|
|
|
|
|
+const editObject = (item: any) => {
|
|
|
+ ojbectDialog.data = props.pen[item.key];
|
|
|
+ ojbectDialog.item = item;
|
|
|
+ ojbectDialog.show = true;
|
|
|
+};
|
|
|
+
|
|
|
+const onOkEditOjbect = () => {
|
|
|
+ if (ojbectDialog.data) {
|
|
|
+ if (
|
|
|
+ ojbectDialog.item.type === 'array' &&
|
|
|
+ !Array.isArray(ojbectDialog.data)
|
|
|
+ ) {
|
|
|
+ MessagePlugin.error('请输入数组格式数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ props.pen[ojbectDialog.item.key] = ojbectDialog.data;
|
|
|
+ props.pen[ojbectDialog.item.key] = updatePen(
|
|
|
+ props.pen,
|
|
|
+ ojbectDialog.item.key
|
|
|
+ );
|
|
|
+ ojbectDialog.show = false;
|
|
|
+ } else {
|
|
|
+ MessagePlugin.error('请输入严格的JSON格式数据');
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
onUnmounted(() => {
|
|
|
clearInterval(timer);
|
|
|
});
|
|
@@ -930,6 +983,7 @@ onUnmounted(() => {
|
|
|
padding-right: 8px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
|
|
|
svg {
|
|
|
flex-shrink: 0;
|