list.vue 73 KB

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