projectInside.vue 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479
  1. <template>
  2. <section>
  3. <el-tabs v-model="activeName" @tab-click="handleClick">
  4. <el-tab-pane label="主要内容" name="project" @click="null" disabled=true>
  5. <template slot="label">
  6. <el-button type="default" size="mini" icon="el-icon-arrow-left" @click="toList" style="margin-left:10px;">项目列表</el-button>
  7. <el-select v-model="curProjectId" size="mini" class="projectCls" @change="onProjectChange">
  8. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  9. </el-select>
  10. <el-dropdown trigger="click" style="margin-right:30px;color:#262626;cursor:pointer;">
  11. <i class="iconfont firerock-iconcaidan" ></i>
  12. <el-dropdown-menu slot="dropdown">
  13. <el-dropdown-item v-if="currentProject.status == 1" @click.native="finishPro()">
  14. <i class="iconfont firerock-iconwancheng"></i>完成项目
  15. </el-dropdown-item>
  16. <el-dropdown-item divided v-if="currentProject.status == 1" @click.native="cancelPro()">
  17. <i class="el-icon-refresh-left"></i>撤销项目
  18. </el-dropdown-item>
  19. <el-dropdown-item v-if="currentProject.status == 2 || currentProject.status == 3" @click.native="startPro()">
  20. <i class="iconfont firerock-iconqidong"></i>重启项目
  21. </el-dropdown-item>
  22. </el-dropdown-menu>
  23. </el-dropdown>
  24. </template>
  25. </el-tab-pane>
  26. <el-tab-pane label="任务看板" name="projectInside">
  27. <el-container style="padding: 0px;">
  28. <!-- <el-aside :style="'padding-left:10px;padding-right:5px;height:'+tableHeight+'px;width:'+groupWidth+'px;'"> -->
  29. <el-aside :style="'height:'+tableHeight+'px;width:'+groupWidth+'px;'">
  30. <div class="task">
  31. <el-input v-model="groupSearch" size="small" placeholder="搜索分组" @input="startSearchGroup" style="margin-top:10px"/>
  32. <p ><span class="heavyTxt">任务分组</span> <i class="el-icon-plus pull-right" style="color:#666;margin-right:10px;" @click="createGroup"></i></p>
  33. <el-menu :default-active="defaultGroupId" class="el-menu-vertical-demo" @select="groupChange" style="border-right:none;">
  34. <el-menu-item :index="item.id" v-for="item in groupList" :key="item.id" class="group_style">
  35. <div slot="title">
  36. <span >{{item.name}}</span>
  37. <el-dropdown trigger="click" style="float:right;margin-right:-10px;">
  38. <i class="iconfont firerock-iconcaidan" ></i>
  39. <el-dropdown-menu slot="dropdown">
  40. <el-dropdown-item @click.native="copyGroup(item)">
  41. <i class="el-icon-document-copy"></i>
  42. 复制分组</el-dropdown-item>
  43. <el-dropdown-item divided @click.native="renameGroup(item)">
  44. <i class="el-icon-edit"></i>
  45. 修改组名</el-dropdown-item>
  46. <el-dropdown-item divided @click.native="deleteGroup(item)">
  47. <i class="el-icon-delete"></i>删除分组</el-dropdown-item>
  48. </el-dropdown-menu>
  49. </el-dropdown>
  50. </div>
  51. </el-menu-item>
  52. </el-menu>
  53. <!--视图 -->
  54. <p ><span class="heavyTxt">视图</span></p>
  55. <el-menu :default-active="1" class="el-menu-vertical-demo" @select="viewChange" style="border-right:none;">
  56. <el-menu-item :index="item.id" v-for="item in viewList" :key="item.id" class="group_style">
  57. <div slot="title">
  58. <span >{{item.name}}</span>
  59. </div>
  60. </el-menu-item>
  61. </el-menu>
  62. </div>
  63. </el-aside>
  64. <span :style="'background:#f0f0f0;width:1px;height:'+tableHeight+'px;'" @click="toggleGroup">
  65. </span>
  66. <!-- <span :style="'width:10px;height:'+tableHeight+'px;float:left;text-align:center;vertical-align:middle;'" @click="toggleGroup">
  67. <span :style="'width:1px;background:#20A0FF;height:'+tableHeight+'px;float:left;'"></span>
  68. <i class="el-icon-d-arrow-left" ></i>
  69. </span> -->
  70. <!-- 增加侧边栏的点击效果 -->
  71. <div class="sidebar" @click="retract()">
  72. <div class="etui">
  73. <i class="el-icon-arrow-left" ref="box"></i>
  74. </div>
  75. </div>
  76. <el-main style="background:#f7f7f7;padding:0px;">
  77. <el-row style="color:#999;margin-top:10px;padding: 0px 10px;">
  78. <el-col :span="20">
  79. <el-link @click="toggleGroup"><i v-if="selectedGroup != null" :class="groupWidth==0?'el-icon-d-arrow-right':'el-icon-d-arrow-left'" style="margin-top:10px;">{{selectedGroup.name}}</i></el-link>
  80. </el-col>
  81. <el-col :span="4">
  82. <el-select v-model="order" size="small" style="background:#fff;display:inline-block;" @change="orderChange">
  83. <el-option v-for="item in orderList" :key="item.id" :label="item.name" :value="item.id">
  84. <span>{{item.name}}</span>
  85. </el-option>
  86. </el-select>
  87. </el-col>
  88. </el-row>
  89. <!-- <div style="color:#999;margin-top:10px;">
  90. <i v-if="selectedGroup != null" class="el-icon-arrow-left" style="margin-top:10px;">{{selectedGroup.name}}</i>
  91. </div> -->
  92. <div v-if="!displayTable">
  93. <draggable style="overflow-x:auto;white-space:nowrap;" @update="onMoveStage"
  94. v-model="stageList" group="stage" @start="stageDrag=true" @end="stageDrag=false;" draggable=".taskStage" >
  95. <!--每个阶段的拖拽 -->
  96. <!-- <transition-group > -->
  97. <v-flex class="taskStage" v-for="stage in stageList" :key="stage.id" :style="'height:'+stageListHeight+'px;'">
  98. <draggable group="task"
  99. class="taskList"
  100. :id="stage.id"
  101. dragClass="dragClass"
  102. ghostClass="ghost"
  103. @start="drag=true" @end="drag=false"
  104. @update="onChange" @add="onChange"
  105. draggable=".taskCard">
  106. <!--头部显示阶段名称,操作 -->
  107. <div slot="header" style="margin:10px 0px;cursor:move;" role="task">
  108. <span class="stage">{{stage.stagesName}}</span><span style="margin-left:10px;color:#303133;font-size:12px;">{{stage.taskList.length}}</span>
  109. <!-- <i class="el-icon-more" style="float:right;"></i> -->
  110. <el-dropdown trigger="click" style="float:right;cursor:pointer;">
  111. <i class="el-icon-more" ></i>
  112. <el-dropdown-menu slot="dropdown">
  113. <el-dropdown-item @click.native="renameStage(stage)">
  114. <i class="el-icon-edit"></i>
  115. 重命名列表</el-dropdown-item>
  116. <el-dropdown-item divided @click.native="deleteStage(stage)">
  117. <i class="el-icon-delete"></i>删除列表</el-dropdown-item>
  118. </el-dropdown-menu>
  119. </el-dropdown>
  120. </div>
  121. <div v-for="element in stage.taskList" :id="element.id" :key="element.id" class="taskCard" @click="editTask(element)" :style="element.taskStatus==0?'':'background:#eFeFeF;'">
  122. <!--任务卡片内容显示 -->
  123. <div>
  124. <el-checkbox :disabled="element.taskStatus==2 || element.subTaskList.length > element.subTaskFinishNum" :checked="element.taskStatus==1?true:false" size="large" class="cb"
  125. @change="finishTask(element)"
  126. @click.stop.native=""
  127. ></el-checkbox>
  128. <el-tooltip class="item" effect="dark" :content="element.name" placement="top">
  129. <label class="task_name" :style="'background:'+(element.taskStatus==0?'#ffffff;':'#eFeFeF;')">{{element.name}}</label>
  130. </el-tooltip>
  131. <span v-if="element.executorName != null" :style="'background:'+element.executorColor" class="user_name_icon">{{element.executorName.length>2?element.executorName.substring(element.executorName.length-2, element.executorName.length):element.executorName}}</span>
  132. <el-button v-if="element.executorName == null" type="primary" @click.stop.native="addAsMyTask(element)" size="mini" style="float:right;width:38px;padding:5px;">认领</el-button>
  133. </div>
  134. <div style="margin: 10px 0px;color:#666;">
  135. <i v-if="element.endDate != null" class="el-icon-date">&nbsp;&nbsp;{{element.endDate}}</i>
  136. <i :class="taskTypeIcon[element.taskType]" :style="'float:right;color:'+taskTypeColor[element.taskType]+';margin-right:5px;'" ></i>
  137. </div>
  138. <!--子任务 -->
  139. <div v-if="element.subTaskList.length > 0">
  140. <el-tooltip class="item" effect="dark" content="查看子任务" placement="top">
  141. <el-link class="sub_task_num" @click.stop.native="showSubTaskList(element)"><i class="iconfont firerock-icontree" ></i><span style="margin-left:5px;">{{element.subTaskFinishNum}}/{{element.subTaskList.length}}</span></el-link>
  142. </el-tooltip>
  143. </div>
  144. </div>
  145. <el-button slot="footer" role="people" @click="addTask(stage)" style="width:100%;" size="small" icon="el-icon-plus"></el-button>
  146. </draggable>
  147. </v-flex>
  148. <!-- </transition-group > -->
  149. <el-button slot="footer" v-if="selectedGroup != null" @click="addStage" class="taskList" icon="el-icon-plus" style="margin-top:30px;">新建任务列表</el-button>
  150. </draggable>
  151. </div>
  152. <!--列表-->
  153. <el-table v-if="displayTable" :data="taskDataList"
  154. :header-cell-style="{'font-weight':'normal'}"
  155. highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;margin-top:10px;" @row-click="taskLineClick">
  156. <el-table-column fixed label="完成" width="50">
  157. <template slot-scope="scope">
  158. <el-checkbox :disabled="scope.row.taskStatus==2" v-model="scope.row.isFinish" size="large" class="cb"
  159. @change="finishTask(scope.row)"
  160. @click.stop.native=""
  161. ></el-checkbox>
  162. </template>
  163. </el-table-column>
  164. <el-table-column prop="name" fixed label="标题" width="250">
  165. <template slot-scope="scope">
  166. <el-tooltip class="item" effect="dark" :content="scope.row.name" placement="top">
  167. <span class="single_line" > {{scope.row.name}}</span>
  168. </el-tooltip>
  169. </template>
  170. </el-table-column>
  171. <el-table-column prop="taskType" label="任务类型" width="100">
  172. <template slot-scope="scope">
  173. {{taskTypeList[scope.row.taskType].name}}
  174. </template>
  175. </el-table-column>
  176. <el-table-column prop="taskStatus" label="任务状态" width="100" >
  177. <template slot-scope="scope">
  178. {{taskStatusList[scope.row.taskStatus]}}
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="parentName" label="父任务" width="250">
  182. <template slot-scope="scope">
  183. <span style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;"> {{scope.row.parentTname}}</span>
  184. </template>
  185. </el-table-column>
  186. <el-table-column prop="stagesName" label="任务列表" width="100" >
  187. </el-table-column>
  188. <el-table-column prop="executorName" label="执行人" width="100" >
  189. <template slot-scope="scope">
  190. {{scope.row.executorName == null?"待分配":scope.row.executorName}}
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="createDate" label="创建时间" width="100" ></el-table-column>
  194. <el-table-column prop="endDate" label="截止时间" width="100" ></el-table-column>
  195. <el-table-column prop="taskLevel" label="优先级" width="100" >
  196. <template slot-scope="scope">
  197. {{importanceList[scope.row.taskLevel].name}}
  198. </template>
  199. </el-table-column>
  200. </el-table>
  201. </el-main>
  202. </el-container>
  203. </el-tab-pane>
  204. <el-tab-pane label="文件中心" name="files"><FileCenter ref="fileCenter"></FileCenter></el-tab-pane>
  205. <el-tab-pane label="项目概览" name="info"><ProjectInfo ref="projectInfo"></ProjectInfo></el-tab-pane>
  206. <el-tab-pane label="数据统计" name="summary"><Summary ref="summary"></Summary></el-tab-pane>
  207. </el-tabs>
  208. <!--新增任务界面-->
  209. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="800px">
  210. <el-form ref="form1" :model="addForm" :rules="taskRules" label-width="100px">
  211. <!--子任务需要选择任务列表 -->
  212. <el-form-item label="任务列表" prop="stages" v-if="addForm.parentTid != null">
  213. <el-select v-model="addForm.stagesId" style="width:100%;" >
  214. <el-option v-for="item in stageList" :key="item.id" :label="item.stagesName" :value="item.id"></el-option>
  215. </el-select>
  216. </el-form-item>
  217. <el-form-item label="类型">
  218. <el-select v-model="addForm.taskType" style="width:100%;" >
  219. <el-option v-for="item in taskTypeList" :key="item.id" :label="item.name" :value="item.id">
  220. <i :class="item.icon" ></i>
  221. <span>{{item.name}}</span>
  222. </el-option>
  223. </el-select>
  224. </el-form-item>
  225. <el-form-item label="任务内容" prop="name">
  226. <el-input v-model="addForm.name" placeholder="请输入任务内容" clearable></el-input>
  227. </el-form-item>
  228. <el-form-item label="执行人">
  229. <el-select v-model="addForm.executorId" filterable placeholder="请选择执行人" style="width:100%;" >
  230. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  231. </el-select>
  232. </el-form-item>
  233. <el-form-item label="截止时间" prop="endDate">
  234. <el-date-picker v-model="addForm.endDate" type="date" style="width:40%;" value-format="yyyy-MM-dd" placeholder="请选择日期" ></el-date-picker>
  235. <span style="margin-left:30px;margin-right:10px;">计划工时</span><el-input-number v-model="addForm.planHours" style="width:30%;" :min="1" :max="100" placeholder="请输入计划工作时长,单位小时" ></el-input-number ><span style="margin-left:10px;">小时</span>
  236. </el-form-item>
  237. <el-form-item label="优先级">
  238. <el-select v-model="addForm.taskLevel" style="width:100%;" >
  239. <el-option v-for="item in importanceList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  240. </el-select>
  241. </el-form-item>
  242. <el-form-item label="详细描述" >
  243. <!-- <Editor id="tinymce" v-model="tinymceHtml" :init="editorInit"></Editor> -->
  244. <el-input type="textarea" v-model="addForm.taskDesc" :rows="3"></el-input>
  245. </el-form-item>
  246. <div v-if="addForm.id != null">
  247. <el-divider ></el-divider>
  248. <p ><i class="iconfont firerock-icontree" style="color:#20A0ff;margin-left:10px;">子任务</i>
  249. <el-link style="float:right;" @click="addSubTask">添加子任务</el-link>
  250. </p>
  251. <!--子任务列表 -->
  252. <el-table :data="addForm.subTaskList"
  253. :header-cell-style="{'font-weight':'normal'}"
  254. highlight-current-row v-loading="listLoading" style="width: 100%;margin-top:10px;" @row-click="taskLineClick">
  255. <el-table-column prop="taskStatus" label="完成" width="50" >
  256. <template slot-scope="scope">
  257. <el-checkbox :disabled="scope.row.taskStatus==2" :checked="scope.row.taskStatus==1?true:false" size="large" class="cb"
  258. @click.stop.native=""
  259. @change="finishTask(scope.row)"
  260. ></el-checkbox>
  261. </template>
  262. </el-table-column>
  263. <el-table-column prop="name" label="标题" >
  264. <template slot-scope="scope">
  265. <el-tooltip class="item" effect="dark" :content="scope.row.name" placement="top">
  266. <span style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;" > {{scope.row.name}}</span>
  267. </el-tooltip>
  268. </template>
  269. </el-table-column>
  270. <el-table-column prop="executorName" label="执行人" width="100" >
  271. <template slot-scope="scope">
  272. {{scope.row.executorName == null?"待分配":scope.row.executorName}}
  273. </template>
  274. </el-table-column>
  275. <el-table-column prop="endDate" label="截止时间" width="100" ></el-table-column>
  276. </el-table>
  277. </div>
  278. </el-form>
  279. <div slot="footer" class="dialog-footer">
  280. <el-button @click.native="deleteTask" style="float:left;">删除</el-button>
  281. <el-button @click.native="addFormVisible = false">取消</el-button>
  282. <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
  283. </div>
  284. <div slot="title" v-if="addForm.parentTid != null" >
  285. <!-- <el-link @click="backToParentTask"><i class="el-icon-arrow-left single_line">返回父级任务</i> | {{addForm.parentTname}}</el-link> -->
  286. <el-page-header @back="backToParentTask" title="返回父任务" :content="addForm.parentTname"></el-page-header>
  287. </div>
  288. </el-dialog>
  289. <!-- 子任务列表 -->
  290. <el-dialog title="查看子任务" v-if="subTaskVisible" :visible.sync="subTaskVisible" :close-on-click-modal="false" customClass="customWidth" width="800px">
  291. <el-table :data="addForm.subTaskList"
  292. :header-cell-style="{'font-weight':'normal'}"
  293. highlight-current-row v-loading="listLoading" style="width: 100%;margin-top:10px;" @row-click="taskLineClick">
  294. <el-table-column prop="taskStatus" label="完成" width="50" >
  295. <template slot-scope="scope">
  296. <el-checkbox :disabled="scope.row.taskStatus==2" :checked="scope.row.taskStatus==1?true:false" size="large" class="cb"
  297. @click.stop.native="finishTask(scope.row)"
  298. ></el-checkbox>
  299. </template>
  300. </el-table-column>
  301. <el-table-column prop="name" label="标题" >
  302. <template slot-scope="scope">
  303. <el-tooltip class="item" effect="dark" :content="scope.row.name" placement="top">
  304. <span style="overflow: hidden;text-overflow:ellipsis;white-space: nowrap;" > {{scope.row.name}}</span>
  305. </el-tooltip>
  306. </template>
  307. </el-table-column>
  308. <el-table-column prop="executorName" label="执行人" width="100" >
  309. <template slot-scope="scope">
  310. {{scope.row.executorName == null?"待分配":scope.row.executorName}}
  311. </template>
  312. </el-table-column>
  313. <el-table-column prop="endDate" label="截止时间" width="100" ></el-table-column>
  314. </el-table>
  315. </el-dialog>
  316. <!--用户详细信息弹出框-->
  317. <el-dialog title="查看详情" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  318. <div class="line"><span>姓名</span><span>{{userDetail.name}}</span></div>
  319. <div class="line"><span>手机号码</span><span>{{userDetail.phone}}</span></div>
  320. <div class="line"><span>部门</span><span>{{userDetail.departmentName}}</span></div>
  321. <div class="line"><span>成本</span><span>{{userDetail.cost}}元/小时</span></div>
  322. <div slot="footer" class="dialog-footer">
  323. <el-button type="primary" @click="userDetailVisible = false" >确定</el-button>
  324. </div>
  325. </el-dialog>
  326. <!-- 新增任务分组弹出框 -->
  327. <el-dialog v-if="addGroupDialog" :visible.sync="addGroupDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  328. <div slot="title" >
  329. <el-tabs v-model="createGroupWay">
  330. <el-tab-pane label="新建分组" name="new">
  331. <el-form ref="form2" :model="groupForm" :rules="rules" style="margin-top:40px;">
  332. <el-form-item prop="name">
  333. <el-input v-model="groupForm.name" placeholder="请输入分组名称" maxlength="12"
  334. show-word-limit clearable></el-input>
  335. </el-form-item>
  336. <el-button type="primary" @click="addGroup" style="width:100%;" >创建</el-button>
  337. </el-form>
  338. </el-tab-pane>
  339. <el-tab-pane label="从模板创建" name="template">
  340. <el-card class="template_box" :style="t.selected?'border: 1px solid #409eff;':''" v-for="(t,tIndex) in groupTemplateList" :key="t.id" @click.native="choseTemplate(tIndex)">
  341. <el-row >
  342. <el-col :span="22">
  343. <div >{{t.name}}</div>
  344. <div style="margin-top:10px;"><span style="color:#8c8c8c;font-size:12px;" v-for="(s,index) in t.stagesList" :key="s.id">
  345. <i class="el-icon-arrow-right" v-if="index>0"></i>
  346. {{s.stagesName}}</span></div>
  347. </el-col>
  348. <el-col :span="2">
  349. <i class="el-icon-check" v-if="t.selected" style="font-size:20px;color:#409eff;margin-top:12px;"></i>
  350. </el-col>
  351. </el-row>
  352. </el-card>
  353. <el-button type="primary" @click="addTemplateGroup" style="width:100%;" >创建</el-button>
  354. </el-tab-pane>
  355. </el-tabs>
  356. </div>
  357. </el-dialog>
  358. <el-dialog title="修改任务分组" v-if="modGroupDialog" :visible.sync="modGroupDialog" :close-on-click-modal="false" customClass="customWidth" width="300px">
  359. <el-form ref="form2" :model="groupForm" :rules="rules" style="margin-top:10px;">
  360. <el-form-item prop="name">
  361. <el-input v-model="groupForm.name" placeholder="请输入分组名称" maxlength="12"
  362. show-word-limit clearable></el-input>
  363. </el-form-item>
  364. </el-form>
  365. <div slot="footer" class="dialog-footer">
  366. <el-button type="primary" @click="addGroup" style="width:100%;" >保存</el-button>
  367. </div>
  368. </el-dialog>
  369. <!-- 新增任务列表弹出框 -->
  370. <el-dialog title="新增/修改任务列表" v-if="addStageDialog" :visible.sync="addStageDialog" :close-on-click-modal="false" customClass="customWidth" width="300px">
  371. <el-form ref="form2" :model="stageForm" :rules="rules2" >
  372. <el-form-item prop="stagesName">
  373. <el-input v-model="stageForm.stagesName" placeholder="请输入任务列表名称" maxlength="12"
  374. show-word-limit clearable></el-input>
  375. </el-form-item>
  376. </el-form>
  377. <div slot="footer" class="dialog-footer">
  378. <el-button type="primary" @click="addStagePost" style="width:100%;" >保存</el-button>
  379. </div>
  380. </el-dialog>
  381. </section>
  382. </template>
  383. <script>
  384. import util from "../../common/js/util";
  385. import draggable from 'vuedraggable';
  386. import tinymce from 'tinymce/tinymce'
  387. import 'tinymce/themes/silver/theme'
  388. import 'tinymce/skins/ui/oxide/skin.css';
  389. import FileCenter from './fileCenter.vue';
  390. import ProjectInfo from './info.vue';
  391. import Summary from './summary.vue';
  392. // import editor from '@tinymce/tinymce-vue'
  393. let id=1;
  394. export default {
  395. name: "two-list-headerslots",
  396. display: "Two list header slot",
  397. order: 14,
  398. components: {
  399. draggable,
  400. // editor,
  401. FileCenter,
  402. ProjectInfo,
  403. Summary,
  404. },
  405. data() {
  406. return {
  407. editorInit: {
  408. language_url: '/static/tinymce/zh_CN.js',
  409. language: 'zh_CN',
  410. skin_url: '/static/tinymce/skins/lightgray',
  411. height: 300,
  412. branding: false, // 是否禁用“Powered by TinyMCE”
  413. menubar: true, // 顶部菜单栏显示
  414. plugins: 'link lists image code table colorpicker textcolor wordcount contextmenu',
  415. toolbar: 'bold italic underline strikethrough | fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote | undo redo | link unlink image code | removeformat'
  416. },
  417. groupTemplateList:[],
  418. createGroupWay:'new',
  419. modGroupDialog:false,
  420. subTaskVisible:false,
  421. orderList:[{id:"seq",name:"手动拖拽顺序",isDesc:false},{id:"create_date",name:"创建时间最晚",isDesc:true},
  422. {id:"end_date",name:"截止时间最晚",isDesc:true},
  423. {id:"task_level",name:"优先级最高",isDesc:true}],
  424. order:"seq",
  425. isDesc:true,
  426. taskDataList:[],
  427. displayTable: false,
  428. viewList: [{id:1,name:"全部任务"},{id:2,name:"进行中的任务"},{id:3,name:"已完成的任务"},{id:4,name:"待安排任务"},
  429. {id:5,name:"我创建的任务"},{id:6,name:"我执行的任务"},{id:7,name:"今天的任务"},{id:8,name:"已超期的任务"}],
  430. importanceList:[{id:0,name:"一般"},{id:1,name:"重要"},{id:2,name:"紧急"},],
  431. taskTypeList:[{id:0,name:"任务", icon:"iconfont firerock-iconrenwu"},{id:1,name:"里程碑",icon:"iconfont firerock-iconicon-"},{id:2,name:"风险",icon:"iconfont firerock-iconfengxian"}],
  432. taskTypeColor:['#20A0FF','#8613ad','#bf0404'],
  433. taskTypeIcon:['iconfont firerock-iconrenwu','iconfont firerock-iconicon-','iconfont firerock-iconfengxian'],
  434. taskStatusList:['进行中','已完成','已撤销'],
  435. //优先级
  436. taskLevelColor:['#262626','#E6A23C','#F56C6C'],
  437. stageListHeight:0,
  438. groupWidth:260,
  439. drag: false,
  440. stageDrag: false,
  441. dragging: false,
  442. stageList:[],
  443. selectedGroup:{},
  444. allGroupData:[],
  445. defaultGroupId:null,
  446. addGroupDialog: false,
  447. addStageDialog: false,
  448. groupSearch:null,
  449. groupType:0,//0-分组,1-视图
  450. groupList: [],
  451. groupForm:{},
  452. stageForm:[],
  453. curProjectId:null,
  454. projectList:null,
  455. activeIndex:"1",
  456. activeName:"projectInside",
  457. searchField:null,
  458. keyword:null,
  459. user: JSON.parse(sessionStorage.getItem("user")),
  460. userDetailVisible: false,
  461. userDetail:{},
  462. date: new Date(),
  463. users: [],
  464. tableHeight: 0,
  465. listLoading: false,
  466. subProjectVisible: false,
  467. subProjectList: [],//子项目列表
  468. currentProject:{},
  469. addSubProject: false,
  470. addFormVisible: false,
  471. addLoading: false,
  472. title: "",
  473. addForm: {
  474. name: '',
  475. },
  476. rules: {
  477. name: [{ required: true, message: "请输入分组名称", trigger: "blur" }],
  478. },
  479. rules2: {
  480. stagesName: [{ required: true, message: "请输入任务列表名称", trigger: "blur" }],
  481. },
  482. taskRules : {
  483. name: [{ required: true, message: "请输入任务内容", trigger: "blur" }],
  484. }
  485. };
  486. },
  487. methods: {
  488. // 侧边栏的点击事件
  489. retract() {
  490. if (this.$refs.box.className == 'el-icon-arrow-left') {
  491. this.$refs.box.className = 'el-icon-arrow-right'
  492. } else {
  493. this.$refs.box.className = 'el-icon-arrow-left'
  494. }
  495. // this.$refs.box.className === 'el-icon-arrow-left' ? this.$refs.box.className = 'el-icon-arrow-right' || this.$refs.box.className = 'el-icon-arrow-left'
  496. this.toggleGroup()
  497. },
  498. //
  499. choseTemplate(tIndex) {
  500. this.groupTemplateList.forEach(g=>{
  501. g.selected = false;
  502. })
  503. this.groupTemplateList[tIndex].selected = true;
  504. },
  505. //获取分组模板列表
  506. getGroupTemplate() {
  507. this.http.post('/group-template/getList',{},
  508. res => {
  509. if (res.code == "ok") {
  510. this.groupTemplateList = res.data;
  511. this.groupTemplateList[0].selected = true;
  512. } else {
  513. this.$message({
  514. message: res.msg,
  515. type: "error"
  516. });
  517. }
  518. },
  519. error => {
  520. this.$message({
  521. message: error,
  522. type: "error"
  523. });
  524. });
  525. },
  526. copyGroup(item) {
  527. this.http.post('/task-group/copy',{id: item.id},
  528. res => {
  529. if (res.code == "ok") {
  530. this.getTaskGroups();
  531. } else {
  532. this.$message({
  533. message: res.msg,
  534. type: "error"
  535. });
  536. }
  537. },
  538. error => {
  539. this.$message({
  540. message: error,
  541. type: "error"
  542. });
  543. });
  544. },
  545. //重启项目
  546. startPro() {
  547. this.http.post('/project/start',{id: this.curProjectId},
  548. res => {
  549. if (res.code == "ok") {
  550. this.$message({
  551. message: '重启成功',
  552. type: "success"
  553. });
  554. this.currentProject.status = 1;
  555. } else {
  556. this.$message({
  557. message: res.msg,
  558. type: "error"
  559. });
  560. }
  561. },
  562. error => {
  563. this.$message({
  564. message: error,
  565. type: "error"
  566. });
  567. });
  568. },
  569. //撤销项目
  570. cancelPro() {
  571. this.http.post('/project/cancel',{id: this.curProjectId},
  572. res => {
  573. if (res.code == "ok") {
  574. this.$message({
  575. message: '撤销成功',
  576. type: "success"
  577. });
  578. this.currentProject.status = 3;
  579. } else {
  580. this.$message({
  581. message: res.msg,
  582. type: "error"
  583. });
  584. }
  585. },
  586. error => {
  587. this.$message({
  588. message: error,
  589. type: "error"
  590. });
  591. });
  592. },
  593. //完成项目
  594. finishPro() {
  595. this.http.post('/project/finish',{id: this.curProjectId},
  596. res => {
  597. if (res.code == "ok") {
  598. this.$message({
  599. message: '项目完成',
  600. type: "success"
  601. });
  602. this.currentProject.status = 2;
  603. } else {
  604. this.$message({
  605. message: res.msg,
  606. type: "error"
  607. });
  608. }
  609. },
  610. error => {
  611. this.$message({
  612. message: error,
  613. type: "error"
  614. });
  615. });
  616. },
  617. //删除当前编辑的任务
  618. deleteTask() {
  619. var warning='';
  620. if (this.addForm.subTaskList.length > 0) {
  621. warning='您确定要删除当前任务及其子任务吗?';
  622. } else {
  623. warning='您确定要删除当前任务吗?';
  624. }
  625. this.$confirm(warning, "提示", {
  626. //type: 'warning'
  627. }).then(() => {
  628. this.http.post('/task/delete',{id: this.addForm.id},
  629. res => {
  630. if (res.code == "ok") {
  631. this.addFormVisible = false;
  632. this.getStageList();
  633. } else {
  634. this.$message({
  635. message: res.msg,
  636. type: "error"
  637. });
  638. }
  639. },
  640. error => {
  641. this.$message({
  642. message: error,
  643. type: "error"
  644. });
  645. });
  646. });
  647. },
  648. //tab页签切换
  649. handleClick(tab, event) {
  650. let pathModel = tab.name;
  651. this.$router.push('/'+pathModel+'/'+this.curProjectId);
  652. if (pathModel == 'summary') {
  653. //刷新页面
  654. this.$router.go(0);
  655. }
  656. },
  657. showSubTaskList(task) {
  658. this.subTaskVisible = true;
  659. this.addForm = task;
  660. },
  661. backToParentTask() {
  662. this.getTaskDetail(this.addForm.parentTid);
  663. },
  664. //显示子任务创建卡片
  665. addSubTask() {
  666. this.addFormVisible = true;
  667. this.addForm = {parentTname: this.addForm.name,parentTid: this.addForm.id,projectId: this.addForm.projectId, groupId: this.addForm.groupId, taskLevel:0, planHours: 8, taskType: 0};
  668. this.addLoading = false;
  669. },
  670. //认领任务
  671. addAsMyTask(task) {
  672. this.http.post('/task/addAsMyTask',{id: task.id},
  673. res => {
  674. if (res.code == "ok") {
  675. this.getStageList();
  676. } else {
  677. this.$message({
  678. message: res.msg,
  679. type: "error"
  680. });
  681. }
  682. },
  683. error => {
  684. this.$message({
  685. message: error,
  686. type: "error"
  687. });
  688. });
  689. },
  690. taskLineClick(row, column, event) {
  691. this.editTask(row);
  692. },
  693. //排序发生改变
  694. orderChange() {
  695. if (this.groupType == 0) {
  696. this.getStageList();
  697. } else {
  698. this.getViewTaskList();
  699. }
  700. },
  701. //加载视图任务列表
  702. getViewTaskList() {
  703. this.http.post('/task/list',{projectId: this.curProjectId, viewId: this.selectedGroup.id, order: this.order, isDesc: this.isDesc},
  704. res => {
  705. if (res.code == "ok") {
  706. this.taskDataList = res.data;
  707. this.taskDataList.forEach(t=>{
  708. t.isFinish = t.taskStatus==1?true:false;
  709. });
  710. } else {
  711. this.$message({
  712. message: res.msg,
  713. type: "error"
  714. });
  715. }
  716. },
  717. error => {
  718. this.$message({
  719. message: error,
  720. type: "error"
  721. });
  722. });
  723. },
  724. //阶段拖拽
  725. onMoveStage(e) {
  726. var data = {
  727. groupId:this.selectedGroup.id,
  728. oldIndex: e.oldIndex,
  729. newIndex: e.newIndex,};
  730. this.http.post('/stages/changeStageOrder',data,
  731. res => {
  732. if (res.code == "ok") {
  733. this.getStageList();
  734. } else {
  735. this.$message({
  736. message: res.msg,
  737. type: "error"
  738. });
  739. }
  740. },
  741. error => {
  742. this.$message({
  743. message: error,
  744. type: "error"
  745. });
  746. });
  747. },
  748. onChange(e) {
  749. var data = {
  750. id:e.item.id,
  751. oldIndex: e.oldIndex -1,
  752. newIndex: e.newIndex -1,
  753. oldStagesId: e.from.id,
  754. newStagesId: e.to.id};
  755. this.http.post('/task/changeOrder',data,
  756. res => {
  757. if (res.code == "ok") {
  758. this.getStageList();
  759. } else {
  760. this.$message({
  761. message: res.msg,
  762. type: "error"
  763. });
  764. }
  765. },
  766. error => {
  767. this.$message({
  768. message: error,
  769. type: "error"
  770. });
  771. });
  772. },
  773. toggleGroup() {
  774. if (this.groupWidth == 0) {
  775. this.groupWidth = 260;
  776. } else {
  777. this.groupWidth = 0;
  778. }
  779. },
  780. finishTask(task) {
  781. this.http.post('/task/finish',{id: task.id, taskStatus: task.taskStatus},
  782. res => {
  783. if (res.code == "ok") {
  784. if (this.groupType == 0) {
  785. this.getStageList();
  786. } else {
  787. this.getViewTaskList();
  788. }
  789. } else {
  790. this.$message({
  791. message: res.msg,
  792. type: "error"
  793. });
  794. }
  795. },
  796. error => {
  797. this.$message({
  798. message: error,
  799. type: "error"
  800. });
  801. });
  802. },
  803. editTask(task) {
  804. // this.addForm = JSON.parse(JSON.stringify(task));
  805. this.addFormVisible = true;
  806. this.addLoading = false;
  807. this.title = "编辑任务";
  808. this.getTaskDetail(task.id);
  809. },
  810. getTaskDetail(id) {
  811. this.http.post('/task/getTask',{id: id},
  812. res => {
  813. if (res.code == "ok") {
  814. this.addForm = res.data;
  815. this.addForm.createDate = null;
  816. this.addForm.indate = null;
  817. this.addLoading = false;
  818. } else {
  819. this.$message({
  820. message: res.msg,
  821. type: "error"
  822. });
  823. }
  824. },
  825. error => {
  826. this.$message({
  827. message: error,
  828. type: "error"
  829. });
  830. });
  831. },
  832. addTask(stage) {
  833. this.addFormVisible = true;
  834. this.addForm = {projectId: stage.projectId, groupId: stage.groupId, stagesId: stage.id, taskLevel:0, planHours: 8, taskType: 0};
  835. this.addLoading = false;
  836. this.title="创建任务";
  837. },
  838. renameStage(item) {
  839. this.stageForm = JSON.parse(JSON.stringify(item));
  840. this.addStageDialog = true;
  841. },
  842. deleteStage(item) {
  843. var _this = this;
  844. var param = {id:item.id, groupId: item.groupId};
  845. this.$confirm("确认删除吗?", "提示", {
  846. //type: 'warning'
  847. }).then(() => {
  848. this.http.post('/stages/delete',param,
  849. res => {
  850. if (res.code == "ok") {
  851. this.stageList = res.data;
  852. } else {
  853. this.$message({
  854. message: res.msg,
  855. type: "error"
  856. });
  857. }
  858. },
  859. error => {
  860. this.$message({
  861. message: error,
  862. type: "error"
  863. });
  864. });
  865. });
  866. },
  867. //加载项目内的任务列表
  868. getStageList() {
  869. this.http.post('/stages/list',{groupId: this.selectedGroup.id, projectId: this.selectedGroup.projectId},
  870. res => {
  871. if (res.code == "ok") {
  872. this.stageList = res.data;
  873. } else {
  874. this.$message({
  875. message: res.msg,
  876. type: "error"
  877. });
  878. }
  879. },
  880. error => {
  881. this.$message({
  882. message: error,
  883. type: "error"
  884. });
  885. });
  886. },
  887. addStagePost() {
  888. let param = JSON.parse(JSON.stringify(this.stageForm));
  889. param.taskList = [];
  890. this.http.post('/stages/save',param,
  891. res => {
  892. if (res.code == "ok") {
  893. this.stageList = res.data;
  894. this.addStageDialog = false;
  895. } else {
  896. this.$message({
  897. message: res.msg,
  898. type: "error"
  899. });
  900. }
  901. },
  902. error => {
  903. this.$message({
  904. message: error,
  905. type: "error"
  906. });
  907. });
  908. },
  909. addStage() {
  910. this.addStageDialog = true;
  911. this.stageForm = {groupId: this.selectedGroup.id, projectId: this.curProjectId};
  912. },
  913. viewChange(index, indexPath) {
  914. console.log(index);
  915. this.groupType = 1;
  916. this.order = "create_date";
  917. this.selectedGroup = this.viewList.filter(g=>g.id == index)[0];
  918. this.getViewTaskList();
  919. this.displayTable = true;
  920. } ,
  921. groupChange(index, indexPath) {
  922. console.log(index);
  923. this.groupType = 0;
  924. this.order = "seq";
  925. this.isDesc = false;
  926. this.selectedGroup = this.groupList.filter(g=>g.id == index)[0];
  927. this.getStageList();
  928. this.displayTable = false;
  929. },
  930. //本地搜索组
  931. startSearchGroup() {
  932. if (this.groupSearch != null || this.groupSearch.length > 0) {
  933. this.groupList = this.allGroupData.filter(g=>g.name.indexOf(this.groupSearch) >= 0);
  934. } else {
  935. this.groupList = this.allGroupData;
  936. }
  937. },
  938. renameGroup(item) {
  939. this.groupForm = JSON.parse(JSON.stringify(item));
  940. this.modGroupDialog = true;
  941. },
  942. deleteGroup(item) {
  943. var _this = this;
  944. this.$confirm("确认删除吗?", "提示", {
  945. //type: 'warning'
  946. }).then(() => {
  947. this.http.post('/task-group/delete',item,
  948. res => {
  949. if (res.code == "ok") {
  950. this.groupList = res.data;
  951. if (item.id == this.selectedGroup.id) {
  952. //之前选中的分组被删除了
  953. if (this.groupList.length > 0) {
  954. this.defaultGroupId = this.groupList[0].id;
  955. this.selectedGroup = this.groupList[0];
  956. } else {
  957. this.selectedGroup = {};
  958. }
  959. }
  960. } else {
  961. this.$message({
  962. message: res.msg,
  963. type: "error"
  964. });
  965. }
  966. },
  967. error => {
  968. this.$message({
  969. message: error,
  970. type: "error"
  971. });
  972. });
  973. });
  974. },
  975. addTemplateGroup() {
  976. var param = JSON.parse(JSON.stringify(this.groupTemplateList.filter(g=>g.selected)[0]));
  977. delete param.stagesList;
  978. param.projectId = this.curProjectId;
  979. this.http.post('/task-group/createFromTemplate',param,
  980. res => {
  981. if (res.code == "ok") {
  982. this.addGroupDialog = false;
  983. this.getTaskGroups();
  984. } else {
  985. this.$message({
  986. message: res.msg,
  987. type: "error"
  988. });
  989. }
  990. },
  991. error => {
  992. this.$message({
  993. message: error,
  994. type: "error"
  995. });
  996. });
  997. },
  998. addGroup() {
  999. this.http.post('/task-group/save',this.groupForm,
  1000. res => {
  1001. if (res.code == "ok") {
  1002. this.groupList = res.data;
  1003. this.addGroupDialog = false;
  1004. this.modGroupDialog = false;
  1005. if (this.selectedGroup.id == this.groupForm.id) {
  1006. this.selectedGroup = this.groupForm;
  1007. }
  1008. } else {
  1009. this.$message({
  1010. message: res.msg,
  1011. type: "error"
  1012. });
  1013. }
  1014. },
  1015. error => {
  1016. this.$message({
  1017. message: error,
  1018. type: "error"
  1019. });
  1020. });
  1021. },
  1022. createGroup() {
  1023. this.addGroupDialog = true;
  1024. this.groupForm = {projectId: this.curProjectId};
  1025. },
  1026. getInsideData() {
  1027. this.getTaskGroups();
  1028. },
  1029. //加载项目内的任务分组
  1030. getTaskGroups() {
  1031. this.http.post('/task-group/list',{projectId: this.curProjectId},
  1032. res => {
  1033. if (res.code == "ok") {
  1034. this.allGroupData = res.data;
  1035. this.groupList = res.data;
  1036. if (this.groupList.length > 0) {
  1037. this.defaultGroupId = this.groupList[0].id;
  1038. this.selectedGroup = this.groupList[0];
  1039. this.getStageList();
  1040. } else {
  1041. //清空任务列表
  1042. this.defaultGroupId = null;
  1043. this.selectedGroup = null;
  1044. this.stageList = [];
  1045. }
  1046. } else {
  1047. this.$message({
  1048. message: res.msg,
  1049. type: "error"
  1050. });
  1051. }
  1052. },
  1053. error => {
  1054. this.$message({
  1055. message: error,
  1056. type: "error"
  1057. });
  1058. });
  1059. },
  1060. //切换项目
  1061. onProjectChange() {
  1062. let path = this.$route.path;
  1063. path = path.substring(0,path.lastIndexOf('/'))+'/'+this.curProjectId;
  1064. this.$router.push(path);
  1065. console.log('this.activeName=='+this.activeName);
  1066. this.getTaskGroups();
  1067. this.$refs.fileCenter.refreshPage();
  1068. this.$refs.projectInfo.refreshPage();
  1069. this.$refs.summary.refreshPage();
  1070. },
  1071. //获取我的项目列表
  1072. getMyProjectList() {
  1073. this.http.post('/project/getProjectList', {
  1074. },
  1075. res => {
  1076. if (res.code == "ok") {
  1077. this.projectList = res.data;
  1078. console.log(this.projectList);
  1079. } else {
  1080. this.$message({
  1081. message: res.msg,
  1082. type: "error"
  1083. });
  1084. }
  1085. },
  1086. error => {
  1087. this.$message({
  1088. message: error,
  1089. type: "error"
  1090. });
  1091. });
  1092. },
  1093. menuSelect() {
  1094. },
  1095. toList() {
  1096. this.$router.push("/list");
  1097. },
  1098. searchList() {
  1099. this.page = 1;
  1100. this.getList();
  1101. },
  1102. //显示用户详情
  1103. showUser(userId) {
  1104. this.userDetailVisible = true;
  1105. this.http.post(this.port.manage.userDetail, {
  1106. userId: userId
  1107. },
  1108. res => {
  1109. if (res.code == "ok") {
  1110. this.userDetail = res.data;
  1111. } else {
  1112. this.$message({
  1113. message: res.msg,
  1114. type: "error"
  1115. });
  1116. }
  1117. },
  1118. error => {
  1119. this.$message({
  1120. message: error,
  1121. type: "error"
  1122. });
  1123. });
  1124. },
  1125. getUsers() {
  1126. this.http.post(this.port.manage.list, {
  1127. departmentId: -1,
  1128. pageIndex: 1,
  1129. pageSize: 99999
  1130. },
  1131. res => {
  1132. if (res.code == "ok") {
  1133. this.users = res.data.records;
  1134. } else {
  1135. this.$message({
  1136. message: res.msg,
  1137. type: "error"
  1138. });
  1139. }
  1140. },
  1141. error => {
  1142. this.$message({
  1143. message: error,
  1144. type: "error"
  1145. });
  1146. });
  1147. },
  1148. //获取项目列表
  1149. getList() {
  1150. this.listLoading = true;
  1151. this.http.post(this.port.project.listPage, {
  1152. pageIndex: this.page,
  1153. pageSize: this.size,
  1154. keyword:this.keyword,
  1155. searchField: this.searchField,
  1156. },
  1157. res => {
  1158. this.listLoading = false;
  1159. if (res.code == "ok") {
  1160. var list = res.data.records;
  1161. for(var i in list) {
  1162. var participator = list[i].participator , str = "";
  1163. for(var j in participator) {
  1164. if(j == participator.length-1) {
  1165. str += participator[j].name
  1166. } else {
  1167. str += participator[j].name + ','
  1168. }
  1169. }
  1170. list[i].userNames = str;
  1171. }
  1172. this.list = list;
  1173. this.total = res.data.total;
  1174. } else {
  1175. this.$message({
  1176. message: res.msg,
  1177. type: "error"
  1178. });
  1179. }
  1180. },
  1181. error => {
  1182. this.listLoading = false;
  1183. this.$message({
  1184. message: error,
  1185. type: "error"
  1186. });
  1187. });
  1188. },
  1189. submitInsert() {
  1190. this.$refs.form1.validate(valid => {
  1191. if (valid) {
  1192. delete this.addForm.subTaskList;
  1193. this.http.post('/task/save',this.addForm,
  1194. res => {
  1195. if (res.code == "ok") {
  1196. this.$message({
  1197. message: "提交成功",
  1198. type: "success"
  1199. });
  1200. if (this.addForm.parentTid == null) {
  1201. this.addFormVisible = false;
  1202. if (this.groupType == 0) {
  1203. this.getStageList();
  1204. } else {
  1205. this.getViewTaskList();
  1206. }
  1207. } else {
  1208. this.backToParentTask();
  1209. }
  1210. } else {
  1211. this.$message({
  1212. message: res.msg,
  1213. type: "error"
  1214. });
  1215. }
  1216. },
  1217. error => {
  1218. this.$message({
  1219. message: error,
  1220. type: "error"
  1221. });
  1222. }
  1223. );
  1224. }
  1225. });
  1226. },
  1227. // 删除
  1228. deletePro(i, item) {
  1229. this.$confirm("确定要项目" + item.projectName + "吗?","删除项目", {
  1230. confirmButtonText: "确定",
  1231. cancelButtonText: "取消",
  1232. type: "warning"
  1233. })
  1234. .then(() => {
  1235. this.listLoading = true;
  1236. this.http.post(this.port.project.delete,{
  1237. id: item.id
  1238. },
  1239. res => {
  1240. this.listLoading = false;
  1241. if (res.code == "ok") {
  1242. this.$message({
  1243. message: "删除成功",
  1244. type: "success"
  1245. });
  1246. this.getList();
  1247. } else {
  1248. this.$message({
  1249. message: res.msg,
  1250. type: "error"
  1251. });
  1252. }
  1253. },
  1254. error => {
  1255. this.listLoading = false;
  1256. this.$message({
  1257. message: error,
  1258. type: "error"
  1259. });
  1260. }
  1261. );
  1262. })
  1263. .catch(() => {});
  1264. },
  1265. detail(i) {
  1266. this.$router.push("/list/" + this.list[i].id + "/" + this.list[i].projectName);
  1267. },
  1268. getDetail() {
  1269. this.http.post('/project/detail',{
  1270. id: this.curProjectId
  1271. },
  1272. res => {
  1273. if (res.code == "ok") {
  1274. this.currentProject = res.data;
  1275. } else {
  1276. }
  1277. },
  1278. error => {
  1279. this.$message({
  1280. message: error,
  1281. type: "error"
  1282. });
  1283. }
  1284. );
  1285. },
  1286. },
  1287. created() {
  1288. let height = window.innerHeight;
  1289. this.tableHeight = height - 135;
  1290. this.stageListHeight = this.tableHeight - 45;
  1291. const that = this;
  1292. window.onresize = function temp() {
  1293. that.tableHeight = window.innerHeight - 135;
  1294. that.stageListHeight = that.tableHeight - 45;
  1295. console.log('stageList height=='+that.stageListHeight);
  1296. };
  1297. },
  1298. mounted() {
  1299. this.curProjectId = parseInt(this.$route.params.id);
  1300. this.activeName = this.$route.path.split("/")[1];
  1301. this.getDetail();
  1302. this.getUsers();
  1303. this.getMyProjectList();
  1304. this.getInsideData();
  1305. this.getGroupTemplate();
  1306. // tinymce.init({});
  1307. }
  1308. };
  1309. </script>
  1310. <style >
  1311. .flip-list-move {
  1312. transition: transform 0.5s;
  1313. }
  1314. .no-move {
  1315. transition: transform 0s;
  1316. }
  1317. .taskStage {
  1318. margin:10px;
  1319. display:inline-block;
  1320. vertical-align:top;
  1321. }
  1322. .taskList {
  1323. padding:7px;
  1324. width:300px;
  1325. }
  1326. .taskList .stage {
  1327. font-weight:bold;
  1328. }
  1329. .taskCard {
  1330. background: #fff;
  1331. margin: 5px 0px;
  1332. padding:5px;
  1333. border: 1px solid #e6e6e6;
  1334. border-radius: 3px;
  1335. box-shadow: 3px 3px 3px #e6e6e6;
  1336. min-height:60px;
  1337. }
  1338. .taskCard:hover {
  1339. cursor: move;
  1340. }
  1341. .chosen {
  1342. background-color: #000 !important;
  1343. color: #fff;
  1344. }
  1345. .ghost {
  1346. background-color: #fafafa !important;
  1347. }
  1348. .taskCard .cb {
  1349. margin-right:5px;
  1350. }
  1351. .item {
  1352. background:#fff;
  1353. }
  1354. .input-with-select .el-input-group__prepend {
  1355. background-color: #fff;
  1356. }
  1357. .el-tabs__item {
  1358. height:45px ;
  1359. }
  1360. .projectCls {
  1361. margin-left:10px;margin-right:10px;
  1362. }
  1363. .heavyTxt {
  1364. font-weight:bold;
  1365. }
  1366. .el-tabs__nav-wrap::after {
  1367. height:0.5px;
  1368. }
  1369. .user_name_icon {
  1370. text-align:center;border-radius:50%;color:white;float:right;font-size:10px;width:30px;height:30px;line-height:30px;
  1371. transform: scale(0.8);
  1372. }
  1373. .task_name {
  1374. color:#262626;
  1375. display:inline-block;
  1376. max-width: 235px;
  1377. overflow: hidden;
  1378. white-space: nowrap;
  1379. text-overflow: ellipsis;
  1380. }
  1381. .group_style {
  1382. border-radius: 5px;margin:2px 0px 2px 0px;height:40px;line-height:40px;
  1383. }
  1384. .el-tabs__nav-wrap::after {
  1385. height:1px;
  1386. }
  1387. .el-tabs__header {
  1388. margin:0 !important;
  1389. }
  1390. .single_line {
  1391. overflow: hidden;text-overflow:ellipsis;white-space: nowrap;
  1392. }
  1393. .sub_task_num {
  1394. font-size:10px;
  1395. color:#666;
  1396. }
  1397. .template_box {
  1398. margin:20px 0px;
  1399. }
  1400. /* 项目阶段侧边栏样式 */
  1401. .sidebar {
  1402. width: 2px;
  1403. background: #dddddd;
  1404. position: relative;
  1405. }
  1406. .sidebar:hover {
  1407. background: #20a0ff;
  1408. }
  1409. .sidebar:hover .etui {
  1410. background: #20a0ff;
  1411. border: #20a0ff;
  1412. color: #fff;
  1413. }
  1414. .etui {
  1415. width: 24px;
  1416. height: 40px;
  1417. background: #fff;
  1418. border: 1px solid #dddddd;
  1419. position: absolute;
  1420. top: 50%;
  1421. left: 0%;
  1422. transform: translate(6%, -50%);
  1423. color: rgb(192, 191, 191);
  1424. }
  1425. .etui i {
  1426. display: inline-block;
  1427. padding-top: 50%;
  1428. padding-left: 15%;
  1429. font-weight: bold;
  1430. }
  1431. /* bug问题 */
  1432. .task {
  1433. box-sizing: border-box;
  1434. padding-left: 10px;
  1435. padding-right: 5px;
  1436. }
  1437. </style>