| | |
| | | </div> |
| | | |
| | | <template #footer v-if="activeName === 'basic' && detailLoaded"> |
| | | <el-button v-if="['11', '21', '23', '31', '60'].includes(gdStatus)" @click="viewDescription" color="#F2F3F5"> |
| | | <el-button |
| | | v-if="['11', '21', '23', '31', '60'].includes(gdStatus)" |
| | | :disabled="footerLoading" |
| | | @click="viewDescription" |
| | | color="#F2F3F5" |
| | | > |
| | | {{ gdStatusObj[gdStatus]?.reason }} |
| | | </el-button> |
| | | |
| | | <template v-if="!suddenlyEdit"> |
| | | <el-button |
| | | @click="addDescription" |
| | | v-if="['20'].includes(gdStatus) && permission.order_applyCancel" |
| | | :disabled="footerLoading" |
| | | @click="addDescription" |
| | | color="#F2F3F5" |
| | | > |
| | | 申请取消 |
| | | </el-button> |
| | | <el-button |
| | | color="#4C34FF" |
| | | @click="requestModification" |
| | | v-if="['20'].includes(gdStatus) && permission.order_applyEdit" |
| | | :loading="modifying" |
| | | :disabled="footerLoading" |
| | | @click="requestModification" |
| | | color="#4C34FF" |
| | | > |
| | | 申请修改 |
| | | </el-button> |
| | |
| | | <el-button |
| | | v-if="(['11'].includes(gdStatus) || suddenlyEdit || !formData.id) && permission.order_release" |
| | | :loading="submitting" |
| | | :disabled="submitting" |
| | | :disabled="footerLoading" |
| | | color="#4C34FF" |
| | | @click="handleSubmit" |
| | | > |
| | | {{ gdStatus === '11' || !gdStatus ? '发布' : '提交修改' }} |
| | | </el-button> |
| | | <el-button v-if="gdStatus === '50' && permission.order_settlement" @click="addDescription" color="#F2F3F5"> |
| | | <el-button |
| | | v-if="gdStatus === '50' && permission.order_settlement" |
| | | :disabled="footerLoading" |
| | | @click="addDescription" |
| | | color="#F2F3F5" |
| | | > |
| | | 结算 |
| | | </el-button> |
| | | <template v-if="permission.order_controlOrder"> |
| | | <el-button v-if="gdStatus === '10'" @click="addDescription" color="#F2F3F5">拒绝接单</el-button> |
| | | <el-button v-if="gdStatus === '10'" @click="statusChange(1)" color="#4C34FF">接单</el-button> |
| | | <el-button v-if="gdStatus === '10'" :disabled="footerLoading" @click="addDescription" color="#F2F3F5"> |
| | | 拒绝接单 |
| | | </el-button> |
| | | <el-button |
| | | v-if="gdStatus === '10'" |
| | | :loading="statusLoading === 1" |
| | | :disabled="footerLoading" |
| | | @click="statusChange(1)" |
| | | color="#4C34FF" |
| | | > |
| | | 接单 |
| | | </el-button> |
| | | </template> |
| | | <template v-if="permission.order_controlEdit"> |
| | | <el-button v-if="gdStatus === '22'" @click="statusChange(8)" color="#F2F3F5">驳回</el-button> |
| | | <el-button v-if="gdStatus === '22'" @click="statusChange(7)" color="#4C34FF">同意</el-button> |
| | | <el-button |
| | | v-if="gdStatus === '22'" |
| | | :loading="statusLoading === 8" |
| | | :disabled="footerLoading" |
| | | @click="statusChange(8)" |
| | | color="#F2F3F5" |
| | | > |
| | | 驳回 |
| | | </el-button> |
| | | <el-button |
| | | v-if="gdStatus === '22'" |
| | | :loading="statusLoading === 7" |
| | | :disabled="footerLoading" |
| | | @click="statusChange(7)" |
| | | color="#4C34FF" |
| | | > |
| | | 同意 |
| | | </el-button> |
| | | </template> |
| | | <template v-if="permission.order_controlCancel"> |
| | | <el-button v-if="gdStatus === '21'" @click="statusChange(6)" color="#F2F3F5">驳回</el-button> |
| | | <el-button v-if="gdStatus === '21'" @click="statusChange(5)" color="#4C34FF">通过</el-button> |
| | | <el-button |
| | | v-if="gdStatus === '21'" |
| | | :loading="statusLoading === 6" |
| | | :disabled="footerLoading" |
| | | @click="statusChange(6)" |
| | | color="#F2F3F5" |
| | | > |
| | | 驳回 |
| | | </el-button> |
| | | <el-button |
| | | v-if="gdStatus === '21'" |
| | | :loading="statusLoading === 5" |
| | | :disabled="footerLoading" |
| | | @click="statusChange(5)" |
| | | color="#4C34FF" |
| | | > |
| | | 通过 |
| | | </el-button> |
| | | </template> |
| | | <el-button v-if="gdStatus === '30' && permission.order_applyNegotiation" @click="addDescription" color="#4C34FF"> |
| | | <el-button |
| | | v-if="gdStatus === '30' && permission.order_applyNegotiation" |
| | | :disabled="footerLoading" |
| | | @click="addDescription" |
| | | color="#4C34FF" |
| | | > |
| | | 协商修改 |
| | | </el-button> |
| | | <el-button |
| | | v-if="gdStatus === '31' && permission.order_controlNegotiation" |
| | | :loading="statusLoading === 10" |
| | | :disabled="footerLoading" |
| | | @click="statusChange(10)" |
| | | color="#4C34FF" |
| | | > |
| | |
| | | import { |
| | | getTaskTypeLabel, |
| | | taskTypeCascaderProps, |
| | | toTaskTypeCascaderValue, |
| | | } from '../taskTypeOptions' |
| | | const store = useStore() |
| | | const permission = computed(() => store.state.user.permission) |
| | |
| | | remark: '', |
| | | geom: '', |
| | | recommendDeviceIds: '', |
| | | typePinyinFirst: '', |
| | | }) |
| | | |
| | | const mapRef = ref(null) |
| | |
| | | const visible = defineModel() // 弹框显隐 |
| | | const dialogMode = ref('add') // 弹框模式 |
| | | const submitting = ref(false) // 提交中 |
| | | const modifying = ref(false) // 申请修改中 |
| | | const statusLoading = ref(null) // 状态操作中 |
| | | const footerLoading = computed(() => submitting.value || modifying.value || statusLoading.value !== null) |
| | | const detailLoaded = ref(false) // 详情加载完成 |
| | | const dialogReadonly = computed(() => dialogMode.value === 'view') |
| | | const titleEnum = ref({ edit: '编辑', view: '查看', add: '新增' }) |
| | |
| | | |
| | | // 操作类型:1接单,2拒接接单,3申请取消,4申请修改, 5同意取消 |
| | | // 6不同意取消 7.同意修改 8.不同意修改 9.协商修改,10:同意协商修改,11.结算 |
| | | function statusChange(operationType) { |
| | | gdWorkOrderHandleStatusApi({ |
| | | operationType: operationType, |
| | | workOrderId: formData.value.id, |
| | | }).then(res => { |
| | | async function statusChange(operationType) { |
| | | if (footerLoading.value) return |
| | | statusLoading.value = operationType |
| | | try { |
| | | await gdWorkOrderHandleStatusApi({ |
| | | operationType: operationType, |
| | | workOrderId: formData.value.id, |
| | | }) |
| | | visible.value = false |
| | | emit('success') |
| | | }) |
| | | } finally { |
| | | statusLoading.value = null |
| | | } |
| | | } |
| | | |
| | | // 申请修改按钮 |
| | | async function requestModification() { |
| | | suddenlyEdit.value = true |
| | | dialogMode.value = 'edit' |
| | | await getDeviceList() |
| | | nextTick(() => { |
| | | syncSelection() |
| | | viewPlane && viewer.entities.remove(viewPlane) |
| | | editPolygon() |
| | | }) |
| | | if (footerLoading.value) return |
| | | modifying.value = true |
| | | try { |
| | | suddenlyEdit.value = true |
| | | dialogMode.value = 'edit' |
| | | await getDeviceList() |
| | | nextTick(() => { |
| | | syncSelection() |
| | | viewPlane && viewer.entities.remove(viewPlane) |
| | | editPolygon() |
| | | }) |
| | | } finally { |
| | | modifying.value = false |
| | | } |
| | | } |
| | | |
| | | // 填写说明弹框回调 |
| | |
| | | |
| | | // 提交新增/编辑 |
| | | async function handleSubmit() { |
| | | const isValid = await formRef.value?.validate().catch(() => false) |
| | | if (!isValid) return |
| | | if (!pointList.value.length) { |
| | | return ElMessage.warning('请绘制范围') |
| | | } |
| | | if (!formData.value.recommendDeviceIds) { |
| | | return ElMessage.warning('请选择设备') |
| | | } |
| | | if (footerLoading.value) return |
| | | submitting.value = true |
| | | try { |
| | | const isValid = await formRef.value?.validate().catch(() => false) |
| | | if (!isValid) return |
| | | if (!pointList.value.length) { |
| | | return ElMessage.warning('请绘制范围') |
| | | } |
| | | if (!formData.value.recommendDeviceIds) { |
| | | return ElMessage.warning('请选择设备') |
| | | } |
| | | const str = [...pointList.value, pointList.value[0]].map(item => `${item.longitude} ${item.latitude}`).join(',') |
| | | formData.value.geom = `POLYGON((${str}))` |
| | | if (!formData.value.id) { |
| | |
| | | loadList() |
| | | const res = await gdWorkOrderDetailApi({ id: formData.value.id }) |
| | | formData.value = res?.data?.data ?? {} |
| | | formData.value.workOrderType = toTaskTypeCascaderValue(formData.value.workOrderType) |
| | | dateRange.value = [formData.value.executeStartTime, formData.value.executeEndTime] |
| | | } |
| | | |
| | |
| | | } |
| | | ) |
| | | |
| | | // 取汉字(或英文)首字的拼音首字母,大写。如「占」→ Z |
| | | function getFirstPinyinLetter(text) { |
| | | const char = String(text ?? '').trim().charAt(0) |
| | | if (!char) return '' |
| | | // 英文/数字直接取大写 |
| | | if (/[a-zA-Z]/.test(char)) return char.toUpperCase() |
| | | // 按拼音排序的各首字母边界字,用 zh-CN 本地化比较定位所属字母 |
| | | const boundaries = [ |
| | | ['A', '啊'], ['B', '芭'], ['C', '擦'], ['D', '搭'], ['E', '蛾'], |
| | | ['F', '发'], ['G', '噶'], ['H', '哈'], ['J', '击'], ['K', '喀'], |
| | | ['L', '垃'], ['M', '妈'], ['N', '拿'], ['O', '哦'], ['P', '啪'], |
| | | ['Q', '期'], ['R', '然'], ['S', '撒'], ['T', '塌'], ['W', '挖'], |
| | | ['X', '昔'], ['Y', '压'], ['Z', '匝'], |
| | | ] |
| | | for (let i = boundaries.length - 1; i >= 0; i--) { |
| | | if (char.localeCompare(boundaries[i][1], 'zh-CN') >= 0) return boundaries[i][0] |
| | | } |
| | | return '' |
| | | } |
| | | |
| | | // 工单类型变化时,用类型名称第一个字的拼音首字母(大写)赋值给 typePinyinFirst |
| | | watch( |
| | | () => formData.value.workOrderType, |
| | | value => { |
| | | const label = getTaskTypeLabel(value, workOrderTypeXT.value) |
| | | formData.value.typePinyinFirst = getFirstPinyinLetter(label) |
| | | }, |
| | | { deep: true } |
| | | ) |
| | | |
| | | // 地图加载完毕 |
| | | function mapReady() { |
| | | dialogMode.value === 'add' && mapRef.value.flyBoundary() |
| | |
| | | |
| | | .gd-cesium { |
| | | position: relative; |
| | | //overflow: hidden; |
| | | overflow: hidden; |
| | | width: 100%; |
| | | height: 390px; |
| | | } |