humingbo il y a 2 ans
Parent
commit
63a4c05c03
2 fichiers modifiés avec 104 ajouts et 207 suppressions
  1. 13 0
      src/api/meeting/meeting.js
  2. 91 207
      src/views/meeting/weeklyRecords.vue

+ 13 - 0
src/api/meeting/meeting.js

@@ -125,3 +125,16 @@ export function getWeeksRecordsByWeeks(meetingId,weeks){
     method : 'get'
   })
 }
+
+/**
+ * 工作评分评论
+ * @param data
+ * @returns {*}
+ */
+export function workComments(data){
+  return request({
+    url: '/meeting/workComment',
+    method: 'post',
+    data: data
+  })
+}

+ 91 - 207
src/views/meeting/weeklyRecords.vue

@@ -1,6 +1,8 @@
 <template>
-<<<<<<< HEAD
   <div class="app-container" >
+<!--    <div style="display: flex;justify-content: space-between;">
+      <el-button size="mini" @click="exportPdf" icon="el-icon-download" style="margin-right: 20px">导出</el-button>
+    </div>-->
     <h3>{{m.meetingName}}</h3>
     <el-descriptions  title="" :column="2" :size="size" border>
       <el-descriptions-item>
@@ -36,22 +38,22 @@
           <i class="el-icon-user"></i>
          参会人员
         </template>
-        <span v-for="(item,index) in JSON.parse(m.innerAttendees)">
+        <span v-if="m.innerAttendees!=''" v-for="(item,index) in JSON.parse(m.innerAttendees)">
           {{item.name}}
         </span>
       </el-descriptions-item>
-<!--      <el-descriptions-item :span="2" >
+     <el-descriptions-item :span="2" >
         <template slot="label">
           <i class="el-icon-office-building"></i>
           参会情况
         </template>
         应到15人,实到12人
-      </el-descriptions-item>-->
+      </el-descriptions-item>
     </el-descriptions>
     <el-table
-      style="width: 100%" border stripe :data="tableData"
+      style="width: 100%" border stripe :data="tableData" :highlight-current-row="true"
       :span-method="objectSpanMethod" >
-      <el-table-column  type="index" label="序号" width="60">
+      <el-table-column prop="group"  label="序号" width="60" align="center">
       </el-table-column>
       <el-table-column
         prop="userName"
@@ -74,102 +76,38 @@
         </el-table-column>
       </el-table-column>
       <el-table-column prop="workplan" label="下周工作计划" >
-        <el-table-column label="工作内容" >
-        </el-table-column>
-        <el-table-column label="计划时间"  width="150">
+        <el-table-column label="工作内容与完成时间" prop="planContent">
+          <template slot-scope="scope">
+            <div v-html="scope.row.planContent">
+            </div>
+          </template>
         </el-table-column>
       </el-table-column>
-      <el-table-column prop="pingfen" label="评分"  align="center"  width="85">
+      <el-table-column prop="score" label="评分"  width="150" align="center">
+        <template slot-scope="scope">
+          <div v-if="scope.row.executor==scope.row.scores">
+            <el-input-number size="mini" :precision="2" :step="0.1" :max="10" min="5" v-model="scope.row.score" @change="workComment(scope.row)">0</el-input-number>
+          </div>
+          <div v-else >
+            <el-input-number size="mini" :precision="2" :step="0.1" :max="10" min="5" v-model="scope.row.score"  @change="workComment(scope.row)">
+              {{scope.row.score}}
+            </el-input-number>
+          </div>
+        </template>
       </el-table-column>
       <el-table-column prop="remark" label="备注" >
+        <template slot-scope="scope">
+           <el-input v-model="scope.row.remark"  type="textarea"
+                     :autosize="{ minRows: 4}" @change="workComment(scope.row)">
+           </el-input>
+        </template>
       </el-table-column>
     </el-table>
