| | |
| | | <template> |
| | | <el-dialog class="ztzf-dialog-mange" modal-class="add-edit-details" v-model="isShowAddEditDetails" :title="txtTitle" |
| | | width="70%" :close-on-click-modal="false" :destroy-on-close="true" @close="cancel" |
| | | :before-close="handleBeforeClose"> |
| | | <el-dialog |
| | | class="ztzf-dialog-mange" |
| | | modal-class="add-edit-details" |
| | | v-model="isShowAddEditDetails" |
| | | :title="txtTitle" |
| | | width="70%" |
| | | :close-on-click-modal="false" |
| | | :destroy-on-close="true" |
| | | @close="cancel" |
| | | :before-close="handleBeforeClose" |
| | | > |
| | | <div class="add-edit-details"> |
| | | <div class="process" v-if="txtTitle !== '新建工单'"> |
| | | <div class="process" v-if="txtTitle !=='新建工单'"> |
| | | <div class="order_title">{{ formParams.name }}</div> |
| | | <div class="custom-steps-container"> |
| | | <!-- 标题行 --> |
| | | <div class="steps-titles"> |
| | | <div class="step-title" v-for="(record, index) in formParams.record_list" |
| | | :class="{ active: record.user_id >= 0 }" :key="index"> |
| | | <div class="step-title" v-for="(record, index) in formParams.record_list" :class="{ active: record.user_id >= 0 }" :key="index"> |
| | | {{ record.status_str }} |
| | | </div> |
| | | </div> |
| | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单名称" prop="name"> |
| | | <el-input v-model="formParams.name" placeholder="请输入工单名称" maxlength="100" show-word-limit |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | <el-input v-model="formParams.name" placeholder="请输入工单名称" maxlength="100" show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="关联航线" prop="file_id"> |
| | | <el-select v-model="formParams.file_id" placeholder="请选择航线" filterable @change="getFlyingNest" |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"> |
| | | <el-select v-if="txtTitle === '新建工单'" v-model="formParams.file_id" placeholder="请选择航线" filterable @change="getFlyingNest"> |
| | | <el-option v-for="item in lineList" :key="item.wayline_id" :label="item.name" |
| | | :value="item.wayline_id" /> |
| | | :value="item.wayline_id" /> |
| | | </el-select> |
| | | <el-input v-else v-model="formParams.wayline_file_region_vo.name" :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="安全返航真高" prop="rth_altitude" class="safe-height"> |
| | | <el-input-number v-model="formParams.rth_altitude" :min="50" :max="500" |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input-number> |
| | | <el-input-number v-model="formParams.rth_altitude" :min="50" :max="500" :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input-number> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联机巢" prop="device_sns"> |
| | | <el-select v-model="formParams.device_sns" placeholder="请选择机巢" multiple |
| | | :disabled="(txtTitle === '工单审核' || txtTitle === '工单详情')"> |
| | | <el-option v-for="item in drone_sns" :key="item.device_sn" :label="item.nickname" |
| | | :value="item.device_sn" /> |
| | | <el-select v-model="formParams.device_sns" placeholder="请选择机巢" multiple :disabled="(txtTitle === '工单审核' || txtTitle === '工单详情')"> |
| | | <el-option v-for="item in drone_sns" :key="item.device_sn" :label="item.nickname" :value="item.device_sn" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联算法" prop="ai_types"> |
| | | <el-select v-model="formParams.ai_types" placeholder="请选择关联算法" multiple |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"> |
| | | <el-option v-for="item in aiTypeList" :key="item.dictKey" :label="item.dictValue" |
| | | :value="item.dictKey" /> |
| | | <el-select v-model="formParams.ai_types" placeholder="请选择关联算法" multiple :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"> |
| | | <el-option v-for="item in aiTypeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12" v-if="txtTitle === '新建工单'"> |
| | | <el-col :span="12" v-if="txtTitle === '新建工单'"> |
| | | <el-form-item label="工单内容" prop="content"> |
| | | <el-input type="textarea" v-model="formParams.content" rows="4" placeholder="请输入工单内容" maxlength="255" |
| | | show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | <el-input type="textarea" v-model="formParams.content" rows="4" placeholder="请输入工单内容" maxlength="255" show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | |
| | | |
| | | <el-col :span="7"> |
| | | <el-form-item label="周期频次" prop="date_range"> |
| | | <el-date-picker :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'" v-model="formParams.date_range" |
| | | type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" |
| | | :disabled-date="disabledDate" /> |
| | | <el-date-picker :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'" |
| | | v-model="formParams.date_range" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | :disabled-date="disabledDate" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-select v-model="formParams.rep_fre_type" placeholder="请选择频次" |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"> |
| | | <el-select v-model="formParams.rep_fre_type" placeholder="请选择频次" :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"> |
| | | <el-option v-for="item in weeks" :key="item" :label="item" :value="item" /> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-time-picker :style="{ width: pxToRem(140) }" v-model="formParams.deal_time" |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'" prop="deal_time" value-format="HH:mm" |
| | | :picker-options="{ selectableRange: '00:00 - 23:59' }" /> |
| | | <el-time-picker :style="{ width: pxToRem(140) }" |
| | | v-model="formParams.deal_time" |
| | | :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'" |
| | | prop="deal_time" |
| | | value-format="HH:mm" |
| | | :picker-options="{ selectableRange: '00:00 - 23:59'}" /> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单内容" prop="content"> |
| | | <el-input type="textarea" v-model="formParams.content" rows="4" placeholder="请输入工单内容" maxlength="255" |
| | | show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | show-word-limit :disabled="txtTitle === '工单审核' || txtTitle === '工单详情'"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | <template #footer v-if="txtTitle === '工单审核'"> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" v-if="formParams.status == 1 && permission.orderLogpass" |
| | | @click="orderPass(formParams.id)">通过 |
| | | <el-button type="primary" |
| | | v-if="formParams.status == 1 && permission.orderLogpass" |
| | | @click="orderPass(formParams.id)">通过 |
| | | </el-button> |
| | | <el-button type="danger" v-if="formParams.status == 1 && permission.rejection_btn" |
| | | @click="orderReject(formParams.id)">驳回 |
| | | <el-button type="danger" |
| | | v-if="formParams.status == 1 && permission.rejection_btn" |
| | | @click="orderReject(formParams.id)">驳回 |
| | | </el-button> |
| | | <el-button @click="cancel" icon="el-icon-circle-close">取消</el-button> |
| | | </div> |
| | |
| | | <template #footer v-if="txtTitle === '工单编辑'"> |
| | | <div class="dialog-footer"> |
| | | <el-button type="danger" |
| | | v-if="formParams.status == 0 || (formParams.status == 2 && userInfo.user_id === formParams.create_user)" |
| | | @click="submitForm(1)" icon="el-icon-position">发布 |
| | | v-if="formParams.status == 0 || (formParams.status == 2 && userInfo.user_id === formParams.create_user)" |
| | | @click="submitForm(1)" icon="el-icon-position">发布 |
| | | </el-button> |
| | | <el-button @click="cancel" icon="el-icon-circle-close">取消</el-button> |
| | | </div> |
| | |
| | | |
| | | <script setup> |
| | | import { pxToRem, pxToRemNum } from '@/utils/rem' |
| | | import { ref, shallowRef, onMounted, computed } from 'vue' |
| | | import { ref, shallowRef, onMounted, computed } from 'vue'; |
| | | import { newGetWorkspacesPage } from '@/api/resource/wayline' |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getFlyingNestBy } from '@/api/device/device' |
| | |
| | | orderLogPass, |
| | | orderLogReject, |
| | | orderLogRecall, getWaylineMaxTerrainHeight |
| | | } from '@/api/tickets/orderLog' |
| | | } from '@/api/tickets/orderLog'; |
| | | import dayjs from 'dayjs' |
| | | import 'dayjs/locale/zh-cn' // 导入中文语言包 |
| | | import _ from 'lodash' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import weekday from 'dayjs/plugin/weekday' |
| | | dayjs.extend(weekday) |
| | | dayjs.locale('zh-cn') |
| | | import { useStore } from 'vuex' |
| | | |
| | | const emit = defineEmits(['refresh']) |
| | | const emit = defineEmits(['refresh']); |
| | | |
| | | const store = useStore() |
| | | const userInfo = computed(() => store.state.user.userInfo) |
| | | const permission = computed(() => store.state.user.permission) |
| | | const permission = computed(() => store.state.user.permission); |
| | | |
| | | // safeHeight 计算属性 |
| | | const safeHeight = computed(() => { |
| | |
| | | initMapLine({}, polygon => { |
| | | const currentLine = lineList.value.find(item => item.wayline_id === waylineId) |
| | | const params = { |
| | | type: ['2', '4', '5', '7', '8', '9', '10'].includes(currentLine.wayline_type) ? 2 : 0, |
| | | type: ['2', '4', '5'].includes(currentLine.wayline_type) ? 2 : 0, |
| | | wayline_id: waylineId, |
| | | polygon |
| | | } |
| | |
| | | // } |
| | | |
| | | // initMapLine 方法 |
| | | const initMapLine = async (infos = {}, cb = () => { }) => { |
| | | const currentLine = lineList.value.find(item => item.wayline_id == formParams.value.file_id) |
| | | const initMapLine = async (infos = {}, cb = () => {}) => { |
| | | let currentLine = lineList.value.find(item => item.wayline_id == formParams.value.file_id) |
| | | |
| | | |
| | | if (!currentLine) return |
| | | if (!currentLine) { |
| | | currentLine = formParams.value.wayline_file_region_vo |
| | | } |
| | | |
| | | await nextTick() |
| | | if (mapContainerRef.value?.initAddEntity) { |
| | |
| | | ).padStart(2, '0')} 00:00:00` |
| | | } |
| | | |
| | | async function returnHeight () { |
| | | let checkedList = drone_sns.value.filter(item => formParams.value.device_sns.includes(item.device_sn)) |
| | | async function returnHeight() { |
| | | let checkedList = drone_sns.value.filter(item => formParams.value.device_sns.includes(item.device_sn)); |
| | | const maxItem = checkedList.reduce((max, item) => { |
| | | return item.drone_height > max.drone_height ? item : max |
| | | }) |
| | | return item.drone_height > max.drone_height ? item : max; |
| | | }); |
| | | // 返航绝对高度 |
| | | let backHeight = formParams.value.rth_altitude // + maxItem.drone_height |
| | | console.log(backHeight, 'backHeight') |
| | | console.log(backHeight,'backHeight') |
| | | // 安全起飞高度 |
| | | let positions = positionsArr.value |
| | | positions.unshift({ latitude: maxItem.latitude, longitude: maxItem.longitude, height: maxItem.drone_height }) |
| | | positions.push({ latitude: maxItem.latitude, longitude: maxItem.longitude, height: maxItem.drone_height }) |
| | | positions.unshift({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height }) |
| | | positions.push({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height}) |
| | | let resultHeight = 0 |
| | | await getWaylineMaxTerrainHeight(positions).then(res => { |
| | | resultHeight = safeHeight.value > (res.data.data + 30) ? safeHeight.value : (res.data.data + 30) |
| | |
| | | return _.round(backHeight - resultHeight, 2) |
| | | } |
| | | |
| | | function submitForm (status) { |
| | | function submitForm(status) { |
| | | orderFormRef.value?.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | console.log('表单验证通过') |
| | |
| | | const now = new Date() |
| | | |
| | | if (selectedDate === dayjs().format('YYYY-MM-DD') && selectedTime < now) { |
| | | return ElMessage({ message: '任务时间不能小于当前时间', type: 'warning' }) |
| | | return ElMessage({message: '任务时间不能小于当前时间', type: 'warning'}) |
| | | } |
| | | } |
| | | let checkedList = drone_sns.value.filter(item => formParams.value.device_sns.includes(item.device_sn)) |
| | | let checkedList = drone_sns.value.filter(item => formParams.value.device_sns.includes(item.device_sn)); |
| | | const maxItem = checkedList.reduce((max, item) => { |
| | | return item.drone_height > max.drone_height ? item : max |
| | | }) |
| | | return item.drone_height > max.drone_height ? item : max; |
| | | }); |
| | | // 返航绝对高度 |
| | | let backHeight = formParams.value.rth_altitude // + maxItem.drone_height |
| | | console.log(backHeight, 'backHeight') |
| | | console.log(backHeight,'backHeight') |
| | | // 安全起飞高度 |
| | | let positions = positionsArr.value |
| | | positions.unshift({ latitude: maxItem.latitude, longitude: maxItem.longitude, height: maxItem.drone_height }) |
| | | positions.push({ latitude: maxItem.latitude, longitude: maxItem.longitude, height: maxItem.drone_height }) |
| | | positions.unshift({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height }) |
| | | positions.push({latitude: maxItem.latitude, longitude: maxItem.longitude, height:maxItem.drone_height}) |
| | | let resultHeight = 0 |
| | | let valueHeight = 0 |
| | | await getWaylineMaxTerrainHeight(positions).then(res => { |
| | | resultHeight = (safeHeight.value + maxItem.drone_height) > (res.data.data + 30) ? (safeHeight.value + maxItem.drone_height) : (res.data.data + 30) |
| | | console.log(resultHeight, maxItem.drone_height, '999') |
| | | console.log(resultHeight,maxItem.drone_height, '999') |
| | | valueHeight = (resultHeight - maxItem.drone_height) > backHeight ? _.round(resultHeight - maxItem.drone_height) : 0 |
| | | }) |
| | | if (valueHeight > 0) { |
| | |
| | | } |
| | | await saveUpdateOrderLog(submitData) |
| | | if (txtTitle === '新建工单') { |
| | | ElMessage({ message: '工单创建成功', type: 'success' }) |
| | | ElMessage({message: '工单创建成功', type: 'success'}) |
| | | } else { |
| | | ElMessage({ message: '工单发布成功', type: 'success' }) |
| | | ElMessage({message: '工单发布成功', type: 'success'}) |
| | | } |
| | | cancel() |
| | | } else { |
| | |
| | | }) |
| | | } |
| | | // 审核通过 |
| | | function orderPass (id) { |
| | | function orderPass(id) { |
| | | orderLogPass(id).then(res => { |
| | | ElMessage.success('审核通过') |
| | | cancel() |
| | |
| | | // 监听txtTitle |
| | | watch(isShowAddEditDetails, async (newVal, oldVal) => { |
| | | console.log('txtTitle 发生变化:', newVal, oldVal) |
| | | formParams.value = { rth_altitude: 120 } |
| | | formParams.value = {rth_altitude:120} |
| | | if (txtTitle.value === '工单审核' || txtTitle.value === '工单详情' || txtTitle.value === '工单编辑') { |
| | | const response = await orderLogDetails(rowObj.value.id) |
| | | const data = response.data.data |
| | | formParams.value = { |
| | | ...data |
| | | } |
| | | console.log(formParams.value, '898789') |
| | | drone_sns.value = data.device_list |
| | | initMapLine(data.device_map_infos) |
| | | } else { |
| | |
| | | }, { |
| | | immediate: true // 立即执行一次 |
| | | }) |
| | | function handleBeforeClose () { |
| | | function handleBeforeClose() { |
| | | cancel() |
| | | } |
| | | function cancel () { |
| | | function cancel() { |
| | | formParams.value = {} |
| | | isShowAddEditDetails.value = false |
| | | emit('refresh') |
| | | emit('refresh'); |
| | | } |
| | | |
| | | // onMounted(async () => { |
| | |
| | | |
| | | .week_pc_one { |
| | | flex: 1; |
| | | |
| | | .week-r { |
| | | margin-right: 4px; |
| | | } |
| | |
| | | width: 100% !important; |
| | | } |
| | | } |
| | | |
| | | .process { |
| | | .order_title { |
| | | height: 30px; |
| | |
| | | font-weight: bold; |
| | | color: #333; |
| | | } |
| | | |
| | | .custom-steps-container { |
| | | width: 100%; |
| | | margin: 7px 0; |