Browse Source

工作汇报新增互动评论

qymljy 1 year ago
parent
commit
7da4963f61

+ 7 - 0
src/HDrpManagement/workReport/index.vue

@@ -92,16 +92,21 @@ export default {
         this.$refs.aside.params.id = 20230524103102
         this.$refs.aside.listData((data) => {
           this.$refs.reportContent.getDetail(data)
+          this.$refs.reportContent.$refs.reportCommentRef.getComments(data)
         })
       } else {
         this.$refs.aside.params.id = 20230524102802
         this.$refs.aside.listData((data) => {
           this.$refs.reportContent.getDetail(data)
+          this.$refs.reportContent.$refs.reportCommentRef.getComments(data)
         })
       }
     },
     reportItemClick (id) {
       this.$refs.reportContent.getDetail(id)
+      if (id){
+        this.$refs.reportContent.$refs.reportCommentRef.getComments(id)
+      }
     },
     valueChange () {
 
@@ -175,6 +180,8 @@ export default {
       this.$refs.aside.params.id = 20230524103102
       this.$refs.aside.listData((data) => {
         this.$refs.reportContent.getDetail(data)
+        console.log('11111')
+        this.$refs.reportContent.$refs.reportCommentRef.getComments(data)
       })
     })
 

+ 221 - 0
src/HDrpManagement/workReport/modules/reportComment/index.vue

