list.vue 82 KB

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