Browse Source

确认服务,接单功能

master
mk 1 year ago
parent
commit
8c7c1a631c
  1. 4
      src/api/index.js
  2. 18
      src/api/service.js
  3. 3
      src/assets/css/common.less
  4. 2
      src/assets/css/vant-theme.less
  5. 6
      src/plugins/vant.js
  6. 4
      src/views/assistance/card.vue
  7. 192
      src/views/assistance/index.vue

4
src/api/index.js

@ -9,7 +9,9 @@ const api = {
CommonalityDetail: '/governance/service/rcvAndProcess/commonDemand/detail', CommonalityDetail: '/governance/service/rcvAndProcess/commonDemand/detail',
MeasureDetail: '/governance/service/rcvAndProcess/userDemand/detail', MeasureDetail: '/governance/service/rcvAndProcess/userDemand/detail',
ListMyIdentities: '/governance/service/rcvAndProcess/listMyIdentities', ListMyIdentities: '/governance/service/rcvAndProcess/listMyIdentities',
receiveService: '/governance/service/rcvAndProcess/receive' receiveService: '/governance/service/rcvAndProcess/receive',
serviceScopeTree :'/gov/org/icServiceProject/service/serviceScopeTree',
ServiceConfirm: '/governance/service/rcvAndProcess/confirm'
} }
export default api export default api

18
src/api/service.js

@ -56,4 +56,22 @@ export function receiveService(data) {
data data
}) })
} }
//获取组织树
export function getServiceScopeTree(data) {
return request({
url: api.serviceScopeTree,
method: 'post',
data
})
}
//确认服务
export function serviceConfirm(data) {
return request({
url: api.ServiceConfirm,
method: 'post',
data
})
}

3
src/assets/css/common.less

@ -85,6 +85,9 @@
.font-size13{ .font-size13{
font-size: 13px; font-size: 13px;
} }
.tag-date{
margin: 0 10px;
}
.text-blue{ .text-blue{
color:#3e92ff; color:#3e92ff;
} }

2
src/assets/css/vant-theme.less

@ -241,7 +241,7 @@
@dialog-message-max-height: 60vh; @dialog-message-max-height: 60vh;
@dialog-has-title-message-text-color: @gray-7; @dialog-has-title-message-text-color: @gray-7;
@dialog-has-title-message-padding-top: @padding-xs; @dialog-has-title-message-padding-top: @padding-xs;
@dialog-confirm-button-text-color: @blue;
// Field // Field
@field-label-color: @gray-7; @field-label-color: @gray-7;
@field-input-text-color: @text-color; @field-input-text-color: @text-color;

6
src/plugins/vant.js

@ -25,7 +25,9 @@ import {
ActionSheet, ActionSheet,
Checkbox, Checkbox,
CellGroup, CellGroup,
Form Form,
DatetimePicker,
Cascader
} from 'vant' } from 'vant'
Vue.use(Button) Vue.use(Button)
@ -53,3 +55,5 @@ Vue.use(Button)
.use(Checkbox) .use(Checkbox)
.use(CellGroup) .use(CellGroup)
.use(Form) .use(Form)
.use(DatetimePicker)
.use(Cascader)

4
src/views/assistance/card.vue

@ -20,14 +20,14 @@
<div class="m-top5 "> <div class="m-top5 ">
<div class="flex flex-center3"> <div class="flex flex-center3">
<img src="@/assets/images/icon/content.png" style="vertical-align: top;" class="small_img m-right7"> <img src="@/assets/images/icon/content.png" style="vertical-align: top;" class="small_img m-right7">
<div>{{ item.summary }}</div> <div class="van-multi-ellipsis--l2">{{ item.summary }}</div>
</div> </div>
</div> </div>
<hr class=" m-top12-right opacity5"> <hr class=" m-top12-right opacity5">
<div class="flex flex-fend m-top12-right"> <div class="flex flex-fend m-top12-right">
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom" v-if="item.processStatus === 10" @click="$emit('handleCLickReceive',item)">接单</van-button> <van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom" v-if="item.processStatus === 10" @click="$emit('handleCLickReceive',item)">接单</van-button>
<van-button size="small" type="default" round class="m-left12 rounded-corner m-top5-bottom" v-if="item.processStatus === 20 && item.source === 4 ">联系需求人</van-button> <van-button size="small" type="default" round class="m-left12 rounded-corner m-top5-bottom" v-if="item.processStatus === 20 && item.source === 4 ">联系需求人</van-button>
<van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom" v-if="item.processStatus === 20">确认服务</van-button> <van-button size="small" type="info" class="m-left12 rounded-corner m-top5-bottom" v-if="item.processStatus === 20" @click="$emit('handelServiceConfirm',item)">确认服务</van-button>
</div> </div>
</div> </div>

