markingIssues.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div>
  3. <normal-dialog
  4. v-if="modalShow"
  5. ref="normalDialog"
  6. v-loading="loading"
  7. :show-dialog="false"
  8. is-succes
  9. :title="titleName"
  10. width="45%"
  11. @succes="updateModule"
  12. >
  13. <el-form :key="domKey" label-width="100px" style="padding-right: 20px;padding-left: 20px">
  14. <el-form-item label="问题">
  15. <el-input
  16. v-model="normalAreaName"
  17. autocomplete="off"
  18. size="small"
  19. type="textarea"
  20. :autosize="{ minRows: 2, maxRows: 30 }"
  21. show-word-limit
  22. placeholder="请输入问题"
  23. />
  24. </el-form-item>
  25. <el-form-item label="责任团队">
  26. <Cascader v-model="cascaderValue" />
  27. </el-form-item>
  28. <el-form-item label="责任人">
  29. <searchPeople
  30. ref="searchPeople"
  31. style="width: 100%"
  32. :value.sync="multiplePeople"
  33. :multiple="true"
  34. />
  35. </el-form-item>
  36. </el-form>
  37. </normal-dialog>
  38. </div>
  39. </template>
  40. <script>
  41. import { uuid10 } from '@/utils'
  42. import Cascader from '@/components/select/selectCascader'
  43. import normalDialog from '@/components/dialog/normalDialog'
  44. import Clickoutside from 'element-ui/src/utils/clickoutside'
  45. import searchPeople from '@/components/select/searchPeople'
  46. import { getDeptCharge } from '@/api/qualityMonthlyReport/edit'
  47. // import _ from 'lodash' // 人员select
  48. export default {
  49. name: 'CreatedItem',
  50. components: {
  51. normalDialog,
  52. searchPeople,
  53. Cascader
  54. },
  55. directives: { Clickoutside },
  56. data() {
  57. return {
  58. modalShow: false,
  59. titleName: '标记为重点问题',
  60. normalAreaName: '',
  61. menuData: '',
  62. domKey: '123456',
  63. callBack: null,
  64. columns: null,
  65. cascaderValue: null,
  66. headerTitle: null,
  67. subTitles: null,
  68. loading: false,
  69. multiplePeople: null
  70. }
  71. },
  72. computed: {
  73. tabPageData() {
  74. return this.$store.state.monthlyReportEdit.tabPageData
  75. },
  76. selectEnum() {
  77. return this.$store.state.monthlyReportEdit.selectEnum
  78. }
  79. },
  80. watch: {
  81. cascaderValue: {
  82. handler(newV, old) {
  83. if (newV.length) {
  84. if (this.$refs.searchPeople) {
  85. this.$refs.searchPeople.firstGetArr = true
  86. }
  87. this.setDeptCharge()
  88. } else {
  89. this.multiplePeople = ''
  90. }
  91. },
  92. deep: true
  93. }
  94. },
  95. methods: {
  96. uuid10,
  97. openModal(params) {
  98. this.loading = true
  99. this.multiplePeople = null
  100. this.domKey = new Date().getTime()
  101. const { title, scope, columns, normalAreaName, subTitles, headerTitle } = params
  102. this.titleName = title
  103. if (scope) this.menuData = scope.row
  104. if (columns) this.columns = columns
  105. this.$refs.normalDialog.visible = true
  106. this.modalShow = true
  107. this.subTitles = subTitles
  108. this.headerTitle = headerTitle
  109. if (normalAreaName) this.normalAreaName = normalAreaName
  110. // this.setDefaultValues()
  111. this.loading = false
  112. },
  113. // 设置默认值
  114. setDefaultValues() {
  115. this.normalAreaName = ''
  116. this.columns &&
  117. this.columns.forEach((elm) => {
  118. // 线上问题
  119. if (elm.name === '定级' && this.headerTitle === '线上问题' && this.normalAreaName.search(/级线上问题/) < 0) {
  120. this.normalAreaName = `${this.menuData[elm.headerKey]}级线上问题:${this.normalAreaName}`
  121. }
  122. if (elm.name === '问题') {
  123. this.normalAreaName += this.menuData[elm.headerKey]
  124. }
  125. if (elm.name.search(/团队/) > -1) {
  126. this.cascaderValue = this.menuData[elm.headerKey]
  127. }
  128. if (elm.name === '负责人') {
  129. this.multiplePeople = [this.menuData[elm.headerKey]]
  130. }
  131. })
  132. // 延期
  133. if (this.headerTitle.search(/延期 - |提测打回/) > -1) {
  134. this.normalAreaName = ''
  135. // elm.name === '延期类型'
  136. const headerKeyYQ = this.columns.filter(elm => elm.name.search(/类型/) > -1)[0]
  137. const headerKeyMC = this.columns.filter(elm => elm.name === '项目名称')[0]
  138. this.normalAreaName = `${this.menuData[headerKeyYQ.headerKey]}${this.menuData[headerKeyYQ.headerKey] && this.menuData[headerKeyMC.headerKey] && ':'}${this.menuData[headerKeyMC.headerKey]}`
  139. }
  140. // 线下缺陷:
  141. if (this.headerTitle === '线下缺陷') {
  142. this.normalAreaName = ''
  143. this.subTitles &&
  144. this.subTitles.forEach((elm, index) => {
  145. // this.normalAreaName += `${elm.copywriter}:${elm.label}`
  146. if (index < 3) {
  147. this.normalAreaName += `${elm.copywriter}:${elm.label}个${
  148. index === 2 ? ';' : ','
  149. }`
  150. }
  151. if (index === 3 && elm.label !== '--') {
  152. this.normalAreaName += `${elm.copywriter}:${elm.label}h;`
  153. }
  154. if (index === 4 && elm.label !== '--') {
  155. this.normalAreaName += `${elm.copywriter}:${elm.label}%;`
  156. }
  157. if (index === 5) {
  158. this.normalAreaName += `${elm.copywriter}:${elm.label}。`
  159. }
  160. })
  161. }
  162. // 发布&回滚
  163. if (this.headerTitle.search(/发布&回滚/) > -1) {
  164. const headerKeyMK = this.columns.filter(
  165. (elm) => elm.name.search(/模块/) > -1
  166. )[0]
  167. this.normalAreaName =
  168. this.menuData[headerKeyMK.headerKey] &&
  169. `${this.menuData[headerKeyMK.headerKey]}模块一次全量回滚`
  170. }
  171. if (this.cascaderValue && this.cascaderValue.length) {
  172. this.setDeptCharge()
  173. }
  174. },
  175. updateModule() {
  176. this.$store.commit('monthlyReportEdit/MARK_ISSUES', {
  177. cascaderValue: this.cascaderValue,
  178. normalAreaName: this.normalAreaName,
  179. multiplePeople: this.multiplePeople
  180. })
  181. this.modalShow = false
  182. this.$refs.normalDialog.visible = false
  183. },
  184. // 根据部门数据,设置团队负责人
  185. async setDeptCharge() {
  186. const res = await getDeptCharge({ deptCode: this.cascaderValue })
  187. if (res.code === 200) {
  188. if (!this.multiplePeople) {
  189. this.multiplePeople = []
  190. }
  191. // this.multiplePeople = [...this.multiplePeople, ...res.data.map(elm => elm.manageName)]
  192. this.multiplePeople = res.data.map(elm => elm.manageName)
  193. this.multiplePeople = Array.from(new Set(this.multiplePeople))
  194. }
  195. }
  196. }
  197. }
  198. </script>
  199. <style scoped lang="less">
  200. /deep/ .el-form-item__label {
  201. text-align: left !important;
  202. }
  203. .el-form-item {
  204. margin-bottom: 10px;
  205. }
  206. /deep/ .el-dialog__body {
  207. padding-bottom: 0;
  208. }
  209. </style>