@@ -0,0 +1,221 @@
+<template>
+  <div class="comment">
+    <div class="comment-header">
+      <span>评论</span>
+    </div>
+    <div class="comment-publish">
+      <el-input
+          type="textarea"
+          style="font-size: 12px"
+          :rows="8"
+          placeholder="发表评论"
+          v-model="textarea">
+      </el-input>
+      <div style="float: right;margin-top: 10px;">
+        <el-button type="primary" size="small" @click="onComment">发表</el-button>
+      </div>
+    </div>
+    <div class="comment-header">
+      <span>评论记录</span>
+    </div>
+    <div style="overflow: auto;height: calc(100vh - 570px);">
+      <div v-if="commentList.length > 0">
+        <div style="padding: 10px" v-for="item in commentList" :key="item.index">
+          <div class="flex-align-center">
+            <div class="avatar" >
+              <img class="avatar__image" v-if="item.headpic" :src="item.headpic" alt="">
+              <p v-else style="font-size: 14px">{{item.createby.substr(0, 1)}}</p>
+            </div>
+            <div style="margin-left: 10px;margin-top: -20px">
+              <small v-if="item.replyusername">
+                {{item.createby}}
+                <i class="el-icon-caret-right"></i>
+                {{item.replyusername}}
+              </small>
+              <small v-else>{{item.createby}}</small>
+            </div>
+          </div>
+          <div style="margin-left: 40px;font-size: 12px;margin-top: -10px">
+            {{item.content}}
+          </div>
+          <div style="margin-left: 40px;margin-top: 10px">
+            <div style="float: right">
+              <el-button style="color: #000000;font-size: 12px;padding: 0 !important;" type="text" icon="el-icon-chat-dot-square" @click="onReply(item)" v-if="!item.isReply">回复</el-button>
+              <el-button style="color: #000000;font-size: 12px;padding: 0 !important;" type="text" icon="el-icon-chat-dot-square" @click="onReply(item)" v-else>取消回复</el-button>
+            </div>
+            <div style="font-size: 12px;color: #CCCCCC">
+              {{item.createdate}}
+              <el-popconfirm
+                  title="确定删除该评论吗?"
+                  @confirm="onDel(item)"
+              >
+                <el-button slot="reference" v-if="item.createuserid === userid" style="color: #ccc;font-size: 12px;padding: 0 !important;" type="text">删除</el-button>
+              </el-popconfirm>
+            </div>
+          </div>
+          <div v-if="item.isReply">
+            <el-input
+                style="font-size: 12px"
+                type="textarea"
+                :rows="3"
+                :placeholder="'回复'+item.createby"
+                v-model="item.retextarea">
+            </el-input>
+            <div style="float: right;margin-top: 10px;">
+              <el-button type="primary" size="small" @click="onReComment(item)">发表</el-button>
+            </div>
+          </div>
+        </div>
+      </div>
+      <el-empty description="暂无数据" size="mini" v-else></el-empty>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "index",
+  props:['id'],
+  data(){
+    return {
+      textarea:"",
+      userid:JSON.parse(sessionStorage.getItem('active_account')).userid,
+      param:{
+        "id": 20240429161501,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 99999,
+          "ownertable":"sys_workreport",
+          "ownerid":"15",
+          "where": {
+            "condition": ""
+          }
+        }
+      },
+      commentList:[]
+    }
+  },
+  methods:{
+    async getComments(id){
+      if (!id) return
+      this.param.content.ownerid = id
+      const res = await this.$api.requested(this.param)
+      this.commentList = res.data
+      this.commentList = this.commentList.map(item=>{
+        return {
+          "content":item.content,
+          "createby":item.createby,
+          "createdate":item.createdate,
+          "createuserid":item.createuserid,
+          "headpic":item.headpic,
+          "replyid":item.replyid,
+          "replyuserid":item.replyuserid,
+          "replyusername":item.replyusername,
+          "rowindex":item.rowindex,
+          "sys_datacommentid":item.sys_datacommentid,
+          "isReply":false,
+          "retextarea":"",
+        }
+      })
+      console.log(this.commentList,'33333')
+    },
+    async onComment(){
+      const res = await this.$api.requested({
+        "id": 20240429161601,
+        "content": {
+          "ownertable":"sys_workreport",//数据表
+          "ownerid":this.param.content.ownerid,//数据id
+          "content":this.textarea,//内容
+          "replyid":"0"//被回复评论id
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.textarea = ''
+        this.getComments(this.param.content.ownerid)
+      })
+    },
+    async onReComment(data){
+      const res = await this.$api.requested({
+        "id": 20240429161601,
+        "content": {
+          "ownertable":"sys_workreport",//数据表
+          "ownerid":this.param.content.ownerid,//数据id
+          "content":data.retextarea,//内容
+          "replyid":data.sys_datacommentid//被回复评论id
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        console.log('回复结果111')
+        this.retextarea = false
+        this.getComments(this.param.content.ownerid)
+      })
+    },
+    onReply(item){
+      this.commentList.forEach(data=>{
+        if (data.sys_datacommentid == item.sys_datacommentid){
+          data.isReply = data.isReply?false:true
+        }
+      })
+    },
+    async onDel(item){
+      const res = await this.$api.requested({
+        "id": 20240429161701,
+        "content": {
+          "sys_datacommentid":item.sys_datacommentid
+        }
+      })
+      this.tool.showMessage(res,()=>{
+        this.getComments(this.param.content.ownerid)
+      })
+    }
+  },
+  mounted() {
+    this.getComments(this.id)
+  }
+}
+</script>
+
+<style scoped>
+.comment {
+  border-left: 1px solid #cccccc;
+  height: calc(100vh - 250px);
+  overflow-y: scroll;
+}
+.comment .comment-header{
+  border-bottom: 1px solid #cccccc;
+  height: 20px;
+  font-size: 14px;
+  padding: 10px 10px;
+  font-weight: bold;
+}
+.comment .comment-publish{
+  border-bottom: 1px solid #cccccc;
+  height: 200px;
+  padding: 10px;
+}
+.avatar__image{
+  height: 100%;
+  width: 100%;
+}
+.avatar:hover .avatar__model{
+  display: block;
+}
+.avatar{
+  position: relative;
+  height:30px;
+  width: 30px;
+  margin-bottom: 5px;
+  border-radius: 100%;
+  text-align: center;
+  line-height: 30px;
+  color:#fff;
+  font-weight: 500;
+  font-size: 14px;
+  background: #3874F6;
+  cursor: pointer;
+  overflow: hidden;
+}
+/deep/ .el-textarea__inner{
+  background-color: #f5f5f5;
+}
+</style>

+ 66 - 37
src/HDrpManagement/workReport/modules/reportContent/index.vue

@@ -1,32 +1,41 @@
 <template>
-  <div class="detail">
-    <div class="detail-header">
-      <span>{{ detail.createby }}-{{ detail.reportname }}</span>
-      <span>{{ detail.createdate }}</span>
-      <customBtn
-        class="inline-16"
-        btnName="删 除"
-        type="default"
-        size="mini"
-        style="position:absolute;left:0;top:0"
-        message="确定删除当前汇报吗?"
-        idName="20230602105902"
-        keyName="sys_workreportid"
-        :id="id"
-        @onSuccess="$emit('deleteSuccess',id);id=''"
-        v-if="tool.checkAuth($route.name,'delete') && id && !currentTab"
-      />
-    </div>
-    <div class="detail-content" v-if="detail.items">
-      <div class="content-box"></div>
-      <div class="kong"></div>
-      <file-item 
-        :marginRight="10"
-        :rowCount="5"
-        :isDownLoad="true" 
-        :fileData="detail.attinfos"
-        @deleteSuccess="deleteFile">
-      </file-item>
+  <div>
+    <div v-if="detail.items" class="detailAll">
+      <div :style="windowWidth<1850?'width: 60%;float: left':'width: 70%;float: left'" class="detail">
+        <div style="padding: 20px 20px">
+          <div class="detail-header">
+            <span>{{ detail.createby }}-{{ detail.reportname }}</span>
+            <span>{{ detail.createdate }}</span>
+            <customBtn
+                class="inline-16"
+                btnName="删 除"
+                type="default"
+                size="mini"
+                style="position:absolute;left:0;top:0"
+                message="确定删除当前汇报吗?"
+                idName="20230602105902"
+                keyName="sys_workreportid"
+                :id="id"
+                @onSuccess="$emit('deleteSuccess',id);id=''"
+                v-if="tool.checkAuth($route.name,'delete') && id && !currentTab"
+            />
+          </div>
+          <div class="detail-content" v-if="detail.items">
+            <div class="content-box"></div>
+            <div class="kong"></div>
+            <file-item
+                :marginRight="10"
+                :rowCount="5"
+                :isDownLoad="true"
+                :fileData="detail.attinfos"
+                @deleteSuccess="deleteFile">
+            </file-item>
+          </div>
+        </div>
+      </div>
+      <div :style="windowWidth<1850?'width: 40%;float: left':'width: 30%;float: left'">
+        <reportComment ref="reportCommentRef" :id="id"></reportComment>
+      </div>
     </div>
     <el-empty description="暂无数据" size="mini" v-else></el-empty>
   </div>
@@ -34,18 +43,25 @@
 
 <script>
 import FileItem from '@/SManagement/orderclue/components/file/index2'
+import reportComment from '../reportComment/index'
 export default {
-  components:{FileItem},
+  components:{FileItem,reportComment},
   data () {
     return {
       detail:{},
-      id:''
+      id:'',
+      windowWidth: document.documentElement.clientWidth
     }
   },
   props:['currentTab'],
+  watch: {
+    windowWidth (val) {
+      console.log("实时屏幕宽度:",val );
+    }
+  },
   methods: {
     async getDetail (id) {
-      if (!id) return 
+      if (!id) return
       this.id = id
       let res = await this.$api.requested({
         "id": "20230524092002",
@@ -78,7 +94,7 @@ export default {
             frag.appendChild(box)
           }
         })
-       
+
         this.$nextTick(() => {
         let child = document.getElementsByClassName('content-item')
           if (child.length) {
@@ -104,19 +120,32 @@ export default {
           }
         })
       })
-      
+
     },
+  },
+  mounted() {
+    var that = this;
+    // <!--把window.onresize事件挂在到mounted函数上-->
+    window.onresize = () => {
+      return (() => {
+        window.fullWidth = document.documentElement.clientWidth;
+        that.windowWidth = window.fullWidth; // 宽
+      })()
+    };
   }
 }
 </script>
 
 <style  scoped>
