|
@@ -10,14 +10,35 @@
|
|
|
style="top:20px;"
|
|
|
width="850px"
|
|
|
>
|
|
|
- <div class="copy-btn-box-9136076486841527">
|
|
|
- 数据库表名:
|
|
|
- <a-input placeholder="请输入表名" style="width:20%;" v-model="businessTable" />
|
|
|
- </div>
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <a-col :md="24" :sm="24">
|
|
|
+ <!-- <div class="copy-btn-box-9136076486841527"> -->
|
|
|
+ 数据库表名:
|
|
|
+ <a-input placeholder="请输入表名" style="width:20%;" v-model="businessTable" />
|
|
|
+ <!-- </div> -->
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <a-col :md="24" :sm="24">
|
|
|
+ <a-table
|
|
|
+ v-if="dataSource.length>0"
|
|
|
+ bordered
|
|
|
+ :data-source="dataSource"
|
|
|
+ :columns="columns"
|
|
|
+ :rowKey="record=>record.id"
|
|
|
+ :pagination="false"
|
|
|
+ style="margin-top:5px"
|
|
|
+ >
|
|
|
+ <template slot="operation" slot-scope="text, record">
|
|
|
+ <a href="javascript:;" @click="textClick(record)">确定</a>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { getFormByBusinessTable } from '../../api/api';
|
|
|
+import { getFormByBusinessTable } from "../../api/api";
|
|
|
/*
|
|
|
* author kcz
|
|
|
* date 2019-11-20
|
|
@@ -27,12 +48,33 @@ export default {
|
|
|
name: "queryModal",
|
|
|
data() {
|
|
|
return {
|
|
|
+ dataSource:[],
|
|
|
+ columns:[
|
|
|
+ {
|
|
|
+ title: '表单名称',
|
|
|
+ dataIndex: 'text',
|
|
|
+ scopedSlots: { customRender: 'text' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数据库表名',
|
|
|
+ dataIndex: 'businessTable',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '表单描述',
|
|
|
+ dataIndex: 'stepMemo',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'operation',
|
|
|
+ scopedSlots: { customRender: 'operation' },
|
|
|
+ }
|
|
|
+ ],
|
|
|
visible: false,
|
|
|
jsonData: {},
|
|
|
handleSetSelectItem: null,
|
|
|
- text:"",//表单标题
|
|
|
- businessTable:""//数据库表名称
|
|
|
- ,formData:{}
|
|
|
+ text: "", //表单标题
|
|
|
+ businessTable: "", //数据库表名称
|
|
|
+ formData: {}
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -50,33 +92,50 @@ export default {
|
|
|
};
|
|
|
return false;
|
|
|
},
|
|
|
+ textClick(data){
|
|
|
+ console.log(data)
|
|
|
+ //获取json展示的数据
|
|
|
+ this.jsonData.list = data.jsonContent.list;
|
|
|
+ this.jsonData.config = data.jsonContent.config;
|
|
|
+ this.jsonData.config.layout = data.jsonContent.config.layout;
|
|
|
+ //当前填写数据存储,用于其他页面获取
|
|
|
+ this.formData.businessTable=data.businessTable;//数据库表明
|
|
|
+ this.formData.text=data.text;//表单标题
|
|
|
+ this.formData.stepMemo=data.stepMemo;//表单标题
|
|
|
+ this.handleCancel();
|
|
|
+ },
|
|
|
handleImportJson() {
|
|
|
// 查询JSON
|
|
|
try {
|
|
|
//判断是否填写数据库表明
|
|
|
- if(!this.businessTable){
|
|
|
+ if (!this.businessTable) {
|
|
|
this.$message.error("请输入数据库表明");
|
|
|
return;
|
|
|
}
|
|
|
//调用查询接口
|
|
|
- getFormByBusinessTable(this.businessTable).then(res=>{
|
|
|
- if(res.data.success){
|
|
|
- //获取Json字符串装json格式
|
|
|
- const editorJsonData = res.data.result.jsonContent;
|
|
|
- //获取json展示的数据
|
|
|
- this.jsonData.list = editorJsonData.list;
|
|
|
- this.jsonData.config = editorJsonData.config;
|
|
|
- this.jsonData.config.layout = editorJsonData.config.layout;
|
|
|
- //当前填写数据存储,用于其他页面获取
|
|
|
- this.formData.businessTable=this.businessTable;//数据库表明
|
|
|
- this.formData.text=res.data.result.text;//表单标题
|
|
|
- this.businessTable="";//清空
|
|
|
- this.handleCancel();
|
|
|
+ getFormByBusinessTable(this.businessTable).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ if(res.data.result.tbTableInfoList!=null&&res.data.result.tbTableInfoList.length>1){
|
|
|
+ this.dataSource=res.data.result.tbTableInfoList;
|
|
|
+ }else{
|
|
|
+ //获取Json字符串装json格式
|
|
|
+ const editorJsonData = res.data.result.jsonContent;
|
|
|
+ //获取json展示的数据
|
|
|
+ this.jsonData.list = editorJsonData.list;
|
|
|
+ this.jsonData.config = editorJsonData.config;
|
|
|
+ this.jsonData.config.layout = editorJsonData.config.layout;
|
|
|
+ //当前填写数据存储,用于其他页面获取
|
|
|
+ this.formData.businessTable = this.businessTable; //数据库表明
|
|
|
+ this.formData.text = res.data.result.text; //表单标题
|
|
|
+ this.businessTable = ""; //清空
|
|
|
+ this.dataSource=[];
|
|
|
+ this.handleCancel();
|
|
|
+ }
|
|
|
this.$message.success("查询成功");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.$message.error(res.data.message);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
// const editorJsonData = JSON.parse(this.jsonFormat);
|
|
|
// this.jsonData.list = editorJsonData.list;
|
|
|
// this.jsonData.config = editorJsonData.config;
|