Browse Source

加表单验证,组织选择可以选社区外

master
mk 1 year ago
parent
commit
95ff2d6500
  1. 160
      src/views/assistance/index.vue
  2. 115
      src/views/assistanceDetail/index.vue

160
src/views/assistance/index.vue

@ -15,36 +15,38 @@
</van-tab>
</van-tabs>
</div>
<van-dialog v-model="showRole" title="请选择接单身份" show-cancel-button @confirm="receiveService">
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
<!-- 接单个性需求 -->
<van-dialog v-model="showRole" title="" show-cancel-button :before-close="handelReceiveService">
<p class="required">接单身份</p>
<van-radio-group v-model="serviceOrgTypeT">
<van-radio :name="index" v-for="(item, index) in roleList" :key="item.id"
@click="handelChangeRole(index)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</van-dialog>
<van-dialog v-model="showScope" title="" show-cancel-button @confirm="receiveService">
<p>服务时间</p>
<!--接单共性需求 -->
<van-dialog v-model="showScope" title="" show-cancel-button :before-close="handelReceiveService">
<p class="required">服务时间</p>
<span @click="showStart = true, showPopup = true" class="font-size13">{{ serviceTimeStart || '开始时间'
}}</span><span class="tag-date"></span><span @click="showEnd = true, showPopup = true"
class="font-size13">{{ serviceTimeEnd || '结束时间' }}</span>
<p>服务范围</p>
<p class="required">服务范围</p>
<span class="font-size13" @click="showTree = true, showPopup = true">{{ serviceScopeName || '请选择范围'
}}</span>
<p>接单身份</p>
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
<p class="required">接单身份</p>
<van-radio-group v-model="serviceOrgTypeT">
<van-radio :name="index" v-for="(item, index) in roleList" :key="item.id"
@click="handelChangeRole(index)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</van-dialog>
<!--个性需求 完成服务 -->
<van-dialog v-model="showComplete" title="我已完成需求人的需求" show-cancel-button :before-close="onBeforeClose">
<p>服务开始时间</p>
<span @click="showStart = true, showPopup = true" class="font-size13">{{ actualServiceStartTime || '服务开始时间'
}}</span><span class="tag-date"></span><span @click="showEnd = true, showPopup = true"
class="font-size13">{{ actualServiceEndTime || '服务结束时间' }}</span>
<p class="required">完成情况</p>
<p class="required">完成情况</p>
<van-radio-group v-model="rdFinishResult">
<van-radio name="resolved">已解决</van-radio>
<van-radio name="unresolved">未解决</van-radio>
@ -62,13 +64,14 @@
<van-field v-model="rdFinishDesc" rows="2" autosize type="textarea" placeholder="请输入备注" />
</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"
@close="showTree = false, showPopup = false" @change="onChange"
:field-names="{ text: 'objectName', value: 'objectId' }" />
</van-popup>
</div>
@ -76,7 +79,7 @@
<script>
import card from './card.vue'
import throttle from 'lodash/debounce'
import { getServiceListRcv, getServiceListProcess, getServiceListCompleted, getCommonalityDetail, getMeasureDetail, getListMyIdentities, receiveService, getServiceScopeTree, serviceConfirm, serviceComplete,getSearchResis } from '@/api/service'
import { getServiceListRcv, getServiceListProcess, getServiceListCompleted, getCommonalityDetail, getMeasureDetail, getListMyIdentities, receiveService, getServiceScopeTree, serviceConfirm, serviceComplete, getSearchResis } from '@/api/service'
import { uploadvariedfile } from '@/api/basic'
import { Dialog } from 'vant';
export default {
@ -105,14 +108,15 @@ export default {
cascaderValue: null,
serviceScopeName: null,
formData: {},
showComplete:false,
actualServiceStartTime:null,//
actualServiceEndTime:null,//
selfObj:{},
showComplete: false,
actualServiceStartTime: null,//
actualServiceEndTime: null,//
selfObj: {},
rdFinishResult: null,//
rdScore: 5,//
fileList: [],//
rdFinishDesc: null,//
serviceOrgTypeT: null
};
},
created() {
@ -123,16 +127,16 @@ export default {
mounted() {
this.$nextTick(() => {
this.scroll = this.$refs.scroll;
if(this.$store.state.app.scrollTop){
setTimeout(()=>{
if (this.$store.state.app.scrollTop) {
setTimeout(() => {
this.$refs.scroll.scrollTo(0, this.$store.state.app.scrollTop);
},500)
}, 500)
}
this.scroll.addEventListener('scroll', this.bottomScroll); //
})
},
activated(){
activated() {
},
methods: {
afterRead(file) {
@ -151,15 +155,15 @@ export default {
})
},
handelServiceComplete(item) {
if(item.source != 4){
if (item.source != 4) {
Dialog.confirm({
message: `确定已完成“${item.title}”服务吗?`,
}).then( () => {
message: `确定已完成“${item.title}”服务吗?`,
}).then(() => {
this.serviceComplete(item)
}).catch(() => {
})
}else if(item.source === 4){
this.showComplete= true;
} else if (item.source === 4) {
this.showComplete = true;
this.selfObj = item;
}
},
@ -195,10 +199,10 @@ export default {
this.serviceComplete(parm)
done(true)
}
}
else {
done(true);
done(true);
}
},
async serviceComplete(parm) {
@ -207,21 +211,19 @@ export default {
this.$tips.success('服务完成')
}
},
async handelTodetail(item) {
this.serverId = item.id;
if (item.source === 4) {
await this.getMeasureDetail()
} else if(item.source === 1){
} else if (item.source === 1) {
await this.getCommonalityDetail()
}else {
} else {
await this.getSearchResis()
}
this.$router.push({ name: 'assistanceDetail', params: { detail: this.formData, selfObj: item } })
},
onFinish(value) {
this.showTree = false;
this.showPopup = false;
onChange(value) {
this.serviceScopeList = value.selectedOptions.map(item => ({ objectType: item.objectType, objectId: item.objectId, objectName: item.objectName }))
this.serviceScopeName = value.selectedOptions.map(item => item.objectName).join('-')
},
@ -244,35 +246,63 @@ export default {
this.showEnd = false;
},
//
async receiveService() {
let parm = {
...this.formData,
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;
async handelReceiveService(action, done) {
if (action === "confirm") {
let parm = {
...this.formData,
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;
if (!this.serviceTimeStart) {
this.$tips.warning('请选择服务开始时间')
return done(false)
}
if (!this.serviceTimeEnd) {
this.$tips.warning('请选择服务结束时间')
return done(false)
}
if (!this.serviceScopeList) {
this.$tips.warning('请选择服务范围')
return done(false)
}
if (!this.serviceOrgId) {
this.$tips.warning('请选择接单身份')
return done(false)
}
} else if (this.showRole) {
if (!this.serviceOrgId) {
this.$tips.warning('请选择接单身份')
return done(false)
}
parm.serviceOrgType = this.serviceOrgType;
parm.serviceOrgId = this.serviceOrgId;
}
console.log(parm);
let { code } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
this.showScope = false;
this.pageNo = 1;
this.requestFlag = true;
this.list = [];
this.getTableData();
}
}
console.log(parm);
let { data, code, msg } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
this.showScope = false;
this.pageNo = 1;
this.requestFlag = true;
this.list = [];
this.getTableData();
else {
done(true);
}
},
handelChangeRole(val) {
this.serviceOrgId = val;
this.serviceOrgId = this.roleList[val].serviceOrgId;
this.serviceOrgType = this.roleList[val].serviceOrgType;
},
//
handleCLickReceive(item) {
@ -330,14 +360,14 @@ export default {
this.list = [];
this.pageNo = 1;
this.active = e;
this.$store.dispatch('setTabActive',e);
this.$store.dispatch('setTabActive', e);
this.getTableData('tab')
},
//
bottomScroll: throttle(function () {
console.log('滚动加载');
let scrollTop = this.scroll.scrollTop; //
this.$store.dispatch('setScrollTop',scrollTop);
this.$store.dispatch('setScrollTop', scrollTop);
let scrollHeight = this.scroll.scrollHeight; //
let clientHeight = this.scroll.clientHeight; //
if (scrollTop + clientHeight >= scrollHeight) {

115
src/views/assistanceDetail/index.vue

@ -26,7 +26,7 @@
</div>
<div class="m-top5 flex flex-center" v-else>
<img src="@/assets/images/icon/time.png" class="small_img m-right7">
<div style="font-size: 15px;">
<div>
{{ detail.serviceTimeStart || '--' }} {{ detail.serviceTimeEnd || '--' }}
</div>
</div>
@ -81,13 +81,7 @@
v-if="selfObj.processStatus === 20 && selfObj.source === 4 && selfObj.confirmedFlag === 1"
@click="showComplete = true">完成服务</van-button>
</div>
<van-dialog v-model="showRole" title="请选择接单身份" show-cancel-button @confirm="receiveService">
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</van-dialog>
<!-- 个性需求完成弹框 -->
<van-dialog v-model="showComplete" title="我已完成需求人的需求" show-cancel-button :before-close="onBeforeClose">
<p class="required">服务开始时间</p>
@ -112,13 +106,38 @@
<van-field v-model="rdFinishDesc" rows="2" autosize type="textarea" placeholder="请输入备注" />
</van-dialog>
<!-- 接单弹框 -->
<van-dialog v-model="showScope" title="" show-cancel-button :before-close="handelReceiveService">
<p class="required">服务时间</p>
<span @click="showStart = true, showPopup = true" class="font-size13">{{ serviceTimeStart || '开始时间'
}}</span><span class="tag-date"></span><span @click="showEnd = true, showPopup = true"
class="font-size13">{{ serviceTimeEnd || '结束时间' }}</span>
<p class="required">服务范围</p>
<span class="font-size13" @click="showTree = true, showPopup = true">{{ serviceScopeName || '请选择范围'
}}</span>
<p class="required">接单身份</p>
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</van-dialog>
<!-- 接单弹框共性需求 -->
<van-dialog v-model="showRole" title="" show-cancel-button :before-close="handelReceiveService">
<p class="required">接单身份</p>
<van-radio-group v-model="serviceOrgType">
<van-radio :name="item.serviceOrgType" v-for="(item) in roleList" :key="item.id"
@click="handelChangeRole(item.serviceOrgId)">{{ item.serviceOrgName
}}</van-radio>
</van-radio-group>
</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"
@close="showTree = false, showPopup = false" @change="onChange"
:field-names="{ text: 'objectName', value: 'objectId' }" />
</van-popup>
</div>
@ -186,7 +205,7 @@ export default {
})
},
async confirmService() {
let { data, code, msg } = await serviceConfirm({ id: this.id })
let { code} = await serviceConfirm({ id: this.id })
if (code === 0) {
this.selfObj.confirmedFlag = 1
}
@ -224,7 +243,6 @@ export default {
done(true)
}
}
//
else {
done(true);
}
@ -250,35 +268,62 @@ export default {
handelChangeRole(val) {
this.serviceOrgId = val;
},
onFinish(value) {
this.showTree = false;
this.showPopup = false;
onChange(value) {
this.serviceScopeList = value.selectedOptions.map(item => ({ objectType: item.objectType, objectId: item.objectId, objectName: item.objectName }))
this.serviceScopeName = value.selectedOptions.map(item => item.objectName).join('-')
},
//
async receiveService() {
let parm = {
...this.selfObj,
id: this.id,
}
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;
async handelReceiveService(action, done) {
if (action === "confirm") {
let parm = {
...this.formData,
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;
if (!this.serviceTimeStart) {
this.$tips.warning('请选择服务开始时间')
return done(false)
}
if (!this.serviceTimeEnd) {
this.$tips.warning('请选择服务结束时间')
return done(false)
}
if (!this.serviceScopeList) {
this.$tips.warning('请选择服务范围')
return done(false)
}
if (!this.serviceOrgId) {
this.$tips.warning('请选择接单身份')
return done(false)
}
} else if (this.showRole) {
if (!this.serviceOrgId) {
this.$tips.warning('请选择接单身份')
return done(false)
}
parm.serviceOrgType = this.serviceOrgType;
parm.serviceOrgId = this.serviceOrgId;
}
console.log(parm);
let { code } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
this.showScope = false;
this.pageNo = 1;
this.requestFlag = true;
this.list = [];
this.getTableData();
}
}
console.log(parm);
let { data, code, msg } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
this.showScope = false;
this.$router.back()
else {
done(true);
}
},
handelCLickConfirmStart(val) {

Loading…
Cancel
Save