|
@@ -6,7 +6,9 @@
|
|
|
@close="close"
|
|
|
@confirm="confirm"
|
|
|
>
|
|
|
- <div class="input-search">
|
|
|
+ <t-tabs v-model="tabValue" @change="tabChange">
|
|
|
+ <t-tab-panel :value="1" label="数据列表">
|
|
|
+ <div class="input-search mt-8">
|
|
|
<div class="btn">
|
|
|
<search-icon class="hover" />
|
|
|
</div>
|
|
@@ -28,12 +30,41 @@
|
|
|
@click="onClick"
|
|
|
/>
|
|
|
</div>
|
|
|
+ </t-tab-panel>
|
|
|
+ <t-tab-panel :value="2" label="自定义数据">
|
|
|
+ <div class="form-item mt-16">
|
|
|
+ <label>显示名称</label>
|
|
|
+ <t-input
|
|
|
+ v-model:value="activeObj.label"
|
|
|
+ placeholder="属性简短描述"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="form-item mt-16">
|
|
|
+ <label>属性名</label>
|
|
|
+ <t-input
|
|
|
+ v-model:value="activeObj.value"
|
|
|
+ placeholder="属性名"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="form-item mt-16">
|
|
|
+ <label>类型</label>
|
|
|
+ <t-select
|
|
|
+ class="w-full"
|
|
|
+ :options="typeOptions"
|
|
|
+ v-model="activeObj.type"
|
|
|
+ placeholder="字符串"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </t-tab-panel>
|
|
|
+ </t-tabs>
|
|
|
</t-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { SearchIcon } from 'tdesign-icons-vue-next';
|
|
|
import { ref, toRaw, onMounted } from 'vue';
|
|
|
+import { typeOptions } from '@/services/common';
|
|
|
+import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
|
|
|
const props = defineProps<{
|
|
|
visible: boolean;
|
|
@@ -139,16 +170,50 @@ const onSearch = () => {
|
|
|
|
|
|
const selectedIds = ref([]);
|
|
|
|
|
|
+let activeObj:any = ref({
|
|
|
+ label:'',
|
|
|
+ type:'',
|
|
|
+ value:''
|
|
|
+});
|
|
|
+
|
|
|
const onClick = (context) => {
|
|
|
const { node } = context;
|
|
|
- // activeObj = JSON.parse(JSON.stringify(node.data));
|
|
|
+ if(!node.isLeaf()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = JSON.parse(JSON.stringify(node.data));
|
|
|
+ const root = node?.getRoot()?.data;
|
|
|
+ if(data._label){
|
|
|
+ data._label = root.label+'#'+data._label;
|
|
|
+ }else{
|
|
|
+ data._label =node?.getParents()?.map((item)=>item.data.label+'#')?.reverse()?.join('') +data.label;
|
|
|
+ }
|
|
|
+ activeObj.value = data;
|
|
|
};
|
|
|
|
|
|
+const tabValue = ref(1);
|
|
|
+
|
|
|
const confirm = () => {
|
|
|
- emit('change', activedProp.value[0]);
|
|
|
- // activeObj.value = {};
|
|
|
+ if(!activeObj.value.value){
|
|
|
+ if(tabValue.value===1){
|
|
|
+ MessagePlugin.info("请选择一项设备属性!");
|
|
|
+ }else{
|
|
|
+ MessagePlugin.info("属性名必填!");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ emit('change', activeObj.value);
|
|
|
};
|
|
|
|
|
|
+const tabChange = ()=>{
|
|
|
+
|
|
|
+ activeObj.value={
|
|
|
+ label:'',
|
|
|
+ type:'',
|
|
|
+ value:''
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
const doBind = () => {};
|
|
|
</script>
|
|
|
|
|
@@ -156,15 +221,20 @@ const doBind = () => {};
|
|
|
.props {
|
|
|
height: 300px;
|
|
|
overflow-y: auto;
|
|
|
+ padding-bottom: 16px;
|
|
|
}
|
|
|
|
|
|
.input-search {
|
|
|
width: 100%;
|
|
|
- margin-top: 0px;
|
|
|
padding: 4px 0px;
|
|
|
|
|
|
.btn {
|
|
|
left: 14px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.t-tab-panel{
|
|
|
+ height: 340px;
|
|
|
+ overflow-y: hidden;
|
|
|
+}
|
|
|
</style>
|