From 5f59baf186a7bc6228bda1f6497d871691691a47 Mon Sep 17 00:00:00 2001 From: bwm <1114523253@qq.com> Date: Fri, 30 Aug 2024 16:56:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- .env.production | 4 +- package.json | 2 +- src/main.js | 1 + src/permission.js | 88 ++-- src/router/index.js | 37 +- src/service/request.js | 2 +- src/store/modules/permission.js | 33 +- .../convolution/costCalculation/index.vue | 481 ++++++++++++------ src/views/costMining/component/artificial.vue | 118 +++++ src/views/costMining/component/manHour.vue | 73 +++ src/views/costMining/component/materials.vue | 75 +++ src/views/costMining/index.vue | 216 ++++++++ src/views/hour/index.vue | 350 +++++++------ vite.config.js | 16 +- 15 files changed, 1119 insertions(+), 381 deletions(-) create mode 100644 src/views/costMining/component/artificial.vue create mode 100644 src/views/costMining/component/manHour.vue create mode 100644 src/views/costMining/component/materials.vue create mode 100644 src/views/costMining/index.vue diff --git a/.env.development b/.env.development index 52b16b8..b2cc583 100644 --- a/.env.development +++ b/.env.development @@ -5,10 +5,10 @@ VITE_APP_TITLE='Qomo Ai' VITE_APP_ENV='development' # 子应用路径配置 -VITE_APP_PATH='/layoutApp/testApp' +VITE_APP_PATH='/layoutApp/newEnergy' # 子应用名称 -VITE_APP_NAME='testApp' +VITE_APP_NAME='newEnergy' # 开发环境 VITE_APP_BASE_API=http://172.16.1.141:8082 diff --git a/.env.production b/.env.production index edd4434..03e94e8 100644 --- a/.env.production +++ b/.env.production @@ -5,10 +5,10 @@ VITE_APP_TITLE='Qomo Ai' VITE_APP_ENV='production' # 子应用路径配置 -VITE_APP_PATH='/layoutApp/testApp' +VITE_APP_PATH='/layoutApp/newEnergy' # 子应用名称 -VITE_APP_NAME='testApp' +VITE_APP_NAME='newEnergy' # 是否在打包时开启压缩,支持 gzip 和 brotli diff --git a/package.json b/package.json index 67088d8..f42fab5 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@vueuse/core": "10.6.1", "axios": "1.6.7", "echarts": "^5.5.0", - "element-plus": "2.7.3", + "element-plus": "2.4.3", "file-saver": "2.0.5", "js-cookie": "3.0.5", "jsencrypt": "3.3.2", diff --git a/src/main.js b/src/main.js index cbe09b8..ff4e134 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,5 @@ import { createApp } from "vue"; +import { isHttp } from "@/utils/validate"; import "./assets/styles/tailwind.css"; import Cookies from "js-cookie"; import "@/utils/flexible.js"; diff --git a/src/permission.js b/src/permission.js index ac72976..62b761f 100644 --- a/src/permission.js +++ b/src/permission.js @@ -10,51 +10,51 @@ import usePermissionStore from "@/store/modules/permission"; NProgress.configure({ showSpinner: false }); -const whiteList = ["/login", "/register"]; +// const whiteList = ["/login", "/register"]; -router.beforeEach((to, from, next) => { - NProgress.start(); - if (getToken()) { - to.meta.title && useSettingsStore().setTitle(to.meta.title); - /* has token*/ - if (to.path === "/login") { - next({ path: "/" }); - NProgress.done(); - } else if (whiteList.indexOf(to.path) !== -1) { - next(); - } else { - if (useUserStore().roles.length === 0) { - isRelogin.show = true; - useUserStore() - .getInfo() - .then(() => { - isRelogin.show = true; - usePermissionStore() - .generateRoutes() - .then(routes => { - routes.forEach(route => { - if (!isHttp(route.path)) { - router.addRoute(route); // 动态添加可访问路由表 - } - }); - next({ ...to, replace: true }); - }); - }); - } else { - next(); - } - } - } else { - // 没有token - if (whiteList.indexOf(to.path) !== -1) { - // 在免登录白名单,直接进入 - next(); - } else { - next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页 - NProgress.done(); - } - } -}); +// router.beforeEach((to, from, next) => { +// NProgress.start(); +// if (getToken()) { +// to.meta.title && useSettingsStore().setTitle(to.meta.title); +// /* has token*/ +// if (to.path === "/login") { +// next({ path: "/" }); +// NProgress.done(); +// } else if (whiteList.indexOf(to.path) !== -1) { +// next(); +// } else { +// if (useUserStore().roles.length === 0) { +// isRelogin.show = true; +// useUserStore() +// .getInfo() +// .then(() => { +// isRelogin.show = true; +// usePermissionStore() +// .generateRoutes() +// .then(routes => { +// routes.forEach(route => { +// if (!isHttp(route.path)) { +// router.addRoute(route); // 动态添加可访问路由表 +// } +// }); +// next({ ...to, replace: true }); +// }); +// }); +// } else { +// next(); +// } +// } +// } else { +// // 没有token +// if (whiteList.indexOf(to.path) !== -1) { +// // 在免登录白名单,直接进入 +// next(); +// } else { +// next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页 +// NProgress.done(); +// } +// } +// }); router.afterEach(() => { NProgress.done(); diff --git a/src/router/index.js b/src/router/index.js index a3efd8b..a0e6e49 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -129,18 +129,18 @@ export const constantRoutes = [ } ] }, - { - path: '', - component: Layout, - children: [ - { - path: "miningAnalysis/statistics", - component: () => import("@/views/miningAnalysis/statistics/index"), - name: "Statistics", - meta: { title: "挖掘统计", icon: "tree", affix: true } - } - ] - }, + // { + // path: '', + // component: Layout, + // children: [ + // { + // path: "miningAnalysis/statistics", + // component: () => import("@/views/miningAnalysis/statistics/index"), + // name: "Statistics", + // meta: { title: "挖掘统计", icon: "tree", affix: true } + // } + // ] + // }, { path: '', component: Layout, @@ -225,6 +225,19 @@ export const constantRoutes = [ } ] }, + //成本挖掘 + { + path: '', + component: Layout, + children: [ + { + path: "costMining", + component: () => import("@/views/costMining/index"), + name: "CostMining", + meta: { title: "成本挖掘", icon: "tree", affix: true } + } + ] + }, // Bom,工序,采购价格 ]; diff --git a/src/service/request.js b/src/service/request.js index dd1b2b7..27604b0 100644 --- a/src/service/request.js +++ b/src/service/request.js @@ -45,6 +45,6 @@ export const genHttp = function (baseURL = "") { return httpRequest; }; //http -export const request = genHttp("/qomo"); +export const request = genHttp("/newEnergy"); export default request; diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index d5c6675..bc58460 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -10,6 +10,17 @@ import { qiankunWindow } from "vite-plugin-qiankun/dist/helper"; // 匹配views里面所有的.vue文件 const modules = import.meta.glob("./../../views/**/*.vue"); const appPath = import.meta.env.VITE_APP_PATH; +// const requireComponent = import.meta.glob('@/views', true, /\/index\.vue$/) +// // const requireComponentjeep = require.context('@/jeep/views', true,/^(?!.*JVxeDemo).*\.vue$/) +// const map = new Map([]) +// requireComponent.keys().forEach((fileName) => { +// const componentConfig = requireComponent(fileName) +// let componentName +// const _n = fileName.split('/').slice(1, fileName.split('/').length).join('/') +// if (_n) componentName = _n.replace(/.vue/g, '') +// else componentName = componentConfig.default.__file +// map.set(componentName, componentConfig.default || componentConfig) +// }) const usePermissionStore = defineStore("permission", { state: () => ({ @@ -41,7 +52,7 @@ const usePermissionStore = defineStore("permission", { data = menu; } else { const menus = await listByApp({ - appId: this.$state.app.id + appId: JSON.parse(localStorage.getItem("appChild"))?.app.id }); data = filterChangeType(menus); } @@ -62,6 +73,22 @@ const usePermissionStore = defineStore("permission", { router.addRoute(rewriteRoutes); resolve(rewriteRoutes); }); + // const data = menu; + // const sdata = JSON.parse(JSON.stringify(data)); + // const rdata = JSON.parse(JSON.stringify(data)); + // const defaultData = JSON.parse(JSON.stringify(data)); + // const sidebarRoutes = filterAsyncRouter(sdata); + // const rewriteRoutes = filterAsyncRouter(rdata, false, true); + // const defaultRoutes = filterAsyncRouter(defaultData); + // const asyncRoutes = filterDynamicRoutes(dynamicRoutes); + // asyncRoutes.forEach(route => { + // router.addRoute(route); + // }); + // this.setRoutes(rewriteRoutes); + // this.setSidebarRouters(constantRoutes.concat(sidebarRoutes)); + // this.setDefaultRoutes(sidebarRoutes); + // this.setTopbarRoutes(defaultRoutes); + // resolve(rewriteRoutes); } }, persist: true @@ -72,11 +99,11 @@ function filterChangeType(routes) { return { component: route.menuType === 0 ? undefined : route.component, hidden: route.hidden, - path: route.url.replace(appPath, ""), + path: route.url.replace(appPath, "") + (route?.redirect || ""), name: route.menuType === 0 ? undefined : route.name, menuType: route.menuType, externalLinks: route.externalLinks, - redirect: route.url.replace(appPath, "") + "/" + route.children[0]?.url, + // redirect: route.children[0]?.url, meta: { title: route.name, icon: route.icon, diff --git a/src/views/convolution/costCalculation/index.vue b/src/views/convolution/costCalculation/index.vue index 00d6533..c8d83a9 100644 --- a/src/views/convolution/costCalculation/index.vue +++ b/src/views/convolution/costCalculation/index.vue @@ -1,175 +1,330 @@ diff --git a/src/views/costMining/component/artificial.vue b/src/views/costMining/component/artificial.vue new file mode 100644 index 0000000..1252d1f --- /dev/null +++ b/src/views/costMining/component/artificial.vue @@ -0,0 +1,118 @@ + + diff --git a/src/views/costMining/component/manHour.vue b/src/views/costMining/component/manHour.vue new file mode 100644 index 0000000..77be785 --- /dev/null +++ b/src/views/costMining/component/manHour.vue @@ -0,0 +1,73 @@ + + diff --git a/src/views/costMining/component/materials.vue b/src/views/costMining/component/materials.vue new file mode 100644 index 0000000..e82230a --- /dev/null +++ b/src/views/costMining/component/materials.vue @@ -0,0 +1,75 @@ + + diff --git a/src/views/costMining/index.vue b/src/views/costMining/index.vue new file mode 100644 index 0000000..2aca776 --- /dev/null +++ b/src/views/costMining/index.vue @@ -0,0 +1,216 @@ + + diff --git a/src/views/hour/index.vue b/src/views/hour/index.vue index e875259..2aca776 100644 --- a/src/views/hour/index.vue +++ b/src/views/hour/index.vue @@ -3,154 +3,214 @@ import { defineComponent, ref } from "vue"; import { ElMessage } from "element-plus"; import { transformPageResponse } from "@/utils/qomo"; -import { hourRateList, addHourRate, editHourRate, deleteHourRate, deleteBatchHourRate } from '@/api/hour'; +import { useRouter } from "vue-router"; export default defineComponent({ - setup() { - const tableRef = ref(); - const forecastDialogRef = ref(); - const selectionRows = ref([]); - // const uploadUrl = ref("/c7525cost/importExcel"); - //列 - const columns = ref([ - { type: "selection" }, - { prop: "year", label: "年度" }, - { label: "成本中心代码", prop: "costCenterCode" }, - { label: "工厂代码", prop: "factory" }, - { prop: "laborHourRate", label: "人工小时费率", hideInSearchForm: true }, - { prop: "equipHourRate", label: "设备小时费率", hideInSearchForm: true }, - { prop: "fuelHourRate", label: "燃动小时费率", hideInSearchForm: true }, - { prop: "auxiliaryHourRate", label: "辅料小时费率", hideInSearchForm: true }, - { prop: "otherHourRate", label: "其他小时费率", hideInSearchForm: true }, - { valueType: "date", prop: "effectiveDate", label: "生效日期", hideInSearchForm: true }, - { valueType: "date", prop: "expirationDate", label: "失效日期", hideInSearchForm: true }, - { prop: "guardian", label: "维护人员", hideInSearchForm: true }, - { - type: "operation", - label: "操作", - minWidth: 120, - render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => ( - doAddOrEdit(row) - }, - { - key: "delete", - label: "删除", - onclick: () => doDeleteRows(row) - } - ] - } - /> - ) - }, - ]); + setup() { + const router = useRouter(); + const tableRef = ref(); + const forecastDialogRef = ref(); + const selectionRows = ref([]); + const btnTitle = ref("工时差异"); + // const uploadUrl = ref("/c7525cost/importExcel"); + //列 + const columnsCheck = ref([ + { prop: "type", label: "对比项", hideInSearchForm: true }, + { + label: "金额(单位:元)", + prop: "costCenterCode", + hideInSearchForm: true + }, + { label: "版本1", prop: "factory", hideInSearchForm: true }, + { label: "版本2", prop: "factory", hideInSearchForm: true }, + { label: "差异金额", prop: "factory", hideInSearchForm: true }, + { + type: "operation", + label: "差异分析", + minWidth: 120, + render: ({ row }) => ( + timeVariance(row) + } + ]} + /> + ) + } + ]); + const columns = ref([ + { type: "selection" }, + { prop: "year", label: "内部订单号" }, + { label: "物料号", prop: "costCenterCode" }, + { label: "成本阶段", prop: "factory" }, + { prop: "laborHourRate", label: "版本号", hideInSearchForm: true }, + { prop: "equipHourRate", label: "状态",hideInAddOrEditForm: true}, + { + prop: "fuelHourRate", + label: "总标准成本(版本1)", + hideInSearchForm: true, + hideInAddOrEditForm: true + }, + { + prop: "auxiliaryHourRate", + label: "总标准成本(版本2)", + hideInSearchForm: true, + hideInAddOrEditForm: true + }, + { prop: "otherHourRate", label: "总差额", hideInSearchForm: true,hideInAddOrEditForm: true }, + { prop: "effectiveDate", label: "差额比", hideInSearchForm: true,hideInAddOrEditForm: true }, + { + valueType: "date", + prop: "expirationDate", + label: "创建时间", + hideInSearchForm: true, + hideInAddOrEditForm: true + }, + { + type: "operation", + label: "操作", + minWidth: 120, + render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => ( + checkReport(row) + } + ]} + /> + ) + } + ]); - const render = () => { - return ( -
- { - return transformPageResponse( - await hourRateList({ - pageNo: current, - pageSize, - ...otherSearchParams - }) - ); - }} - curdConfig={{ - /** - * 接受自动表单的数据 - * @param data - */ - async onAddOrEdit(data) { - if (data.id) { - await editHourRate(data) - } else { - await addHourRate(data) - } - }, - /*删除*/ - async onDeleteRows(data) { - if (Array.isArray(data)) { - await deleteBatchHourRate({ ids: data.map(item => item.id).join(',') }) - } else { - await deleteHourRate({ id: data.id }) - } - }, - unitColSpan: 12, - // rules: { - // 'name': [{required:true}] - // }, - }} - v-slots={{ - toolbar: ({ doAddOrEdit, doDeleteRows }) => ( - - 批量导入 - 导出 - - 添加 - - 批量删除 - - ), - }} - /> - { - {/* forecastDialogRef.value.open() */} - }} - v-slots={{ - default: ({ model }) => ( - - - - - -
请上传文件
-
-
- ) - }} - /> -
+ const render = () => { + return ( +
+ { + await new Promise(resolve => + setTimeout(resolve, Math.random() * 1111) + ); + return { + data: Array(pageSize) + .fill(0) + .map((item, index) => ({ + id: Math.random(), + name: "Tom" + current, + date123: "date123" + current, + createTime: new Date().getTime(), + districtName: "区划" + index, + districtName1: "区划1" + index + })), + current, + // pages: 500 / pageSize, + total: 500 + }; + }} + curdConfig={{ + /** + * 接受自动表单的数据 + * @param data + */ + async onAddOrEdit(data) {}, - ); - }; - const handleBatchImport = () => { - forecastDialogRef.value.open() - }; - const handleExport = () => { - console.log(selectionRows.value,"PPPPPPPPPPPPPPPPPP"); - - }; - return render; - }, + unitColSpan: 24 + }} + v-slots={{ + toolbar: ({ doAddOrEdit, doDeleteRows }) => ( + + + 添加对比项 + + + ) + }} + /> + + { + await new Promise(resolve => + setTimeout(resolve, Math.random() * 1111) + ); + return { + data: Array(pageSize) + .fill(0) + .map((item, index) => ({ + id: Math.random(), + name: "Tom" + current, + date123: "date123" + current, + createTime: new Date().getTime(), + districtName: "区划" + index, + districtName1: "区划1" + index, + type: index % 3 + })), + current, + total: 500 + }; + }} + curdConfig={{ + /** + * 接受自动表单的数据 + * @param data + */ + async onAddOrEdit(data) {}, + + unitColSpan: 24 + }} + /> + +
+ ); + }; + const checkReport = () => { + forecastDialogRef.value.open(); + }; + const timeVariance = row => { + if (row.type == 0) { + // 工时 + router.push({ + path: "/standardComparison/manHour", + }); + } else if (row.type == 1) { + // 人工 + router.push({ + path: "/standardComparison/artificial", + }); + } else if (row.type == 2) { + // 材料 + router.push({ + path: "/standardComparison/materials", + }); + } + }; + return render; + } }); diff --git a/vite.config.js b/vite.config.js index 16d222c..2f4d455 100644 --- a/vite.config.js +++ b/vite.config.js @@ -53,26 +53,26 @@ export default defineConfig(({ mode, command }) => { hmr: { overlay: false }, proxy: { // https://cn.vitejs.dev/config/#server-proxy - "/qomo": { + "/newEnergy": { // target: "http://172.16.0.241:8095", //wq // target: "http://172.16.0.162:8082", //bgy - target: "http://172.16.2.127:8082", //bgy远程 - // target: "http://192.168.50.9:2999",//中智平台 + // target: "http://192.168.43.195:8098", //bgy远程 + // target: "http://192.168.50.9:2999",//中制平台 changeOrigin: true, pathRewrite: { - "^/qomo": "/qomo" + "^/newEnergy": "/newEnergy" } }, - "/qomo/flowSocket": { + "/newEnergy/flowSocket": { // target: 'ws://192.168.0.66:60601/',这是后端接口地址 - target: 'ws://172.16.0.162:8082', + // target: 'ws://192.168.43.195:8098', // target: 'ws://192.168.50.99:2999', changeOrigin: true, ws: true }, - "/qomo/taskSocket": { + "/newEnergy/taskSocket": { // target: 'ws://192.168.0.66:60601/',这是后端接口地址 - target: 'ws://172.16.0.162:8082', + // target: 'ws://192.168.43.195:8098', // target: 'ws://192.168.50.99:2999', changeOrigin: true, ws: true