Interaction.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div>
  3. <div class="scroll-bar" :class="{'setHeight':target_type==4}">
  4. <template v-if="target_type!=5">
  5. <div class="fontColorC hoverBlue" style="font-size: 12px;">
  6. <span @click="isShowAll=!isShowAll">全部操作 {{total}} <i :class="isShowAll? 'el-icon-arrow-up':'el-icon-arrow-down'"></i></span>
  7. </div>
  8. <Record :record="record" :isShowAll="isShowAll"></Record>
  9. </template>
  10. <div class="fontColorC flex-box-ce flex-d-center">
  11. <span class="hoverBlue" style="font-size: 12px;" @click="isShowAll2=!isShowAll2">全部沟通 {{total2}} <i :class="isShowAll2? 'el-icon-arrow-up':'el-icon-arrow-down'"></i></span>
  12. <div class="flex-box-ce">
  13. <el-checkbox v-model="checked">仅看有附件的</el-checkbox>
  14. <el-input class="input" maxlength="20" prefix-icon="el-icon-search" style="width: 206px;margin: 0 10px;" size="small" v-model="keyword" clearable placeholder="按沟通内容搜索" />
  15. <el-button @click="huiFu({},true)" class="primaryBtn" size="small" v-if="isOperation"><i class="el-icon-edit"></i>立即沟通</el-button>
  16. </div>
  17. </div>
  18. <div class="record" v-if="feedbackList.length > 0" style="margin: 20px 0;">
  19. <div v-for="(item, index) in feedbackList" :key="index" class="record-list" v-if="isShowAll2">
  20. <div class="flex-box-ce record-date fontColorB">
  21. <userImage :user_name="item.userInfo.name" :img_url="item.userInfo.img_url" fontSize="12" width="32px" height="32px"></userImage>
  22. <div class="record-name">{{ item.userInfo.name }} <span v-if="item.reply_employee_id"><span style="font-weight: 500;" class="fontColorF">回复</span> {{$getEmployeeMapItem(item.reply_employee_id).name}}</span></div>
  23. <span class="fontColorC flex-1">{{ item.create_time }}</span>
  24. <span class="blue cursor" style="padding-right: 10px;display: none;" @click="huiFu(item)">回复</span>
  25. <el-popconfirm title="此操作不可恢复,您确定删除吗?" @confirm="deleteFeedback(item)" v-if="userId==item.userInfo.id">
  26. <span slot="reference" class="blue cursor" style="display: none;">删除</span>
  27. </el-popconfirm>
  28. </div>
  29. <div class="record-content">
  30. <pre class="pre fontColorB">{{ item.content }}</pre>
  31. </div>
  32. <div v-if="item.files.length>0" class="flex-box-ce" style="margin-top: 20px;">
  33. <div class="files-box flex-box-ce" v-for="(f,index2) in item.files" :key="index2">
  34. <el-image v-if="f.type=='img'" style="width: 30px; height: 30px;cursor: pointer;" :src="f.file" :preview-src-list="[f.file]"></el-image>
  35. <span v-else ><img @click="$onFilePreView(f.file)" style="width: 30px; height: 30px;cursor: pointer;" src="static/images/excel_icon.png"/></span>
  36. <Tooltip :preHtml="f.name">
  37. <div style="margin-left: 10px;width: 120px;">{{f.name}}</div>
  38. </Tooltip>
  39. </div>
  40. </div>
  41. <div v-if="item.notice_employee_ids.length>0" class="flex-box-ce" style="margin-top: 20px;padding-left: 40px;">
  42. <div>@人员:</div>
  43. <span class="green" v-for="(f,index2) in item.notice_employee_ids" :key="index2" style="padding-left: 5px;">{{f.name}}</span>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="dotted-line" v-else style="margin: 20px 0;">
  48. <div>暂无沟通记录,<span class="blue cursor" @click="huiFu({},true)">去沟通</span></div>
  49. </div>
  50. </div>
  51. <!-- 沟通弹窗 -->
  52. <AddInteraction :visible.sync="isShowCommunication" :userInfo="userInfo" :replyId="reply_id" :target_type="target_type" :target_id="target_id" @confirm="getLog"></AddInteraction>
  53. </div>
  54. </template>
  55. <script>
  56. import Record from '@/okr/components/public/Record'; //流程
  57. import AddInteraction from '@/okr/components/TargetDetail/AddInteraction'; //流程
  58. import Tooltip from '@/components/Tooltip'; //鼠标悬浮显示文字
  59. import { _debounce} from '@/utils/auth';
  60. export default {
  61. name: 'Interaction',
  62. components: { Record, AddInteraction,Tooltip },
  63. props: {
  64. target_id: {//对象id 根据对象种类不同而不同
  65. type: Number,
  66. default: 0,
  67. },
  68. target_type: {//沟通记录所属的对象种类 1-目标 2-KR 3-计划 4-项目 5-里程碑 6-进展
  69. type: Number,
  70. default: 0,
  71. },
  72. isOperation: { //是否可以操作
  73. type: Boolean,
  74. default: true
  75. },
  76. },
  77. data() {
  78. return {
  79. userInfo:{},
  80. userId:this.$userInfo().id,//当前用户id
  81. reply_id:0,
  82. tags: [], //沟通@人员
  83. selectUser: false,
  84. record: [],
  85. feedbackList:[],
  86. total:0,
  87. total2:0,
  88. isShowAll:false,//是否显示全部操作记录
  89. isShowAll2:true,
  90. isShowCommunication: false, //沟通反馈
  91. keyword:'',
  92. file:'',
  93. checked:false,
  94. };
  95. },
  96. watch: {
  97. keyword:_debounce(function(val) {
  98. this.getLog();
  99. }),
  100. checked(val) {
  101. this.getLog();
  102. },
  103. },
  104. mounted() {
  105. this.getLog()
  106. },
  107. methods: {
  108. onFilePreView(url) {
  109. window.open(url, '_blank');
  110. },
  111. deleteFeedback(item){
  112. this.$axiosUser('post','/api/pro/okr/feedback/delete',{fb_id:item.id}).then(res => {
  113. this.getLog()
  114. })
  115. },
  116. huiFu(item,is){
  117. if(is){
  118. this.userInfo={};
  119. this.reply_id=0;
  120. }else{
  121. this.userInfo=item.userInfo;
  122. this.reply_id=item.id;
  123. }
  124. this.isShowCommunication=true;
  125. },
  126. getLog() {
  127. let axios= this.$axiosUser('get', '/api/pro/okr/log',{target_id:this.target_id,target_type:this.target_type})
  128. let axios2= this.$axiosUser('get', '/api/pro/okr/feedback/list', {target_id:this.target_id,target_type:this.target_type,page:0,page_size:100,keyword:this.keyword,file:this.checked? 1:0})
  129. let urls=this.target_type==5? [axios2]:[axios,axios2];
  130. Promise.all(urls).then(res => {
  131. if(this.target_type==5){
  132. let data2=res[0].data.data
  133. let list=data2.list;
  134. list.forEach(item=>{
  135. item.userInfo=this.$getEmployeeMapItem(item.publisher_id);
  136. item.notice_employee_ids=item.notice_employee_ids.map(e=>{
  137. return this.$getEmployeeMapItem(e)
  138. })
  139. })
  140. this.feedbackList=list;
  141. this.total2=data2.total;
  142. }else{
  143. let data1=res[0].data.data
  144. this.record=data1.list;
  145. this.total=data1.total;
  146. let data2=res[1].data.data
  147. let list=data2.list;
  148. list.forEach(item=>{
  149. item.userInfo=this.$getEmployeeMapItem(item.publisher_id);
  150. item.notice_employee_ids=item.notice_employee_ids.map(e=>{
  151. return this.$getEmployeeMapItem(e)
  152. })
  153. })
  154. this.feedbackList=list;
  155. this.total2=data2.total;
  156. }
  157. })
  158. }
  159. }
  160. };
  161. </script>
  162. <style scoped="scoped" lang="scss">
  163. ::v-deep input {
  164. border-radius: 20px;
  165. }
  166. .setHeight{
  167. height: calc(100vh - 280px);
  168. overflow-y: auto;
  169. }
  170. .add-task {
  171. width: 120px;
  172. text-align: center;
  173. color: #409EFF;
  174. // background-color: #409EFF;
  175. padding: 2px 0;
  176. border: 1px solid #409EFF;
  177. border-radius: 3px;
  178. cursor: pointer;
  179. }
  180. .record-message {
  181. font-size: 13px;
  182. margin: 5px 60px;
  183. }
  184. .record-list {
  185. position: relative;
  186. padding: 8px;
  187. border-radius: 5px;
  188. }
  189. .record-list:hover {
  190. background-color: #f4f6f9;
  191. }
  192. .record-list:hover .blue {
  193. display: block !important;
  194. }
  195. .record-title {
  196. padding: 16px 0;
  197. font-size: 16px;
  198. }
  199. .record-date {
  200. position: relative;
  201. font-size: 13px;
  202. }
  203. .record-content {
  204. margin-left: 40px;
  205. border-radius: 5px;
  206. }
  207. .pre{
  208. margin: 5px 0;
  209. }
  210. .record-name {
  211. margin-right: 10px;
  212. margin-left: 10px;
  213. color: #141c28;
  214. font-weight: 600;
  215. }
  216. .files-box{
  217. margin-right: 10px;
  218. height: 46px;
  219. width: 200px;
  220. padding-left: 10px;
  221. position: relative;
  222. }
  223. .files-box div{
  224. width: 100px;
  225. overflow: hidden;
  226. text-overflow: ellipsis;
  227. white-space: nowrap;
  228. }
  229. .files-box:hover{
  230. background-color: #dcdfe6;
  231. }
  232. .files-box i{
  233. color: #606266;
  234. }
  235. .files-box i:hover{
  236. color: #f56c6c;
  237. }
  238. </style>