Bläddra i källkod

fix:修复新增动态表格联合查询无法新增新、提示信息、样式等优化

韩帛霖 1 år sedan
förälder
incheckning
df17b890e2

+ 9 - 130
zkqy-ui/src/views/tableMange/components/ClassificationQueryPanel.vue

@@ -20,20 +20,10 @@
         </template>
       </el-table-column>
 
-      <!--      <el-table-column align="center" prop="conditionNotes" label="描述条件">-->
-      <!--        <template slot-scope="scope">-->
-      <!--          <el-input-->
-      <!--            v-model="scope.row.conditionNotes"-->
-      <!--            size="normal"-->
-      <!--            clearable-->
-      <!--          ></el-input>-->
-      <!--        </template>-->
-      <!--      </el-table-column>-->
       <el-table-column
         align="center"
         prop="conditionField"
-        label="条件字段"
-        width="100">
+        label="条件字段">
         <template slot-scope="scope">
           <el-select v-model="scope.row.conditionField" placeholder="请选择条件字段" filterable>
             <el-option
@@ -60,76 +50,13 @@
           </el-select>
         </template>
       </el-table-column>
-
-
-
-      <!--      <el-table-column align="center" prop="componentType" label="显示类型">-->
-      <!--              <template slot-scope="scope">-->
-      <!--                <el-select v-model="scope.row.componentType" clearable filterable>-->
-      <!--                  <el-option-->
-      <!--                    v-for="item in componentTypeOptions"-->
-      <!--                    :key="item.value"-->
-      <!--                    :label="item.label"-->
-      <!--                    :value="item.value">-->
-      <!--                  </el-option>-->
-      <!--                </el-select>-->
-      <!--              </template>-->
-      <!--            </el-table-column>-->
-      <!--      <el-table-column align="center" prop="componentSize" label="尺寸">-->
-      <!--        <template slot-scope="scope">-->
-      <!--          <el-select v-model="scope.row.componentSize" clearable filterable>-->
-      <!--            <el-option-->
-      <!--              v-for="item in componentSizeOptions"-->
-      <!--              :key="item.value"-->
-      <!--              :label="item.label"-->
-      <!--              :value="item.value"-->
-      <!--            >-->
-      <!--            </el-option>-->
-      <!--          </el-select>-->
-      <!--        </template>-->
-      <!--      </el-table-column>-->
-      <!--      <el-table-column align="center" prop="componentIcon" label="图标">-->
-      <!--        <template slot-scope="scope">-->
-      <!--          <el-popover-->
-      <!--            placement="bottom-start"-->
-      <!--            width="460"-->
-      <!--            trigger="click"-->
-      <!--            @show="$refs['iconSelect'].reset()"-->
-      <!--          >-->
-      <!--            <IconSelect-->
-      <!--              ref="iconSelect"-->
-      <!--              @selected="-->
-      <!--                (name) => {-->
-      <!--                  selected(name, scope.row);-->
-      <!--                }-->
-      <!--              "-->
-      <!--              :active-icon="scope.row.componentIcon"-->
-      <!--            />-->
-      <!--            <el-input-->
-      <!--              slot="reference"-->
-      <!--              v-model="scope.row.componentIcon"-->
-      <!--              placeholder="点击选择图标"-->
-      <!--              readonly-->
-      <!--            >-->
-      <!--              <svg-icon-->
-      <!--                v-if="scope.row.componentIcon"-->
-      <!--                slot="prefix"-->
-      <!--                :icon-class="scope.row.componentIcon"-->
-      <!--                style="width: 25px"-->
-      <!--              />-->
-      <!--              <i v-else slot="prefix" class="el-icon-search el-input__icon"/>-->
-      <!--            </el-input>-->
-      <!--          </el-popover>-->
-      <!--        </template>-->
-      <!--      </el-table-column>-->
-
-      <el-table-column align="center" prop="conditionDefaultValue" label="默认值">
+      <el-table-column align="center" prop="conditionDefaultValue" label="默认条件值">
         <template slot-scope="scope">
           <el-input v-model="scope.row.conditionDefaultValue"
                     :disabled="scope.row.conditionType!='button' && scope.row.conditionType!='radio'"></el-input>
         </template>
       </el-table-column>
-      <el-table-column align="center" prop="sort" label="展示顺序">
+      <el-table-column align="center" prop="sort" label="渲染顺序" width="80">
         <template slot-scope="scope">
           <el-input v-model="scope.row.sort"></el-input>
         </template>
@@ -152,15 +79,10 @@
       </el-table-column>
     </el-table>
     <!--  查询条件更多设置弹窗  -->
-    <el-dialog :title="settings.title" :visible.sync="settings.open" width="400px" append-to-body>
+    <el-dialog :title="settings.title" :visible.sync="settings.open" width="500px" append-to-body>
       <!-- 下拉框数据来源(字典、表数据)设置label、value -->
       <!-- 时间范围(选择到年、月、日 时、分、秒)   -->
