diff --git a/package.json b/package.json index 9656715..bbf93b2 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2ba0d16..1c6593e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/src/api/orderItem.ts b/src/api/orderItem.ts index ed689d0..d139477 100644 --- a/src/api/orderItem.ts +++ b/src/api/orderItem.ts @@ -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 = {} diff --git a/src/layout/index.vue b/src/layout/index.vue index b060876..681acb5 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -861,7 +861,9 @@ function handleUserAction(key: string) { positiveText: '确定', negativeText: '取消', onPositiveClick: () => { - userStore.logout() + userStore.logout().then(() => { + userStore.setinit(true) + }) message.success('已退出登录') } }) diff --git a/src/router/index.ts b/src/router/index.ts index f5a35dc..5ceceab 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -118,9 +118,9 @@ const routes: RouteRecordRaw[] = [ }, //运营管理 { - path: 'biz/orderItem', + path: 'biz/product', name: 'product', - component: () => import('@/views/biz/orderItem/index.vue'), + component: () => import('@/views/biz/product/index.vue'), meta: { title: '商品管理', icon: 'ListOutline' } }, { @@ -219,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', component: () => import('@/views/error/404.vue'), meta: { title: '404', requiresAuth: false } } @@ -327,35 +332,59 @@ export function resetRouter() { addedRouteNames.clear() } + // 路由守卫 router.beforeEach(async (to, _from, next) => { const userStore = useUserStore() - + //document.title = `${to.meta.title || ''} - CSY Admin` - if (to.meta.requiresAuth === false) { + + + if (!userStore.token) { + //next({ name: 'Login', query: { redirect: to.fullPath } }) next() return } - if (!userStore.token) { - next({ name: 'Login', query: { redirect: to.fullPath } }) - return - } - - if (!userStore.user) { - try { + 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 diff --git a/src/stores/user.ts b/src/stores/user.ts index cc42d81..9e6b499 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -11,11 +11,17 @@ export const useUserStore = defineStore('user', () => { const permissions = ref([]) const menus = ref([]) + const init = ref(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, diff --git a/src/utils/tool.ts b/src/utils/tool.ts new file mode 100644 index 0000000..6059fc4 --- /dev/null +++ b/src/utils/tool.ts @@ -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}` +} \ No newline at end of file diff --git a/src/views/biz/orderItem/gxitem.vue b/src/views/biz/orderItem/gxitem.vue new file mode 100644 index 0000000..7bfb28f --- /dev/null +++ b/src/views/biz/orderItem/gxitem.vue @@ -0,0 +1,62 @@ + + \ No newline at end of file diff --git a/src/views/biz/orderItem/index.vue b/src/views/biz/orderItem/index.vue index 44bcd03..0ff1598 100644 --- a/src/views/biz/orderItem/index.vue +++ b/src/views/biz/orderItem/index.vue @@ -7,8 +7,8 @@ - - + + @@ -34,7 +34,11 @@
- + 新增/补单 @@ -54,56 +58,179 @@
- + +
+ + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +