|
@@ -1,40 +1,40 @@
|
|
|
<template>
|
|
|
- <div class="create-container">
|
|
|
+ <div class="create-container" v-loading="loading">
|
|
|
<div class="title h1" v-if="!isModifyMode">任务</div>
|
|
|
<div class="create-body">
|
|
|
<div class="title h2" v-if="!isModifyMode">基本信息</div>
|
|
|
<el-form :model="task" :rules="rules" ref="task" label-width="12%" class="demo-task">
|
|
|
- <el-form-item label="任务名称" prop="name">
|
|
|
- <el-input v-if="isModifyMode" v-model="task.title"></el-input>
|
|
|
+ <el-form-item label="任务名称" prop="title">
|
|
|
+ <el-input size="small" v-if="isModifyMode" v-model="task.title"></el-input>
|
|
|
<span v-if="!isModifyMode">{{task.title}}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="任务描述" prop="desc">
|
|
|
- <el-input v-if="isModifyMode" type="textarea" v-model="task.description"></el-input>
|
|
|
+ <el-input autosize v-if="isModifyMode" type="textarea" v-model="task.description"></el-input>
|
|
|
<span v-if="!isModifyMode">{{task.description}}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="任务报价" prop="quotePrice">
|
|
|
- <el-input v-if="isModifyMode" v-model="task.quotePrice"></el-input>
|
|
|
- <span v-if="!isModifyMode">{{task.quotePrice}}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="任务定价" prop="fixedPrice">
|
|
|
- <el-input v-if="isModifyMode" v-model="task.fixedPrice"></el-input>
|
|
|
- <span v-if="!isModifyMode">{{task.fixedPrice}}</span>
|
|
|
+ <el-input size="small" type="number" v-if="isModifyMode" v-model="task.quotePrice">
|
|
|
+ <template slot="append">¥</template>
|
|
|
+ </el-input>
|
|
|
+ <span v-if="!isModifyMode">{{task.quotePrice}}¥</span>
|
|
|
</el-form-item>
|
|
|
+ <!--<el-form-item type="number" label="任务定价" prop="fixedPrice">-->
|
|
|
+ <!--<el-input v-if="isModifyMode" v-model="task.fixedPrice">-->
|
|
|
+ <!--<template slot="append">¥</template>-->
|
|
|
+ <!--</el-input>-->
|
|
|
+ <!--<span v-if="!isModifyMode">{{task.fixedPrice}}</span>-->
|
|
|
+ <!--</el-form-item>-->
|
|
|
<el-form-item label="业务类型" prop="serviceType">
|
|
|
<el-radio-group v-if="isModifyMode" v-model="task.serviceType">
|
|
|
- <el-radio label="0" name="type">{{serviceType[0]}}</el-radio>
|
|
|
- <el-radio label="1" name="type">{{serviceType[1]}}</el-radio>
|
|
|
- <el-radio label="2" name="type">{{serviceType[2]}}</el-radio>
|
|
|
- <el-radio label="3" name="type">{{serviceType[3]}}</el-radio>
|
|
|
- <el-radio label="4" name="type">{{serviceType[4]}}</el-radio>
|
|
|
- <el-radio label="5" name="type">{{serviceType[5]}}</el-radio>
|
|
|
- <el-radio label="6" name="type">{{serviceType[6]}}</el-radio>
|
|
|
+ <span v-for="(item,index) in serviceType" :key="index">
|
|
|
+ <el-radio :label="item" name="type">{{item}}</el-radio>
|
|
|
+ </span>
|
|
|
</el-radio-group>
|
|
|
- <span class="badge" v-if="!isModifyMode">{{serviceType[task.serviceType]}}</span>
|
|
|
+ <span class="badge" v-if="!isModifyMode">{{task.serviceType}}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="任务可见性" prop="resource">
|
|
|
<div v-if="!isModifyMode">
|
|
|
- <div v-if="task.resource=='1'">{{updateLocation(task.location)}}</div>
|
|
|
+ <!--<div v-if="task.resource=='1'">{{updateLocation(task.location)}}</div>-->
|
|
|
<div v-if="task.resource=='0'">{{task.institution}}</div>
|
|
|
<div v-if="task.resource=='2'">{{resourceType[task.resource]}}</div>
|
|
|
</div>
|
|
@@ -51,22 +51,24 @@
|
|
|
name="type"
|
|
|
v-for="item,index in institutionArray"
|
|
|
:key="index"
|
|
|
- ></el-radio>
|
|
|
+ >{{item.name}}
|
|
|
+ </el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane :label="resourceType[1]" name="1">
|
|
|
- <provincecity
|
|
|
- ref="addFormProvince"
|
|
|
- @selectChange="locationChange"
|
|
|
- :provinceCode="task.location.provinceCode"
|
|
|
- :cityCode="task.location.cityCode"
|
|
|
- ></provincecity>
|
|
|
- </el-tab-pane>
|
|
|
+ <!--<el-tab-pane :label="resourceType[1]" name="1">-->
|
|
|
+ <!--<provincecity-->
|
|
|
+ <!--ref="addFormProvince"-->
|
|
|
+ <!--@selectChange="locationChange"-->
|
|
|
+ <!--:provinceCode="task.location == null ||task.location.provinceCode==null?'3200':task.location.provinceCode"-->
|
|
|
+ <!--:cityCode="task.location == null ||task.location.cityCode==null?'3201':task.location.cityCode"-->
|
|
|
+ <!--></provincecity>-->
|
|
|
+ <!--</el-tab-pane>-->
|
|
|
<el-tab-pane :label="resourceType[2]" name="2"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="需求文档" prop="doc">
|
|
|
<el-upload
|
|
|
+ style="width: 400px"
|
|
|
v-if="isModifyMode"
|
|
|
drag
|
|
|
class="upload-demo"
|
|
@@ -75,7 +77,7 @@
|
|
|
:before-remove="beforeRemove"
|
|
|
:limit="1"
|
|
|
:on-exceed="handleExceed"
|
|
|
- :before-upload="beforeFileUpload"
|
|
|
+
|
|
|
:http-request="uploadRequireDoc"
|
|
|
:file-list="task.doc"
|
|
|
>
|
|
@@ -84,20 +86,21 @@
|
|
|
将文件拖到此处,或
|
|
|
<em>点击上传</em>
|
|
|
</div>
|
|
|
- <div class="el-upload__tip" slot="tip">请上传需求文档</div>
|
|
|
</el-upload>
|
|
|
<span v-if="!isModifyMode">
|
|
|
- <span v-if="task.requireDocUrl == null">
|
|
|
- 暂无文件
|
|
|
+ <span v-if="task.requireDocUrl == null || task.requireDocUrl == ''">
|
|
|
+ <i class="el-icon-document"></i>暂无文件
|
|
|
</span>
|
|
|
- <span v-if="task.requireDocUrl != null">
|
|
|
- <a :href="task.requireDocUrl">{{task.requireDocUrl}}</a>
|
|
|
+ <span v-if="task.requireDocUrl != null && task.requireDocUrl != ''">
|
|
|
+ <a :href="task.requireDocUrl"><el-link :underline="false" type="primary"><i
|
|
|
+ class="el-icon-document"></i>下载文档</el-link></a>
|
|
|
</span>
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="任务截止时间" prop="datetime">
|
|
|
<div class="block" v-if="isModifyMode">
|
|
|
<el-date-picker
|
|
|
+ size="small"
|
|
|
v-model="task.datetime"
|
|
|
type="datetime"
|
|
|
placeholder="选择截止时间"
|
|
@@ -105,19 +108,77 @@
|
|
|
:picker-options="pickerOptions"
|
|
|
></el-date-picker>
|
|
|
</div>
|
|
|
- <span v-if="!isModifyMode">{{task.datetime}}</span>
|
|
|
+ <span v-if="!isModifyMode">{{reformDate(new Date(task.datetime))}}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="isModifyMode">
|
|
|
- <div class="btn btn-medium btn-info" @click="submitForm('task')">确认修改</div>
|
|
|
- <div class="btn btn-medium" @click="resetForm('task')">重置</div>
|
|
|
- <div class="btn btn-medium" @click="cancelMode('task')">取消</div>
|
|
|
+ <div class="btn btn-small btn-info" @click="updateTask()">确认修改</div>
|
|
|
+ <div class="btn btn-small" @click="resetForm()">重置</div>
|
|
|
+ <div class="btn btn-small" @click="cancelMode()">取消</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="!isModifyMode">
|
|
|
- <div class="btn btn-medium btn-info" @click="submitTaskRequest()">提交任务</div>
|
|
|
- <div class="btn btn-medium btn-info" @click="applyTask()">接收任务</div>
|
|
|
- <div class="btn btn-medium btn-info" @click="modifyForm()">修改</div>
|
|
|
- <div class="btn btn-medium btn-info" @click="createReport()">上传报告</div>
|
|
|
- <div class="btn btn-medium" @click="toProject()">前往项目</div>
|
|
|
+ <el-button size="mini" @click="toProject()">项目详情</el-button>
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ title="确认结束?"
|
|
|
+ width="200"
|
|
|
+ trigger="hover"
|
|
|
+ content="测评机构已提交结束申请,请确认是否结束该任务">
|
|
|
+ <el-button v-if="taskOperationControl.confirmFinish" type="success" size="mini" slot="reference"
|
|
|
+ @click="endTask()">确认结束
|
|
|
+ </el-button>
|
|
|
+ </el-popover>
|
|
|
+
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ title="确认提交?"
|
|
|
+ width="200"
|
|
|
+ trigger="hover"
|
|
|
+ content="提交任务后不可更改,等待区域管理员验收">
|
|
|
+ <el-button v-if="taskOperationControl.finish" type="primary" size="mini" slot="reference"
|
|
|
+ @click="submitTaskRequest()">提交任务
|
|
|
+ </el-button>
|
|
|
+ </el-popover>
|
|
|
+
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ title="确认拒绝?"
|
|
|
+ width="200"
|
|
|
+ trigger="hover"
|
|
|
+ content="拒绝后不可再接收此任务,且该任务对您不可见">
|
|
|
+ <el-button v-if="taskOperationControl.reject" type="danger" size="mini" slot="reference"
|
|
|
+ @click="rejectTask()">拒绝任务
|
|
|
+ </el-button>
|
|
|
+ </el-popover>
|
|
|
+
|
|
|
+ <el-popover
|
|
|
+ placement="top-start"
|
|
|
+ title="确认接收?"
|
|
|
+ width="200"
|
|
|
+ trigger="hover"
|
|
|
+ content="接收任务后请认真完成!">
|
|
|
+ <el-button v-if="taskOperationControl.receive" type="primary" size="mini" slot="reference"
|
|
|
+ @click="receiveTask()">接收任务
|
|
|
+ </el-button>
|
|
|
+ </el-popover>
|
|
|
+
|
|
|
+
|
|
|
+ <el-button v-if="taskOperationControl.update" type="primary" size="mini" @click="modifyForm()">修改任务
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="taskOperationControl.uploadReport" type="primary" size="mini" @click="toCreateReport()">
|
|
|
+ 上传报告
|
|
|
+ </el-button>
|
|
|
+ <!--<div class="btn btn-small btn-info"-->
|
|
|
+ <!--v-if="taskOperationControl.confirmFinish"-->
|
|
|
+ <!--@click="endTask()">确认结束-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="btn btn-small btn-info" v-if="!taskOperationControl.finish" @click="submitTaskRequest()">提交任务-->
|
|
|
+ <!--</div>-->
|
|
|
+ <!--<div class="btn btn-small btn-info" v-if="!taskOperationControl.receive" @click="receiveTask()">接收任务</div>-->
|
|
|
+ <!--<div class="btn btn-small btn-danger" v-if="!taskOperationControl.reject" @click="rejectTask()">拒绝任务</div>-->
|
|
|
+ <!--<div class="btn btn-small btn-info" v-if="taskOperationControl.update" @click="modifyForm()">修改任务</div>-->
|
|
|
+ <!--<div class="btn btn-small btn-info" v-if="!taskOperationControl.uploadReport" @click="toCreateReport()">上传报告-->
|
|
|
+ <!--</div>-->
|
|
|
+
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -129,15 +190,27 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Enum from '@/constants/enum/index'
|
|
|
import ResourceType from '@/constants/enum/resource-type.js'
|
|
|
-import ServiceType from '@/constants/enum/service-type'
|
|
|
import provincecity from '@/components/commons/ProvinceCity'
|
|
|
-import provinceCityJSON from '@/constants/provinceCity.json'
|
|
|
import ReportList from '@/components/report/ReportList'
|
|
|
import Http from '@/js/http.js'
|
|
|
import Apis from '@/js/api.js'
|
|
|
import {notify} from '@/constants/index'
|
|
|
+import {
|
|
|
+ ensureEndTask,
|
|
|
+ getAllAgencies,
|
|
|
+ getAllServiceTypes,
|
|
|
+ getFormalTimeFromDate,
|
|
|
+ getProvinceCodeByProvinceName,
|
|
|
+ getProvinceNameByProvinceCode,
|
|
|
+ getTask,
|
|
|
+ receiveTaskRequest,
|
|
|
+ rejectTask,
|
|
|
+ storageGet,
|
|
|
+ submitTaskRequest,
|
|
|
+ updateTask
|
|
|
+} from '@/js/index'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'Task',
|
|
|
components: {
|
|
@@ -146,20 +219,32 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ user: {},
|
|
|
+ rolesPermissions: {},
|
|
|
+ loading: false,
|
|
|
isModifyMode: false,
|
|
|
- institutionArray: Enum.institution,
|
|
|
+ institutionArray: [],
|
|
|
tabPosition: 'top',
|
|
|
resourceType: ResourceType,
|
|
|
- serviceType: ServiceType,
|
|
|
+ serviceType: [],
|
|
|
taskId: '',
|
|
|
projectId: '',
|
|
|
+ taskOperationControl: {
|
|
|
+ confirmFinish: false,
|
|
|
+ finish: false,
|
|
|
+ receive: false,
|
|
|
+ update: false,
|
|
|
+ uploadReport: false
|
|
|
+ },
|
|
|
task: {
|
|
|
+ agencyId: '',
|
|
|
+ status: '',
|
|
|
name: '',
|
|
|
desc: '',
|
|
|
- type: '',
|
|
|
+ serviceType: '',
|
|
|
resource: '',
|
|
|
location: {},
|
|
|
- institution: '',
|
|
|
+ institution: {},
|
|
|
datetime: '',
|
|
|
quotePrice: '',
|
|
|
fixedPrice: '',
|
|
@@ -194,46 +279,68 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
rules: {
|
|
|
- // name: [
|
|
|
- // {required: true, message: '请输入任务名称', trigger: 'blur'}
|
|
|
- // // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
|
|
|
- // ],
|
|
|
- // datetime: [
|
|
|
- // {
|
|
|
- // type: 'date',
|
|
|
- // required: true,
|
|
|
- // message: '请选择截止时间',
|
|
|
- // trigger: 'change'
|
|
|
- // }
|
|
|
- // ],
|
|
|
- // type: [
|
|
|
- // {required: true, message: '请选择业务类型', trigger: 'change'}
|
|
|
- // ],
|
|
|
- //desc: [{required: true, message: '请填写任务描述', trigger: 'blur'}],
|
|
|
- // quotePrice: [{required: true, message: '请填写任务报价', trigger: 'blur'}],
|
|
|
- //fixedPrice: [{required: true, message: '请填写任务定价', trigger: 'blur'}]
|
|
|
+ title: [
|
|
|
+ {required: true, message: '请输入任务名称', trigger: 'blur'},
|
|
|
+ {min: 5, max: 50, message: '任务名称长度在 5 到 50 个字符', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ type: [
|
|
|
+ {required: true, message: '业务类型不可为空'},
|
|
|
+ ],
|
|
|
+ desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
|
|
|
+ //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
|
|
|
+ quotePrice: [
|
|
|
+ {required: true, message: '预算不可为空', trigger: 'blur'},
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value <= 0) {
|
|
|
+ callback(new Error('请输入大于0的数'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }, trigger: 'blur'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ resource: [
|
|
|
+ {required: true},
|
|
|
+ {
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ if (value == 0 && this.task.institution.id == null) {
|
|
|
+ callback(new Error('定向发布至少要选择一个测评机构'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }, trigger: 'change'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- 'task.institution' () {
|
|
|
- if (this.task.institution) {
|
|
|
- this.$refs.addFormProvince.resetProviceCity()
|
|
|
- this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
- }
|
|
|
+ institutionArray (val) {
|
|
|
+ this.institutionArray = val
|
|
|
},
|
|
|
- 'task.location' () {
|
|
|
- if (this.task.location.provinceCode || this.task.location.cityCode) {
|
|
|
- this.task.institution = ''
|
|
|
- }
|
|
|
- },
|
|
|
- 'task.resource' () {
|
|
|
- if (this.task.resource == '广场') {
|
|
|
- this.$refs.addFormProvince.resetProviceCity()
|
|
|
- this.task.institution = ''
|
|
|
- this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
- }
|
|
|
+ serviceType (val) {
|
|
|
+ this.serviceType = val
|
|
|
},
|
|
|
+ // 'task.institution' () {
|
|
|
+ // if (this.task.institution) {
|
|
|
+ // //this.$refs.addFormProvince.resetProviceCity()
|
|
|
+ // this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 'task.location' () {
|
|
|
+ // if (this.task.location.provinceCode || this.task.location.cityCode) {
|
|
|
+ // this.task.institution = ''
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // 'task.resource' () {
|
|
|
+ // if (this.task.resource == '广场') {
|
|
|
+ // this.$refs.addFormProvince.resetProviceCity()
|
|
|
+ // this.task.institution = ''
|
|
|
+ // this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
+ // }
|
|
|
+ // },
|
|
|
deep: true
|
|
|
},
|
|
|
mounted () {
|
|
@@ -245,136 +352,191 @@ export default {
|
|
|
init () {
|
|
|
this.taskId = this.$route.params.taskId
|
|
|
this.projectId = this.$route.params.projectId
|
|
|
- this.loadData(this.projectId, this.taskId)
|
|
|
- },
|
|
|
- updateLocation (location) {
|
|
|
- var provinceName = ''
|
|
|
- var cityName = ''
|
|
|
- for (var item of provinceCityJSON.provinces) {
|
|
|
- if (item.code === location.provinceCode) {
|
|
|
- provinceName = item.name
|
|
|
- for (var city of item.cities) {
|
|
|
- if (city.code === location.cityCode) {
|
|
|
- cityName = city.name
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return provinceName + ' / ' + cityName
|
|
|
+ this.setUserInfo()
|
|
|
+ this.setServiceType()
|
|
|
+ //this.loadData(this.projectId, this.taskId)
|
|
|
+ this.getTaskDetail()
|
|
|
+ this.setInstitutions()
|
|
|
+ },
|
|
|
+
|
|
|
+ //跳转至项目详情页面
|
|
|
+ toProject () {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'Project',
|
|
|
+ params: {projectId: this.projectId}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //切换至可编辑页面
|
|
|
+ modifyForm () {
|
|
|
+ this.isModifyMode = true
|
|
|
},
|
|
|
- submitForm (formName) {
|
|
|
- console.log(this.task)
|
|
|
- this.$refs[formName].validate(valid => {
|
|
|
+ //切换至不可编辑页面
|
|
|
+ cancelMode () {
|
|
|
+ this.isModifyMode = false
|
|
|
+ },
|
|
|
+ //重置表单
|
|
|
+ resetForm () {
|
|
|
+ this.task.name = ''
|
|
|
+ this.task.desc = ''
|
|
|
+ this.task.quotePrice = ''
|
|
|
+ this.task.fixedPrice = ''
|
|
|
+ this.task.type = ''
|
|
|
+ this.task.resource = '2' //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
+ this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
+ this.task.institution = ''
|
|
|
+ this.task.datetime = ''
|
|
|
+ },
|
|
|
+ //显示页面加载画面
|
|
|
+ showLoading () {
|
|
|
+ this.loading = true
|
|
|
+ },
|
|
|
+ //隐藏页面加载画面
|
|
|
+ hideLoading () {
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ //加载用户信息
|
|
|
+ setUserInfo () {
|
|
|
+ this.user = storageGet('user')
|
|
|
+ this.rolesPermissions = storageGet('rolesPermissions')
|
|
|
+ },
|
|
|
+ //加载任务的服务类型
|
|
|
+ setServiceType () {
|
|
|
+ getAllServiceTypes().then((res) => {
|
|
|
+ this.serviceType = res
|
|
|
+ }).catch((error) => {
|
|
|
+ notify('error', '加载任务类型失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //加载所有的测评机构
|
|
|
+ setInstitutions () {
|
|
|
+ getAllAgencies().then((res) => {
|
|
|
+ this.institutionArray = res
|
|
|
+ }).catch((error) => {
|
|
|
+ notify('error', '获取机构列表失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取任务详情
|
|
|
+ getTaskDetail () {
|
|
|
+ this.showLoading()
|
|
|
+ getTask(this.projectId, this.taskId, this.getTaskDetailSuccess, this.getTaskDetailFail)
|
|
|
+ },
|
|
|
+ //获取任务详情成功时回调函数
|
|
|
+ getTaskDetailSuccess (res) {
|
|
|
+ this.hideLoading()
|
|
|
+ //console.log(res.crowdTaskVO)
|
|
|
+ this.taskId = res.crowdTaskVO.id
|
|
|
+ this.projectId = res.crowdTaskVO.projectId
|
|
|
+ this.task.title = res.crowdTaskVO.title
|
|
|
+ this.task.description = res.crowdTaskVO.description
|
|
|
+ this.task.serviceType = res.crowdTaskVO.serviceType
|
|
|
+ this.task.resource = res.crowdTaskVO.resource
|
|
|
+ this.task.location = getProvinceCodeByProvinceName(res.crowdTaskVO.location.provinceCode, res.crowdTaskVO.location.cityCode)
|
|
|
+ this.task.institution = res.crowdTaskVO.institution
|
|
|
+ this.task.datetime = new Date(res.crowdTaskVO.datetime)
|
|
|
+ this.task.quotePrice = res.crowdTaskVO.quotePrice
|
|
|
+ this.task.fixedPrice = res.crowdTaskVO.fixedPrice
|
|
|
+ this.task.doc = []
|
|
|
+ this.task.requireDocUrl = res.crowdTaskVO.requirementFile
|
|
|
+ this.task.agencyId = res.crowdTaskVO.agencyId
|
|
|
+ this.task.status = res.crowdTaskVO.status
|
|
|
+ this.taskOperationControl = res.taskOperationControl
|
|
|
+ this.reportList = res.crowdReportVOList
|
|
|
+ },
|
|
|
+ //获取任务详情失败时回调函数
|
|
|
+ getTaskDetailFail (error) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', '获取任务详情失败:' + error.data)
|
|
|
+ },
|
|
|
+ //更新任务信息
|
|
|
+ updateTask () {
|
|
|
+ this.$refs['task'].validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.isModifyMode = false
|
|
|
+ this.showLoading()
|
|
|
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,
|
|
|
+ location: this.task.location == null ? {} : 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,
|
|
|
- requireDoc: this.task.requireDocUrl
|
|
|
+ requirementFile: this.task.requireDocUrl
|
|
|
}
|
|
|
- //修改TASK
|
|
|
- Http.put(Apis.TASK.UPDATE_TASK.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId), newTask).then((res) => {
|
|
|
- console.log(res)
|
|
|
- })
|
|
|
- //提交 task
|
|
|
+ //console.log(newTask)
|
|
|
+ updateTask(this.projectId, this.taskId, newTask, this.updateTaskSuccess, this.updateTaskFail)
|
|
|
} else {
|
|
|
- console.log('error submit!!')
|
|
|
+ notify('error', '表单填写有误!')
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- cancelMode (formName) {
|
|
|
- this.isModifyMode = false
|
|
|
- },
|
|
|
- modifyForm () {
|
|
|
- this.isModifyMode = true
|
|
|
- },
|
|
|
- resetForm (formName) {
|
|
|
- this.$refs.addFormProvince.resetProviceCity()
|
|
|
- this.$refs[formName].resetFields()
|
|
|
- this.task.name = ''
|
|
|
- this.task.desc = ''
|
|
|
- this.task.quotePrice = ''
|
|
|
- this.task.fixedPrice = ''
|
|
|
- this.task.type = ''
|
|
|
- this.task.resource = '2'; //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
- (this.task.location = {provinceCode: '', cityCode: ''}),
|
|
|
- (this.task.institution = '')
|
|
|
- this.task.datetime = ''
|
|
|
+ //更新任务信息成功时回调函数
|
|
|
+ updateTaskSuccess (res) {
|
|
|
+ this.cancelMode()
|
|
|
+ this.taskId = res.crowdTaskVO.id
|
|
|
+ this.projectId = res.crowdTaskVO.projectId
|
|
|
+ this.task.title = res.crowdTaskVO.title
|
|
|
+ this.task.description = res.crowdTaskVO.description
|
|
|
+ this.task.serviceType = res.crowdTaskVO.serviceType
|
|
|
+ this.task.resource = res.crowdTaskVO.resource
|
|
|
+ this.task.location = res.crowdTaskVO.location == null ? {
|
|
|
+ provinceCode: 3200,
|
|
|
+ cityCode: 3201
|
|
|
+ } : getProvinceCodeByProvinceName(res.crowdTaskVO.location.provinceCode, res.crowdTaskVO.location.cityCode)
|
|
|
+ this.task.institution = res.crowdTaskVO.institution
|
|
|
+ this.task.datetime = new Date(res.crowdTaskVO.datetime)
|
|
|
+ this.task.quotePrice = res.crowdTaskVO.quotePrice
|
|
|
+ this.task.fixedPrice = res.crowdTaskVO.fixedPrice
|
|
|
+ this.task.doc = []
|
|
|
+ this.task.requireDocUrl = res.crowdTaskVO.requirementFile
|
|
|
+ this.reportList = res.crowdReportVOList
|
|
|
+ this.hideLoading()
|
|
|
+ notify('success', '修改成功')
|
|
|
},
|
|
|
- locationChange (provinceId, cityId) {
|
|
|
- if (provinceId || cityId) {
|
|
|
- this.task.location = {provinceCode: provinceId, cityCode: cityId}
|
|
|
- }
|
|
|
+ //更新任务信息失败时回调函数
|
|
|
+ updateTaskFail (error) {
|
|
|
+ notify('error', '修改失败:' + error.data)
|
|
|
+ this.hideLoading()
|
|
|
},
|
|
|
- toProject () {
|
|
|
- this.$router.push({
|
|
|
- name: 'Project',
|
|
|
- params: {projectId: this.projectId}
|
|
|
- })
|
|
|
- },
|
|
|
- applyTask () {
|
|
|
- const data = {
|
|
|
- userId: 3,
|
|
|
- projectId: this.projectId,
|
|
|
- taskId: this.taskId
|
|
|
+ //上传任务需求文档
|
|
|
+ uploadRequireDoc (param) {
|
|
|
+ const formData = new FormData()
|
|
|
+ let config = {
|
|
|
+ //添加请求头
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'},
|
|
|
}
|
|
|
- Http.post(Apis.USER.ACCEPT_TASK, data).then((res) => {
|
|
|
- console.log(res)
|
|
|
+ formData.append('file', param.file)
|
|
|
+ Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
|
|
|
+ this.uploadRequireDocSuccess(res)
|
|
|
+ }).catch((error) => {
|
|
|
+ this.uploadRequireDocFail(error)
|
|
|
})
|
|
|
},
|
|
|
- submitTaskRequest () {
|
|
|
- const data = {
|
|
|
- userId: 3,
|
|
|
- projectId: this.projectId,
|
|
|
- taskId: this.taskId
|
|
|
- }
|
|
|
- Http.post(Apis.USER.SUBMIT_TASK_REQUEST, data).then((res) => {
|
|
|
- console.log(res)
|
|
|
- })
|
|
|
+ //上传任务需求文档成功时回调函数
|
|
|
+ uploadRequireDocSuccess (res) {
|
|
|
+ this.hideLoading()
|
|
|
+ console.log('上传成功')
|
|
|
+ this.task.requireDocUrl = res.data
|
|
|
+ console.log(res.data)
|
|
|
},
|
|
|
- createReport () {
|
|
|
- this.$router.push({
|
|
|
- name: 'ReportCreate',
|
|
|
- params: {
|
|
|
- scope: 1,
|
|
|
- dependencyCode: this.taskId,
|
|
|
- projectId: this.projectId,
|
|
|
- taskId: this.taskId,
|
|
|
- }
|
|
|
- })
|
|
|
+ //上传任务需求文档失败时回调函数
|
|
|
+ uploadRequireDocFail (error) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', '任务需求文档上传失败:' + error.data)
|
|
|
},
|
|
|
- loadData (projectId, taskId) {
|
|
|
- //replace('{taskId}', this.taskId)
|
|
|
- Http.get(Apis.TASK.GET_TASK.replace('{projectId}', projectId).replace('{taskId}', taskId)).then((res) => {
|
|
|
- this.taskId = res.crowdTaskVO.id
|
|
|
- this.projectId = res.crowdTaskVO.projectId
|
|
|
- this.task.title = res.crowdTaskVO.title
|
|
|
- this.task.description = res.crowdTaskVO.description
|
|
|
- this.task.serviceType = res.crowdTaskVO.serviceType
|
|
|
- this.task.resource = res.crowdTaskVO.resource
|
|
|
- this.task.location = res.crowdTaskVO.location
|
|
|
- this.task.institution = res.crowdTaskVO.institution
|
|
|
- this.task.datetime = new Date(res.crowdTaskVO.datetime)
|
|
|
- this.task.quotePrice = res.crowdTaskVO.quotePrice
|
|
|
- this.task.fixedPrice = res.crowdTaskVO.fixedPrice
|
|
|
- this.task.doc = []
|
|
|
- this.task.requireDocUrl = res.crowdTaskVO.requireDocUrl
|
|
|
+ //文档上传前响应函数
|
|
|
|
|
|
- this.reportList = res.crowdReportVOList
|
|
|
- })
|
|
|
+ //移除文档前的响应函数
|
|
|
+ beforeRemove (file, fileList) {
|
|
|
+ //return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
},
|
|
|
+ //移除文档时的响应函数
|
|
|
handleRemove (file, fileList) {
|
|
|
console.log(file, fileList)
|
|
|
},
|
|
|
+ //需求文档添加进来时的响应函数
|
|
|
handleExceed (files, fileList) {
|
|
|
this.$message.warning(
|
|
|
`当前限制选择 1 个文件,本次选择了 ${
|
|
@@ -382,54 +544,165 @@ export default {
|
|
|
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
|
)
|
|
|
},
|
|
|
- beforeRemove (file, fileList) {
|
|
|
- //return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
+ //接收任务
|
|
|
+ receiveTask () {
|
|
|
+ this.$confirm('确认接收任务?', '提示', {
|
|
|
+ confirmButtonText: '确认接收',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'success'
|
|
|
+ }).then(() => {
|
|
|
+ this.showLoading()
|
|
|
+ receiveTaskRequest(this.projectId, this.taskId, this.user.userVO.id, this.receiveTaskSuccess, this.receiveTaskFail)
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
},
|
|
|
- beforeFileUpload (file) {
|
|
|
- console.log(file)
|
|
|
- const isPDF = file.type === 'application/pdf'
|
|
|
- const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
|
|
- const isEXCEL = file.type === 'application/vnd.ms-excel'
|
|
|
- const isXLS = file.type === 'application/x-xls'
|
|
|
- const isTXT = file.type === 'text/plain'
|
|
|
- const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
- //console.log(file)
|
|
|
- if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
|
|
|
- this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
|
|
|
- }
|
|
|
- return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
|
|
|
+ //接收任务成功时的回调函数
|
|
|
+ receiveTaskSuccess (res) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('success', '接收任务成功')
|
|
|
+ console.log(res)
|
|
|
+ this.taskOperationControl = res.taskOperationControl
|
|
|
+ this.task.status = res.crowdTaskVO.status
|
|
|
+ this.task.institution = res.crowdTaskVO.institution
|
|
|
},
|
|
|
- uploadProjectCreateExcelFile (param) {
|
|
|
- const formData = new FormData()
|
|
|
- let config = {
|
|
|
- //添加请求头
|
|
|
- headers: {'Content-Type': 'multipart/form-data'},
|
|
|
- }
|
|
|
- formData.append('file', param.file)
|
|
|
- Http.upload(Apis.PROJECT.ADD_PROJECT_BY_EXCEL, formData, config).then((res) => {
|
|
|
- console.log('上传成功')
|
|
|
- this.project.excelFileUrl = res.data
|
|
|
- console.log(res.data)
|
|
|
+ //接收任务失败时的回调函数
|
|
|
+ receiveTaskFail (error) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', '接收任务失败:' + error.data)
|
|
|
+ },
|
|
|
+ //拒绝任务
|
|
|
+ rejectTask () {
|
|
|
+ this.$confirm('确认拒绝任务?拒绝后将不能再接收该任务', '提示', {
|
|
|
+ confirmButtonText: '确认拒绝',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'success'
|
|
|
+ }).then(() => {
|
|
|
+ this.showLoading()
|
|
|
+ rejectTask(this.projectId, this.taskId, this.rejectTaskSuccess, this.rejectTaskFail)
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
- uploadRequireDoc (param) {
|
|
|
- const formData = new FormData()
|
|
|
- let config = {
|
|
|
- //添加请求头
|
|
|
- headers: {'Content-Type': 'multipart/form-data'},
|
|
|
- }
|
|
|
- formData.append('file', param.file)
|
|
|
- Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', 3), formData, config).then((res) => {
|
|
|
- console.log('上传成功')
|
|
|
- this.task.requireDocUrl = res.data
|
|
|
- console.log(res.data)
|
|
|
+ //拒绝任务成功时的回调函数
|
|
|
+ rejectTaskSuccess (res) {
|
|
|
+ this.hideLoading()
|
|
|
+ this.$router.push({
|
|
|
+ name: 'Mine'
|
|
|
+ })
|
|
|
+ notify('success', '拒绝任务成功,已为您自动跳转到个人中心')
|
|
|
+ },
|
|
|
+ //拒绝任务失败时的回调函数
|
|
|
+ rejectTaskFail (error) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', '拒绝任务失败:' + error.data)
|
|
|
+ },
|
|
|
+ //提交结束任务申请
|
|
|
+ submitTaskRequest () {
|
|
|
+ this.$confirm('确认提交任务?提交后将不能再修改', '提示', {
|
|
|
+ confirmButtonText: '确认提交',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'success'
|
|
|
+ }).then(() => {
|
|
|
+ this.showLoading()
|
|
|
+ submitTaskRequest(this.projectId, this.taskId, this.submitTaskRequestSuccess, this.submitTaskRequestFail)
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
+ //提交结束任务申请成功时的回调函数
|
|
|
+ submitTaskRequestSuccess (res) {
|
|
|
+ this.hideLoading()
|
|
|
+ console.log(res)
|
|
|
+ this.taskOperationControl = res.taskOperationControl
|
|
|
+ this.task.status = res.crowdTaskVO.status
|
|
|
+ this.task.institution = res.crowdTaskVO.institution
|
|
|
+ notify('success', '提交任务成功,等待区域管理员审核')
|
|
|
+ },
|
|
|
+ //提交结束任务申请失败时的回调函数
|
|
|
+ submitTaskRequestFail (error) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', '提交任务失败:' + error.data)
|
|
|
+ },
|
|
|
+ //结束任务
|
|
|
+ endTask () {
|
|
|
+ this.$confirm('确认结束任务?', '提示', {
|
|
|
+ confirmButtonText: '确认结束',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'success'
|
|
|
+ }).then(() => {
|
|
|
+ this.showLoading()
|
|
|
+ ensureEndTask(this.projectId, this.taskId, this.endTaskSuccess, this.endTaskFail)
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //结束任务成功时的回调函数
|
|
|
+ endTaskSuccess (res) {
|
|
|
+ this.hideLoading()
|
|
|
+ this.taskOperationControl = res.taskOperationControl
|
|
|
+ this.task.status = res.crowdTaskVO.status
|
|
|
+ this.task.institution = res.crowdTaskVO.institution
|
|
|
+ notify('success', '结束任务成功!')
|
|
|
+ },
|
|
|
+ //结束任务失败时的回调函数
|
|
|
+ endTaskFail (error) {
|
|
|
+ this.hideLoading()
|
|
|
+ notify('error', '结束任务失败:' + error.data)
|
|
|
+ },
|
|
|
+ //跳转到创建项目报告页面
|
|
|
+ toCreateReport () {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'TaskReportCreate',
|
|
|
+ params: {
|
|
|
+ scope: 1,
|
|
|
+ dependencyCode: this.taskId,
|
|
|
+ projectId: this.projectId,
|
|
|
+ taskId: this.taskId,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ reformDate (date) {
|
|
|
+ return getFormalTimeFromDate(date)
|
|
|
+ }
|
|
|
},
|
|
|
- // created () {
|
|
|
- // this.loadData()
|
|
|
- // }
|
|
|
}
|
|
|
+//回收站
|
|
|
+//
|
|
|
+// updateLocation (location) {
|
|
|
+// console.log(location)
|
|
|
+// const loactionName = getProvinceNameByProvinceCode(location.provinceCode, location.cityCode)
|
|
|
+// // var provinceName = ''
|
|
|
+// // var cityName = ''
|
|
|
+// // for (var item of provinceCityJSON.provinces) {
|
|
|
+// // if (item.code === location.provinceCode) {
|
|
|
+// // provinceName = item.name
|
|
|
+// // for (var city of item.cities) {
|
|
|
+// // if (city.code === location.cityCode) {
|
|
|
+// // cityName = city.name
|
|
|
+// // break
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// // }
|
|
|
+// return loactionName.provinceCode + ' / ' + loactionName.cityCode
|
|
|
+// },
|
|
|
+//
|
|
|
+// locationChange (provinceId, cityId) {
|
|
|
+// if (provinceId || cityId) {
|
|
|
+// this.task.location = {provinceCode: provinceId, cityCode: cityId}
|
|
|
+// }
|
|
|
+// },
|
|
|
+// submitForm (formName) {
|
|
|
+// this.$refs[formName].validate(valid => {
|
|
|
+// if (valid) {
|
|
|
+// this.isModifyMode = false
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// console.log('error submit!!')
|
|
|
+// return false
|
|
|
+// }
|
|
|
+// })
|
|
|
+// },
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|