-      <el-form label-width="100px">
-
-        <el-form-item label="条件描述">
-          <el-input v-model="tableData[settings.dataIndex].conditionNotes" type="text"
-                    placeholder="描述例句(请输入姓名、请输入编号...)"/>
-        </el-form-item>
+      <el-form label-width="100px" v-if="tableData.length!=0">
         <el-form-item label="显示类型">
           <el-select v-model="tableData[settings.dataIndex].componentType" clearable filterable>
             <el-option v-for="item in componentTypeOptions" :key="item.value" :label="item.label"
@@ -172,13 +94,10 @@
             <el-option v-for="item in componentSizeOptions" :key="item.value" :label="item.label" :value="item.value"/>
           </el-select>
         </el-form-item>
-
         <el-form-item label="显示图标">
           <el-popover placement="bottom-start" width="460" trigger="click" @show="$refs['iconSelect'].reset()">
             <IconSelect ref="iconSelect" @selected="(name) => selected(name, settings.row)"
                         :active-icon="tableData[settings.dataIndex].componentIcon"/>
-
-
             <el-input slot="reference" v-model="tableData[settings.dataIndex].componentIcon"
                       placeholder="点击选择图标" readonly>
               <svg-icon v-if="tableData[settings.dataIndex].componentIcon" slot="prefix"
@@ -188,6 +107,10 @@
             </el-input>
           </el-popover>
         </el-form-item>
+        <el-form-item label="条件描述">
+          <el-input v-model="tableData[settings.dataIndex].conditionNotes" type="text"
+                    placeholder="描述例句(请输入姓名、请输入编号...)"/>
+        </el-form-item>
         <el-form-item label="下拉sql" v-show="tableData[settings.dataIndex].conditionType=='select'">
           <el-input v-model="tableData[settings.dataIndex].conditionDatasource" type="textarea" :rows="8"
                     placeholder="请输入当前下拉框数据来源sql语句,例如:SELECT custom_name AS `label`, custom_no AS `value`, id AS id FROM {DBNAME}.customer"/>
