yrik 4 жил өмнө
parent
commit
fa890d67d3

+ 7 - 0
ruoyi-ui/src/api/tool/gen.js

@@ -67,6 +67,13 @@ export function delTable(tableId) {
     method: 'delete'
   })
 }
+// 删除
+export function delPost(id) {
+  return request({
+    url: '/genTableColumn/columnIds/' + id,
+    method: 'delete'
+  })
+}
 
 // 生成代码(自定义路径)
 export function genCode(tableName) {

+ 97 - 11
ruoyi-ui/src/views/tool/gen/editTable.vue

@@ -1,11 +1,36 @@
 <template>
   <el-card>
+    <el-row type="flex" :gutter="10" class="mb8" justify="end">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:post:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['system:post:remove']"
+        >删除</el-button>
+      </el-col>
+      <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
+    </el-row>
     <el-tabs v-model="activeName">
       <el-tab-pane label="基本信息" name="basic">
         <basic-info-form ref="basicInfo" :info="info" />
       </el-tab-pane>
       <el-tab-pane label="字段信息" name="cloum">
-        <el-table ref="dragTable" :data="cloumns" row-key="columnId" :max-height="tableHeight">
+        <el-table ref="dragTable" :data="cloumns" row-key="columnId" :max-height="tableHeight" @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55" align="center" />
           <el-table-column label="序号" type="index" min-width="5%" class-name="allowDrag" />
           <el-table-column
             label="字段列名"
@@ -13,7 +38,11 @@
             min-width="10%"
             :show-overflow-tooltip="true"
           />
-          <el-table-column label="字段描述" align="center" prop="columnComment" min-width="10%"  />
+          <el-table-column label="字段描述" min-width="10%">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.columnComment"></el-input>
+            </template>
+          </el-table-column>
           <el-table-column
             label="物理类型"
             prop="columnType"
@@ -21,7 +50,7 @@
             :show-overflow-tooltip="true"
           />
           <el-table-column label="字段显示规则" align="center" prop="mask" min-width="11%"/>
-          <el-table-column label="排序" min-width="5%" align="center" prop="sort"/>
+          <el-table-column label="排序" min-width="8%" align="center" prop="sort"/>
           <el-table-column label="输入字段" min-width="10%">
             <template slot-scope="scope">
               <el-checkbox true-label="1" v-model="scope.row.isIn"></el-checkbox>
@@ -32,7 +61,7 @@
               <el-checkbox true-label="1" v-model="scope.row.isOut"></el-checkbox>
             </template>
           </el-table-column>
-          <el-table-column label="查询" min-width="5%">
+          <el-table-column label="查询" min-width="8%">
             <template slot-scope="scope">
               <el-checkbox true-label="1" v-model="scope.row.isQuery"></el-checkbox>
             </template>
@@ -40,14 +69,40 @@
           <el-table-column label="关联HR字段" min-width="10%" align="center" prop="hrParentId"/>
           <el-table-column label="缺省值" min-width="10%" align="center" prop="defaultValue"/>
           <el-table-column label="外键" min-width="10%" align="center" prop="foreignKey"/>
-          <el-table-column label="必填" min-width="5%">
+          <el-table-column label="必填" min-width="8%">
             <template slot-scope="scope">
               <el-checkbox true-label="1" v-model="scope.row.isRequired"></el-checkbox>
             </template>
           </el-table-column>
-          <el-table-column label="显示类型" min-width="12%" align="center" prop="htmlType"/>
-          <el-table-column label="字典类型" min-width="12%" align="center" prop="dictType"/>
-
+          <el-table-column label="显示类型" min-width="12%">
+            <template slot-scope="scope">
+              <el-select v-model="scope.row.htmlType">
+                <el-option label="文本框" value="input" />
+                <el-option label="文本域" value="textarea" />
+                <el-option label="下拉框" value="select" />
+                <el-option label="单选框" value="radio" />
+                <el-option label="复选框" value="checkbox" />
+                <el-option label="日期控件" value="datetime" />
+                <el-option label="图片上传" value="imageUpload" />
+                <el-option label="文件上传" value="fileUpload" />
+                <el-option label="富文本控件" value="editor" />
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column label="字典类型" min-width="12%">
+            <template slot-scope="scope">
+              <el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
+                <el-option
+                  v-for="dict in dictOptions"
+                  :key="dict.dictType"
+                  :label="dict.dictName"
+                  :value="dict.dictType">
+                  <span style="float: left">{{ dict.dictName }}</span>
+                  <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.dictType }}</span>
+              </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
         </el-table>
       </el-tab-pane>
      <!-- <el-tab-pane label="生成信息" name="genInfo">
@@ -121,7 +176,7 @@
           <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
         </el-form-item>
         <el-form-item label="序号:" prop="status">
-          
+
         </el-form-item>
         <el-form-item label="可用:" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
@@ -135,7 +190,7 @@
   </el-card>
 </template>
 <script>
-import { getGenTable, updateGenTable } from "@/api/tool/gen";
+import { getGenTable, updateGenTable, delPost} from "@/api/tool/gen";
 import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
 import { listMenu as getMenuTreeselect } from "@/api/system/menu";
 import basicInfoForm from "./basicInfoForm";
@@ -167,7 +222,13 @@ export default {
       // 菜单信息
       menus: [],
       // 表详细信息
-      info: {}
+      info: {},
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
     };
   },
   created() {
@@ -228,6 +289,31 @@ export default {
     close() {
       this.$store.dispatch("tagsView/delView", this.$route);
       this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      console.log(selection)
+      this.ids = selection.map(item => item.columnId)
+      this.single = selection.length!=1
+      this.multiple = !selection.length
+      console.log(this.ids)
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除岗位编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delPost(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    handleAdd(){
+
     }
   },
   mounted() {