-  <div class="app-container">
-    <div style="display: flex;justify-content: space-between">
-      <div style="font-size: 24px">{{ title }}</div>
-      <el-button size="mini" @click="exportPdf" icon="el-icon-download" style="margin-right: 20px">导出</el-button>
-    </div>
-
-    <div id="pdfDom" ref="pdfDom" style="padding: 20px">
-      <el-descriptions title="" :column="2" :size="size" border>
-        <el-descriptions-item>
-          <template slot="label">
-            <i class="el-icon-user"></i>
-            会议时间
-          </template>
-          2022-12-12 12:00:00至2022-12-12 12:00:00
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            <i class="el-icon-mobile-phone"></i>
-            会议主持人
-          </template>
-          张三
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            <i class="el-icon-location-outline"></i>
-            会议地点
-          </template>
-          重庆柏玮熠办公室
-        </el-descriptions-item>
-        <el-descriptions-item>
-          <template slot="label">
-            <i class="el-icon-tickets"></i>
-            会议记录人
-          </template>
-          <el-tag size="small">李四</el-tag>
-        </el-descriptions-item>
-        <el-descriptions-item :span="2">
-          <template slot="label">
-            <i class="el-icon-office-building"></i>
-            参会人员
-          </template>
-          王五、张三、小七
-        </el-descriptions-item>
-        <el-descriptions-item :span="2">
-          <template slot="label">
-            <i class="el-icon-office-building"></i>
-            参会情况
-          </template>
-          应到15人,实到12人
-        </el-descriptions-item>
-      </el-descriptions>
-      <el-table
-        style="width: 100%" border stripe>
-        <el-table-column
-          prop="date"
-          label="姓名" align="center"
-          width="120">
-        </el-table-column>
-        <el-table-column prop="workzongjie" label="本周工作总结" align="center" min-width="450">
-          <el-table-column label="工作内容" align="center">
-          </el-table-column>
-          <el-table-column label="是否上周遗留" align="center" width="120">
-          </el-table-column>
-          <el-table-column label="完成情况说明" align="center">
-          </el-table-column>
-        </el-table-column>
-        <el-table-column prop="workplan" label="下周工作计划" align="center">
-          <el-table-column label="工作内容" align="center">
-          </el-table-column>
-          <el-table-column label="计划时间" align="center" width="150">
-          </el-table-column>
-        </el-table-column>
-        <el-table-column prop="pingfen" label="评分" align="center" width="85">
-        </el-table-column>
-        <el-table-column prop="remark" label="备注" align="center">
-        </el-table-column>
-      </el-table>
-    </div>
-
-
-  </div>
   </div>
-
+</template>
 <script>
 
-import { getWeeksRecordsByWeeks } from '@/api/meeting/meeting'
+import { getWeeksRecordsByWeeks, workComments } from '@/api/meeting/meeting'
 
 import {downloadPdf} from "@/api/meeting/meeting";
 
