taskKanBan.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div style="width: 100%;">
  3. <div class="set-background">
  4. <div class="block">
  5. <el-tabs v-model="activeName">
  6. <el-tab-pane label="列表" name="first">
  7. <el-form :model="form">
  8. <div class="set-between">
  9. <!-- <el-form-item label="创建时间" label-width="70px"><el-date-picker v-model="form.createTime" align="left" size="medium" type="datetime" style="width:76%;" placeholder="选择日期" /></el-form-item> -->
  10. <el-form-item label="任务名称" label-width="70px"><el-input v-model="form.name" placeholder="填写任务名称" autocomplete="off" clearable size="medium" style="width:76%;" /></el-form-item>
  11. <el-form-item label="状态" label-width="40px">
  12. <el-select v-model="form.status" size="medium" style="width:60%;" clearable placeholder="状态">
  13. <el-option v-for="item in processStatusEnumList" :key="item.code" :label="item.name" :value="item.code" />
  14. </el-select>
  15. </el-form-item>
  16. </div>
  17. <div class="set-between">
  18. <el-button type="primary" plain size="medium" @click="dataQuery(form)">查询</el-button>
  19. </div>
  20. </el-form>
  21. <div class="set-locate">
  22. <el-table
  23. :data="tableData"
  24. border
  25. style="width: 100%"
  26. size="mini"
  27. >
  28. <el-table-column
  29. prop="id"
  30. label="ID"
  31. align="center"
  32. width="80"
  33. />
  34. <el-table-column
  35. label="任务名称"
  36. align="center"
  37. >
  38. <template slot-scope="scope">
  39. <el-link style="font-weight: 400;" type="primary" :underline="false" @click="taskShow(scope.row.id)">{{ scope.row.name }}</el-link>
  40. </template>
  41. </el-table-column>
  42. <el-table-column
  43. label="状态"
  44. align="center"
  45. width="130"
  46. >
  47. <template slot-scope="scope">
  48. <el-tag type="success"><span>{{ scope.row.statusString }}</span></el-tag>
  49. </template>
  50. </el-table-column>
  51. <el-table-column
  52. prop="createTime"
  53. label="创建时间"
  54. align="center"
  55. />
  56. <el-table-column
  57. label="操作"
  58. align="center"
  59. width="300"
  60. >
  61. <template v-slot="scope">
  62. <div>
  63. <el-button size="mini" type="primary" plain @click="projectShowData(scope.row.id)">编辑</el-button>
  64. <el-button size="mini" type="danger" plain @click="dialogBug(scope.row.id)">删除</el-button>
  65. <el-dialog
  66. :visible.sync="dialogVisible"
  67. width="30%"
  68. >
  69. <span>确定要删除这条项目信息吗</span>
  70. <span slot="footer" class="dialog-footer">
  71. <el-button type="primary" size="mini" @click="delHmVirtual()">确 定</el-button>
  72. <el-button type="danger" size="mini" @click="dialogVisible = false">取 消</el-button>
  73. </span>
  74. </el-dialog>
  75. </div>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination background style="margin-top:30px;" align="center" :current-page="curIndex" :page-size="pageSize" layout="prev, pager, next" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
  80. </div>
  81. </el-tab-pane>
  82. <el-tab-pane label="看板" name="second">
  83. 敬请期待
  84. </el-tab-pane>
  85. </el-tabs>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import { taskListGet } from '@/api/defectManage'
  92. import { bugGetEnum } from '@/api/defectManage' // 下拉菜单data
  93. import { deleteTaskData } from '@/api/projectPage.js'
  94. export default {
  95. data() {
  96. return {
  97. tableData: [],
  98. form: {},
  99. dialogVisible: false,
  100. bizJson: localStorage.getItem('key'),
  101. userInformation: localStorage.getItem('username'),
  102. userNames: localStorage.getItem('realname'),
  103. queryCode: {},
  104. curIndex: 1,
  105. pageSize: 20,
  106. total: 0,
  107. activeName: 'first',
  108. pauseId: '',
  109. processStatusEnumList: []
  110. }
  111. },
  112. created() {
  113. this.bugListSelectBeforeGet()
  114. },
  115. methods: {
  116. async bugListSelectBeforeGet() {
  117. await bugGetEnum().then(res => {
  118. this.processStatusEnumList = res.data.processStatusEnumList
  119. })
  120. // 任务list
  121. taskListGet({ bizId: this.bizJson }).then(response => {
  122. this.tableData = response.data
  123. if (response.data) {
  124. this.total = response.data.length
  125. }
  126. // const processStatusEnumMap = this.processStatusEnumList.reduce((a, c) => {
  127. // return {
  128. // ...a,
  129. // [c.code]: c.name
  130. // }
  131. // }, {})
  132. // console.log(this.tableData)
  133. })
  134. },
  135. dataQuery(queryCode) {
  136. queryCode.bizId = localStorage.getItem('key')
  137. queryCode.pageSize = this.pageSize
  138. queryCode.curIndex = this.curIndex
  139. taskListGet(queryCode).then(res => {
  140. res.code === 200 ? this.tableData = res.data : this.errorFun(res.msg)
  141. })
  142. },
  143. // id Bug
  144. dialogBug(e) {
  145. this.dialogVisible = true
  146. this.pauseId = e
  147. },
  148. // 删除任务
  149. delHmVirtual() {
  150. this.userData = { id: '', ename: this.userInformation, name: this.userNames }
  151. deleteTaskData(this.pauseId, this.userData).then(response => {
  152. if (response.code === 200) {
  153. this.bugListSelectBeforeGet()
  154. this.successFun('delete')
  155. } else {
  156. this.errorFun(response.msg)
  157. }
  158. })
  159. this.dialogVisible = false
  160. },
  161. handleSizeChange(size) {
  162. this.pageSize = size
  163. },
  164. handleCurrentChange(curIndex) {
  165. this.curIndex = curIndex
  166. },
  167. taskShow(e) {
  168. this.$router.push({ name: '任务查看', query: { id: e }})
  169. },
  170. projectShowData(e) {
  171. this.$router.push({ name: '任务更新', query: { id: e }})
  172. },
  173. successFun(successText) {
  174. this.$notify({ title: 'Success', message: `${successText} Successfully`, type: 'success', duration: 2000 })
  175. },
  176. errorFun(errorText) {
  177. this.$notify({ title: 'Failed', message: errorText, type: 'error', duration: 2000 })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="stylus" scoped>
  183. .set-background
  184. background-color #F2F3F6
  185. display flex
  186. justify-content center
  187. .block
  188. background-color rgba(255,255,255,1)
  189. box-shadow 0px 0px 11px 0px rgba(238,240,245,1)
  190. border-radius 7px
  191. width 96%
  192. margin 25px 0
  193. padding 10px 20px
  194. min-height calc(100vh - 100px)
  195. .block >>> .el-tabs__nav-wrap::after
  196. background-color white
  197. .block >>> .el-tabs__item
  198. padding 0 10px 0 0
  199. .block >>> .el-form
  200. display flex
  201. justify-content space-between
  202. margin-top 10px
  203. .block >>> .el-form-item__content
  204. margin-left 0 !important
  205. .block >>> th
  206. background-color #F0F2F4 !important
  207. .set-between
  208. display flex
  209. .set-between >>> .el-button
  210. height 36px
  211. .set-between >>> .el-form-item
  212. display flex
  213. margin-right -35px
  214. .set-locate
  215. margin-top 15px
  216. </style>