list.vue 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <div style="margin-left: 20px;display: inline-block">
  7. <el-form-item label="任务列表">
  8. </el-form-item>
  9. </div>
  10. <el-form-item >
  11. <div style="margin-left: 8px">
  12. <!-- <el-input style="float:left;" v-model="keyword" class="input-with-select" placeholder="请输入项目名称关键字" clearable="true"> -->
  13. <el-select v-model="searchField" style="width:120px;" slot="prepend" placeholder="请选择">
  14. <el-option label="进行中" value="0" @click.native="hiddens()"></el-option>
  15. <el-option label="已完成" value="1" @click.native="hiddens()"></el-option>
  16. </el-select>
  17. <!-- <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button> -->
  18. <!-- </el-input> -->
  19. </div>
  20. </el-form-item>
  21. <!-- <el-form-item style="float:right;">
  22. <el-link type="primary" :underline="false" @click="handleAdd(-1,null)">新增任务</el-link>
  23. </el-form-item> -->
  24. </el-form>
  25. </el-col>
  26. <div style="display: flex;width: 100%;">
  27. <div class="classification">
  28. <div>
  29. <p :class="idx == 1 ? 'on' : ''" @click="switchs(1)">我执行的</p>
  30. <p :class="idx == 2 ? 'on' : ''" @click="switchs(2)">我创建的</p>
  31. </div>
  32. </div>
  33. <div style="max-width: 94%;min-width: 90%">
  34. <!--列表-->
  35. <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
  36. <el-table-column type="index" width="60">
  37. <template slot-scope="scope" >
  38. {{scope.$index+1+(page-1)*size}}
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="name" label="任务名称" sortable width="380">
  42. <template slot-scope="scope">
  43. <el-popover trigger="hover" placement="top" width="380" v-if="scope.row.name">
  44. <p id="caseContent">{{scope.row.name}}</p>
  45. <div slot="reference" class="name-wrapper">
  46. <div class="cal" @click="editTask(scope.row)">{{scope.row.name}}</div>
  47. </div>
  48. </el-popover>
  49. </template>
  50. </el-table-column>
  51. <el-table-column prop="projectName" label="项目名称" sortable width="350">
  52. <template slot-scope="scope">
  53. <el-link type="primary" :href="'#/projectInside/'+scope.row.projectId">{{scope.row.projectName}}</el-link>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="executorName" label="执行人" sortable width="200">
  57. <template slot-scope="scope">
  58. <el-link type="primary" @click="showUser(scope.row.executorId)">{{scope.row.executorName}}</el-link>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="stagesName" label="任务阶段" sortable width="230" @mouseover="mouseOver">
  62. </el-table-column>
  63. <el-table-column prop="createDate" label="创建时间" sortable width="250"></el-table-column>
  64. <el-table-column label="截止时间" width="290" fixed="right">
  65. <template slot-scope="scope">
  66. <div style="display: flex;justify-content: space-between;padding-right: 40px">
  67. <span style="display: inline-block;margin-right: 55px">{{scope.row.endDate}}</span>
  68. <el-button v-if="searchField == 0" size="small" type="primary" @click="completes(scope.row.id, 0)">完成</el-button>
  69. <el-button v-if="searchField == 1" size="small" type="warning" @click="completes(scope.row.id, 1)">重启</el-button>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <!--工具条-->
  75. <el-col :span="24" class="toolbar">
  76. <el-pagination
  77. @size-change="handleSizeChange"
  78. @current-change="handleCurrentChange"
  79. :page-sizes="[20, 50 , 80 , 100]"
  80. :page-size="20"
  81. :current-page="page"
  82. layout="total, sizes, prev, pager, next"
  83. :total="total"
  84. style="float:right;"
  85. ></el-pagination>
  86. </el-col>
  87. </div>
  88. </div>
  89. <!--新增界面-->
  90. <!-- <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="600px">
  91. <el-form ref="form1" :model="addForm" :rules="rules" label-width="100px">
  92. <el-form-item label="任务名称" >
  93. <el-input v-model="addForm.code" :disabled="user.role==0" placeholder="请输入项目编号" clearable></el-input>
  94. </el-form-item>
  95. <el-form-item label="项目名称" prop="name">
  96. <el-input v-model="addForm.name" :disabled="user.role==0" placeholder="请输入项目名称" clearable></el-input>
  97. </el-form-item>
  98. <el-form-item label="全部参与者">
  99. <el-select v-model="addForm.userId" multiple filterable placeholder="请选择参与者" style="width:100%;" @change="changeParticipator">
  100. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item label="主要负责人" >
  104. <el-select v-model="addForm.inchargerId" :disabled="addForm.userId.length==0 || user.role==0" filterable placeholder="请选择负责人" style="width:100%;" @change="changeIncharger">
  105. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  106. </el-select>
  107. </el-form-item>
  108. </el-form>
  109. <div slot="footer" class="dialog-footer">
  110. <el-button @click.native="addFormVisible = false">取消</el-button>
  111. <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
  112. </div>
  113. </el-dialog> -->
  114. <!--用户详细信息弹出框-->
  115. <el-dialog title="查看详情" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  116. <div class="line"><span>姓名</span><span>{{userDetail.name}}</span></div>
  117. <div class="line"><span>手机号码</span><span>{{userDetail.phone}}</span></div>
  118. <div class="line"><span>部门</span><span>{{userDetail.departmentName}}</span></div>
  119. <div class="line"><span>成本</span><span>{{userDetail.cost}}元/小时</span></div>
  120. <div slot="footer" class="dialog-footer">
  121. <el-button type="primary" @click="userDetailVisible = false" >确定</el-button>
  122. </div>
  123. </el-dialog>
  124. <!-- 子项目列表 -->
  125. <el-dialog title="子项目列表" show-header="false" v-if="subProjectVisible" :visible.sync="subProjectVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  126. <el-table :data="subProjectList" highlight-current-row height="400" style="width: 100%;">
  127. <el-table-column type="index" width="60" label="序号">
  128. <template slot-scope="scope" >
  129. {{scope.$index+1+(page-1)*size}}
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="name" label="名称" ></el-table-column>
  133. <el-table-column label="操作" width="150">
  134. <template slot-scope="scope" >
  135. <el-button size="small" type="primary" @click="addNewSubProject(scope.row)">编辑</el-button>
  136. <el-button size="small" type="danger" @click="deleteSubPro(scope.row)">删除</el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <div slot="footer" class="dialog-footer">
  141. <el-button type="primary" @click="subProjectVisible = false" >关闭</el-button>
  142. <el-button type="primary" @click="addNewSubProject()" >新增子项目</el-button>
  143. </div>
  144. </el-dialog>
  145. <!-- 新增子项目弹出框 -->
  146. <el-dialog title="新增/修改子项目" v-if="addSubProject" :visible.sync="addSubProject" :close-on-click-modal="false" customClass="customWidth" width="500px">
  147. <el-form ref="form2" :model="addForm" :rules="rules" label-width="100px">
  148. <el-form-item label="项目名称" prop="name">
  149. <el-input v-model="addForm.name" placeholder="请输入项目名称" clearable></el-input>
  150. </el-form-item>
  151. </el-form>
  152. <div slot="footer" class="dialog-footer">
  153. <el-button @click.native="addSubProject = false">取消</el-button>
  154. <el-button type="primary" @click="submitInsertSubProject" :loading="addLoading">提交</el-button>
  155. </div>
  156. </el-dialog>
  157. <!-- 任务详情信息弹出框 -->
  158. <el-dialog :class="addForm.id==null?'':'jm'" :title="title" v-if="addFormVisible" :visible.sync="addFormVisible"
  159. :close-on-click-modal="false" customClass="customWidth" width="800px">
  160. <!-- <div style="width: 200%;height:80%;position: absolute;right:-100%;top:0;background:#000;opacity: 0;" @click="sss"></div> -->
  161. <el-form ref="form1" :model="addForm" :rules="taskRules" label-width="100px">
  162. <!--子任务需要选择任务列表 -->
  163. <el-form-item label="任务列表" prop="stages" v-if="addForm.parentTid != null">
  164. <el-select v-model="addForm.stagesId" style="width:100%;" >
  165. <el-option v-for="item in stageList" :key="item.id" :label="item.stagesName" :value="item.id"></el-option>
  166. </el-select>
  167. </el-form-item>
  168. <el-form-item label="类型">
  169. <el-select v-model="addForm.taskType" style="width:100%;" :disabled="this.addForm.id != null && user.id != this.addForm.createrId && currentProject.inchargerId != user.id">
  170. <el-option v-for="item in taskTypeList" :key="item.id" :label="item.name" :value="item.id">
  171. <i :class="item.icon" ></i>
  172. <span>{{item.name}}</span>
  173. </el-option>
  174. </el-select>
  175. </el-form-item>
  176. <el-form-item label="任务内容" prop="name">
  177. <el-input v-model="addForm.name" :maxlength="40" :disabled="this.addForm.id != null && user.id != this.addForm.createrId && currentProject.inchargerId != user.id" placeholder="请输入任务内容" clearable></el-input>
  178. </el-form-item>
  179. <el-form-item label="执行人">
  180. <el-select v-model="addForm.executorId" filterable placeholder="请选择执行人" style="width:100%;" >
  181. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  182. </el-select>
  183. </el-form-item>
  184. <el-form-item label="截止时间" prop="endDate">
  185. <el-date-picker v-model="addForm.endDate" type="date" style="width:40%;" value-format="yyyy-MM-dd"
  186. placeholder="请选择日期" :disabled="this.addForm.id != null && user.id != this.addForm.createrId && currentProject.inchargerId != user.id"></el-date-picker>
  187. <span style="margin-left:30px;margin-right:10px;">计划工时</span><el-input-number :disabled="this.addForm.id != null && user.id != this.addForm.createrId && currentProject.inchargerId != user.id" v-model="addForm.planHours" style="width:30%;" :min="1" :max="100" placeholder="请输入计划工作时长,单位小时" ></el-input-number ><span style="margin-left:10px;">小时</span>
  188. </el-form-item>
  189. <el-form-item label="优先级">
  190. <el-select v-model="addForm.taskLevel" style="width:100%;" >
  191. <el-option v-for="item in importanceList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  192. </el-select>
  193. </el-form-item>
  194. <!-- 富文本 -->
  195. <el-form-item label="详细描述" style="height: 200px">
  196. <!-- <Editor id="tinymce" v-model="tinymceHtml" :init="editorInit"></Editor> -->
  197. <!-- <el-input type="textarea" v-model="addForm.taskDesc" :rows="3"></el-input> -->
  198. <!-- <quill-edito v-model="addForm.taskDesc"></quill-edito> -->
  199. <quill-editor style="height: 150px" ref="text" v-model="addForm.taskDesc" class="myQuillEditor" :options="editorOption" @blur="onEditorBlur($event)" @focus="onEditorFocus($event)"/>
  200. </el-form-item>
  201. <!-- 富文本 -->
  202. <div v-if="addForm.id != null">
  203. <el-divider ></el-divider>
  204. <!-- 任务进展 -->
  205. <p ><i class="iconfont firerock-icontree" style="color:#20A0ff;margin-left:10px;">任务进展</i>
  206. <span ref="addPro" style="display: block; float:right;"><el-link @click="addprogress">添加任务进展</el-link></span>
  207. </p>
  208. <!-- 任务进展展示 -->
  209. <div style="display: none;" ref="proBox" class="progress">
  210. <!-- <el-form :model="> -->
  211. <el-radio-group v-model="radio">
  212. <el-radio :label="0" class="rala1">状态正常</el-radio>
  213. <el-radio :label="1" class="rala2">存在风险</el-radio>
  214. <el-radio :label="2" class="rala3">进展逾期</el-radio>
  215. </el-radio-group>
  216. <el-input
  217. type="textarea"
  218. border="0"
  219. :autosize="{ minRows: 2, maxRows: 6}"
  220. placeholder="请输入详细进展描述"
  221. v-model.trim="text2"
  222. style="margin:10px 0 0 0">
  223. </el-input>
  224. <h4 style="font-weight: normal;">提醒谁查看:{{checkLists.length}}</h4>
  225. <i class="el-icon-circle-plus pron_i" style="font-size: 28px;color: #409EFF;" @click="addI(0)"></i>
  226. <div class="remind" ref="addRem" style="display: none">
  227. <el-checkbox-group v-model="checkboxGrounp" v-for="item in users" :key="item.id">
  228. <p><el-checkbox :label="item.name" @change="kkk(item)"></el-checkbox></p>
  229. </el-checkbox-group>
  230. </div>
  231. <div class="ssp" @click="sss"></div>
  232. <!-- </el-form> -->
  233. <div class="pro_btn">
  234. <el-button size="mini" @click="shutPro">取消</el-button>
  235. <el-button size="mini" type="primary" @click="addTaskProgress">发布</el-button>
  236. </div>
  237. </div>
  238. <div class="ddl" v-if="recentProgressInfo != null && recentProgressInfo.id != null">
  239. <div class="elCard" style="margin-bottom: 10px; height:" >
  240. <i class="el-icon-success" style="color: #43d14f;" v-if="recentProgressInfo.status == 0"></i>
  241. <i class="el-icon-success" style="color: #fd7624;" v-else-if="recentProgressInfo.status == 1"></i>
  242. <i class="el-icon-success" style="color: #fd4d47;" v-else></i>
  243. <span v-if="recentProgressInfo.status == 0">状态正常</span>
  244. <span v-else-if="recentProgressInfo.status == 1">状态正常</span>
  245. <span v-else>进展逾期</span>
  246. <el-dropdown trigger="click" style="float:right;cursor:pointer; float: right;">
  247. <i class="el-icon-more" ></i>
  248. <el-dropdown-menu slot="dropdown">
  249. <el-dropdown-item divided>
  250. <span @click="deleteTaskProgress(recentProgressInfo.id)"><i class="el-icon-delete"></i>删除列表</span></el-dropdown-item>
  251. </el-dropdown-menu>
  252. </el-dropdown>
  253. <div class="elCard_qu">{{recentProgressInfo.creatorName}}更新于{{recentProgressInfo.indate | relativeTime}}</div>
  254. <p style="padding-left: 20px;">{{recentProgressInfo.content}}</p>
  255. <div class="examine"><el-button type="text" @click="innerVisibless = true" style="color: #8F87A3;">查看历史记录</el-button></div>
  256. </div>
  257. </div>
  258. <!-- 任务列表没有数据的时候展示 -->
  259. <div class="nones" v-if="ProgressList.length <= 0">
  260. 暂无数据
  261. </div>
  262. <!-- 任务进展完整状态 -->
  263. <el-dialog title="提示" :visible.sync="innerVisibless" append-to-body width="500px">
  264. <div class="integrity">
  265. <h3 style="font-weight: normal;display: inline-block;margin: 0 0 20px 0;">任务进展:{{ProgressList.length}}</h3>
  266. <!-- <span class="write"><i class="el-icon-circle-plus"></i>填写进展</span> -->
  267. <el-divider></el-divider>
  268. <!-- -->
  269. <div class="block" style="height: 200px;">
  270. <el-timeline style="padding:20px 0 0 0;">
  271. <el-timeline-item
  272. v-for="(activity, index) in ProgressList"
  273. :key="index">
  274. <div class="tb">
  275. <span v-if="activity.status == 0" style="color: #43D14F" class="icon"></span>
  276. <span v-if="activity.status == 1" style="color: #FD7624" class="icon"></span>
  277. <span v-if="activity.status == 2" style="color: red" class="icon"></span>
  278. <div>
  279. <span v-if="activity.status == 0" style="color: #43D14F">状态正常</span>
  280. <span v-if="activity.status == 1" style="color: #FD7624">存在风险</span>
  281. <span v-if="activity.status == 2" style="color: red">进展预期</span>
  282. <span style="display: inline-block; float: right; color: #8C8C8C">{{activity.indate | relativeTime}}</span>
  283. </div>
  284. <p style="color: #8C8C8C">{{activity.content}}</p>
  285. </div>
  286. </el-timeline-item>
  287. </el-timeline>
  288. </div>
  289. <!-- -->
  290. </div>
  291. <span slot="footer" class="dialog-footer">
  292. <el-button type="primary" @click="innerVisibless = false">关闭</el-button>
  293. </span>
  294. </el-dialog>
  295. <!-- 子任务 -->
  296. <!-- <p ><i class="iconfont firerock-icontree" style="color:#20A0ff;margin-left:10px;">子任务</i>
  297. <el-link style="float:right;" @click="addSubTask">添加子任务</el-link>
  298. </p> -->
  299. <!--子任务列表 -->
  300. <!-- <el-table :data="addForm.subTaskList"
  301. :header-cell-style="{'font-weight':'normal'}"
  302. highlight-current-row v-loading="listLoading" style="width: 100%;margin-top:10px;" @row-click="taskLineClick">
  303. <el-table-column prop="taskStatus" label="完成" width="50" >
  304. <template slot-scope="scope">
  305. <el-checkbox :disabled="scope.row.taskStatus==2" :checked="scope.row.taskStatus==1?true:false" size="large" class="cb"
  306. @click.stop.native=""
  307. @change="finishTask(scope.row)"
  308. ></el-checkbox>
  309. </template>
  310. </el-table-column>
  311. <el-table-column prop="name" label="标题" >
  312. <template slot-scope="scope">
  313. <el-tooltip class="item" effect="dark" :content="scope.row.name" placement="top">
  314. <span style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;" > {{scope.row.name}}</span>
  315. </el-tooltip>
  316. </template>
  317. </el-table-column>
  318. <el-table-column prop="executorName" label="执行人" width="100" >
  319. <template slot-scope="scope">
  320. {{scope.row.executorName == null?"待分配":scope.row.executorName}}
  321. </template>
  322. </el-table-column>
  323. <el-table-column prop="endDate" label="截止时间" width="100" >
  324. <template slot-scope="scope">
  325. <p v-if="scope.row.endDate >= times">{{scope.row.endDate}}</p>
  326. <p v-else style="background: #e62412; color: #fff;text-align: center; border-radius: 3px;">{{scope.row.endDate}}</p>
  327. </template>
  328. </el-table-column>
  329. </el-table> -->
  330. </div>
  331. </el-form>
  332. <div slot="footer" class="dialog-footer">
  333. <el-button v-if="user.id == this.addForm.createrId || currentProject.inchargerId == user.id" @click.native="deleteTask" style="float:left;">删除</el-button>
  334. <el-button @click.native="addFormVisible = false">取消</el-button>
  335. <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
  336. </div>
  337. <div slot="title" v-if="addForm.parentTid != null" >
  338. <!-- <el-link @click="backToParentTask"><i class="el-icon-arrow-left single_line">返回父级任务</i> | {{addForm.parentTname}}</el-link> -->
  339. <el-page-header @back="backToParentTask" title="返回父任务" :content="addForm.parentTname"></el-page-header>
  340. </div>
  341. <!-- 评论 -->
  342. <div class="remark" v-show="addForm.id != null">
  343. <span class="zh">
  344. <!-- <span v-for="(pl, i) in critic" :key="i"> -->
  345. <!-- <div class="player" v-if="pl"> -->
  346. <div class="player">
  347. <p @click="chan">参与人</p>
  348. <span v-for="(pl, i) in critic" :key="i">
  349. <div class="bj" style="width: 14%">
  350. <span style="background: #778899">{{pl.length > 2 ? pl.substring(pl.length - 2, pl.length) : pl}}</span>
  351. <!-- <span style="background: #778899">{{pl.length}}</span> -->
  352. </div>
  353. </span>
  354. </div>
  355. <!-- </span> -->
  356. <div class="subject">
  357. <div class="sub-all">所有动态</div>
  358. <div class="sub-details" ref="main">
  359. <ul class="infinite-list" v-infinite-scroll="load" style="overflow:auto" ref="contRoll">
  360. <div style="width: 100%" v-if="commentList.length <= 0">
  361. <img src="../../assets/image/xiao.png" alt="">
  362. </div>
  363. <li v-for="i in count" class="infinite-list-item counli" :key="i">
  364. <p><i class="el-icon-s-fold"></i> <em>屈经理完成了依赖任务</em><span>4月20日</span></p>
  365. </li>
  366. <li class="carts" v-for="item in commentList" :key="item.id">
  367. <!-- <el-image style="width: 30px; height: 30px" :src="url" :fit="fit"></el-image> -->
  368. <!-- <i :style="'background' + item.userColor"> -->
  369. <i :style="'background' + item.userColor">
  370. {{item.userName.length > 2 ? item.userName.substring(item.userName.length - 2, item.userName.length) : item.userName}}
  371. </i>
  372. <div>
  373. <!-- <p>{{item.userName}}</p> -->
  374. <p>{{item.userName}}</p>
  375. <em>{{item.content}}</em>
  376. </div>
  377. <span>{{item.createTime | relativeTime}}</span>
  378. </li>
  379. </ul>
  380. </div>
  381. </div>
  382. <div class="issue">
  383. <!-- <el-input type="textarea" class="textareays" label-width="100%" label-height="140px"></el-input> -->
  384. <div class="issue_fixation">
  385. <div class="inputDeep"><el-input
  386. type="textarea"
  387. placeholder="请输入内容"
  388. :autosize="{ minRows: 6, maxRows: 6}"
  389. v-model.trim="textarea2"
  390. class="inputDeeps"
  391. >
  392. </el-input></div>
  393. <el-button class="issue-button" type="primary" @click="release()">发布</el-button>
  394. </div>
  395. </div>
  396. </span>
  397. </div>
  398. <!-- 评论 -->
  399. </el-dialog>
  400. </section>
  401. </template>
  402. <style scoped>
  403. .input-with-select .el-input-group__prepend {
  404. background-color: #fff;
  405. }
  406. .line {
  407. padding:10px;
  408. }
  409. .line span{
  410. font-size:18px;
  411. }
  412. .line span:nth-child(even){
  413. float:right;
  414. }
  415. .classification {
  416. width: 120px;
  417. border-right: 1px solid #f2f2f2;
  418. display: flex;
  419. flex-wrap: wrap;
  420. padding-top: 20px;
  421. }
  422. .classification p{
  423. width: 120px;
  424. text-align: center;
  425. line-height: 50px;
  426. margin: 0;
  427. cursor: pointer;
  428. }
  429. .classification p:hover {
  430. background: #dddddd;
  431. }
  432. .on {
  433. color: #409EFF;
  434. }
  435. .acl{
  436. display: inline-block;
  437. width: 300px;
  438. height: 22px;
  439. overflow: hidden;
  440. white-space: nowrap;
  441. text-overflow: ellipsis;
  442. display: flex;
  443. align-items: center;
  444. margin: 0;
  445. padding: 0;
  446. line-height: 0;
  447. }
  448. .cal {
  449. width: 300px;
  450. overflow: hidden;
  451. white-space: nowrap;
  452. text-overflow: ellipsis;
  453. cursor: pointer;
  454. }
  455. /* p {
  456. margin: 0 !important;
  457. } */
  458. </style>
  459. <style lang="scss" scoped>
  460. .counli {
  461. em {
  462. font-style: normal;
  463. display: inline-block;
  464. margin-left: 9%;
  465. }
  466. span {
  467. float: right;
  468. }
  469. }
  470. .carts {
  471. position: relative;
  472. .el-image{
  473. border-radius: 50%;
  474. float: left;
  475. width: 20%;
  476. }
  477. i {
  478. width: 30px;
  479. height: 30px;
  480. // background: #778899;
  481. display: inline-block;
  482. float: left;
  483. border-radius:50%;
  484. font-style:normal;
  485. font-size: 12px;
  486. line-height: 30px;
  487. text-align: center;
  488. color: #fff;
  489. background: #778899;
  490. }
  491. div {
  492. text-align: left;
  493. p {
  494. text-align: left;
  495. margin-left: 10px;
  496. margin-left: 13%;
  497. }
  498. em {
  499. display: block;
  500. font-style: normal;
  501. margin-left: 13%;
  502. }
  503. }
  504. span {
  505. font-size: 10px;
  506. float: right;
  507. margin-top: -40px;
  508. }
  509. }
  510. .issue {
  511. // height: 20%;
  512. // position: relative;
  513. // z-index: 4;
  514. .zh{
  515. position: relative;
  516. width: 100%;
  517. height: 100%;
  518. }
  519. .textareays {
  520. background: #000;
  521. height: 140px;
  522. border: 0;
  523. .el-textarea__inner {
  524. height: 85%;
  525. }
  526. }
  527. .issue-button {
  528. position: absolute;
  529. bottom: 20px;
  530. right: 20px;
  531. }
  532. }
  533. .inputDeep {
  534. position: absolute;
  535. bottom: 85px;
  536. width: 95%;
  537. margin: 0 12px;
  538. }
  539. .inputDeep .el-textarea .el-textarea__inner{
  540. border: 0 !important;
  541. resize: none !important;
  542. }
  543. .inputDeeps .el-textarea__inner {
  544. border: 0 !important;
  545. resize: none !important;
  546. }
  547. .scop_span {
  548. display: inline-block;
  549. padding: 2px 5px;
  550. }
  551. </style>
  552. <script>
  553. import { error } from 'dingtalk-jsapi';
  554. import util from "../../common/js/util";
  555. // 富文本样式
  556. import 'quill/dist/quill.core.css'
  557. import 'quill/dist/quill.snow.css'
  558. import 'quill/dist/quill.bubble.css'
  559. // 导入富文本
  560. import { quillEditor } from 'vue-quill-editor'
  561. export default {
  562. name: "two-list-headerslots",
  563. display: "Two list header slot",
  564. order: 14,
  565. components: {
  566. // draggable,
  567. // // editor,
  568. // FileCenter,
  569. // ProjectInfo,
  570. // Summary,
  571. // Earning,
  572. quillEditor // 富文本
  573. },
  574. data() {
  575. return {
  576. searchField: '0',
  577. keyword:null,
  578. user: JSON.parse(sessionStorage.getItem("user")),
  579. userDetailVisible: false,
  580. userDetail:{},
  581. date: new Date(),
  582. users: [],
  583. participator:[],
  584. tableHeight: 0,
  585. listLoading: false,
  586. total: 0,
  587. page: 1,
  588. size: 20,
  589. list: [],
  590. subProjectVisible: false,
  591. subProjectList: [],//子项目列表
  592. currentProject:{},
  593. addSubProject: false,
  594. addFormVisible: false,
  595. addLoading: false,
  596. title: "",
  597. addForm: {
  598. name: '',
  599. userId: [],
  600. },
  601. rules: {
  602. name: [{ required: true, message: "请输入项目名称", trigger: "blur" }],
  603. },
  604. idx: 1,
  605. taskDetails: false,
  606. addForm: {
  607. name: '',
  608. },
  609. rules: {
  610. name: [{ required: true, message: "请输入分组名称", trigger: "blur" }],
  611. },
  612. rules2: {
  613. stagesName: [{ required: true, message: "请输入任务列表名称", trigger: "blur" }],
  614. },
  615. taskRules : {
  616. name: [{ required: true, message: "请输入任务内容", trigger: "blur" }],
  617. },
  618. sleectId: null,
  619. sleectProjectId: null,
  620. sidebarIndex: null, // 侧边栏索引
  621. url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
  622. count: 0,
  623. textarea2: '',
  624. taskId: null,
  625. commentList: [],
  626. radio: 0,
  627. critic: [], // 评论头像的数组
  628. editorOption: { // 富文本框里面的默认值
  629. placeholder: '请输入文本...',
  630. modules: {
  631. toolbar:[
  632. ['bold', 'italic', 'underline', 'strike'], //加粗,斜体,下划线,删除线
  633. // ['blockquote', 'code-block'], //引用,代码块
  634. [{ 'header': 1 }, { 'header': 2 }], // 标题,键值对的形式;1、2表示字体大小
  635. // [{ 'list': 'ordered'}, { 'list': 'bullet' }], //列表
  636. // [{ 'script': 'sub'}, { 'script': 'super' }], // 上下标
  637. // [{ 'indent': '-1'}, { 'indent': '+1' }], // 缩进
  638. // [{ 'direction': 'rtl' }], // 文本方向
  639. [{ 'size': ['small', false, 'large', 'huge'] }], // 字体大小
  640. [{ 'header': [1, 2, 3, 4, 5, 6, false] }], //几级标题
  641. [{ 'color': [] }, { 'background': [] }], // 字体颜色,字体背景颜色
  642. // [{ 'font': [] }], //字体
  643. [{ 'align': [] }], //对齐方式
  644. ['clean'], //清除字体样式
  645. // ['image','video'] //上传图片、上传视频
  646. ['image'] //上传图片、上传视频
  647. ], //工具栏设置
  648. },
  649. theme: 'snow',
  650. },
  651. textContent: true, // 控制提交
  652. times: null,
  653. text2: '',
  654. innerVisibless: false, // 任务展示弹出层
  655. activities: [{
  656. content: '状态正常',
  657. timestamp: '7小时前',
  658. size: 'large',
  659. type: 'primary',
  660. icon: 'el-icon-circle-check',
  661. color: '#409EFF'
  662. }, {
  663. content: '进展逾期',
  664. timestamp: '八小时前',
  665. color: '#F87872'
  666. }],
  667. ProgressList: [],
  668. checkboxGrounp: [], // 选中人的数据
  669. checkLists: [], // 选中人数据的ID
  670. taskIid: null,
  671. viewList: [{id:1,name:"全部任务"},{id:2,name:"进行中的任务"},{id:3,name:"已完成的任务"},{id:4,name:"待安排任务"},
  672. {id:5,name:"我创建的任务"},{id:6,name:"我执行的任务"},{id:7,name:"今天的任务"},{id:8,name:"已超期的任务"}],
  673. importanceList:[{id:0,name:"一般"},{id:1,name:"重要"},{id:2,name:"紧急"},],
  674. taskTypeList:[{id:0,name:"任务", icon:"iconfont firerock-iconrenwu"},{id:1,name:"里程碑",icon:"iconfont firerock-iconicon-"},{id:2,name:"风险",icon:"iconfont firerock-iconfengxian"}],
  675. taskTypeColor:['#20A0FF','#8613ad','#bf0404'],
  676. taskTypeIcon:['iconfont firerock-iconrenwu','iconfont firerock-iconicon-','iconfont firerock-iconfengxian'],
  677. taskStatusList:['进行中','已完成','已撤销'],
  678. //优先级
  679. taskLevelColor:['#262626','#E6A23C','#F56C6C'],
  680. stageList: '',
  681. selectedGroup:{},
  682. };
  683. },
  684. methods: {
  685. deleteSubPro(subProject) {
  686. this.$confirm("确定要删除子项目" + subProject.name + "吗?","删除子项目", {
  687. confirmButtonText: "确定",
  688. cancelButtonText: "取消",
  689. type: "warning"
  690. })
  691. .then(() => {
  692. this.listLoading = true;
  693. this.http.post('/sub-project/deleteProject',{
  694. id: subProject.id
  695. },
  696. res => {
  697. this.listLoading = false;
  698. if (res.code == "ok") {
  699. this.$message({
  700. message: "删除成功",
  701. type: "success"
  702. });
  703. this.subProject(this.currentProject);
  704. } else {
  705. this.$message({
  706. message: res.msg,
  707. type: "error"
  708. });
  709. }
  710. },
  711. error => {
  712. this.listLoading = false;
  713. this.$message({
  714. message: error,
  715. type: "error"
  716. });
  717. }
  718. );
  719. })
  720. .catch(() => {});
  721. },
  722. searchList() {
  723. this.page = 1;
  724. this.getList();
  725. },
  726. addNewSubProject(subProject) {
  727. if (subProject == null) {
  728. this.addForm = {projectId: this.currentProject.id}
  729. } else {
  730. this.addForm = subProject;
  731. }
  732. this.addSubProject = true;
  733. },
  734. //显示子项目
  735. subProject(item) {
  736. this.subProjectVisible = true;
  737. this.currentProject = item;
  738. this.http.post('/sub-project/list', {
  739. projectId: item.id
  740. },
  741. res => {
  742. if (res.code == "ok") {
  743. this.subProjectList = res.data;
  744. } else {
  745. this.$message({
  746. message: res.msg,
  747. type: "error"
  748. });
  749. }
  750. },
  751. error => {
  752. this.$message({
  753. message: error,
  754. type: "error"
  755. });
  756. });
  757. },
  758. //显示用户详情
  759. showUser(userId) {
  760. this.userDetailVisible = true;
  761. this.http.post(this.port.manage.userDetail, {
  762. userId: userId
  763. },
  764. res => {
  765. if (res.code == "ok") {
  766. this.userDetail = res.data;
  767. } else {
  768. this.$message({
  769. message: res.msg,
  770. type: "error"
  771. });
  772. }
  773. },
  774. error => {
  775. this.$message({
  776. message: error,
  777. type: "error"
  778. });
  779. });
  780. },
  781. //选择参与人
  782. changeParticipator() {
  783. //检查是否在参与人中,如果没有需要加入到参与人中
  784. // console.log(this.addForm.userId);
  785. var find = false;
  786. this.participator = [];
  787. this.addForm.userId.forEach(u=>{
  788. var findUser = this.users.filter(au=>au.id == u)[0];
  789. this.participator.push(findUser);
  790. })
  791. },
  792. getUsers() {
  793. this.http.post(this.port.manage.list, {
  794. departmentId: -1,
  795. pageIndex: 1,
  796. pageSize: 99999
  797. },
  798. res => {
  799. if (res.code == "ok") {
  800. this.users = res.data.records;
  801. } else {
  802. this.$message({
  803. message: res.msg,
  804. type: "error"
  805. });
  806. }
  807. },
  808. error => {
  809. this.$message({
  810. message: error,
  811. type: "error"
  812. });
  813. });
  814. },
  815. addStagePost() {
  816. let param = JSON.parse(JSON.stringify(this.stageForm));
  817. param.taskList = [];
  818. this.http.post('/stages/save',param,
  819. res => {
  820. if (res.code == "ok") {
  821. this.stageList = res.data;
  822. this.addStageDialog = false;
  823. } else {
  824. this.$message({
  825. message: res.msg,
  826. type: "error"
  827. });
  828. }
  829. },
  830. error => {
  831. this.$message({
  832. message: error,
  833. type: "error"
  834. });
  835. });
  836. },
  837. //分页
  838. handleCurrentChange(val) {
  839. this.page = val;
  840. this.getList();
  841. },
  842. handleSizeChange(val) {
  843. this.size = val;
  844. this.getList();
  845. },
  846. //获取项目列表
  847. getList() {
  848. this.listLoading = true;
  849. this.http.post('/task/listByPage', {
  850. status: this.searchField,
  851. viewId: this.idx,
  852. pageIndex: this.page,
  853. pageSize: this.size,
  854. },
  855. res => {
  856. this.listLoading = false;
  857. if(res.code == 'ok') {
  858. this.list = res.data.records
  859. this.total = res.data.total
  860. } else {
  861. this.$message({
  862. message: res.msg,
  863. type: "error"
  864. });
  865. }
  866. // console.log(res)
  867. },
  868. error => {
  869. this.listLoading = false;
  870. this.$message({
  871. message: error,
  872. type: "error"
  873. });
  874. })
  875. },
  876. //显示新增界面
  877. handleAdd(i, item) {
  878. if(i == -1) {
  879. this.title = "新增任务";
  880. this.addForm = {
  881. name: '',
  882. userId: [],
  883. code:'',
  884. inchargerId:null,
  885. }
  886. } else {
  887. this.title = "修改项目";
  888. var list = item.participator , arr = [];
  889. for(var j in list) {
  890. arr.push(list[j].id)
  891. }
  892. this.addForm = {
  893. id: item.id,
  894. name: item.projectName,
  895. userId: arr,
  896. code:item.projectCode,
  897. inchargerId: item.inchargerId
  898. }
  899. this.changeParticipator();
  900. }
  901. this.addFormVisible = true;
  902. },
  903. //提交子项目创建修改请求
  904. submitInsertSubProject () {
  905. this.$refs.form2.validate(valid => {
  906. if (valid) {
  907. this.http.post('/sub-project/saveOrUpdate',this.addForm,
  908. res => {
  909. if (res.code == "ok") {
  910. this.$message({
  911. message: "操作成功",
  912. type: "success"
  913. });
  914. this.subProject(this.currentProject);
  915. this.addSubProject = false;
  916. } else {
  917. this.$message({
  918. message: res.msg,
  919. type: "error"
  920. });
  921. }
  922. },
  923. error => {
  924. this.listLoading = false;
  925. this.$message({
  926. message: error,
  927. type: "error"
  928. });
  929. }
  930. );
  931. }
  932. });
  933. },
  934. submitInsert() {
  935. this.$refs.form1.validate(valid => {
  936. if (valid) {
  937. this.addLoading = true;
  938. let formData = new FormData();
  939. formData.append("name", this.addForm.name);
  940. if(this.addForm.id != null) {
  941. formData.append("id", this.addForm.id);
  942. }
  943. if(this.addForm.userId.length != 0) {
  944. for(var j in this.addForm.userId) {
  945. formData.append("userId", this.addForm.userId[j]);
  946. }
  947. }
  948. if(this.addForm.inchargerId != null) {
  949. formData.append("inchargerId", this.addForm.inchargerId);
  950. }
  951. if(this.addForm.code != null) {
  952. formData.append("code", this.addForm.code);
  953. }
  954. this.http.uploadFile(this.port.project.add,formData,
  955. res => {
  956. this.addLoading = false;
  957. if (res.code == "ok") {
  958. this.$message({
  959. message: this.addForm.id!=null?'修改':'创建'+"成功",
  960. type: "success"
  961. });
  962. this.addFormVisible = false;
  963. this.getList();
  964. } else {
  965. this.$message({
  966. message: res.msg,
  967. type: "error"
  968. });
  969. }
  970. },
  971. error => {
  972. this.addLoading = false;
  973. this.$message({
  974. message: error,
  975. type: "error"
  976. });
  977. });
  978. }
  979. });
  980. },
  981. // 删除
  982. deletePro(i, item) {
  983. this.$confirm("确定要项目" + item.projectName + "吗?","删除项目", {
  984. confirmButtonText: "确定",
  985. cancelButtonText: "取消",
  986. type: "warning"
  987. })
  988. .then(() => {
  989. this.listLoading = true;
  990. this.http.post(this.port.project.delete,{
  991. id: item.id
  992. },
  993. res => {
  994. this.listLoading = false;
  995. if (res.code == "ok") {
  996. this.$message({
  997. message: "删除成功",
  998. type: "success"
  999. });
  1000. this.getList();
  1001. } else {
  1002. this.$message({
  1003. message: res.msg,
  1004. type: "error"
  1005. });
  1006. }
  1007. },
  1008. error => {
  1009. this.listLoading = false;
  1010. this.$message({
  1011. message: error,
  1012. type: "error"
  1013. });
  1014. }
  1015. );
  1016. })
  1017. .catch(() => {});
  1018. },
  1019. detail(i) {
  1020. this.$router.push("/list/" + this.list[i].id + "/" + this.list[i].projectName);
  1021. },
  1022. // 切换当前选项的索引
  1023. switchs(e) {
  1024. this.idx = e
  1025. this.page = 1
  1026. // console.log(this.searchField)
  1027. this.getList()
  1028. },
  1029. // 下拉框选择
  1030. hiddens() {
  1031. // console.log(this.searchField)
  1032. this.page = 1
  1033. this.getList()
  1034. },
  1035. // 完成
  1036. completes(e, el) {
  1037. this.http.post('/task/finish', {
  1038. id: e,
  1039. taskStatus: el
  1040. },
  1041. res => {
  1042. if (res.code == "ok") {
  1043. this.$message({
  1044. message: "操作成功",
  1045. type: "success"
  1046. });
  1047. this.getList();
  1048. } else {
  1049. this.$message({
  1050. message: res.msg,
  1051. type: "error"
  1052. });
  1053. }
  1054. },
  1055. error => {
  1056. this.listLoading = false;
  1057. this.$message({
  1058. message: error,
  1059. type: "error"
  1060. });
  1061. }
  1062. )
  1063. },
  1064. // 点击任务事件
  1065. editTask(task) {
  1066. // console.log(task)
  1067. this.addFormVisible = true;
  1068. // this.addLoading = false;
  1069. this.title = "编辑任务";
  1070. this.getTaskDetail(task.id);
  1071. this.getTaskProgressList(task.id); // 获取任务进展列表
  1072. this.getUsers(); // 获取名单数据
  1073. this.gain(task); // 获取评论列表
  1074. // this.getStageList()
  1075. },
  1076. getTaskDetail(id) {
  1077. this.http.post('/task/getTask',{id: id},
  1078. res => {
  1079. if (res.code == "ok") {
  1080. this.addForm = res.data;
  1081. this.addForm.createDate = null;
  1082. this.addForm.indate = null;
  1083. this.addLoading = false;
  1084. this.recentProgressInfo = this.addForm.progress;
  1085. // console.log(this.addForm, '看看数据')
  1086. } else {
  1087. this.$message({
  1088. message: res.msg,
  1089. type: "error"
  1090. });
  1091. }
  1092. },
  1093. error => {
  1094. this.$message({
  1095. message: error,
  1096. type: "error"
  1097. });
  1098. });
  1099. },
  1100. //获取任务进展列表
  1101. getTaskProgressList(taskId) {
  1102. this.taskIid = taskId
  1103. this.http.post('/task-progress/list', {taskId: taskId},
  1104. res => {
  1105. if (res.code == "ok") {
  1106. this.ProgressList = res.data;
  1107. this.recentProgressInfo = res.data[0]
  1108. } else {
  1109. this.$message({
  1110. message: res.msg,
  1111. type: "error"
  1112. });
  1113. }
  1114. }
  1115. );
  1116. },
  1117. getUsers() {
  1118. // console.log(this.port.manage.list)
  1119. this.http.post(this.port.manage.list, {
  1120. departmentId: -1,
  1121. pageIndex: 1,
  1122. pageSize: 99999
  1123. },
  1124. res => {
  1125. if (res.code == "ok") {
  1126. this.users = res.data.records;
  1127. } else {
  1128. this.$message({
  1129. message: res.msg,
  1130. type: "error"
  1131. });
  1132. }
  1133. },
  1134. error => {
  1135. this.$message({
  1136. message: error,
  1137. type: "error"
  1138. });
  1139. });
  1140. },
  1141. // 获取评论列表
  1142. gain (task) {
  1143. this.commentList = [];
  1144. this.taskId = task.id;
  1145. this.http.post('/task-comment/getList', {taskId: task.id},
  1146. res => {
  1147. if (res.code == "ok") {
  1148. this.commentList = res.data
  1149. this.sppk(this.commentList) // 获取参与人的方法
  1150. } else {
  1151. this.$message({
  1152. message: res.msg,
  1153. type: "error"
  1154. });
  1155. }
  1156. },
  1157. error => {
  1158. this.$message({
  1159. message: error,
  1160. type: "error"
  1161. });
  1162. });
  1163. },
  1164. // 获取评论参与人
  1165. sppk(comit) {
  1166. var sk = []
  1167. comit.forEach(function(e){
  1168. sk.push(e.userName)
  1169. })
  1170. this.critic = new Set(sk)
  1171. },
  1172. sss(){
  1173. this.$refs.addRem.style.display="none"
  1174. },
  1175. addprogress(){ // 添加子任务进展事件
  1176. this.$refs.proBox.style.display="block"
  1177. this.$refs.addPro.style.display="none"
  1178. },
  1179. shutPro() { // 关闭任务进展
  1180. this.$refs.addPro.style.display="block"
  1181. this.$refs.addRem.style.display="none"
  1182. this.$refs.proBox.style.display="none"
  1183. },
  1184. addI() { // 打开选择查看
  1185. this.$refs.addRem.style.display="block"
  1186. },
  1187. load() {
  1188. if(this.count >= 0) return
  1189. this.count += 2
  1190. },
  1191. onEditorFocus() {
  1192. this.onEditorBlur()
  1193. },
  1194. kkk(el){
  1195. var k = this.checkLists.indexOf(el.id)
  1196. if (k == -1) {
  1197. this.checkLists.push(el.id)
  1198. } else {
  1199. this.checkLists.splice(k, 1)
  1200. }
  1201. },
  1202. shutPro() { // 关闭任务进展
  1203. this.$refs.addPro.style.display="block"
  1204. this.$refs.addRem.style.display="none"
  1205. this.$refs.proBox.style.display="none"
  1206. },
  1207. addTaskProgress() { //创建任务进展
  1208. var param = {
  1209. taskId: this.taskIid,
  1210. status: this.radio,
  1211. content: this.text2,
  1212. participatorIds: this.checkLists.toString()
  1213. };
  1214. this.http.post('/task-progress/addProgress', param,
  1215. res => {
  1216. if (res.code == "ok") {
  1217. this.shutPro()
  1218. this.getTaskProgressList(this.taskIid)
  1219. this.$message({
  1220. message: '发布成功',
  1221. type: "success"
  1222. });
  1223. this.checkboxGrounp = [],
  1224. this.checkLists = [],
  1225. this.text2 = '',
  1226. this.radio = 0
  1227. } else {
  1228. this.$message({
  1229. message: res.msg,
  1230. type: "error"
  1231. });
  1232. }
  1233. }
  1234. );
  1235. },
  1236. //删除任务进展
  1237. deleteTaskProgress(id) {
  1238. this.http.post('/task-progress/deleteProgress', {id: id},
  1239. res => {
  1240. if (res.code == "ok") {
  1241. this.getTaskProgressList(this.taskIid)
  1242. this.$message({
  1243. message: '删除成功',
  1244. type: "success"
  1245. });
  1246. } else {
  1247. this.$message({
  1248. message: res.msg,
  1249. type: "error"
  1250. });
  1251. }
  1252. }
  1253. );
  1254. },
  1255. //显示子任务创建卡片
  1256. addSubTask() {
  1257. this.addFormVisible = true;
  1258. this.addForm = {parentTname: this.addForm.name,parentTid: this.addForm.id,projectId: this.addForm.projectId, groupId: this.addForm.groupId, taskLevel:0, planHours: 8, taskType: 0};
  1259. this.addLoading = false;
  1260. },
  1261. taskLineClick(row, column, event) {
  1262. this.editTask(row);
  1263. },
  1264. finishTask(task) {
  1265. this.http.post('/task/finish',{id: task.id, taskStatus: task.taskStatus},
  1266. res => {
  1267. if (res.code == "ok") {
  1268. if (this.groupType == 0) {
  1269. this.getStageList();
  1270. } else {
  1271. // this.getViewTaskList();
  1272. }
  1273. } else {
  1274. this.$message({
  1275. message: res.msg,
  1276. type: "error"
  1277. });
  1278. }
  1279. },
  1280. error => {
  1281. this.$message({
  1282. message: error,
  1283. type: "error"
  1284. });
  1285. });
  1286. },
  1287. //认领任务
  1288. addAsMyTask(task) {
  1289. this.http.post('/task/addAsMyTask',{id: task.id},
  1290. res => {
  1291. if (res.code == "ok") {
  1292. this.getStageList();
  1293. } else {
  1294. this.$message({
  1295. message: res.msg,
  1296. type: "error"
  1297. });
  1298. }
  1299. },
  1300. error => {
  1301. this.$message({
  1302. message: error,
  1303. type: "error"
  1304. });
  1305. });
  1306. },
  1307. timess(){
  1308. var date = new Date()
  1309. let Y = date.getFullYear()
  1310. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)
  1311. let D = date.getDate() < 10 ? ('0' + date.getDate()) : date.getDate()
  1312. this.times = `${Y}-${M}-${D}`
  1313. },
  1314. showSubTaskList(task) {
  1315. this.subTaskVisible = true;
  1316. this.addForm = task;
  1317. },
  1318. addTask(stage) {
  1319. this.addFormVisible = true;
  1320. this.addForm = {projectId: stage.projectId, groupId: stage.groupId, stagesId: stage.id, taskLevel:0, planHours: 8, taskType: 0};
  1321. this.addLoading = false;
  1322. this.title="创建任务";
  1323. this.commentList = [];
  1324. },
  1325. addStage() {
  1326. this.addStageDialog = true;
  1327. this.stageForm = {groupId: this.selectedGroup.id, projectId: this.curProjectId};
  1328. },
  1329. // 获得焦点时触发
  1330. onEditorBlur(){
  1331. let theEle = this.$refs.text; // 获取元素
  1332. var img = theEle.value.match(/<img[^>]+>/g); // 赛选 img 标签
  1333. var arrImg = ''
  1334. for (var j = 0; j < img.length; j++) {
  1335. // 正则匹配,摘出img标签下的src里的内容,即capture
  1336. img[j].replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
  1337. arrImg += capture
  1338. });
  1339. }
  1340. // 原来的字符流大小,单位为字节
  1341. var strLen = arrImg.length;
  1342. // 计算后得到的文件流大小,单位为字节
  1343. var fileSize=parseInt(strLen-(strLen/8)*2);
  1344. var size = "";
  1345. size = (fileSize/1024/1024).toFixed(2);
  1346. if (size > 2){
  1347. this.textContent = false
  1348. this.$message({
  1349. showClose: true,
  1350. message: '图片超过了2MB,请重新上传',
  1351. type: 'warning'
  1352. });
  1353. }
  1354. this.textContent = true
  1355. },
  1356. backToParentTask() {
  1357. this.getTaskDetail(this.addForm.parentTid);
  1358. },
  1359. // 点击发布
  1360. release() {
  1361. if(this.textarea2.length <= 0) return this.$message({message: "请输入内容", type: "error"})
  1362. this.http.post('/task-comment/add', {taskId: this.taskId, userId: this.user.id, content: this.textarea2},
  1363. res => {
  1364. if(res.code == "ok"){
  1365. this.commentList.push(res.data)
  1366. this.sppk(this.commentList)
  1367. this.textarea2 = ""
  1368. this.contRoll() // 滚动到底部
  1369. } else {
  1370. this.$message({
  1371. message: res.msg,
  1372. type: "error"
  1373. });
  1374. }
  1375. },
  1376. error => {
  1377. this.$message({
  1378. message: error,
  1379. type: "error"
  1380. });
  1381. })
  1382. },
  1383. // 滚动到底部
  1384. contRoll(){
  1385. this.$nextTick(() => {
  1386. this.$refs.main.scrollTop = this.$refs.contRoll.scrollHeight;
  1387. })
  1388. },
  1389. submitInsert() {
  1390. if (this.textContent !== true) return this.$message({
  1391. showClose: true,
  1392. message: '图片太大,请重新上传',
  1393. type: 'warning'
  1394. });
  1395. this.$refs.form1.validate(valid => {
  1396. if (valid) {
  1397. delete this.addForm.subTaskList;
  1398. delete this.addForm.progress;
  1399. this.http.post('/task/save',this.addForm,
  1400. res => {
  1401. if (res.code == "ok") {
  1402. this.$message({
  1403. message: "提交成功",
  1404. type: "success"
  1405. });
  1406. if (this.addForm.parentTid == null) {
  1407. this.addFormVisible = false;
  1408. if (this.groupType == 0) {
  1409. this.getStageList();
  1410. } else {
  1411. // this.getViewTaskList();
  1412. }
  1413. } else {
  1414. this.backToParentTask();
  1415. }
  1416. } else {
  1417. this.$message({
  1418. message: res.msg,
  1419. type: "error"
  1420. });
  1421. }
  1422. },
  1423. error => {
  1424. this.$message({
  1425. message: error,
  1426. type: "error"
  1427. });
  1428. }
  1429. );
  1430. }
  1431. });
  1432. },
  1433. //加载项目内的任务列表
  1434. getStageList() {
  1435. // console.log('进来了')
  1436. this.http.post('/stages/list',{groupId: this.selectedGroup.id, projectId: this.selectedGroup.projectId, order: this.order, isDesc: this.isDesc},
  1437. res => {
  1438. if (res.code == "ok") {
  1439. this.stageList = res.data;
  1440. // console.log('触发获取任务列表函数')
  1441. this.timess() // 处理时间的方法
  1442. } else {
  1443. this.$message({
  1444. message: res.msg,
  1445. type: "error"
  1446. });
  1447. }
  1448. },
  1449. error => {
  1450. this.$message({
  1451. message: error,
  1452. type: "error"
  1453. });
  1454. });
  1455. },
  1456. //删除当前编辑的任务
  1457. deleteTask() {
  1458. var warning='';
  1459. if (this.addForm.subTaskList.length > 0) {
  1460. warning='您确定要删除当前任务及其子任务吗?';
  1461. } else {
  1462. warning='您确定要删除当前任务吗?';
  1463. }
  1464. this.$confirm(warning, "提示", {
  1465. //type: 'warning'
  1466. }).then(() => {
  1467. this.http.post('/task/delete',{id: this.addForm.id},
  1468. res => {
  1469. if (res.code == "ok") {
  1470. this.addFormVisible = false;
  1471. // this.getStageList();
  1472. this.getList();
  1473. } else {
  1474. this.$message({
  1475. message: res.msg,
  1476. type: "error"
  1477. });
  1478. }
  1479. },
  1480. error => {
  1481. this.$message({
  1482. message: error,
  1483. type: "error"
  1484. });
  1485. });
  1486. });
  1487. },
  1488. chan() {
  1489. // console.log(this.critic)
  1490. }
  1491. },
  1492. created() {
  1493. let height = window.innerHeight;
  1494. this.tableHeight = height - 195;
  1495. const that = this;
  1496. window.onresize = function temp() {
  1497. that.tableHeight = window.innerHeight - 195;
  1498. };
  1499. },
  1500. mounted() {
  1501. this.getList();
  1502. this.getUsers();
  1503. },
  1504. };
  1505. </script>
  1506. <style lang="scss" scoped>
  1507. // .classification {
  1508. // width: 120px;
  1509. // // height: 100%;
  1510. // border-right: 1px solid #f2f2f2;
  1511. // display: flex;
  1512. // flex-wrap: wrap;
  1513. // // align-items: center;
  1514. // // justify-content: center;
  1515. // padding-top: 20px;
  1516. // }
  1517. // .classification p{
  1518. // width: 120px;
  1519. // text-align: center;
  1520. // line-height: 50px;
  1521. // margin: 0;
  1522. // cursor: pointer;
  1523. // }
  1524. // .classification p:hover {
  1525. // background: #dddddd;
  1526. // }
  1527. // .on {
  1528. // // background: #dddddd;
  1529. // color: #409EFF;
  1530. // }
  1531. // .acl{
  1532. // display: inline-block;
  1533. // width: 300px;
  1534. // height: 22px;
  1535. // // line-height: 22px;
  1536. // overflow: hidden;
  1537. // white-space: nowrap;
  1538. // text-overflow: ellipsis;
  1539. // margin: 0;
  1540. // padding: 0;
  1541. // line-height: 0;
  1542. // }
  1543. // .cal {
  1544. // width: 300px;
  1545. // overflow: hidden;
  1546. // white-space: nowrap;
  1547. // text-overflow: ellipsis;
  1548. // cursor: pointer;
  1549. // }
  1550. </style>