list.vue 71 KB

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