From b8cc0dbcae5d9d4a62d8462f914429d5b7b03d6a Mon Sep 17 00:00:00 2001
From: dy <dingyang@lnfxkj.tech>
Date: 星期一, 14 四月 2025 20:41:30 +0800
Subject: [PATCH] 焊缝统计页面
---
src/api/mainPlan/weldSeam/weldSeam.js | 2
src/components/HxlhTable/index.vue | 4
src/views/partPlan/index.vue | 4
src/views/mainPlan/weldSeam/index.vue | 151 +++++++++++++++++++++++++++++++++++++++-----------
4 files changed, 123 insertions(+), 38 deletions(-)
diff --git a/src/api/mainPlan/weldSeam/weldSeam.js b/src/api/mainPlan/weldSeam/weldSeam.js
index 0994c01..6ae30f0 100644
--- a/src/api/mainPlan/weldSeam/weldSeam.js
+++ b/src/api/mainPlan/weldSeam/weldSeam.js
@@ -29,7 +29,7 @@
// 淇敼鐒婄紳
export function updateWeldSeam(data) {
return request({
- url: '/weldSeam/weldSeam',
+ url: '/aps/weldSeamStatistics',
method: 'put',
data: data
})
diff --git a/src/components/HxlhTable/index.vue b/src/components/HxlhTable/index.vue
index 111a639..8de4a38 100644
--- a/src/components/HxlhTable/index.vue
+++ b/src/components/HxlhTable/index.vue
@@ -32,8 +32,8 @@
@checkbox-change="checkChange"
@checkbox-all="checkChangeall"
>
- <template v-slot:buttons>
- <slot name="buttons"/>
+ <template v-slot:buttons="row">
+ <slot name="buttons" v-bind="row"/>
</template>
</vxe-grid>
</div>
diff --git a/src/views/mainPlan/weldSeam/index.vue b/src/views/mainPlan/weldSeam/index.vue
index 9b73426..38a3d5d 100644
--- a/src/views/mainPlan/weldSeam/index.vue
+++ b/src/views/mainPlan/weldSeam/index.vue
@@ -33,6 +33,7 @@
>
<template #buttons="{row}">
<vxe-button mode="text" @click="viewEvent(row)">缂栬緫</vxe-button>
+ <!-- <vxe-button mode="text" @row-click="viewEvent(row.year)">缂栬緫</vxe-button> -->
</template>
</HxlhTable>
@@ -110,53 +111,43 @@
<el-dialog :title="title" v-model="open" width="700px" append-to-body>
<el-form ref="weldSeamRef" :model="form" :rules="rules" label-width="150px">
<el-form-item label="骞翠唤" prop="year">
- <el-input v-model="form.year" placeholder="骞翠唤" :disabled="isDisabled"/>
+ <el-input v-model="form.year" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="鏈堜唤" prop="month">
- <el-input v-model="form.month" placeholder="鏈堜唤" :disabled="isDisabled"/>
+ <el-input v-model="form.month" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="鐢熶骇鍩哄湴" prop="productionBase">
- <el-input v-model="form.productionBase" placeholder="鐢熶骇鍩哄湴" :disabled="isDisabled"/>
+ <el-input v-model="form.productionBase" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="绠¤矾璁㈠崟闇�姹�" prop="pipingOrderRequirement">
- <el-input v-model="form.pipingOrderRequirement" placeholder="绠¤矾璁㈠崟闇�姹�" :disabled="isDisabled"/>
+ <el-input v-model="form.pipingOrderRequirement" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="姘旀煖璁㈠崟闇�姹�" prop="gasOrderRequirement">
- <el-input v-model="form.gasOrderRequirement" placeholder="姘旀煖璁㈠崟闇�姹�" :disabled="isDisabled"/>
+ <el-input v-model="form.gasOrderRequirement" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="绠¤矾棰勬祴闇�姹�" prop="pipingPredictionRequirement">
- <el-input v-model="form.pipingPredictionRequirement" placeholder="绠¤矾棰勬祴闇�姹�" :disabled="isDisabled"/>
+ <el-input v-model="form.pipingPredictionRequirement" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="姘旀煖棰勬祴闇�姹�" prop="gasPredictionRequirement">
- <el-input v-model="form.gasPredictionRequirement" placeholder="姘旀煖棰勬祴闇�姹�" :disabled="isDisabled"/>
+ <el-input v-model="form.gasPredictionRequirement" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="棰勭暀绱ф�ヨ鍗曚骇鍑�" prop="reserveEmergencyOrderOutput">
- <el-input v-model="form.reserveEmergencyOrderOutput" placeholder="璇疯緭棰勭暀绱ф�ヨ鍗曚骇鍑�" :disabled="isDisabled"/>
+ <el-input-number :min="0" v-model="form.reserveEmergencyOrderOutput" placeholder="璇疯緭棰勭暀绱ф�ヨ鍗曚骇鍑�"/>
</el-form-item>
<el-form-item label="鍚堣" prop="total">
- <el-input v-model="form.total" placeholder="璇疯緭鍏ュ悎璁�" :disabled="isDisabled"/>
+ <el-input v-model="form.total" :disabled="isDisabled"/>
</el-form-item>
- <el-form-item label="澶╂暟" prop="produceMonth">
- <el-input v-model="form.produceMonth" placeholder="璇疯緭鍏ュぉ鏁�" :disabled="isDisabled"/>
+ <el-form-item label="澶╂暟" prop="days">
+ <el-input-number :min="0" v-model="form.days" placeholder="璇疯緭鍏ュぉ鏁�"/>
</el-form-item>
<el-form-item label="闇�姹傛棩鐒婄紳" prop="requirementDayWeldSeam">
- <el-date-picker clearable
- v-model="form.requirementDayWeldSeam"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨闇�姹傛棩鐒婄紳鏃ユ湡" :disabled="isDisabled">
- </el-date-picker>
+ <el-input v-model="form.requirementDayWeldSeam" :disabled="isDisabled"/>
</el-form-item>
<el-form-item label="鐢熶骇鏃ョ剨缂�" prop="productionDayWeldSeam">
- <el-date-picker clearable
- v-model="form.productionDayWeldSeam"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨鐢熶骇鏃ョ剨缂濇棩鏈�">
- </el-date-picker>
+ <el-input-number :min="0" v-model="form.productionDayWeldSeam" placeholder="璇疯緭鐢熶骇鏃ョ剨缂�"/>
</el-form-item>
<el-form-item label="鏄惁婊¤冻" prop="isSatisfy">
- <el-input v-model="form.isSatisfy" placeholder="璇疯緭鍏ユ槸鍚︽弧瓒�" :disabled="isDisabled"/>
+ <el-input v-model="form.isSatisfy" :disabled="isDisabled"/>
</el-form-item>
</el-form>
<template #footer>
@@ -174,6 +165,7 @@
import { getToken } from "@/utils/auth";
import HxlhTable from '@/components/HxlhTable'
import { ref } from "vue";
+import * as XLSX from 'xlsx';
const { proxy } = getCurrentInstance();
@@ -197,6 +189,8 @@
const batchNumber = ref(null);
const dataList = ref([]);
const isDisabled = ref(true);
+const headers = ref([]);
+const exportData = ref([]);
/** 瀵煎叆鍙傛暟 */
const upload = reactive({
@@ -426,6 +420,27 @@
batchNumber: null
},
rules: {
+ reserveEmergencyOrderOutput: [
+ {
+ required: true,
+ message: '璇疯緭鍏ラ鐣欑揣鎬ヨ鍗曚骇鍑�',
+ trigger: 'blur',
+ },
+ ],
+ days: [
+ {
+ required: true,
+ message: '璇疯緭鍏ュぉ鏁�',
+ trigger: 'blur',
+ },
+ ],
+ productionDayWeldSeam: [
+ {
+ required: true,
+ message: '璇疯緭鍏ラ鐣欑揣鎬ヨ鍗曚骇鍑�',
+ trigger: 'blur',
+ },
+ ],
}
});
@@ -437,6 +452,25 @@
query(queryParams.value).then(response => {
console.log(response);
dataList.value = response.rows;
+ // exportData.value = response.rows;
+ dataList.value.forEach(item=>{
+ let data = [];
+ data.push(item.year);
+ data.push(item.month);
+ data.push(item.productionBase);
+ data.push(item.pipingOrderRequirement);
+ data.push(item.gasOrderRequirement);
+ data.push(item.pipingPredictionRequirement);
+ data.push(item.gasPredictionRequirement);
+ data.push(item.reserveEmergencyOrderOutput);
+ data.push(item.total);
+ data.push(item.days);
+ data.push(item.requirementDayWeldSeam);
+ data.push(item.productionDayWeldSeam);
+ data.push(item.isSatisfy);
+ exportData.value.push(data);
+ })
+ console.log(exportData.value);
loading.value = false;
});
}
@@ -553,9 +587,53 @@
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
- proxy.download('weldSeam/weldSeam/export', {
- ...queryParams.value
- }, `weldSeam_${new Date().getTime()}.xlsx`)
+ const headersOne = ["骞翠唤","鏈堜唤","鐢熶骇鍩哄湴","璁㈠崟闇�姹�","","棰勬祴闇�姹�","","棰勭暀绱ф�ヨ鍗曚骇鍑�","鍚堣","澶╂暟","闇�姹傛棩鐒婄紳","鐢熶骇鏃ョ剨缂�","鏄惁婊¤冻"]
+ const headersTwo = ["","","","绠¤矾","姘旀煖","绠¤矾","姘旀煖","","","","","",""]
+ headers.value.push(headersOne);
+ headers.value.push(headersTwo);
+
+ // 鍚堝苟琛ㄥご鍜屾暟鎹�
+ const finalData = [...headers.value, ...exportData.value];
+
+ // 灏嗘暟鎹浆鎹负 worksheet
+ const ws = XLSX.utils.aoa_to_sheet(finalData);
+
+ // 鍚堝苟鍗曞厓鏍硷紙濡傛灉闇�瑕侊級
+ ws['!merges'] = [
+ { s: { r: 0, c: 0 }, e: { r: 1, c: 0 } },
+ { s: { r: 0, c: 1 }, e: { r: 1, c: 1 } },
+ { s: { r: 0, c: 2 }, e: { r: 1, c: 2 } },
+ { s: { r: 0, c: 3 }, e: { r: 0, c: 4 } },
+ { s: { r: 0, c: 5 }, e: { r: 0, c: 6 } },
+ { s: { r: 0, c: 7 }, e: { r: 1, c: 7 } },
+ { s: { r: 0, c: 8 }, e: { r: 1, c: 8 } },
+ { s: { r: 0, c: 9 }, e: { r: 1, c: 9 } },
+ { s: { r: 0, c: 10 }, e: { r: 1, c: 10 } },
+ { s: { r: 0, c: 11 }, e: { r: 1, c: 11 } },
+ { s: { r: 0, c: 12 }, e: { r: 1, c: 12 } },
+ ];
+
+ // ws['!merges'] = merges;
+
+ // 璁剧疆灞呬腑鏍峰紡
+ const centerStyle = { alignment: { horizontal: 'center', vertical: 'center' } };
+ const range = XLSX.utils.decode_range(ws['!ref']);
+ for (let R = range.s.r; R <= range.e.r; ++R) {
+ for (let C = range.s.c; C <= range.e.c; ++C) {
+ const cellAddress = XLSX.utils.encode_cell({ r: R, c: C });
+ const cell = ws[cellAddress];
+ if (cell) {
+ cell.s = centerStyle;
+ }
+ }
+ }
+
+ // 鍒涘缓 workbook
+ const wb = XLSX.utils.book_new();
+ // 灏� worksheet 娣诲姞鍒� workbook 涓�
+ XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
+ // 瀵煎嚭鏂囦欢
+ XLSX.writeFile(wb, `apsPartRouteStat_${new Date().getTime()}.xlsx`);
}
/** dialog鍙栨秷 */
@@ -623,14 +701,21 @@
}
/** 缂栬緫 */
+// const viewEvent = (row, column, event) => {
+// console.log('鐐瑰嚮鐨勮鏁版嵁');
+// console.log('鐐瑰嚮鐨勮鏁版嵁锛�', row);
+// };
function viewEvent(row){
console.log(row);
- /* const _id = row.id
- getWeldSeam(_id).then(response => {
- form.value = response.data;
- open.value = true;
- title.value = "淇敼鐒婄紳";
- }); */
+ open.value = true;
+ title.value = "淇敼鐒婄紳";
+ form.value = row;
+ // const _id = row.id
+ // getWeldSeam(_id).then(response => {
+ // form.value = response.data;
+ // open.value = true;
+ // title.value = "淇敼鐒婄紳";
+ // });
}
getList();
diff --git a/src/views/partPlan/index.vue b/src/views/partPlan/index.vue
index b18cabd..bd69847 100644
--- a/src/views/partPlan/index.vue
+++ b/src/views/partPlan/index.vue
@@ -115,7 +115,7 @@
>
</HxlhTable>
- <!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� -->
+ <!-- 瀵煎叆瀵硅瘽妗� -->
<el-dialog :title="upload.title" v-model="upload.open" width="90%" append-to-body @close="dialogCancel">
<el-row :gutter="10">
<el-col>
@@ -252,7 +252,7 @@
const exampleHeight = ref("500px");
const uploadRef = ref();
-/*** 鐢ㄦ埛瀵煎叆鍙傛暟 */
+/** 瀵煎叆鍙傛暟 */
const upload = reactive({
// 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛�
open: false,
--
Gitblit v1.9.3