|
@@ -1,11 +1,47 @@
|
|
|
<template>
|
|
|
<el-card>
|
|
|
+ <el-row type="flex" v-if="activeName=='cloum'" justify="space-between" style="margin: 10px 0;">
|
|
|
+ <el-col :span="1.5" style="display: flex; align-items: center;">
|
|
|
+ <el-form label-width="100px" style="display: flex; align-items: center;">
|
|
|
+ <el-form-item style="text-align: center;margin-left:-100px;margin-top:0; margin-bottom: 0;">
|
|
|
+ <el-button type="primary" @click="submitForm()">保存</el-button>
|
|
|
+ <el-button @click="close()">返回</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ <el-row type="flex" :gutter="10" justify="end">
|
|
|
+ <el-col :span="1.5" style="display: flex; align-items: center;">
|
|
|
+ <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" style="display: flex; align-items: center;">
|
|
|
+ <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-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 +49,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 +61,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 +72,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,27 +80,52 @@
|
|
|
<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">
|
|
|
<gen-info-form ref="genInfo" :info="info" :tables="tables" :menus="menus"/>
|
|
|
</el-tab-pane> -->
|
|
|
<el-tab-pane label="关联表" name="genInfo">
|
|
|
- <el-row style="margin-bottom: 20px;">
|
|
|
- <el-col :span="12">
|
|
|
- <!-- <el-button style="background-color: #1591FF;color: #fff;border: 1px solid #1591FF;">保存</el-button>
|
|
|
- <el-button style="background-color: #fff;color: #5B636C;border: 1px solid #ECECEC;">返回</el-button> -->
|
|
|
+ <el-row style="margin-bottom: 20px;" type="flex" :gutter="10" justify="end">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button @click="handleAdd_gl" icon="el-icon-plus" size="mini" style="background-color: #FFE9ED;color: #E58481;border: 1px solid #E58481;">新增</el-button>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-button @click="handleAdd" style="background-color: #FFE9ED;color: #E58481;border: 1px solid #E58481;">新增</el-button>
|
|
|
- <el-button style="background-color: #FFD6B0;color: #EA551A;border: 1px solid #F4AD6B;">删除</el-button>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button icon="el-icon-delete" size="mini" style="background-color: #FFD6B0;color: #EA551A;border: 1px solid #F4AD6B;">删除</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-table ref="dragTable" v-loading="loading" :data="postList" row-key="columnId" align="center" :max-height="tableHeight">
|
|
@@ -73,11 +138,19 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="序号" align="center" prop="sort" />
|
|
|
<el-table-column label="描述" align="center" prop="description" />
|
|
|
- <el-table-column label="关联表" align="center" prop="relationParentId" />
|
|
|
- <el-table-column label="字段(关联到主表PK)" align="center" prop="relationChildId"/>
|
|
|
+ <el-table-column label="关联表" align="center" prop="tableName" />
|
|
|
+ <el-table-column label="字段(关联到主表PK)" align="center" prop="columnName"/>
|
|
|
<el-table-column label="显示条件" align="center" prop="displayConditions" />
|
|
|
- <el-table-column label="关联方式" align="center" prop="relationType" />
|
|
|
- <el-table-column label="内嵌编辑" align="center" prop="embedEdit" />
|
|
|
+ <el-table-column label="关联方式" align="center" prop="relationType" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.relationType | relationTypeFn}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="内嵌编辑" align="center" prop="embedEdit">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.embedEdit | embedEditFn}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="修改人" align="center" prop="updateBy"/>
|
|
|
<el-table-column label="修改时间" align="center" prop="updateTime" />
|
|
|
</el-table>
|
|
@@ -104,38 +177,46 @@
|
|
|
</el-form>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
- <el-form label-width="100px">
|
|
|
- <el-form-item v-if="activeName=='cloum'" style="text-align: center;margin-left:-100px;margin-top:10px;">
|
|
|
- <el-button type="primary" @click="submitForm()">提交</el-button>
|
|
|
- <el-button @click="close()">返回</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
<!-- 添加或修改岗位对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-form-item label="描述:" prop="postName">
|
|
|
- <el-input v-model="form.postName" placeholder="请输入岗位名称" />
|
|
|
+ <el-input v-model="form.description" placeholder="请输入描述" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="关联表:" prop="postCode">
|
|
|
- <el-input v-model="form.postCode" placeholder="请输入编码名称" />
|
|
|
+ <el-form-item label="关联表:" prop="relationParentId">
|
|
|
+ <el-input v-model="form.relationParentId" placeholder="请输入编码名称" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="字段(关联到主表PK):" prop="postSort">
|
|
|
- <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
|
|
|
+ <el-form-item label="字段:" prop="relationChildId">
|
|
|
+ <el-input-number v-model="form.relationChildId" controls-position="right" :min="0" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="显示条件:" prop="postSort">
|
|
|
- <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
|
|
|
+ <el-form-item label="显示条件:" prop="displayConditions">
|
|
|
+ <el-input-number v-model="form.displayConditions" controls-position="right" :min="0" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="关联方式:" prop="postSort">
|
|
|
- <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
|
|
|
+ <el-form-item label="关联方式:" prop="relationType">
|
|
|
+ <el-select v-model="form.relationType" placeholder="岗位状态" clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in relationType"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="dict.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="内嵌编辑:" prop="postSort">
|
|
|
- <el-input-number v-model="form.postSort" controls-position="right" :min="0" />
|
|
|
+ <el-form-item label="内嵌编辑:" prop="embedEdit">
|
|
|
+ <el-select v-model="form.embedEdit" placeholder="岗位状态" clearable size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in embedEdit"
|
|
|
+ :key="dict.dictValue"
|
|
|
+ :label="dict.dictLabel"
|
|
|
+ :value="dict.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="序号:" prop="status">
|
|
|
-
|
|
|
+ <el-form-item label="序号:" prop="sort">
|
|
|
+ <el-input-number v-model="form.sort" controls-position="right" :min="0" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="可用:" prop="remark">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
+ <el-form-item label="是否可用:" prop="isDel">
|
|
|
+ <el-checkbox true-label="Y" disabled v-model="form.isDel"></el-checkbox>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -146,13 +227,14 @@
|
|
|
</el-card>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { getGenTable, updateGenTable, tabList} from "@/api/tool/gen";
|
|
|
+import { getGenTable, updateGenTable, delPost,tabList} 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";
|
|
|
import genInfoForm from "./genInfoForm";
|
|
|
import Sortable from 'sortablejs'
|
|
|
|
|
|
+let _this = ''
|
|
|
export default {
|
|
|
name: "GenEdit",
|
|
|
components: {
|
|
@@ -160,21 +242,26 @@ export default {
|
|
|
genInfoForm
|
|
|
},
|
|
|
data() {
|
|
|
+ _this = this
|
|
|
return {
|
|
|
title: "",
|
|
|
loading: false,
|
|
|
- open: false,
|
|
|
+ open: true,
|
|
|
form: {},
|
|
|
rules: {},
|
|
|
postList: [],
|
|
|
total: 1,
|
|
|
+ // 关联方式
|
|
|
+
|
|
|
+ // 内嵌编辑
|
|
|
+
|
|
|
// 关联表查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
},
|
|
|
// 选中选项卡的 name
|
|
|
- activeName: "cloum",
|
|
|
+ activeName: "genInfo",
|
|
|
// 表格的高度
|
|
|
tableHeight: document.documentElement.scrollHeight - 245 + "px",
|
|
|
// 表信息
|
|
@@ -186,9 +273,39 @@ export default {
|
|
|
// 菜单信息
|
|
|
menus: [],
|
|
|
// 表详细信息
|
|
|
- info: {}
|
|
|
+ info: {},
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 关联方式
|
|
|
+ relationType: [],
|
|
|
+ // 内嵌编辑
|
|
|
+ embedEdit: [],
|
|
|
};
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ relationTypeFn(data) {
|
|
|
+ let is = ''
|
|
|
+ for(let item of _this.relationType){
|
|
|
+ if(item.dictValue == data){
|
|
|
+ is = item.dictLabel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return is
|
|
|
+ },
|
|
|
+ embedEditFn(data) {
|
|
|
+ let is = ''
|
|
|
+ for(let item of _this.embedEdit){
|
|
|
+ if(item.dictValue == data){
|
|
|
+ is = item.dictLabel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return is
|
|
|
+ },
|
|
|
+ },
|
|
|
created() {
|
|
|
const tableId = this.$route.params && this.$route.params.tableId;
|
|
|
if (tableId) {
|
|
@@ -203,13 +320,26 @@ export default {
|
|
|
this.dictOptions = response.data;
|
|
|
});
|
|
|
/** 查询菜单下拉列表 */
|
|
|
- getMenuTreeselect().then(response => {
|
|
|
- this.menus = this.handleTree(response.data, "menuId");
|
|
|
+ // getMenuTreeselect().then(response => {
|
|
|
+ // this.menus = this.handleTree(response.data, "menuId");
|
|
|
+ // });
|
|
|
+ // 关联方式
|
|
|
+ this.getDicts("relation_type").then(response => {
|
|
|
+ this.relationType = response.data;
|
|
|
+ });
|
|
|
+ // 内嵌编辑
|
|
|
+ this.getDicts("embed_edit").then(response => {
|
|
|
+ this.embedEdit = response.data;
|
|
|
});
|
|
|
}
|
|
|
this.tabList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
// 关联表数据
|
|
|
tabList() {
|
|
|
this.loading = true;
|
|
@@ -220,7 +350,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
+ handleAdd_gl() {
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
this.title = "新增关联表";
|
|
@@ -235,19 +365,19 @@ export default {
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
|
|
|
- const genForm = this.$refs.genInfo.$refs.genInfoForm;
|
|
|
+ // const genForm = this.$refs.genInfo.$refs.genInfoForm;
|
|
|
// console.log(basicForm)
|
|
|
- Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
|
|
|
+ Promise.all([basicForm].map(this.getFormPromise)).then(res => {
|
|
|
const validateResult = res.every(item => !!item);
|
|
|
if (validateResult) {
|
|
|
- const genTable = Object.assign({}, basicForm.model, genForm.model);
|
|
|
+ const genTable = Object.assign({}, basicForm.model);
|
|
|
genTable.columns = this.cloumns;
|
|
|
- genTable.params = {
|
|
|
- treeCode: genTable.treeCode,
|
|
|
- treeName: genTable.treeName,
|
|
|
- treeParentCode: genTable.treeParentCode,
|
|
|
- parentMenuId: genTable.parentMenuId
|
|
|
- };
|
|
|
+ // genTable.params = {
|
|
|
+ // treeCode: genTable.treeCode,
|
|
|
+ // treeName: genTable.treeName,
|
|
|
+ // treeParentCode: genTable.treeParentCode,
|
|
|
+ // parentMenuId: genTable.parentMenuId
|
|
|
+ // };
|
|
|
updateGenTable(genTable).then(res => {
|
|
|
this.msgSuccess(res.msg);
|
|
|
if (res.code === 200) {
|
|
@@ -270,6 +400,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() {
|