-.detail {
-  padding: 20px 40px;
+.detailAll {
   border-top: 1px solid #cccccc;
   height: calc(100vh - 250px);
   overflow-y: scroll;
 }
+.detail {
+  height: calc(100vh - 250px);
+  overflow-y: scroll;
+}
 ::-webkit-scrollbar {
   display: none;
 }
@@ -140,7 +169,7 @@ export default {
   margin-bottom:10px;
 }
 /deep/.el-button {
-  border: 1px solid #3874F6 !important;
-  color:#3874F6 !important;
+  /*border: 1px solid #3874F6 !important;*/
+ /* color:#3874F6 !important;*/
 }
 </style>

+ 1 - 1
src/HManagement/siteManage/securityConfig/index.vue

@@ -182,7 +182,7 @@
     <div class="panel" style="margin-bottom:16px">
       <div class="flex-align-center flex-between">
         <div class="flex-align-stretch">
-          <img width="72" height="72" src="../../../assets/icons/projectTradefield.svg" alt="">
+          <img width="72" height="72" src="../../../assets/icons/statementData.svg" alt="">
           <div class="text-panel">
             <p class="explain-title">数据统计及报表排除非营业部门数据</p>
             <p class="explain-tips">当前设置:

+ 1 - 0
src/assets/icons/statementData.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1714460950810" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10748" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><path d="M191.985778 19.911111h554.666666c62.577778 0 113.777778 51.2 113.777778 113.777778v612.977778c0 62.577778-51.2 113.777778-113.777778 113.777777h-554.666666c-62.577778 0-113.777778-51.2-113.777778-113.777777V133.688889c0-62.577778 51.2-113.777778 113.777778-113.777778z" fill="#F4F5F7" p-id="10749"></path><path d="M98.119111 24.177778c-39.822222 0-72.533333 32.711111-72.533333 72.533333v674.133333c0 39.822222 32.711111 72.533333 72.533333 72.533334h682.666667c39.822222 0 72.533333-32.711111 72.533333-72.533334V96.711111c0-39.822222-32.711111-72.533333-72.533333-72.533333h-682.666667m0-24.177778h682.666667c54.044444 0 96.711111 42.666667 98.133333 96.711111v674.133333c0 54.044444-44.088889 96.711111-98.133333 96.711112h-682.666667c-54.044444 0-96.711111-42.666667-98.133333-96.711112V96.711111c0-54.044444 44.088889-96.711111 98.133333-96.711111z" fill="#3874F6" p-id="10750"></path><path d="M910.222222 1024H260.266667c-62.577778 0-113.777778-51.2-113.777778-113.777778V270.222222c0-62.577778 51.2-113.777778 113.777778-113.777778H910.222222c62.577778 0 113.777778 51.2 113.777778 113.777778v640c0 62.577778-51.2 113.777778-113.777778 113.777778z m-123.733333-668.444444c-35.555556 0-64 28.444444-64 64v355.555555c0 35.555556 28.444444 64 64 64s64-28.444444 64-64v-355.555555c0-35.555556-28.444444-64-64-64z m-199.111111 128c-35.555556 0-64 28.444444-64 64v227.555555c0 35.555556 28.444444 64 64 64s64-28.444444 64-64v-227.555555c0-35.555556-28.444444-64-64-64z m-184.888889 128c-35.555556 0-64 28.444444-64 64v99.555555c0 35.555556 28.444444 64 64 64s64-28.444444 64-64v-99.555555c0-35.555556-28.444444-64-64-64z" fill="#3874F6" p-id="10751"></path></svg>