192
src/views/assistance/index.vue

@ -3,43 +3,52 @@
<div class="scroll-box" ref="scroll-content"> <div class="scroll-box" ref="scroll-content">
<van-tabs :active="active" sticky @change="hadelChangeTab"> <van-tabs :active="active" sticky @change="hadelChangeTab">
<van-tab title="待接单"> <van-tab title="待接单">
<card :tableData="list" @handleCLickReceive="handleCLickReceive"></card> <card :tableData="list" @handleCLickReceive="handleCLickReceive">
</card>
</van-tab> </van-tab>
<van-tab title="待处理"> <van-tab title="待处理">
<card :tableData="list"></card> <card :tableData="list" @handelServiceConfirm="handelServiceConfirm"></card>
</van-tab> </van-tab>
<van-tab title="已完成">内容 3</van-tab> <van-tab title="已完成">内容 3</van-tab>
</van-tabs> </van-tabs>
</div> </div>
<van-dialog v-model="showRole" title="请选择接单身份" show-cancel-button @confirm="receiveService"> <van-dialog v-model="showRole" title="请选择接单身份" show-cancel-button @confirm="receiveService">
<van-radio-group v-model="serviceOrgType"> <van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id">{{item.serviceOrgName}}</van-radio> <van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group> </van-radio-group>
</van-dialog> </van-dialog>
<van-dialog v-model="showScope" title="" show-cancel-button @confirm="receiveService"> <van-dialog v-model="showScope" title="" show-cancel-button @confirm="receiveService">
<van-datetime-picker <p>服务时间</p>
v-model="serviceTimeStart" <span @click="showStart = true, showPopup = true" class="font-size13">{{ serviceTimeStart || '开始时间'
type="datetime" }}</span><span class="tag-date"></span><span @click="showEnd = true, showPopup = true"
title="开始时间" class="font-size13">{{ serviceTimeEnd || '结束时间' }}</span>
:min-date="minDate" <p>服务范围</p>
:max-date="maxDate" <span class="font-size13" @click="showTree = true, showPopup = true">{{ serviceScopeName || '请选择范围'
/> }}</span>
<p>接单身份</p>
<van-datetime-picker <van-radio-group v-model="serviceOrgType">
v-model="serviceTimeStart" <van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
type="datetime" @click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
title="结束时间" }}</van-radio>
:min-date="minDate" </van-radio-group>
:max-date="maxDate"
/>
</van-dialog> </van-dialog>
<van-popup v-model="showPopup" position="bottom">
<van-datetime-picker v-if="showStart" v-model="serviceTimeStart" type="datetime" title="开始时间"
@confirm="handelCLickConfirmStart" @cancel="showPopup = false" :min-date="minDate" />
<van-datetime-picker v-if="showEnd" v-model="serviceTimeEnd" @confirm="handelCLickConfirmEnd"
@cancel="showPopup = false" type="datetime" title="结束时间" :min-date="minDate" />
<van-cascader v-if="showTree" v-model="cascaderValue" title="请选择范围" :options="treeOptions"
@close="showTree = false, showPopup = false" @finish="onFinish"
:field-names="{ text: 'objectName', value: 'objectId' }" />
</van-popup>
</div> </div>
</template> </template>
<script> <script>
import card from './card.vue' import card from './card.vue'
import throttle from 'lodash/debounce' import throttle from 'lodash/debounce'
import { getServiceListRcv, getServiceListProcess , getServiceListCompleted,getCommonalityDetail,getMeasureDetail, getListMyIdentities,receiveService} from '@/api/service' import { getServiceListRcv, getServiceListProcess, getServiceListCompleted, getCommonalityDetail, getMeasureDetail, getListMyIdentities, receiveService, getServiceScopeTree, serviceConfirm } from '@/api/service'
export default { export default {
data() { data() {
return { return {
@ -50,17 +59,28 @@ export default {
pageSize: 4, pageSize: 4,
list: [], list: [],
total: 0, total: 0,
requestFlag:false, requestFlag: false,
showRole:false, showRole: false,
roleList:[], roleList: [],
serviceOrgType:null, serviceOrgType: null,
serviceOrgId:null, serviceOrgId: null,
showScope:null showScope: false,
serviceTimeStart: null,
serviceTimeEnd: null,
showStart: false,
showEnd: false,
showTree: false,
showPopup: false,
minDate: new Date(),
treeOptions: null,
cascaderValue: null,
serviceScopeName: null
}; };
}, },
created() { created() {
this.getListMyIdentities() this.getListMyIdentities()
this.getServiceListRcv() this.getServiceListRcv()
this.getServiceScopeTree()
}, },
mounted() { mounted() {
this.clientHeight = document.documentElement.clientHeight; // this.clientHeight = document.documentElement.clientHeight; //
@ -71,57 +91,101 @@ export default {
}) })
}, },
methods: { methods: {
onFinish(value) {
this.showTree = false;
this.showPopup = false;
this.serviceScopeList = value.selectedOptions.map(item => ({ objectType: item.objectType, objectId: item.objectId, objectName: item.objectName }))
this.serviceScopeName = value.selectedOptions.map(item => item.objectName).join('-')
},
handelCLickConfirmStart(val) {
this.serviceTimeStart = this.$dayjs(val).format('YYYY-MM-DD HH:mm:ss');
this.showPopup = false;
this.showStart = false;
},
handelCLickConfirmEnd(val) {
this.serviceTimeEnd = this.$dayjs(val).format('YYYY-MM-DD HH:mm:ss');
this.showPopup = false;
this.showEnd = false;
},
// //
async receiveService(){ async receiveService() {
let parm = { let parm = {
...this.formData, ...this.formData,
serviceOrgType:this.serviceOrgType, id: this.serverId,
serviceOrgId:this.serviceOrgId, }
id:this.serverId if (this.showScope) {
parm.serviceScopeList = this.serviceScopeList;
parm.serviceTimeStart = this.serviceTimeStart;
parm.serviceTimeEnd = this.serviceTimeEnd;
parm.serviceOrgType = this.serviceOrgType;
parm.serviceOrgId = this.serviceOrgId;
} else if (this.showRole) {
parm.serviceOrgType = this.serviceOrgType;
parm.serviceOrgId = this.serviceOrgId;
} }
console.log(parm); console.log(parm);
// let {data,code,msg} = await receiveService(parm) let { data, code, msg } = await receiveService(parm)
// if(code === 0){ if (code === 0) {
// this.$toast.success('') this.$toast.success('接单成功')
// this.showRole = false; this.showRole = false;
// this.pageNo = 1; this.pageNo = 1;
// this.getTableData(); this.list = [];
// } this.getTableData();
}, }
handleCLickReceive(item){ },
handelChangeRole(val) {
this.serviceOrgId = val;
},
//
handleCLickReceive(item) {
this.showRole = item.source === 4; this.showRole = item.source === 4;
this.showScope = item.source === 0; this.showScope = item.source === 1;
this.serverId = item.id; this.serverId = item.id;
if(item.source === 4){ if (item.source === 4) {
this.getMeasureDetail() this.getMeasureDetail()
}else { } else {
this.getCommonalityDetail() this.getCommonalityDetail()
} }
}, },
async getListMyIdentities(){ //
let {data,code,msg} = await getListMyIdentities() async handelServiceConfirm(val) {
if(code === 0){ let { data, code, msg } = await serviceConfirm({ id: val.id })
if (code === 0) {
this.$toast.success('确认成功')
this.pageNo = 1;
this.list = [];
this.getTableData();
}
},
async getListMyIdentities() {
let { data, code, msg } = await getListMyIdentities()
if (code === 0) {
this.roleList = data; this.roleList = data;
this.serviceOrgId = data[0].id;
} }
}, },
async getMeasureDetail() {
async getMeasureDetail(){ let { data, code, msg } = await getMeasureDetail({ id: this.serverId })
let {data,code,msg} = await getMeasureDetail({id:this.serverId}) if (code === 0) {
if(code === 0){
this.formData = data; this.formData = data;
} }
}, },
async getCommonalityDetail(){ async getCommonalityDetail() {
let {data,code,msg} = await getCommonalityDetail({id:this.serverId}) let { data, code, msg } = await getCommonalityDetail({ id: this.serverId })
if(code === 0){ if (code === 0) {
this.formData = data; this.formData = data;
} }
}, },
hadelChangeTab(e){ async getServiceScopeTree() {
let { data, code, msg } = await getServiceScopeTree({ id: this.serverId })
if (code === 0) {
this.treeOptions = [data];
}
},
hadelChangeTab(e) {
this.list = []; this.list = [];
this.pageNo = 1; this.pageNo = 1;
this.active = e this.active = e;
this.getTableData('tab') this.getTableData('tab')
}, },
// //
@ -135,15 +199,15 @@ export default {
} }
}, 500), }, 500),
getTableData(tab){ getTableData(tab) {
if ((this.active === 0 && this.requestFlag) || (tab && this.active === 0)) { if ((this.active === 0 && this.requestFlag) || (tab && this.active === 0)) {
this.getServiceListRcv(); this.getServiceListRcv();
} else if ((this.active === 1 && this.requestFlag) || (tab && this.active === 1)) { } else if ((this.active === 1 && this.requestFlag) || (tab && this.active === 1)) {
this.getServiceListProcess(); this.getServiceListProcess();
}else if((this.active === 2 && this.requestFlag ) || (tab && this.active === 2)){ } else if ((this.active === 2 && this.requestFlag) || (tab && this.active === 2)) {
this.getServiceListCompleted() this.getServiceListCompleted()
} }
if(!this.requestFlag){ if (!this.requestFlag) {
this.$toast({ this.$toast({
message: '没有更多数据了', message: '没有更多数据了',
duration: 1000 duration: 1000
@ -156,7 +220,6 @@ export default {
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: this.pageSize pageSize: this.pageSize
}).then(res => { }).then(res => {
console.log(res);
this.total = res.total; this.total = res.total;
this.requestFlag = res.data.list.length === this.pageSize; this.requestFlag = res.data.list.length === this.pageSize;
this.list = this.list.concat(res.data.list) this.list = this.list.concat(res.data.list)
@ -171,20 +234,20 @@ export default {
pageSize: this.pageSize pageSize: this.pageSize
}).then(res => { }).then(res => {
this.total = res.total; this.total = res.total;
// this.requestFlag = res.length === this.pageSize; this.requestFlag = res.data.list.length === this.pageSize;
this.list = res.data.list; this.list = res.data.list;
}).catch(err => { }).catch(err => {
}) })
}, },
// //
getServiceListCompleted(){ getServiceListCompleted() {
getServiceListCompleted({ getServiceListCompleted({
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: this.pageSize pageSize: this.pageSize
}).then(res => { }).then(res => {
this.total = res.total; this.total = res.total;
this.requestFlag = res.length === this.pageSize; this.requestFlag = res.data.list === this.pageSize;
this.list = this.list.concat(...this.list, ...res.list); this.list = this.list.concat(...this.list, ...res.list);
}).catch(err => { }).catch(err => {
}) })
@ -200,12 +263,13 @@ export default {
</script> </script>
<style lang='less' scoped> <style lang='less' scoped>
:deep(.van-tabs__content){ :deep(.van-tabs__content) {
padding: 0 10px 20px; padding: 0 10px 20px;
box-sizing: border-box; box-sizing: border-box;
} }
:deep(.van-dialog__content){
padding:10px; :deep(.van-dialog__content) {
padding: 10px;
box-sizing: border-box; box-sizing: border-box;
} }
</style> </style>

Loading…
Cancel
Save