| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud" @row-del="rowDel" |
| | | v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" |
| | | @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
| | | @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | v-model:page="page" |
| | | ref="crud" |
| | | @row-del="rowDel" |
| | | v-model="form" |
| | | :permission="permissionList" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | :before-open="beforeOpen" |
| | | :before-close="beforeClose" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | > |
| | | <template #menu-left> |
| | | <!-- <el-button |
| | | type="danger" |
| | |
| | | {{ formatSeconds(row.processingTime) }} |
| | | </template> |
| | | <template #menu="scope"> |
| | | <el-button type="primary" text icon="el-icon-guide" |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="el-icon-guide" |
| | | v-if="permission.odm_task_handle && scope.row.taskId == null" |
| | | @click.stop="atHandle(scope.row, scope.index)">立即启动 |
| | | @click.stop="atHandle(scope.row, scope.index)" |
| | | >立即启动 |
| | | </el-button> |
| | | <el-button type="primary" text icon="el-icon-refresh-right" |
| | | <el-button |
| | | type="primary" |
| | | text |
| | | icon="el-icon-refresh-right" |
| | | v-if="(permission.odm_task_handle && scope.row.status == 30) || scope.row.status == 50" |
| | | @click.stop="restartHandle(scope.row, scope.index)">重新启动 |
| | | @click.stop="restartHandle(scope.row, scope.index)" |
| | | >重新启动 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList, remove, update, add, createOdmTask, restartOdmTask } from '@/api/odm/task' |
| | | import { tourStrategies } from 'element-plus' |
| | | import { mapGetters } from 'vuex' |
| | | import { getList, remove, update, add, createOdmTask, restartOdmTask } from '@/api/odm/task'; |
| | | import { tourStrategies } from 'element-plus'; |
| | | import { mapGetters } from 'vuex'; |
| | | |
| | | export default { |
| | | data () { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | |
| | | searchSpan: 4, |
| | | searchLabelWidth: 100, |
| | | //labelWidth: 130, |
| | | searchPlaceholder: "任务名称", |
| | | searchPlaceholder: '任务名称', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | searchLabelWidth: 100, |
| | | //width: 100, |
| | | labelWidth: 130, |
| | | searchPlaceholder: "任务类型", |
| | | searchPlaceholder: '任务类型', |
| | | dicData: [ |
| | | { |
| | | label: '航测', |
| | |
| | | value: 4, |
| | | }, |
| | | ], |
| | | change: (value) => { |
| | | this.searchChange({ ...this.query,waylineType:value.value}, () => {}); |
| | | } |
| | | change: value => { |
| | | this.searchChange({ ...this.query, waylineType: value.value }, () => {}); |
| | | }, |
| | | }, |
| | | { |
| | | label: '机场名称', |
| | |
| | | search: true, |
| | | searchSpan: 4, |
| | | searchLabelWidth: 100, |
| | | searchPlaceholder: "任务状态", |
| | | searchPlaceholder: '任务状态', |
| | | width: 90, |
| | | dicData: [ |
| | | { label: '待启动', value: 0 }, |
| | |
| | | { label: '已完成', value: 40 }, |
| | | { label: '已取消', value: 50 }, |
| | | ], |
| | | change: (value) => { |
| | | this.searchChange({ ...this.query,status:value.value}, () => {}); |
| | | } |
| | | change: value => { |
| | | this.searchChange({ ...this.query, status: value.value }, () => {}); |
| | | }, |
| | | }, |
| | | |
| | | { |
| | |
| | | { |
| | | label: '完成时间', |
| | | prop: 'completedTime', |
| | | type: "date", |
| | | type: 'date', |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | searchPlaceholder: "任务完成时间", |
| | | searchPlaceholder: '任务完成时间', |
| | | labelWidth: 130, |
| | | search: true, |
| | | searchSpan: 4, |
| | | searchLabelWidth: 100, |
| | | //valueFormat: 'YYYY-MM-DD', |
| | | width: 160, |
| | | change: (value) => { |
| | | this.searchChange({ ...this.query,completedTime:value.value}, () => {}); |
| | | } |
| | | change: value => { |
| | | this.searchChange({ ...this.query, completedTime: value.value }, () => {}); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | } |
| | | isClickSearch: true, |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['permission']), |
| | | permissionList () { |
| | | permissionList() { |
| | | return { |
| | | viewBtn: this.validData(this.permission.odm_task_view, true), |
| | | delBtn: this.validData(this.permission.odm_task_delete, true), |
| | | // editBtn: this.validData(this.permission.workspace_edit, true), |
| | | } |
| | | }; |
| | | }, |
| | | ids () { |
| | | let ids = [] |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id) |
| | | }) |
| | | return ids.join(',') |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(','); |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 立即处理 |
| | | atHandle (row) { |
| | | atHandle(row) { |
| | | createOdmTask(row.waylineJobId, row.gsd).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }) |
| | | done() |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error) |
| | | loading() |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ) |
| | | ); |
| | | }, |
| | | // 重启启动 |
| | | restartHandle (row) { |
| | | restartHandle(row) { |
| | | if (!row.taskName) { |
| | | this.$message({ |
| | | type: 'error', |
| | | message: '该航线任务已删除,无法进行重启启动!', |
| | | }) |
| | | return |
| | | }); |
| | | return; |
| | | } |
| | | restartOdmTask(row.taskId).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }) |
| | | done() |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error) |
| | | loading() |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ) |
| | | ); |
| | | }, |
| | | // 时间格式化 |
| | | formatSeconds (value) { |
| | | formatSeconds(value) { |
| | | // 如果value不是数字或者小于0,则直接返回'00:00:00' |
| | | if (isNaN(value) || value < 0) { |
| | | return '00:00:00' |
| | | return '00:00:00'; |
| | | } |
| | | |
| | | // 计算小时、分钟和秒 |
| | | let seconds = Math.floor(value / 1000) |
| | | let minutes = Math.floor(seconds / 60) |
| | | let hours = Math.floor(minutes / 60) |
| | | let seconds = Math.floor(value / 1000); |
| | | let minutes = Math.floor(seconds / 60); |
| | | let hours = Math.floor(minutes / 60); |
| | | |
| | | // 格式化为两位数字的字符串 |
| | | seconds %= 60 |
| | | minutes %= 60 |
| | | seconds %= 60; |
| | | minutes %= 60; |
| | | |
| | | const formattedTime = `${this.padZero(hours)}:${this.padZero(minutes)}:${this.padZero( |
| | | seconds |
| | | )}` |
| | | )}`; |
| | | |
| | | // 返回格式化后的时间字符串 |
| | | return formattedTime |
| | | return formattedTime; |
| | | }, |
| | | // 函数用于在数字不足两位数时,在前面补零 |
| | | padZero (value) { |
| | | return String(value).padStart(2, '0') |
| | | padZero(value) { |
| | | return String(value).padStart(2, '0'); |
| | | }, |
| | | rowSave (row, done, loading) { |
| | | rowSave(row, done, loading) { |
| | | add(row).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }) |
| | | done() |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error) |
| | | loading() |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ) |
| | | ); |
| | | }, |
| | | rowUpdate (row, index, done, loading) { |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }) |
| | | done() |
| | | }); |
| | | done(); |
| | | }, |
| | | error => { |
| | | window.console.log(error) |
| | | loading() |
| | | window.console.log(error); |
| | | loading(); |
| | | } |
| | | ) |
| | | ); |
| | | }, |
| | | rowDel (row) { |
| | | rowDel(row) { |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id) |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page) |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }) |
| | | }) |
| | | }); |
| | | }); |
| | | }, |
| | | searchReset () { |
| | | this.query = {} |
| | | this.onLoad(this.page) |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange (params, done) { |
| | | this.query = params |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.page, params) |
| | | done() |
| | | searchChange(params, done) { |
| | | if (!this.isClickSearch) return; |
| | | |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange (list) { |
| | | this.selectionList = list |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear () { |
| | | this.selectionList = [] |
| | | this.$refs.crud.toggleSelection() |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | handleDelete () { |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning('请选择至少一条数据') |
| | | return |
| | | this.$message.warning('请选择至少一条数据'); |
| | | return; |
| | | } |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids) |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page) |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '操作成功!', |
| | | }) |
| | | this.$refs.crud.toggleSelection() |
| | | }) |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen (done, type) { |
| | | beforeOpen(done, type) { |
| | | // if (['edit', 'view'].includes(type)) { |
| | | // getDetail(this.form.id).then(res => { |
| | | // this.form = res.data.data; |
| | | // }); |
| | | // } |
| | | done() |
| | | this.isClickSearch = false; |
| | | |
| | | done(); |
| | | }, |
| | | currentChange (currentPage) { |
| | | this.page.currentPage = currentPage |
| | | |
| | | beforeClose(done, type) { |
| | | this.isClickSearch = true; |
| | | |
| | | done(); |
| | | }, |
| | | sizeChange (pageSize) { |
| | | this.page.pageSize = pageSize |
| | | |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | refreshChange () { |
| | | this.onLoad(this.page, this.query) |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | onLoad (page, params = {}) { |
| | | const { releaseTimeRange } = this.query |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | const { releaseTimeRange } = this.query; |
| | | |
| | | let values = { |
| | | ...params, |
| | | ...this.query, |
| | | } |
| | | }; |
| | | if (releaseTimeRange) { |
| | | values = { |
| | | ...values, |
| | | releaseTime_datege: releaseTimeRange[0], |
| | | releaseTime_datelt: releaseTimeRange[1], |
| | | } |
| | | values.releaseTimeRange = null |
| | | }; |
| | | values.releaseTimeRange = null; |
| | | } |
| | | this.loading = true |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, values).then(res => { |
| | | const data = res.data.data |
| | | this.page.total = data.total |
| | | this.data = data.records |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |