taskList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <div>
  3. <el-row v-if="!showHeader" class="select-main" type="flex" align="center">
  4. <el-col :span="2" class="flex-align-center">
  5. <el-checkbox v-model="planChecked" class="plan-checked" @change="changeCheck" />
  6. </el-col>
  7. <el-col :span="3" class="item-checked">已选择<span style="color: #409EFF">{{ curcentChecked }}</span>个</el-col>
  8. <el-col :span="1" class="item-click">|</el-col>
  9. <el-col :span="2" class="item-click click-blue" @click.native="handlePlan('test')">提测</el-col>
  10. <el-col :span="2" class="item-click click-blue" @click.native="handlePlan('allow')">准出</el-col>
  11. <el-col :span="4" class="item-click click-blue" @click.native="handlePlan('daily')">建立测试日报</el-col>
  12. <el-col :span="4" class="item-click" @click.native="handlePlan('cancel')">取消选择</el-col>
  13. </el-row>
  14. <el-table
  15. ref="planTable"
  16. :data="all_task"
  17. style="width: 100%;"
  18. size="mini"
  19. row-key="id"
  20. :expand-row-keys="expandArr"
  21. :header-cell-style="{ color: '#4A4A4A', fontSize: '14px', fontWeight: '550', textAlign: 'center' }"
  22. show-overflow-tooltip="true"
  23. :show-header="showHeader"
  24. :header-row-style="{height: '50px'}"
  25. @selection-change="handleSelectionChange"
  26. >
  27. <el-table-column type="selection" width="55" align="center" />
  28. <el-table-column type="expand" width="40">
  29. <template slot="header">
  30. <div class="expand"><i v-show="!allChange" class="el-icon-plus" @click="expandAll(true)" /></div>
  31. <div class="expand"><i v-show="allChange" class="el-icon-minus" @click="expandAll(false)" /></div>
  32. </template>
  33. <template slot-scope="props">
  34. <schedule-list :id="props.row.id" :type-list="taskScheduleEvent" />
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="优先级" prop="priority" width="90" sortable align="center">
  38. <template slot-scope="scope" style="text-align: center;">
  39. <span class="div_priority" :class="scope.row.priorityString">
  40. {{ scope.row.priorityString }}
  41. </span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="任务名称" width="200" align="center" show-overflow-tooltip>
  45. <template slot-scope="scope"><span class="task-title" @click="link_task(scope.row.id)">{{ scope.row.name }}</span></template>
  46. </el-table-column>
  47. <el-table-column label="所属模块" width="150" align="center" show-overflow-tooltip>
  48. <template slot-scope="scope">{{ scope.row.moduleInfoName }}</template>
  49. </el-table-column>
  50. <el-table-column label="状态" width="105" align="center">
  51. <template slot-scope="scope">
  52. <el-select
  53. v-model="scope.row.status"
  54. :class="['status'+scope.row.status]"
  55. class="btns"
  56. size="mini"
  57. @change="changeStatus(scope.row)"
  58. >
  59. <el-option v-for="item in allStatus" :key="item.code" :label="item.msg" :value="item.code" />
  60. </el-select>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="所属需求" width="200" align="center" show-overflow-tooltip>
  64. <template slot-scope="scope">{{ scope.row.requireName }}</template>
  65. </el-table-column>
  66. <el-table-column label="跟版客户端" width="120" align="center" show-overflow-tooltip>
  67. <template slot-scope="scope">{{ scope.row.app }}</template>
  68. </el-table-column>
  69. <el-table-column label="开发负责人" width="100" align="center" show-overflow-tooltip>
  70. <template slot-scope="scope">{{ scope.row.rdObject ? scope.row.rdObject.name : '' }}</template>
  71. </el-table-column>
  72. <el-table-column label="测试负责人" width="100" align="center" show-overflow-tooltip>
  73. <template slot-scope="scope">{{ scope.row.qaObject ? scope.row.qaObject.name : '' }}</template>
  74. </el-table-column>
  75. <el-table-column label="任务进度" min-width="150" align="center">
  76. <template slot-scope="scope">
  77. <el-progress :percentage="Number(scope.row.rate && scope.row.rate.substring(0,4))" color="#409eff" />
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <TestReport v-if="dialogTestReport" ref="TestReport" />
  82. <DailyReport v-if="dialogDailyReport" ref="DailyReport" />
  83. <ClientReport v-if="dialogClientReport" ref="ClientReport" />
  84. <normal-dialog :show-dialog.sync="statusDialog" :title="'状态变更:已上线'" :width="'50%'" @confirm="confirmStatus()">
  85. <div class="dialog-change-status">
  86. <span>实际上线时间:</span>
  87. <el-date-picker v-model="changeStatusDate" type="date" style="width:100%;" placeholder="选择日期" format="yyyy-MM-dd HH:mm:ss" />
  88. </div>
  89. </normal-dialog>
  90. </div>
  91. </template>
  92. <script>
  93. import TestReport from '@/views/Platform/presentation/Templates/TestReport' // 提测
  94. import DailyReport from '@/views/Platform/presentation/Templates/DailyReport' // 日报
  95. import ClientReport from '@/views/Platform/presentation/Templates/ClientReport' // 准出
  96. import { taskList } from '@/api/projectIndex'
  97. import { taskUpdate } from '@/api/projectViewDetails'
  98. import { configShowTaskEnum } from '@/api/taskIndex'
  99. import scheduleList from './scheduleList'
  100. import normalDialog from '@/components/dialog/normalDialog'
  101. export default {
  102. components: {
  103. normalDialog,
  104. TestReport,
  105. DailyReport,
  106. ClientReport,
  107. scheduleList
  108. },
  109. data() {
  110. return {
  111. changeData: new Map(),
  112. allChange: false, // 是否全展开
  113. expandArr: [], // 展开行数组
  114. inputValue: '',
  115. all_task: [], // 任务列表
  116. allStatus: [], // 任务所有状态
  117. taskScheduleEvent: [], // 排期类型
  118. showHeader: true, // 任务列表的表头是否显示
  119. curcentList: [], // 当前已选择的列表
  120. curcentChecked: 0, // 当前已选择的数量
  121. planChecked: false,
  122. planHandleType: '', // 任务列表操作类型
  123. dialogTestReport: false, // 提测
  124. dialogDailyReport: false, // 日报
  125. dialogClientReport: false, // 准出
  126. statusDialog: false, // 修改状态弹框
  127. changeStatusDate: null, // 状态改变时间
  128. nowChangeTask: null // 当前正在改变的任务对象
  129. }
  130. },
  131. watch: {
  132. value: {
  133. handler(newV, oldV) {
  134. this.inputValue = newV
  135. },
  136. immediate: true
  137. }
  138. },
  139. created() {
  140. this.getTaskStatus()
  141. this.get_allTask()
  142. },
  143. methods: {
  144. async get_allTask() { // 获取全部任务
  145. const res = await taskList({
  146. projectId: this.$route.query.id
  147. })
  148. if (res.code === 200) {
  149. this.all_task = res.data
  150. // for (const [key, value] of Object.entries(res.data[0])) {
  151. // console.log(`${key}: ${value}`)
  152. // }
  153. }
  154. },
  155. async getTaskStatus() { // 获取任务状态列表
  156. const res = await configShowTaskEnum()
  157. if (res.code === 200) {
  158. this.allStatus = res.data.taskStatus
  159. this.taskScheduleEvent = res.data.taskScheduleEvent || []
  160. }
  161. },
  162. changeCheck(val) {
  163. if (val) {
  164. this.all_task.forEach(row => {
  165. this.$refs.planTable.toggleRowSelection(row, true)
  166. })
  167. } else {
  168. this.$refs.planTable.clearSelection()
  169. }
  170. },
  171. expandAll(isEx) { // 全部展开
  172. this.allChange = isEx
  173. isEx ? this.expandArr = this.all_task.map(item => item.id) : this.expandArr = []
  174. },
  175. async changeStatus(e) { // 状态改变
  176. if (e.status === 5) { // 已上线
  177. this.statusDialog = true
  178. this.nowChangeTask = e
  179. } else {
  180. const user = {
  181. name: localStorage.getItem('username'),
  182. ename: localStorage.getItem('realname'),
  183. id: ''
  184. }
  185. const taskInfoDO = e
  186. const resTask = await taskUpdate({ taskInfoDO, user })
  187. if (resTask.code === 200) {
  188. this.$message({ message: resTask.msg, type: 'success', offset: 150 })
  189. }
  190. }
  191. },
  192. async confirmStatus() { // 确认更改状态
  193. const user = {
  194. name: localStorage.getItem('username'),
  195. ename: localStorage.getItem('realname'),
  196. id: ''
  197. }
  198. const taskInfoDO = this.nowChangeTask
  199. taskInfoDO.onlineRealTime = this.changeStatusDate
  200. const resTask = await taskUpdate({ taskInfoDO, user })
  201. if (resTask.code === 200) {
  202. this.$message({ message: resTask.msg, type: 'success', offset: 150 })
  203. }
  204. },
  205. handleSelectionChange(val) { // 任务列表删选操作
  206. val.length > 0 ? this.showHeader = false : this.showHeader = true
  207. this.curcentChecked = val.length
  208. this.curcentList = val
  209. if (val.length === this.all_task.length) {
  210. this.planChecked = true
  211. }
  212. },
  213. handlePlan(type) { // 任务列表操作
  214. this.planHandleType = type
  215. switch (type) {
  216. case 'test':
  217. this.filtrateTest()
  218. break
  219. case 'allow':
  220. this.filtrateAllow()
  221. break
  222. case 'daily':
  223. this.filtrateDaily()
  224. break
  225. case 'cancel':
  226. this.$refs.planTable.clearSelection()
  227. break
  228. }
  229. },
  230. filtrateTest() { // 提测筛选
  231. this.dialogTestReport = true
  232. this.$nextTick(() => {
  233. this.$refs.TestReport.init(7, this.curcentList.map(item => { return item.id }))
  234. })
  235. },
  236. filtrateAllow() { // 准出筛选
  237. this.dialogClientReport = true
  238. this.$nextTick(() => {
  239. this.$refs.ClientReport.init(7, this.curcentList.map(item => { return item.id }))
  240. })
  241. },
  242. filtrateDaily() { // 建立日报
  243. this.dialogDailyReport = true
  244. this.$nextTick(() => {
  245. this.$refs.DailyReport.init(7, this.curcentList.map(item => { return item.id }))
  246. })
  247. },
  248. link_task(id) { // 跳转到任务详情页
  249. this.$router.push({ name: '任务详情', query: { id: id }})
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. @mixin setStatus($color) {
  256. input {
  257. color:$color;
  258. border: 1px solid $color;
  259. }
  260. >>> .el-select__caret{
  261. color:$color;
  262. }
  263. >>> .el-input__inner{
  264. color:$color;
  265. border-color: $color;
  266. }
  267. >>> .el-input__inner:focus {
  268. border-color: $color;
  269. }
  270. }
  271. >>>.el-row .el-col {
  272. margin: 10px 0;
  273. }
  274. .task-title {
  275. cursor: pointer;
  276. }
  277. .P0 {
  278. background-color: #F56C6C;
  279. }
  280. .P1 {
  281. background-color: #FF8952;
  282. }
  283. .P2 {
  284. background-color: #F5E300;
  285. }
  286. .P3 {
  287. background-color: #7ED321;
  288. }
  289. .P4 {
  290. background-color: #61D3B8;
  291. }
  292. .P5 {
  293. background-color: #69B3FF;
  294. }
  295. .P6 {
  296. background-color: #BDBDBD;
  297. }
  298. .status0 {
  299. @include setStatus(#409EFF)
  300. }
  301. .status1 {
  302. @include setStatus(#FF8952)
  303. }
  304. .status3 {
  305. @include setStatus(#13C2C2)
  306. }
  307. .status5 {
  308. @include setStatus(#7ED321)
  309. }
  310. .expand i {
  311. border:1px solid #DCDFE6;
  312. }
  313. >>>.el-table__expand-icon{
  314. font-size: 14px;
  315. .el-icon{
  316. margin: 0;
  317. transform: translate(-50%, -50%);
  318. border:1px solid #DCDFE6;
  319. }
  320. }
  321. >>>.el-table__expand-icon .el-icon-arrow-right::before{
  322. content: "\E6D9";
  323. }
  324. >>>.el-table__expand-icon--expanded .el-icon-arrow-right::before{
  325. content: "\E6D8";
  326. }
  327. >>>.el-table__expand-icon--expanded {
  328. transform: rotate(180deg);
  329. }
  330. >>>.el-table__expanded-cell {
  331. background-color: #FFFFFF;
  332. padding: 0;
  333. }
  334. >>>.el-table__expanded-cell:hover {
  335. background-color: #FFFFFF !important;
  336. }
  337. .div_priority {
  338. text-align: center;
  339. color: #ffffff;
  340. padding: inherit;
  341. border-radius: 4px;
  342. width: 40px;
  343. display: inline-block;
  344. }
  345. .plan-checked {
  346. padding-left: 21px;
  347. }
  348. .select-main {
  349. height: 50px;
  350. border-bottom: 1px solid #DCDFE6;
  351. .flex-align-center {
  352. display: flex;
  353. align-items: center;
  354. }
  355. .item-checked {
  356. color: #606266;
  357. font-size: 14px;
  358. display: flex;
  359. align-items: center;
  360. justify-content: left;
  361. cursor: pointer;
  362. }
  363. .item-click{
  364. color: #606266;
  365. font-size: 14px;
  366. display: flex;
  367. align-items: center;
  368. justify-content: center;
  369. cursor: pointer;
  370. }
  371. .click-blue {
  372. color: #409EFF;
  373. }
  374. }
  375. .descr {
  376. display: flex;
  377. justify-content: flex-start;
  378. }
  379. .planList >>> .el-table th>.cell {
  380. padding-left: 14px;
  381. padding-right: 14px;
  382. }
  383. .dialog-change-status {
  384. margin: 2% 3%;
  385. display: flex;
  386. justify-content: space-between;
  387. align-items: center;
  388. white-space:nowrap;
  389. }
  390. </style>