|
@@ -155,22 +155,39 @@ export default {
|
|
|
},
|
|
|
rules: {
|
|
|
name: [
|
|
|
- {required: true, message: '请输入任务名称', trigger: 'blur'}
|
|
|
- // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
|
|
|
+ {required: true, message: '请输入任务名称', trigger: 'blur'},
|
|
|
+ {min: 5, max: 50, message: '任务名称长度在 5 到 50 个字符', trigger: 'blur'}
|
|
|
],
|
|
|
- datetime: [
|
|
|
+ type: [
|
|
|
+ {required: true, message: '业务类型不可为空'},
|
|
|
+ ],
|
|
|
+ desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
|
|
|
+ //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
|
|
|
+ quotePrice: [
|
|
|
+ {required: true, message: '预算不可为空', trigger: 'blur'},
|
|
|
{
|
|
|
- type: 'date',
|
|
|
- required: true,
|
|
|
- message: '请选择截止时间',
|
|
|
- trigger: 'change'
|
|
|
- }
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (parseInt(value) < 0) {
|
|
|
+ callback(new Error('请输入不小于0的数'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }, trigger: 'blur'
|
|
|
+ },
|
|
|
],
|
|
|
- type: [
|
|
|
- {required: true, message: '请选择业务类型', trigger: 'change'}
|
|
|
+ resource: [
|
|
|
+ {required: true},
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value == 0 && this.task.institution.id == null) {
|
|
|
+ callback(new Error('定向发布至少要选择一个测评机构'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }, trigger: 'change'
|
|
|
+ },
|
|
|
],
|
|
|
- desc: [{required: true, message: '请填写任务描述', trigger: 'blur'}],
|
|
|
- quotePrice: [{required: true, message: '请填写任务报价', trigger: 'blur'}]
|
|
|
+ datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -230,50 +247,35 @@ export default {
|
|
|
return provinceName + ' / ' + cityName
|
|
|
},
|
|
|
submitForm (formName) {
|
|
|
- this.showLoading()
|
|
|
- const newTask = {
|
|
|
- name: this.task.name,
|
|
|
- desc: this.task.desc,
|
|
|
- type: this.task.type,
|
|
|
- resource: this.task.resource,
|
|
|
- location: getProvinceNameByProvinceCode(this.task.location.provinceCode, this.task.location.cityCode),
|
|
|
- institution: this.task.institution.id,
|
|
|
- datetime: this.task.datetime,
|
|
|
- quotePrice: this.task.quotePrice,
|
|
|
- fixedPrice: this.task.fixedPrice,
|
|
|
- requirementFile: this.task.requireDocUrl
|
|
|
- }
|
|
|
- Http.post(Apis.TASK.CREATE_TASK.replace('{projectId}', this.projectId), newTask).then((res) => {
|
|
|
- console.log(res)
|
|
|
- this.hideLoading()
|
|
|
- this.createTaskSuccess(res.crowdTaskVO.id)
|
|
|
- }).catch((error) => {
|
|
|
- console.log(error)
|
|
|
- this.hideLoading()
|
|
|
- notify('error', error.data)
|
|
|
+ this.$refs['task'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.showLoading()
|
|
|
+ const newTask = {
|
|
|
+ name: this.task.name,
|
|
|
+ desc: this.task.desc,
|
|
|
+ type: this.task.type,
|
|
|
+ resource: this.task.resource,
|
|
|
+ location: getProvinceNameByProvinceCode(this.task.location.provinceCode, this.task.location.cityCode),
|
|
|
+ institution: this.task.institution.id,
|
|
|
+ datetime: this.task.datetime,
|
|
|
+ quotePrice: this.task.quotePrice,
|
|
|
+ fixedPrice: this.task.fixedPrice,
|
|
|
+ requirementFile: this.task.requireDocUrl
|
|
|
+ }
|
|
|
+ Http.post(Apis.TASK.CREATE_TASK.replace('{projectId}', this.projectId), newTask).then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ this.hideLoading()
|
|
|
+ this.createTaskSuccess(res.crowdTaskVO.id)
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', error.data)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ notify('error', '表单填写有误!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
})
|
|
|
- // this.$refs[formName].validate(valid => {
|
|
|
- // if (valid) {
|
|
|
- // const newTask = {
|
|
|
- // name: this.task.title,
|
|
|
- // desc: this.task.description,
|
|
|
- // type: this.task.serviceType,
|
|
|
- // resource: this.task.resource,
|
|
|
- // location: this.task.location,
|
|
|
- // institution:this.task.institution,
|
|
|
- // datetime:this.task.datetime,
|
|
|
- // quotePrice: this.task.quotePrice,
|
|
|
- // fixedPrice: this.task.fixedPrice
|
|
|
- // }
|
|
|
- // Http.post(Apis.TASK.CREATE_TASK.replace('{projectId}', 'PROJECT_1'), this.task).then((res) => {
|
|
|
- // console.log(res)
|
|
|
- // })
|
|
|
- // //提交 task
|
|
|
- // } else {
|
|
|
- // console.log('error submit!!')
|
|
|
- // return false
|
|
|
- // }
|
|
|
- // })
|
|
|
},
|
|
|
resetForm (formName) {
|
|
|
this.$refs.addFormProvince.resetProviceCity()
|
|
@@ -336,12 +338,12 @@ export default {
|
|
|
formData.append('file', param.file)
|
|
|
Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
|
|
|
this.hideLoading()
|
|
|
- notify('success','上传成功')
|
|
|
+ notify('success', '上传成功')
|
|
|
this.task.requireDocUrl = res.data
|
|
|
console.log(res.data)
|
|
|
- }).catch((error)=>{
|
|
|
+ }).catch((error) => {
|
|
|
this.hideLoading()
|
|
|
- notify('error','上传失败:'+error.data)
|
|
|
+ notify('error', '上传失败:' + error.data)
|
|
|
})
|
|
|
},
|
|
|
setServiceType () {
|