Pārlūkot izejas kodu

修改用户单位验证以及查询方式

jiangbiao 3 gadi atpakaļ
vecāks
revīzija
1c78067a12

+ 11 - 0
master/src/main/java/com/ruoyi/project/invoice/domain/TInvoiceUserUnit.java

@@ -62,6 +62,17 @@ public class TInvoiceUserUnit extends BaseEntity
     @TableField(exist = false)
     private String deptName;
 
+    @TableField(exist = false)
+    private String nickName;
+
+    public String getNickName() {
+        return nickName;
+    }
+
+    public void setNickName(String nickName) {
+        this.nickName = nickName;
+    }
+
     public String getDeptName() {
         return deptName;
     }

+ 3 - 1
master/src/main/resources/mybatis/invoice/TInvoiceUserUnitMapper.xml

@@ -16,11 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptId"    column="dept_id"    />
         <result property="remarks"    column="remarks"    />
         <result property="deptName" column="dept_name" />
+        <result property="nickName" column="nick_name" />
     </resultMap>
 
     <sql id="selectTInvoiceUserUnitVo">
-        select d.id, d.user_unit, d.user_ids, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name from t_invoice_user_unit d
+        select d.id, d.user_unit, d.user_ids, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name,u.nick_name from t_invoice_user_unit d
       left join sys_dept s on s.dept_id = d.dept_id
+      left join sys_user u on d.user_ids = u.user_id
     </sql>
 
     <select id="selectTInvoiceUserUnitList" parameterType="TInvoiceUserUnit" resultMap="TInvoiceUserUnitResult">

+ 4 - 1
ui/src/views/invoice/contractor/index.vue

@@ -108,7 +108,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="contractorList" @selection-change="handleSelectionChange"
+    <el-table v-loading="loading" ref="conTable" :data="contractorList" @selection-change="handleSelectionChange"
               :height="clientHeight" border>
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="承包商公司名称" align="center" prop="contractorName" :show-overflow-tooltip="true"/>
@@ -468,6 +468,9 @@ export default {
       this.loading = true;
       listContractor(this.queryParams).then(response => {
         this.contractorList = response.rows;
+        this.$nextTick(() => {
+          this.$refs.conTable.doLayout(); // 解决表格错位
+        });
         this.total = response.total;
         this.loading = false;
       });

+ 4 - 1
ui/src/views/invoice/device/index.vue

@@ -85,7 +85,7 @@
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+    <el-table v-loading="loading" ref="deviceTable" :data="deviceList" @selection-change="handleSelectionChange" :height="clientHeight" border>
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="装置名称" align="center" prop="devName" :show-overflow-tooltip="true"/>
       <el-table-column label="工作区域" align="center" prop="workArea" :show-overflow-tooltip="true"/>
@@ -286,6 +286,9 @@ export default {
       this.loading = true;
       listDevice(this.queryParams).then(response => {
         this.deviceList = response.rows;
+        this.$nextTick(() => {
+          this.$refs.deviceTable.doLayout(); // 解决表格错位
+        });
         this.total = response.total;
         this.loading = false;
         this.deviceList.forEach(function (value,key,arr) {

+ 23 - 22
ui/src/views/invoice/unit/index.vue

@@ -81,7 +81,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :span-method="mergeMethod" :data="unitList" @selection-change="handleSelectionChange" :height="clientHeight"
+    <el-table v-loading="loading" ref="unitTable" :span-method="mergeMethod" :data="unitList" @selection-change="handleSelectionChange" :height="clientHeight"
               border >
       <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="单位" align="center" prop="userUnit" :show-overflow-tooltip="true"
@@ -254,7 +254,17 @@ export default {
       // 表单参数
       form: {},
       // 表单校验
-      rules: {}
+      rules: {
+        userIds: [
+          { required: true, message: "用户不能为空", trigger: "blur" }
+        ],
+        userUnit: [
+          { required: true, message: "用户单位不能为空", trigger: "blur" }
+        ],
+        deptId: [
+          { required: true, message: "归属部门不能为空", trigger: "blur" }
+        ],
+      }
     };
   },
   watch: {
@@ -288,20 +298,11 @@ export default {
       this.loading = true;
       listUnit(this.queryParams).then(response => {
         this.unitList = response.rows;
+        this.$nextTick(() => {
+          this.$refs.unitTable.doLayout(); // 解决表格错位
+        });
         this.total = response.total;
         this.loading = false;
-        this.unitList.forEach(function (value, key, arr) {
-          let nickName = null;
-          let userIds = value.userIds;
-          if (userIds != null) {
-            _this.userOptions.forEach(function (v, k, arr) {
-              if (userIds == v.userId) {
-                nickName = v.nickName;
-              }
-            })
-          }
-          _this.unitList[key].nickName = nickName;
-        });
       });
     },
     /** 查询部门下拉树结构 */
@@ -440,14 +441,14 @@ export default {
     },
     //合并单元格
     mergeMethod({row, column, rowIndex, columnIndex}) {
-      if (columnIndex === 0) {
-        const _row = this.setTable(this.unitList).merge[rowIndex];
-        const _col = _row > 0 ? 1 : 0;
-        return {
-          rowspan: _row,
-          colspan: _col
-        };
-      }
+      // if (columnIndex === 0) {
+      //   const _row = this.setTable(this.unitList).merge[rowIndex];
+      //   const _col = _row > 0 ? 1 : 0;
+      //   return {
+      //     rowspan: _row,
+      //     colspan: _col
+      //   };
+      // }
       if (columnIndex === 1) {
         const _row = this.setTable(this.unitList).merge[rowIndex];
         const _col = _row > 0 ? 1 : 0;