瀏覽代碼

动态表格新增弹窗

xuezizhuo 1 年之前
父節點
當前提交
09aa1ace2a

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	        left join sys_user_role ur on ur.role_id = r.role_id
 	        left join sys_user u on u.user_id = ur.user_id
 	        left join sys_dept d on u.dept_id = d.dept_id
-			LEFT JOIN sys_tenant t ON u.tenant_id = t.tenant_id
+			LEFT JOIN sys_tenant t ON r.tenant_id = t.tenant_id
     </sql>
     
     <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">

+ 9 - 0
ruoyi-ui/src/api/tablelist/commonTable.js

@@ -136,3 +136,12 @@ export function delTableTem(tId) {
     baseURL: process.env.VUE_APP_BASE_API3
   })
 }
+
+// 获取动态表单详细信息
+export function getInfoBySqlKey(sqlKey) {
+  return request({
+    url: '/dragform/form/getInfoBySqlKey/' + sqlKey,
+    method: 'get',
+    baseURL: process.env.VUE_APP_BASE_API3
+  })
+}

+ 41 - 80
ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -1,97 +1,57 @@
 <template>
   <div class="app-container">
-    <Queryfrom :form-vals="templateInfo.where" @getList="getList" ref="mychild"/>
+    <Queryfrom :form-vals="templateInfo.where" @getList="getList" ref="mychild" />
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-        >新增
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd(sqlkey)">新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-        >修改
+        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-        >删除
+        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-        >导出
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出
         </el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-        >导出
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出
         </el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center"/>
-      <el-table-column label="自增主键" align="center" prop="id"/>
-      <span v-for="(key,val) in columns">
-        <el-table-column :label="key" align="center" :prop="val"/>
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="自增主键" align="center" prop="id" />
+      <span v-for="(key, val) in columns">
+        <el-table-column :label="key" align="center" :prop="val" />
       </span>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:outsalesdocuments:edit']"
-          >修改
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:outsalesdocuments:edit']">修改
           </el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:outsalesdocuments:remove']"
-          >删除
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+            v-hasPermi="['system:outsalesdocuments:remove']">删除
           </el-button>
         </template>
       </el-table-column>
     </el-table>
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="pageList"
-    />
+    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="pageList" />
+
     <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" append-to-body>
+      <iframe :src="iframeUrl" width="100%" height="600px" style="border: none;" scrolling="no">
+
+      </iframe>
+    </el-dialog>
+
+    <!-- <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-item label="客户编号关联客户表" prop="customerno">
           <el-input v-model="form.customerno" placeholder="请输入客户编号关联客户表"/>
@@ -102,17 +62,18 @@
         <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
-    </el-dialog>
+    </el-dialog> -->
+
   </div>
 </template>
 <script>
-import {dragTableInfo, listTable, unionListTableData} from "@/api/tablelist/commonTable";
-import {getToken} from "@/utils/auth";
+import { dragTableInfo, listTable, unionListTableData, getInfoBySqlKey } from "@/api/tablelist/commonTable";
+import { getToken } from "@/utils/auth";
 import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
 
 export default {
   name: "listInfo",
-  components: {Queryfrom},
+  components: { Queryfrom },
   data() {
     return {
       // 遮罩层
@@ -149,7 +110,7 @@ export default {
         // 是否更新已经存在的数据
         updateSupport: 0,
         // 设置上传的请求头部
-        headers: {Authorization: "Bearer " + getToken()},
+        headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "接口地址",
       },
@@ -178,6 +139,8 @@ export default {
       queryFromWhere: {},
       // 当前table唯一标识
       sqlkey: null,
+      //存放html代码块
+      iframeUrl: '',
     };
   },
 
@@ -192,7 +155,7 @@ export default {
       // 序列化当前查询参数列表
       this.queryParams.queryMap = queryParams.queryMap
       // 获取当前表单结构信息
-      dragTableInfo({queryMap: {sqlkey: this.sqlkey}}).then(res => {
+      dragTableInfo({ queryMap: { sqlkey: this.sqlkey } }).then(res => {
         // 得到当前模版信息 --- sql columns queryWhere
         this.templateInfo = res.data.resultMap
         // 得到查询条件
@@ -246,15 +209,15 @@ export default {
       }
     },
     /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      getUser().then((response) => {
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
+    handleAdd(sqlkey) {
+      // this.reset();
+      getInfoBySqlKey(sqlkey).then(({ data }) => {
+        const htmlCode = data.dfHtmlTemplate;;
+        this.iframeUrl = 'data:text/html;charset=utf-8,' + encodeURI(htmlCode);
         this.open = true;
         this.title = "添加信息";
-        this.form.password = this.initPassword;
       });
+
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -350,7 +313,7 @@ export default {
         response.msg +
         "</div>",
         "导入结果",
-        {dangerouslyUseHTMLString: true}
+        { dangerouslyUseHTMLString: true }
       );
       this.getList();
     },
@@ -362,6 +325,4 @@ export default {
 };
 </script>
 
-<style scoped lang="scss">
-
-</style>
+<style scoped lang="scss"></style>