list.vue 69 KB

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