Merge branch 'hcb' of kn-cost/cost-frontend into dev

This commit was merged in pull request #9.
This commit is contained in:
2024-09-14 17:20:15 +08:00
committed by Gitea
4 changed files with 273 additions and 224 deletions
+12
View File
@@ -239,6 +239,18 @@ export const constantRoutes = [
]
},
// Bom,工序,采购价格
{
path: '',
component: Layout,
children: [
{
path: "actualCost",
component: () => import("@/views/actualCost/index"),
name: "ActualCost",
meta: { title: "实际成本", icon: "tree", affix: true }
}
]
},
];
//本地调试默认路由
+103
View File
@@ -0,0 +1,103 @@
<script lang="tsx">
//表格
import { defineComponent, ref } from "vue";
import {
costStandardDetailList,
exportcostStandardDetail
} from "@/api/singleLineQuery.js";
import { transformPageResponse } from "@/utils/qomo";
import { download } from "@qomo-platform/utils";
import { ElMessage } from "element-plus";
export default defineComponent({
setup() {
const tableRef = ref();
//列
const columns = ref([
{ type: "selection" },
{ prop: "materialNumber", label: "内部订单号" },
{ label: "物料号", prop: "versionNumber" },
{ label: "总实际成本", prop: "level", hideInSearchForm: true },
{ label: "材料成本", prop: "figureNumber", hideInSearchForm: true },
{ label: "直接人工", prop: "dosage", hideInSearchForm: true },
{ label: "折旧", prop: "unit", hideInSearchForm: true },
{ label: "燃动力", prop: "materialCost", hideInSearchForm: true },
{ label: "辅料", prop: "laborCost", hideInSearchForm: true },
{ label: "其他费用", prop: "equipmentCost", hideInSearchForm: true },
{ label: "人工工时(分钟)", prop: "driveCost", hideInSearchForm: true },
{
label: "机器工时(分钟)",
prop: "supplyMaterialCost",
hideInSearchForm: true
},
{
type: "operation",
label: "操作",
minWidth: 120,
render: ({ row }) => (
<base-table-operation
btnList={[
{
key: "edit",
label: "查看结构树",
onclick: () => checkTree(row)
},
]}
/>
)
}
]);
const render = () => {
return (
<BaseTable
columns={columns.value}
queryParamsToUrl
toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
ref={tableRef}
issortTable
request={async ({
pageSize = 10,
current = 1,
...otherSearchParams
}) => {
return transformPageResponse(
await costStandardDetailList({
pageNo: current,
pageSize,
...otherSearchParams
})
);
}}
v-slots={{
toolbar: ({ doAddOrEdit }) => (
<el-space>
<el-button type="success" onclick={handleExport}>
批量导出
</el-button>
</el-space>
)
}}
/>
);
};
const handleExport = () => {
exportcostStandardDetail(
tableRef.value.selectionRows
? {
selections: tableRef.value.selectionRows
.map(item => item.id)
.join(",")
}
: {}
).then(res => {
download(res, "费用预测明细.xlsx");
});
};
const checkTree = (row) => {
ElMessage.info("查看结构树");
};
return render;
}
});
</script>
<style lang="scss" scoped></style>
+12 -18
View File
@@ -10,34 +10,28 @@ export default defineComponent({
const tableRef = ref();
const forecastDialogRef = ref();
const selectionRows = ref([]);
const btnTitle = ref("工时差异");
const btnTitle = ref("工时差异");
// const uploadUrl = ref("/c7525cost/importExcel");
//列
const columnsCheck = ref([
{ prop: "type", label: "对比项", hideInSearchForm: true },
{
label: "金额(单位:元)",
label: "实际",
prop: "costCenterCode",
hideInSearchForm: true
},
{ label: "版本1", prop: "factory", hideInSearchForm: true },
{ label: "版本2", prop: "factory", hideInSearchForm: true },
{ label: "差异金额", prop: "factory", hideInSearchForm: true },
{ label: "标准", prop: "factory", hideInSearchForm: true },
{ label: "差值", prop: "factory", hideInSearchForm: true },
{
type: "operation",
label: "差异分析",
label: "挖掘分析",
minWidth: 120,
render: ({ row }) => (
<base-table-operation
btnList={[
{
key: "check",
label:
row.type === 0
? "工时差异"
: row.type === 1
? "人工制费差异"
: "材料成本差异",
label:"查看明细",
onclick: () => timeVariance(row)
}
]}
@@ -47,20 +41,20 @@ export default defineComponent({
]);
const columns = ref([
{ type: "selection" },
{ prop: "year", label: "内部订单号" },
{ prop: "year", label: "工厂号" },
{ label: "物料号", prop: "costCenterCode" },
{ label: "成本阶段", prop: "factory" },
{ prop: "laborHourRate", label: "版本号", hideInSearchForm: true },
{ prop: "equipHourRate", label: "状态",hideInAddOrEditForm: true},
{ prop: "equipHourRate", label: "工单年月",hideInAddOrEditForm: true},
{
prop: "fuelHourRate",
label: "总标准成本(版本1)",
label: "实际总成本",
hideInSearchForm: true,
hideInAddOrEditForm: true
},
{
prop: "auxiliaryHourRate",
label: "总标准成本(版本2)",
label: "标准总成本",
hideInSearchForm: true,
hideInAddOrEditForm: true
},
@@ -75,7 +69,7 @@ export default defineComponent({
},
{
type: "operation",
label: "操作",
label: "报告状态",
minWidth: 120,
render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => (
<base-table-operation
@@ -138,7 +132,7 @@ export default defineComponent({
toolbar: ({ doAddOrEdit, doDeleteRows }) => (
<el-space>
<el-button type="primary" onClick={doAddOrEdit}>
添加对比项
新增挖掘任务
</el-button>
</el-space>
)
+146 -206
View File
@@ -3,214 +3,154 @@
import { defineComponent, ref } from "vue";
import { ElMessage } from "element-plus";
import { transformPageResponse } from "@/utils/qomo";
import { useRouter } from "vue-router";
import { hourRateList, addHourRate, editHourRate, deleteHourRate, deleteBatchHourRate } from '@/api/hour';
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)
}
]}
/>
)
}
]);
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 }) => (
<base-table-operation
btnList={
[{
key: "edit",
label: "编辑",
onclick: () => doAddOrEdit(row)
},
{
key: "delete",
label: "删除",
onclick: () => doDeleteRows(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) {},
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
}) => {
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 }) => (
<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>
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;
}
);
};
const handleBatchImport = () => {
forecastDialogRef.value.open()
};
const handleExport = () => {
console.log(selectionRows.value,"PPPPPPPPPPPPPPPPPP");
};
return render;
},
});
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped></style>