Browse Source

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

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

70
src/views/assistance/index.vue

@ -15,30 +15,32 @@
</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 || '服务开始时间'
@ -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>
@ -113,6 +116,7 @@ export default {
rdScore: 5,//
fileList: [],//
rdFinishDesc: null,//
serviceOrgTypeT: null
};
},
created() {
@ -219,9 +223,7 @@ export default {
}
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,23 +246,45 @@ export default {
this.showEnd = false;
},
//
async receiveService() {
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 { data, code, msg } = await receiveService(parm)
let { code } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
@ -270,9 +294,15 @@ export default {
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) {

83
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() {
async handelReceiveService(action, done) {
if (action === "confirm") {
let parm = {
...this.selfObj,
id: this.id,
...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 { data, code, msg } = await receiveService(parm)
let { code } = await receiveService(parm)
if (code === 0) {
this.$tips.success('接单成功')
this.showRole = false;
this.showScope = false;
this.$router.back()
this.pageNo = 1;
this.requestFlag = true;
this.list = [];
this.getTableData();
}
}
else {
done(true);
}
},
handelCLickConfirmStart(val) {

Loading…
Cancel
Save