@@ -178,7 +116,6 @@ export default {
   name: 'weeklyRecords',
   data() {
     return {
-
       title : '技术部周会',
       size: '',
       tableData:[],
@@ -205,13 +142,9 @@ export default {
         col:0,
         row:0
       },
-      spanArr: [], // 存合并行数据的数组
-      pos: 0,// 合并行数据数组下标
-      rowIndex: 1, // 序号
-      // 合并行
-      mergeArr: [],
-      // 排序号
-      indexNum: {},
+      mergeObj: {}, // 用来记录需要合并行的下标
+      mergeArr: ['group','userName','planContent','score','remark'], // 表格中的列名
+
 
     }
   },
@@ -222,124 +155,75 @@ export default {
     getData() {
       getWeeksRecordsByWeeks(this.meetingId,this.weeks).then(res => {
         this.tableData=res.data.workContent
-       // this.getSpanArr(this.tableData)
+        this.getSpanArr(this.tableData);
         this.m=res.data.meeting
       })
     },
-    colMethod(columnArr, data){
-      let column = {}
-      let position = 0
-      //遍历合并的列的数据
-      columnArr.forEach((prop) => {
-        column[prop] = []
-        data.forEach((row,rowIndex) =>{
-          column[prop][rowIndex]=[1,1]
-          if(rowIndex===0){
-            position=0
-          }else if (row[prop] === data[rowIndex - 1][prop]) {
-            // 当前行数据等于上一行,根据记录的行号,计算需要合并几行。
-            column[prop][position][0] += 1
-            // 当前行 隐藏不显示
-            column[prop][rowIndex][0] = 0
-          } else {
-            // 不相等之后,重置记录行号
-            position = rowIndex
-          }
 
-        })
-      })
-      return column;
-    },
-    getList() {
-      const _this = this;
-      // 计算合并的行
-      this.mergeArr = this.colMethod(['id'], this.tableData)
-      // 浅拷贝处理数据
-      let dataBase = Array.from(this.tableData);
-      let saleIdArr = this.colMethod(['id'], dataBase)
-
-      // 先根据saleId合并第一次,将数据源根据合并下标处理为多段数据源
-      let newData = []
-      saleIdArr.saleId.forEach( (item, index) => {
-        if (item[0] > 0) {
-          let res = []
-          for (let i = 0; i < item[0]; i++) {
-            res.push(dataBase.slice(0,1)[0])
-            this.$delete(dataBase, 0)
-          }
-          newData.push(res)
-        }
-      })
-
-      // 根据合并后的数据,分段处理time的合并行下标
-      let outArr = []
-      for (let i = 0; i < newData.length; i++) {
-        let obt = _this.colMethod(['time'], newData[i]);
-        if (obt.outboundTime.length > 0) {
-          outArr.push(obt.outboundTime)
-        }
-      }
-
-      // 处理time合并行
-      let finishRes = []
-      outArr.forEach( item => {
-        if (item.length > 1) {
-          for (let i = 0; i < item.length; i++) {
-            finishRes.push(item[i])
-          }
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if(this.mergeArr.indexOf(column.property) !== -1) {
+        // 判断其值是不是为0
+        if(this.mergeObj[column.property][rowIndex]) {
+          return [this.mergeObj[column.property][rowIndex], 1]
         } else {
-          finishRes.push(item[0])
+          // 如果为0则为需要合并的行
+          return [0, 0];
         }
-      })
-      // 赋值给总合并行集合
-      this.mergeArr.outboundTime = finishRes
-
-      //排列序号
-      this.indexObj()
-
+      }
     },
 
+    getSpanArr(data) {
+      this.mergeArr.forEach((key, index1) => {
+        let count = 0; // 用来记录需要合并行的起始位置
+        this.mergeObj[key] = []; // 记录每一列的合并信息
 
-    getSpanArr(data){
-      // 重新查询后,要清空行数据数组、序号重置为1
-      this.spanArr = []
-      this.rowIndex = 1
-      for (let i = 0; i < data.length; i++){
-        let executor=data[i].executor;
-        if (i === 0) {
-          this.spanArr.push(1)
-          this.pos = 0
-          data[i].serialNo = this.rowIndex
-          this.rowIndex++
-        } else{
-          if(data[i].executor===data[i-1].executor){
-            this.spanArr.push[this.pos]+=1
-            this.spanArr.push(0)
-          }else{
-            this.spanArr.push(1)
-            this.pos=i
-            data[i].serialNo= this.rowIndex
-            this.rowIndex++
+        data.forEach((item, index) => {
+          // index == 0表示数据为第一行,直接 push 一个 1
+          if(index === 0) {
+            this.mergeObj[key].push(1);
+            //item.group=index;
+          } else {
+            // 判断当前行是否与上一行其值相等 如果相等 在 count 记录的位置其值 +1 表示当前行需要合并 并push 一个 0 作为占位
+            if(item[key] === data[index - 1][key]) {
+              this.mergeObj[key][count] += 1;
+              this.mergeObj[key].push(0);
+              //item.group = this.tableData[index - 1].group;
+            } else {
+              // 如果当前行和上一行其值不相等
+              count = index; // 记录当前位置
+              this.mergeObj[key].push(1); // 重新push 一个 1
+             // item.group = this.tableData[index - 1].group + 1; //如果不一样 将组号设置为上一个数据的组号加1
+            }
           }
-        }
+        })
 
-      }
-    },
-    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-      let arr = this.mergeArr[column.property] || []
-      if (column.type == 'index' && this.mergeArr['id'])
-        return this.mergeArr['id'][rowIndex]
-      else if (arr.length) return arr[rowIndex]
-      else[1, 1]
-    },
-    indexObj() {
-      let num = 0;
-      this.mergeArr['id'].forEach((item, index) => {
-        if (item[0] != 0) {
-          this.indexNum[index] = num += 1
-        }
       })
+    },
+    workComment(row){
+      let scoreId=row.scoreId
+      let score=row.score
+      let remark=row.remark
+      let meetingId=row.meetingId
+      let weeks=row.weeks-1;
+      let userId=row.executor
+      if(scoreId===meetingId){
+        scoreId=null
+      }
+      let data={
+        id:scoreId,
+        score:score,
+        remark:remark,
+        weeks:weeks,
+        userId:userId
+      }
 
+      workComments(data).then(res => {
+        this.$message({
+          message: '操作成功!',
+          type: 'info'
+        });
+        this.getData()
+      });
 
     },
     downloadPdf(){
@@ -349,4 +233,4 @@ export default {
 }
 </script>
 
-</template>
+