@@ -300,24 +223,6 @@ export default {
     myTableFieldList: {
       handler(nval) {
         this.fieldList = nval;
-
-        console.log(this.fieldList);
-        // 初始化删除逻辑条件
-        // let is_has_del_flag = nval.find((item) => {
-        //   return item.fieldName == "del_flag";
-        // });
-        // console.log(is_has_del_flag);
-        // if (is_has_del_flag) {
-        //   let { fieldName, tableName } = is_has_del_flag;
-        //   this.tableData = [];
-        //   this.tableData.push({
-        //     fieldName: tableName + "." + fieldName,
-        //     condition: "=",
-        //     refValue: 0,
-        //   });
-        // } else {
-        //   this.tableData = [];
-        // }
       },
       deep: true,
       immediate: true,
@@ -325,7 +230,6 @@ export default {
     myFilterDataEcho: {
       handler(val) {
         if (val) {
-          console.log("valavavalvlavl", val);
           this.tableData = val;
         }
       },
@@ -335,7 +239,6 @@ export default {
   },
   computed: {
     myTableFieldList() {
-      console.log(this.tableFieldList);
       return this.tableFieldList;
     },
     myFilterDataEcho() {
@@ -354,10 +257,8 @@ export default {
     },
     // 处理联合查询,默认值输入框禁用逻辑
     handleDisabled(row) {
-      console.log("rowrowrow", row)
       // 如果是文本类型则禁用默认值输入框
       if (row.componentType == 'input') {
-        console.log("进入", row)
         return 'disabled';
       }
       return false;
@@ -365,7 +266,6 @@ export default {
     // 选择图标
     selected(name, row) {
       row.componentIcon = name;
-      // this.btnGroupFormData.btnIcon = name;
     },
     // 新增条件回调
     addCondition() {
@@ -400,27 +300,6 @@ export default {
   },
 
   mounted() {
-    const mime = 'text/x-mariadb'
-    // let theme = 'ambiance'//设置主题,不设置的会使用默认主题
-    this.editor = CodeMirror.fromTextArea(this.$refs.mycode, {
-      mode: mysql, // 选择对应代码编辑器的语言,我这边选的是数据库,根据个人情况自行设置即可
-      indentWithTabs: true,
-      smartIndent: true,
-      lineNumbers: true,
-      matchBrackets: true,
-      // theme: 'base16-light',
-      // autofocus: true,
-      extraKeys: {'Ctrl': 'autocomplete'}, // 自定义快捷键
-      hintOptions: {// 自定义提示选项
-        tables: {
-          users: ['1112', '123123', '124124'],
-          countries: ['124', '124124', '1']
-        }
-      }
-    })
-    this.editor.on('cursorActivity', () => {
-      this.editor.showHint()
-    })
   },
 };
 </script>

+ 0 - 22
zkqy-ui/src/views/tableMange/index.vue

@@ -965,7 +965,6 @@ export default {
     // menuOrderNum() {
     //   if (!this.formData.routePath) return 0;
     //   let targetMenu = this.getTargetMenu(this.menus);
-    //   console.log(targetMenu);
     //   if (targetMenu.children?.length) {
     //     return targetMenu.children.length;
     //   } else {
@@ -1001,11 +1000,9 @@ export default {
         if (res.code == 200) {
           this.btnTemplate = res.data.map((item) => JSON.parse(item.remark));
         } else {
-          console.log(res);
           this.$message.error("获取按钮模板数据失败");
         }
       } catch (error) {
-        console.log(error);
         this.$message.error("获取按钮模板数据失败");
       }
     },
@@ -1047,7 +1044,6 @@ export default {
     treeSelectChange(val) {
       // await this.getMenuList();
       //没有change事件
-      console.log("val", val);
     },
     async treeSelectFocus() {
       await this.getMenuList();
@@ -1075,7 +1071,6 @@ export default {
       let tableComment = this.getTableCommont(this.tableName, this.tableList);
       // 获取当前表单结构信息
       getListName(data).then((res) => {
-        // console.log(res);
         this.tableFieldList = res.map((item, index) => {
           return {
             id: this.tableName + "_" + item.fieldName,
@@ -1098,7 +1093,6 @@ export default {
             relationFieldList: [],
           };
         });
-        // console.log(this.tableFieldList);
       });
     },
     // 关联表变化回调
@@ -1578,7 +1572,6 @@ export default {
           //   isRelationFieldAll: false,
           // };
           // this.validateField(this.tableFieldList, validateParams);
-          // console.log(validateParams);
           // if (validateParams.isFieldDescrib) {
           //   this.$message.error("需要显示的字段描述不能为空");
           //   return;
@@ -1648,7 +1641,6 @@ export default {
       let list = Object.assign([], classificationData);
       // 校验 填写不完整删除查询条件
       classificationData.forEach((item, index) => {
-        console.log("进入处理")
         if (item.conditionName == "" || item.conditionField == "" || item.conditionType == "") {
           classificationData.splice(index, 1);
         }
@@ -1657,7 +1649,6 @@ export default {
     },
     // 创建回调
     async createHandle() {
-      // console.log(123);
       // this.sqlKey = uuidv4();
       this.isInputInvalid = true;
       this.$refs.formData.validate(async (valid) => {
@@ -1698,7 +1689,6 @@ export default {
           // 表单
           let result;
           let btnTemplate = this.formateBtnTemplate();
-          console.log(btnTemplate);
 
           // if (this.tId && this.menuId) {
           if (this.menuId && !this.isNeedNewMenu) {
@@ -1845,7 +1835,6 @@ export default {
               this.dragTableStatisticList.forEach((item) => {
                 item.tableKey = this.editData.tableKey;
               });
-              // console.log(res);
               res1 = await updateStatistic({
                 tableKey: this.editData.tableKey,
                 dragTableStatisticList: this.dragTableStatisticList,
@@ -1859,7 +1848,6 @@ export default {
                 data.tableKey
               );
               res = await addDragTable(data);
-              // console.log('123456789', res)
               this.dragTableStatisticList.forEach((item) => {
                 item.tableKey = this.uuid;
               });
@@ -1879,7 +1867,6 @@ export default {
                 btnTemplate.menuID = result.data;
                 let btnRes = await insertByDefaultBtn(btnTemplate);
                 if (btnRes.code == 200) {
-                  console.log(btnRes);
                   // 发送权限请求
                   let payload = btnRes.data.map((item) => {
                     return {
@@ -2021,15 +2008,12 @@ export default {
       this.isShowAddData = true;
       this.dataType = await this.getDicts("table_statistic_type");
       this.dataType = this.dataType.data;
-      // console.log(this.dataType)
     },
     async updataDialog() {
-      // console.log(this.dataType)
     },
     // 修改数据字段
     upadtaData() {
       this.dragTableStatisticList.forEach((item, index) => {
-        // console.log(this.dataCountFormData);
         if (item.id !== undefined && item.id == this.dataCountFormData.id) {
           this.dragTableStatisticList[index] = this.dataCountFormData;
         } else if (item.xid == this.dataCountFormData.xid) {
@@ -2037,12 +2021,10 @@ export default {
         }
       });
       this.isShowAddData = false;
-      // console.log(this.dragTableStatisticList)
       this.dataCountFormData = {};
     },
     // 添加数据字段
     addData() {
-      // console.log(this.dataCountFormData);
       this.dataCountFormData.xid = Date.now();
       this.dataCountFormData.tableKey = this.tableKey;
       this.dragTableStatisticList.push(this.dataCountFormData);
@@ -2062,20 +2044,16 @@ export default {
         searchFieldList: this.searchFieldList,
         dtTableName: this.tableName,
       }).then((res) => {
-        // console.log(res)
       });
     },
     // 修改统计信息
     async handleUpdateStat(row) {
-      // console.log(row);
       this.dataCountFormData = row;
       this.dataCountFormData.xid = Date.now();
       this.staictitle = "修改统计数据字段";
       this.dataType = await this.getDicts("table_statistic_type");
       this.dataType = this.dataType.data;
       this.isShowAddData = true;
-      // console.log(this.dataCountFormData)
-      // console.log(this.dragTableStatisticList);
     },
     // 删除统计信息
     handleDeleteStat(row) {