scheduleList.vue 6.8 KB

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