Compare commits

...

5 Commits

Author SHA1 Message Date
andy
2caa3e0fa0 提交 2026-05-30 17:04:57 +08:00
andy
0ac481b11a 修改 2026-05-29 11:54:51 +08:00
andy
7d61f2213d Merge branch 'master' of https://git.evo-techina.com/sgc/mes-vue 2026-05-27 09:30:05 +08:00
andy
683de566ba 提交 2026-05-27 09:29:57 +08:00
andy
054cdc265f 提交 2026-05-27 09:06:32 +08:00
16 changed files with 1606 additions and 578 deletions

View File

@ -20,6 +20,7 @@
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"vue": "^3.4.15",
"vue-draggable-plus": "^0.6.1",
"vue-router": "^4.2.5"
},
"devDependencies": {

View File

@ -31,7 +31,7 @@ importers:
version: 3.5.4
naive-ui:
specifier: ^2.37.3
version: 2.44.1(vue@3.5.31(typescript@5.9.3))
version: 2.37.3(vue@3.5.31(typescript@5.9.3))
pinia:
specifier: ^2.1.7
version: 2.3.1(typescript@5.9.3)(vue@3.5.31(typescript@5.9.3))
@ -41,6 +41,9 @@ importers:
vue:
specifier: ^3.4.15
version: 3.5.31(typescript@5.9.3)
vue-draggable-plus:
specifier: ^0.6.1
version: 0.6.1(@types/sortablejs@1.15.9)
vue-router:
specifier: ^4.2.5
version: 4.6.4(vue@3.5.31(typescript@5.9.3))
@ -79,6 +82,10 @@ packages:
engines: {node: '>=6.0.0'}
hasBin: true
'@babel/runtime@7.29.7':
resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==}
engines: {node: '>=6.9.0'}
'@babel/types@7.29.0':
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
engines: {node: '>=6.9.0'}
@ -269,36 +276,42 @@ packages:
engines: {node: '>= 10.0.0'}
cpu: [arm]
os: [linux]
libc: [glibc]
'@parcel/watcher-linux-arm-musl@2.5.6':
resolution: {integrity: sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==}
engines: {node: '>= 10.0.0'}
cpu: [arm]
os: [linux]
libc: [musl]
'@parcel/watcher-linux-arm64-glibc@2.5.6':
resolution: {integrity: sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==}
engines: {node: '>= 10.0.0'}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@parcel/watcher-linux-arm64-musl@2.5.6':
resolution: {integrity: sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==}
engines: {node: '>= 10.0.0'}
cpu: [arm64]
os: [linux]
libc: [musl]
'@parcel/watcher-linux-x64-glibc@2.5.6':
resolution: {integrity: sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==}
engines: {node: '>= 10.0.0'}
cpu: [x64]
os: [linux]
libc: [glibc]
'@parcel/watcher-linux-x64-musl@2.5.6':
resolution: {integrity: sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==}
engines: {node: '>= 10.0.0'}
cpu: [x64]
os: [linux]
libc: [musl]
'@parcel/watcher-win32-arm64@2.5.6':
resolution: {integrity: sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q==}
@ -356,66 +369,79 @@ packages:
resolution: {integrity: sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==}
cpu: [arm]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.60.1':
resolution: {integrity: sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==}
cpu: [arm]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.60.1':
resolution: {integrity: sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.60.1':
resolution: {integrity: sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-loong64-gnu@4.60.1':
resolution: {integrity: sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==}
cpu: [loong64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-loong64-musl@4.60.1':
resolution: {integrity: sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==}
cpu: [loong64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-ppc64-gnu@4.60.1':
resolution: {integrity: sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-ppc64-musl@4.60.1':
resolution: {integrity: sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==}
cpu: [ppc64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-riscv64-gnu@4.60.1':
resolution: {integrity: sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-musl@4.60.1':
resolution: {integrity: sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==}
cpu: [riscv64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-s390x-gnu@4.60.1':
resolution: {integrity: sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.60.1':
resolution: {integrity: sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.60.1':
resolution: {integrity: sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==}
cpu: [x64]
os: [linux]
libc: [musl]
'@rollup/rollup-openbsd-x64@4.60.1':
resolution: {integrity: sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==}
@ -450,6 +476,9 @@ packages:
'@types/estree@1.0.8':
resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
'@types/katex@0.16.8':
resolution: {integrity: sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg==}
'@types/lodash-es@4.17.12':
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
@ -459,6 +488,9 @@ packages:
'@types/node@20.19.37':
resolution: {integrity: sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw==}
'@types/sortablejs@1.15.9':
resolution: {integrity: sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==}
'@vicons/ionicons5@0.12.0':
resolution: {integrity: sha512-Iy1EUVRpX0WWxeu1VIReR1zsZLMc4fqpt223czR+Rpnrwu7pt46nbnC2ycO7ItI/uqDLJxnbcMC7FujKs9IfFA==}
@ -563,13 +595,14 @@ packages:
csstype@3.2.3:
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
date-fns-tz@3.2.0:
resolution: {integrity: sha512-sg8HqoTEulcbbbVXeg84u5UnlsQa8GS5QXMqjjYIhS4abEVVKIUwe0/l/UhrZdKaL/W5eWZNlbTeEIiOXTcsBQ==}
date-fns-tz@2.0.1:
resolution: {integrity: sha512-fJCG3Pwx8HUoLhkepdsP7Z5RsucUi+ZBOxyM5d0ZZ6c4SdYustq0VMmOu6Wf7bli+yS/Jwp91TOCqn9jMcVrUA==}
peerDependencies:
date-fns: ^3.0.0 || ^4.0.0
date-fns: 2.x
date-fns@4.1.0:
resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
date-fns@2.30.0:
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
engines: {node: '>=0.11'}
de-indent@1.0.2:
resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==}
@ -718,9 +751,8 @@ packages:
muggle-string@0.3.1:
resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==}
naive-ui@2.44.1:
resolution: {integrity: sha512-reo8Esw0p58liZwbUutC7meW24Xbn3EwNv91zReWKm2W4JPu+zfgJRn/F7aO0BFmvN+h2brA2M5lRvYqLq4kuA==}
engines: {node: '>=20'}
naive-ui@2.37.3:
resolution: {integrity: sha512-aUkHFXVIluSi8Me+npbcsdv1NYhVMj5t9YaruoCESlqmfqspj+R2QHEVXkTtUI1kQwVrABMCtAGq/wountqjZA==}
peerDependencies:
vue: ^3.0.0
@ -856,6 +888,15 @@ packages:
'@vue/composition-api':
optional: true
vue-draggable-plus@0.6.1:
resolution: {integrity: sha512-FbtQ/fuoixiOfTZzG3yoPl4JAo9HJXRHmBQZFB9x2NYCh6pq0TomHf7g5MUmpaDYv+LU2n6BPq2YN9sBO+FbIg==}
peerDependencies:
'@types/sortablejs': ^1.15.0
'@vue/composition-api': '*'
peerDependenciesMeta:
'@vue/composition-api':
optional: true
vue-router@4.6.4:
resolution: {integrity: sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg==}
peerDependencies:
@ -896,6 +937,8 @@ snapshots:
dependencies:
'@babel/types': 7.29.0
'@babel/runtime@7.29.7': {}
'@babel/types@7.29.0':
dependencies:
'@babel/helper-string-parser': 7.27.1
@ -1122,6 +1165,8 @@ snapshots:
'@types/estree@1.0.8': {}
'@types/katex@0.16.8': {}
'@types/lodash-es@4.17.12':
dependencies:
'@types/lodash': 4.17.24
@ -1132,6 +1177,8 @@ snapshots:
dependencies:
undici-types: 6.21.0
'@types/sortablejs@1.15.9': {}
'@vicons/ionicons5@0.12.0': {}
'@vitejs/plugin-vue@5.2.4(vite@5.4.21(@types/node@20.19.37)(sass@1.98.0))(vue@3.5.31(typescript@5.9.3))':
@ -1268,11 +1315,13 @@ snapshots:
csstype@3.2.3: {}
date-fns-tz@3.2.0(date-fns@4.1.0):
date-fns-tz@2.0.1(date-fns@2.30.0):
dependencies:
date-fns: 4.1.0
date-fns: 2.30.0
date-fns@4.1.0: {}
date-fns@2.30.0:
dependencies:
'@babel/runtime': 7.29.7
de-indent@1.0.2: {}
@ -1424,17 +1473,18 @@ snapshots:
muggle-string@0.3.1: {}
naive-ui@2.44.1(vue@3.5.31(typescript@5.9.3)):
naive-ui@2.37.3(vue@3.5.31(typescript@5.9.3)):
dependencies:
'@css-render/plugin-bem': 0.15.14(css-render@0.15.14)
'@css-render/vue3-ssr': 0.15.14(vue@3.5.31(typescript@5.9.3))
'@types/katex': 0.16.8
'@types/lodash': 4.17.24
'@types/lodash-es': 4.17.12
async-validator: 4.2.5
css-render: 0.15.14
csstype: 3.2.3
date-fns: 4.1.0
date-fns-tz: 3.2.0(date-fns@4.1.0)
date-fns: 2.30.0
date-fns-tz: 2.0.1(date-fns@2.30.0)
evtd: 0.2.4
highlight.js: 11.11.1
lodash: 4.17.23
@ -1559,6 +1609,10 @@ snapshots:
dependencies:
vue: 3.5.31(typescript@5.9.3)
vue-draggable-plus@0.6.1(@types/sortablejs@1.15.9):
dependencies:
'@types/sortablejs': 1.15.9
vue-router@4.6.4(vue@3.5.31(typescript@5.9.3)):
dependencies:
'@vue/devtools-api': 6.6.4

View File

@ -50,30 +50,37 @@ export interface OrderItem {
// 生产订单 API
export const orderItemApi = {
// 分页查询
page(params: { page: number; pageSize: number; code?: string; projectId?: number; beginTime?: string; endTime?: string }) {
page(params: any) { //{ page: number; pageSize: number; code?: string; projectId?: number; beginTime?: string; endTime?: string }
return request({ url: '/biz/orderItem/page', method: 'get', params })
},
// 获取详情
detail(id: string) {
detail(id: any) {
return request({ url: `/biz/orderItem/${id}`, method: 'get' })
},
// 新增
create(data: OrderItem) {
create(data: any) { //OrderItem
return request({ url: '/biz/orderItem', method: 'post', data })
},
// 修改
update(data: OrderItem) {
update(data: any) {
return request({ url: '/biz/orderItem', method: 'put', data })
},
// 删除
delete(ids: string[]) {
delete(ids: any) {
return request({ url: `/biz/orderItem/${ids.join(',')}`, method: 'delete' })
},
//派工
assignWork(data: any) {
return request({ url: '/biz/orderItem/assignWork', method: 'post', data })
},
//根据生产编号查询预生产订单
preCreation(data: any) {
return request({ url: '/biz/orderItem/preCreation', method: 'post', data })
},
// 导出
export(params?: { ids?: string[]; code?: string; projectId?: number; beginTime?: string; endTime?: string }) {
const p: Record<string, any> = {}

View File

@ -39,7 +39,7 @@ export interface OrderProcessPlan {
// 工序计划 API
export const orderProcessPlanApi = {
// 分页查询
page(params: { page: number; pageSize: number; id?: number; name?: string; code?: string; orderItemId?: number }) {
page(params:any) { //{ page: number; pageSize: number; id?: number; name?: string; code?: string; orderItemId?: number }
return request({ url: '/biz/orderProcessPlan/page', method: 'get', params })
},
@ -49,12 +49,12 @@ export const orderProcessPlanApi = {
},
// 新增
create(data: OrderProcessPlan) {
create(data: any) {
return request({ url: '/biz/orderProcessPlan', method: 'post', data })
},
// 修改
update(data: OrderProcessPlan) {
update(data: any) {
return request({ url: '/biz/orderProcessPlan', method: 'put', data })
},
@ -63,6 +63,11 @@ export const orderProcessPlanApi = {
return request({ url: `/biz/orderProcessPlan/${ids.join(',')}`, method: 'delete' })
},
//派工
assignWork(data: any) {
return request({ url: '/biz/orderProcessPlan/assignWork', method: 'put', data })
},
// 导出
export(params?: { ids?: string[]; id?: number; name?: string; code?: string; orderItemId?: number }) {
const p: Record<string, any> = {}

View File

@ -47,10 +47,19 @@ export function mytasks(params:any) {
}
//派工数据统计
export function workload(params:any) {
export function workload(params?:any) {
return request({
url: `/mes/dispatch/workload`,
method: 'get',
params
})
}
//报检
export function inspectio(data:any) {
return request({
url: `/mes/dispatch/qc`,
method: 'put',
data
})
}

View File

@ -861,7 +861,9 @@ function handleUserAction(key: string) {
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
userStore.logout()
userStore.logout().then(() => {
userStore.setinit(true)
})
message.success('已退出登录')
}
})

View File

@ -1,6 +1,6 @@
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import { useUserStore } from '@/stores/user'
import type { MenuInfo } from '@/api/auth'
//import type { MenuInfo } from '@/api/auth'
// 动态导入所有页面组件
const modules = import.meta.glob('/src/views/**/*.vue')
@ -118,16 +118,10 @@ const routes: RouteRecordRaw[] = [
},
//运营管理
{
path: 'biz/orderItem',
name: 'orderItem',
component: () => import('@/views/biz/orderItem/index.vue'),
meta: { title: '生产订单', icon: 'ListOutline' }
},
{
path: 'biz/orderProcessPlan',
name: 'orderProcessPlan',
component: () => import('@/views/biz/orderProcessPlan/index.vue'),
meta: { title: '工序计划', icon: 'ListOutline' }
path: 'biz/product',
name: 'product',
component: () => import('@/views/biz/product/index.vue'),
meta: { title: '商品管理', icon: 'ListOutline' }
},
{
path: 'biz/user',
@ -209,14 +203,8 @@ const routes: RouteRecordRaw[] = [
component: () => import('@/views/test/test/index.vue'),
meta: { title: '测试菜单', icon: 'StarOutline' }
},
// 开发工具
{
path: 'biz/submitLog',
name: 'submitLog',
component: () => import('@/views/biz/submitLog/index.vue'),
meta: { title: '派工工单汇报记录', icon: 'ListOutline' }
},
{
// 开发工具
path: 'tool/gen',
name: 'ToolGen',
component: () => import('@/views/tool/gen/index.vue'),
@ -231,9 +219,14 @@ const routes: RouteRecordRaw[] = [
}
]
},
// {
// path: '/:pathMatch(.*)',
// name: 'NotFound',
// component: () => import('@/views/error/404.vue'),
// meta: { title: '404', requiresAuth: false }
// }
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
path: '/:pathMatch(.*)',
component: () => import('@/views/error/404.vue'),
meta: { title: '404', requiresAuth: false }
}
@ -249,11 +242,10 @@ const addedRouteNames = new Set<string>()
/**
*
*/
export function addDynamicRoutes(menus: MenuInfo[]) {
console.log('[动态路由] 开始处理菜单:', menus)
const addRoutes = (menuList: MenuInfo[]) => {
*/
export function addDynamicRoutes(menus: any) { //MenuInfo[]
//console.log('[动态路由] 开始处理菜单:', menus)
const addRoutes = (menuList: any) => { //MenuInfo[]
for (const menu of menuList) {
// 只处理菜单类型(type=2),且有 path
if (menu.type === 2 && menu.path) {
@ -265,12 +257,12 @@ export function addDynamicRoutes(menus: MenuInfo[]) {
const pathExists = existingRoutes.some(r => r.path === '/' + menuPath || r.path === menuPath)
if (pathExists) {
console.log(`[动态路由] 跳过(已存在): ${menuPath}`)
// console.log(`[动态路由] 跳过(已存在): ${menuPath}`)
continue
}
if (addedRouteNames.has(routeName)) {
console.log(`[动态路由] 跳过(已添加): ${menuPath}`)
//console.log(`[动态路由] 跳过(已添加): ${menuPath}`)
continue
}
@ -296,7 +288,7 @@ export function addDynamicRoutes(menus: MenuInfo[]) {
const componentPath = `/src/views/${componentName}.vue`
const component = modules[componentPath]
console.log(`[动态路由] 处理: path=${menuPath}, component=${componentPath}, 组件存在=${!!component}`)
//console.log(`[动态路由] 处理: path=${menuPath}, component=${componentPath}, 组件存在=${!!component}`)
if (component) {
router.addRoute('Layout', {
@ -310,9 +302,9 @@ export function addDynamicRoutes(menus: MenuInfo[]) {
}
})
addedRouteNames.add(routeName)
console.log(`[动态路由] ✓ 添加成功: ${menuPath}`)
//console.log(`[动态路由] ✓ 添加成功: ${menuPath}`)
} else {
console.warn(`[动态路由] ✗ 组件不存在: ${componentPath}`)
//console.warn(`[动态路由] ✗ 组件不存在: ${componentPath}`)
}
}
}
@ -325,7 +317,7 @@ export function addDynamicRoutes(menus: MenuInfo[]) {
}
addRoutes(menus)
console.log('[动态路由] 当前所有路由:', router.getRoutes().map(r => r.path))
//console.log('[动态路由] 当前所有路由:', router.getRoutes().map(r => r.path))
}
/**
@ -340,42 +332,59 @@ export function resetRouter() {
addedRouteNames.clear()
}
// 路由守卫
router.beforeEach(async (to, _from, next) => {
console.log('路由测试');
const userStore = useUserStore()
//document.title = `${to.meta.title || ''} - CSY Admin`
console.log('开始动态路由11', to.meta, _from);
if (to.meta.requiresAuth === false) {
if (!userStore.token) {
//next({ name: 'Login', query: { redirect: to.fullPath } })
next()
return
}
console.log('开始动态路由2222', to.meta, _from);
if (!userStore.token) {
next({ name: 'Login', query: { redirect: to.fullPath } })
return
}
if (!userStore.user) {
try {
console.log('开始动态路由4444', userStore.user, to.meta, _from);
if (userStore.init) {
try {
await userStore.getInfo()
// 添加动态路由(只添加新的,不影响已有的)
addDynamicRoutes(userStore.menus)
//userStore.setinit(false)
userStore.init = false
next({ ...to, replace: true })
return
//return
} catch (error) {
userStore.logout()
userStore.init = false
//userStore.setinit(true)
next({ name: 'Login' })
return
//return
}
}else{
next()
}
next()
// if (!userStore.user) {
// try {
// await userStore.getInfo()
// // 添加动态路由(只添加新的,不影响已有的)
// addDynamicRoutes(userStore.menus)
// next({ ...to, replace: true })
// return
// } catch (error) {
// userStore.logout()
// next({ name: 'Login' })
// return
// }
// }
// if (to.meta.requiresAuth === false) {
// next()
// return
// }
})
export default router

View File

@ -11,11 +11,17 @@ export const useUserStore = defineStore('user', () => {
const permissions = ref<string[]>([])
const menus = ref<MenuInfo[]>([])
const init = ref<any>(true)
// 计算属性
const isLogin = computed(() => !!token.value)
const nickname = computed(() => user.value?.nickname || user.value?.username || '')
const avatar = computed(() => user.value?.avatar || '')
function setinit(v:any) {
init.value = v
}
// 登录
async function login(params: LoginParams) {
const res = await authApi.login(params)
@ -46,6 +52,8 @@ export const useUserStore = defineStore('user', () => {
permissions.value = []
menus.value = []
init.value = true
// 重置路由
resetRouter()
@ -83,6 +91,8 @@ export const useUserStore = defineStore('user', () => {
isLogin,
nickname,
avatar,
init,
setinit,
login,
getInfo,
logout,

15
src/utils/tool.ts Normal file
View File

@ -0,0 +1,15 @@
export function getaDtetime(timestamp:any) {
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hour = String(date.getHours()).padStart(2, '0')
const minute = String(date.getMinutes()).padStart(2, '0')
const second = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hour}:${minute}:${second}`
}

View File

@ -0,0 +1,63 @@
<template>
<tr
:key="obj.name"
class="cursor-move"
:style="{
height: '40px',
background:isEven(index)?'#fff':'#f3f3f3'
}"
>
<td>{{ obj.code }}{{ obj.sort}}</td>
<td>{{ obj.name }}</td>
<td>{{ obj.orderItemName }}</td>
<td>
<n-date-picker
v-model:value="beginTime"
type="datetime"
placeholder="请选择开始时间"
@update:value="updatehand"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%;"
/>
</td>
<td>
<n-date-picker
v-model:value="endTime"
type="datetime"
placeholder="请选择结束时间"
@update:value="updatehand"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%;"
/>
</td>
</tr>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { getaDtetime } from '@/utils/tool'
const props = withDefaults(defineProps<{
obj:any,
index:any
}>(), {
obj:{}
})
const emit = defineEmits<{
update: [index:any,obj:any]
}>()
let beginTime = ref<any>(null)
let endTime = ref<any>(null)
function isEven(num:any) {
return num % 2 == 0
}
function updatehand() {
emit('update',props.index,Object.assign(props.obj,{
beginTime:beginTime.value?getaDtetime(beginTime.value):null,
endTime:endTime.value?getaDtetime(endTime.value):null
}))
}
</script>

View File

@ -7,8 +7,8 @@
<n-form-item label="物料编码">
<n-input v-model:value="searchForm.code" placeholder="请输入物料编码" clearable />
</n-form-item>
<n-form-item label="产品id">
<n-input v-model:value="searchForm.projectId" placeholder="请输入产品id" clearable />
<n-form-item label="项目名称">
<n-input v-model:value="searchForm.projectName" placeholder="请输入产品名称" clearable />
</n-form-item>
<n-form-item label="开始时间">
<n-date-picker v-model:value="searchForm.beginTime" type="datetime" clearable />
@ -34,7 +34,11 @@
<!-- 工具栏 -->
<div class="table-toolbar">
<n-space>
<n-button type="primary" @click="handleAdd">
<n-button
size="small"
type="primary"
@click="handleAdd"
>
<template #icon><n-icon><AddOutline /></n-icon></template>
新增/补单
</n-button>
@ -54,56 +58,189 @@
</div>
<!-- 表格 -->
<n-data-table
:columns="columns"
:data="tableData"
:loading="loading"
:pagination="pagination"
<!--
:row-key="(row) => row.id"
:scroll-x="1200"
@update:page="handlePageChange"
@update:page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck"
:pagination="pagination"
-->
<n-data-table
size="small"
remote
striped
:border="false"
:single-line="false"
:columns="columns"
:data="tableData"
:loading="loading"
/>
<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="[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-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
<n-form-item label="生产令号" path="productionCode">
<n-input v-model:value="formData.productionCode" placeholder="请输入生产令号" />
</n-form-item>
<n-form-item label="物料名称" path="name">
<n-input v-model:value="formData.name" placeholder="请输入物料名称" readonly />
</n-form-item>
<n-form-item label="物料编码" path="code">
<n-input v-model:value="formData.code" placeholder="请输入物料编码" readonly />
</n-form-item>
<n-form-item label="产品序列" path="sort">
<n-input v-model:value="formData.sort" placeholder="请输入产品序列" readonly />
</n-form-item>
<n-form-item label="生产数量" path="quantity">
<n-input v-model:value="formData.quantity" placeholder="请输入生产数量" readonly />
</n-form-item>
<n-form-item label="产品名称" path="projectName">
<n-input v-model:value="formData.projectName" placeholder="请输入产品名称" readonly />
</n-form-item>
<n-form-item label="是否半成品" path="sfProduct">
<n-input v-model:value="formData.sfProduct" placeholder="请输入是否半成品, 1是 0不是" />
</n-form-item>
<n-form-item label="是否采购" path="procurement">
<n-input v-model:value="formData.procurement" placeholder="请输入是否采购, 1是 0不是" />
</n-form-item>
<n-form-item label="预计开始时间" path="beginTime">
<n-date-picker v-model:value="formData.beginTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
<n-form-item label="预计结束时间" path="endTime">
<n-date-picker v-model:value="formData.endTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
<n-form-item label="派工接收人" path="assingWorkId">
<n-input v-model:value="formData.assingWorkId" placeholder="请输入派工接收人" />
</n-form-item>
<n-modal
v-model:show="modalVisible"
preset="card"
:title="modalTitle"
style="width: 900px"
:mask-closable="false"
>
<n-form
ref="formRef"
:model="formData"
:rules="formRules"
label-placement="left"
label-width="120px"
>
<n-grid :cols="2">
<!-- <n-gi>
<n-form-item label="生产令号" path="productionCode">
<n-input v-if="formData.id" v-model:value="formData.productionCode" placeholder="请输入生产令号" />
<n-input v-else v-model:value="formData.productionCode" @input="gongxu" placeholder="请输入生产令号" />
</n-form-item>
</n-gi> -->
<n-gi>
<n-form-item label="项目名称" path="projectName">
<n-input v-if="formData.id" v-model:value="formData.projectName" disabled placeholder="请选择项目名称" />
<n-input v-else v-model:value="formData.projectName" placeholder="请选择产品名称" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="物料编码" path="code">
<n-input v-if="formData.id" v-model:value="formData.code" disabled placeholder="请选择物料编码" />
<n-input v-else v-model:value="formData.code" placeholder="请选择物料编码" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="物料名称" path="name">
<n-input v-model:value="formData.name" placeholder="请输入物料名称" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="产品序列" path="sort">
<n-input v-if="formData.id" v-model:value="formData.sort" placeholder="请输入产品序列" />
<n-input v-else v-model:value="formData.sort" placeholder="请输入产品序列" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="生产数量" path="quantity">
<n-input v-if="formData.id" v-model:value="formData.quantity" disabled placeholder="请输入生产数量" />
<n-input v-else v-model:value="formData.quantity" placeholder="请输入生产数量" disabled />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否半成品" path="sfProduct">
<n-radio-group v-model:value="formData.sfProduct" name="radiogroup">
<n-space>
<n-radio :value="1"></n-radio>
<n-radio :value="0"></n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否采购" path="procurement">
<!-- <n-input v-model:value="formData.procurement" placeholder="请输入是否采购, 1是 0不是" /> -->
<n-radio-group v-model:value="formData.procurement" name="radiogroup">
<n-space>
<n-radio :value="1"></n-radio>
<n-radio :value="0"></n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="预计开始时间" path="beginTime">
<n-date-picker v-model:value="formData.beginTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="预计结束时间" path="endTime">
<n-date-picker v-model:value="formData.endTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="派工接收人" path="assingWorkId">
<n-input v-model:value="formData.assingWorkId" placeholder="请输入派工接收人" />
</n-form-item>
</n-gi>
</n-grid>
</n-form>
<template v-if="planList.length > 0">
<n-divider title-placement="left" size="small">可拖动工序排序</n-divider>
<VueDraggable
v-model="planList"
target=".sort-target"
:animation="150"
@end="tuozChange"
>
<table style="width: 100%;text-align: center;">
<thead>
<tr style="height: 30px;background: #e5e7eb;">
<th>订单名称</th>
<th>工序编码</th>
<th>工序名称</th>
<th>开始时间</th>
<th>结束时间</th>
</tr>
</thead>
<tbody class="sort-target">
<!-- <gxitem
v-for="(n,i) in planList"
:obj="n"
:index="i"
@update="gxupdata"
/> -->
<tr
v-for="(n,i) in planList"
:key="i"
class="cursor-move"
:style="{
height: '40px',
background:isEven(i)?'#fff':'#f3f3f3'
}"
>
<td>{{ n.code }}{{n.sort}}</td>
<td>{{ n.name }}</td>
<td>{{ n.orderItemName }}</td>
<td>
<n-date-picker
v-model:value="n.beginTime"
type="datetime"
style="width: 100%;"
/>
</td>
<td>
<n-date-picker
v-model:value="n.endTime"
type="datetime"
style="width: 100%;"
/>
</td>
</tr>
</tbody>
</table>
</VueDraggable>
</template>
<template #footer>
<n-space justify="end">
<n-button @click="modalVisible = false">取消</n-button>
@ -112,8 +249,63 @@
</template>
</n-modal>
<!--派工弹框-->
<n-modal
v-model:show="dispatchmodal"
title="派工"
preset="card"
style="width: 400px"
:mask-closable="false"
>
<n-form
ref="dispatchformRef"
:model="dispatchform"
:rules="dispatchrules"
label-placement="top"
label-width="80"
>
<n-form-item label="工单名称">
<n-input v-model:value="dispatchform.name" disabled />
</n-form-item>
<n-form-item label="指派员工" path="userid">
<!-- <n-select
v-model:value="dispatchform.userid"
:options="yglist"
clearable
placeholder="请选择员工"
/> -->
<n-select
v-model:value="dispatchform.userid"
filterable
placeholder="请输入用户名称搜索"
:options="yglist"
:loading="loadingRef"
clearable
remote
:clear-filter-after-select="false"
@search="slehand"
/>
<!-- <n-input v-model:value="dispatchform.userid" placeholder="请选择员工" /> -->
</n-form-item>
</n-form>
<template #footer>
<n-space justify="end">
<n-button size="small" @click="dispatchmodal = false">取消</n-button>
<n-button
size="small"
type="primary"
:loading="dispatchLoading"
@click="dispatchSubmit"
:disabled="dispatchddbtn"
>确定</n-button>
</n-space>
</template>
</n-modal>
<!-- 导入弹窗 -->
<n-modal v-model:show="importModalVisible" preset="card" title="导入生产订单" style="width: 500px">
<!-- <n-modal v-model:show="importModalVisible" preset="card" title="导入生产订单" style="width: 500px">
<n-space vertical>
<n-alert type="info">
<template #header>导入说明</template>
@ -141,31 +333,77 @@
<template #footer>
<n-button @click="importModalVisible = false">关闭</n-button>
</template>
</n-modal>
</n-modal> -->
</div>
</template>
<script setup lang="ts">
import { ref, reactive, h, onMounted } from 'vue'
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
import { orderItemApi, type OrderItem } from '@/api/orderItem'
import {
ref,
reactive,
h,
onMounted
} from 'vue'
import {
NButton,
NSpace,
NIcon,
//NUpload,
useMessage,
useDialog,
//type DataTableColumns,
type UploadCustomRequestOptions
} from 'naive-ui'
import {
SearchOutline,
RefreshOutline,
AddOutline,
//TrashOutline,
//CreateOutline,
// CloudUploadOutline,
// DownloadOutline
} from '@vicons/ionicons5'
import {
orderItemApi,
type OrderItem
} from '@/api/orderItem'
import { useUserStore } from '@/stores/user'
import { VueDraggable } from 'vue-draggable-plus'
// import Gxitem from './gxitem.vue'
import { userApi } from '@/api/system'
const message = useMessage()
const dialog = useDialog()
const userStore = useUserStore()
function isEven(num:any) {
return num % 2 == 0
}
//
const hasPermission = (permission: string) => userStore.hasPermission(permission)
//
const searchForm = reactive({
const searchForm = reactive<any>({
code: '',
projectId: null as number | null,
projectName: '',
beginTime: null as number | null,
endTime: null as number | null,
})
//
const tableData = ref<OrderItem[]>([])
const tableData = ref<any>([])
const loading = ref(false)
const selectedIds = ref<number[]>([])
const selectedIds = ref<any>([])
const pagination = reactive({
page: 1,
pageSize: 10,
@ -174,34 +412,36 @@ const pagination = reactive({
pageSizes: [10, 20, 50]
})
//
const modalVisible = ref(false)
const modalTitle = ref('')
const importModalVisible = ref(false)
const formRef = ref()
const defaultFormData: OrderItem = {
id: undefined,
const defaultFormData = {
id: '',
productionCode:'',
name: '',
code: '',
sort: undefined,
quantity: undefined,
projectId: undefined,
sort: '',
quantity: '',
projectId: '',
projectName:'',
parentId: undefined,
sfProduct: undefined,
procurement: undefined,
beginTime: undefined,
endTime: undefined,
actualStartTime: undefined,
actualEndTime: undefined,
parentId: '',
sfProduct: '',
procurement: '',
beginTime: null,
endTime: null,
actualStartTime: null,
actualEndTime: null,
assingWorkId: '',
assingWorkTime: undefined,
assingWorkTime: null,
assingWorkOperationId: '',
assingWorkOperationTime: undefined,
starter: undefined,
assingWorkOperationTime: null,
starter: '',
}
const formData = reactive<OrderItem>({ ...defaultFormData })
const formData = reactive<any>({ ...defaultFormData })
// //使
@ -210,41 +450,155 @@ const formRules = {
}
//
const columns: DataTableColumns<OrderItem> = [
{ type: 'selection' },
{ title: '产品名称', key: 'projectName' },
{ title: '物料名称', key: 'name' },
{ title: '物料编码', key: 'code' },
{ title: '产品序列', key: 'sort' },
{ title: '生产数量', key: 'quantity' },
{ title: '是否半成品', key: 'sfProduct' },
{ title: '是否采购', key: 'procurement' },
{ title: '开始时间', key: 'beginTime' },
{ title: '结束时间', key: 'endTime' },
{ title: '实际开始时间', key: 'actualStartTime' },
{ title: '实际结束时间', key: 'actualEndTime' },
{ title: '派工操作人', key: 'assingWorkOperationName' },
{ title: '派工操作时间', key: 'assingWorkOperationTime' },
{ title: '派工接收人', key: 'assingWorkName' },
{ title: '派工时间', key: 'assingWorkTime' },
{ title: '是否开工', key: 'starter' },
{ title: '备注', key: 'remark' },
const columns = [
// {
// type: 'selection'
// },
{
align:'center',
minWidth: 150,
title: '产品名称',
key: 'projectName'
},
{
align:'center',
minWidth: 150,
title: '物料名称',
key: 'name'
},
{
align:'center',
minWidth: 150,
title: '物料编码',
key: 'code'
},
{
align:'center',
minWidth: 150,
title: '产品序列',
key: 'sort'
},
{
align:'center',
minWidth: 150,
title: '生产数量',
key: 'quantity'
},
{
align:'center',
minWidth: 150,
title: '是否半成品',
key: 'sfProduct'
},
{
align:'center',
minWidth: 150,
title: '是否采购',
key: 'procurement'
},
{
align:'center',
minWidth: 150,
title: '开始时间',
key: 'beginTime'
},
{
align:'center',
minWidth: 150,
title: '结束时间',
key: 'endTime'
},
{
align:'center',
minWidth: 150,
title: '实际开始时间',
key: 'actualStartTime'
},
{
align:'center',
minWidth: 150,
title: '实际结束时间',
key: 'actualEndTime'
},
{
align:'center',
minWidth: 150,
title: '派工操作人',
key: 'assingWorkOperationName'
},
// {
// align:'center',
// minWidth: 150,
// title: '',
// key: 'assingWorkOperationTime'
// },
{
align:'center',
minWidth: 150,
title: '派工接收人',
key: 'assingWorkName'
},
{
align:'center',
minWidth: 150,
title: '派工时间',
key: 'assingWorkTime'
},
{
align:'center',
minWidth: 150,
title: '是否开工',
key: 'starter'
},
{
align:'center',
minWidth: 150,
title: '备注',
key: 'remark'
},
// { title: '', key: 'createTime', width: 100 },
// { title: '', key: 'createBy' },
{
align:'center',
title: '操作',
key: 'actions',
width: 140,
fixed: 'right',
render(row) {
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
}),
h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' 派工']
})
])
render(row:any) {
const buttons:any = []
if(hasPermission('biz:orderItem:edit')){
buttons.push(h(NButton, {
size: 'small',
type:'primary',
ghost:true,
onClick: () => { handleEdit(row) } },
//{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ' ]}
{ default: () => '编辑'}
))
}
if(hasPermission('biz:orderItem:assign')){
buttons.push(h(NButton, {
size: 'small',
type:'success',
ghost:true,
onClick: () => { disphand(row) } },
{ default: () => '派工'}
))
}
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
// return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
// h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
// default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ']
// }),
// h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
// default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' ']
// })
// ])
}
}
]
@ -256,10 +610,10 @@ async function loadData() {
const res = await orderItemApi.page({
page: pagination.page,
pageSize: pagination.pageSize,
code: searchForm.code || undefined,
projectId: searchForm.projectId || undefined,
beginTime: searchForm.beginTime || undefined,
endTime: searchForm.endTime || undefined,
code: searchForm.code,
projectId: searchForm.projectId,
beginTime: searchForm.beginTime,
endTime: searchForm.endTime
})
tableData.value = res.list
pagination.itemCount = res.total
@ -278,7 +632,7 @@ function handleSearch() {
function handleReset() {
searchForm.code = ''
searchForm.projectId = null
searchForm.projectId = ''
searchForm.beginTime = null
@ -304,16 +658,44 @@ function handleCheck(keys: Array<string | number>) {
selectedIds.value = keys as number[]
}
//
//
let planList = ref<any>([])
function gongxu(){
if(formData.productionCode){
planList.value.splice(0)
orderItemApi.preCreation({productionCode:formData.productionCode}).then((rps:any) => {
planList.value = rps.planList?rps.planList:[]
})
}else{
planList.value.splice(0)
}
}
function tuozChange() {
console.log(planList.value)
}
// function gxupdata(v:any) {
// console.log(planList.value,'planList')
// console.log(v,'gx')
// }
//
function handleAdd() {
modalTitle.value = '新增生产订单'
Object.assign(formData, defaultFormData)
modalVisible.value = true
planList.value.splice(0)
}
//
function handleEdit(row: OrderItem) {
modalTitle.value = '编辑生产订单'
modalVisible.value = true
planList.value.splice(0)
Object.assign(formData, row)
if (formData.beginTime && typeof formData.beginTime === 'string') {
formData.beginTime = new Date(formData.beginTime.replace(' ', 'T')).getTime()
@ -336,11 +718,12 @@ function handleEdit(row: OrderItem) {
if (formData.assingWorkOperationTime && typeof formData.assingWorkOperationTime === 'string') {
formData.assingWorkOperationTime = new Date(formData.assingWorkOperationTime.replace(' ', 'T')).getTime()
}
modalVisible.value = true
}
//
async function handleSubmit() {
await formRef.value?.validate()
try {
const submitData = { ...formData } as OrderItem
@ -365,11 +748,21 @@ async function handleSubmit() {
if (typeof submitData.assingWorkOperationTime === 'number') {
submitData.assingWorkOperationTime = new Date(submitData.assingWorkOperationTime).toISOString().slice(0, 19).replace('T', ' ')
}
if (submitData.id) {
await orderItemApi.update(submitData)
message.success('修改成功')
} else {
await orderItemApi.create(submitData)
let savedata = Object.assign(
{},
submitData,
{
planList:planList.value
}
)
await orderItemApi.create(savedata)
message.success('新增成功')
}
modalVisible.value = false
@ -379,6 +772,88 @@ async function handleSubmit() {
}
}
//
let dispatchmodal = ref(false)
let dispatchform = reactive<any>({
id:'',
name:'',
userid:'',
username:''
})
let yglist = ref<any>([])
const dispatchrules = {
userid:[{ required: true, message: '请选择员工', trigger: 'blur' }]
}
let dispatchLoading = ref(false)
let dispatchddbtn = ref(false)
const dispatchformRef = ref()
let loadingRef = ref(false)
function slehand(v?:any) {
loadingRef.value = true
userApi.page({
page: 1,
pageSize: 100,
username: v,
}).then((rps:any) =>{
if(rps.list && rps.list.length > 0){
yglist.value = rps.list.map((n:any) => {
return {
label:n.username,
value:n.id+''
}
})
}
console.log(yglist.value,'12')
loadingRef.value = false
}).catch(() => {
loadingRef.value = false
})
}
function disphand(v:any){
dispatchmodal.value = true
dispatchformRef.value?.restoreValidation()
dispatchform.id = v.id
dispatchform.name = v.name
dispatchform.userid = ''
slehand()
}
function dispatchSubmit() {
console.log(dispatchform.userid,'dispatchform.userid')
dispatchformRef.value?.validate((v:any) => {
if(!v){
// dispatchLoading.value = true
// dispatchddbtn.value = true
// message.success('!')
// setTimeout(()=> {
// dispatchmodal.value = false
// dispatchform.value = false
// dispatchLoading.value = false
// dispatchddbtn.value = false
// loadData()
// },1000)
orderItemApi.assignWork(dispatchform).then(() => {
message.success('操作成功!')
setTimeout(()=> {
dispatchmodal.value = false
dispatchLoading.value = false
dispatchddbtn.value = false
loadData()
},1000)
}).catch(() => {
dispatchddbtn.value = false
dispatchLoading.value = false
})
}
})
}
//
function handleDelete(row: OrderItem) {
dialog.warning({

View File

@ -4,18 +4,18 @@
<!-- 搜索表单 -->
<div class="search-form">
<n-form inline :model="searchForm" label-placement="left">
<n-form-item label="主键">
<!-- <n-form-item label="主键">
<n-input v-model:value="searchForm.id" placeholder="请输入主键" clearable />
</n-form-item>
</n-form-item> -->
<n-form-item label="工序名称">
<n-input v-model:value="searchForm.name" placeholder="请输入工序名称" clearable />
</n-form-item>
<n-form-item label="工序编码">
<n-input v-model:value="searchForm.code" placeholder="请输入工序编码" clearable />
</n-form-item>
<n-form-item label="生产订单id">
<!-- <n-form-item label="生产订单">
<n-input v-model:value="searchForm.orderItemId" placeholder="请输入生产订单id" clearable />
</n-form-item>
</n-form-item> -->
<n-form-item>
<n-space>
<n-button type="primary" @click="handleSearch">
@ -34,97 +34,160 @@
<!-- 工具栏 -->
<div class="table-toolbar">
<n-space>
<n-button type="primary" @click="handleAdd">
<n-button type="primary" @click="handleAdd" size="small">
<template #icon><n-icon><AddOutline /></n-icon></template>
新增
</n-button>
<n-button @click="importModalVisible = true">
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
导入
</n-button>
<n-button @click="handleExport">
<template #icon><n-icon><DownloadOutline /></n-icon></template>
导出{{ selectedIds.length > 0 ? `(${selectedIds.length})` : '' }}
</n-button>
<n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
<n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete" size="small">
<template #icon><n-icon><TrashOutline /></n-icon></template>
删除
</n-button>
</n-space>
<n-button-group size="large">
<n-button type="success" @click="importModalVisible = true" size="small">
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
导入
</n-button>
<n-button @click="handleExport" size="small">
<template #icon><n-icon><DownloadOutline /></n-icon></template>
导出{{ selectedIds.length > 0 ? `(${selectedIds.length})` : '' }}
</n-button>
</n-button-group>
</div>
<!-- 表格 -->
<n-data-table
size="small"
remote
:border="false"
:single-line="false"
striped
:columns="columns"
:data="tableData"
:loading="loading"
:pagination="pagination"
:row-key="(row) => row.id"
:scroll-x="1200"
/>
<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="[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>
<!-- :pagination="pagination"
:row-key="(row:any) => row.id"
@update:page="handlePageChange"
@update:page-size="handlePageSizeChange"
@update:checked-row-keys="handleCheck"
/>
-->
</n-card>
<!-- 新增/编辑弹窗 -->
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
<n-form-item label="工序名称" path="name">
<n-input v-model:value="formData.name" placeholder="请输入工序名称" />
</n-form-item>
<n-form-item label="工序编码" path="code">
<n-input v-model:value="formData.code" placeholder="请输入工序编码" />
</n-form-item>
<n-form-item label="工序顺序" path="sort">
<n-input v-model:value="formData.sort" placeholder="请输入工序顺序" />
</n-form-item>
<n-form-item label="生产订单id" path="orderItemId">
<n-input v-model:value="formData.orderItemId" placeholder="请输入生产订单id" />
</n-form-item>
<n-form-item label="生产开始时间" path="beginTime">
<n-date-picker v-model:value="formData.beginTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
<n-form-item label="生产结束时间" path="endTime">
<n-date-picker v-model:value="formData.endTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
<n-form-item label="是否采购" path="procurement">
<n-radio-group v-model:value="formData.procurement">
<n-space>
<n-radio v-for="opt in procurementOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
<n-form-item label="是否委外" path="outsource">
<n-radio-group v-model:value="formData.outsource">
<n-space>
<n-radio v-for="opt in outsourceOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
<n-form-item label="生产总数" path="quantity">
<n-input v-model:value="formData.quantity" placeholder="请输入生产总数" />
</n-form-item>
<n-form-item label="转入数量" path="transferNum">
<n-input v-model:value="formData.transferNum" placeholder="请输入转入数量" />
</n-form-item>
<n-form-item label="转出数量" path="transferOutNum">
<n-input v-model:value="formData.transferOutNum" placeholder="请输入转出数量" />
</n-form-item>
<n-form-item label="是否质检" path="qualityInspection">
<n-radio-group v-model:value="formData.qualityInspection">
<n-space>
<n-radio v-for="opt in qualityInspectionOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
<n-form-item label="是否直接入库" path="storageEntry">
<n-radio-group v-model:value="formData.storageEntry">
<n-space>
<n-radio v-for="opt in storageEntryOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
<n-modal
v-model:show="modalVisible"
preset="card"
:title="modalTitle"
style="width: 800px"
>
<n-form
ref="formRef"
:model="formData"
:rules="formRules"
label-placement="left"
label-width="120px"
>
<n-grid :cols="2">
<n-gi>
<n-form-item label="工序名称" path="name">
<n-input v-model:value="formData.name" placeholder="请输入工序名称" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="工序编码" path="code">
<n-input v-model:value="formData.code" placeholder="请输入工序编码" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="工序顺序" path="sort">
<n-input v-model:value="formData.sort" placeholder="请输入工序顺序" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="生产订单id" path="orderItemId">
<n-input v-model:value="formData.orderItemId" placeholder="请输入生产订单id" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="生产开始时间" path="beginTime">
<n-date-picker v-model:value="formData.beginTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="生产结束时间" path="endTime">
<n-date-picker v-model:value="formData.endTime" type="datetime" clearable style="width: 100%" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否采购" path="procurement">
<n-radio-group v-model:value="formData.procurement">
<n-space>
<n-radio v-for="opt in procurementOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否委外" path="outsource">
<n-radio-group v-model:value="formData.outsource">
<n-space>
<n-radio v-for="opt in outsourceOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="生产总数" path="quantity">
<n-input v-model:value="formData.quantity" placeholder="请输入生产总数" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="转入数量" path="transferNum">
<n-input v-model:value="formData.transferNum" placeholder="请输入转入数量" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="转出数量" path="transferOutNum">
<n-input v-model:value="formData.transferOutNum" placeholder="请输入转出数量" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否质检" path="qualityInspection">
<n-radio-group v-model:value="formData.qualityInspection">
<n-space>
<n-radio v-for="opt in qualityInspectionOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否直接入库" path="storageEntry">
<n-radio-group v-model:value="formData.storageEntry">
<n-space>
<n-radio v-for="opt in storageEntryOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</n-gi>
</n-grid>
</n-form>
<template #footer>
<n-space justify="end">
@ -134,6 +197,138 @@
</template>
</n-modal>
<!--派工弹框-->
<n-modal
v-model:show="dispatchmodal"
title="派工"
preset="card"
style="width: 800px"
:mask-closable="false"
>
<n-form
ref="dispatchformRef"
:model="dispatchform"
label-placement="left"
:inline="true"
:rules="dispatchrules"
label-width="80"
>
<n-grid :cols="2">
<n-gi>
<n-form-item label="工序名称">
<n-input v-model:value="dispatchform.name" disabled />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="生产数量">
<n-input v-model:value="dispatchform.quantity" disabled />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="开始时间">
<n-input v-model:value="dispatchform.beginTime" disabled />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="结束时间">
<n-input v-model:value="dispatchform.endTime" disabled />
</n-form-item>
</n-gi>
<!-- <pgitem
v-for="(n,i) in dispatchform.userlist"
:obj="n"
:index="i"
@addhand="addpgnum"
@delehand="deletenum(i)"
/> -->
<n-gi :span="24">
<pgitem
v-for="(n,i) in dispatchform.list"
:obj="n"
:index="i"
:key="i"
listname="list"
@addhand="addpgnum"
@delehand="deletenum(i)"
/>
<!-- <n-grid :cols="8">
<template v-for="(n,i) in dispatchform.userlist">
<n-gi :span="8">
<n-form-item
label="指派员工"
:rule="{
required: true,
message: '请选择员工',
trigger: 'blur'
}"
>
<n-select
v-model:value="n.id"
filterable
placeholder="请输入用户名称搜索"
:options="yglist"
:loading="loadingRef"
clearable
remote
:clear-filter-after-select="false"
@search="slehand"
/>
</n-form-item>
</n-gi>
<n-gi :span="8">
<n-form-item
label="数量"
:rule="{
required: true,
message: `请输入数量`,
trigger: ['input', 'blur'],
}"
>
<n-input v-model:value="n.num" />
</n-form-item>
</n-gi>
<n-gi :span="8" style="padding-left:10px;">
<n-icon
v-if="i == 0"
size="25"
style="padding-top: 5px;cursor: pointer;" color="#1060c9"
@click="addpgnum"
>
<AddOutline />
</n-icon>
<n-icon
v-else
size="18"
style="padding:7px 0 0 2px;cursor: pointer;" color="#d03050"
@click="deletenum(i)"
>
<TrashOutline />
</n-icon>
</n-gi>
</template>
</n-grid> -->
</n-gi>
</n-grid>
</n-form>
<template #footer>
<n-space justify="end">
<n-button size="small" @click="dispatchmodal = false">取消</n-button>
<n-button
size="small"
type="primary"
:loading="dispatchLoading"
@click="dispatchSubmit"
:disabled="dispatchddbtn"
>确定</n-button>
</n-space>
</template>
</n-modal>
<!-- 导入弹窗 -->
<n-modal v-model:show="importModalVisible" preset="card" title="导入工序计划" style="width: 500px">
<n-space vertical>
@ -168,21 +363,55 @@
</template>
<script setup lang="ts">
import { ref, reactive, h, onMounted } from 'vue'
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
import { orderProcessPlanApi, type OrderProcessPlan } from '@/api/orderProcessPlan'
import {
ref,
reactive,
h,
onMounted
} from 'vue'
import {
NButton,
NSpace,
NIcon,
NUpload,
useMessage,
useDialog,
//type DataTableColumns,
type UploadCustomRequestOptions
} from 'naive-ui'
import {
SearchOutline,
RefreshOutline,
AddOutline,
TrashOutline,
//CreateOutline,
CloudUploadOutline,
DownloadOutline
} from '@vicons/ionicons5'
import {
orderProcessPlanApi,
type OrderProcessPlan
} from '@/api/orderProcessPlan'
import { dictDataApi } from '@/api/org'
import Pgitem from './pgitem.vue'
//import { userApi } from '@/api/system'
import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
//
const hasPermission = (permission: string) => userStore.hasPermission(permission)
const message = useMessage()
const dialog = useDialog()
//
const searchForm = reactive({
id: null as number | null,
const searchForm = reactive<any>({
id: '',
name: '',
code: '',
orderItemId: null as number | null,
orderItemId: '',
})
//
@ -202,22 +431,22 @@ const modalVisible = ref(false)
const modalTitle = ref('')
const importModalVisible = ref(false)
const formRef = ref()
const defaultFormData: OrderProcessPlan = {
const defaultFormData = {
name: '',
code: '',
sort: undefined,
orderItemId: undefined,
beginTime: undefined,
endTime: undefined,
procurement: undefined,
outsource: undefined,
quantity: undefined,
transferNum: undefined,
transferOutNum: undefined,
qualityInspection: undefined,
storageEntry: undefined,
sort: '',
orderItemId: '',
beginTime: null,
endTime: null,
procurement: '',
outsource: '',
quantity: '',
transferNum: '',
transferOutNum: '',
qualityInspection: '',
storageEntry: '',
}
const formData = reactive<OrderProcessPlan>({ ...defaultFormData })
const formData = reactive<any>({ ...defaultFormData })
// //使
const procurementOptions = ref<{ label: string; value: any }[]>([])
@ -230,40 +459,100 @@ const formRules = {
}
//
const columns: DataTableColumns<OrderProcessPlan> = [
{ type: 'selection' },
{ title: '主键', key: 'id' },
{ title: '工序名称', key: 'name' },
{ title: '工序编码', key: 'code' },
{ title: '工序顺序', key: 'sort' },
{ title: '生产订单id', key: 'orderItemId' },
{ title: '生产开始时间', key: 'beginTime' },
{ title: '生产结束时间', key: 'endTime' },
{ title: '是否采购', key: 'procurement',
const columns = [
// { type: 'selection' },
{
align:'center',
minWidth: 150,
title: '工序名称',
key: 'name'
},
{
align:'center',
minWidth: 150,
title: '工序编码',
key: 'code'
},
{
align:'center',
minWidth: 150,
title: '工序顺序',
key: 'sort'
},
// {
// align:'center',
// minWidth: 150,
// title: 'id',
// key: 'orderItemId'
// },
{
align:'center',
minWidth: 150,
title: '生产开始时间',
key: 'beginTime'
},
{
align:'center',
minWidth: 150,
title: '生产结束时间',
key: 'endTime'
},
{
align:'center',
minWidth: 150,
title: '是否采购',
key: 'procurement',
render(row) {
const val = row.procurement
const opt = procurementOptions.value.find(o => o.value === val || String(o.value) === String(val))
return opt ? opt.label : (val ?? '-')
}
},
{ title: '是否委外', key: 'outsource',
{
align:'center',
minWidth: 150,
title: '是否委外',
key: 'outsource',
render(row) {
const val = row.outsource
const opt = outsourceOptions.value.find(o => o.value === val || String(o.value) === String(val))
return opt ? opt.label : (val ?? '-')
}
},
{ title: '生产总数', key: 'quantity' },
{ title: '转入数量', key: 'transferNum' },
{ title: '转出数量', key: 'transferOutNum' },
{ title: '是否质检', key: 'qualityInspection',
{
align:'center',
minWidth: 150,
title: '生产总数',
key: 'quantity'
},
{
align:'center',
minWidth: 150,
title: '转入数量',
key: 'transferNum'
},
{
align:'center',
minWidth: 150,
title: '转出数量',
key: 'transferOutNum'
},
{
align:'center',
minWidth: 150,
title: '是否质检',
key: 'qualityInspection',
render(row) {
const val = row.qualityInspection
const opt = qualityInspectionOptions.value.find(o => o.value === val || String(o.value) === String(val))
return opt ? opt.label : (val ?? '-')
}
},
{ title: '是否直接入库', key: 'storageEntry',
{
align:'center',
minWidth: 150,
title: '是否直接入库',
key: 'storageEntry',
render(row) {
const val = row.storageEntry
const opt = storageEntryOptions.value.find(o => o.value === val || String(o.value) === String(val))
@ -271,19 +560,45 @@ const columns: DataTableColumns<OrderProcessPlan> = [
}
},
{
align:'center',
title: '操作',
key: 'actions',
width: 140,
fixed: 'right',
render(row) {
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
}),
h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' 删除']
})
])
const buttons:any = []
if(hasPermission('biz:orderItem:edit')){
buttons.push(h(NButton, {
size: 'small',
type:'primary',
ghost:true,
onClick: () => { handleEdit(row) } },
//{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ' ]}
{ default: () => '编辑'}
))
}
if(hasPermission('biz:orderItem:assign')){
buttons.push(h(NButton, {
size: 'small',
type:'success',
ghost:true,
onClick: () => { disphand(row) } },
{ default: () => '派工'}
))
}
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
// return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
// h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
// default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ']
// }),
// h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
// default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' ']
// })
// ])
}
}
]
@ -295,10 +610,10 @@ async function loadData() {
const res = await orderProcessPlanApi.page({
page: pagination.page,
pageSize: pagination.pageSize,
id: searchForm.id || undefined,
name: searchForm.name || undefined,
code: searchForm.code || undefined,
orderItemId: searchForm.orderItemId || undefined,
id: searchForm.id,
name: searchForm.name,
code: searchForm.code,
orderItemId: searchForm.orderItemId
})
tableData.value = res.list
pagination.itemCount = res.total
@ -315,13 +630,13 @@ function handleSearch() {
//
function handleReset() {
searchForm.id = null
searchForm.id = ''
searchForm.name = ''
searchForm.code = ''
searchForm.orderItemId = null
searchForm.orderItemId = ''
handleSearch()
}
@ -351,7 +666,7 @@ function handleAdd() {
}
//
function handleEdit(row: OrderProcessPlan) {
function handleEdit(row:any) {
modalTitle.value = '编辑工序计划'
Object.assign(formData, row)
if (formData.beginTime && typeof formData.beginTime === 'string') {
@ -370,7 +685,7 @@ function handleEdit(row: OrderProcessPlan) {
async function handleSubmit() {
await formRef.value?.validate()
try {
const submitData = { ...formData } as OrderProcessPlan
const submitData = { ...formData }
if (typeof submitData.beginTime === 'number') {
submitData.beginTime = new Date(submitData.beginTime).toISOString().slice(0, 19).replace('T', ' ')
}
@ -394,6 +709,110 @@ async function handleSubmit() {
}
}
//
let dispatchmodal = ref(false)
let dispatchform = reactive<any>({
id:'',
name:'',
beginTime:'',
endTime:'',
userid:'',
quantity:'',
list:[{
userId:'',
quantity:''
}],
username:''
})
//let yglist = ref<any>([])
const dispatchrules = {
// userid:[
// {
// required: true,
// message: '',
// trigger: 'blur'
// }
// {
// required: true,
// validator(rule:any,value: any) {
// if(value.length == 0){
// return new Error('')
// }
// return true
// },
// trigger: ['blur']
// }
// ]
}
let dispatchLoading = ref(false)
let dispatchddbtn = ref(false)
const dispatchformRef = ref()
let loadingRef = ref(false)
function addpgnum() {
dispatchform.list.push({
userId:'',
quantity:''
})
}
function deletenum(index:any) {
dispatchform.list.splice(index,1)
}
function disphand(v:any){
dispatchmodal.value = true
dispatchformRef.value?.restoreValidation()
dispatchform.id = v.id
dispatchform.name = v.name
dispatchform.beginTime = v.beginTime
dispatchform.endTime = v.endTime
dispatchform.quantity = v.quantity
dispatchform.userid = ''
dispatchform.list = [{
userId:'',
quantity:''
}]
//slehand()
}
function dispatchSubmit() {
let total = 0
dispatchform.list.forEach((n:any) => {
total = n.quantity*1+total
})
dispatchformRef.value?.validate((v:any) => {
if(!v){
if(total != dispatchform.quantity){
message.error('派工总数量需等于生产总数',{
duration:4000
})
}else{
orderProcessPlanApi.assignWork(dispatchform).then(() => {
message.success('操作成功!')
setTimeout(()=> {
dispatchmodal.value = false
dispatchLoading.value = false
dispatchddbtn.value = false
loadData()
},1000)
}).catch(() => {
dispatchddbtn.value = false
dispatchLoading.value = false
})
}
}
})
}
//
function handleDelete(row: OrderProcessPlan) {
dialog.warning({

View File

@ -0,0 +1,125 @@
<template>
<n-grid>
<n-gi :span="10">
<n-form-item
label="指派员工"
:path="`${listname}[${index}].userId`"
:rule="{
required: true,
message: '请选择员工',
trigger: 'blur'
}"
>
<!--multiple-->
<n-select
v-model:value="obj.userId"
filterable
placeholder="请输入用户名称搜索"
:options="yglist"
:loading="loadingRef"
clearable
remote
:clear-filter-after-select="false"
@search="slehand"
/>
</n-form-item>
</n-gi>
<n-gi :span="10">
<n-form-item
label="数量"
:path="`${listname}[${index}].quantity`"
:rule="{
required: true,
message: `请输入数量`,
trigger: 'blur',
}"
>
<n-input v-model:value="obj.quantity" />
</n-form-item>
</n-gi>
<n-gi :span="4" style="padding-left:10px;">
<n-icon
v-if="index == 0"
size="25"
style="padding-top: 5px;cursor: pointer;" color="#1060c9"
@click="addpgnum"
>
<AddOutline />
</n-icon>
<n-icon
v-else
size="18"
style="padding:7px 0 0 2px;cursor: pointer;" color="#d03050"
@click="deletenum(index)"
>
<TrashOutline />
</n-icon>
</n-gi>
</n-grid>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { userApi } from '@/api/system'
import {
AddOutline,
TrashOutline,
} from '@vicons/ionicons5'
const props = withDefaults(defineProps<{
listname:any
obj:any,
index:any
}>(), {
obj:{}
})
const emit = defineEmits<{
addhand:[],
delehand:[index:any],
update: [index:any,obj:any]
}>()
// function updatehand() {
// emit('update')
// }
function addpgnum() {
emit('addhand')
}
function deletenum(index:any){
emit('delehand',index)
}
let yglist = ref<any>([])
let loadingRef = ref(false)
function slehand(v?:any) {
loadingRef.value = true
yglist.value.splice(0)
// dispatchform.userlist = [{
// id:'',
// num:''
// }]
userApi.page({
page: 1,
pageSize: 100,
username: v,
}).then((rps:any) =>{
if(rps.list && rps.list.length > 0){
yglist.value = rps.list.map((n:any) => {
return {
label:n.username,
value:n.id+''
}
})
}
console.log(yglist.value,'12')
loadingRef.value = false
}).catch(() => {
loadingRef.value = false
})
}
slehand()
</script>

View File

@ -115,7 +115,7 @@
<!-- 新增/编辑弹窗 -->
<n-modal
v-model:show="editmodal"
title="编辑派工"
title="编辑派工"
preset="card"
style="width: 800px"
:mask-closable="false"
@ -128,7 +128,7 @@
label-width="80"
class="modal-form"
>
<n-grid :cols="2" :x-gap="16">
<n-grid :cols="2">
<!-- <n-gi>
<n-form-item label="工序编号" path="processName">
<n-input v-model:value="formData.processName" placeholder="请输入用户名" :disabled="!!formData.id" />
@ -136,22 +136,22 @@
</n-gi> -->
<n-gi>
<n-form-item label="工序名称" path="processName">
<n-input v-model:value="formData.processName" placeholder="请输入用户名" />
<n-input v-model:value="formData.processName" placeholder="请输入工序名称" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="工人名称" path="stringUserName">
<n-input v-model:value="formData.stringUserName" placeholder="请输入用户名" />
<n-input v-model:value="formData.stringUserName" placeholder="请选择工人" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="数" path="quantity">
<n-input v-model:value="formData.quantity" placeholder="请输入用户名" />
<n-form-item label="数" path="quantity">
<n-input v-model:value="formData.quantity" placeholder="请输入数量" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否返工" path="rework">
<n-input v-model:value="formData.rework" placeholder="请输入用户名" />
<n-input v-model:value="formData.rework" placeholder="请输入" />
</n-form-item>
</n-gi>
<!-- <n-gi>
@ -160,7 +160,7 @@
</n-form-item>
</n-gi> -->
<n-gi>
<n-form-item label="完成数" path="completedQuantity">
<n-form-item label="完成数" path="completedQuantity">
<n-input v-model:value="formData.completedQuantity" placeholder="请输入用户名" :disabled="!!formData.id" />
</n-form-item>
</n-gi>
@ -194,8 +194,14 @@
:rules="reassrules"
label-placement="top"
label-width="80"
class="modal-form"
>
<n-form-item label="工序编号">
<n-input v-model:value="gxobg.id" disabled />
</n-form-item>
<n-form-item label="工序名称">
<n-input v-model:value="gxobg.name" disabled />
</n-form-item>
<n-form-item label="工人名称" path="">
<n-input v-model:value="reassform.userid" placeholder="请选择员工" />
</n-form-item>
@ -211,7 +217,7 @@
:loading="reassLoading"
@click="reassSubmit"
:disabled="reassdisedbtn"
>保存</n-button>
>确定</n-button>
</n-space>
</template>
</n-modal>
@ -229,9 +235,13 @@
:model="pauseform"
label-placement="top"
label-width="80"
class="modal-form"
>
<n-form-item label="工序编号">
<n-input v-model:value="gxobg.id" disabled />
</n-form-item>
<n-form-item label="工序名称">
<n-input v-model:value="gxobg.name" disabled />
</n-form-item>
<n-form-item label="暂停原因" path="reason">
<n-input type="textarea" v-model:value="pauseform.reason" placeholder="请输入暂停原因" />
</n-form-item>
@ -244,7 +254,7 @@
:loading="submitLoading"
@click="pauseSubmit"
:disabled="disedbtn"
>保存</n-button>
>确定</n-button>
</n-space>
</template>
</n-modal>
@ -286,7 +296,7 @@ import {
editdiswor,
transfer,
pauseresume,
workload
//workload
} from '@/api/production'
//const dialog = useDialog()
@ -549,7 +559,7 @@ const formData = reactive<any>({
const rules = {
processName: [{ required: true, message: '请输工序名称', trigger: 'blur' }],
quantity: [{ required: true, message: '请输入数', trigger: 'blur' }]
quantity: [{ required: true, message: '请输入数', trigger: 'blur' }]
}
//
@ -630,6 +640,8 @@ function handleSubmit() {
})
}
let gxobg = reactive<any>({})
//
let reassignmodal = ref(false)
@ -650,6 +662,10 @@ let reassLoading = ref(false)
let reassdisedbtn = ref(false)
function handlreass(n:any) {
gxobg.name = n.processName
gxobg.id = n.processId
reassignmodal.value = true
reassLoading.value = false
reassdisedbtn.value = false
@ -696,6 +712,10 @@ const pauseformRef = ref()
let pauseisedbtn = ref(false)
function handlpause(n:any) {
gxobg.name = n.processName
gxobg.id = n.processId
pausemodal.value = true
pauseLoading.value = false
pauseisedbtn.value = false
@ -744,7 +764,7 @@ function pauseSubmit() {
onMounted(() => {
getlist()
workload()
//workload()
})
</script>

View File

@ -15,9 +15,7 @@
<n-form-item-gi :span="6" label="工序名称">
<n-input v-model:value="searchForm.processName" placeholder="请输入工序名称" clearable />
</n-form-item-gi>
<n-form-item-gi :span="6" label="工人名称">
<n-input v-model:value="searchForm.stringUserName" placeholder="请输入工人名称" clearable />
</n-form-item-gi>
<!-- <n-form-item-gi :span="6" label="数里">
<n-input v-model:value="searchForm.processId" placeholder="请输入数里" clearable />
</n-form-item-gi> -->
@ -112,109 +110,45 @@
</div>
</n-card>
<!-- 新增/编辑弹窗 -->
<!--暂停恢复弹框-->
<n-modal
v-model:show="editmodal"
title="编辑派工"
preset="card"
style="width: 800px"
:mask-closable="false"
>
<n-form
ref="formRef"
:model="formData"
:rules="rules"
label-placement="left"
label-width="80"
class="modal-form"
>
<n-grid :cols="2" :x-gap="16">
<!-- <n-gi>
<n-form-item label="工序编号" path="processName">
<n-input v-model:value="formData.processName" placeholder="请输入用户名" :disabled="!!formData.id" />
</n-form-item>
</n-gi> -->
<n-gi>
<n-form-item label="工序名称" path="processName">
<n-input v-model:value="formData.processName" placeholder="请输入用户名" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="工人名称" path="stringUserName">
<n-input v-model:value="formData.stringUserName" placeholder="请输入用户名" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="数里" path="quantity">
<n-input v-model:value="formData.quantity" placeholder="请输入用户名" />
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="是否返工" path="rework">
<n-input v-model:value="formData.rework" placeholder="请输入用户名" />
</n-form-item>
</n-gi>
<!-- <n-gi>
<n-form-item label="返工次数" path="username">
<n-input v-model:value="formData.username" placeholder="请输入用户名" :disabled="!!formData.id" />
</n-form-item>
</n-gi> -->
<n-gi>
<n-form-item label="完成数里" path="completedQuantity">
<n-input v-model:value="formData.completedQuantity" placeholder="请输入用户名" :disabled="!!formData.id" />
</n-form-item>
</n-gi>
</n-grid>
</n-form>
<template #footer>
<n-space justify="end">
<n-button @click="editmodal = false">取消</n-button>
<n-button
type="primary"
:loading="submitLoading"
@click="handleSubmit"
:disabled="disedbtn"
>保存</n-button>
</n-space>
</template>
</n-modal>
<!--改派弹框-->
<n-modal
v-model:show="reassignmodal"
title="改派"
v-model:show="pausemodal"
title="报检"
preset="card"
style="width: 400px"
:mask-closable="false"
>
<n-form
ref="reassformRef"
:model="reassform"
:rules="reassrules"
ref="pauseformRef"
:model="pauseform"
:rules="pauserules"
label-placement="top"
label-width="80"
class="modal-form"
>
<n-form-item label="工人名称" path="">
<n-input v-model:value="reassform.userid" placeholder="请选择员工" />
</n-form-item>
<n-form-item label="改派原因" path="reason">
<n-input type="textarea" v-model:value="reassform.reason" placeholder="请输入改派原因" />
<n-form-item label="工序编号">
<n-input v-model:value="gxobg.id" disabled />
</n-form-item>
<n-form-item label="工序名称">
<n-input v-model:value="gxobg.name" disabled />
</n-form-item>
<n-form-item label="报检数量" path="qcNum">
<n-input v-model:value="pauseform.qcNum" placeholder="请输入报检数量" />
</n-form-item>
</n-form>
<template #footer>
<n-space justify="end">
<n-button @click="reassignmodal = false">取消</n-button>
<n-button @click="pausemodal = false">取消</n-button>
<n-button
type="primary"
:loading="reassLoading"
@click="reassSubmit"
:disabled="reassdisedbtn"
:loading="pauseLoading"
@click="pauseSubmit"
:disabled="pauseisedbtn"
>保存</n-button>
</n-space>
</template>
</n-modal>
</div>
</template>
@ -224,7 +158,8 @@ import {
ref,
reactive,
h,
onMounted,
onMounted,
watch,
} from 'vue'
@ -234,11 +169,11 @@ import {
NSpace,
NPagination,
NGrid,
NGi,
// NGi,
NTag,
useMessage,
//useDialog,
type FormInst,
//type FormInst,
} from 'naive-ui'
import {
@ -250,9 +185,7 @@ import { useUserStore } from '@/stores/user'
import {
mytasks,
editdiswor,
transfer,
pauseresume
inspectio
} from '@/api/production'
//const dialog = useDialog()
@ -269,9 +202,8 @@ const hasPermission = (permission: string) => userStore.hasPermission(permission
const searchForm = reactive({
page: 1,
pageSize: 20,
// processId:'',
// processName:'',
// stringUserName:''
processId:'',
processName:'',
})
@ -385,7 +317,7 @@ const columns = [
},
{
align:'center',
title: '质检打回数',
title: '质检打回数',
key: 'qualityReturnNum',
minWidth: 150
},
@ -444,79 +376,30 @@ const columns = [
align:'center',
title: '操作',
key: 'actions',
width: 200,
width: 100,
fixed: 'right',
render(row:any) {
const buttons:any = [
// h(NButton, {
// size: 'small',
// type:'warning',
// ghost:true,
// onClick: () => handleEdit(row) },
// //{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ' ]}
// { default: () => ''}
// )
]
const buttons:any = []
// if(hasPermission('biz:assingWork:edit')){
// buttons.push(h(NButton, {
// size: 'small',
// type:'primary',
// ghost:true,
// onClick: () => { handleEdit(row) } },
// //{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ' ]}
// { default: () => ''}
// ))
// }
// if(hasPermission('biz:assingWork:transfer')){
// buttons.push(h(NButton, {
// size: 'small',
// type:'success',
// ghost:true,
// onClick: () => { handlreass(row) } },
// { default: () => ''}
// ))
// }
// if(hasPermission('biz:assingWork:pauseResume')){
// buttons.push(h(NButton, {
// size: 'small',
// type:'warning',
// ghost:true,
// onClick:()=>{ handlpause(row) }
// },
// { default: () => ''}
// ))
// }
// buttons.push(
// )
if(hasPermission('biz:assingWork:edit')){
buttons.push(h(NButton, {
size: 'small',
type:'primary',
ghost:true,
onClick: () => { handlpause(row) } },
//{ default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' ' ]}
{ default: () => '报检'}
))
}
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
}
}
]
//
const editmodal = ref(false)
const formRef = ref<FormInst | null>(null)
const submitLoading = ref(false)
const formData = reactive<any>({
id:'',
processName:'', //
userId:'', //id
stringUserName:'', //
quantity:'', //
rework:'', //
reworkNum:'', //
completedQuantity:'', //
})
const rules = {
processName: [{ required: true, message: '请输工序名称', trigger: 'blur' }],
quantity: [{ required: true, message: '请输入数里', trigger: 'blur' }]
}
//
function search() {
@ -530,7 +413,6 @@ function search() {
function reset() {
searchForm.processId =''
searchForm.processName = ''
searchForm.stringUserName = ''
}
//
@ -558,117 +440,48 @@ function handlePageSizeChange(pageSize: number) {
}
//
let disedbtn = ref(false)
function handleEdit(n:any) {
editmodal.value = true
submitLoading.value = false
disedbtn.value = false
formRef.value?.restoreValidation()
formData.id = n.id
formData.processName = n.processName
// formData.userId = '' //id
// formData.stringUserName = '' //
// formData.quantity = '' //
// formData.rework = '' //
// formData.reworkNum = '' //
// formData.completedQuantity = '' //
}
function handleSubmit() {
formRef.value?.validate(v => {
if(!v){
submitLoading.value = true
disedbtn.value = true
editdiswor(formData).then(() => {
message.success('保存成功!')
setTimeout(()=> {
editmodal.value = false
submitLoading.value = false
disedbtn.value = false
getlist()
},1000)
}).catch(() => {
disedbtn.value = false
submitLoading.value = false
})
}
})
}
//
let reassignmodal = ref(false)
const reassformRef = ref()
let reassform = reactive<any>({
// userId:'', //id
// stringUserName:'', //
id:'', //id
reason:'', //
userid:456 //Id
})
const reassrules = {
userid: [{ required: true, message: '请选择员工', trigger: 'blur' }]
}
let reassLoading = ref(false)
let reassdisedbtn = ref(false)
function handlreass(n:any) {
reassignmodal.value = true
reassLoading.value = false
reassdisedbtn.value = false
reassformRef.value?.restoreValidation()
reassform.id = n.id
reassform.reason = ''
reassform.userid = 456
}
function reassSubmit() {
reassformRef.value?.validate((v:any) => {
if(!v){
reassLoading.value = true
reassdisedbtn.value = true
transfer(reassform).then(() => {
message.success('操作成功!')
setTimeout(()=> {
reassignmodal.value = false
reassLoading.value = false
reassdisedbtn.value = false
getlist()
},1000)
}).catch(() => {
reassdisedbtn.value = false
reassLoading.value = false
})
}
})
}
///
let gxobg = reactive<any>({})
//
let pausemodal = ref(false)
let pauseform = reactive<any>({
id:'',
status:'', //012
reason:'' //
qcNum:''
})
const pauseformRef = ref()
const pauserules = {
qcNum: [
{ required: true, message: '请输报检数量', trigger: 'blur' },
{
validator(rule:any,value: any) {
if(value > pauseform.qcNum){
return new Error(`报检数量最大为${pauseform.qcNum}`)
}
return true
},
trigger: ['blur']
}
]
}
watch(()=>pauseform.qcNum,v => {
pauseform.qcNum = v.replace(/[^\d]/g,'')
})
let pauseLoading = ref(false)
let pauseisedbtn = ref(false)
function handlpause(n:any) {
gxobg.id = n.id
gxobg.name = n.name
pausemodal.value = true
pauseLoading.value = false
pauseisedbtn.value = false
pauseformRef.value?.restoreValidation()
pauseform.id = n.id
pauseform.reason = ''
pauseform.status = n.staus
pauseform.qcNum = `${n.quantity}`
}
@ -677,7 +490,7 @@ function pauseSubmit() {
if(!v){
pauseLoading.value = true
pauseisedbtn.value = true
pauseresume(pauseform).then(() => {
inspectio(Object.assign({},pauseform,{qcNum:pauseform.qcNum*1})).then(() => {
message.success('操作成功!')
setTimeout(()=> {
pausemodal.value = false

View File

@ -21,6 +21,7 @@ export default defineConfig({
proxy: {
'/api': {
target:'http://192.168.6.107:8080', //'http://192.168.5.230:8888',
//target:'http://192.168.5.230:8888',
changeOrigin: true
},
'/druid': {