Parcourir la source

Merge remote-tracking branch 'refs/remotes/origin/1.2.4' into 1.2.2yang

# Conflicts:
#	src/components/Generator/parser/Parser.vue
#	src/utils/request.js
yangfan il y a 2 mois
Parent
commit
d6eac68c0d

+ 16 - 11
src/components/Generator/index/Home.vue

@@ -14,7 +14,7 @@
               filter=".disabled"
               :sort="false"
               :group="{ name: 'componentsGroup', pull: 'clone', put: false }"
-              @end="onEnd"  :move="onHandleAdd"
+              @end="onEnd" ref="componentsList" @start="onDragStart"
             >
               <div v-for="(element, index) in item.list" :key="index" class="components-item" :class="{ disabled: element.__config__.dragDisabled }" @click="addComponent(element)">
                 <div class="components-body">
@@ -206,7 +206,9 @@ export default {
       ],
       layout: [],
       layouKey: 0,
-      map: []
+      map: [],
+      filterdrawingList:[],
+      onStartDrawingList:[]
     }
   },
   computed: {},
@@ -538,18 +540,21 @@ export default {
       this.activeData = element
       this.activeId = element.__config__.formId
     },
-    onHandleAdd(to){
-      if (to.to.className === 'drawing-board' || to.to.className === 'drag-wrapper') {
-        let fieldsFil = loopSerialNumberList(this.drawingList)
-        const z = fieldsFil.find(i=> i.__config__.jnpfKey && i.__config__.jnpfKey === 'serialNumber')
-        if (z){
-          this.$message.warning('表单中仅可添加一个流水号控件')
-          return false;
-        }
-      }
+    onDragStart(){
+      this.onStartDrawingList = deepClone(this.drawingList)
+      this.filterdrawingList = loopSerialNumberList(this.onStartDrawingList)
     },
     onEnd(obj) {
       if (!tempActiveData) return
+      if (obj?.item?._underlying_vm_?.__config__?.jnpfKey === 'serialNumber'){
+        if (obj.to.className === 'drawing-board' || obj.to.className === 'drag-wrapper') {
+          const z = this.filterdrawingList.find(i=> i.__config__.jnpfKey && i.__config__.jnpfKey === 'serialNumber')
+          if (z){
+            this.$message.warning('表单中仅可添加一个流水号控件')
+            this.drawingList = this.onStartDrawingList
+          }
+        }
+      }
       this.showTip = true
       if (obj.from !== obj.to) {
         this.activeData = tempActiveData

+ 2 - 2
src/components/Generator/index/RightComponents/Table.vue

@@ -49,13 +49,13 @@
     <el-form-item>
       <template slot="label">
         <span>选择表单</span>
-        <el-tooltip style="cursor: pointer" effect="dark" :content="'被选择的表单需同时符合【未关联其他表单】和【是一个单表表单】才会在下拉选择中展示'" placement="top">
+        <el-tooltip style="cursor: pointer" effect="dark" :content="'被选择的表单需同时符合【是一个单表表单】才会在下拉选择中展示'" placement="top">
           <i class="el-icon-question" />
         </el-tooltip>
       </template>
       <el-select v-model="activeData.relationConf.itemRelationTable" filterable placeholder="请选择" clearable @change="onRelationTableChange($event)">
         <el-option
-          v-for="(item, index) in allTabelList.filter((o) => o.associationType && o.associationType == 1 && o.visualdevTableType && o.visualdevTableType == 1)"
+          v-for="(item, index) in allTabelList.filter((o) => o.visualdevTableType && o.visualdevTableType == 1)"
           :label="item.fullName"
           :value="item.id"
           :key="item.id"

+ 3 - 3
src/components/Generator/parser/Parser.vue

@@ -719,9 +719,9 @@ export default {
       const rowRes = await getConfigData(this.modelId)
       const rowData = rowRes.data.data
       // 获取当前表格信息
-      const rowDetailData = await detail(this.modelId, rowData.dbLinkId)
-      localStorage.setItem('BROWSER_associationData', JSON.stringify(rowDetailData.associationData))
-      localStorage.setItem('BROWSER_associationColumnDict', JSON.stringify(rowDetailData.associationColumnDict))
+      const rowDetailData = await detail(this.modelId, rowData.dbLinkId,rowData.idKey,this[this.formConf.formModel][rowData.idKey])
+      localStorage.setItem("BROWSER_associationData", JSON.stringify(rowDetailData.associationData));
+      localStorage.setItem("BROWSER_associationColumnDict", JSON.stringify(rowDetailData.associationColumnDict));
 
       function isEmptyObject(obj) {
         return Object.keys(obj).length === 0

+ 5 - 3
src/components/compSqlEditor/index.vue

@@ -30,7 +30,8 @@
     </div>
     <div class="main">
       <div class="label label-title">
-        <aceEditor ref="editor" :font-size="16" :value="value" @change="onChange" height="500" lang="sql" snippets wrap />
+        <aceEditor ref="editor" :font-size="16" :value="value" @change="onChange" height="500" lang="sql" snippets
+                   wrap />
       </div>
     </div>
     <div class="panel" style="margin-right: 10px">
@@ -90,7 +91,7 @@ import { funcList } from "@/api/newbi/func";
 export default {
   components: { aceEditor },
   model: { prop: "value", event: "change" },
-  props: ["cubeId", "value"],
+  props: ["cubeId", "value", "dsId"],
   data() {
     return {
       datasourceId: "",
@@ -132,6 +133,8 @@ export default {
   created() {
     this.getInitData();
     this.getGlobalData();
+    this.datasourceId = this.dsId;
+    this.onDsChange(this.dsId);
   },
   methods: {
     onChange(val) {
@@ -229,7 +232,6 @@ export default {
         this.funcAttrList = list;
       });
       funcList({ dsType: "mysql" }).then((res) => {
-        logjson(res.data.data)
         this.functionList = res.data.data;
         this.functionListSearched = [...this.functionList];
         this.funcAttr = -1;

+ 2 - 1
src/views/form/webDesign/CustomButton.vue

@@ -191,7 +191,8 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="展示条件">
-          <CompSqlEditor v-model="showFrom.buttonCondition" :cube-id="dataForm.dbLinkId"></CompSqlEditor>
+          <CompSqlEditor v-model="showFrom.buttonCondition" :cube-id="dataForm.dbLinkId" :dsId="dataForm.dbSourceId"
+          ></CompSqlEditor>
           <div class="hint" style="font-size: 12px;color:#777">
             注:条件sql返回列必须存在主键列,并且where条件必须有主键列约束。例句:SELECT id from {表名} where {约束条件} and id IN([ids])
           </div>

+ 16 - 7
src/views/form/webDesign/customFormEvent.vue

@@ -8,12 +8,11 @@
     width="700px">
     <p slot="title">
       {{ id ? '编辑自定义赋值模式事件' : '新增自定义赋值模式事件' }}
-      <span style="color:#ff0000;font-size:12px;">注:表单赋值当前仅支持更新数据</span>
     </p>
     <div >
       <div style="margin-bottom:5px;">
         事件名称:<el-input style="width:300px" v-model="eventName" placeholder="请输入事件名称"></el-input>
-        <el-button style="float:right;" type="success" plain size="mini" @click="list.length < 3 && list.push({formName:'',dataTable:'',FormColumnList:[{columnName:'',value:''}],columnList:[],filterColumnList:[{columnId:'',viewDataType:'STRING',function:'like',value:''}]});">+添加分组</el-button>
+        <el-button style="float:right;" type="success" plain size="mini" @click="list.length < 3 && list.push({formName:'',dataTable:'',operate:1,primaryStrategy:'',idKeyName:'',FormColumnList:[{columnId:'',columnName:'',value:''}],columnList:[],filterColumnList:[{columnId:'',viewDataType:'STRING',function:'like',value:''}]});">+添加分组</el-button>
       </div>
       <div style="height: 500px;overflow-y:auto">
         <el-card class="box-card" v-for="(value,key) in list" style="margin-bottom: 10px" :key="key">
@@ -25,7 +24,11 @@
             <span style="margin-left:10px">物理数据表:{{value.dataTable}}</span>
             <i class="el-icon-delete" style="font-size:20px;color:#13ce66;float: right;cursor: pointer;" @click="list.length > 1 ? list.splice(key,1) : $message.warning('至少保留一个分组') "></i>
           </div>
-          <el-button type="success" plain size="mini" @click="value.FormColumnList.push({columnName:'',value:''});">+添加字段</el-button>
+          <el-button type="success" plain size="mini" @click="value.FormColumnList.push({columnId:'',columnName:'',value:''});">+添加字段</el-button>
+          <el-select style="float:right;bottom:5px;" v-model="value.operate" filterable placeholder="请选择方式" clearable >
+            <el-option  label="新增" :value="0" :key="0"></el-option>
+            <el-option  label="编辑" :value="1" :key="1"></el-option>
+          </el-select>
           <el-table v-loading="loading" size="mini" :data="value.FormColumnList"  border  style="width: 100%;margin:10px 0;">
             <el-table-column width="50" align="center">
               <template slot-scope="scope">
@@ -34,8 +37,8 @@
             </el-table-column>
             <el-table-column label="表单字段" width="180"  align="center">
               <template slot-scope="scope">
-                <el-select v-model="scope.row.columnName" filterable placeholder="请选择表单字段" clearable >
-                  <el-option v-for="(item, index) in value.columnList" :label="item.label" :value="item.propId" :key="item.propId"></el-option>
+                <el-select v-model="scope.row.columnId" filterable @change="scope.row.columnName = value.columnList.find(o=> o.propId === $event).prop" placeholder="请选择表单字段" clearable >
+                  <el-option v-for="(item, index) in value.columnList.filter(o=>o.prop !== value.idKeyName)" :label="item.label" :value="item.propId" :key="item.propId"></el-option>
                 </el-select>
               </template>
             </el-table-column>
@@ -160,7 +163,7 @@ export default {
       paramList: [],
       id:'',
       list:[
-        {formName:'',dataTable:'',FormColumnList:[{columnName:'',value:''}],columnList:[],filterColumnList:[{columnId:'',viewDataType:'STRING',function:'like',value:''}]}
+        {formName:'',dataTable:'',operate:1,primaryStrategy:'',idKeyName:'',FormColumnList:[{columnId:'',columnName:'',value:''}],columnList:[],filterColumnList:[{columnId:'',viewDataType:'STRING',function:'like',value:''}]}
       ],
       nowParam:[]
     }
@@ -189,7 +192,7 @@ export default {
           this.eventStatus = 0
           this.datasourceId = this.dbSourceId
           this.list =[
-            {formName:'',dataTable:'',FormColumnList:[{columnName:'',value:''}],columnList:[],filterColumnList:[{columnId:'',viewDataType:'STRING',function:'like',value:''}]}
+            {formName:'',dataTable:'',operate:1,primaryStrategy:'',idKeyName:'',FormColumnList:[{columnId:'',columnName:'',value:''}],columnList:[],filterColumnList:[{columnId:'',viewDataType:'STRING',function:'like',value:''}]}
           ]
         }
       })
@@ -236,8 +239,14 @@ export default {
       getConfigData(v).then((res) => {
         let data = res.data.data
         value.dataTable = data.primaryTableName
+        value.primaryStrategy = data.primaryStrategy
         let columnData = JSON.parse(data.columnData)
         value.columnList = columnData.columnList
+        try {
+          value.idKeyName = columnData.columnList.find(o=> o.propId === data.idKey)?.prop
+        }catch (e) {
+          value.idKeyName = ''
+        }
         this.loading = false
       }).finally(()=>{
         this.loading = false

+ 2 - 2
src/views/workFlow/workFlowForm/dynamicForm/index.vue

@@ -203,8 +203,8 @@ export default {
               }
               if (editFlg && editFlg === 1){
                 let noShow = false,
-                  isDisabled = true,
-                  isRequired = true
+                  isDisabled = false,
+                  isRequired = false
                 if (this.setting.formOperates && this.setting.formOperates.length) {
                   let arr = this.setting.formOperates.filter((o) => o.id == item.__vModel__) || []
                   if (arr.length) {