|
@@ -3,28 +3,81 @@
|
|
|
<div class="json-box-9136076486841527">
|
|
|
<codemirror style="height:100%;" ref="myEditor" :value="editorJson"></codemirror>
|
|
|
</div>
|
|
|
- <div>
|
|
|
+ <div></div>
|
|
|
+ <a-form-model :model="formData" :label-col="labelCol" :wrapper-col="wrapperCol">
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-model-item label="表单名">
|
|
|
+ <a-input v-model="formData.text" placeholder="请输入表名" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-model-item label="数据库表名">
|
|
|
+ <a-select
|
|
|
+ v-model="formData.businessTable"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择数据库表名"
|
|
|
+ allowClear
|
|
|
+ show-search
|
|
|
+ >
|
|
|
+ <a-select-option
|
|
|
+ v-for="(item) in tableList"
|
|
|
+ :key="item.tableName"
|
|
|
+ :value="item.tableName"
|
|
|
+ >{{item.tableName}}{{item.tableComment}}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-model-item>
|
|
|
+ <span slot="label">
|
|
|
+ 表单描述
|
|
|
+ <a-tooltip>
|
|
|
+ <template slot="title">用来明确表单的使用含义</template>
|
|
|
+ <a-icon type="question-circle-o" />
|
|
|
+ </a-tooltip>
|
|
|
+ </span>
|
|
|
|
|
|
- </div>
|
|
|
- <div class="copy-btn-box-9136076486841527">
|
|
|
+ <a-input placeholder="请输入表单描述" v-model="formData.stepMemo" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-model-item label="表单类型">
|
|
|
+ <a-radio-group v-model="formData.type" :disabled="disabled">
|
|
|
+ <a-radio value="1">PC端</a-radio>
|
|
|
+ <a-radio value="2">钉钉端</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form-model>
|
|
|
+ <!-- <div style="padding-top: 8px">
|
|
|
表单名:
|
|
|
<a-input placeholder="请输入表名" style="width:20%;" v-model="formData.text" />
|
|
|
数据库表名:
|
|
|
- <!-- <a-input placeholder="请输入表名" style="width:20%;" v-model="formData.businessTable" /> -->
|
|
|
- <a-select v-model="formData.businessTable" style="width: 20%" placeholder="请选择数据库表名" allowClear show-search >
|
|
|
- <a-select-option v-for="(item) in tableList" :key="item.tableName" :value="item.tableName">{{item.tableName}}{{item.tableComment}}</a-select-option>
|
|
|
- </a-select>
|
|
|
- 表单描述
|
|
|
+ <a-select
|
|
|
+ v-model="formData.businessTable"
|
|
|
+ style="width: 20%"
|
|
|
+ placeholder="请选择数据库表名"
|
|
|
+ allowClear
|
|
|
+ show-search
|
|
|
+ >
|
|
|
+ <a-select-option
|
|
|
+ v-for="(item) in tableList"
|
|
|
+ :key="item.tableName"
|
|
|
+ :value="item.tableName"
|
|
|
+ >{{item.tableName}}{{item.tableComment}}</a-select-option>
|
|
|
+ </a-select>表单描述
|
|
|
<a-tooltip>
|
|
|
- <template slot="title">
|
|
|
- 用来明确表单的使用含义
|
|
|
- </template>
|
|
|
+ <template slot="title">用来明确表单的使用含义</template>
|
|
|
<a-icon type="question-circle-o" />
|
|
|
</a-tooltip>:
|
|
|
<a-input placeholder="请输入表单描述" style="width:20%;" v-model="formData.stepMemo" />
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
<div class="copy-btn-box-9136076486841527" style="text-align:right">
|
|
|
- <a-divider style="margin: 5px 0;"/>
|
|
|
+ <a-divider style="margin: 5px 0;" />
|
|
|
<a-button
|
|
|
@click="handleCopyJson"
|
|
|
type="primary"
|
|
@@ -64,14 +117,18 @@ export default {
|
|
|
visible: false,
|
|
|
businessTable: "",
|
|
|
text: "",
|
|
|
- tableList:[]//数据库下拉列表数据
|
|
|
+ tableList: [], //数据库下拉列表数据
|
|
|
+ labelCol: { span: 8 },
|
|
|
+ wrapperCol: { span: 16 },
|
|
|
+ disabled:false
|
|
|
};
|
|
|
},
|
|
|
- created(){
|
|
|
+ created() {
|
|
|
+ this.initial();
|
|
|
//获取数据库表名下拉数据
|
|
|
- getTableList().then(res=>{
|
|
|
- if(res.data.success){
|
|
|
- this.tableList=res.data.result;
|
|
|
+ getTableList().then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.tableList = res.data.result;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -79,6 +136,15 @@ export default {
|
|
|
codemirror
|
|
|
},
|
|
|
methods: {
|
|
|
+ initial(){
|
|
|
+ //判断是否修改进入,修改进入则禁用修改表单类型
|
|
|
+ if(this.formData.text){
|
|
|
+ this.disabled=true;
|
|
|
+ }else{
|
|
|
+ this.formData.type='1'//默认表单类型为PC端
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ,
|
|
|
exportData(data, fileName = `demo.${this.fileFormat}`) {
|
|
|
let content = "data:text/csv;charset=utf-8,";
|
|
|
content += data;
|
|
@@ -108,10 +174,14 @@ export default {
|
|
|
this.$message.error("请输入表单名");
|
|
|
return;
|
|
|
}
|
|
|
- if(!this.formData.stepMemo){
|
|
|
+ if (!this.formData.stepMemo) {
|
|
|
this.$message.error("请输入表单描述");
|
|
|
return;
|
|
|
}
|
|
|
+ if(!this.formData.type){
|
|
|
+ this.$message.error("请选择表单类型");
|
|
|
+ return;
|
|
|
+ }
|
|
|
console.log(this.editorJson);
|
|
|
//定义保存数据格式
|
|
|
const formData = {
|
|
@@ -119,7 +189,8 @@ export default {
|
|
|
routeName: "自定义$" + this.formData.businessTable,
|
|
|
businessTable: this.formData.businessTable,
|
|
|
jsonContent: JSON.parse(this.editorJson),
|
|
|
- stepMemo:this.formData.stepMemo
|
|
|
+ stepMemo: this.formData.stepMemo,
|
|
|
+ type: this.formData.type
|
|
|
};
|
|
|
console.log(formData);
|
|
|
//保存接口
|
|
@@ -127,7 +198,7 @@ export default {
|
|
|
if (res.data.success) {
|
|
|
this.$message.success("保存成功");
|
|
|
} else {
|
|
|
- this.$message.errore("保存失败");
|
|
|
+ this.$message.error("保存失败");
|
|
|
}
|
|
|
});
|
|
|
},
|