12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073 |
- <template>
- <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-row :gutter="20">
- <el-col :span="15">
- <el-form :model="task" :rules="rules" ref="task" label-width="120px" class="demo-task"
- style="margin:0 0 0 80px;">
- <el-form-item label="任务名称" prop="title" style="width: 700px;">
- <el-input size="small" v-if="isModifyMode" v-model="task.title"></el-input>
- <span v-if="!isModifyMode">{{task.title}}</span>
- <el-tag v-if="!isModifyMode" :type="task.statusVO&&task.statusVO.style">{{task.statusVO ?
- task.statusVO.text:''}}
- </el-tag>
- </el-form-item>
- <el-form-item label="任务描述" prop="description" style="width: 700px;">
- <el-input autosize v-if="isModifyMode" type="textarea" v-model="task.description"></el-input>
- <span v-if="!isModifyMode">{{task.description ? task.description : '暂无'}}</span>
- </el-form-item>
- <el-form-item label="任务报价" prop="quotePrice" style="width: 700px;">
- <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>
-
-
-
-
- {{task.fixedPrice}}
-
- <el-form-item label="测试类型" prop="serviceType">
- <el-radio-group v-if="isModifyMode" v-model="task.serviceType" @change="handleTestTypeChange">
- <span v-for="(item,index) in serviceType" :key="index">
- <el-radio :label="item.code" name="serviceType">{{item.name}}</el-radio>
- </span>
- </el-radio-group>
- <span class="badge" v-if="!isModifyMode">{{serviceName}}</span>
- </el-form-item>
- <el-form-item label="服务序列号" prop="endPoint" style="width: 700px;"
- v-if="showBD&&task.endPoint&&currType.type===1"
- >
- <el-input v-if="isModifyMode" v-model="task.endPoint.serverCode" label="examId"></el-input>
- <span v-if="!isModifyMode&&showBD">{{task.endPoint.serverCode}}</span>
- </el-form-item>
- <el-form-item label="任务可见性" prop="resource" style="width: 700px;">
- <div v-if="!isModifyMode">
- {{updateLocation(task.location)}}
- <div v-if="task.resource==0">定向</div>
- <div v-if="task.resource==2">{{resourceType[task.resource]}}</div>
- </div>
- <el-tabs
- :tab-position="tabPosition"
- v-model="task.resource"
- style="max-height: 200px;"
- v-if="isModifyMode"
- >
- <el-tab-pane :label="resourceType[0]" name="0">
- <el-radio-group v-model="task.institution" @change="handleTestTypeChange">
- <el-radio
- :label="item"
- name="type"
- v-for="(item,index) in institutionArray"
- :key="index"
- >{{item.evaluationAgencyName}}
- </el-radio>
- </el-radio-group>
- </el-tab-pane>
-
-
-
-
-
-
-
-
- <el-tab-pane :label="resourceType[2]" name="2"></el-tab-pane>
- </el-tabs>
- </el-form-item>
- <el-form-item label="领取人数" prop="contactPhone" v-if="isModifyMode&&task.resource !== '0' && currType.type===0">
- <el-input-number v-model="task.participantCount" :min="1" :max="1000" label="领取人数"></el-input-number>
- </el-form-item>
- <el-form-item label="领取人数" prop="contactPhone" v-if="isModifyMode&&task.resource !== '0' && currType.type===1">
- <el-input-number v-model="task.participantCount" :min="2" :max="1000" label="领取人数"></el-input-number>
- </el-form-item>
- <el-form-item label="Go平台" prop="goPlatform">
- <div v-if="!isModifyMode">
- {{updateLocation(task.location)}}
- <div v-if="task.goPlatform">使用</div>
- <div v-else>不使用</div>
- </div>
- <div v-else>
- <el-radio-group v-model="task.goPlatform">
- <el-radio :label="0">不使用</el-radio>
- <el-radio :label="1">使用</el-radio>
- </el-radio-group>
- </div>
- </el-form-item>
- <el-form-item label="领取人数" prop="quotePrice" v-if="!isModifyMode">
- {{task.acceptedCount }}/{{ task.participantCount}}
- </el-form-item>
- <el-form-item label="需求文档" prop="doc">
- <el-upload
- style="width: 400px"
- v-if="isModifyMode"
- drag
- class="upload-demo"
- action=""
- :on-remove="handleRemove"
- :before-remove="beforeRemove"
- :limit="1"
- :on-exceed="handleExceed"
- :http-request="uploadRequireDoc"
- :file-list="task.doc"
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">
- 将文件拖到此处,或
- <em>点击上传</em>
- </div>
- </el-upload>
- <span>
- <span v-if="task.requireDocUrl == null || task.requireDocUrl == ''">
- <i class="el-icon-document"></i>暂无文件
- </span>
- <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="选择截止时间"
- align="right"
- :picker-options="pickerOptions"
- ></el-date-picker>
- </div>
- <span v-if="!isModifyMode">{{dateFormat(new Date(task.datetime),'yyyy-MM-dd HH:mm:ss')}}</span>
- </el-form-item>
- <el-form-item v-if="isModifyMode">
- <div class="btn btn-small btn-info" @click="updateTask()">确认修改</div>
-
- <div class="btn btn-small" @click="cancelMode()">取消</div>
- </el-form-item>
- <el-form-item v-if="editShortLink && task.endPoint.serverCode && taskOperationControl.confirmFinish" label="任务面板链接" props="shortLink">
- <el-input v-model="shortLink" placeholder="请输入短链接生成任务报告" style="width: 800px">
- <template slot="append">
- <el-button @click="getTaskDataBoard()">确定</el-button>
- </template>
- </el-input>
- </el-form-item>
- <el-form-item v-if="shortLink && !editShortLink" label="任务面板链接" props="shortLink">
- {{shortLink}}
- <i class="el-icon-edit" @click="editShortLink = true" v-if="taskOperationControl.confirmFinish"/>
- </el-form-item>
- <el-form-item v-if="!isModifyMode">
- <el-button size="mini" @click="toProject()">项目详情</el-button>
- <el-button v-if="taskOperationControl.update||taskOperationControl.taskRecommend" @click="manageVirtualMachine()" type="primary" size="mini">管理虚拟机</el-button>
- <el-button v-if="taskOperationControl.writeReport||taskOperationControl.uploadReport" @click="connectVirtualMachine()" type="primary" size="mini">连接虚拟机</el-button>
- <el-button v-if="(taskOperationControl.writeReport||taskOperationControl.uploadReport||taskOperationControl.update||taskOperationControl.taskRecommend)&&task.goPlatform" type="primary" size="mini" @click="toGo()">go语言测试在线测试平台</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.writeReport" type="primary" size="mini" @click="gotoWriteReport()">填写报告
- </el-button>
- <el-button v-if="taskOperationControl.update" type="primary" size="mini" @click="modifyForm()">修改任务
- </el-button>
- <el-button v-if="taskOperationControl.taskRecommend" type="primary" size="mini" @click="recommendTask()">任务推荐
- </el-button>
- <el-button v-if="taskOperationControl.testCaseManage" type="primary" size="mini" @click="toTestCases()">
- 众测执行
- </el-button>
- <el-button v-if="taskOperationControl.testCaseExam" type="primary" size="mini" @click="toTestCasesExam()">
- 众测审核
- </el-button>
- <el-button v-if="taskOperationControl.taskDemonstrate" type="success" size="mini" @click="gotoDataboard()">
- 任务面板
- </el-button>
-
-
-
-
-
-
-
-
-
-
-
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="9">
- <TaskCloud :info="wordCloud" v-if="wordCloud.length"></TaskCloud>
- </el-col>
- </el-row>
- </div>
- <div class="create-body" v-if="!isModifyMode">
- <div class="title h2">用户报告列表</div>
- <el-collapse accordion style="margin: 0 30px">
- <el-collapse-item v-for="(item,index) in acceptedUserList" :key="item.id">
- <template slot="title">
- <el-row style="width: 100%;font-size: 16px">
- <el-col :span="6">{{item.userVO.userName}}</el-col>
- <el-col :span="6">{{item.userVO.email}}</el-col>
- <el-col :span="6">
- <el-tag type="success" v-if="item.crowdReportVOS">已提交报告</el-tag>
- <el-tag type="info" v-if="!item.crowdReportVOS">未提交报告</el-tag>
- </el-col>
- <el-col :span="6">
- <el-tag type="success" v-if="item.isCommitted">已提交任务</el-tag>
- <el-tag type="info" v-if="!item.isCommitted">未提交任务</el-tag>
- </el-col>
- </el-row>
- </template>
- <report-list v-bind:reports="item.crowdReportVOS" v-bind:taskId="taskId" v-bind:projectId="projectId"/>
- </el-collapse-item>
- </el-collapse>
-
-
- </div>
- </div>
- </template>
- <script>
- import ResourceType from '@/constants/enum/resource-type.js'
- import provincecity from '@/components/commons/ProvinceCity'
- import ReportList from '@/components/report/ReportList'
- import TaskCloud from '@/components/task/TaskCloud'
- 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,
- getTaskWordCloud,
- getToken
- } from '@/js/index'
- export default {
- name: 'Task',
- components: {
- provincecity,
- ReportList,
- TaskCloud
- },
- data() {
- return {
- currType: {},
- user: {},
- serviceName:'',
- showBD: true,
- rolesPermissions: {},
- loading: false,
- isModifyMode: false, institutionArray: [],
- tabPosition: 'top',
- resourceType: ResourceType,
- serviceType: [],
- taskId: '',
- projectId: '',
- taskOperationControl: {
- confirmFinish: false,
- finish: false,
- receive: false,
- update: false,
- uploadReport: false,
- writeReport: false,
- taskDemonstrate: false,
- taskRecommend: false,
- testCaseExam: false,
- testCaseManage: false
- },
- crowdReportUrl: '',
- wordCloud:[],
- task: {
- agencyId: '',
- status: '',
- name: '',
- desc: '',
- serviceType: '',
- resource: '',
- location: {},
- institution: {},
- datetime: '',
- quotePrice: '',
- fixedPrice: '',
- doc: [],
- requireDocUrl: '',
- participantCount: 1,
- goPlatform: 0,
- title: '',
- description: '',
- endPoint: {
- serverCode: '',
- token: ''
- }
- },
- reportList: [],
- pickerOptions: {
- shortcuts: [
- {
- text: '今天',
- onClick(picker) {
- picker.$emit('pick', new Date())
- }
- },
- {
- text: '昨天',
- onClick(picker) {
- const date = new Date()
- date.setTime(date.getTime() - 3600 * 1000 * 24)
- picker.$emit('pick', date)
- }
- },
- {
- text: '一周前',
- onClick(picker) {
- const date = new Date()
- date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
- picker.$emit('pick', date)
- }
- }
- ]
- },
- rules: {
- title: [
- {required: true, message: '请输入任务名称', trigger: 'blur'},
- {min: 5, max: 50, message: '任务名称长度在 5 到 50 个字符', trigger: 'blur'}
- ],
- serviceType: [
- {required: true, message: '测试类型不可为空', trigger: 'change'},
- ],
- description: [{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'
- },
- ],
- endPoint: [
- {
- validator: (rule, value, callback) => {
- if (this.currType.type === 1 && this.task.endPoint.serverCode === '') {
- callback(new Error('请填写对应得服务序列号'))
- } else {
- callback()
- }
- }, trigger: ['change','blur']
- },
- ],
- datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
- },
- acceptedUserList: [],
- shortLink:'',
- editShortLink:false,
- creatorId:'',
- receiverId:''
- }
- },
- watch: {
- institutionArray(val) {
- this.institutionArray = val
- },
- serviceType(val) {
- this.serviceType = val
- },
- deep: true
- },
- mounted() {
- this.$nextTick(() => {
- this.init();
- })
- },
- methods: {
-
- gotoDataboard(){
- window.open(this.task.endPoint.token)
- },
-
- getTaskDataBoard(){
- this.showLoading()
- Http.put(`/api/project/${this.projectId}/task/${this.taskId}/addToken`,{"token":this.shortLink}).then((res)=>{
- this.taskOperationControl = res.taskOperationControl;
- this.task.endPoint = res.crowdTaskVO.endPointVO;
- this.shortLink = res.crowdTaskVO.endPointVO.token;
- if(this.shortLink != ''){
- this.editShortLink = false;
- }
- this.hideLoading()
- })
- },
- getServiceByCode(code){
- let serviceName = this.serviceType.filter((item) => {
- return item.code === code;
- });
- return serviceName&&serviceName[0]&&serviceName[0]['name']
- },
- handleTestTypeChange(val) {
- let type = this.serviceType.filter((item) => {
- return item.code === val;
- });
- this.currType = type[0] ? type[0] : {};
- if (this.currType.type === 0) {
- this.$refs.task.clearValidate('endPoint');
- }
- },
- init() {
- this.taskId = this.$route.params.taskId
- this.projectId = this.$route.params.projectId
- this.setUserInfo()
- this.setServiceType()
-
- this.getTaskDetail()
- this.getWordCloud()
- this.setInstitutions()
- this.getProjectInfo()
- },
-
- gotoWriteReport() {
- window.open(this.crowdReportUrl, '_blank');
- },
-
- toProject() {
- this.$router.push({
- name: 'Project',
- params: {projectId: this.projectId}
- })
- },
- toGo() {
- let roleid=1;
-
-
-
-
- if(this.user.roleList.length==1 && this.user.roleList.includes("generalUser")){roleid = 1;}
- if(this.creatorId==this.user.userVO.id){roleid=3;}
- if(this.taskOperationControl.uploadReport){roleid=4;}
- if(this.receiverId==this.user.userVO.id){roleid=2;}
-
- let goUrl='http://101.132.74.9:1106/hjc2?project_code='+this.projectId+'&user_id'+this.user.userVO.id+'&role_id='+roleid;
- window.open(goUrl, '_blank');
- },
-
- modifyForm() {
-
- this.isModifyMode = true
- },
-
- cancelMode() {
- this.isModifyMode = false
- },
-
- resetForm() {
- this.task.name = ''
- this.task.desc = ''
- this.task.quotePrice = ''
- this.task.fixedPrice = ''
- this.task.type = ''
- this.task.resource = '2'
- this.task.location = {provinceCode: '', cityCode: ''}
- this.task.institution = ''
- this.task.datetime = ''
- this.task.participantCount = 1
- this.task.goPlatform = 0
-
-
- },
-
- showLoading() {
- this.loading = true
- },
-
- hideLoading() {
- this.loading = false
- },
-
- setUserInfo() {
- this.user = storageGet('user')
- console.log(this.user,'this.user')
- this.rolesPermissions = storageGet('rolesPermissions')
- console.log(this.rolesPermissions,'this.rolesPermissions')
- if (storageGet('rolesPermissions').isRegionManager || storageGet('rolesPermissions').isSystemAdministrator) {
- this.showBD = true;
- } else {
- this.showBD = false;
- }
- },
- getProjectInfo(){
- Http.get(Apis.PROJECT.GET_PROJECT.replace('{projectId}', this.projectId)).then((res) => {
-
- this.creatorId = res.projectDetails.userId;
- this.receiverId =res.projectDetails.regionManagerId;
-
- }).catch((error) => {
-
-
- })
- },
-
- 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)
- },
- manageVirtualMachine(){
- getToken(this.projectId, this.taskId).then((res) => {
- var token = res.data
- var url = 'http://docker.chuangchaokeji.cn:38080/cloudtest/api/oauth/gateway?website=cofortest&token='+ token + '&userId='+this.user.userVO.id +
- '&screen=PROJECT' + '&projectId='+this.projectId+'&taskId='+this.taskId;
- window.open(url);
- })
- },
-
-
-
-
-
-
-
-
- connectVirtualMachine(){
- getToken(this.projectId, this.taskId).then((res) => {
- var token = res.data
- var url = 'http://docker.chuangchaokeji.cn:38080/cloudtest/api/oauth/connect?userId='+this.user.userVO.id+ '&projectId='+
- this.projectId+'&taskId='+this.taskId+'&token='+token;
- window.open(url);
- })
- },
-
- getWordCloud(){
- getTaskWordCloud(this.projectId, this.taskId, this.getTaskCloudSuccess, this.getTaskCloudFail)
- },
- getTaskCloudSuccess(words){
- this.wordCloud = words.data;
- },
- getTaskCloudFail(err){
- notify('error',err)
- },
-
- getTaskDetailSuccess(res) {
- this.hideLoading()
-
- 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.toString()
- 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.acceptedCount = res.crowdTaskVO.acceptedCount
- this.task.participantCount = res.crowdTaskVO.participantCount
- this.task.goPlatform = res.crowdTaskVO.goPlatform
- 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.task.statusVO = res.crowdTaskVO.statusVO
- this.task.endPoint = res.crowdTaskVO.endPointVO ? res.crowdTaskVO.endPointVO : {
- serverCode: '',
- }
- this.taskOperationControl = res.taskOperationControl;
- console.log(this.taskOperationControl)
- this.acceptedUserList = res.acceptedUserList;
- this.crowdReportUrl = res.crowdTaskVO.writeReportUrl;
- this.handleFormatReport(this.acceptedUserList);
- this.handleTestTypeChange(res.crowdTaskVO.serviceType);
- this.serviceName = this.getServiceByCode(res.crowdTaskVO.serviceType);
- if(res.crowdTaskVO.endPointVO){
- if(res.crowdTaskVO.endPointVO.token){
- this.shortLink = res.crowdTaskVO.endPointVO.token;
- this.editShortLink = false
- }else{
- this.editShortLink = true
- }
- }
-
-
-
- },
-
- getTaskDetailFail(error) {
- this.hideLoading()
-
- },
-
- handleFormatReport(acceptedUserList) {
- console.log(acceptedUserList,"this.acceptedUserList")
- acceptedUserList.map((user) => {
- user.crowdReportVOS && user.crowdReportVOS.map((report) => {
- report.userName = user.userVO.userName;
- this.reportList.push(report);
- })
- })
- },
- dateFormat(date, format) {
- date = new Date(date)
- let o = {
- 'M+': date.getMonth() + 1,
- 'd+': date.getDate(),
- 'H+': date.getHours(),
- 'm+': date.getMinutes(),
- 's+': date.getSeconds(),
- 'q+': Math.floor((date.getMonth() + 3) / 3),
- 'S': date.getMilliseconds()
- }
- if (/(y+)/.test(format)) {
- format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
- }
- for (let k in o)
- if (new RegExp('(' + k + ')').test(format))
- format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
- return format;
- },
-
- updateTask() {
- this.$refs['task'].validate(valid => {
- if (valid) {
- this.showLoading()
- const newTask = {
- name: this.task.title,
- desc: this.task.description,
- type: this.task.serviceType,
- resource: this.task.resource,
- location: this.task.location == null ? {} : getProvinceNameByProvinceCode(this.task.location.provinceCode, this.task.location.cityCode),
- institution: this.task.institution ? this.task.institution.id : null,
- datetime: this.task.datetime,
- quotePrice: this.task.quotePrice,
- fixedPrice: this.task.fixedPrice,
- requirementFile: this.task.requireDocUrl,
- participantCount: this.task.participantCount,
- goPlatform: this.task.goPlatform,
- endPoint: this.task.endPoint
- }
-
- updateTask(this.projectId, this.taskId, newTask, this.updateTaskSuccess, this.updateTaskFail)
- } else {
- notify('error', '表单填写有误!')
- return false
- }
- })
- },
-
- 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.toString()
- 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.task.participantCount = res.crowdTaskVO.participantCount
- this.task.goPlatform = res.crowdTaskVO.goPlatform
- this.task.endPoint = res.crowdTaskVO.endPointVO ? res.crowdTaskVO.endPointVO : {
- serverCode: '',
- }
- this.task.createTime = res.crowdTaskVO.createTime,
- this.reportList = res.crowdReportVOList
- this.crowdReportUrl = res.crowdTaskVO.writeReportUrl;
- this.acceptedUserList = res.acceptedUserList
- this.handleTestTypeChange(res.crowdTaskVO.serviceType);
- this.serviceName = this.getServiceByCode(res.crowdTaskVO.serviceType)
- this.getWordCloud()
- this.hideLoading()
- notify('success', '修改成功')
- },
-
- updateTaskFail(error) {
- notify('error', '修改失败:' + error.data)
- this.hideLoading()
- },
-
- 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}', this.user.userVO.id), formData, config).then((res) => {
- notify('success', '上传成功')
- this.uploadRequireDocSuccess(res)
- }).catch((error) => {
- notify('error', '上传失败:' + error.data)
- this.uploadRequireDocFail(error)
- })
- },
-
- uploadRequireDocSuccess(res) {
- this.hideLoading()
- console.log('上传成功')
- this.task.requireDocUrl = res.data
- console.log(res.data)
- },
-
- uploadRequireDocFail(error) {
- this.hideLoading()
- notify('error', '任务需求文档上传失败:' + error.data)
- },
-
-
- beforeRemove(file, fileList) {
-
- },
-
- handleRemove(file, fileList) {
- console.log(file, fileList)
- },
-
- handleExceed(files, fileList) {
- this.$message.warning(
- `当前限制选择 1 个文件,本次选择了 ${
- files.length
- } 个文件,共选择了 ${files.length + fileList.length} 个文件`
- )
- },
-
- receiveTask() {
- this.$confirm('确认接收任务?', '提示', {
- confirmButtonText: '确认接收',
- cancelButtonText: '取消',
- type: 'success'
- }).then(() => {
- this.showLoading()
- receiveTaskRequest(this.projectId, this.taskId, this.user.userVO.id, this.receiveTaskSuccess, this.receiveTaskFail)
- }).catch(() => {
- })
- },
-
- receiveTaskSuccess(res) {
- this.hideLoading()
- this.getTaskDetail();
- notify('success', '接收任务成功')
-
- this.taskOperationControl = res.taskOperationControl
- this.task.status = res.crowdTaskVO.status
- this.task.institution = res.crowdTaskVO.institution
- },
-
- receiveTaskFail(error) {
- this.hideLoading()
- notify('error', '接收任务失败:' + error.data)
- },
-
- recommendTask(){
- let task = {
- "title": this.task.title,
- "description": this.task.description,
- "participantCount": this.task.participantCount,
- "quotePrice": this.task.quotePrice,
- "requirementFile": this.task.requireDocUrl,
- "serviceType": this.task.serviceType,
- "createTime": this.task.createTime,
- "datetime": this.task.datetime
- };
- Http.post('/recommendationtest/query',task).then((res)=>{
- console.log("recommend")
- window.open('http://8.134.39.104:7477/userinformation.html');
- })
- },
-
- rejectTask() {
- this.$confirm('确认拒绝任务?拒绝后将不能再接收该任务', '提示', {
- confirmButtonText: '确认拒绝',
- cancelButtonText: '取消',
- type: 'success'
- }).then(() => {
- this.showLoading()
- rejectTask(this.projectId, this.taskId, this.rejectTaskSuccess, this.rejectTaskFail)
- }).catch(() => {
- })
- },
-
- 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', '提交任务成功,等待区域管理员审核')
- this.getTaskDetail();
- },
-
- submitTaskRequestFail(error) {
- this.hideLoading()
- notify('error', '提交任务失败:' + error.data)
- },
-
- endTask() {
- this.$confirm('确认结束任务?', '提示', {
- confirmButtonText: '确认结束',
- cancelButtonText: '取消',
- type: 'success'
- }).then(() => {
- this.getTaskDetail()
- 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', '结束任务成功!')
- this.getTaskDetail();
- },
-
- 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)
- },
-
- toTestCases () {
- this.$router.push({
- name: 'TestCases',
- params: {
- taskCode: this.taskId
- }
- })
- },
-
- toTestCasesExam () {
- console.log(this.user.userVO.id)
- console.log(this.projectId)
- this.$router.push({
- name: 'ExamTestCases',
- params: {
- projectCode: this.projectId,
- taskCode: this.taskId,
- userId: 0
- }
- })
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .el-radio {
- margin: 10px 20px 10px 0;
- }
- .el-form-item /deep/ .el-tabs__content {
- /*max-height: 120px !important;*/
- overflow: auto;
- }
- .el-collapse-item__content {
- padding-bottom: 0 !important;
- }
- </style>
|