This commit is contained in:
bwm
2024-08-30 16:56:07 +08:00
parent 49855f198a
commit 5f59baf186
15 changed files with 1119 additions and 381 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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",
+1
View File
@@ -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";
+44 -44
View File
@@ -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();
+25 -12
View File
@@ -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,工序,采购价格
];
+1 -1
View File
@@ -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;
+30 -3
View File
@@ -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,
+189 -34
View File
@@ -1,32 +1,61 @@
<script lang="tsx">
//表格
import { defineComponent, ref } from "vue";
import { defineComponent, ref, watch } from "vue";
import { ElMessage } from "element-plus";
import Calculate from "./component/calculate.vue";
import { transformPageResponse } from "@/utils/qomo";
import { costStandardList,deleteCostStandard } from '@/api/costCalculation';
import { costStandardList, deleteCostStandard } from "@/api/costCalculation";
import { costStandardVersionAdd } from "@/api/costCalculation";
import { modelList } from "@/api/modelManagement";
export default defineComponent({
setup() {
const tableRef = ref();
const visible = ref(false);
const forecastDialogRef = ref();
const forecastDialogRefNum = ref();
const formData = ref({
drawingNo: "",
stage: "",
createTime: "",
costVersion: "",
materialNo: "",
year: "",
flowDefinitionId: ""
});
const rileForm = ref();
const modelSelect = ref([]);
//列
const columns = ref([
{ type: "selection" },
{ label: "版本号", prop: "costVersion" },
{ label: "年份", prop: "year", valueType: "year" },
{ label: "物料编号", prop: "materialNo" },
{ label: "创建日期", prop: "createTime", hideInSearchForm: true, valueType: "datetime" },
{ label: "阶段", prop: "stage", valueType: 'dict-select', extraProps: { dictType: 'stageData' } },
{ label: "状态", prop: "status",valueType: 'dict-select',extraProps: { dictType: 'statusList' } },
{
label: "创建日期",
prop: "createTime",
hideInSearchForm: true,
valueType: "datetime"
},
{
label: "阶段",
prop: "stage",
valueType: "dict-select",
extraProps: { dictType: "stageData" }
},
{
label: "状态",
prop: "status",
valueType: "dict-select",
extraProps: { dictType: "statusList" }
},
{
type: "operation",
label: "操作",
minWidth: 200,
render: ({ row, doAddOrEdit, doDeleteRows, doReload, doPreview }) => (
<base-table-operation
btnList={
[{
btnList={[
{
key: "edit",
label: "重新计算",
onclick: () => doAddOrEdit(row)
@@ -38,28 +67,32 @@ export default defineComponent({
},
{
key: "deletion",
label: "部件缺失信息",
label: "部件缺失信息"
},
{
key: "preview",
label: "查看详情",
onclick: () => doPreview(row)
}
]
}
]}
/>
)
},
}
]);
const render = () => {
return (
<div>
<BasePageContainer flex-hidden={true} style={{ width: "100%", height: "800px", padding: "0" }}>
<BasePageContainer
flex-hidden={true}
style={{ width: "100%", height: "800px", padding: "0" }}
>
<BaseTable
columns={columns.value}
queryParamsToUrl
toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
toolbar={{
layout: "search-dnamic,reload,column-setting,fullscreen"
}}
ref={tableRef}
request={async ({
pageSize = 10,
@@ -76,20 +109,20 @@ export default defineComponent({
);
tableData.data.forEach(item => {
if (item.stage == "A") {
item.stage = "初始"
item.stage = "初始";
} else if (item.stage == "B") {
item.stage = "量产"
item.stage = "量产";
} else if (item.stage == "C") {
item.stage = "首批"
item.stage = "首批";
}
})
});
return tableData;
}}
curdConfig={{
unitColSpan: 12,
async onDeleteRows(data) {
await deleteCostStandard({ id: data.id })
},
await deleteCostStandard({ id: data.id });
}
}}
v-slots={{
toolbar: () => (
@@ -97,14 +130,101 @@ export default defineComponent({
<el-button type="primary" onClick={calculate}>
计算标准成本
</el-button>
<el-button type="success" onClick={batchCalculate}>批量计算</el-button>
<el-button type="info" onClick={batchExport}>批量导出</el-button>
<el-button type="success" onClick={batchCalculate}>
批量计算
</el-button>
<el-button type="info" onClick={batchExport}>
批量导出
</el-button>
</el-space>
),
)
}}
/>
</BasePageContainer>
<Calculate visible={visible.value} onCancelVisible={cancelVisible} tableRef={tableRef.value}></Calculate>
<base-dialog-form
ref={forecastDialogRefNum}
v-model={visible.value}
title={"生成设置版本号"}
width={400}
labelWidth={0}
confirm={() => {
const year = formData.value.createTime.split("-")[0];
formData.value.year = year;
costStandardVersionAdd(formData.value).then(res => {
tableRef.value.doReload();
});
}}
cancel={() => {
}}
>
<el-form
ref={rileForm}
v-model={formData.value}
label-width="100px"
>
<el-form-item label="图号" prop="drawingNo">
<el-input
v-model={formData.value.drawingNo}
onChange={splicing}
/>
</el-form-item>
<el-form-item label="物料号" prop="materialNo">
<el-input v-model={formData.value.materialNo} />
</el-form-item>
<el-form-item label="项目阶段" prop="stage">
<el-select
v-model={formData.value.stage}
placeholder="请选择项目阶段"
onChange={splicing}
>
<el-option label="初始" value="A"></el-option>
<el-option label="量产" value="B"></el-option>
<el-option label="首批" value="C"></el-option>
</el-select>
</el-form-item>
<el-form-item label="选择模型" prop="stage">
<el-select
v-model={formData.value.flowDefinitionId}
placeholder="请选择项目阶段"
onChange={splicing}
>
{modelSelect.value.map(item => (
<ElOption
key={item.value}
label={item.label}
value={item.value}
/>
))}
</el-select>
</el-form-item>
<el-form-item label="创建日期" prop="createTime">
<el-date-picker
v-model={formData.value.createTime}
type="datetime"
disabledDate={time => {
return time.getTime() > Date.now();
}}
value-format="YYYY-MM-DD HH:MM:ss"
onChange={splicing}
placeholder="选择日期"
></el-date-picker>
</el-form-item>
<el-form-item label="生成版本号" prop="costVersion">
<el-input
type="textarea"
disabled
rows="2"
v-model={formData.value.costVersion}
/>
</el-form-item>
</el-form>
</base-dialog-form>
{/* <Calculate
visible={visible.value}
onCancelVisible={cancelVisible}
tableRef={tableRef.value}
></Calculate> */}
<base-dialog-form
ref={forecastDialogRef}
title={"批量计算"}
@@ -116,7 +236,9 @@ export default defineComponent({
]
}}
confirm={() => {
{/* forecastDialogRef.value.open(); */ }
{
/* forecastDialogRef.value.open(); */
}
}}
cancel={() => {
forecastDialogRef.value.close();
@@ -146,30 +268,63 @@ export default defineComponent({
};
const calculate = () => {
visible.value = true;
}
};
const cancelVisible = () => {
visible.value = false;
}
};
const batchCalculate = () => {
forecastDialogRef.value.open();
}
};
const batchExport = () => {
console.log(tableRef.value.selectionRows, "批量导出");
}
const onChange = (file) => {
};
const onChange = file => {
console.log(file, "PPPPPPPPPPPPPPPPPPPP");
const isExcel = file.raw.type === 'application/vnd.ms-excel' ||
file.raw.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
const isExcel =
file.raw.type === "application/vnd.ms-excel" ||
file.raw.type ===
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
if (!isExcel) {
ElMessage.error('只能上传Excel文件!');
ElMessage.error("只能上传Excel文件!");
return false;
}
return true;
};
const splicing = () => {
formData.value.costVersion = "";
formData.value.costVersion =
formData.value.drawingNo +
"_" +
formData.value.stage +
"_" +
formData.value.createTime;
};
watch(visible, (newVal, oldVal) => {
if (newVal) {
formData.value = {
drawingNo: "",
stage: "",
createTime: "",
costVersion: "",
materialNo: "",
year: "",
flowDefinitionId: ""
};
modelList({ pageNo: 1, pageSize: 999, projectId: 49 }).then(res => {
modelSelect.value = res.records.map(item => {
return {
value: item.id,
label: item.name
};
});
console.log(modelSelect.value, "PPPPPPPPPPPPPPPPPPPPP");
});
}
const doReload = () => { }
});
const doReload = () => {};
return render;
},
}
});
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,118 @@
<script lang="tsx">
//表格
import { defineComponent, ref } from "vue";
import { ElMessage } from "element-plus";
import { useRouter } from 'vue-router';
export default defineComponent({
setup() {
const tableRef = ref();
const router = useRouter();
//列
const columns = ref([
{ prop: "districtName", label: "内部订单号",hideInSearchForm: true },
{ label: "物料编码", prop: "name",hideInSearchForm: true },
{ label: "物料信息", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "成本中心代码" ,hideInSearchForm: true },
{ prop: "districtName", label: "成本中心名称",hideInSearchForm: true },
{ label: "基于成品结构用量(版本1)", prop: "name",hideInSearchForm: true },
{ label: "单个零件报工工时(版本1)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "人工工时(版本1)" ,hideInSearchForm: true },
{ prop: "districtName", label: "人工费率(版本1)",hideInSearchForm: true },
{ label: "基于成品结构用量(版本2)", prop: "name",hideInSearchForm: true },
{ label: "单个零件报工工时(版本2)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "人工工时(版本2)" ,hideInSearchForm: true },
{ prop: "districtName", label: "人工费率(版本2)",hideInSearchForm: true },
{ label: "人工差价", prop: "name",hideInSearchForm: true },
{ label: "人工量差", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "人工总差" ,hideInSearchForm: true },
{ prop: "districtName", label: "基于成品结构用量(版本1)",hideInSearchForm: true },
{ label: "单个零件报工工时(版本1)", prop: "name",hideInSearchForm: true },
{ label: "燃动力工时(版本1)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "燃动力费率(版本1)" ,hideInSearchForm: true },
{ prop: "districtName", label: "基于成品结构用量(版本2)",hideInSearchForm: true },
{ label: "单个零件报工工时(版本2)", prop: "name",hideInSearchForm: true },
{ label: "燃动力工时(版本2)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "燃动力费率(版本2)" ,hideInSearchForm: true },
{ prop: "districtName", label: "燃动力价差",hideInSearchForm: true },
{ label: "燃动力量差", prop: "name",hideInSearchForm: true },
{ label: "燃动力总差", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "基于成品结构用量(版本1)" ,hideInSearchForm: true },
{ prop: "districtName", label: "单个零件报工工时(版本1)",hideInSearchForm: true },
{ label: "辅料工时(版本1)", prop: "name",hideInSearchForm: true },
{ label: "辅料费率(版本1)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "基于成品结构用量(版本2)" ,hideInSearchForm: true },
{ prop: "districtName", label: "单个零件报工工时(版本2)",hideInSearchForm: true },
{ label: "辅料工时(版本2)", prop: "name",hideInSearchForm: true },
{ label: "辅料费率(版本2)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "辅料价差" ,hideInSearchForm: true },
{ prop: "districtName", label: "辅料量差",hideInSearchForm: true },
{ label: "辅料总差", prop: "name",hideInSearchForm: true },
{ label: "基于成品结构用量(版本1)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "单个零件报工工时(版本1)" ,hideInSearchForm: true },
{ prop: "districtName", label: "其他工时(版本1)",hideInSearchForm: true },
{ label: "其他费率(版本1)", prop: "name",hideInSearchForm: true },
{ label: "基于成品结构用量(版本2)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "单个零件报工工时(版本2)" ,hideInSearchForm: true },
{ prop: "districtName", label: "其他工时(版本2)",hideInSearchForm: true },
{ label: "其他费率(版本2)", prop: "name",hideInSearchForm: true },
{ label: "其他价差", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "其他量差" ,hideInSearchForm: true },
{ prop: "districtName", label: "其他总差",hideInSearchForm: true },
]);
const render = () => {
return (
<BaseTable
columns={columns.value}
queryParamsToUrl
ref={tableRef}
request={async ({ pageSize = 10, current = 1, ...otherSearchParams }) => {
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={{
}}
v-slots={{
toolbar: ({ doAddOrEdit }) => (
<el-space>
<el-button type="danger" onClick={toBack}>返回</el-button>
</el-space>
),
}}
/>
);
};
const toBack = ()=>{
router.go(-1);
}
return render;
},
});
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,73 @@
<script lang="tsx">
//表格
import { defineComponent, ref } from "vue";
import { ElMessage } from "element-plus";
import { useRouter } from 'vue-router';
export default defineComponent({
setup() {
const tableRef = ref();
const router = useRouter();
//列
const columns = ref([
{ prop: "districtName", label: "成本中心代码",hideInSearchForm: true },
{ label: "成本中心代码名称", prop: "name",hideInSearchForm: true },
{ label: "基于成品结构用量(版本1)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "单个零件报工工时(版本1)" ,hideInSearchForm: true },
{ prop: "districtName", label: "人工工时(版本1)",hideInSearchForm: true },
{ label: "基于成品结构用量(版本2)", prop: "name",hideInSearchForm: true },
{ label: "单个零件报工工时(版本2)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "人工工时(版本2)" ,hideInSearchForm: true },
{ prop: "districtName", label: "人工工时总差",hideInSearchForm: true },
{ label: "基于成品结构用量(版本1)", prop: "name",hideInSearchForm: true },
{ label: "单个零件报工工时(版本1)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "机器工时(版本1)" ,hideInSearchForm: true },
{ prop: "districtName", label: "基于成品结构用量(版本2)",hideInSearchForm: true },
{ label: "单个零件报工工时(版本2)", prop: "name",hideInSearchForm: true },
{ label: "机器工时(版本2)", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "机器工时总差" ,hideInSearchForm: true },
]);
const render = () => {
return (
<BaseTable
columns={columns.value}
queryParamsToUrl
ref={tableRef}
request={async ({ pageSize = 10, current = 1, ...otherSearchParams }) => {
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={{
}}
v-slots={{
toolbar: ({ doAddOrEdit }) => (
<el-space>
<el-button type="danger" onClick={toBack}>返回</el-button>
</el-space>
),
}}
/>
);
};
const toBack = ()=>{
router.go(-1);
}
return render;
},
});
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,75 @@
<script lang="tsx">
//表格
import { defineComponent, ref } from "vue";
import { ElMessage } from "element-plus";
import { useRouter } from 'vue-router';
export default defineComponent({
setup() {
const tableRef = ref();
const router = useRouter();
//列
const columns = ref([
{ prop: "districtName", label: "单位",hideInSearchForm: true },
{ label: "采购类型", prop: "name",hideInSearchForm: true },
{ label: "特殊采购类型", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "结构用量" ,hideInSearchForm: true },
{ prop: "districtName", label: "单位材料价格",hideInSearchForm: true },
{ label: "单位总成本", prop: "name",hideInSearchForm: true },
{ label: "版本1", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "结构用量" ,hideInSearchForm: true },
{ prop: "districtName", label: "单位材料价格",hideInSearchForm: true },
{ label: "单位总成本", prop: "name",hideInSearchForm: true },
{ label: "版本2", prop: "date123",hideInSearchForm: true },
{ prop: "createTime", label: "结构用量量差" ,hideInSearchForm: true },
{ prop: "districtName", label: "材料价格价差",hideInSearchForm: true },
{ label: "单位成本差异", prop: "name",hideInSearchForm: true },
{ label: "备注", prop: "date123",hideInSearchForm: true },
]);
const render = () => {
return (
<BaseTable
columns={columns.value}
queryParamsToUrl
ref={tableRef}
request={async ({ pageSize = 10, current = 1, ...otherSearchParams }) => {
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={{
}}
v-slots={{
toolbar: ({ doAddOrEdit }) => (
<el-space>
<el-button type="danger" onClick={toBack}>返回</el-button>
</el-space>
),
}}
/>
);
};
const toBack = ()=>{
router.go(-1);
}
return render;
},
});
</script>
<style lang="scss" scoped></style>
+216
View File
@@ -0,0 +1,216 @@
<script lang="tsx">
//表格
import { defineComponent, ref } from "vue";
import { ElMessage } from "element-plus";
import { transformPageResponse } from "@/utils/qomo";
import { useRouter } from "vue-router";
export default defineComponent({
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 }) => (
<base-table-operation
btnList={[
{
key: "check",
label:
row.type === 0
? "工时差异"
: row.type === 1
? "人工制费差异"
: "材料成本差异",
onclick: () => 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 }) => (
<base-table-operation
btnList={[
{
key: "check",
label: "查看报告",
onclick: () => checkReport(row)
}
]}
/>
)
}
]);
const render = () => {
return (
<div>
<BaseTable
columns={columns.value}
ref={tableRef}
selectionRows={selectionRows.value}
toolbar={{
layout: "search-dnamic,reload,column-setting,fullscreen"
}}
request={async ({
pageSize = 10,
current = 1,
...otherSearchParams
}) => {
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) {},
unitColSpan: 24
}}
v-slots={{
toolbar: ({ doAddOrEdit, doDeleteRows }) => (
<el-space>
<el-button type="primary" onClick={doAddOrEdit}>
添加对比项
</el-button>
</el-space>
)
}}
/>
<BaseDialog
title="报告详情"
width="80%"
ref={forecastDialogRef}
confirmButtonProps={false}
>
<BaseTable
columns={columnsCheck.value}
ref={tableRef}
selectionRows={selectionRows.value}
request={async ({ pageSize = 10, current = 1 }) => {
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
}}
/>
</BaseDialog>
</div>
);
};
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;
}
});
</script>
<style lang="scss" scoped></style>
+153 -93
View File
@@ -3,49 +3,92 @@
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 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 }) => (
<base-table-operation
btnList={[
{
key: "check",
label:
row.type === 0
? "工时差异"
: row.type === 1
? "人工制费差异"
: "材料成本差异",
onclick: () => timeVariance(row)
}
]}
/>
)
}
]);
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 },
{ 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 }) => (
<base-table-operation
btnList={
[{
key: "edit",
label: "编辑",
onclick: () => doAddOrEdit(row)
},
btnList={[
{
key: "delete",
label: "删除",
onclick: () => doDeleteRows(row)
}
]
key: "check",
label: "查看报告",
onclick: () => checkReport(row)
}
]}
/>
)
},
}
]);
const render = () => {
@@ -54,103 +97,120 @@ export default defineComponent({
<BaseTable
columns={columns.value}
ref={tableRef}
selectionRows = {selectionRows.value}
toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
selectionRows={selectionRows.value}
toolbar={{
layout: "search-dnamic,reload,column-setting,fullscreen"
}}
request={async ({
pageSize = 10,
current = 1,
...otherSearchParams
}) => {
return transformPageResponse(
await hourRateList({
pageNo: current,
pageSize,
...otherSearchParams
})
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) {
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}]
// },
async onAddOrEdit(data) {},
unitColSpan: 24
}}
v-slots={{
toolbar: ({ doAddOrEdit, doDeleteRows }) => (
<el-space>
<el-button type="success" onclick={handleBatchImport}>批量导入</el-button>
<el-button type="success" onclick={handleExport}>导出</el-button>
<el-button type="primary" onClick={doAddOrEdit}>
添加
添加对比项
</el-button>
<el-button type="warning" onClick={doDeleteRows}>批量删除</el-button>
</el-space>
),
}}
/>
<base-dialog-form
ref={forecastDialogRef}
title={"批量导入文件"}
width={400}
labelWidth={0}
rules={{
filed: [
{ required: true, message: "请上传附件", trigger: "blur" }
]
}}
confirm= { () =>{
{/* forecastDialogRef.value.open() */}
}}
v-slots={{
default: ({ model }) => (
<el-form-item label="" prop="filed">
<base-upload
dragx
multiple
limit={1}
v-model={model.fileIds}
>
<el-icon>
<upload-filled />
</el-icon>
<div class="w-full">请上传文件</div>
</base-upload>
</el-form-item>
)
}}
/>
</div>
<BaseDialog
title="报告详情"
width="80%"
ref={forecastDialogRef}
confirmButtonProps={false}
>
<BaseTable
columns={columnsCheck.value}
ref={tableRef}
selectionRows={selectionRows.value}
request={async ({ pageSize = 10, current = 1 }) => {
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
}}
/>
</BaseDialog>
</div>
);
};
const handleBatchImport = () => {
forecastDialogRef.value.open()
const checkReport = () => {
forecastDialogRef.value.open();
};
const handleExport = () => {
console.log(selectionRows.value,"PPPPPPPPPPPPPPPPPP");
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;
},
}
});
</script>
<style lang="scss" scoped></style>
+8 -8
View File
@@ -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