list.vue 72 KB

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