From f673939620847927a42e24629385e3b4cfcde299 Mon Sep 17 00:00:00 2001
From: CD配唱片 <CD配唱片>
Date: 星期四, 24 四月 2025 13:07:52 +0800
Subject: [PATCH] 提交钣金计划大表动态表格
---
src/api/mainPlan/apsPlatePlanList.js | 44 ++++++
src/views/mainPlan/platePlanList/index.vue | 340 ++++++++++++++++++++++++++++++++----------------
src/api/ApsPlateProcessShopStat/ApsPlateProcessShopStat.js | 2
3 files changed, 269 insertions(+), 117 deletions(-)
diff --git a/src/api/ApsPlateProcessShopStat/ApsPlateProcessShopStat.js b/src/api/ApsPlateProcessShopStat/ApsPlateProcessShopStat.js
index 23bad94..a3d3002 100644
--- a/src/api/ApsPlateProcessShopStat/ApsPlateProcessShopStat.js
+++ b/src/api/ApsPlateProcessShopStat/ApsPlateProcessShopStat.js
@@ -3,7 +3,7 @@
// 鏌ヨ閽i噾杞﹂棿缁熻鍒楄〃
export function listApsPlateProcessShopStat(query) {
return request({
- url: '/plateProcessShopStat/list',
+ url: '/aps/plateProcessShopStat/list',
method: 'get',
params: query
})
diff --git a/src/api/mainPlan/apsPlatePlanList.js b/src/api/mainPlan/apsPlatePlanList.js
new file mode 100644
index 0000000..0029c5e
--- /dev/null
+++ b/src/api/mainPlan/apsPlatePlanList.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 鏌ヨ閽i噾杞﹂棿缁熻鍒楄〃
+export function listApsPlateProcessShopStat(query) {
+ return request({
+ url: '/aps/plateProcessShopStat/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// // 鏌ヨ閽i噾杞﹂棿缁熻璇︾粏
+// export function getApsPlateProcessShopStat(id) {
+// return request({
+// url: '/ApsPlateProcessShopStat/ApsPlateProcessShopStat/' + id,
+// method: 'get'
+// })
+// }
+
+// // 鏂板閽i噾杞﹂棿缁熻
+// export function addApsPlateProcessShopStat(data) {
+// return request({
+// url: '/ApsPlateProcessShopStat/ApsPlateProcessShopStat',
+// method: 'post',
+// data: data
+// })
+// }
+
+// // 淇敼閽i噾杞﹂棿缁熻
+// export function updateApsPlateProcessShopStat(data) {
+// return request({
+// url: '/ApsPlateProcessShopStat/ApsPlateProcessShopStat',
+// method: 'put',
+// data: data
+// })
+// }
+
+// // 鍒犻櫎閽i噾杞﹂棿缁熻
+// export function delApsPlateProcessShopStat(id) {
+// return request({
+// url: '/ApsPlateProcessShopStat/ApsPlateProcessShopStat/' + id,
+// method: 'delete'
+// })
+// }
diff --git a/src/views/mainPlan/platePlanList/index.vue b/src/views/mainPlan/platePlanList/index.vue
index d2169d9..2a1437f 100644
--- a/src/views/mainPlan/platePlanList/index.vue
+++ b/src/views/mainPlan/platePlanList/index.vue
@@ -2,21 +2,29 @@
<div class="app-container">
<el-row :gutter="20">
<el-col>
- <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="90px">
+ <el-form
+ :model="queryParams"
+ ref="queryRef"
+ :inline="true"
+ v-show="showSearch"
+ label-width="90px"
+ >
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="宸ュ崟鍙�" prop="num">
<el-input
- v-model="queryParams.workOrderNo"
- placeholder="璇疯緭鍏ラ挘閲戣鍒掑伐鍗曞彿"
- clearable
- @keyup.enter="handleQuery"
+ v-model="queryParams.workOrderNo"
+ placeholder="璇疯緭鍏ラ挘閲戣鍒掑伐鍗曞彿"
+ clearable
+ @keyup.enter="handleQuery"
/>
</el-form-item>
</el-col>
- <el-col :span="12" style="text-align: right;">
+ <el-col :span="12" style="text-align: right">
<el-form-item>
- <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
+ <el-button type="primary" icon="Search" @click="handleQuery"
+ >鎼滅储</el-button
+ >
<el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-col>
@@ -25,51 +33,68 @@
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
-
<el-col :span="1.5">
<el-button
- type="warning"
- plain
- icon="Download"
- @click="handleExport"
- v-hasPermi="['apsPlateProcessStat:export']"
- >瀵煎嚭</el-button>
+ type="warning"
+ plain
+ icon="Download"
+ @click="handleExport"
+ v-hasPermi="['apsPlateProcessStat:export']"
+ >瀵煎嚭</el-button
+ >
</el-col>
<el-col :span="1.5">
<el-button
- type="success"
- plain
- icon="Edit"
- @click="handleUpdate"
- v-hasPermi="['apsPlateProcessStat:edit']"
- >鏇存柊</el-button>
+ type="success"
+ plain
+ icon="Edit"
+ @click="handleUpdate"
+ v-hasPermi="['apsPlateProcessStat:edit']"
+ >鏇存柊</el-button
+ >
</el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+ <right-toolbar
+ v-model:showSearch="showSearch"
+ @queryTable="getList"
+ ></right-toolbar>
</el-row>
<HxlhTable
- style="width: 100%"
- :columns="columns"
- :data="aps_plate_process_statList"
- :loading="loading"
- :height="height"
+ style="width: 100%"
+ ref="xGrid"
+ :key="columnsVersion"
+ :columns="columns"
+ :data="aps_plate_process_statList"
+ :loading="loading"
+ :height="height"
>
</HxlhTable>
<!-- 娣诲姞鎴栦慨鏀归挘閲戠粺璁″璇濇 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
- <el-form ref="aps_plate_process_statRef" :model="form" :rules="rules" label-width="80px">
+ <el-form
+ ref="aps_plate_process_statRef"
+ :model="form"
+ :rules="rules"
+ label-width="80px"
+ >
<el-form-item label="鎺掑簭" prop="num">
<el-input v-model="form.num" placeholder="璇疯緭鍏ユ帓搴�" />
</el-form-item>
<el-form-item label="鐢熶骇鏁伴噺" prop="productionQuantity">
- <el-input v-model="form.productionQuantity" placeholder="璇疯緭鍏ョ敓浜ф暟閲�" />
+ <el-input
+ v-model="form.productionQuantity"
+ placeholder="璇疯緭鍏ョ敓浜ф暟閲�"
+ />
</el-form-item>
<el-form-item label="鏍囧噯宸ユ椂" prop="standardTime">
<el-input v-model="form.standardTime" placeholder="璇疯緭鍏ユ爣鍑嗗伐鏃�" />
</el-form-item>
<el-form-item label="宸ュ簭鎬诲伐鏃�" prop="processTotalTime">
- <el-input v-model="form.processTotalTime" placeholder="璇疯緭鍏ュ伐搴忔�诲伐鏃�" />
+ <el-input
+ v-model="form.processTotalTime"
+ placeholder="璇疯緭鍏ュ伐搴忔�诲伐鏃�"
+ />
</el-form-item>
<el-form-item label="璁捐宸ユ椂" prop="designTimes">
<el-input v-model="form.designTimes" placeholder="璇疯緭鍏ヨ璁″伐鏃�" />
@@ -86,14 +111,17 @@
</template>
<script setup name="Aps_plate_process_stat">
-import { listPlateStat,updateStat } from "@/api/mainPlan/plateProcessStat";
+import { listPlateStat, updateStat } from "@/api/mainPlan/plateProcessStat";
+import { listApsPlateProcessShopStat } from "@/api/mainPlan/apsPlatePlanList";
import HxlhTable from "@/components/HxlhTable/index.vue";
import { getToken } from "@/utils/auth";
-import { ref } from "vue";
-import {ElMessage} from "element-plus";
+import { nextTick, onMounted, ref } from "vue";
+import { ElMessage } from "element-plus";
const { proxy } = getCurrentInstance();
const aps_plate_process_statList = ref([]);
+const dynamicList = ref([]);
+const generateColumnList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
@@ -101,9 +129,8 @@
const multiple = ref(true);
const total = ref(0);
const title = ref("");
-const height = ref(document.documentElement.clientHeight - 270 + "px;")
-
-
+const height = ref(document.documentElement.clientHeight - 270 + "px;");
+const columnsVersion = ref(0);
const data = reactive({
form: {},
queryParams: {
@@ -122,93 +149,161 @@
designTimes: null,
batchNumber: null,
},
- rules: {
- }
+ rules: {},
});
-
+const xGrid = ref();
const { queryParams, form, rules } = toRefs(data);
-
// 琛ㄦ牸閰嶇疆
const columns = ref([
-/* { type: 'seq', title: '搴忓彿', width: 60 },*/
+ /* { type: 'seq', title: '搴忓彿', width: 60 },*/
{
- title: '宸ュ崟鍙�',
- field: 'workOrderNo',
+ title: "涓讳欢鏂欏彿",
+ field: "mainPartNumber",
width: 150,
- } ,
- {
- title: '宸ュ簭鍚嶇О',
- field: 'processName',
},
{
- title: '宸ュ簭鍙�',
- field: 'routeProcessNumberTxt',
+ title: "涓氬姟绫诲瀷",
+ field: "businessType",
+ },
+ {
+ title: "鍗曟嵁鍙�",
+ field: "documentNumber",
width: 100,
},
{
- title: '褰撳墠宸ュ簭鍙�',
- field: 'currentProcessNumberTxt',
+ title: "褰撳墠宸ュ簭鍙�",
+ field: "currentProcessNumberTxt",
width: 100,
},
{
- title: '鐢熶骇鏁伴噺',
- field: 'productionQuantity',
+ title: "闇�姹傚垎绫�",
+ field: "requirementType",
width: 80,
},
{
- title: '鏍囧噯宸ユ椂',
- field: 'standardTime',
+ title: "鍗曟嵁鐘舵��",
+ field: "documentStatus",
width: 80,
},
{
- title: '宸ュ簭鎬诲伐鏃�',
- field: 'processTotalTime',
+ title: "褰撳墠宸ュ簭",
+ field: "workCenter",
width: 80,
-
},
{
- title: '璁″垝寮�宸ユ棩',
- field: 'processPlanStartDaytxt',
+ title: "璁″垝寮�宸ユ棩",
+ field: "processPlanStartDaytxt",
width: 140,
- type:'html'
+ type: "html",
},
{
- title: '璁″垝瀹屽伐鏃�',
- field: 'processPlanEndDaytxt',
+ title: "鏂欏彿",
+ field: "itemNumber",
width: 140,
- type:'html'
+ type: "html",
},
{
- title: '璁㈠崟瀹屽伐鏃�',
- field: 'orderPlanEndDay',
+ title: "鍥惧彿",
+ field: "drawingNo",
width: 120,
- format: 'YYYY-MM-DD'
- }
+ // format: 'YYYY-MM-DD'
+ },
+ {
+ title: "鐗堟湰鍙�",
+ field: "versionNumber",
+ width: 140,
+ type: "html",
+ },
+ {
+ title: "鐢熶骇鏁伴噺",
+ field: "productionQuantity",
+ width: 140,
+ type: "html",
+ },
+ {
+ title: "璁″垝瀹屽伐鏃�",
+ field: "planEndDay",
+ width: 140,
+ format: "YYYY-MM-DD hh:mm:ss",
+ },
]);
-
-
/** 鏌ヨ閽i噾缁熻鍒楄〃 */
-function getList() {
+async function getList() {
loading.value = true;
- listPlateStat(queryParams.value).then(response => {
- const listValue = response.rows;
- listValue.forEach(listItem => {
- listItem[`processPlanStartDaytxt`]= listItem.warning? `<font color="red">${listItem.processPlanStartDay}</font>` :listItem.processPlanStartDay;
- listItem[`processPlanEndDaytxt`]= listItem.warning? `<font color="red">${listItem.processPlanEndDay}</font>` :listItem.processPlanEndDay;
- listItem[`routeProcessNumberTxt`]= listItem.routeProcessNumber.toString().padStart(3, '0');
- listItem[`currentProcessNumberTxt`]= listItem.currentProcessNumber.toString().padStart(3, '0');
-
-
+ const response = await listApsPlateProcessShopStat(queryParams.value);
+ const listValue = response.data;
+ const resData = listValue.map((item,index)=>{
+ item.deptPlans.map((n, i) => {
+ item[`${i}_startDate`] = n.planStartDate
+ item[`${i}_endDate`] = n.planEndDate
});
- aps_plate_process_statList.value =listValue
- debugger;
- total.value = response.total;
- loading.value = false;
- });
+ return {
+ ...item
+ }
+ })
+ console.log(resData,'resDataresDataresData')
+ dynamicList.value = response.shopNames;
+ aps_plate_process_statList.value = listValue;
+ total.value = response.total;
+ loading.value = false;
+ await nextTick();
+ const newArray = dynamicList.value.flatMap((item, index) => [
+ {
+ title: `${item}寮�濮嬫椂闂碻,
+ field:`${index}_startDate`,
+ width: 140,
+ formatter: ({ cellValue, row, column }) => {
+ let dateStr = "";
+ if (cellValue) {
+ row.deptPlans.map((n, i) => {
+ if (item === n.shopName) {
+ // console.log(
+ // item,
+ // n.shopName,
+ // n.planStartDate,
+ // `${item}寮�濮嬫椂闂碻,
+ // "planStartDate"
+ // );
+ dateStr = n.planStartDate;
+ }
+ });
+ }
+ return dateStr
+ },
+ },
+ {
+ title: `${item}缁撴潫鏃堕棿`,
+ field:`${index}_endDate`,
+ width: 140,
+ formatter: ({ cellValue, row, column }) => {
+ let dateStr = "";
+ if (cellValue) {
+ row.deptPlans.map((n, i) => {
+ if (item === n.shopName) {
+ // console.log(
+ // item,
+ // n.shopName,
+ // n.planStartDate,
+ // `${item}寮�濮嬫椂闂碻,
+ // "planStartDate"
+ // );
+ dateStr = n.planEndDate;
+ }
+ });
+ }
+ return dateStr
+ },
+ },
+ ]);
+ await nextTick();
+ console.log(xGrid.value, "llll");
+ columns.value = [...columns.value, ...newArray]; // 寮哄埗缁勪欢閲嶆柊娓叉煋
+
}
+function generateColumnDynamic() {}
// 鍙栨秷鎸夐挳
function cancel() {
open.value = false;
@@ -232,7 +327,7 @@
designTimes: null,
batchNumber: null,
createBy: null,
- delFlag: null
+ delFlag: null,
};
proxy.resetForm("aps_plate_process_statRef");
}
@@ -245,14 +340,14 @@
/** 閲嶇疆鎸夐挳鎿嶄綔 */
function resetQuery() {
- queryParams.value.workOrderNo ='';
+ queryParams.value.workOrderNo = "";
proxy.resetForm("queryRef");
handleQuery();
}
// 澶氶�夋閫変腑鏁版嵁
function handleSelectionChange(selection) {
- ids.value = selection.map(item => item.id);
+ ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@@ -267,28 +362,28 @@
/** 淇敼鎸夐挳鎿嶄綔 */
function handleUpdate(row) {
reset();
- updateStat().then(response => {
+ updateStat().then((response) => {
form.value = response.data;
ElMessage({
- message: '鏁版嵁鏇存柊鎴愬姛',
- type: 'success',
- })
+ message: "鏁版嵁鏇存柊鎴愬姛",
+ type: "success",
+ });
getList();
});
}
/** 鎻愪氦鎸夐挳 */
function submitForm() {
- proxy.$refs["aps_plate_process_statRef"].validate(valid => {
+ proxy.$refs["aps_plate_process_statRef"].validate((valid) => {
if (valid) {
if (form.value.id != null) {
- updateAps_plate_process_stat(form.value).then(response => {
+ updateAps_plate_process_stat(form.value).then((response) => {
proxy.$modal.msgSuccess("淇敼鎴愬姛");
open.value = false;
getList();
});
} else {
- addAps_plate_process_stat(form.value).then(response => {
+ addAps_plate_process_stat(form.value).then((response) => {
proxy.$modal.msgSuccess("鏂板鎴愬姛");
open.value = false;
getList();
@@ -301,41 +396,54 @@
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
function handleDelete(row) {
const _ids = row.id || ids.value;
- proxy.$modal.confirm('鏄惁纭鍒犻櫎閽i噾缁熻缂栧彿涓�"' + _ids + '"鐨勬暟鎹」锛�').then(function() {
- return delAps_plate_process_stat(_ids);
- }).then(() => {
- getList();
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- }).catch(() => {});
+ proxy.$modal
+ .confirm('鏄惁纭鍒犻櫎閽i噾缁熻缂栧彿涓�"' + _ids + '"鐨勬暟鎹」锛�')
+ .then(function () {
+ return delAps_plate_process_stat(_ids);
+ })
+ .then(() => {
+ getList();
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ })
+ .catch(() => {});
}
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
- proxy.download('/aps/plateProcessStat/export', {
- ...queryParams.value
- }, `aps_plate_process_stat_${new Date().getTime()}.xlsx`)
+ proxy.download(
+ "/aps/plateProcessStat/export",
+ {
+ ...queryParams.value,
+ },
+ `aps_plate_process_stat_${new Date().getTime()}.xlsx`
+ );
}
const headerCellClassName = ({ column }) => {
- if (column.field === 'name') {
- return 'col-blue'
+ if (column.field === "name") {
+ return "col-blue";
}
- return null
-}
+ return null;
+};
const rowClassName = ({ rowIndex }) => {
if ([2, 3, 5].includes(rowIndex)) {
- return 'row-green'
+ return "row-green";
}
- return null
-}
+ return null;
+};
const cellClassName = ({ row, column }) => {
- if (column.field === 'processPlanStartDay'||column.field === 'processPlanEndDay') {
+ if (
+ column.field === "processPlanStartDay" ||
+ column.field === "processPlanEndDay"
+ ) {
if (row.warning) {
- return 'col-orange'
+ return "col-orange";
}
}
- return null
-}
-getList();
+ return null;
+};
+onMounted(async () => {
+ getList();
+});
</script>
<style lang="scss" scoped>
::v-deep(.mytable-style.vxe-table .vxe-body--row.row-green) {
@@ -350,4 +458,4 @@
background-color: red;
color: #fff;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3