list.vue 69 KB

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