sr 4 vuotta sitten
vanhempi
commit
7a5d2b8f68
1 muutettua tiedostoa jossa 20 lisäystä ja 12 poistoa
  1. 20 12
      ruoyi-ui/src/views/tool/gen/editTable.vue

+ 20 - 12
ruoyi-ui/src/views/tool/gen/editTable.vue

@@ -330,7 +330,7 @@
         </el-form-item>
         <el-form-item label="字段:" prop="relationChildId">
           <el-select style="width: 100%;" v-model="form.relationChildId" placeholder="请选择字段" v-loadmore="loadMore">
-            <el-option v-for="item in genList" :key="item.columnId" :label="item.columnName" :value="item.columnId">
+            <el-option v-for="item in genList" v-if="item.foreignKey" :key="item.columnId" :label="item.columnName" :value="item.columnId">
             </el-option>
           </el-select>
         </el-form-item>
@@ -761,9 +761,12 @@
         getByIdWithForeignKey(id).then(response => {
           let data = response.data
           data.foreignKey = data.foreignKey ? data.foreignKey - 0 : ''
-          this.formZd = data;
-          this.ForeName = data.fkInfo.value
-          this.openZd = true;
+          this.formZd = data;
+          console.log(data,8890)
+          if(data.fkInfo){
+            this.ForeName = data.fkInfo.value
+          }
+          this.openZd = true;
           this.title = "修改字段信息";
         });
       },
@@ -773,10 +776,11 @@
         qurGenTable(id).then(response => {
           let data = response.data
           data.relationType = data.relationType + ""
-          data.embedEdit = data.embedEdit + ""
+          data.embedEdit = data.embedEdit?(data.embedEdit + ""): data.embedEdit
+
           getGenTable(data.relationParentId).then(res => {
             this.genList = res.data.rows;
-            this.form = response.data;
+            this.form = data;
             this.open = true;
             this.title = "修改关联表";
           });
@@ -784,15 +788,17 @@
       },
       addGlfn() {
         this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.id != undefined) {
-              setGenTable(this.form).then(response => {
+          if (valid) {
+            let datas = JSON.parse(JSON.stringify(this.form))
+            datas.relationParentId = this.info.tableId
+            if (this.form.id != undefined) {
+              setGenTable(datas).then(response => {
                 this.msgSuccess("修改成功");
                 this.open = false;
                 this.tabList();
               });
             } else {
-              addGenTable(this.form).then(response => {
+              addGenTable(datas).then(response => {
                 this.msgSuccess("新增成功");
                 this.open = false;
                 this.tabList();
@@ -840,7 +846,9 @@
       /** 新增按钮操作 */
       handleAdd_gl() {
         this.reset();
-        this.open = true;
+        this.open = true;
+        console.log(this.form)
+
         this.title = "新增关联表";
       },
       handleDel_gl(row) {
@@ -860,7 +868,7 @@
       // 表单重置
       reset() {
         this.form = {
-
+          isDel: 'N'
         };
         this.resetForm("form");
       },