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

115
src/views/assistanceDetail/index.vue

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

Loading…
Cancel
Save