Browse Source

feat:增加动态表格联合查询配置逻辑

韩帛霖 11 months ago
parent
commit
cab4e0928c

+ 27 - 17
zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysBpmNodeScriptController.java

@@ -1,8 +1,12 @@
 package com.zkqy.web.controller.system;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
+import com.mchange.v1.identicator.IdList;
+import com.zkqy.common.annotation.Anonymous;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,8 +36,7 @@ import com.zkqy.common.core.page.TableDataInfo;
 @RestController
 @RequestMapping("/system/script")
 @Api(value = "/system/script")
-public class SysBpmNodeScriptController extends BaseController
-{
+public class SysBpmNodeScriptController extends BaseController {
     @Autowired
     private ISysBpmNodeScriptService sysBpmNodeScriptService;
 
@@ -43,8 +46,7 @@ public class SysBpmNodeScriptController extends BaseController
 //    //@PreAuthorize("@ss.hasPermi('system:script:list')")
     @GetMapping("/list")
     @ApiOperation(value = "查询流程节点脚本列表")
-    public TableDataInfo list(SysBpmNodeScript sysBpmNodeScript)
-    {
+    public TableDataInfo list(SysBpmNodeScript sysBpmNodeScript) {
         startPage();
         List<SysBpmNodeScript> list = sysBpmNodeScriptService.selectSysBpmNodeScriptList(sysBpmNodeScript);
         return getDataTable(list);
@@ -57,8 +59,7 @@ public class SysBpmNodeScriptController extends BaseController
     @Log(title = "流程节点脚本", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出流程节点脚本列表")
-    public void export(HttpServletResponse response, SysBpmNodeScript sysBpmNodeScript)
-    {
+    public void export(HttpServletResponse response, SysBpmNodeScript sysBpmNodeScript) {
         List<SysBpmNodeScript> list = sysBpmNodeScriptService.selectSysBpmNodeScriptList(sysBpmNodeScript);
         ExcelUtil<SysBpmNodeScript> util = new ExcelUtil<SysBpmNodeScript>(SysBpmNodeScript.class);
         util.exportExcel(response, list, "流程节点脚本数据");
@@ -70,8 +71,7 @@ public class SysBpmNodeScriptController extends BaseController
 //    //@PreAuthorize("@ss.hasPermi('system:script:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取流程节点脚本详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(sysBpmNodeScriptService.selectSysBpmNodeScriptById(id));
     }
 
@@ -82,8 +82,20 @@ public class SysBpmNodeScriptController extends BaseController
     @Log(title = "流程节点脚本", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增流程节点脚本")
-    public AjaxResult add(@RequestBody SysBpmNodeScript sysBpmNodeScript)
-    {
+    public AjaxResult add(@RequestBody SysBpmNodeScript sysBpmNodeScript) {
+//        String asd = "母卷,放卷装置,放卷张力控制,入料牵引机构,入料牵引张力,预烘箱加热,纠偏机构,正面涂装,下层烘箱加热,纠偏机构,反面涂装,上层烘箱加热,纠偏机构,出料牵引机构,出料牵引张力,收卷纠偏,收卷张力机构,收卷";
+//        List<SysBpmNodeScript> sysBpmNodeScriptList = new ArrayList<>();
+//        List<String> list = Arrays.asList(asd.split(","));
+//        list.forEach(item -> {
+//            SysBpmNodeScript end = new SysBpmNodeScript();
+//            end.setIndustryType("55");
+//            end.setScriptKey("850da57a-0037-4f16-9887-1985656278e5");
+//            end.setScriptName(item);
+//            end.setScriptType(1L);
+//            sysBpmNodeScriptService.insertSysBpmNodeScript(end);
+//        });
+//        System.out.println(sysBpmNodeScriptList);
+//        return null;
         return toAjax(sysBpmNodeScriptService.insertSysBpmNodeScript(sysBpmNodeScript));
     }
 
@@ -94,8 +106,7 @@ public class SysBpmNodeScriptController extends BaseController
     @Log(title = "流程节点脚本", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改流程节点脚本")
-    public AjaxResult edit(@RequestBody SysBpmNodeScript sysBpmNodeScript)
-    {
+    public AjaxResult edit(@RequestBody SysBpmNodeScript sysBpmNodeScript) {
         return toAjax(sysBpmNodeScriptService.updateSysBpmNodeScript(sysBpmNodeScript));
     }
 
@@ -106,16 +117,15 @@ public class SysBpmNodeScriptController extends BaseController
     @Log(title = "流程节点脚本", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除流程节点脚本")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(sysBpmNodeScriptService.deleteSysBpmNodeScriptByIds(ids));
     }
 
     /**
-     *  根据scriptKey获取流程节点脚本详细信息
+     * 根据scriptKey获取流程节点脚本详细信息
      */
     @GetMapping("/selectSysBpmNodeScriptByScriptKey/{scriptKey}")
-    public AjaxResult selectSysBpmNodeScriptByScriptKey(@PathVariable("scriptKey") String scriptKey){
+    public AjaxResult selectSysBpmNodeScriptByScriptKey(@PathVariable("scriptKey") String scriptKey) {
         return success(sysBpmNodeScriptService.selectSysBpmNodeScriptByScriptKey(scriptKey));
     }
 
@@ -123,7 +133,7 @@ public class SysBpmNodeScriptController extends BaseController
      * 根据scriptKeys获取流程节点脚本详细信息
      */
     @PostMapping("/selectSysBpmNodeScriptByScriptKeys")
-    public AjaxResult selectSysBpmNodeScriptByScriptKeys(@RequestBody List<String> scriptKeys){
+    public AjaxResult selectSysBpmNodeScriptByScriptKeys(@RequestBody List<String> scriptKeys) {
         return AjaxResult.success(sysBpmNodeScriptService.selectSysBpmNodeScriptByScriptKeys(scriptKeys));
     }
 

+ 1 - 1
zkqy-system/src/main/java/com/zkqy/system/service/impl/SysBpmNodeScriptServiceImpl.java

@@ -57,7 +57,7 @@ public class SysBpmNodeScriptServiceImpl implements ISysBpmNodeScriptService
     public int insertSysBpmNodeScript(SysBpmNodeScript sysBpmNodeScript)
     {
         sysBpmNodeScript.setCreateTime(DateUtils.getNowDate());
-        sysBpmNodeScript.setCreateBy(SecurityUtils.getUserId().toString());
+//        sysBpmNodeScript.setCreateBy(SecurityUtils.getUserId().toString());
         return sysBpmNodeScriptMapper.insertSysBpmNodeScript(sysBpmNodeScript);
     }
 

+ 118 - 84
zkqy-ui/src/views/tableMange/components/ClassificationQueryPanel.vue

@@ -10,7 +10,7 @@
     </el-button>
     <el-table :data="tableData" style="width: 100%">
       <el-table-column align="center" label="序号" type="index" width="50"/>
-      <el-table-column align="center" prop="conditionNotes" label="条件名称">
+      <el-table-column align="center" prop="conditionName" label="条件名称">
         <template slot-scope="scope">
           <el-input
             v-model="scope.row.conditionName"
@@ -19,22 +19,23 @@
           ></el-input>
         </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="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">
         <template slot-scope="scope">
-          <el-select v-model="scope.row.conditionField" placeholder="请选择条件字段" clearable filterable>
+          <el-select v-model="scope.row.conditionField" placeholder="请选择条件字段" filterable>
             <el-option
               v-for="item in fieldList"
               :key="item.fieldName"
@@ -53,79 +54,79 @@
 
       <el-table-column align="center" prop="conditionType" label="条件类型">
         <template slot-scope="scope">
-          <el-select v-model="scope.row.conditionType" clearable filterable>
+          <el-select v-model="scope.row.conditionType" filterable>
             <el-option v-for="item in conditionTypeOptions" :key="item.value" :label="item.label" :value="item.value">
             </el-option>
           </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="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="默认值">
         <template slot-scope="scope">
-          <!--          handleDisabled(scope.row)
-                    :disabled="tableData[scope.$index].componentType='input'"-->
-          <el-input v-model="scope.row.conditionDefaultValue"></el-input>
+          <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="展示顺序">
@@ -151,15 +152,47 @@
       </el-table-column>
     </el-table>
     <!--  查询条件更多设置弹窗  -->
-    <el-dialog :title="settings.title" :visible.sync="settings.open" width="400px" append-to-body fullscreen>
-      <el-input
-        type="textarea"
-        :rows="8"
-        placeholder="请输入当前下拉框数据来源sql语句,例如SELECT custom_name AS label, custom_no AS `value`, id AS id FROM customer"
-        v-model="tableData[settings.dataIndex].conditionDatasource">
-      </el-input>
+    <el-dialog :title="settings.title" :visible.sync="settings.open" width="400px" 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-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"
+                       :value="item.value"/>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="显示尺寸">
+          <el-select v-model="tableData[settings.dataIndex].componentSize" clearable filterable>
+            <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"
+                        :icon-class="tableData[settings.dataIndex].componentIcon"
+                        style="width: 25px"/>
+              <i v-else slot="prefix" class="el-icon-search el-input__icon"/>
+            </el-input>
+          </el-popover>
+        </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"/>
+        </el-form-item>
+      </el-form>
     </el-dialog>
   </div>
 </template>
@@ -179,6 +212,7 @@ export default {
   data() {
     return {
       settings: {
+        row: {},
         title: "",
         open: false,
         dataIndex: 0,
@@ -314,6 +348,7 @@ export default {
       // console.log(scope.$index)
       // 设置当前选择查询条件的sql语句
       this.settings.dataIndex = scope.$index;
+      this.settings.row = scope.row;
       this.settings.open = true
       this.settings.title = "设置条件-" + scope.row.conditionName
     },
@@ -329,7 +364,6 @@ export default {
     },
     // 选择图标
     selected(name, row) {
-      console.log(name, row);
       row.componentIcon = name;
       // this.btnGroupFormData.btnIcon = name;
     },
@@ -344,7 +378,7 @@ export default {
         conditionDefaultValue: "", //按钮值
         sort: this.tableData.length + 1, //排序
         componentType: "primary", //显示类型
-        componentsSize: "default", //尺寸
+        componentSize: "default", //尺寸
         componentIcon: "", //图标
       });
     },

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

@@ -438,7 +438,7 @@
               :filterDataEcho="filterDataEcho"
             ></DataFilterPanel>
           </el-tab-pane>
-          <el-tab-pane label="按钮配置" name="classificationQuery">
+          <el-tab-pane label="联合查询" name="classificationQuery">
             <ClassificationQueryPanel
               ref="classificationQueryRef"
               :tableFieldList="tableFieldList"
@@ -1634,24 +1634,25 @@ export default {
       // });
     },
 
-    // 处理配置的条件查询按钮数据
+    // 联合查询条件
     getBtnData(searchArr = []) {
       // 按钮条件list
-      let classificationData =
-        this.$refs.classificationQueryRef.getConditions();
-      let res = searchArr
-        .map((item) => {
-          return {
-            conditionField: item,
-            conditionName: "超级查询",
-            conditionType: "SuperQuery",
-          };
-        })
-      // .filter((item) => {
-      //   return !classificationData.some((v) => {
-      //     return v.conditionField == item.conditionField;
-      //   });
-      // });
+      let classificationData = this.$refs.classificationQueryRef.getConditions();
+      let res = searchArr.map((item) => {
+        return {
+          conditionField: item,
+          conditionName: "超级查询",
+          conditionType: "SuperQuery",
+        };
+      })
+      let list = Object.assign([], classificationData);
+      // 校验 填写不完整删除查询条件
+      classificationData.forEach((item, index) => {
+        console.log("进入处理")
+        if (item.conditionName == "" || item.conditionField == "" || item.conditionType == "") {
+          classificationData.splice(index, 1);
+        }
+      })
       return [...res, ...classificationData];
     },
     // 创建回调
@@ -1692,21 +1693,6 @@ export default {
             this.$message.warning("请至少选择一个包含查询字段");
             return false;
           }
-          // let validateParams = {
-          //   isFieldDescrib: false,
-          //   isRelationFieldAll: false,
-          // };
-          // this.validateField(this.tableFieldList, validateParams);
-          // console.log(validateParams);
-          // if (validateParams.isFieldDescrib) {
-          //   this.$message.error("需要显示的字段描述不能为空");
-          //   return;
-          // }
-          // if (validateParams.isRelationFieldAll) {
-          //   this.$message.error("请补全关联条件");
-          //   return;
-          // }
-          // console.log("123", columns);
           this.uuid = uuidv4();
           this.tableKey = uuidv4();
           // 表单
@@ -1780,6 +1766,8 @@ export default {
           if (result.code == 200) {
             // 更新路由
             this.reloadRouter();
+
+            // 得到联合查询数组
             let conditions = this.$refs.dataFilterRef?.getConditions();
             let conditionDefaultValueMap = {};
             conditions.map((item) => {
@@ -1787,9 +1775,10 @@ export default {
                 " " + item.condition + " " + item.refValue
               );
             });
-
             // let isAsc = this.formData.isAsc == "ASC" ? 0 : 1;
             let btnData = this.getBtnData(searchFieldList);
+
+
             let data = {
               conditionDefaultValueMap, //数据筛选条件
               tId: this.tId,