list.vue 69 KB

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