订单查询异常GIT提交

This commit is contained in:
2025-02-19 11:07:28 +08:00
parent dd19571489
commit 0055abebdc
4 changed files with 98 additions and 68 deletions

View File

@@ -1,13 +1,21 @@
import request from '@/utils/request'
import { downFile } from '@/utils/request'
/**
* 员工报工清单查询
* @param {查询条件} data
*/
export function listGroupReportList(query) {
return request({
url: 'mes/groupManagement/GroupShift/list',
method: 'get',
params: query
url: 'mes/groupManagement/Achievement/get_staff_achievement_list',
method: 'post',
data: query
})
}
/**
* 导出Excel
* @param params
*/
export async function exportGroupReportAchievement(params) {
const url = '/mes/groupManagement/Achievement/export'
return await downFile(url + params)
}

View File

@@ -6,32 +6,24 @@
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="时间范围">
<el-date-picker v-model="searchForm.dateRange" type="datetimerange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss"
<el-date-picker v-model="searchForm.jobDatetime" :clearable="false" type="datetimerange"
range-separator="" start-placeholder="开始日期" end-placeholder="结束日期"
value-format="YYYY-MM-DD HH:mm:ss"
:default-value="[dayjs().startOf('day').add(8, 'hour'), dayjs().endOf('day').subtract(16, 'hour')]" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="员工名称">
<el-input v-model="searchForm.name" placeholder="请输入员工名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="工序号">
<el-select v-model="searchForm.process" placeholder="请选择工序号">
<el-option label="全部" value=""></el-option>
<el-option v-for="process in processOptions" :key="process" :label="process"
:value="process"></el-option>
</el-select>
<el-input v-model="searchForm.worker" placeholder="请输入员工名称"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="班次选择">
<el-radio-group v-model="searchForm.shift">
<el-radio-button value="白班">白班</el-radio-button>
<el-radio-button value="晚班">晚班</el-radio-button>
<el-radio-group v-model="searchForm.shift" @change="handleShiftChange">
<el-radio-button value="白班">当日白班</el-radio-button>
<el-radio-button value="晚班">当日晚班</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
@@ -39,6 +31,8 @@
<el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button>
<el-button @click="resetForm">重置</el-button>
<el-button type="success" icon="download" @click="handleExport">{{ $t('btn.export')
}}</el-button>
</el-form-item>
</el-col>
</el-row>
@@ -50,37 +44,35 @@
<!-- VxeTable 表格 -->
<vxe-table :data="tableData">
<vxe-column field="员工姓名" title="员工姓名"></vxe-column>
<vxe-column field="物料领用" title="物料领用"></vxe-column>
<vxe-column field="机械加工" title="机械加工"></vxe-column>
<vxe-column field="中间检查" title="中间检查"></vxe-column>
<vxe-column field="手工研磨" title="手工研磨"></vxe-column>
<vxe-column field="机研磨" title="研磨"></vxe-column>
<vxe-column field="精研磨" title="研磨"></vxe-column>
<vxe-column field="入库检查" title="入库检查"></vxe-column>
<vxe-column field="出货" title="出货"></vxe-column>
<vxe-column field="id" title="员工id"></vxe-column>
<vxe-column field="worker" title="员工姓名"></vxe-column>
<vxe-column field="materialUse" title="物料领用"></vxe-column>
<vxe-column field="mechanicalProcessing" title="机械加工"></vxe-column>
<vxe-column field="middleCheck" title="中间检查"></vxe-column>
<vxe-column field="handgrind" title="手工研磨"></vxe-column>
<vxe-column field="machinegrind" title="研磨"></vxe-column>
<vxe-column field="finegrind" title="精研磨"></vxe-column>
<vxe-column field="warehouseInspection" title="入库检查"></vxe-column>
<vxe-column field="shipment" title="出货"></vxe-column>
</vxe-table>
</div>
</template>
<script setup>
import { ref, watch } from 'vue'
import { ref } from 'vue'
import dayjs from 'dayjs'
import { listGroupReportList } from '@/api/groupManagement/achievement.js'
import { listGroupReportList, exportGroupReportAchievement } from '@/api/groupManagement/achievement.js'
const { proxy } = getCurrentInstance()
// 假设这是从你的文件中读取的数据
const tableData = ref([
{ 员工姓名: "员工1", 物料领用: 300, 机械加工: 300, 中间检查: 300, 手工研磨: 300, 机研磨: 300, 精研磨: 300, 入库检查: 300, 出货: 300 },
// 添加更多数据...
])
const tableData = ref([])
// 工序号选项
const processOptions = ['物料领用', '机械加工', '中间检查', '手工研磨', '机研磨', '精研磨', '入库检查', '出货']
// 搜索条件
const searchForm = ref({
name: '',
dateRange: [dayjs().startOf('day').add(8, 'hour'), dayjs().endOf('day').subtract(16, 'hour')],
worker: '',
jobDatetime: [dayjs().startOf('day').add(8, 'hour'), dayjs().endOf('day').subtract(16, 'hour')],
process: '', // 默认值为空表示全部
shift: '白班'
})
@@ -90,13 +82,22 @@ const loading = ref(false)
const error = ref(null)
// 处理班次选择变化
watch(() => searchForm.value.shift, (newVal) => {
function handleShiftChange(newVal) {
const currentDateStart = dayjs(searchForm.value.jobDatetime[0]).startOf('day')
const currentDateEnd = dayjs(searchForm.value.jobDatetime[1]).startOf('day')
if (newVal === '白班') {
searchForm.value.dateRange = [dayjs().startOf('day').add(8, 'hour'), dayjs().endOf('day').subtract(16, 'hour')]
searchForm.value.jobDatetime = [
currentDateStart.hour(8),
currentDateStart.hour(20)
]
} else if (newVal === '晚班') {
searchForm.value.dateRange = [dayjs().startOf('day').add(20, 'hour'), dayjs().add(1, 'day').startOf('day').subtract(4, 'hour')]
searchForm.value.jobDatetime = [
currentDateStart.hour(20),
currentDateStart.hour(32)
]
}
}, { immediate: true })
}
// 处理搜索逻辑
async function handleSearch() {
@@ -119,12 +120,28 @@ async function handleSearch() {
// 重置表单
function resetForm() {
searchForm.value = {
name: '',
dateRange: [dayjs().startOf('day').add(8, 'hour'), dayjs().endOf('day').subtract(16, 'hour')],
worker: '',
jobDatetime: [dayjs().startOf('day').add(8, 'hour'), dayjs().endOf('day').subtract(16, 'hour')],
process: '', // 默认值为空表示全部
shift: '白班'
}
}
// 导出
function handleExport() {
const params = { ...searchForm.value }
proxy.$confirm('您确定要导出当前搜索条件下的信息吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = `?worker=${params.worker}&jobDatetime=${params.jobDatetime[0]}&jobDatetime=${params.jobDatetime[1]}`
exportGroupReportAchievement(param).then(response => {
proxy.$alert("导出成功!")
})
}).catch(() => {
// 用户取消导出
})
}
</script>
<style scoped>

View File

@@ -11,7 +11,8 @@
</el-form-item>
<el-form-item label="订单是否完成">
<el-select v-model="queryParams.orderindicator" placeholder="请选择" clearable>
<el-option v-for="option in boolOptions" :key="option.dictValue" :label="option.dictLabel" :value="option.dictValue" />
<el-option v-for="option in boolOptions" :key="option.dictValue" :label="option.dictLabel"
:value="option.dictValue" />
</el-select>
</el-form-item>
<el-form-item label="销售地区">
@@ -19,20 +20,14 @@
</el-form-item>
<el-form-item label="是否非标">
<el-select v-model="queryParams.specordindicator" placeholder="请选择" clearable>
<el-option v-for="option in boolOptions" :key="option.dictValue" :label="option.dictLabel" :value="option.dictValue" />
<el-option v-for="option in boolOptions" :key="option.dictValue" :label="option.dictLabel"
:value="option.dictValue" />
</el-select>
</el-form-item>
<el-form-item label="单据日期">
<el-date-picker
v-model="queryParams.importDate"
type="datetimerange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date(2000, 1, 1, 8, 0, 0), new Date(2000, 1, 1, 20, 0, 0)]"
:shortcuts="shortcuts"
value-format="YYYY-MM-DD HH:mm:ss"
/>
<el-date-picker v-model="queryParams.importDate" type="datetimerange" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" :default-time="[new Date(2000, 1, 1, 8, 0, 0), new Date(2000, 1, 1, 20, 0, 0)]"
:shortcuts="shortcuts" value-format="YYYY-MM-DD HH:mm:ss" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
@@ -41,7 +36,7 @@
</el-form>
<vxe-table :data="dataList" v-loading="loading" height="600" border header-cell-class-name="el-table-header-cell"
highlight-current-row row-key="id">
highlight-current-row row-key="id">
<vxe-column type="expand">
<template #default="{ row }">
<div>
@@ -54,7 +49,8 @@
<vxe-column field="planNum" align="center" title="计划数量" />
<vxe-column field="workorderDate" title="工单日期">
<template #default="{ row }">
<span v-if="row.workorderDate != '' && row.workorderDate != null">{{ proxy.dayjs(row.workorderDate).format('YYYY-MM-DD') }}</span>
<span v-if="row.workorderDate != '' && row.workorderDate != null">{{
proxy.dayjs(row.workorderDate).format('YYYY-MM-DD') }}</span>
</template>
</vxe-column>
<vxe-column field="priority" title="优先级" align="center">
@@ -120,9 +116,9 @@ const queryParams = reactive({
orderNoMes: '',
purchaseOrderErp: '',
materialCode: '',
orderindicator: '',
orderindicator: -2,
salesArea: '',
specordindicator: '',
specordindicator: -2,
})
const dataList = ref([])
@@ -181,8 +177,9 @@ const isCarton = [
{ dictLabel: '否', dictValue: '0', listClass: 'info' }
]
// 是否纸箱
// 通用判定
const boolOptions = [
{ dictLabel: '全部', dictValue: -2, listClass: 'success' },
{ dictLabel: '是', dictValue: 1, listClass: 'success' },
{ dictLabel: '否', dictValue: 0, listClass: 'info' }
]

View File

@@ -17,8 +17,8 @@
</el-form-item>
<el-form-item label="订单是否完成">
<el-select v-model="queryParams.orderindicator" placeholder="请选择" clearable>
<el-option label="是" value="是" />
<el-option label="否" value="否" />
<el-option v-for="option in boolOptions" :key="option.dictValue" :label="option.dictLabel"
:value="option.dictValue" />
</el-select>
</el-form-item>
<el-form-item label="销售地区">
@@ -26,8 +26,8 @@
</el-form-item>
<el-form-item label="是否非标">
<el-select v-model="queryParams.specordindicator" placeholder="请选择" clearable>
<el-option label="是" value="是" />
<el-option label="否" value="否" />
<el-option v-for="option in boolOptions" :key="option.dictValue" :label="option.dictLabel"
:value="option.dictValue" />
</el-select>
</el-form-item>
<el-form-item>
@@ -226,8 +226,8 @@
<el-col :lg="12">
<el-form-item label="订单是否完成" prop="orderindicator">
<el-radio-group v-model="form.orderindicator">
<el-radio label=""></el-radio>
<el-radio label=""></el-radio>
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -316,7 +316,7 @@ const queryParams = reactive({
orderNoMes: '',
purchaseOrderErp: '',
materialCode: '',
orderindicator: '',
orderindicator: -2,
salesArea: '',
specordindicator: '',
})
@@ -365,6 +365,12 @@ const state = reactive({
kdTypeOptions: [],
}
})
// 通用判定
const boolOptions = [
{ dictLabel: '全部', dictValue: -2, listClass: 'success' },
{ dictLabel: '是', dictValue: 1, listClass: 'success' },
{ dictLabel: '否', dictValue: 0, listClass: 'info' }
]
const { form, rules, options } = toRefs(state)
@@ -477,7 +483,9 @@ function handleExport() {
type: 'warning'
}).then(() => {
exportOrderPurchase(params).then(response => {
proxy.$alert("导出成功!")
if (response.code === 200) {
proxy.$alert("导出成功!")
}
})
}).catch(() => {
// 用户取消导出