|
@@ -21,7 +21,7 @@
|
|
<t-icon
|
|
<t-icon
|
|
name="link"
|
|
name="link"
|
|
class="hover"
|
|
class="hover"
|
|
- :class="{ primary: item.binds?.length }"
|
|
|
|
|
|
+ :class="{ primary: item.binds?.id }"
|
|
@click="onBind(item)"
|
|
@click="onBind(item)"
|
|
/>
|
|
/>
|
|
</t-tooltip>
|
|
</t-tooltip>
|
|
@@ -196,15 +196,15 @@
|
|
class="data-link-dialog"
|
|
class="data-link-dialog"
|
|
header="动态数据绑定"
|
|
header="动态数据绑定"
|
|
@close="
|
|
@close="
|
|
- dataBindDialog.data.binds = dataBindDialog.bkBinds;
|
|
|
|
- dataBindDialog.show = false;
|
|
|
|
|
|
+ // dataBindDialog.data.binds = dataBindDialog.bkBinds;
|
|
|
|
+ dataBindDialog.show = false
|
|
"
|
|
"
|
|
@confirm="dataBindDialog.show = false"
|
|
@confirm="dataBindDialog.show = false"
|
|
:width="700"
|
|
:width="700"
|
|
>
|
|
>
|
|
<div class="form-item">
|
|
<div class="form-item">
|
|
<label>当前绑定:</label>
|
|
<label>当前绑定:</label>
|
|
- <div class="label" v-if="dataBindDialog.data.binds?.length">
|
|
|
|
|
|
+ <!-- <div class="label" v-if="dataBindDialog.data.binds?.length">
|
|
<t-tooltip
|
|
<t-tooltip
|
|
v-for="(tag, index) in dataBindDialog.data.binds"
|
|
v-for="(tag, index) in dataBindDialog.data.binds"
|
|
:key="index"
|
|
:key="index"
|
|
@@ -214,6 +214,13 @@
|
|
{{ tag.label }}
|
|
{{ tag.label }}
|
|
</t-tag>
|
|
</t-tag>
|
|
</t-tooltip>
|
|
</t-tooltip>
|
|
|
|
+ </div> -->
|
|
|
|
+ <div class="label" v-if="dataBindDialog.data.binds?.id">
|
|
|
|
+ <t-tooltip :content="dataBindDialog.data.binds?.id">
|
|
|
|
+ <t-tag class="mr-8 mb-8" closable @close="onRemoveBind()">
|
|
|
|
+ {{ dataBindDialog.data.binds?.label }}
|
|
|
|
+ </t-tag>
|
|
|
|
+ </t-tooltip>
|
|
</div>
|
|
</div>
|
|
<div class="label gray" v-else>无</div>
|
|
<div class="label gray" v-else>无</div>
|
|
</div>
|
|
</div>
|
|
@@ -521,7 +528,7 @@ const dataBindDialog = reactive<any>({
|
|
const dataSetColumns = [
|
|
const dataSetColumns = [
|
|
{
|
|
{
|
|
colKey: 'row-select',
|
|
colKey: 'row-select',
|
|
- type: 'multiple',
|
|
|
|
|
|
+ type: 'single',
|
|
width: 50,
|
|
width: 50,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -661,19 +668,25 @@ const onMenuMore = (e: any, item: any, i: number) => {
|
|
};
|
|
};
|
|
|
|
|
|
const onBind = (item: any) => {
|
|
const onBind = (item: any) => {
|
|
- if (!item.binds) {
|
|
|
|
- item.binds = [];
|
|
|
|
- }
|
|
|
|
|
|
+ // if (!item.binds) {
|
|
|
|
+ // item.binds = [];
|
|
|
|
+ // }
|
|
|
|
+ // dataBindDialog.data = item;
|
|
|
|
+ // dataBindDialog.input = '';
|
|
|
|
+ // dataBindDialog.selectedIds = [];
|
|
|
|
+ // for (const i of item.binds) {
|
|
|
|
+ // dataBindDialog.selectedIds.push(i.id);
|
|
|
|
+ // }
|
|
|
|
+ // dataBindDialog.bkBinds = [];
|
|
|
|
+ // dataBindDialog.bkBinds.push(...item.binds);
|
|
|
|
+ // dataBindDialog.show = true;
|
|
dataBindDialog.data = item;
|
|
dataBindDialog.data = item;
|
|
dataBindDialog.input = '';
|
|
dataBindDialog.input = '';
|
|
dataBindDialog.selectedIds = [];
|
|
dataBindDialog.selectedIds = [];
|
|
- for (const i of item.binds) {
|
|
|
|
- dataBindDialog.selectedIds.push(i.id);
|
|
|
|
|
|
+ if (item.binds && item.binds.id) {
|
|
|
|
+ dataBindDialog.selectedIds.push(item.binds.id);
|
|
}
|
|
}
|
|
- dataBindDialog.bkBinds = [];
|
|
|
|
- dataBindDialog.bkBinds.push(...item.binds);
|
|
|
|
dataBindDialog.show = true;
|
|
dataBindDialog.show = true;
|
|
-
|
|
|
|
getDataset();
|
|
getDataset();
|
|
};
|
|
};
|
|
|
|
|
|
@@ -708,59 +721,65 @@ const onChangePagination = (pageInfo: any) => {
|
|
};
|
|
};
|
|
|
|
|
|
const onSelectBindsChange = (value: string[], options: any) => {
|
|
const onSelectBindsChange = (value: string[], options: any) => {
|
|
- dataBindDialog.selectedIds = value;
|
|
|
|
|
|
+ // dataBindDialog.selectedIds = value;
|
|
|
|
|
|
if (options.type === 'check') {
|
|
if (options.type === 'check') {
|
|
- for (const item of options.selectedRowData) {
|
|
|
|
- const found = dataBindDialog.data.binds.findIndex((elem: any) => {
|
|
|
|
- return elem.id === item.id;
|
|
|
|
- });
|
|
|
|
- if (found < 0) {
|
|
|
|
- dataBindDialog.data.binds.push(toRaw(item));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // for (const item of options.selectedRowData) {
|
|
|
|
+ // const found = dataBindDialog.data.binds.findIndex((elem: any) => {
|
|
|
|
+ // return elem.id === item.id;
|
|
|
|
+ // });
|
|
|
|
+ // if (found < 0) {
|
|
|
|
+ // dataBindDialog.data.binds.push(toRaw(item));
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ dataBindDialog.selectedIds = value;
|
|
|
|
+ dataBindDialog.data.binds = toRaw(options.selectedRowData[0]);
|
|
} else if (options.type === 'uncheck') {
|
|
} else if (options.type === 'uncheck') {
|
|
- if (options.currentRowKey === 'CHECK_ALL_BOX') {
|
|
|
|
- for (const data of dataBindDialog.dataSet) {
|
|
|
|
- const found = dataBindDialog.data.binds.findIndex((elem: any) => {
|
|
|
|
- return elem.id === data.id;
|
|
|
|
- });
|
|
|
|
- if (found > -1) {
|
|
|
|
- dataBindDialog.data.binds.splice(found, 1);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- const found = dataBindDialog.data.binds.findIndex((elem: any) => {
|
|
|
|
- return elem.id === options.currentRowKey;
|
|
|
|
- });
|
|
|
|
- if (found > -1) {
|
|
|
|
- dataBindDialog.data.binds.splice(found, 1);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // if (options.currentRowKey === 'CHECK_ALL_BOX') {
|
|
|
|
+ // for (const data of dataBindDialog.dataSet) {
|
|
|
|
+ // const found = dataBindDialog.data.binds.findIndex((elem: any) => {
|
|
|
|
+ // return elem.id === data.id;
|
|
|
|
+ // });
|
|
|
|
+ // if (found > -1) {
|
|
|
|
+ // dataBindDialog.data.binds.splice(found, 1);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // const found = dataBindDialog.data.binds.findIndex((elem: any) => {
|
|
|
|
+ // return elem.id === options.currentRowKey;
|
|
|
|
+ // });
|
|
|
|
+ // if (found > -1) {
|
|
|
|
+ // dataBindDialog.data.binds.splice(found, 1);
|
|
|
|
+ // }
|
|
|
|
+ dataBindDialog.selectedIds = [];
|
|
|
|
+ dataBindDialog.data.binds = {};
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-const onRemoveBind = (index: number) => {
|
|
|
|
- dataBindDialog.data.binds.splice(index, 1);
|
|
|
|
|
|
+const onRemoveBind = () => {
|
|
|
|
+ // dataBindDialog.data.binds.splice(index, 1);
|
|
|
|
|
|
dataBindDialog.selectedIds = [];
|
|
dataBindDialog.selectedIds = [];
|
|
- for (const i of dataBindDialog.data.binds) {
|
|
|
|
- dataBindDialog.selectedIds.push(i.id);
|
|
|
|
- }
|
|
|
|
|
|
+ // for (const i of dataBindDialog.data.binds) {
|
|
|
|
+ // dataBindDialog.selectedIds.push(i.id);
|
|
|
|
+ // }
|
|
|
|
+ dataBindDialog.data.binds = undefined;
|
|
};
|
|
};
|
|
|
|
|
|
const getBindsDesc = (item: any) => {
|
|
const getBindsDesc = (item: any) => {
|
|
- if (!item.binds || !item.binds.length) {
|
|
|
|
|
|
+ if (!item.binds || !item.binds.id) {
|
|
return '绑定动态数据';
|
|
return '绑定动态数据';
|
|
}
|
|
}
|
|
- let desc = '';
|
|
|
|
- for (const i of item.binds) {
|
|
|
|
- desc += i.label + ',';
|
|
|
|
- }
|
|
|
|
- if (desc && desc.length > 1) {
|
|
|
|
- desc = desc.substring(0, desc.length - 1);
|
|
|
|
- }
|
|
|
|
- return desc;
|
|
|
|
|
|
+ // let desc = '';
|
|
|
|
+ // for (const i of item.binds) {
|
|
|
|
+ // desc += i.label + ',';
|
|
|
|
+ // }
|
|
|
|
+ // if (desc && desc.length > 1) {
|
|
|
|
+ // desc = desc.substring(0, desc.length - 1);
|
|
|
|
+ // }
|
|
|
|
+ return item.binds.label;
|
|
};
|
|
};
|
|
|
|
|
|
const changeValue = (prop: string) => {
|
|
const changeValue = (prop: string) => {
|