scheduleList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <div class="schedule-list" :class="className">
  3. <el-table
  4. :id="'schedule-'+id"
  5. :data="scheduleList"
  6. :header-cell-style="{ backgroundColor: 'rgba(232,232,232,0.4)', color: 'rgb(74, 74, 74)', fontSize: '14px', fontWeight: '500'}"
  7. style="width: 100%"
  8. show-overflow-tooltip="true"
  9. row-key="id"
  10. border
  11. stripe
  12. size="mini"
  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. {{ scope.row.name }}
  32. <div v-show="showunlock" :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="100"
  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. min-width="100"
  66. >
  67. <template slot-scope="scope">
  68. <el-popover
  69. placement="bottom"
  70. title="关联的任务"
  71. width="450"
  72. trigger="click"
  73. popper-class="synchronize"
  74. >
  75. <div class="blueStr" />
  76. <div class="task-object-list">
  77. <template v-for="(item,index) in scope.row.taskObjectList">
  78. <div v-if="index<5" :key="'task-object'+index" class="task-item" @click="link(item.id)">
  79. <span class="item-id">{{ item.taskId }}</span>
  80. <span class="item-name">{{ item.name }}</span>
  81. <span>{{ item.moduleInfoName }}</span>
  82. </div>
  83. </template>
  84. </div>
  85. <div v-if="scope.row.taskObjectList" slot="reference" class="point-blue">{{ scope.row.taskObjectList.length }}</div>
  86. </el-popover>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. label="操作"
  91. width="200"
  92. show-overflow-tooltip
  93. >
  94. <template slot-scope="scope">
  95. <div v-if="showunlock">
  96. <el-button v-if="scope.row.isScheduleLocked === 0" type="text" size="small" @click="editSchedule(scope.row)">编辑</el-button>
  97. <el-button v-if="scope.row.isScheduleLocked === 0" type="text" size="small" @click="deleteSchedule(scope.row)">删除</el-button>
  98. </div>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. <div class="bottom-detail">
  103. <el-row>交付日期:{{ scheduleDetail.endTime }}</el-row>
  104. <el-row>排期:{{ scheduleDetail.startTime | handlerDate }} ~ {{ scheduleDetail.endTime | handlerDate }} <span style="color: #999999; font-size: 14px;">{{ '(' + scheduleDetail.scheduleTimeAnnotation ? '' : scheduleDetail.scheduleTimeAnnotation.所有 + ')' }}</span></el-row>
  105. <el-row>预计上线版本:
  106. <span v-if="scheduleDetail.preOnlineVersion && scheduleDetail.preOnlineVersion.length > 0">
  107. <span v-for="item in scheduleDetail.preOnlineVersion" :key="item">{{ item }}</span>
  108. </span>
  109. <el-tooltip class="item" effect="dark" content="版本有问题?点击触发重新计算!" placement="right">
  110. <svg-icon :icon-class="icon_problem ? 'problem1' : 'problem'" style="cursor: pointer;" @mouseenter="icon_problem = true" @mouseleave="icon_problem = false" @click="taskUpdatePreOnlineVersion" />
  111. </el-tooltip>
  112. </el-row>
  113. </div>
  114. <modify-schedule
  115. v-if="visibleSchedule"
  116. :visible.sync="visibleSchedule"
  117. :is-delete.sync="isDelete"
  118. :detail-data="detailData"
  119. :title="DialogTitle"
  120. type="task"
  121. @update="listByTask(id)"
  122. />
  123. </div>
  124. </template>
  125. <script>
  126. import { taskUpdatePreOnlineVersion } from '@/api/taskIndex.js'
  127. import { EncryptId } from '@/utils/crypto-js.js'
  128. import { mapGetters } from 'vuex'
  129. import Sortable from 'sortablejs'
  130. import moment from 'moment'
  131. import 'moment/locale/zh-cn'
  132. import { listByTask, sortForTask } from '@/api/projectViewDetails'
  133. import modifySchedule from '@/views/projectManage/projectList/components/modifySchedule'
  134. import move from '@/assets/麻将@2x.png'
  135. export default {
  136. components: {
  137. modifySchedule
  138. },
  139. filters: {
  140. handlerDate(val) {
  141. return val ? moment(val).format('YYYY-MM-DD') : ''
  142. }
  143. },
  144. props: {
  145. id: {
  146. type: Number,
  147. default: NaN,
  148. required: true
  149. },
  150. typeList: {
  151. type: Array,
  152. default: () => [],
  153. required: false
  154. },
  155. className: {
  156. type: String,
  157. default: '',
  158. required: false
  159. },
  160. showunlock: {
  161. type: Boolean,
  162. default: false,
  163. required: false
  164. }
  165. },
  166. data() {
  167. return {
  168. taskId: '',
  169. move: move,
  170. icon_problem: false,
  171. scheduleList: [],
  172. scheduleDetail: {},
  173. visibleSchedule: false,
  174. detailData: null,
  175. taskScheduleEvent: [], // 排期类型
  176. DialogTitle: '新建排期',
  177. isDelete: false // 删除排期操作
  178. }
  179. },
  180. computed: {
  181. ...mapGetters(['bizId'])
  182. },
  183. watch: {
  184. id: {
  185. handler(newV, oldV) {
  186. if (newV === -1) return
  187. this.$nextTick(() => {
  188. this.listByTask(newV)
  189. })
  190. },
  191. immediate: true
  192. },
  193. typeList: {
  194. handler(newV, oldV) {
  195. this.scheduleList = newV
  196. this.taskScheduleEvent = newV
  197. },
  198. immediate: true
  199. }
  200. },
  201. mounted() {
  202. this.rowDrop()
  203. },
  204. methods: {
  205. rowDrop() {
  206. const tbody = document.querySelector(`#schedule-${this.id} tbody`)
  207. const _this = this
  208. Sortable.create(tbody, {
  209. onEnd({ newIndex, oldIndex }) {
  210. const currRow = _this.scheduleList.splice(oldIndex, 1)[0]
  211. _this.scheduleList.splice(newIndex, 0, currRow)
  212. _this.sortForTask(_this.scheduleList.map(item => item.id))
  213. }
  214. })
  215. },
  216. async sortForTask(arr) {
  217. const res = await sortForTask(this.id, arr)
  218. if (res.code === 200) {
  219. this.$message({ message: '移动成功', type: 'success', duration: 1000, offset: 150 })
  220. }
  221. },
  222. async taskUpdatePreOnlineVersion() {
  223. const res = await taskUpdatePreOnlineVersion(this.taskId)
  224. if (res.code === 200) {
  225. this.listByTask(this.taskId)
  226. this.$message({ message: '预计上线版本重新计算中,请稍后刷新页面查看!', type: 'success', offset: 150 })
  227. }
  228. },
  229. // getType(value) {
  230. // const res = this.taskScheduleEvent.find(item => item.code === value) || {}
  231. // return res.msg
  232. // },
  233. async listByTask(id) { // 获取排期列表
  234. this.taskId = id
  235. const res = await listByTask(id)
  236. if (res.code === 200) {
  237. this.scheduleList = res.data.scheduleDetailRespons || []
  238. this.scheduleDetail = res.data || {}
  239. this.scheduleList = this.scheduleList.map(item => ({
  240. ...item,
  241. peopleList: item.peopleObjectList.map(item => item.name).join(',')
  242. }))
  243. this.$emit('updataData')
  244. }
  245. },
  246. addSchedule() {
  247. this.detailData = null
  248. this.DialogTitle = '新建排期'
  249. this.visibleSchedule = true
  250. },
  251. deleteSchedule(row) { // 删除排期
  252. this.DialogTitle = '删除排期'
  253. this.isDelete = true
  254. this.visibleSchedule = true
  255. this.detailData = row
  256. },
  257. editSchedule(row) { // 编辑排期
  258. this.DialogTitle = '编辑排期'
  259. this.visibleSchedule = true
  260. this.detailData = row
  261. },
  262. link(id) {
  263. const bizId_id = EncryptId(`${this.bizId}_${id}`)
  264. const newTab = this.$router.resolve({ name: '任务详情', query: { bizId_id: bizId_id }})
  265. window.open(newTab.href, '_blank')
  266. }
  267. }
  268. }
  269. </script>
  270. <style lang="scss" scoped>
  271. .add-schedule {
  272. cursor: pointer;
  273. color: #409EFF;
  274. font-size: 14px;
  275. width: calc(100% - 40px);
  276. margin: 0 20px;
  277. padding: 20px 0;
  278. i {
  279. margin-right: 4px;
  280. }
  281. span {
  282. margin-right: 20px;
  283. }
  284. }
  285. .schedule-list {
  286. width: calc(100% - 40px);
  287. margin: 0 20px;
  288. padding: 0;
  289. }
  290. >>>.el-table, .el-table__expanded-cell{
  291. background:rgba(248,248,248,0.6);
  292. }
  293. .white {
  294. background: #ffffff;
  295. .add-schedule {
  296. padding: 0 0 20px 0;
  297. }
  298. /deep/.el-table{
  299. background: #ffffff !important;
  300. }
  301. }
  302. .bottom-detail {
  303. font-size: 14px;
  304. width: calc(100% - 40px);
  305. margin: 0 20px;
  306. padding: 20px 0;
  307. :nth-child(2) {
  308. margin: 10px 0;
  309. }
  310. }
  311. .sortable-tip {
  312. height: 26px;
  313. width: 15px;
  314. border-radius:2px;
  315. margin: auto;
  316. display: flex;
  317. justify-content: center;
  318. align-items: center;
  319. img {
  320. width: 8px;
  321. }
  322. }
  323. .point-blue {
  324. cursor: pointer;
  325. color: #409EFF;
  326. }
  327. .task-object-list {
  328. width: 100%;
  329. overflow: scroll;
  330. .task-item {
  331. width: 100%;
  332. white-space: nowrap;
  333. color: #999999;
  334. margin-bottom: 5px;
  335. .item-id {
  336. padding-right: 20px;
  337. }
  338. .item-name {
  339. color: #333333;
  340. padding-right: 20px;
  341. }
  342. }
  343. }
  344. .task-object-list::-webkit-scrollbar {
  345. display: none;
  346. }
  347. </style>
  348. <style lang="scss">
  349. .synchronize {
  350. .el-popover__title {
  351. color: #333333;
  352. padding: 10px 20px;
  353. }
  354. }
  355. .blueStr {
  356. width:4px;
  357. height:17px;
  358. background:#409EFF;
  359. border-radius:1px;
  360. position: absolute;
  361. top: 22px;
  362. left: 15px;
  363. }
  364. .el-tooltip__popper.is-dark {
  365. background:rgba(121,132,150,0.8);
  366. color: #FFF;
  367. }
  368. </style>