Merge branch 'master' of http://192.168.1.22:3000/frontend/pqs-9100_client
This commit is contained in:
@@ -43,4 +43,9 @@ export const getPqReportAllVersion = (params:any) => {
|
||||
//被检设备归档
|
||||
export const documentedPqDev = (ids: string[]) => {
|
||||
return http.post(`/report/documented`, ids)
|
||||
}
|
||||
|
||||
//上传报告到云端
|
||||
export const uploadReportToCloud = (deviceIds: string[]) => {
|
||||
return http.post(`/report/uploadReportToCloud`, deviceIds)
|
||||
}
|
||||
@@ -140,7 +140,7 @@
|
||||
link
|
||||
:icon='Download'
|
||||
@click="openDrawer('报告下载', scope.row)"
|
||||
v-if='form.activeTabs === 3 && form.activeChildTabs === 0 && scope.row.reportState === 1'
|
||||
v-if='form.activeTabs === 3 && form.activeChildTabs === 0 && (scope.row.reportState === 1 ||scope.row.reportState === 3)'
|
||||
>报告下载
|
||||
</el-button>
|
||||
|
||||
@@ -630,6 +630,8 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
return '已生成'
|
||||
} else if (scope.row.reportState === 2) {
|
||||
return '未检'
|
||||
}else if(scope.row.reportState === 3){
|
||||
return '已上传'
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
@@ -730,7 +730,7 @@ const initScriptData = async () => {
|
||||
|
||||
let response: any = await getBigTestItem({reCheckType: checkStore.reCheckType, planId: checkStore.plan.id, devIds: checkStore.devices.map(item => item.deviceId)})
|
||||
|
||||
let temp = response.data.map(item => {
|
||||
let temp = response.data.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
scriptName: item.scriptName
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('比对式')"
|
||||
v-if='modeStore.currentMode === "比对式"'>导入
|
||||
</el-button>
|
||||
<el-button type='primary' :icon='Upload' plain @click='uploadFile()' v-if='appSceneStore.currentScene === "1"'>报告上传</el-button>
|
||||
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||
@click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
@@ -28,6 +29,8 @@
|
||||
</el-button>
|
||||
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除
|
||||
</el-button>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
</ProTable>
|
||||
@@ -38,7 +41,7 @@
|
||||
|
||||
<script setup lang='tsx' name='useRole'>
|
||||
import TimeControl from '@/components/TimeControl/index.vue'
|
||||
import {type Device} from '@/api/device/interface/device.ts'
|
||||
import {type Device} from '@/api/device/interface/device'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {useDownload} from '@/hooks/useDownload'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
@@ -47,8 +50,9 @@ import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/int
|
||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||
import {CirclePlus, Delete, Download, EditPen, Upload} from '@element-plus/icons-vue'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev,getPqDevById} from '@/api/device/device/index.ts'
|
||||
import {ElMessageBox} from 'element-plus'
|
||||
import {deletePqDev, downloadTemplate, exportPqDev, getPqDev, getPqDevList, importPqDev} from '@/api/device/device/index'
|
||||
import {uploadReportToCloud} from '@/api/device/report/index'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import {onBeforeMount, reactive, ref} from 'vue'
|
||||
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode'
|
||||
|
||||
@@ -93,7 +97,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
prop: 'devType',
|
||||
label: '设备类型',
|
||||
minWidth: 200,
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
prop: 'createDate',
|
||||
@@ -200,7 +204,7 @@ const openDialog = async (titleType: string, row: Partial<Device.ResPqDev> = {})
|
||||
row = await getPqDevById(row)
|
||||
devicePopup.value?.open(titleType, row.data, modeStore.currentMode, appSceneStore.currentScene, devTypeOptions.value)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +255,42 @@ const importFile = async (pattern: string) => {
|
||||
getTableList: proTable.value?.getTableList,
|
||||
}
|
||||
deviceImportExcel.value?.acceptParams(params)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 报告上传
|
||||
const uploadFile = async () => {
|
||||
const selectedRows = proTable.value?.selectedList || []
|
||||
|
||||
if (selectedRows.length === 0) {
|
||||
// 没有选择设备,弹出确认框询问是否处理全部
|
||||
ElMessageBox.confirm('未选择被检设备,是否对全部设备进行报告上传?', '提示', {
|
||||
type: 'warning',
|
||||
confirmButtonText: '全部上传',
|
||||
cancelButtonText: '取消'
|
||||
}).then(() => {
|
||||
// 用户确认全部上传,传递空数组或特殊标识
|
||||
handleReportUpload([])
|
||||
}).catch(() => {
|
||||
// 用户取消
|
||||
})
|
||||
} else {
|
||||
// 有选择设备,使用选中的设备ID
|
||||
const selectedIds = selectedRows.map(row => row.id)
|
||||
handleReportUpload(selectedIds)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理报告上传
|
||||
const handleReportUpload = async (deviceIds: string[]) => {
|
||||
try {
|
||||
await uploadReportToCloud(deviceIds)
|
||||
ElMessage.success('报告上传成功')
|
||||
} catch (error) {
|
||||
ElMessage.error('报告上传失败')
|
||||
console.error('报告上传错误:', error)
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
||||
Reference in New Issue
Block a user