Replay.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <div>
  3. <div class="flex-box-ce flex-d-center" v-if="isOperation && !readonly">
  4. <!-- <el-date-picker v-model="time" type="daterange" size="mini" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> -->
  5. <div class="add-task" @click="isShowFp = true"><i class="el-icon-plus"></i> 添加复盘</div>
  6. </div>
  7. <div style="padding: 10px 0;">
  8. <div class="flex-box-ce flex-d-center cursor record-list" v-for="(item, index) in list" :key="index"
  9. @click="openDetail(item.id)">
  10. <div class="black" style="font-weight: 700;font-size: 16px;">{{index+1}} 复盘({{item.ct}})</div>
  11. <div class="blue">
  12. <span style="padding-right: 10px;" class="cursor" v-if="isOperation && !readonly"><i
  13. class="el-icon-edit-outline"></i>编辑</span>
  14. <!-- <span class="cursor">查看详情</span> -->
  15. </div>
  16. </div>
  17. <div class="dotted-line" v-if="list.length==0">
  18. <div>尚未复盘过</div>
  19. </div>
  20. </div>
  21. <!-- 复盘目标 -->
  22. <el-dialog title="复盘" :visible.sync="isShowFp" :append-to-body="true" width="600px" :close-on-click-modal="false">
  23. <div style="max-height: 500px;overflow: auto;height: 500px;" class="scroll-bar">
  24. <div class="flex-box-ce">
  25. <div class="add-task-title">复盘对象</div>
  26. <div class="flex-1">
  27. <div class="huan" v-if="target_type==1"><span></span></div>
  28. <span class="huan" v-else style="font-weight: 600; color: #409EFF; font-size: 12px;">KR</span>{{name}}
  29. </div>
  30. </div>
  31. <div style="margin-bottom: 10px;">
  32. <div class="add-task-title">价值与收获</div>
  33. <el-input type="textarea" v-model="form.summary" :disabled="readonly" aria-required maxlength="500"
  34. show-word-limit clearable placeholder="我们在过程中学到了什么?(必填)" />
  35. </div>
  36. <div style="margin-bottom: 10px;">
  37. <div class="add-task-title">问题与不足</div>
  38. <el-input type="textarea" v-model="content" :disabled="readonly" maxlength="500" show-word-limit clearable
  39. placeholder="请描述出现的某个问题并针对该问题展开分析(必填)" />
  40. </div>
  41. <div style="margin-bottom: 10px;">
  42. <div class="add-task-title2">根本原因</div>
  43. <el-input type="textarea" v-model="reason" :disabled="readonly" maxlength="500" show-word-limit clearable
  44. placeholder="请填写问题出现的根本原因(必填)" />
  45. </div>
  46. <div style="margin-bottom: 10px;">
  47. <div class="add-task-title2">相应解决措施</div>
  48. <el-input type="textarea" v-model="plan" :disabled="readonly" maxlength="500" show-word-limit clearable
  49. placeholder="请根据上述原因给出可落地的解决措施(必填)" />
  50. </div>
  51. <div style="margin-bottom: 10px;">
  52. <div class="add-task-title">复盘参与人员</div>
  53. <div class="flex-box-ce flex-d-wrap">
  54. <div class="flex-box-ce userItem" v-for="item in employee_selected_all.employee" :key="item.id"
  55. style="margin-right: 10px;">
  56. <userImage :id="item.id" width="30px" height="30px" fontSize="14" :user_name="item.name"></userImage>
  57. <span style="font-weight: 600;padding-left: 10px;" class="fontColorB">{{item.name}}</span>
  58. </div>
  59. <div v-if="!readonly" class="aite" @click="show_employee_selector_all=true">+</div>
  60. </div>
  61. </div>
  62. <div style="height: 100px;"></div>
  63. </div>
  64. <div class="flex-box-end" style="margin-top:10px;">
  65. <el-popconfirm title="此操作不可恢复,您确定删除吗?" @confirm="deleteR" v-if="form.replay_id && isOperation && !readonly">
  66. <el-button slot="reference" type="danger" plain>删除</el-button>
  67. </el-popconfirm>
  68. <div class="flex-1"></div>
  69. <el-button @click="isShowFp=false">取消</el-button>
  70. <el-button type="primary" @click="confirm" v-if="isOperation">确定</el-button>
  71. </div>
  72. </el-dialog>
  73. <!--添加任务 -->
  74. <AddTask :visible.sync="isShowAddTask"></AddTask>
  75. <!-- @人员 -->
  76. <EmployeeSelector :is_filtration_creator="false" title="选择人员" :selected="employee_selected_all"
  77. :visible.sync="show_employee_selector_all" @confirm="employee_confirm_all" />
  78. </div>
  79. </template>
  80. <script>
  81. import AddTask from '@/okr/components/public/AddTask'; //添加任务
  82. import EmployeeSelector from '@/components/EmployeeSelector';
  83. export default {
  84. name: 'Replay',
  85. components:{AddTask,EmployeeSelector},
  86. props: {
  87. readonly: {
  88. type: Boolean,
  89. default: false
  90. },
  91. target_id: {//对象id 根据对象种类不同而不同
  92. type: Number,
  93. default: 0,
  94. },
  95. target_type: {//沟通记录所属的对象种类 1-目标 2-KR 3-计划 4-项目 5-里程碑 6-进展
  96. type: Number,
  97. default: 0,
  98. },
  99. name:{ //名称
  100. type: String,
  101. default: '',
  102. },
  103. isOperation: { //是否可以操作
  104. type: Boolean,
  105. default: true
  106. },
  107. },
  108. data() {
  109. return {
  110. form: {
  111. target_type:this.target_type,// 是 string 复盘对象种类 1-目标 2-KR
  112. target_id:this.target_id,// 是 string 复盘对象id
  113. content:'',// 是 string 问题与不足列表。指定json结构的字符串
  114. summary:'',// 是 string 价值总结
  115. joiner_ids:'',// 是 string 参与者id列表,多个参与者以逗号分隔
  116. },
  117. content:'',
  118. reason:'',
  119. plan:'',
  120. time: [],
  121. tags: [],
  122. isShowAddTask:false,
  123. isShowFp: false,
  124. list: [],
  125. employee_selected_all: { dept: [], employee: [] },
  126. show_employee_selector_all: false,
  127. };
  128. },
  129. computed: {
  130. valueStr() {
  131. return (this.value + this.value).toString();
  132. }
  133. },
  134. watch:{
  135. isShowFp(val){
  136. if(!val){
  137. this.form={
  138. target_type:this.target_type,// 是 string 复盘对象种类 1-目标 2-KR
  139. target_id:this.target_id,// 是 string 复盘对象id
  140. content:'',// 是 string 问题与不足列表。指定json结构的字符串
  141. summary:'',// 是 string 价值总结
  142. joiner_ids:'',// 是 string 参与者id列表,多个参与者以逗号分隔
  143. };
  144. this.content='';
  145. this.reason='';
  146. this.plan='';
  147. this.employee_selected_all={ dept: [], employee: [] };
  148. }
  149. },
  150. time(val){
  151. this.getReplay();
  152. }
  153. },
  154. methods: {
  155. deleteR(){
  156. this.$axiosUser('post', '/api/pro/okr/replay/delete', {replay_id:this.form.replay_id}).then(res=>{
  157. this.getReplay();
  158. this.isShowFp=false;
  159. })
  160. },
  161. openDetail(id) {
  162. let url = ""
  163. if (!this.readonly) url = '/api/pro/okr/replay/info'
  164. else url = '/api/pro/okr/public/replay/info'
  165. this.$axiosUser('get', url, {replay_id:id}).then(res=>{
  166. let data=res.data.data
  167. this.form={
  168. replay_id:data.id,
  169. target_type:this.target_type,// 是 string 复盘对象种类 1-目标 2-KR
  170. target_id:this.target_id,// 是 string 复盘对象id
  171. content:data.content[0].problem,// 是 string 问题与不足列表。指定json结构的字符串
  172. summary:data.summary,// 是 string 价值总结
  173. joiner_ids:data.joiner_ids,// 是 string 参与者id列表,多个参与者以逗号分隔
  174. };
  175. this.content=data.content[0].problem;
  176. this.reason=data.content[0].reason;
  177. this.plan=data.content[0].plan;
  178. this.employee_selected_all.employee=data.joiner_ids.map(e=>{
  179. return this.$getEmployeeMapItem(e)
  180. });
  181. this.isShowFp=true;
  182. })
  183. },
  184. employee_confirm_all(val){
  185. this.employee_selected_all.employee=val.employee;
  186. this.form.joiner_ids=val.employee.map(item=>{
  187. return item.id
  188. });
  189. },
  190. getReplay() {
  191. let url = "";
  192. if (!this.readonly) {
  193. url = '/api/pro/okr/replay/list'
  194. } else {
  195. url = '/api/pro/okr/public/replay/list'
  196. }
  197. this.$axiosUser('get', url, {target_type:this.target_type,target_id:this.target_id,page:1,page_size:100}).then(res=>{
  198. let list=res.data.data.list
  199. this.list=list
  200. })
  201. },
  202. confirm(val) {
  203. if(!this.form.summary){
  204. this.$message.error('请输入价值与收获');
  205. return false
  206. }
  207. if(!this.content){
  208. this.$message.error('请输入问题与不足');
  209. return false
  210. }
  211. if(!this.reason){
  212. this.$message.error('请输入根本原因');
  213. return false
  214. }
  215. if(!this.plan){
  216. this.$message.error('请输入相应解决措施');
  217. return false
  218. }
  219. if(this.form.joiner_ids.length==0){
  220. this.$message.error('请选择复盘参与人员');
  221. return false
  222. }
  223. this.form.joiner_ids=this.form.joiner_ids.toString();
  224. this.form.content=JSON.stringify([{problem:this.content,reason:this.reason,plan:this.plan}]);
  225. let url='';
  226. if(this.form.replay_id){
  227. url="api/pro/okr/replay"
  228. }else{
  229. url="api/pro/okr/replay/create"
  230. }
  231. this.$axiosUser('post',url,this.form).then(res=>{
  232. this.$message.success(this.form.replay_id? "编辑成功":'已添加');
  233. this.getReplay();
  234. this.isShowFp=false;
  235. })
  236. }
  237. },
  238. mounted() {
  239. this.getReplay()
  240. }
  241. };
  242. </script>
  243. <style scoped="scoped" lang="scss">
  244. .record-list {
  245. padding: 6px 2px;
  246. border-radius: 5px;
  247. margin-bottom: 6px;
  248. }
  249. .record-list:hover {
  250. background-color: #f4f6f9;
  251. }
  252. .userItem{
  253. border-radius: 5px;
  254. padding: 5px;
  255. position: relative;
  256. }
  257. .userItem i{
  258. position: absolute;
  259. right: 0;
  260. top: 0;
  261. padding: 0;
  262. display: none;
  263. }
  264. .userItem:hover{
  265. background-color: #F7F8FA;
  266. }
  267. .userItem:hover i{
  268. display: block !important;
  269. }
  270. .blue-btn{
  271. background-color: #409EFF;
  272. color: #fff;
  273. width: 130px;
  274. text-align: center;
  275. padding: 5px 0;
  276. cursor: pointer;
  277. border-radius: 3px;
  278. }
  279. .aite {
  280. width: 28px;
  281. height: 28px;
  282. text-align: center;
  283. line-height: 22px;
  284. font-size: 22px;
  285. cursor: pointer;
  286. color: #409EFF;
  287. display: inline-block;
  288. border-radius: 100%;
  289. background-color: #e9f1fe;
  290. }
  291. .aite:hover {
  292. color: #409EFF;
  293. }
  294. .add-task-title2{
  295. }
  296. .add-task-title,.add-task-title2{
  297. padding: 10px;
  298. position: relative;
  299. color: #141c28;
  300. font-weight: 600;
  301. }
  302. .add-task-title::after{
  303. content: "";
  304. position: absolute;
  305. width: 4px;
  306. height: 14px;
  307. border-radius: 5px;
  308. background-color: #409EFF;
  309. left: 0;
  310. top: 13px;
  311. }
  312. .add-task {
  313. width: 120px;
  314. text-align: center;
  315. color: #409EFF;
  316. // background-color: #409EFF;
  317. padding: 2px 0;
  318. border: 1px solid #409EFF;
  319. border-radius: 3px;
  320. cursor: pointer;
  321. }
  322. .huan {
  323. position: relative;
  324. width: 22px;
  325. height: 16px;
  326. border-radius: 25px;
  327. background-color: #e9f1fe;
  328. box-sizing: border-box;
  329. text-align: center;
  330. line-height: 17px;
  331. margin-right: 11px;
  332. display: inline-block;
  333. }
  334. .huan span {
  335. border: 2px solid #409EFF;
  336. border-radius: 100%;
  337. width: 12px;
  338. height: 12px;
  339. display: inline-block;
  340. }
  341. </style>