needsList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div>
  3. <div class="table-top">
  4. <label>{{ name }}的需求</label>
  5. <span class="new-tab-open">
  6. <el-switch
  7. v-model="newTabOpen"
  8. active-text="新标签页跳转"
  9. />
  10. </span>
  11. </div>
  12. <el-table
  13. ref="planTable"
  14. :data="needsDataList"
  15. style="width: 100%;"
  16. size="mini"
  17. row-key="id"
  18. :header-cell-style="{ color: 'rgb(74, 74, 74)', fontSize: '14px', fontWeight: '500'}"
  19. :row-style="{ fontSize: '14px' }"
  20. show-overflow-tooltip="true"
  21. :header-row-style="{height: '50px'}"
  22. >
  23. <el-table-column label="优先级" fixed prop="priority" width="100" sortable align="center">
  24. <template slot-scope="scope" style="text-align: center;">
  25. <span class="div_priority" :class="scope.row.priorityName">
  26. {{ scope.row.priorityName }}
  27. </span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="需求名称" fixed min-width="300" align="left" show-overflow-tooltip>
  31. <template slot-scope="scope">
  32. <div class="table-project-name" @click="needs_link(scope.row.id)">
  33. <span class="id">
  34. {{ scope.row.requirementDisplayId }}
  35. <img v-if="scope.row.type === 1" :src="extraUrgent" style="height: 17px;padding: 0 10px;">
  36. <div
  37. v-if="scope.row.optionsObject && scope.row.optionsObject.tagsType !==-1 && scope.row.optionsObject.remindTags && scope.row.status !== -2"
  38. :class="'tag-tip'+scope.row.optionsObject.tagsType"
  39. >{{ scope.row.optionsObject.remindTags }}
  40. </div>
  41. <div v-if="scope.row.status === -2" class="tag-tip1">hold</div>
  42. </span>
  43. <span class="name">{{ scope.row.name }}</span>
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="状态" width="150" align="left">
  48. <template slot-scope="scope">
  49. <el-select
  50. v-model="scope.row.status"
  51. :class="[
  52. {
  53. 'bottom-i': scope.row.status <= 0 || scope.row.status >= 30,
  54. 'bottom-u': scope.row.status === 10 || scope.row.status === 16,
  55. 'bottom-y': scope.row.status === 20
  56. },
  57. 'status'+scope.row.status
  58. ]"
  59. class="btnSize"
  60. size="mini"
  61. @change="changeStatus(scope.row)"
  62. >
  63. <el-option v-for="item in scope.row.availableStatusList" :key="item.code" :label="item.name" :value="item.code" />
  64. </el-select>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="PM" width="150" align="center" show-overflow-tooltip>
  68. <template v-if="scope.row.pmMemberInfoResponse" slot-scope="scope">
  69. <span>{{ scope.row.pmMemberInfoResponse.name }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="需求方向" min-width="150" align="center" show-overflow-tooltip>
  73. <template v-slot="scope">
  74. {{ scope.row.rqmtOrntNames }}
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="跟版客户端" width="200" align="center" prop="referredClientTypeName" show-overflow-tooltip />
  78. <el-table-column label="PRD链接" width="300" align="left" prop="mrdUrl" show-overflow-tooltip>
  79. <template v-slot="scope">
  80. <el-link :href="scope.row.mrdUrl" class="mrdUrl" target="_blank">{{ scope.row.mrdUrl }}</el-link>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="交付日期" min-width="200" align="center" show-overflow-tooltip>
  84. <template slot-scope="scope">{{ scope.row.optionsObject === null? '' :scope.row.optionsObject.endTime }}</template>
  85. </el-table-column>
  86. <el-table-column label="任务数量" width="100" align="center" prop="taskCount" show-overflow-tooltip />
  87. <el-table-column label="缺陷数量" width="100" align="center" prop="bugCount" show-overflow-tooltip />
  88. </el-table>
  89. <div align="right">
  90. <el-pagination
  91. :page-sizes="[10, 20, 30, total]"
  92. :current-page.sync="pages.curIndex"
  93. :page-size="pages.pageSize"
  94. background
  95. layout="total, sizes, prev, pager, next, jumper"
  96. :total="total"
  97. @size-change="handleSizeChange"
  98. @current-change="handleCurrentChange"
  99. />
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. import { configShowRequireStatusEnum, updateRequirementStatus, getRequirement } from '@/api/requirement'
  105. import extraUrgent from '@/assets/extraUrgent.png'
  106. export default {
  107. props: {
  108. idList: {
  109. type: Array,
  110. default: () => [],
  111. required: true
  112. },
  113. name: {
  114. type: String,
  115. default: '',
  116. required: false
  117. }
  118. },
  119. data() {
  120. return {
  121. newTabOpen: false, // 是否新的tab页打开
  122. extraUrgent: extraUrgent, // 紧急图片
  123. needsDataList: [], // 需求列表
  124. allStatus: [], // 状态列表
  125. pages: {
  126. pageSize: 10,
  127. curIndex: 1
  128. },
  129. total: 0
  130. }
  131. },
  132. watch: {
  133. idList: {
  134. handler(newV) {
  135. this.getNeedsList()
  136. },
  137. deep: true
  138. },
  139. name: {
  140. handler(newV) {},
  141. immediate: true
  142. }
  143. },
  144. created() {
  145. this.getTaskStatus()
  146. },
  147. methods: {
  148. setStatus(val) {
  149. this.status = val
  150. this.pages.curIndex = 1
  151. this.getNeedsList()
  152. },
  153. handleSizeChange(val) {
  154. this.pages.pageSize = val
  155. this.getNeedsList()
  156. },
  157. handleCurrentChange(val) {
  158. this.pages.curIndex = val
  159. this.getNeedsList()
  160. },
  161. async getTaskStatus() { // 获取需求的所有状态
  162. const res1 = await configShowRequireStatusEnum(localStorage.getItem('bizId'))
  163. if (res1.code === 200) {
  164. this.allStatus = []
  165. this.allStatus = res1.data.requirementStatus
  166. }
  167. },
  168. async getNeedsList() { // 获取需求列表
  169. if (this.idList.length === 0) {
  170. this.needsDataList = []
  171. return
  172. }
  173. const res = await getRequirement({ ids: this.idList, ...this.pages })
  174. if (res && res.code === 200) {
  175. this.needsDataList = res.data.list
  176. this.total = res.data.total
  177. }
  178. },
  179. async changeStatus(e) { // 状态改变
  180. const modifier = localStorage.getItem('username')
  181. const res = await updateRequirementStatus({ id: e.id, status: e.status, modifier: modifier })
  182. if (res.code === 200) {
  183. this.$message({ message: '修改成功', type: 'success', offset: 150 })
  184. this.getNeedsList()
  185. }
  186. },
  187. needs_link(id) {
  188. if (this.newTabOpen) {
  189. const newTab = this.$router.resolve({ name: '需求详情', query: { id: id }})
  190. window.open(newTab.href, '_blank')
  191. } else {
  192. this.$router.push({ name: '需求详情', query: { id: id }})
  193. }
  194. }
  195. }
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. @mixin setStatus($color) {
  200. input {
  201. color:$color;
  202. border: 1px solid $color;
  203. }
  204. >>> .el-select__caret{
  205. color:$color;
  206. }
  207. >>> .el-input__inner{
  208. color:$color;
  209. border-color: $color;
  210. }
  211. >>> .el-input__inner:focus {
  212. border-color: $color;
  213. }
  214. }
  215. >>>.el-row .el-col {
  216. margin: 10px 0;
  217. }
  218. .table-top {
  219. color: #333333;
  220. font-size: 16px;
  221. width: 100%;
  222. padding: 10px 15px 0 15px;
  223. display: flex;
  224. justify-content: space-between;
  225. }
  226. .color-blue {
  227. color:#409EFF;
  228. }
  229. .P0 {
  230. background-color: #F56C6C;
  231. }
  232. .P1 {
  233. background-color: #FF8952;
  234. }
  235. .P2 {
  236. background-color: #F5E300;
  237. }
  238. .P3 {
  239. background-color: #7ED321;
  240. }
  241. .P4 {
  242. background-color: #61D3B8;
  243. }
  244. .P5 {
  245. background-color: #69B3FF;
  246. }
  247. .P6 {
  248. background-color: #BDBDBD;
  249. }
  250. .status0 {
  251. @include setStatus(#409EFF)
  252. }
  253. .status10 {
  254. @include setStatus(#FF8952)
  255. }
  256. .status16 {
  257. @include setStatus(#FF8952)
  258. }
  259. .status20 {
  260. @include setStatus(#FF8952)
  261. }
  262. .status30 {
  263. @include setStatus(#FF8952)
  264. }
  265. .status40 {
  266. @include setStatus(#FF8952)
  267. }
  268. .status100 {
  269. @include setStatus(#FF8952)
  270. }
  271. .status150 {
  272. @include setStatus(#7ED321)
  273. }
  274. .tag-tip0,.tag-tip1 {
  275. margin-left: 5px;
  276. display: inline-block;
  277. padding: 0 5px;
  278. border-radius: 8px;
  279. height: 16px;
  280. line-height: 16px;
  281. }
  282. .tag-tip0 {
  283. background: rgba(255,137,82,0.15);
  284. color: rgba(255,137,82,1);
  285. }
  286. .tag-tip1{
  287. background: rgba(245,108,108,0.17);
  288. color: rgba(245,108,108,1);
  289. }
  290. .div_priority {
  291. text-align: center;
  292. color: #ffffff;
  293. padding: inherit;
  294. border-radius: 4px;
  295. width: 40px;
  296. display: inline-block;
  297. }
  298. .table-project-name {
  299. cursor: pointer;
  300. display: flex;
  301. justify-content: center;
  302. flex-direction: column;
  303. .id {
  304. color: #A7AEBC;
  305. font-size: 10px;
  306. }
  307. .name {
  308. font-size: 14px;
  309. color: #666666;
  310. overflow: hidden;
  311. white-space: nowrap;
  312. text-overflow: ellipsis;
  313. }
  314. }
  315. .mrdUrl{
  316. cursor: pointer;
  317. color: #69B3FF;
  318. }
  319. >>>.btnSize .el-input--suffix .el-input__inner {
  320. padding-right: 10px;
  321. padding-left: 10px;
  322. }
  323. .bottom-i { width: 73px; }
  324. .bottom-u { width: 100px; }
  325. .bottom-y { width: 110px; }
  326. </style>