派工工单添加分页
This commit is contained in:
parent
59890053b9
commit
be92dd1a7b
@ -72,10 +72,11 @@ export const assingWorkDetailApi = {
|
|||||||
|
|
||||||
|
|
||||||
//根据派工id获取详情信息
|
//根据派工id获取详情信息
|
||||||
selectAssingWorkDetailListByAssingWorkId(assingWorkId:number) {
|
selectAssingWorkDetailListByAssingWorkId(params:{page?:number;pageSize?:number;assingWorkId?:number}) {
|
||||||
return request({
|
return request({
|
||||||
url:`/biz/assingWorkDetail/getAssingWorkDetailList/${assingWorkId}`,
|
url:`/biz/assingWorkDetail/getAssingWorkDetailList`,
|
||||||
method:"get"
|
method:"get",
|
||||||
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ export const qualityTestingApi = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//加载质检单
|
//加载质检单
|
||||||
loadQualityTestingList(assingId:number) {
|
loadQualityTestingList(params:{page?:number,pageSize?:number,assingId?:number}) {
|
||||||
return request({url:`/mes/qc/loadQualityTestingList/${assingId}`,method:'get'})
|
return request({url:`/mes/qc/loadQualityTestingList`,method:'get', params})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,7 +99,8 @@ export const submitLogApi = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//加载汇报列表
|
//加载汇报列表
|
||||||
loadSumbitLog(assingId?:number){
|
loadSumbitLog(params:{assingId:number,page?:number,pageSize?:number}){
|
||||||
return request({url:`/mes/report/loadSumbitLog/${assingId}`,method:'get'})
|
console.log(params)
|
||||||
|
return request({url:`/mes/report/loadSumbitLog`,method:'get',params})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -379,7 +379,13 @@ const columns: DataTableColumns<Device> = [
|
|||||||
title: '新代ID', key: 'synEquipId', width: 90,
|
title: '新代ID', key: 'synEquipId', width: 90,
|
||||||
render: (row) => row.synEquipId ?? '-'
|
render: (row) => row.synEquipId ?? '-'
|
||||||
},
|
},
|
||||||
{title: '设备类型', key: 'deviceType'},
|
{title: '设备类型', key: 'deviceTypeId',
|
||||||
|
render: (row) =>{
|
||||||
|
let val = row.deviceTypeId
|
||||||
|
const opt = deviceTypeList.value.find(o => o.value === val || String(o.value) === String(val))
|
||||||
|
return h(NTag, {type: opt.class, size: 'small'}, {default: () => opt.label})
|
||||||
|
}
|
||||||
|
},
|
||||||
{title: '设备负责人', key: 'deviceManagerName'},
|
{title: '设备负责人', key: 'deviceManagerName'},
|
||||||
{title: '所属工段', key: 'sectionName'},
|
{title: '所属工段', key: 'sectionName'},
|
||||||
{title: '设备型号', key: 'spec'},
|
{title: '设备型号', key: 'spec'},
|
||||||
|
|||||||
@ -217,7 +217,6 @@ const columns: DataTableColumns<Device> = [
|
|||||||
{ type: 'selection' },
|
{ type: 'selection' },
|
||||||
{ title: '工位编码', key: 'deviceCode' },
|
{ title: '工位编码', key: 'deviceCode' },
|
||||||
{ title: '工位名称', key: 'deviceName' },
|
{ title: '工位名称', key: 'deviceName' },
|
||||||
{ title: '工位类型', key: 'deviceType' },
|
|
||||||
{ title: '所属工段', key: 'sectionName' },
|
{ title: '所属工段', key: 'sectionName' },
|
||||||
{ title: '状态', key: 'status',
|
{ title: '状态', key: 'status',
|
||||||
render:(row) =>{
|
render:(row) =>{
|
||||||
|
|||||||
@ -606,7 +606,6 @@ async function doLogin() {
|
|||||||
if (rememberMeEnabled.value) {
|
if (rememberMeEnabled.value) {
|
||||||
loginData.rememberMe = formData.rememberMe
|
loginData.rememberMe = formData.rememberMe
|
||||||
}
|
}
|
||||||
|
|
||||||
await userStore.login(loginData)
|
await userStore.login(loginData)
|
||||||
message.success('登录成功')
|
message.success('登录成功')
|
||||||
const redirect = route.query.redirect as string
|
const redirect = route.query.redirect as string
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
:max-height="1000"
|
:max-height="1000"
|
||||||
size="small"
|
size="small"
|
||||||
style="margin-bottom:15px"
|
style="margin-bottom:15px"
|
||||||
|
@update-expanded-row-keys="handleExpandChange"
|
||||||
/>
|
/>
|
||||||
</n-scrollbar>
|
</n-scrollbar>
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ import {
|
|||||||
|
|
||||||
import { mytasks,type AssingWork } from '@/api/production';
|
import { mytasks,type AssingWork } from '@/api/production';
|
||||||
import {
|
import {
|
||||||
NButton, NSpace, NTag, NDataTable, DataTableColumns, NDescriptions, NDescriptionsItem
|
NButton, NSpace, NTag, NDataTable, DataTableColumns, NDescriptions, NDescriptionsItem, NPagination
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
import { dictDataApi } from '@/api/org'
|
import { dictDataApi } from '@/api/org'
|
||||||
import { assingWorkDetailApi,AssingWorkDetail } from '@/api/AssingWorkDetail'
|
import { assingWorkDetailApi,AssingWorkDetail } from '@/api/AssingWorkDetail'
|
||||||
@ -360,6 +361,7 @@ const AssingWorkDetailColums:DataTableColumns<AssingWorkDetail> = [
|
|||||||
render(row:any) {
|
render(row:any) {
|
||||||
const val = row.status
|
const val = row.status
|
||||||
const opt = qcAssingWorkDetailStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
const opt = qcAssingWorkDetailStatusOptions.value.find(o => o.value === val || String(o.value) === String(val))
|
||||||
|
|
||||||
if (!opt) return val ?? '-'
|
if (!opt) return val ?? '-'
|
||||||
|
|
||||||
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
|
return h(NTag, { type: opt.class, size: 'small' }, { default: () => opt.label })
|
||||||
@ -449,48 +451,112 @@ function AssingWorkToggleExpandAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 缓存:key=派工id,value=明细数组
|
// 缓存:key=派工id,value=明细数组
|
||||||
const expandDataMap = new Map<number, any[]>()
|
interface DetailPageState {
|
||||||
|
list: AssingWorkDetail[]
|
||||||
|
page: number
|
||||||
|
pageSize: number
|
||||||
|
total: number
|
||||||
|
loading: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
// key:父行id
|
||||||
|
const expandDetailMap = new Map<number, DetailPageState>()
|
||||||
|
|
||||||
|
|
||||||
function renderAssingWorkExpand(row: AssingWork) {
|
function renderAssingWorkExpand(row: AssingWork) {
|
||||||
// 1. 首次展开,发起请求
|
const rowId = row.id
|
||||||
if (!expandDataMap.has(row.id)) {
|
|
||||||
expandDataMap.set(row.id, [])
|
|
||||||
loadingRowIds.value.add(row.id)
|
|
||||||
|
|
||||||
// 异步请求,不阻塞当前渲染
|
if (!expandDetailMap.has(rowId)) {
|
||||||
getAssingWorkDetail(row.id).then((detailList) => {
|
expandDetailMap.set(rowId, reactive({
|
||||||
expandDataMap.set(row.id, detailList)
|
list: [],
|
||||||
loadingRowIds.value.delete(row.id)
|
page: 1,
|
||||||
})
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
loading: true
|
||||||
|
}))
|
||||||
|
loadDetail(rowId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 根据缓存状态渲染
|
const state = expandDetailMap.get(rowId)!
|
||||||
if (loadingRowIds.value.has(row.id)) {
|
console.log(state)
|
||||||
return h('div', { style: 'padding:12px' }, '加载中...')
|
console.log(state.list)
|
||||||
}
|
|
||||||
|
// 加载中提示
|
||||||
|
// if (state.loading) {
|
||||||
|
// return h('div', {style: 'padding:12px'}, '加载中...')
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
const tableData = expandDataMap.get(row.id)!
|
|
||||||
return h('div', { style: 'padding: 0 16px 12px' }, [
|
return h('div', { style: 'padding: 0 16px 12px' }, [
|
||||||
h(NDataTable, {
|
h(NDataTable, {
|
||||||
columns: AssingWorkDetailColums,
|
columns: AssingWorkDetailColums,
|
||||||
data: tableData,
|
data: state.list,
|
||||||
rowKey: DetailRowKey,
|
rowKey: DetailRowKey,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
bordered: true,
|
bordered: true,
|
||||||
striped: true,
|
striped: true,
|
||||||
scrollX: 1360
|
scrollX: 1360
|
||||||
|
}),
|
||||||
|
// ✅ 复刻你原来的分页容器 + n‑pagination + prefix插槽
|
||||||
|
h('div', {
|
||||||
|
class: 'pagination-container',
|
||||||
|
style: 'display: flex; justify-content: flex-end; margin-top: 12px'
|
||||||
|
}, [
|
||||||
|
h(NPagination, {
|
||||||
|
page: state.page,
|
||||||
|
pageSize: state.pageSize,
|
||||||
|
itemCount: state.total,
|
||||||
|
onUpdatePage: (p: number) => handleDetailPageChange(rowId, p),
|
||||||
|
onUpdatePageSize: (sz: number) => handleDetailPageSizeChange(rowId, sz)
|
||||||
|
}, {
|
||||||
|
// ✅ #prefix 插槽
|
||||||
|
prefix: () => h('span', `共 ${state.total} 条`)
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
|
])
|
||||||
|
}
|
||||||
|
// 分页切换事件,点击页码/每页大小
|
||||||
|
async function handleDetailPageChange(rowId: number,page:number) {
|
||||||
|
const state = expandDetailMap.get(rowId)
|
||||||
|
if (!state) return
|
||||||
|
state.page = page
|
||||||
|
loadDetail(rowId)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDetailPageSizeChange(rowId: number,pageSize: number) {
|
||||||
|
const state = expandDetailMap.get(rowId)
|
||||||
|
if (!state) return
|
||||||
|
state.pageSize = pageSize
|
||||||
|
state.page = 1
|
||||||
|
loadDetail(rowId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleExpandChange(openKeys: number[]){
|
||||||
|
for (const [rowId] of expandDetailMap) {
|
||||||
|
if (!openKeys.includes(rowId)) {
|
||||||
|
expandDetailMap.delete(rowId)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function getAssingWorkDetail(assingWorkId:number) {
|
|
||||||
const res = await assingWorkDetailApi.selectAssingWorkDetailListByAssingWorkId(assingWorkId)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const loadDetail = async (rowId: number)=>{
|
||||||
|
const state = expandDetailMap.get(rowId)
|
||||||
|
if (!state) return
|
||||||
|
state.loading = true
|
||||||
|
try {
|
||||||
|
const res = await assingWorkDetailApi.selectAssingWorkDetailListByAssingWorkId({
|
||||||
|
assingWorkId: rowId,
|
||||||
|
page: state.page,
|
||||||
|
pageSize: state.pageSize
|
||||||
|
})
|
||||||
|
state.list = res.list
|
||||||
|
state.total = res.total
|
||||||
|
}finally {
|
||||||
|
state.loading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 加载字典选项
|
// 加载字典选项
|
||||||
async function loadDictOptions() {
|
async function loadDictOptions() {
|
||||||
|
|||||||
@ -31,12 +31,27 @@
|
|||||||
remote
|
remote
|
||||||
:scroll-x="600"
|
:scroll-x="600"
|
||||||
/>
|
/>
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="[2,10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ pagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
</n-card>
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui";
|
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui";
|
||||||
import {onMounted, ref,h} from "vue";
|
import {onMounted, ref, h, reactive} from "vue";
|
||||||
import { dictDataApi } from '@/api/org'
|
import { dictDataApi } from '@/api/org'
|
||||||
|
|
||||||
import {QualityTesting,qualityTestingApi} from "@/api/qualityTesting.ts";
|
import {QualityTesting,qualityTestingApi} from "@/api/qualityTesting.ts";
|
||||||
@ -47,6 +62,12 @@ const props =defineProps(
|
|||||||
baseInfo:Object
|
baseInfo:Object
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
//业务来源字典
|
//业务来源字典
|
||||||
const qcSourceTypeOptions = ref<{ label: string; value: any;class:any }[]>([])
|
const qcSourceTypeOptions = ref<{ label: string; value: any;class:any }[]>([])
|
||||||
@ -93,8 +114,24 @@ async function loadDictOptions() {
|
|||||||
|
|
||||||
const qualityTestingList = ref<QualityTesting[]>([])
|
const qualityTestingList = ref<QualityTesting[]>([])
|
||||||
async function loadQualityTestingList() {
|
async function loadQualityTestingList() {
|
||||||
const res = await qualityTestingApi.loadQualityTestingList(props.assingId)
|
const res = await qualityTestingApi.loadQualityTestingList({
|
||||||
qualityTestingList.value = res
|
assingId:props.assingId,
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize
|
||||||
|
})
|
||||||
|
qualityTestingList.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
loadQualityTestingList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
loadQualityTestingList()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
|||||||
@ -32,11 +32,27 @@
|
|||||||
:scroll-x="600"
|
:scroll-x="600"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:item-count="pagination.itemCount"
|
||||||
|
:page-sizes="[2,10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ pagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
</n-card>
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui";
|
import { NCard, NDataTable, NGi,NTag, NGrid,DataTableColumns} from "naive-ui";
|
||||||
import {onMounted, ref,h} from "vue";
|
import {onMounted, ref, h, reactive} from "vue";
|
||||||
import { dictDataApi } from '@/api/org'
|
import { dictDataApi } from '@/api/org'
|
||||||
import { SubmitLog,submitLogApi} from '@/api/submitLog'
|
import { SubmitLog,submitLogApi} from '@/api/submitLog'
|
||||||
|
|
||||||
@ -51,6 +67,12 @@ const props =defineProps(
|
|||||||
const submitStatusOptions = ref<{ label: string; value: any ;class:any}[]>([])
|
const submitStatusOptions = ref<{ label: string; value: any ;class:any}[]>([])
|
||||||
|
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0
|
||||||
|
})
|
||||||
|
|
||||||
//汇报信息表格
|
//汇报信息表格
|
||||||
const reportRecordsColums:DataTableColumns<SubmitLog> = [
|
const reportRecordsColums:DataTableColumns<SubmitLog> = [
|
||||||
|
|
||||||
@ -79,8 +101,24 @@ async function loadDictOptions() {
|
|||||||
//加载汇报信息
|
//加载汇报信息
|
||||||
const submitLogList = ref<SubmitLog[]>([])
|
const submitLogList = ref<SubmitLog[]>([])
|
||||||
async function load() {
|
async function load() {
|
||||||
const res = await submitLogApi.loadSumbitLog(props.assingId)
|
const res = await submitLogApi.loadSumbitLog({
|
||||||
submitLogList.value = res
|
assingId:props.assingId,
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize
|
||||||
|
})
|
||||||
|
submitLogList.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
load()
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
|||||||
@ -16,11 +16,11 @@ export default defineConfig({
|
|||||||
emptyOutDir: true
|
emptyOutDir: true
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
// host:'192.168.12.11', //true,
|
host:'192.168.12.4', //true,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target:'http://192.168.12.12:8888/', //'http://192.168.5.230:8888',
|
target:'http://192.168.12.4:8888/', //'http://192.168.5.230:8888',
|
||||||
//target:'http://192.168.12.4:8888/',
|
//target:'http://192.168.12.4:8888/',
|
||||||
//target:'http://192.168.12.230:8888',
|
//target:'http://192.168.12.230:8888',
|
||||||
//target:'http://192.168.5.230:8888',
|
//target:'http://192.168.5.230:8888',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user