Browse Source

feat: 一谢调整

main
betaqi 2 days ago
parent
commit
76f58a6958
  1. 1
      src/api/module/taks/index.ts
  2. 2
      src/components/Edfs-dialog.vue
  3. 8
      src/views/stationData/components/offTransferDlg.vue
  4. 6
      src/views/stationData/components/onLineTransferDlg.vue
  5. 1
      src/views/stationData/transferData.vue
  6. 4
      src/views/taskList/index.vue
  7. 16
      src/views/taskList/infoDrawer.vue

1
src/api/module/taks/index.ts

@ -32,6 +32,7 @@ export interface TaskCreateParams {
mode: 'import' | 'export' | 'update' mode: 'import' | 'export' | 'update'
startTime?: string startTime?: string
endTime?: string endTime?: string
firmware?: string
} }
export const createTask = (params: TaskCreateParams) => globalServer({ export const createTask = (params: TaskCreateParams) => globalServer({

2
src/components/Edfs-dialog.vue

@ -23,7 +23,7 @@
inner-text="确定" inner-text="确定"
/> />
<edfs-button v-if="useDelBtn" type="danger" @click="onDel" inner-text="删除" /> <edfs-button v-if="useDelBtn" type="danger" @click="onDel" inner-text="删除" />
<edfs-button @click="onClose" inner-text="取消" /> <edfs-button @click="onClose" inner-text="关闭" />
</div> </div>
</template> </template>
</el-dialog> </el-dialog>

8
src/views/stationData/components/offTransferDlg.vue

@ -1,5 +1,6 @@
<template> <template>
<EdfsDialog :title="'数据导出'" :is-show="visible" width="580px" @on-close="close" @on-save="onSave"> <EdfsDialog :title="'数据导出'" :is-show="visible" width="580px" :btnLoading="btnLoading" @on-close="close"
@on-save="onSave">
<div class="flex-col gap-10 w-80% m-x-30px"> <div class="flex-col gap-10 w-80% m-x-30px">
<el-row> <el-row>
<div class="label"> <div class="label">
@ -45,6 +46,7 @@ function open(parmas: TaskCreateParams) {
visible.value = true visible.value = true
} }
const btnLoading = ref(false)
async function onSave() { async function onSave() {
if (verifyData()) return if (verifyData()) return
if (!paramsData.value) { if (!paramsData.value) {
@ -55,14 +57,14 @@ async function onSave() {
paramsData.value.devices.forEach((r) => { paramsData.value.devices.forEach((r) => {
r.host = form.value.clientIp r.host = form.value.clientIp
}) })
btnLoading.value = true
const res = await createTask(paramsData.value) const res = await createTask(paramsData.value)
if (res.code !== 0) { if (res.code !== 0) {
message.error(`任务创建失败`) message.error(`任务创建失败`)
} else { } else {
message.success('任务创建成功,请在任务列表中查看') message.success('任务创建成功,请在任务列表中查看')
} }
btnLoading.value = false
emit('on-save') emit('on-save')
close() close()
} }

6
src/views/stationData/components/onLineTransferDlg.vue

@ -1,5 +1,6 @@
<template> <template>
<EdfsDialog :title="isBatchTransfer ? '批量迁移' : '数据迁移'" :is-show="visible" width="580px" @on-close="close" <EdfsDialog :title="isBatchTransfer ? '批量迁移' : '数据迁移'" :is-show="visible" width="580px" @on-close="close"
:btnLoading="btnLoading"
@on-save="onSave"> @on-save="onSave">
<div class="flex-col gap-10 w-80% m-x-30px"> <div class="flex-col gap-10 w-80% m-x-30px">
<el-row> <el-row>
@ -101,7 +102,7 @@ function open(parmas: TaskCreateParams) {
paramsData.value = parmas paramsData.value = parmas
visible.value = true visible.value = true
} }
const btnLoading = ref(false)
async function onSave() { async function onSave() {
if (!verifyData()) return if (!verifyData()) return
if (!paramsData.value) { if (!paramsData.value) {
@ -111,6 +112,7 @@ async function onSave() {
const params = paramsData.value const params = paramsData.value
params.startTime = dayjs(startTime.value).format('YYYY-MM-DD HH:mm:ss') params.startTime = dayjs(startTime.value).format('YYYY-MM-DD HH:mm:ss')
params.endTime = dayjs(endTime.value).format('YYYY-MM-DD HH:mm:ss') params.endTime = dayjs(endTime.value).format('YYYY-MM-DD HH:mm:ss')
btnLoading.value = true
const res = await createTask(params) const res = await createTask(params)
if (res.code !== 0) { if (res.code !== 0) {
message.error(`任务创建失败`) message.error(`任务创建失败`)
@ -118,7 +120,7 @@ async function onSave() {
message.success('任务创建成功,请在任务列表中查看') message.success('任务创建成功,请在任务列表中查看')
} }
btnLoading.value = false
emit('on-save') emit('on-save')
close() close()
} }

1
src/views/stationData/transferData.vue

@ -369,6 +369,7 @@ async function onFirmwareUpload(devices: IOnlineDevice[]) {
site, site,
devices: deivcesParms, devices: deivcesParms,
mode: 'update', mode: 'update',
firmware: firmwarePath.value,
} }
const res = await createTask(parmas) const res = await createTask(parmas)
if (res.code !== 0) { if (res.code !== 0) {

4
src/views/taskList/index.vue

@ -93,6 +93,7 @@ const tableCol = [
{ label: '任务类型', prop: 'mode', minWidth: '10%' }, { label: '任务类型', prop: 'mode', minWidth: '10%' },
{ label: '任务状态', prop: 'status', minWidth: '10%' }, { label: '任务状态', prop: 'status', minWidth: '10%' },
{ label: '创建时间', prop: 'startTime', minWidth: '10%' }, { label: '创建时间', prop: 'startTime', minWidth: '10%' },
{ label: '任务详情', prop: 'info', minWidth: '20%' },
] ]
@ -102,7 +103,6 @@ const list = ref<TaskList[]>([])
const queryParams = reactive({ const queryParams = reactive({
page: 1, page: 1,
size: undefined, size: undefined,
}) })
const tableRef = ref() const tableRef = ref()
const getList = async () => { const getList = async () => {
@ -139,7 +139,7 @@ const onCancel = async (id: string) => {
await getList() await getList()
} }
function onTaskFinish(id: string, status: -1 | 0 | 1 | 2 | 3) { function onTaskFinish(id: string, status: -1 | 0 | 1 | 2 | 3) {
const curTask = list.value.findIndex(item => item.id === id) const curTask = list.value.findIndex(item => item.id === id)
if (curTask !== -1) { if (curTask !== -1) {
list.value[curTask].status = status list.value[curTask].status = status

16
src/views/taskList/infoDrawer.vue

@ -5,9 +5,9 @@
:before-close="handleBeforeClose"> :before-close="handleBeforeClose">
<main class="wh-full" v-loading="loading"> <main class="wh-full" v-loading="loading">
<template v-for="detail in detailList"> <template v-for="detail in detailList">
<el-descriptions border :title="`${detail.sn}任务详情`"> <el-descriptions border :title="`${detail.sn}任务详情`" style="margin-top: 20px">
<el-descriptions-item :label-width="60" label="状态"> <el-descriptions-item :label-width="60" label="状态">
<el-tag size="small">{{ <el-tag size="small" :type="statusTypeMap[detail.status]" >{{
statusList.find(r => r.value === statusList.find(r => r.value ===
detail.status)?.label || '--' detail.status)?.label || '--'
}} }}
@ -24,11 +24,11 @@
<el-descriptions-item :label-width="60" label="信息"> <el-descriptions-item :label-width="60" label="信息">
{{ detail?.info ? detail.info : '暂无信息' }} {{ detail?.info ? detail.info : '暂无信息' }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="当前进度"> <el-descriptions-item label="当前进度" style="width: 400px">
<template v-if="detail.total === 0"> <template v-if="detail.total === 0">
<span>暂无进度</span> <span>暂无进度</span>
</template> </template>
<el-progress v-else style="width: 95%;" <el-progress v-else
:percentage="Math.floor((detail.finish / detail.total) * 100)" :percentage="Math.floor((detail.finish / detail.total) * 100)"
:text-inside="true" :stroke-width="20"/> :text-inside="true" :stroke-width="20"/>
</el-descriptions-item> </el-descriptions-item>
@ -92,6 +92,14 @@ const statusList = [
} }
] ]
const statusTypeMap = {
'-1': 'danger',
'0': 'info',
'1': 'warning',
'2': 'info',
'3': 'primary'
}
function zmqTaskCb(msg: SubMsgData) { function zmqTaskCb(msg: SubMsgData) {
const { feedback } = msg const { feedback } = msg

Loading…
Cancel
Save