|
@@ -96,6 +96,54 @@
|
|
|
<div slot="tip" class="el-upload__tip">最多上传5个文件,单个文件不超过20MB</div>
|
|
<div slot="tip" class="el-upload__tip">最多上传5个文件,单个文件不超过20MB</div>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-divider content-position="left">研发任务</el-divider>
|
|
|
|
|
+
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="创建研发任务">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="form.createRdTask"
|
|
|
|
|
+ :disabled="hasRdTask"
|
|
|
|
|
+ placeholder="请选择"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ @change="handleCreateRdTaskChange">
|
|
|
|
|
+ <el-option v-if="!hasRdTask" label="否" value="false" />
|
|
|
|
|
+ <el-option label="是" value="true" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <span v-if="hasRdTask" style="color: #909399; font-size: 12px; margin-left: 8px">已创建研发任务</span>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
|
|
+ <template v-if="form.createRdTask === 'true' && !hasRdTask">
|
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="负责人" prop="rdTaskOpsUserId">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="form.rdTaskOpsUserId"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ filterable
|
|
|
|
|
+ :loading="rdUsersLoading"
|
|
|
|
|
+ placeholder="请选择负责人"
|
|
|
|
|
+ remote
|
|
|
|
|
+ :remote-method="remoteFetchRdUsers"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ @change="handleRdUserChange"
|
|
|
|
|
+ @visible-change="handleRdUserVisibleChange">
|
|
|
|
|
+ <el-option v-for="u in rdUserOptions" :key="u.value" :label="u.label" :value="u.value" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12">
|
|
|
|
|
+ <el-form-item label="任务类型" prop="rdTaskType">
|
|
|
|
|
+ <el-select v-model="form.rdTaskType" placeholder="请选择任务类型" style="width: 100%">
|
|
|
|
|
+ <el-option v-for="dict in rdTaskTypeOptions" :key="dict.key" :label="dict.value" :value="dict.key" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </template>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
<div slot="footer">
|
|
<div slot="footer">
|
|
@@ -112,8 +160,10 @@
|
|
|
import attachmentUploadMixin from '@/mixins/attachmentUpload'
|
|
import attachmentUploadMixin from '@/mixins/attachmentUpload'
|
|
|
import deliveryProjectApi from '@/api/devops/deliveryProject'
|
|
import deliveryProjectApi from '@/api/devops/deliveryProject'
|
|
|
import deliveryProjectEventApi from '@/api/devops/deliveryProjectEvent'
|
|
import deliveryProjectEventApi from '@/api/devops/deliveryProjectEvent'
|
|
|
|
|
+ import userApi from '@/api/system/user'
|
|
|
import store from '@/store'
|
|
import store from '@/store'
|
|
|
import { uploadRichtextImage } from '@/utils/richtextUpload'
|
|
import { uploadRichtextImage } from '@/utils/richtextUpload'
|
|
|
|
|
+ import { DEVOPS_DEV_DEPT_ID } from '@/config/devops.config'
|
|
|
import debounce from 'lodash/debounce'
|
|
import debounce from 'lodash/debounce'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -176,6 +226,10 @@
|
|
|
feedbackReporter: '',
|
|
feedbackReporter: '',
|
|
|
onSite: '20',
|
|
onSite: '20',
|
|
|
attachments: [],
|
|
attachments: [],
|
|
|
|
|
+ createRdTask: 'false',
|
|
|
|
|
+ rdTaskOpsUserId: null,
|
|
|
|
|
+ rdTaskOpsUserName: '',
|
|
|
|
|
+ rdTaskType: '',
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
|
projectId: [{ required: true, message: '请选择所属项目', trigger: 'change' }],
|
|
projectId: [{ required: true, message: '请选择所属项目', trigger: 'change' }],
|
|
@@ -183,12 +237,18 @@
|
|
|
deliveryEventType: [{ required: true, message: '请选择事件类型', trigger: 'change' }],
|
|
deliveryEventType: [{ required: true, message: '请选择事件类型', trigger: 'change' }],
|
|
|
feedbackSource: [{ required: true, message: '请选择反馈来源', trigger: 'change' }],
|
|
feedbackSource: [{ required: true, message: '请选择反馈来源', trigger: 'change' }],
|
|
|
feedbackReporter: [{ required: true, message: '请输入反馈人', trigger: 'blur' }],
|
|
feedbackReporter: [{ required: true, message: '请输入反馈人', trigger: 'blur' }],
|
|
|
|
|
+ rdTaskOpsUserId: [{ required: true, message: '请选择负责人', trigger: 'change' }],
|
|
|
|
|
+ rdTaskType: [{ required: true, message: '请选择任务类型', trigger: 'change' }],
|
|
|
},
|
|
},
|
|
|
submitLoading: false,
|
|
submitLoading: false,
|
|
|
projectOptions: [],
|
|
projectOptions: [],
|
|
|
deliveryEventTypeOptions: [],
|
|
deliveryEventTypeOptions: [],
|
|
|
feedbackSourceOptions: [],
|
|
feedbackSourceOptions: [],
|
|
|
onSiteOptions: [],
|
|
onSiteOptions: [],
|
|
|
|
|
+ rdUserOptions: [],
|
|
|
|
|
+ rdUsersLoading: false,
|
|
|
|
|
+ rdTaskTypeOptions: [],
|
|
|
|
|
+ hasRdTask: false, // 是否已关联研发任务(编辑时从后端获取)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -232,11 +292,13 @@
|
|
|
this.getDicts('delivery_event_type'),
|
|
this.getDicts('delivery_event_type'),
|
|
|
this.getDicts('feedback_source'),
|
|
this.getDicts('feedback_source'),
|
|
|
this.getDicts('sys_yes_no'),
|
|
this.getDicts('sys_yes_no'),
|
|
|
|
|
+ this.getDicts('ops_task_type'),
|
|
|
])
|
|
])
|
|
|
- .then(([eventType, feedbackSource, onSite]) => {
|
|
|
|
|
|
|
+ .then(([eventType, feedbackSource, onSite, rdTaskType]) => {
|
|
|
this.deliveryEventTypeOptions = eventType.data.values || []
|
|
this.deliveryEventTypeOptions = eventType.data.values || []
|
|
|
this.feedbackSourceOptions = feedbackSource.data.values || []
|
|
this.feedbackSourceOptions = feedbackSource.data.values || []
|
|
|
this.onSiteOptions = onSite.data.values || []
|
|
this.onSiteOptions = onSite.data.values || []
|
|
|
|
|
+ this.rdTaskTypeOptions = rdTaskType.data.values || []
|
|
|
})
|
|
})
|
|
|
.catch((err) => console.log(err))
|
|
.catch((err) => console.log(err))
|
|
|
},
|
|
},
|
|
@@ -255,6 +317,10 @@
|
|
|
feedbackReporter: data.feedbackReporter || data.feedback_reporter || '',
|
|
feedbackReporter: data.feedbackReporter || data.feedback_reporter || '',
|
|
|
onSite: data.onSite || data.on_site || '20',
|
|
onSite: data.onSite || data.on_site || '20',
|
|
|
attachments: data.attachments || [],
|
|
attachments: data.attachments || [],
|
|
|
|
|
+ createRdTask: 'false',
|
|
|
|
|
+ rdTaskOpsUserId: null,
|
|
|
|
|
+ rdTaskOpsUserName: '',
|
|
|
|
|
+ rdTaskType: '',
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
normalizeProjectOption(project) {
|
|
normalizeProjectOption(project) {
|
|
@@ -315,6 +381,10 @@
|
|
|
},
|
|
},
|
|
|
initForm() {
|
|
initForm() {
|
|
|
this.form = this.normalizeFormData(this.data)
|
|
this.form = this.normalizeFormData(this.data)
|
|
|
|
|
+ this.hasRdTask = this.data?.hasRdTask || false
|
|
|
|
|
+ if (this.hasRdTask) {
|
|
|
|
|
+ this.form.createRdTask = 'false'
|
|
|
|
|
+ }
|
|
|
this.searchProject('')
|
|
this.searchProject('')
|
|
|
this.initAttachmentFiles(this.form.attachments || [])
|
|
this.initAttachmentFiles(this.form.attachments || [])
|
|
|
},
|
|
},
|
|
@@ -332,7 +402,13 @@
|
|
|
feedbackReporter: nickName || userName || '',
|
|
feedbackReporter: nickName || userName || '',
|
|
|
onSite: '20',
|
|
onSite: '20',
|
|
|
attachments: [],
|
|
attachments: [],
|
|
|
|
|
+ createRdTask: 'false',
|
|
|
|
|
+ rdTaskOpsUserId: null,
|
|
|
|
|
+ rdTaskOpsUserName: '',
|
|
|
|
|
+ rdTaskType: '',
|
|
|
}
|
|
}
|
|
|
|
|
+ this.hasRdTask = false
|
|
|
|
|
+ this.rdUserOptions = []
|
|
|
this.searchProject('')
|
|
this.searchProject('')
|
|
|
this.resetAttachmentFiles()
|
|
this.resetAttachmentFiles()
|
|
|
if (this.editor) {
|
|
if (this.editor) {
|
|
@@ -348,15 +424,24 @@
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
this.$refs.form.validate(async (valid) => {
|
|
|
if (!valid) return
|
|
if (!valid) return
|
|
|
|
|
|
|
|
|
|
+ // 编辑模式下,如果已创建研发任务,禁止再次创建
|
|
|
|
|
+ if (this.form.id && this.hasRdTask && this.form.createRdTask === 'true') {
|
|
|
|
|
+ this.$message.warning('此事件已关联研发任务,无法再次创建')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.submitLoading = true
|
|
this.submitLoading = true
|
|
|
try {
|
|
try {
|
|
|
- // 上传附件
|
|
|
|
|
const uploadedAttachments = await this.uploadAttachments()
|
|
const uploadedAttachments = await this.uploadAttachments()
|
|
|
|
|
|
|
|
const submitData = {
|
|
const submitData = {
|
|
|
...this.form,
|
|
...this.form,
|
|
|
projectId: this.form.projectId ? parseInt(this.form.projectId) : null,
|
|
projectId: this.form.projectId ? parseInt(this.form.projectId) : null,
|
|
|
attachments: uploadedAttachments,
|
|
attachments: uploadedAttachments,
|
|
|
|
|
+ createRdTask: this.form.createRdTask === 'true',
|
|
|
|
|
+ rdTaskOpsUserId: this.form.createRdTask === 'true' ? this.form.rdTaskOpsUserId : null,
|
|
|
|
|
+ rdTaskOpsUserName: this.form.createRdTask === 'true' ? this.form.rdTaskOpsUserName : '',
|
|
|
|
|
+ rdTaskType: this.form.createRdTask === 'true' ? this.form.rdTaskType : '',
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const api = this.form.id ? deliveryProjectEventApi.update : deliveryProjectEventApi.create
|
|
const api = this.form.id ? deliveryProjectEventApi.update : deliveryProjectEventApi.create
|
|
@@ -373,6 +458,40 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ handleCreateRdTaskChange(val) {
|
|
|
|
|
+ if (val !== 'true') {
|
|
|
|
|
+ this.form.rdTaskOpsUserId = null
|
|
|
|
|
+ this.form.rdTaskOpsUserName = ''
|
|
|
|
|
+ this.form.rdTaskType = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ handleRdUserChange(userId) {
|
|
|
|
|
+ const user = this.rdUserOptions.find((u) => u.value === userId)
|
|
|
|
|
+ this.form.rdTaskOpsUserName = user ? user.label : ''
|
|
|
|
|
+ },
|
|
|
|
|
+ async remoteFetchRdUsers(query) {
|
|
|
|
|
+ this.rdUsersLoading = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const payload = { deptId: DEVOPS_DEV_DEPT_ID, pageNum: 1, pageSize: 999 }
|
|
|
|
|
+ if (query) payload.keyWords = query
|
|
|
|
|
+ const res = await userApi.getList(payload)
|
|
|
|
|
+ const list = res.data?.list || []
|
|
|
|
|
+ this.rdUserOptions = list.map((u) => ({
|
|
|
|
|
+ value: u.userId ?? u.user_id ?? u.id ?? null,
|
|
|
|
|
+ label: u.nickName ?? u.nick_name ?? u.name ?? '',
|
|
|
|
|
+ }))
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取研发人员列表失败:', error)
|
|
|
|
|
+ this.rdUserOptions = []
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.rdUsersLoading = false
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ handleRdUserVisibleChange(visible) {
|
|
|
|
|
+ if (visible && !this.rdUsersLoading && !this.rdUserOptions.length) {
|
|
|
|
|
+ this.remoteFetchRdUsers('')
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|