Browse Source

自助检索修改

xiaoqiao 1 year ago
parent
commit
51ac600884

+ 9 - 3
vue/package-lock.json

@@ -2196,6 +2196,12 @@
         "@types/node": "*"
       }
     },
+    "@types/uuid": {
+      "version": "9.0.7",
+      "resolved": "https://registry.npmmirror.com/@types/uuid/-/uuid-9.0.7.tgz",
+      "integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g==",
+      "dev": true
+    },
     "@types/web-bluetooth": {
       "version": "0.0.15",
       "resolved": "https://registry.npmmirror.com/@types/web-bluetooth/-/web-bluetooth-0.0.15.tgz",
@@ -13418,9 +13424,9 @@
       "dev": true
     },
     "uuid": {
-      "version": "9.0.0",
-      "resolved": "https://registry.npmmirror.com/uuid/-/uuid-9.0.0.tgz",
-      "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg=="
+      "version": "9.0.1",
+      "resolved": "https://registry.npmmirror.com/uuid/-/uuid-9.0.1.tgz",
+      "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
     },
     "v8-compile-cache": {
       "version": "2.3.0",

+ 6 - 5
vue/package.json

@@ -33,13 +33,12 @@
   },
   "dependencies": {
     "@ant-design/icons-vue": "~6.1.0",
-    "@vueuse/core": "~9.1.0",
-    "@wangeditor/editor": "^5.1.23",
-    "@wangeditor/editor-for-vue": "^5.1.12",
     "@codemirror/lang-sql": "^6.x",
     "@codemirror/language": "^6.x",
     "@codemirror/theme-one-dark": "^6.x",
-    "thememirror": "^2.0.1",
+    "@vueuse/core": "~9.1.0",
+    "@wangeditor/editor": "^5.1.23",
+    "@wangeditor/editor-for-vue": "^5.1.12",
     "animate.css": "^4.1.1",
     "ant-design-vue": "3.2.17",
     "axios": "~0.27.2",
@@ -58,7 +57,8 @@
     "qs": "~6.11.0",
     "socket.io-client": "~4.5.1",
     "sortablejs": "~1.15.0",
-    "uuid": "^9.0.0",
+    "thememirror": "^2.0.1",
+    "uuid": "^9.0.1",
     "vue": "3.2.47",
     "vue-codemirror": "^6.1.1",
     "vue-i18n": "9.2.2",
@@ -71,6 +71,7 @@
     "@commitlint/config-conventional": "~17.0.3",
     "@types/lodash-es": "~4.17.6",
     "@types/node": "~18.7.3",
+    "@types/uuid": "^9.0.7",
     "@types/webpack-env": "~1.17.0",
     "@typescript-eslint/eslint-plugin": "~5.33.0",
     "@typescript-eslint/parser": "~5.33.0",

+ 101 - 96
vue/src/components/basic/query/display-table.vue

@@ -1,118 +1,123 @@
 <template>
   <a-table :columns="columns" :data-source="dataList" :scroll="{ x:'100%', y: 500 }"
            :pagination="pagination"
-           :loading="loading"
            @change="pageChange"
            bordered>
   </a-table>
 </template>
 
 <script lang="ts">
-  import {defineComponent, computed} from 'vue';
-  import {getPaginationTotalTitle} from "@/utils/common";
-  import type {TableColumnsType} from 'ant-design-vue';
+import {defineComponent, computed} from 'vue';
+import {getPaginationTotalTitle} from "@/utils/common";
+import type {TableColumnsType} from 'ant-design-vue';
 
-  export  default defineComponent ({
-    props:{
-      bases : [] as any,
-      measures : [] as any,
-      wheres : [] as any
-    },
-    emits: ['displayChange'],
-    name : 'DisplayTable',
-    data() {
-      return{
-        pagination : {
-          total: 0,
-          current: 1,
-          pageSize: 10,
-          orderBy : null,
-          orderByString : null,
-          showSizeChanger: true,
-          showTotal: total => getPaginationTotalTitle(total)
-        },
-        dataList : [] as any,
-        columns : [] as any,
-        loading : false
-      }
-    },
-    setup(props, context){
-      console.log("DisplayTable setup" , props, context);
+export default defineComponent({
+  props: {
+    bases: [] as any,
+    measures: [] as any,
+    wheres: [] as any
+  },
+  emits: ['displayChange'],
+  name: 'DisplayTable',
+  data() {
+    return {
+      pagination: {
+        total: 0,
+        current: 1,
+        pageSize: 10,
+        orderBy: null,
+        orderByString: null,
+        showSizeChanger: true,
+        showTotal: total => getPaginationTotalTitle(total)
+      },
+      dataList: [] as any,
+      columns: [] as any,
+      loading: false
+    }
+  },
+  setup(props, context) {
+    console.log("DisplayTable setup", props, context);
 
-      const bases = computed(() => {
-        console.log("props.bases", props.bases)
-        return props.bases ? props.bases : []
-      });
-      const measures = computed(() => {
-        return props.measures ? props.measures : []
-      });
-      const wheres = computed(() => {
-        return props.wheres ? props.wheres : []
-      });
+    const bases = computed(() => {
+      console.log("props.bases", props.bases)
+      return props.bases ? props.bases : []
+    });
+    const measures = computed(() => {
+      return props.measures ? props.measures : []
+    });
+    const wheres = computed(() => {
+      return props.wheres ? props.wheres : []
+    });
 
-      const displayChange = (obj) => {
-        context.emit('displayChange', obj)
-      }
+    const displayChange = (obj) => {
+      context.emit('displayChange', obj)
+    }
 
-      return{
-        bases, measures, wheres, displayChange
+    return {
+      bases, measures, wheres, displayChange
+    }
+  },
+  mounted() {
+    console.log("mounted", "");
+  },
+  methods: {
+    getTableColumns: function () {
+      let rtns: TableColumnsType = [];
+      let cols = this.bases.concat(this.measures);
+      cols = cols.sort((a,b)=>{
+        return b.isFixed - a.isFixed;
+      })
+      for (let i = 0; i < cols.length; i++) {
+        let it = cols[i];
+        rtns.push({
+          title: it.displayName ? it.displayName : it.fieldName,
+          dataIndex: "RENAME" + i,
+          key: it.tempFeildId,
+          sorter: true,
+          width: 120,
+          fixed: it.isFixed == 1 ? 'left' : undefined,
+          align: "center"
+        });
       }
+      console.log("getTableColumns", rtns);
+      return rtns;
     },
-    mounted(){
-      console.log("mounted" , "");
-    },
-    methods:{
-      getTableColumns:function (){
-        let rtns: TableColumnsType = [];
-        let cols = this.bases.concat(this.measures);
-        for(let i=0;i<cols.length; i++){
-          let it = cols[i];
-          rtns.push({
-            title: it.displayName?it.displayName:it.fieldName,
-            dataIndex: "RENAME" + i,
-            key: it.tempFeildId,
-            sorter: true,
-            align:"center"});
-        }
-        console.log("getTableColumns", rtns);
-        return rtns;
-      },
-      pageChange: function(pag: { pageSize: number; current: number } , filters: any, sorter: any){
-        this.pagination.current = pag.current;
-        this.pagination.pageSize = pag.pageSize;
-        console.log("sorter",sorter, filters);
+    pageChange: function (pag: { pageSize: number; current: number }, filters: any, sorter: any) {
+      this.pagination.current = pag.current;
+      this.pagination.pageSize = pag.pageSize;
+      console.log("sorter", sorter, filters);
 
-        this.pagination.orderBy = sorter.column ? sorter.columnKey : null;
-        this.pagination.orderByString = sorter.column ? sorter.order.replace("end","") : null;
+      this.pagination.orderBy = sorter.column ? sorter.columnKey : null;
+      this.pagination.orderByString = sorter.column ? sorter.order.replace("end", "") : null;
 
-        this.loading = true;
-        this.displayChange(this.getPagination());
-      },
-      setData : function (result){
-        console.log(result);
-        if(result["code"]!=0) this.dataList = [];
-        else{
-          this.dataList = result["rows"];
-          this.pagination.total = result["total"];
-          this.loading = false;
-        }
-      },
-      reader: function () {
-        this.columns = this.getTableColumns();
-        this.dataList = [];
-        this.pagination.current = 1;
-        this.pagination.total = 0;
-      },
-      getPagination:function (){
-        return {
-          page : this.pagination.current,
-          rows : this.pagination.pageSize,
-          orderBy : this.pagination.orderBy,
-          orderByString : this.pagination.orderByString
-        };
+      this.loading = true;
+      this.displayChange(this.getPagination());
+    },
+    setData: function (result) {
+      console.log(result);
+      if (result["code"] != 0) this.dataList = [];
+      else {
+        this.dataList = result["rows"];
+        this.pagination.total = result["total"];
+        this.loading = false;
       }
+    },
+    reader: function () {
+      this.columns = this.getTableColumns();
+      this.dataList = [];
+      this.pagination.current = 1;
+      this.pagination.total = 0;
+    },
+    getPagination: function () {
+      return {
+        page: this.pagination.current,
+        rows: this.pagination.pageSize,
+        orderBy: this.pagination.orderBy,
+        orderByString: this.pagination.orderByString
+      };
     }
-  })
+  }
+})
 </script>
 
 <style lang="less" scoped></style>

+ 2 - 1
vue/src/components/basic/query/select-column.vue

@@ -49,6 +49,7 @@
 import {defineComponent, ref, reactive, watch, toRefs} from "vue";
 import {get} from "@/api/common";
 import {OperationList} from '@/enums/dictions';
+import { v4 as uuidv4 } from 'uuid';
 
 export default defineComponent({
   name: 'SelectColumn',
@@ -142,7 +143,7 @@ export default defineComponent({
     );
     const changeColumn = () => {
       let selectList = Object.assign(fieldList.value.filter(x => state.checkedList.findIndex(ck => ck == x.fieldId) > -1));
-      selectList.forEach(it => it.tempFeildId = new Date().getTime() + '');
+      selectList.forEach(it => it.tempFeildId = uuidv4());
       let basesList = selectList.filter(x => x.settingTypeId == 1);
       let measuresList = selectList.filter(x => x.settingTypeId == 2);
       emit('checked', basesList, measuresList);

+ 6 - 28
vue/src/views/query/index.vue

@@ -12,7 +12,8 @@
       <div class="query-index-tree-box">
         <a-tree
           :show-line="true"
-          v-model:expandedKeys="subjectTrees.expandedKeys"
+          :expandedKeys="subjectTrees.expandedKeys"
+          :selectedKeys="subjectTrees.selectedKeys"
           :tree-data="subjectTrees.data"
           @expand="treeOnExpand"
           @select="treeOnSelect">
@@ -94,26 +95,6 @@
               </a-form-item>
             </a-col>
 
-            <a-col :span="24">
-              <a-form-item>
-                <template #label>
-                  <ColumnHeightOutlined style="color: #8DC6F9;"/>
-                  <span>维度</span>
-                </template>
-                <DragBase ref="base" @change="onChangeBase" :subjectId="formState.temp.subId"></DragBase>
-              </a-form-item>
-            </a-col>
-
-            <a-col :span="24">
-              <a-form-item>
-                <template #label>
-                  <ColumnWidthOutlined style="color: #8DC6F9;"/>
-                  <span>度量</span>
-                </template>
-                <DragMeasure ref="measure" @change="onChangeMeasure" query-type="measure"
-                             :subjectId="formState.temp.subId"></DragMeasure>
-              </a-form-item>
-            </a-col>
           </a-row>
         </a-form>
       </div>
@@ -182,8 +163,6 @@ export default defineComponent({
     const route = useRoute();
     const expand = ref(false);
     const formRef = ref<FormInstance>();
-    const measure = ref<typeof DragMeasure>();
-    const base = ref<typeof DragBase>();
     const where = ref<typeof DragWhere>();
     const display = ref<typeof DisplayTable>();
     const displayChartBar = ref<typeof DisplayChartBar>();
@@ -216,6 +195,7 @@ export default defineComponent({
     const subjectTrees = ref({
       data: [] as TreeProps['treeData'],
       expandedKeys: [''],
+      selectedKeys:[''],
       searchStr: ''
     });
 
@@ -351,15 +331,15 @@ export default defineComponent({
 
       setTimeout(displayReader, 100);
 
-      (measure.value as any).setTagList(rtn.measures);
       (where.value as any).setTagList(rtn.wheres);
-      (base.value as any).setTagList(rtn.bases);
 
       selectColumnOptions.value.basesList = rtn.bases;
       selectColumnOptions.value.measuresList = rtn.measures;
 
       subjectTrees.value.expandedKeys = [];
-      subjectTrees.value.expandedKeys.push(rtn.sub.subId);
+      subjectTrees.value.expandedKeys.push(rtn.temp.tagId);
+      subjectTrees.value.selectedKeys = [];
+      subjectTrees.value.selectedKeys.push(rtn.temp.subId);
     }
 
     const onChangeMeasure = (list, obj) => {
@@ -421,9 +401,7 @@ export default defineComponent({
       formRef,
       formState,
       labelCol,
-      measure,
       where,
-      base,
       activeTab,
       display,
       displayChartBar,