|
|
@@ -1,810 +1,814 @@
|
|
|
<template>
|
|
|
- <div v-loading="loading" element-loading-text="拼命加载中">
|
|
|
- <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small">
|
|
|
- <el-form-item prop="readTable" label="读表">
|
|
|
-
|
|
|
- <el-switch :value="formData.readTable" on-text="读表" off-text="不读" @change="updateReadTable()">
|
|
|
- </el-switch>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="typeFlag" label="分类">
|
|
|
- <el-input v-model="formData.typeFlag" style="width: 400px;"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="className" label="类名">
|
|
|
- <el-input v-model="formData.className" style="width: 400px;"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item prop="remark" label="描述">
|
|
|
- <el-input v-model="formData.remark" style="width: 400px;"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item prop="dataBaseType" label="库类型">
|
|
|
- <el-select placeholder="库类型" size="small" v-model="formData.dataBaseType" @change="changeDataBaseType" class="filter-item">
|
|
|
- <el-option label="Mysql" value="Mysql">
|
|
|
- </el-option>
|
|
|
- <el-option label="SqlServer" value="SqlServer">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="dataSourceCode" label="数据库">
|
|
|
-
|
|
|
- <el-select placeholder="数据库" size="small" v-model="formData.dataSourceCode" @change="changeDataSourceCode" class="filter-item">
|
|
|
- <el-option v-for="item in datasourceInfoList" :label="item.databaseName" :value="item.code" :key="item.code"></el-option>
|
|
|
- </el-select>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item prop="tableName" label="表名" v-if="!formData.readTable">
|
|
|
- <el-input v-model="formData.tableName" style="width: 400px;"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="tableName" label="表名" v-if="formData.readTable">
|
|
|
-
|
|
|
- <el-select placeholder="表名" size="small" clearable filterable v-model="formData.tableName" @change="changeTableName" class="filter-item">
|
|
|
- <el-option v-for="item in tableList" :label="item" :value="item" :key="item"></el-option>
|
|
|
- </el-select>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item prop="genCode" label="生成">
|
|
|
- <el-checkbox v-model="formData.genTable" label="表"></el-checkbox>
|
|
|
- <el-checkbox v-model="formData.genClass" label="类"></el-checkbox>
|
|
|
- <el-checkbox v-model="formData.genList" label="列表"></el-checkbox>
|
|
|
- <el-checkbox v-model="formData.genForm" label="表单"></el-checkbox>
|
|
|
- <el-checkbox v-model="formData.genRouter" label="路由"></el-checkbox>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="javaPath" label="根目录">
|
|
|
- <el-input v-model="formData.rootPath"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="fields" label="数据">
|
|
|
- <el-tabs value="1" type="border-card">
|
|
|
- <el-tab-pane label="字段" name="1">
|
|
|
- <el-table :data="fields">
|
|
|
- <el-table-column prop="name" label="字段名" min-width="100" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.name"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="type" label="类型" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.jdbcType" filterable>
|
|
|
- <el-option v-for="item in fieldTypes" :value="item" :label="item" :key="item"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="length" label="长度" width="80" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model.number="row.length"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="decimalPlaces" label="小数点" width="80" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model.number="row.decimalPlaces"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="remark" label="描述" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.remark"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="defaultValue" label="默认值" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.defaultValue"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="notNull" label="非空" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.notNull"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="primaryKey" label="主键" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.primaryKey"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="autoIncrease" label="自增" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.autoIncrease"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="130" align="center">
|
|
|
- <template slot-scope="{ row, column, $index }" v-if="$index>1||formData.dataBaseType!='Mysql'">
|
|
|
- <el-button @click="moveUp($index)" size="small" type="text">上移</el-button>
|
|
|
- <el-button @click="moveDown($index)" size="small" type="text">下移</el-button>
|
|
|
- <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="页面属性" name="2">
|
|
|
- <el-table :data="editableFields">
|
|
|
- <el-table-column prop="name" label="字段" align="center">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="showInList" label="列表" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.showInList"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="showInForm" label="表单" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.showInForm" :disabled="row.primaryKey&&!formData.readTable"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="searchable" label="搜索" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.searchable"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- <el-table-column prop="sortable" label="排序" width="50" align="center">
|
|
|
+ <div v-loading="loading" element-loading-text="拼命加载中">
|
|
|
+ <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small">
|
|
|
+ <el-form-item prop="readTable" label="读表">
|
|
|
+
|
|
|
+ <el-switch :value="formData.readTable" on-text="读表" off-text="不读" @change="updateReadTable()">
|
|
|
+ </el-switch>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="typeFlag" label="分类">
|
|
|
+ <el-input v-model="formData.typeFlag" style="width: 400px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="className" label="类名">
|
|
|
+ <el-input v-model="formData.className" style="width: 400px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="remark" label="描述">
|
|
|
+ <el-input v-model="formData.remark" style="width: 400px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="dataBaseType" label="库类型">
|
|
|
+ <el-select placeholder="库类型" size="small" v-model="formData.dataBaseType" @change="changeDataBaseType" class="filter-item">
|
|
|
+ <el-option label="Mysql" value="Mysql">
|
|
|
+ </el-option>
|
|
|
+ <el-option label="SqlServer" value="SqlServer">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="dataSourceCode" label="数据库">
|
|
|
+
|
|
|
+ <el-select placeholder="数据库" size="small" v-model="formData.dataSourceCode" @change="changeDataSourceCode" class="filter-item">
|
|
|
+ <el-option v-for="item in datasourceInfoList" :label="item.databaseName" :value="item.code" :key="item.code"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="tableName" label="表名" v-if="!formData.readTable">
|
|
|
+ <el-input v-model="formData.tableName" style="width: 400px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="tableName" label="表名" v-if="formData.readTable">
|
|
|
+
|
|
|
+ <el-select placeholder="表名" size="small" clearable filterable v-model="formData.tableName" @change="changeTableName" class="filter-item">
|
|
|
+ <el-option v-for="item in tableList" :label="item" :value="item" :key="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item prop="genCode" label="生成">
|
|
|
+ <el-checkbox v-model="formData.genTable" label="表"></el-checkbox>
|
|
|
+ <el-checkbox v-model="formData.genClass" label="类"></el-checkbox>
|
|
|
+ <el-checkbox v-model="formData.genList" label="列表"></el-checkbox>
|
|
|
+ <el-checkbox v-model="formData.genForm" label="表单"></el-checkbox>
|
|
|
+ <el-checkbox v-model="formData.genRouter" label="路由"></el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="javaPath" label="根目录">
|
|
|
+ <el-input v-model="formData.rootPath"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="fields" label="数据">
|
|
|
+ <el-tabs value="1" type="border-card">
|
|
|
+ <el-tab-pane label="字段" name="1">
|
|
|
+ <el-table :data="fields">
|
|
|
+ <el-table-column prop="name" label="字段名" min-width="100" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.name"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="type" label="类型" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.jdbcType" filterable>
|
|
|
+ <el-option v-for="item in fieldTypes" :value="item" :label="item" :key="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="length" label="长度" width="80" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model.number="row.length"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="decimalPlaces" label="小数点" width="80" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model.number="row.decimalPlaces"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="描述" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.remark"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="defaultValue" label="默认值" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.defaultValue"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="notNull" label="非空" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.notNull"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="primaryKey" label="主键" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.primaryKey"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="autoIncrease" label="自增" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.autoIncrease"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="130" align="center">
|
|
|
+ <template slot-scope="{ row, column, $index }" v-if="$index>1||formData.dataBaseType!='Mysql'">
|
|
|
+ <el-button @click="moveUp($index)" size="small" type="text">上移</el-button>
|
|
|
+ <el-button @click="moveDown($index)" size="small" type="text">下移</el-button>
|
|
|
+ <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="页面属性" name="2">
|
|
|
+ <el-table :data="editableFields">
|
|
|
+ <el-table-column prop="name" label="字段" align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="showInList" label="列表" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.showInList"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="showInForm" label="表单" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.showInForm" :disabled="row.primaryKey&&!formData.readTable"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="searchable" label="搜索" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.searchable"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column prop="sortable" label="排序" width="50" align="center">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-checkbox v-model="row.sortable"></el-checkbox>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column prop="formType" label="表单类型" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.formType">
|
|
|
- <el-option v-for="item in formTypes" :label="item.label" :value="item.value" :key="item.value"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="apiFlag" label="接口" width="300" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-radio v-model="row.apiFlag" label="1" :disabled="row.formType!='select'&&row.formType!='multiSelect'">枚举</el-radio>
|
|
|
- <el-radio v-model="row.apiFlag" label="2" :disabled="row.formType!='select'&&row.formType!='multiSelect'">接口</el-radio>
|
|
|
- <el-radio v-model="row.apiFlag" label="3" :disabled="row.formType!='select'&&row.formType!='multiSelect'">表</el-radio>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="optionsValue" label="选项" min-width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input type="textarea" v-if="row.apiFlag=='1'&&(row.formType=='select'||row.formType=='multiSelect')" v-model="row.optionsValue"></el-input>
|
|
|
- <div v-if="(row.apiFlag=='2'||row.apiFlag=='3')&&(row.formType=='select'||row.formType=='multiSelect')" @click="editSelectField(row)">
|
|
|
- <el-input type="textarea" :value="optionsInfo(row)"></el-input>
|
|
|
- </div>
|
|
|
-
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
|
|
|
+ <el-table-column prop="formType" label="表单类型" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.formType">
|
|
|
+ <el-option v-for="item in formTypes" :label="item.label" :value="item.value" :key="item.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="apiFlag" label="接口" width="300" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-radio v-model="row.apiFlag" label="1" :disabled="row.formType!='select'&&row.formType!='multiSelect'">枚举</el-radio>
|
|
|
+ <el-radio v-model="row.apiFlag" label="2" :disabled="row.formType!='select'&&row.formType!='multiSelect'">接口</el-radio>
|
|
|
+ <el-radio v-model="row.apiFlag" label="3" :disabled="row.formType!='select'&&row.formType!='multiSelect'">表</el-radio>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="optionsValue" label="选项" min-width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input type="textarea" v-if="row.apiFlag=='1'&&(row.formType=='select'||row.formType=='multiSelect')" v-model="row.optionsValue"></el-input>
|
|
|
+ <div v-if="(row.apiFlag=='2'||row.apiFlag=='3')&&(row.formType=='select'||row.formType=='multiSelect')" @click="editSelectField(row)">
|
|
|
+ <el-input type="textarea" :value="optionsInfo(row)"></el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-select v-model="row.searchMethod">
|
|
|
<el-option v-for="item in searchMethods" :label="item" :value="item" :key="item"></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- </el-table>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="表单校验" name="3">
|
|
|
- <el-table :data="fields">
|
|
|
- <el-table-column prop="name" label="字段" align="center">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="logicalKey" label="逻辑关键字" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.logicalKey"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="required" label="必填" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.required"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="validate" label="校验" width="50" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-checkbox v-model="row.validate"></el-checkbox>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="minLength" label="最短" width="80" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model.number="row.minLength"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="maxLength" label="最长" width="80" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model.number="row.maxLength"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="min" label="最小值" width="80" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.min"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="max" label="最大值" width="80" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.max"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="validatorType" label="校验类型" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.validatorType" clearable>
|
|
|
- <el-option v-for="item in validatorTypes" :label="item.label" :value="item.value" :key="item.value"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-tab-pane>
|
|
|
- <el-tab-pane label="子表" name="4">
|
|
|
- <el-table :data="subtables">
|
|
|
-
|
|
|
- <el-table-column prop="name" label="控件名" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.name"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="column" label="主表字段" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.column"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="subColumn" label="子表字段" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-input v-model="row.subColumn"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="subCode" label="子表类" width="150" align="center">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <el-select v-model="row.subCode" clearable>
|
|
|
- <el-option v-for="item in subCodes" :label="item.className" :value="item.className" :key="item.className"></el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="60" align="center">
|
|
|
- <template slot-scope="{ row, column, $index }">
|
|
|
- <el-button @click="removeSubtable($index)" size="small" type="text">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <el-button @click="addSubtable" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
|
|
|
- <el-button @click="$router.go(-1)">取消</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <el-dialog title="接口选项" :visible.sync="showSelectDialog">
|
|
|
- <el-form :model="selectField">
|
|
|
- <el-form-item label="接口">
|
|
|
- <el-select placeholder="接口" size="small" filterable clearable v-model="selectField.optionsMethod" class="filter-item">
|
|
|
- <el-option v-for="item in selectMappings" :label="item.url" :value="item.url" :key="item.url"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="显示">
|
|
|
- <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='2'" filterable clearable placeholder="显示" size="small" v-model="selectField.optionsLabel" class="filter-item">
|
|
|
- <el-option v-for="item in selectMappingsJson[selectField.optionsMethod].fileds.split(',')" :label="item" :value="item" :key="item"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="选项">
|
|
|
- <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='2'" filterable clearable placeholder="选项" size="small" v-model="selectField.optionsValue" class="filter-item">
|
|
|
- <el-option v-for="item in selectMappingsJson[selectField.optionsMethod].fileds.split(',')" :label="item" :value="item" :key="item"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="selectMappingSubmit">确定</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog title="表选项" :visible.sync="showTableSelectDialog">
|
|
|
- <el-form :model="selectField">
|
|
|
- <el-form-item label="库类型">
|
|
|
- <el-select placeholder="库类型" size="small" filterable clearable v-model="selectField.optionsDataBaseType" @change="changeOptionsDataBaseType" class="filter-item">
|
|
|
- <el-option label="Mysql" value="Mysql">
|
|
|
- </el-option>
|
|
|
- <el-option label="SqlServer" value="SqlServer">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="数据库">
|
|
|
-
|
|
|
- <el-select placeholder="数据库" size="small" filterable clearable v-model="selectField.optionsDataSourceCode" @change="changeOptionsDataSourceCode" class="filter-item">
|
|
|
- <el-option v-for="item in optionsDatasourceInfoList" :label="item.databaseName" :value="item.code" :key="item.code"></el-option>
|
|
|
- </el-select>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="表名">
|
|
|
-
|
|
|
- <el-select placeholder="表名" size="small" clearable filterable v-model="selectField.optionsMethod" @change="changeOptionsTableName" class="filter-item">
|
|
|
- <el-option v-for="item in optionsTableList" :label="item" :value="item" :key="item"></el-option>
|
|
|
- </el-select>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="显示">
|
|
|
- <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='3'" filterable clearable placeholder="显示" size="small" v-model="selectField.optionsLabel" class="filter-item">
|
|
|
- <el-option v-for="item in optionsFields" :label="item.name" :value="item.name" :key="item.name"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="选项">
|
|
|
- <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='3'" filterable clearable placeholder="选项" size="small" v-model="selectField.optionsValue" class="filter-item">
|
|
|
- <el-option v-for="item in optionsFields" :label="item.name" :value="item.name" :key="item.name"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="selectMappingSubmit">确定</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- </div>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="表单校验" name="3">
|
|
|
+ <el-table :data="fields">
|
|
|
+ <el-table-column prop="name" label="字段" align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="logicalKey" label="逻辑关键字" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.logicalKey"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="required" label="必填" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.required"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="validate" label="校验" width="50" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-checkbox v-model="row.validate"></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="minLength" label="最短" width="80" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model.number="row.minLength"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="maxLength" label="最长" width="80" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model.number="row.maxLength"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="min" label="最小值" width="80" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.min"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="max" label="最大值" width="80" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.max"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="validatorType" label="校验类型" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.validatorType" clearable>
|
|
|
+ <el-option v-for="item in validatorTypes" :label="item.label" :value="item.value" :key="item.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="子表" name="4">
|
|
|
+ <el-table :data="subtables">
|
|
|
+
|
|
|
+ <el-table-column prop="name" label="控件名" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.name"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="column" label="主表字段" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.column"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="subColumn" label="子表字段" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-input v-model="row.subColumn"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="subCode" label="子表类" width="150" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-select v-model="row.subCode" clearable>
|
|
|
+ <el-option v-for="item in subCodes" :label="item.className" :value="item.className" :key="item.className"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="60" align="center">
|
|
|
+ <template slot-scope="{ row, column, $index }">
|
|
|
+ <el-button @click="removeSubtable($index)" size="small" type="text">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-button @click="addSubtable" type="text" icon="el-icon-plus">添加</el-button>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
|
|
|
+ <el-button @click="$router.go(-1)">取消</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-dialog title="接口选项" :visible.sync="showSelectDialog">
|
|
|
+ <el-form :model="selectField">
|
|
|
+ <el-form-item label="接口">
|
|
|
+ <el-select placeholder="接口" size="small" filterable clearable v-model="selectField.optionsMethod" class="filter-item">
|
|
|
+ <el-option v-for="item in selectMappings" :label="item.url" :value="item.url" :key="item.url"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="显示">
|
|
|
+ <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='2'" filterable clearable placeholder="显示" size="small" v-model="selectField.optionsLabel" class="filter-item">
|
|
|
+ <el-option v-for="item in selectMappingsJson[selectField.optionsMethod].fileds.split(',')" :label="item" :value="item" :key="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="选项">
|
|
|
+ <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='2'" filterable clearable placeholder="选项" size="small" v-model="selectField.optionsValue" class="filter-item">
|
|
|
+ <el-option v-for="item in selectMappingsJson[selectField.optionsMethod].fileds.split(',')" :label="item" :value="item" :key="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="selectMappingSubmit">确定</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="表选项" :visible.sync="showTableSelectDialog">
|
|
|
+ <el-form :model="selectField">
|
|
|
+ <el-form-item label="库类型">
|
|
|
+ <el-select placeholder="库类型" size="small" filterable clearable v-model="selectField.optionsDataBaseType" @change="changeOptionsDataBaseType" class="filter-item">
|
|
|
+ <el-option label="Mysql" value="Mysql">
|
|
|
+ </el-option>
|
|
|
+ <el-option label="SqlServer" value="SqlServer">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="数据库">
|
|
|
+
|
|
|
+ <el-select placeholder="数据库" size="small" filterable clearable v-model="selectField.optionsDataSourceCode" @change="changeOptionsDataSourceCode" class="filter-item">
|
|
|
+ <el-option v-for="item in optionsDatasourceInfoList" :label="item.databaseName" :value="item.code" :key="item.code"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="表名">
|
|
|
+
|
|
|
+ <el-select placeholder="表名" size="small" clearable filterable v-model="selectField.optionsMethod" @change="changeOptionsTableName" class="filter-item">
|
|
|
+ <el-option v-for="item in optionsTableList" :label="item" :value="item" :key="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="显示">
|
|
|
+ <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='3'" filterable clearable placeholder="显示" size="small" v-model="selectField.optionsLabel" class="filter-item">
|
|
|
+ <el-option v-for="item in optionsFields" :label="item.name" :value="item.name" :key="item.name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="选项">
|
|
|
+ <el-select v-if="selectField.optionsMethod&&selectField.apiFlag=='3'" filterable clearable placeholder="选项" size="small" v-model="selectField.optionsValue" class="filter-item">
|
|
|
+ <el-option v-for="item in optionsFields" :label="item.name" :value="item.name" :key="item.name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="selectMappingSubmit">确定</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import axios from 'axios'
|
|
|
-
|
|
|
-export default {
|
|
|
- created() {
|
|
|
- if (this.$route.query.id) {
|
|
|
- this.loading = true;
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/getOne',
|
|
|
- data: {
|
|
|
- id: this.$route.query.id
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- this.loading = false;
|
|
|
- if (res.success) {
|
|
|
- this.formData = {
|
|
|
- ...this.formData,
|
|
|
- ...JSON.parse(res.data.genJson)
|
|
|
- };
|
|
|
- this.fields = this.formData.fields;
|
|
|
- this.formData.id = res.data.id;
|
|
|
- this.formData.genRouter = false;
|
|
|
- this.subtables = this.formData.subtables;
|
|
|
- }
|
|
|
- }).catch(e => this.loading = false)
|
|
|
- }
|
|
|
-
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/getSrcPath'
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.formData.rootPath = res.data.root;
|
|
|
- this.formData.javaPathRelative = res.data.javaPath;
|
|
|
- this.formData.viewPathRelative = res.data.viewPath;
|
|
|
- this.formData.routerPathRelative = res.data.routerPath;
|
|
|
- }
|
|
|
- });
|
|
|
- this.$http.get({
|
|
|
- url: '/dataSourceInfo/all'
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.MysqlDataSourceInfos.push(this.baseDataSource);
|
|
|
-
|
|
|
- if (res.data.length > 0) {
|
|
|
- res.data.forEach(item => {
|
|
|
- if ('Mysql' == item.databaseType) {
|
|
|
- this.MysqlDataSourceInfos.push(item);
|
|
|
- } else if ('SqlServer' == item.databaseType) {
|
|
|
- this.SqlServerDataSourceInfos.push(item);
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- this.datasourceInfoList = this.MysqlDataSourceInfos;
|
|
|
- }
|
|
|
- });
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/all'
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.subCodes = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- this.$http.get({
|
|
|
- url: '/dev/selectMappings'
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
- if (res.data.length > 0) {
|
|
|
- var temp = {}
|
|
|
- res.data.forEach(item => {
|
|
|
- temp[item.url] = item
|
|
|
- })
|
|
|
- }
|
|
|
- this.selectMappingsJson = temp;
|
|
|
- this.selectMappings = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- this.getDatabaseTables();
|
|
|
-
|
|
|
-
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- loading: false,
|
|
|
- fieldTypes: ['char', 'varchar', 'int', 'text', 'timestamp', 'datetime', 'decimal', 'float', 'vue'],
|
|
|
- searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'between', 'like', 'left like', 'right like'],
|
|
|
- formTypes: [
|
|
|
- { label: '单行文本', value: 'singleLineText' },
|
|
|
- { label: '多行文本', value: 'textarea' },
|
|
|
- { label: '富文本', value: 'richText' },
|
|
|
- { label: '数字', value: 'number' },
|
|
|
- { label: '日期选择', value: 'date' },
|
|
|
- { label: '日期时间选择', value: 'datetime' },
|
|
|
- { label: '单选下拉框', value: 'select' },
|
|
|
- { label: '多选下拉框', value: 'multiSelect' },
|
|
|
- { label: '单图上传', value: 'singleImage' },
|
|
|
- { label: '多图上传', value: 'multiImage' },
|
|
|
- { label: '文件上传', value: 'fileUpload' },
|
|
|
- { label: '树形选择', value: 'tree' },
|
|
|
- { label: '开关', value: 'switch' }
|
|
|
- ],
|
|
|
- validatorTypes: [
|
|
|
- { label: '英文', value: 'english' },
|
|
|
- { label: '数字', value: 'number' },
|
|
|
- { label: '手机', value: 'phone' },
|
|
|
- { label: '网址', value: 'url' },
|
|
|
- { label: '电子邮件', value: 'email' },
|
|
|
- { label: '身份证', value: 'id' }
|
|
|
- ],
|
|
|
- rules: {
|
|
|
- className: [
|
|
|
- { required: true, message: '请填写类名', trigger: 'blur' },
|
|
|
- {
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (value) {
|
|
|
- if (/^[\u4e00-\u9fa5a-zA-Z0-9_]*$/.test(value)) {
|
|
|
- callback();
|
|
|
- } else {
|
|
|
- callback(new Error('类名不正确'));
|
|
|
- }
|
|
|
- }
|
|
|
- }, trigger: 'blur'
|
|
|
- }
|
|
|
- ],
|
|
|
- tableName: [
|
|
|
- { required: true, message: '请填写表名', trigger: 'blur' },
|
|
|
- {
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (value) {
|
|
|
- if (/^[\u4e00-\u9fa5a-zA-Z0-9_]*$/.test(value)) {
|
|
|
- callback();
|
|
|
- } else {
|
|
|
- callback(new Error('表名不正确'));
|
|
|
- }
|
|
|
- }
|
|
|
- }, trigger: 'blur'
|
|
|
- }
|
|
|
- ],
|
|
|
- remark: [{ required: true, message: '请填写描述', trigger: 'blur' }],
|
|
|
- rootPath: [{ required: true, message: '请填写生成目录', trigger: 'blur' }],
|
|
|
- dataBaseType: [{ required: true, message: '请选择数据库类型', trigger: 'blur' }],
|
|
|
- dataSourceCode: [{ required: true, message: '请填选择数据库', trigger: 'blur' }],
|
|
|
- typeFlag: [{ required: true, message: '请填填写分类', trigger: 'blur' }],
|
|
|
- },
|
|
|
- formData: {
|
|
|
- tableName: '',
|
|
|
- remark: '',
|
|
|
- genTable: true,
|
|
|
- genClass: true,
|
|
|
- genList: true,
|
|
|
- genForm: true,
|
|
|
- genRouter: true,
|
|
|
- rootPath: '',
|
|
|
- javaPathRelative: '',
|
|
|
- viewPathRelative: '',
|
|
|
- dataBaseType: 'Mysql',
|
|
|
- readTable: false,
|
|
|
- dataSourceCode: 'dataSource',
|
|
|
- className: '',
|
|
|
- subtables: [],
|
|
|
-
|
|
|
- },
|
|
|
- fields: [
|
|
|
- {
|
|
|
- name: 'id',
|
|
|
- jdbcType: 'int',
|
|
|
- notNull: true,
|
|
|
- primaryKey: true,
|
|
|
- autoIncrease: true,
|
|
|
- remark: '',
|
|
|
- showInList: false,
|
|
|
- showInForm: false,
|
|
|
- searchable: false,
|
|
|
- sortable: true
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'del_flag',
|
|
|
- jdbcType: 'char',
|
|
|
- notNull: true,
|
|
|
- primaryKey: false,
|
|
|
- autoIncrease: false,
|
|
|
- remark: '删除标识',
|
|
|
- showInList: false,
|
|
|
- showInForm: false,
|
|
|
- searchable: false,
|
|
|
- defaultValue: 'N',
|
|
|
- length: 1,
|
|
|
- sortable: false
|
|
|
- },
|
|
|
- ],
|
|
|
- MysqlDataSourceInfos: [],
|
|
|
- SqlServerDataSourceInfos: [],
|
|
|
- baseDataSource: {
|
|
|
- databaseType: 'Mysql',
|
|
|
- code: 'dataSource',
|
|
|
- databaseName: '基础数据库'
|
|
|
-
|
|
|
- },
|
|
|
- datasourceInfoList: [],
|
|
|
- tableList: [],
|
|
|
- subtables: [],
|
|
|
- subCodes: [],
|
|
|
- selectMappings: [],
|
|
|
- selectMappingsJson: {},
|
|
|
- showSelectDialog: false,
|
|
|
- selectField: {},
|
|
|
- showTableSelectDialog: false,
|
|
|
- optionsDatasourceInfoList: [],
|
|
|
- optionsTableList: [],
|
|
|
- optionsFields: [],
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- editableFields() {
|
|
|
- return this.fields.filter(i => {
|
|
|
- return i.name
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- onSave() {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.submit();
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- submit() {
|
|
|
-
|
|
|
- this.formData.fields = this.fields;
|
|
|
- this.formData.subtables = this.subtables;
|
|
|
- this.formData.javaPath = this.formData.rootPath + this.formData.javaPathRelative;
|
|
|
- this.formData.viewPath = this.formData.rootPath + this.formData.viewPathRelative;
|
|
|
- this.formData.routerPath = this.formData.rootPath + this.formData.routerPathRelative;
|
|
|
- this.formData.genJson = '';
|
|
|
-
|
|
|
- this.$alert('生成代码可能会删除已有同名表、数据或文件,确认要生成么?', '警告', { type: 'error' }).then(() => {
|
|
|
- this.loading = true;
|
|
|
- return axios.post(this.formData.id ? '/genCode/update' : '/genCode/save', this.formData)
|
|
|
- }).then(() => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success('代码生成成功');
|
|
|
- this.$router.go(-1);
|
|
|
- }).catch(res => {
|
|
|
- this.loading = false;
|
|
|
- if ('cancel' === res) {
|
|
|
- this.$msgbox({ title: '提示', type: 'error', message: '生成取消' });
|
|
|
- } else {
|
|
|
- this.$msgbox({ title: '提示', type: 'error', message: '生成失败' });
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- addField() {
|
|
|
- this.fields.push({
|
|
|
- name: '',
|
|
|
- jdbcType: 'varchar',
|
|
|
- notNull: false,
|
|
|
- primaryKey: false,
|
|
|
- autoIncrease: false,
|
|
|
- remark: '',
|
|
|
- showInList: true,
|
|
|
- showInForm: true,
|
|
|
- searchable: true,
|
|
|
- formType: 'singleLineText',
|
|
|
- sortable: true
|
|
|
- });
|
|
|
- },
|
|
|
- removeField(i) {
|
|
|
- if (this.fields.length > 0) {
|
|
|
- this.fields.splice(i, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- updateReadTable() {
|
|
|
- this.formData.readTable = !this.formData.readTable;
|
|
|
- this.formData.genTable = !this.formData.readTable;
|
|
|
- },
|
|
|
- changeDataBaseType() {
|
|
|
- if ('Mysql' == this.formData.dataBaseType) {
|
|
|
- this.datasourceInfoList = this.MysqlDataSourceInfos;
|
|
|
- this.formData.dataSourceCode = 'dataSource';
|
|
|
- this.getDatabaseTables();
|
|
|
- } else if ('SqlServer' == this.formData.dataBaseType) {
|
|
|
- this.datasourceInfoList = this.SqlServerDataSourceInfos;
|
|
|
- this.formData.dataSourceCode = '';
|
|
|
- }
|
|
|
- },
|
|
|
- changeOptionsDataBaseType() {
|
|
|
- if ('Mysql' == this.selectField.optionsDataBaseType) {
|
|
|
- this.optionsDatasourceInfoList = this.MysqlDataSourceInfos;
|
|
|
- this.selectField.optionsDataSourceCode = 'dataSource';
|
|
|
- this.getOptionsDatabaseTables();
|
|
|
- } else if ('SqlServer' == this.selectField.optionsDataBaseType) {
|
|
|
- this.optionsDatasourceInfoList = this.SqlServerDataSourceInfos;
|
|
|
- this.selectField.optionsDataSourceCode = '';
|
|
|
- }
|
|
|
- },
|
|
|
- getDatabaseTables(code) {
|
|
|
- this.tableList = [];
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/tables',
|
|
|
- data: {
|
|
|
- code: code
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
-
|
|
|
- this.tableList = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- getOptionsDatabaseTables(code) {
|
|
|
- this.optionsTableList = [];
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/tables',
|
|
|
- data: {
|
|
|
- code: code
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
-
|
|
|
- this.optionsTableList = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- changeDataSourceCode() {
|
|
|
- if (this.formData.readTable) {
|
|
|
-
|
|
|
- this.formData.tableName = '';
|
|
|
- this.getDatabaseTables(this.formData.dataSourceCode);
|
|
|
- }
|
|
|
- },
|
|
|
- changeOptionsDataSourceCode() {
|
|
|
-
|
|
|
- this.getOptionsDatabaseTables(this.selectField.optionsDataSourceCode);
|
|
|
- },
|
|
|
- changeTableName() {
|
|
|
- if (this.formData.readTable) {
|
|
|
-
|
|
|
- this.fields = [];
|
|
|
-
|
|
|
- this.getTableFields(this.formData.tableName);
|
|
|
- }
|
|
|
- },
|
|
|
- changeOptionsTableName() {
|
|
|
-
|
|
|
- this.optionsFields = [];
|
|
|
-
|
|
|
- this.getOptionsTableFields(this.selectField.optionsMethod);
|
|
|
- },
|
|
|
- getTableFields(tableName) {
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/tableFields',
|
|
|
- data: {
|
|
|
- code: this.formData.dataSourceCode,
|
|
|
- tableName: tableName,
|
|
|
- databaseType: this.formData.dataBaseType,
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
-
|
|
|
- this.fields = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- getOptionsTableFields(tableName) {
|
|
|
- this.$http.get({
|
|
|
- url: '/genCode/tableFields',
|
|
|
- data: {
|
|
|
- code: this.selectField.optionsDataSourceCode,
|
|
|
- tableName: tableName,
|
|
|
- databaseType: this.selectField.optionsDataBaseType,
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- if (res.success) {
|
|
|
-
|
|
|
- this.optionsFields = res.data;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- addSubtable() {
|
|
|
- this.subtables.push({
|
|
|
- name: '',
|
|
|
- column: '',
|
|
|
- subColumn: '',
|
|
|
- subCode: '',
|
|
|
- });
|
|
|
- },
|
|
|
- removeSubtable(i) {
|
|
|
- if (this.subtables.length > 0) {
|
|
|
- this.subtables.splice(i, 1);
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- moveUp(i) {
|
|
|
- if (i > 0) {
|
|
|
-
|
|
|
- var tempFields = [...this.fields];
|
|
|
- var tempField = tempFields[i - 1];
|
|
|
-
|
|
|
-
|
|
|
- tempFields[i - 1] = tempFields[i];
|
|
|
- tempFields[i] = tempField;
|
|
|
-
|
|
|
- this.fields = tempFields;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- moveDown(i) {
|
|
|
- if (this.fields.length - 1 > i) {
|
|
|
-
|
|
|
- var tempFields = [...this.fields];
|
|
|
-
|
|
|
- var tempField = tempFields[i + 1];
|
|
|
-
|
|
|
-
|
|
|
- tempFields[i + 1] = tempFields[i];
|
|
|
- tempFields[i] = tempField;
|
|
|
-
|
|
|
- this.fields = tempFields;
|
|
|
+ import axios from 'axios'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ created() {
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ this.loading = true;
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/getOne',
|
|
|
+ data: {
|
|
|
+ id: this.$route.query.id
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ this.loading = false;
|
|
|
+ if (res.success) {
|
|
|
+ this.formData = {
|
|
|
+ ...this.formData,
|
|
|
+ ...JSON.parse(res.data.genJson)
|
|
|
+ };
|
|
|
+ this.fields = this.formData.fields;
|
|
|
+ this.formData.id = res.data.id;
|
|
|
+ this.formData.genRouter = false;
|
|
|
+ this.subtables = this.formData.subtables;
|
|
|
+ }
|
|
|
+ }).catch(e => this.loading = false)
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/getSrcPath'
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.formData.rootPath = res.data.root;
|
|
|
+ this.formData.javaPathRelative = res.data.javaPath;
|
|
|
+ this.formData.viewPathRelative = res.data.viewPath;
|
|
|
+ this.formData.routerPathRelative = res.data.routerPath;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$http.get({
|
|
|
+ url: '/dataSourceInfo/all'
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.MysqlDataSourceInfos.push(this.baseDataSource);
|
|
|
+
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ res.data.forEach(item => {
|
|
|
+ if ('Mysql' == item.databaseType) {
|
|
|
+ this.MysqlDataSourceInfos.push(item);
|
|
|
+ } else if ('SqlServer' == item.databaseType) {
|
|
|
+ this.SqlServerDataSourceInfos.push(item);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.datasourceInfoList = this.MysqlDataSourceInfos;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/all'
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.subCodes = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$http.get({
|
|
|
+ url: '/dev/selectMappings'
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ var temp = {}
|
|
|
+ res.data.forEach(item => {
|
|
|
+ temp[item.url] = item
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.selectMappingsJson = temp;
|
|
|
+ this.selectMappings = res.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ this.getDatabaseTables();
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ fieldTypes: ['char', 'varchar', 'int', 'text', 'timestamp', 'datetime', 'decimal', 'float', 'vue'],
|
|
|
+ searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'between', 'like', 'left like', 'right like'],
|
|
|
+ formTypes: [
|
|
|
+
|
|
|
+ { label: '单行文本', value: 'singleLineText' },
|
|
|
+ { label: '数字', value: 'number' },
|
|
|
+ { label: '日期选择', value: 'date' },
|
|
|
+ { label: '日期时间选择', value: 'datetime' },
|
|
|
+ { label: '登录名', value: 'loginName' },
|
|
|
+ { label: '当前时间', value: 'currentTime' },
|
|
|
+ { label: '当前日期', value: 'currentDate' },
|
|
|
+ { label: '单选下拉框', value: 'select' },
|
|
|
+ { label: '多选下拉框', value: 'multiSelect' },
|
|
|
+ { label: '单图上传', value: 'singleImage' },
|
|
|
+ { label: '多图上传', value: 'multiImage' },
|
|
|
+ { label: '文件上传', value: 'fileUpload' },
|
|
|
+ { label: '树形选择', value: 'tree' },
|
|
|
+ { label: '开关', value: 'switch' },
|
|
|
+ { label: '多行文本', value: 'textarea' },
|
|
|
+ { label: '富文本', value: 'richText' },
|
|
|
+ ],
|
|
|
+ validatorTypes: [
|
|
|
+ { label: '英文', value: 'english' },
|
|
|
+ { label: '数字', value: 'number' },
|
|
|
+ { label: '手机', value: 'phone' },
|
|
|
+ { label: '网址', value: 'url' },
|
|
|
+ { label: '电子邮件', value: 'email' },
|
|
|
+ { label: '身份证', value: 'id' }
|
|
|
+ ],
|
|
|
+ rules: {
|
|
|
+ className: [
|
|
|
+ { required: true, message: '请填写类名', trigger: 'blur' },
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value) {
|
|
|
+ if (/^[\u4e00-\u9fa5a-zA-Z0-9_]*$/.test(value)) {
|
|
|
+ callback();
|
|
|
+ } else {
|
|
|
+ callback(new Error('类名不正确'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ tableName: [
|
|
|
+ { required: true, message: '请填写表名', trigger: 'blur' },
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value) {
|
|
|
+ if (/^[\u4e00-\u9fa5a-zA-Z0-9_]*$/.test(value)) {
|
|
|
+ callback();
|
|
|
+ } else {
|
|
|
+ callback(new Error('表名不正确'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ remark: [{ required: true, message: '请填写描述', trigger: 'blur' }],
|
|
|
+ rootPath: [{ required: true, message: '请填写生成目录', trigger: 'blur' }],
|
|
|
+ dataBaseType: [{ required: true, message: '请选择数据库类型', trigger: 'blur' }],
|
|
|
+ dataSourceCode: [{ required: true, message: '请填选择数据库', trigger: 'blur' }],
|
|
|
+ typeFlag: [{ required: true, message: '请填填写分类', trigger: 'blur' }],
|
|
|
+ },
|
|
|
+ formData: {
|
|
|
+ tableName: '',
|
|
|
+ remark: '',
|
|
|
+ genTable: true,
|
|
|
+ genClass: true,
|
|
|
+ genList: true,
|
|
|
+ genForm: true,
|
|
|
+ genRouter: true,
|
|
|
+ rootPath: '',
|
|
|
+ javaPathRelative: '',
|
|
|
+ viewPathRelative: '',
|
|
|
+ dataBaseType: 'Mysql',
|
|
|
+ readTable: false,
|
|
|
+ dataSourceCode: 'dataSource',
|
|
|
+ className: '',
|
|
|
+ subtables: [],
|
|
|
+
|
|
|
+ },
|
|
|
+ fields: [
|
|
|
+ {
|
|
|
+ name: 'id',
|
|
|
+ jdbcType: 'int',
|
|
|
+ notNull: true,
|
|
|
+ primaryKey: true,
|
|
|
+ autoIncrease: true,
|
|
|
+ remark: '',
|
|
|
+ showInList: false,
|
|
|
+ showInForm: false,
|
|
|
+ searchable: false,
|
|
|
+ sortable: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'del_flag',
|
|
|
+ jdbcType: 'char',
|
|
|
+ notNull: true,
|
|
|
+ primaryKey: false,
|
|
|
+ autoIncrease: false,
|
|
|
+ remark: '删除标识',
|
|
|
+ showInList: false,
|
|
|
+ showInForm: false,
|
|
|
+ searchable: false,
|
|
|
+ defaultValue: 'N',
|
|
|
+ length: 1,
|
|
|
+ sortable: false
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ MysqlDataSourceInfos: [],
|
|
|
+ SqlServerDataSourceInfos: [],
|
|
|
+ baseDataSource: {
|
|
|
+ databaseType: 'Mysql',
|
|
|
+ code: 'dataSource',
|
|
|
+ databaseName: '基础数据库'
|
|
|
+
|
|
|
+ },
|
|
|
+ datasourceInfoList: [],
|
|
|
+ tableList: [],
|
|
|
+ subtables: [],
|
|
|
+ subCodes: [],
|
|
|
+ selectMappings: [],
|
|
|
+ selectMappingsJson: {},
|
|
|
+ showSelectDialog: false,
|
|
|
+ selectField: {},
|
|
|
+ showTableSelectDialog: false,
|
|
|
+ optionsDatasourceInfoList: [],
|
|
|
+ optionsTableList: [],
|
|
|
+ optionsFields: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ editableFields() {
|
|
|
+ return this.fields.filter(i => {
|
|
|
+ return i.name
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onSave() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.submit();
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+
|
|
|
+ this.formData.fields = this.fields;
|
|
|
+ this.formData.subtables = this.subtables;
|
|
|
+ this.formData.javaPath = this.formData.rootPath + this.formData.javaPathRelative;
|
|
|
+ this.formData.viewPath = this.formData.rootPath + this.formData.viewPathRelative;
|
|
|
+ this.formData.routerPath = this.formData.rootPath + this.formData.routerPathRelative;
|
|
|
+ this.formData.genJson = '';
|
|
|
+
|
|
|
+ this.$alert('生成代码可能会删除已有同名表、数据或文件,确认要生成么?', '警告', { type: 'error' }).then(() => {
|
|
|
+ this.loading = true;
|
|
|
+ return axios.post(this.formData.id ? '/genCode/update' : '/genCode/save', this.formData)
|
|
|
+ }).then(() => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success('代码生成成功');
|
|
|
+ this.$router.go(-1);
|
|
|
+ }).catch(res => {
|
|
|
+ this.loading = false;
|
|
|
+ if ('cancel' === res) {
|
|
|
+ this.$msgbox({ title: '提示', type: 'error', message: '生成取消' });
|
|
|
+ } else {
|
|
|
+ this.$msgbox({ title: '提示', type: 'error', message: '生成失败' });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addField() {
|
|
|
+ this.fields.push({
|
|
|
+ name: '',
|
|
|
+ jdbcType: 'varchar',
|
|
|
+ notNull: false,
|
|
|
+ primaryKey: false,
|
|
|
+ autoIncrease: false,
|
|
|
+ remark: '',
|
|
|
+ showInList: true,
|
|
|
+ showInForm: true,
|
|
|
+ searchable: true,
|
|
|
+ formType: 'singleLineText',
|
|
|
+ sortable: true
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeField(i) {
|
|
|
+ if (this.fields.length > 0) {
|
|
|
+ this.fields.splice(i, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateReadTable() {
|
|
|
+ this.formData.readTable = !this.formData.readTable;
|
|
|
+ this.formData.genTable = !this.formData.readTable;
|
|
|
+ },
|
|
|
+ changeDataBaseType() {
|
|
|
+ if ('Mysql' == this.formData.dataBaseType) {
|
|
|
+ this.datasourceInfoList = this.MysqlDataSourceInfos;
|
|
|
+ this.formData.dataSourceCode = 'dataSource';
|
|
|
+ this.getDatabaseTables();
|
|
|
+ } else if ('SqlServer' == this.formData.dataBaseType) {
|
|
|
+ this.datasourceInfoList = this.SqlServerDataSourceInfos;
|
|
|
+ this.formData.dataSourceCode = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeOptionsDataBaseType() {
|
|
|
+ if ('Mysql' == this.selectField.optionsDataBaseType) {
|
|
|
+ this.optionsDatasourceInfoList = this.MysqlDataSourceInfos;
|
|
|
+ this.selectField.optionsDataSourceCode = 'dataSource';
|
|
|
+ this.getOptionsDatabaseTables();
|
|
|
+ } else if ('SqlServer' == this.selectField.optionsDataBaseType) {
|
|
|
+ this.optionsDatasourceInfoList = this.SqlServerDataSourceInfos;
|
|
|
+ this.selectField.optionsDataSourceCode = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDatabaseTables(code) {
|
|
|
+ this.tableList = [];
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/tables',
|
|
|
+ data: {
|
|
|
+ code: code
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+
|
|
|
+ this.tableList = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getOptionsDatabaseTables(code) {
|
|
|
+ this.optionsTableList = [];
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/tables',
|
|
|
+ data: {
|
|
|
+ code: code
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+
|
|
|
+ this.optionsTableList = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeDataSourceCode() {
|
|
|
+ if (this.formData.readTable) {
|
|
|
+
|
|
|
+ this.formData.tableName = '';
|
|
|
+ this.getDatabaseTables(this.formData.dataSourceCode);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeOptionsDataSourceCode() {
|
|
|
+
|
|
|
+ this.getOptionsDatabaseTables(this.selectField.optionsDataSourceCode);
|
|
|
+ },
|
|
|
+ changeTableName() {
|
|
|
+ if (this.formData.readTable) {
|
|
|
+
|
|
|
+ this.fields = [];
|
|
|
+
|
|
|
+ this.getTableFields(this.formData.tableName);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeOptionsTableName() {
|
|
|
+
|
|
|
+ this.optionsFields = [];
|
|
|
+
|
|
|
+ this.getOptionsTableFields(this.selectField.optionsMethod);
|
|
|
+ },
|
|
|
+ getTableFields(tableName) {
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/tableFields',
|
|
|
+ data: {
|
|
|
+ code: this.formData.dataSourceCode,
|
|
|
+ tableName: tableName,
|
|
|
+ databaseType: this.formData.dataBaseType,
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+
|
|
|
+ this.fields = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getOptionsTableFields(tableName) {
|
|
|
+ this.$http.get({
|
|
|
+ url: '/genCode/tableFields',
|
|
|
+ data: {
|
|
|
+ code: this.selectField.optionsDataSourceCode,
|
|
|
+ tableName: tableName,
|
|
|
+ databaseType: this.selectField.optionsDataBaseType,
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+
|
|
|
+ this.optionsFields = res.data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addSubtable() {
|
|
|
+ this.subtables.push({
|
|
|
+ name: '',
|
|
|
+ column: '',
|
|
|
+ subColumn: '',
|
|
|
+ subCode: '',
|
|
|
+ });
|
|
|
+ },
|
|
|
+ removeSubtable(i) {
|
|
|
+ if (this.subtables.length > 0) {
|
|
|
+ this.subtables.splice(i, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ moveUp(i) {
|
|
|
+ if (i > 0) {
|
|
|
+
|
|
|
+ var tempFields = [...this.fields];
|
|
|
+ var tempField = tempFields[i - 1];
|
|
|
+
|
|
|
+
|
|
|
+ tempFields[i - 1] = tempFields[i];
|
|
|
+ tempFields[i] = tempField;
|
|
|
+
|
|
|
+ this.fields = tempFields;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ moveDown(i) {
|
|
|
+ if (this.fields.length - 1 > i) {
|
|
|
+
|
|
|
+ var tempFields = [...this.fields];
|
|
|
+
|
|
|
+ var tempField = tempFields[i + 1];
|
|
|
+
|
|
|
+
|
|
|
+ tempFields[i + 1] = tempFields[i];
|
|
|
+ tempFields[i] = tempField;
|
|
|
+
|
|
|
+ this.fields = tempFields;
|
|
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- },
|
|
|
- editSelectField(row) {
|
|
|
- this.selectField = row;
|
|
|
+ },
|
|
|
+ editSelectField(row) {
|
|
|
+ this.selectField = row;
|
|
|
|
|
|
- if (row.apiFlag == '2') {
|
|
|
+ if (row.apiFlag == '2') {
|
|
|
|
|
|
- this.showSelectDialog = true;
|
|
|
- } else if (row.apiFlag == '3') {
|
|
|
- this.showTableSelectDialog = true;
|
|
|
- }
|
|
|
- },
|
|
|
- optionsInfo(row) {
|
|
|
- var value = '';
|
|
|
- if (row.apiFlag == '1') {
|
|
|
- value = row.optionsValue;
|
|
|
- } else if (row.apiFlag == '2') {
|
|
|
+ this.showSelectDialog = true;
|
|
|
+ } else if (row.apiFlag == '3') {
|
|
|
+ this.showTableSelectDialog = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ optionsInfo(row) {
|
|
|
+ var value = '';
|
|
|
+ if (row.apiFlag == '1') {
|
|
|
+ value = row.optionsValue;
|
|
|
+ } else if (row.apiFlag == '2') {
|
|
|
|
|
|
- value = row.optionsMethod + ',' + row.optionsLabel + ',' + row.optionsValue;
|
|
|
- } else if (row.apiFlag == '3') {
|
|
|
- value = row.optionsMethod + ',' + row.optionsLabel + ',' + row.optionsValue;
|
|
|
- }
|
|
|
- return value;
|
|
|
- },
|
|
|
- selectMappingSubmit() {
|
|
|
+ value = row.optionsMethod + ',' + row.optionsLabel + ',' + row.optionsValue;
|
|
|
+ } else if (row.apiFlag == '3') {
|
|
|
+ value = row.optionsMethod + ',' + row.optionsLabel + ',' + row.optionsValue;
|
|
|
+ }
|
|
|
+ return value;
|
|
|
+ },
|
|
|
+ selectMappingSubmit() {
|
|
|
|
|
|
- if (this.selectField.apiFlag == '2') {
|
|
|
+ if (this.selectField.apiFlag == '2') {
|
|
|
|
|
|
- this.showSelectDialog = false;
|
|
|
- } else if (this.selectField.apiFlag == '3') {
|
|
|
- this.showTableSelectDialog = false;
|
|
|
- }
|
|
|
+ this.showSelectDialog = false;
|
|
|
+ } else if (this.selectField.apiFlag == '3') {
|
|
|
+ this.showTableSelectDialog = false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
|
|
|
- }
|
|
|
-}
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|