iterationTable.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="schedule-list">
  3. <!-- <el-col align="right" class="add-schedule"><span @click="addSchedule()"><i class="el-icon-circle-plus-outline" />添加排期</span></el-col> -->
  4. <el-table
  5. :id="'schedule-'+id"
  6. :data="scheduleList"
  7. :header-cell-style="{'background-color': 'rgba(232,232,232,0.4)'}"
  8. style="width: 100%"
  9. show-overflow-tooltip="true"
  10. row-key="id"
  11. border
  12. stripe
  13. >
  14. <!-- <el-table-column
  15. width="80"
  16. >
  17. <template>
  18. <el-tooltip class="item" effect="dark" content="代表移动,鼠标选中区域可以向上移动" placement="bottom">
  19. <div class="sortable-tip">
  20. <img :src="imgUrl" alt="">
  21. </div>
  22. </el-tooltip>
  23. </template>
  24. </el-table-column> -->
  25. <el-table-column
  26. prop="type"
  27. label="类型"
  28. min-width="80"
  29. >
  30. <template slot-scope="scope">
  31. {{ getType(scope.row.type) }}
  32. <div :class="scope.row.isScheduleLocked === 1 ? 'el-icon-lock' : 'el-icon-unlock'" />
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. prop="desc"
  37. label="描述"
  38. min-width="200"
  39. show-overflow-tooltip
  40. />
  41. <el-table-column
  42. prop="seperateDaysNoHoliday"
  43. label="排期"
  44. min-width="100"
  45. show-overflow-tooltip
  46. />
  47. <el-table-column
  48. prop="dayLength"
  49. label="时长"
  50. min-width="50"
  51. />
  52. <el-table-column
  53. prop="peopleList"
  54. label="参与人员"
  55. min-width="150"
  56. />
  57. <el-table-column
  58. label="操作"
  59. min-width="150"
  60. show-overflow-tooltip
  61. >
  62. <template slot-scope="scope">
  63. <el-button v-if="scope.row.isScheduleLocked === 0" type="text" size="small" @click="editSchedule(scope.row)">编辑</el-button>
  64. <el-button v-if="scope.row.isScheduleLocked === 0" type="text" size="small" @click="deleteSchedule(scope.row)">删除</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div class="bottom-detail">
  69. <el-row>排期总汇:{{ scheduleDetail.startTime | handlerDate }} ~ {{ scheduleDetail.endTime | handlerDate }}</el-row>
  70. <el-row v-if="scheduleDetail.preOnlineVersion && scheduleDetail.preOnlineVersion.length>0">
  71. <el-col :span="2">预计上线版本:</el-col>
  72. <el-col :span="6">
  73. <span v-for="item in scheduleDetail.preOnlineVersion" :key="item">{{ item }}</span><br>
  74. </el-col>
  75. </el-row>
  76. <el-row v-else>预计上线版本:</el-row>
  77. </div>
  78. <modify-schedule
  79. v-if="visibleSchedule"
  80. :visible.sync="visibleSchedule"
  81. :is-delete.sync="isDelete"
  82. :detail-data="detailData"
  83. :title="DialogTitle"
  84. @update="listByTask(id)"
  85. />
  86. </div>
  87. </template>
  88. <script>
  89. // import Sortable from 'sortablejs'
  90. import moment from 'moment'
  91. import 'moment/locale/zh-cn'
  92. import imgUrl from '@/assets/麻将@2x.png'
  93. import { scheduleListByRequire } from '@/api/iteration.js'
  94. import { sortForTask } from '@/api/projectViewDetails'
  95. import modifySchedule from './modifySchedule'
  96. // import 'ant-design-vue/dist/antd.css'
  97. export default {
  98. components: {
  99. modifySchedule
  100. },
  101. filters: {
  102. handlerDate(val) {
  103. return val ? moment(val).format('YYYY-MM-DD') : ''
  104. }
  105. },
  106. props: {
  107. id: {
  108. type: Number,
  109. default: NaN,
  110. required: true
  111. },
  112. typeList: {
  113. type: Array,
  114. default: () => [],
  115. required: false
  116. }
  117. },
  118. data() {
  119. return {
  120. imgUrl: imgUrl,
  121. scheduleList: [],
  122. scheduleDetail: {},
  123. visibleSchedule: false,
  124. detailData: null,
  125. taskScheduleEvent: [], // 排期类型
  126. DialogTitle: '新建排期',
  127. isDelete: false // 删除排期操作
  128. }
  129. },
  130. watch: {
  131. id: {
  132. handler(newV, oldV) {
  133. this.listByTask(newV)
  134. },
  135. immediate: true
  136. },
  137. typeList: {
  138. handler(newV, oldV) {
  139. this.taskScheduleEvent = newV
  140. },
  141. immediate: true
  142. }
  143. },
  144. mounted() {
  145. // this.rowDrop()
  146. },
  147. methods: {
  148. // rowDrop() {
  149. // const tbody = document.querySelector(`#schedule-${this.id} tbody`)
  150. // const _this = this
  151. // Sortable.create(tbody, {
  152. // onEnd({ newIndex, oldIndex }) {
  153. // const currRow = _this.scheduleList.splice(oldIndex, 1)[0]
  154. // _this.scheduleList.splice(newIndex, 0, currRow)
  155. // _this.sortForTask(_this.scheduleList.map(item => item.id))
  156. // }
  157. // })
  158. // },
  159. async sortForTask(arr) {
  160. const res = await sortForTask(this.id, arr)
  161. if (res.code === 200) {
  162. this.$message({ message: '移动成功', type: 'success', duration: 1000, offset: 150 })
  163. }
  164. },
  165. getType(value) {
  166. const res = this.taskScheduleEvent.find(item => item.code === value) || {}
  167. return res.msg
  168. },
  169. async listByTask(id) { // 获取排期列表
  170. const res = await scheduleListByRequire(id)
  171. if (res.code === 200) {
  172. this.scheduleList = res.data.scheduleDetailRespons || []
  173. this.scheduleDetail = res.data || {}
  174. this.scheduleList = this.scheduleList.map(item => ({
  175. ...item,
  176. peopleList: item.peopleObjectList.map(item => item.name).join(',')
  177. }))
  178. }
  179. },
  180. addSchedule() {
  181. this.detailData = null
  182. this.DialogTitle = '新建排期'
  183. this.visibleSchedule = true
  184. },
  185. deleteSchedule(row) { // 删除排期
  186. this.DialogTitle = '删除排期'
  187. this.isDelete = true
  188. this.visibleSchedule = true
  189. this.detailData = row
  190. },
  191. editSchedule(row) { // 编辑排期
  192. this.DialogTitle = '编辑排期'
  193. this.visibleSchedule = true
  194. this.detailData = row
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .add-schedule {
  201. cursor: pointer;
  202. color: #409EFF;
  203. font-size: 14px;
  204. width: calc(100% - 40px);
  205. margin: 0 20px;
  206. padding: 20px 0;
  207. i {
  208. margin-right: 4px;
  209. }
  210. span {
  211. margin-right: 20px;
  212. }
  213. }
  214. .schedule-list {
  215. width: calc(100% - 40px);
  216. margin: 0 20px;
  217. padding: 0;
  218. }
  219. >>>.el-table, .el-table__expanded-cell{
  220. background:rgba(248,248,248,0.6);
  221. }
  222. .bottom-detail {
  223. font-size: 14px;
  224. width: calc(100% - 40px);
  225. margin: 0 20px;
  226. padding: 20px 0;
  227. :first-child {
  228. margin-bottom: 10px;
  229. }
  230. }
  231. // .sortable-tip {
  232. // height: 26px;
  233. // width: 15px;
  234. // border-radius:2px;
  235. // margin: auto;
  236. // justify-content: center;
  237. // align-items: center;
  238. // img {
  239. // width: 8px;
  240. // }
  241. // }
  242. </style>
  243. <style>
  244. .el-tooltip__popper.is-dark {
  245. background:rgba(121,132,150,0.8);
  246. color: #FFF;
  247. }
  248. </style>