From 739da1778e71e0fb23cef0a1a2c2a2bc3a7a2cb6 Mon Sep 17 00:00:00 2001 From: bluejay <253316343@qq.com> Date: 星期二, 15 四月 2025 09:10:00 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/api/mainPlan/weldSeam/weldSeam.js | 70 +++++ src/components/HxlhTable/index.vue | 4 src/views/partPlan/index.vue | 4 src/views/ApsPartRouteStat/index.vue | 24 + src/views/mainPlan/weldSeam/index.vue | 722 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 812 insertions(+), 12 deletions(-) diff --git a/src/api/mainPlan/weldSeam/weldSeam.js b/src/api/mainPlan/weldSeam/weldSeam.js new file mode 100644 index 0000000..6ae30f0 --- /dev/null +++ b/src/api/mainPlan/weldSeam/weldSeam.js @@ -0,0 +1,70 @@ +import request from '@/utils/request' + +// 鏌ヨ鐒婄紳鍒楄〃 +export function listWeldSeam(query) { + return request({ + url: '/weldSeam/weldSeam/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ鐒婄紳璇︾粏 +export function getWeldSeam(id) { + return request({ + url: '/weldSeam/weldSeam/' + id, + method: 'get' + }) +} + +// 鏂板鐒婄紳 +export function addWeldSeam(data) { + return request({ + url: '/weldSeam/weldSeam', + method: 'post', + data: data + }) +} + +// 淇敼鐒婄紳 +export function updateWeldSeam(data) { + return request({ + url: '/aps/weldSeamStatistics', + method: 'put', + data: data + }) +} + +// 鍒犻櫎鐒婄紳 +export function delWeldSeam(id) { + return request({ + url: '/weldSeam/weldSeam/' + id, + method: 'delete' + }) +} + +// 鏌ヨ鐒婄紳璁″垝绠$悊鍒楄〃 +export function examplePlan(query) { + return request({ + url: '/aps/weldSeamTemp/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ闆朵欢璁″垝绠$悊鍒楄〃 +export function confirmWeldSeam(data) { + return request({ + url: '/aps/weldSeam/confirmWeldSeam', + method: 'post', + data: data + }) +} + +// 鏌ヨ闆朵欢缁熻琛ㄥ垪琛� +export function query() { + return request({ + url: '/aps/weldSeamStatistics/list', + method: 'get' + }) +} \ No newline at end of file diff --git a/src/components/HxlhTable/index.vue b/src/components/HxlhTable/index.vue index 54ee3f1..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 /> + <template v-slot:buttons="row"> + <slot name="buttons" v-bind="row"/> </template> </vxe-grid> </div> diff --git a/src/views/ApsPartRouteStat/index.vue b/src/views/ApsPartRouteStat/index.vue index 850b49a..5ac9332 100644 --- a/src/views/ApsPartRouteStat/index.vue +++ b/src/views/ApsPartRouteStat/index.vue @@ -26,7 +26,7 @@ </template> <script setup name="apsPartRouteStat"> -import { query,updateStat } from "@/api/apsPartRouteStat/apsPartRouteStat"; +import { query,updateStat } from "@/api/ApsPartRouteStat/ApsPartRouteStat"; import { ref } from "vue"; import * as XLSX from 'xlsx'; @@ -87,8 +87,9 @@ colList.push({ field: 'dateCol', title: '鏃ユ湡', + fixed: 'left', children: [ - { field: `resourceName`, title: '璧勬簮缁�', width: 100}, + { field: `resourceName`, title: '璧勬簮缁�', width: 250, type: 'html'}, ], width: 160 }) @@ -104,9 +105,9 @@ field: `dateColTime${colKey}`, title: item, children: [ - { field: `designTimes${colKey}`, title: '璁捐宸ユ椂', width: 100}, - { field: `requireTimes${colKey}`, title: '闇�姹傚伐鏃�', width: 100}, - { field: `capacityLoad${colKey}`, title: '浜ц兘璐熻嵎', width: 100}, + { field: `designTimes${colKey}`, title: '璁捐宸ユ椂', width: 80}, + { field: `requireTimes${colKey}`, title: '闇�姹傚伐鏃�', width: 80}, + { field: `capacityLoad${colKey}`, title: '浜ц兘璐熻嵎', width: 80, type: 'html'}, ], width: 160 }) @@ -131,17 +132,24 @@ } for (const [key, listValue] of Object.entries(mapItem)) { data.push(key); - item[`resourceName`] = key; + let tableKey = 0; + let flag = false; listValue.forEach(listItem => { + tableKey++ item[`designTimes${tableKey}`] = listItem.designTimes; item[`requireTimes${tableKey}`] = listItem.requireTimes; - item[`capacityLoad${tableKey}`] = listItem.capacityLoad; + item[`capacityLoad${tableKey}`] = listItem.capacityLoad > 100 ? `<font color="red">${listItem.capacityLoad}%</font>` :listItem.capacityLoad+'%'; data.push(listItem.designTimes); data.push(listItem.requireTimes); - data.push(listItem.capacityLoad); + data.push(listItem.capacityLoad+'%'); + if (listItem.capacityLoad > 100) { + flag = true; + } }); + + item[`resourceName`] = flag ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>` : key; } exportData.value.push(data); dataList.push(item); diff --git a/src/views/mainPlan/weldSeam/index.vue b/src/views/mainPlan/weldSeam/index.vue new file mode 100644 index 0000000..38a3d5d --- /dev/null +++ b/src/views/mainPlan/weldSeam/index.vue @@ -0,0 +1,722 @@ +<template> + <div class="app-container"> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="info" + plain + icon="Upload" + @click="handleImport" + v-hasPermi="['weldSeam:weldSeam:import']" + >瀵煎叆</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="Download" + @click="handleExport" + v-hasPermi="['weldSeam:weldSeam:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <HxlhTable + style="width: 100%" + :columns="columns" + :data="dataList" + :loading="loading" + :height="height" + @on-checkbox="handleCheckboxChange" + > + <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> + + <!-- 瀵煎叆瀵硅瘽妗� --> + <el-dialog :title="upload.title" v-model="upload.open" width="90%" append-to-body @close="dialogCancel"> + <el-row :gutter="10"> + <el-col> + <div style="border-bottom: 1px solid #ccc;" > + <p>涓婁紶Excel鏂囦欢锛屽寘鍚剨缂濆伐鍗曚俊鎭�傜郴缁熷皢瑙f瀽鏁版嵁骞朵繚瀛樺埌鏈湴锛岀敤浜庡叧鑱斿埌鐒婄紳璁″垝涓��</p> + </div> + </el-col> + <el-col > + <div></div> + </el-col> + </el-row> + <el-row> + <el-col> + <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="true" drag> + <el-icon class="el-icon--upload"><upload-filled /></el-icon> + <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div> + <template #tip> + <div class="el-upload__tip"> + <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span> + </div> + </template> + </el-upload> + </el-col> + </el-row> + <el-row> + <el-col style="margin-top: 20px;"> + <div v-show="isVisible"> + <el-alert icon="Check" :show-icon="true" title="鐒婄紳宸ュ崟鏁版嵁宸叉垚鍔熻В鏋�" type="success" :closable="false"/> + </div> + <div v-show="isError"> + <el-alert icon="Close" :show-icon="true" title="鐒婄紳宸ュ崟鏁版嵁宸茶В鏋愬け璐�" type="error" :closable="false"/> + </div> + </el-col> + </el-row> + <el-row v-show="isVisible"> + <el-col> + <div> + <h2>鏁版嵁棰勮</h2> + </div> + <HxlhTable + style="width: 100%" + :columns="exampleColumns" + :data="exampleList" + :loading="loading" + :maxHeight="exampleHeight" + > + </HxlhTable> + </el-col> + <el-col> + <div style="text-align: right;"> + <h4>鍏变笂浼�<span style="color: blue;">{{ total }}</span>鏉$剨缂濆伐鍗曟暟鎹�</h4> + </div> + </el-col> + </el-row> + <template #footer> + <div class="dialog-footer"> + <el-button + type="success" + plain + icon="Check" + :disabled="planned" + @click="uploadParse" + v-hasPermi="['weldSeam:weldSeam:confirmPart']" + >纭涓婁紶</el-button> + <el-button @click="dialogCancel">鍙� 娑�</el-button> + </div> + </template> + </el-dialog> + + <!-- 娣诲姞鎴栦慨鏀圭剨缂濆璇濇 --> + <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" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="鏈堜唤" prop="month"> + <el-input v-model="form.month" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="鐢熶骇鍩哄湴" prop="productionBase"> + <el-input v-model="form.productionBase" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="绠¤矾璁㈠崟闇�姹�" prop="pipingOrderRequirement"> + <el-input v-model="form.pipingOrderRequirement" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="姘旀煖璁㈠崟闇�姹�" prop="gasOrderRequirement"> + <el-input v-model="form.gasOrderRequirement" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="绠¤矾棰勬祴闇�姹�" prop="pipingPredictionRequirement"> + <el-input v-model="form.pipingPredictionRequirement" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="姘旀煖棰勬祴闇�姹�" prop="gasPredictionRequirement"> + <el-input v-model="form.gasPredictionRequirement" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="棰勭暀绱ф�ヨ鍗曚骇鍑�" prop="reserveEmergencyOrderOutput"> + <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" :disabled="isDisabled"/> + </el-form-item> + <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-input v-model="form.requirementDayWeldSeam" :disabled="isDisabled"/> + </el-form-item> + <el-form-item label="鐢熶骇鏃ョ剨缂�" prop="productionDayWeldSeam"> + <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" :disabled="isDisabled"/> + </el-form-item> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup name="WeldSeam"> +import { listWeldSeam, getWeldSeam, delWeldSeam, addWeldSeam, updateWeldSeam ,examplePlan ,confirmWeldSeam ,query} from "@/api/mainPlan/weldSeam/weldSeam"; +import { getToken } from "@/utils/auth"; +import HxlhTable from '@/components/HxlhTable' +import { ref } from "vue"; +import * as XLSX from 'xlsx'; + +const { proxy } = getCurrentInstance(); + +const open = ref(false); +const loading = ref(true); +const showSearch = ref(true); +const ids = ref([]); +const single = ref(true); +const multiple = ref(true); +const total = ref(0); +const title = ref(""); +const daterangeThisFeedbackDay = ref([]); +const daterangeMaterialsRequirementDay = ref([]); +const isVisible = ref(false); +const isError = ref(false); +const planned = ref(true); +const height = ref(document.documentElement.clientHeight - 210 + "px;") +const exampleHeight = ref("500px"); +const uploadRef = ref(); +const exampleList = ref([]); +const batchNumber = ref(null); +const dataList = ref([]); +const isDisabled = ref(true); +const headers = ref([]); +const exportData = ref([]); + +/** 瀵煎叆鍙傛暟 */ +const upload = reactive({ + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛� + open: false, + // 寮瑰嚭灞傛爣棰橈紙鐢ㄦ埛瀵煎叆锛� + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹� + updateSupport: 0, + // 璁剧疆涓婁紶鐨勮姹傚ご閮� + headers: { Authorization: "Bearer " + getToken() }, + // 涓婁紶鐨勫湴鍧� + url: import.meta.env.VITE_APP_BASE_API + "/aps/weldSeam/importData" +}); + +// 琛ㄦ牸閰嶇疆 +const columns = ref([ + { type: 'seq', title: '搴忓彿', width: 60 }, + { + title: '骞翠唤', + field: 'year', + width: 100, + }, + { + title: '鏈堜唤', + field: 'month', + width: 80, + }, + { + title: '鐢熶骇鍩哄湴', + field: 'productionBase', + width: 150, + }, + { + title: '璁㈠崟闇�姹�', + field: 'order', + children: [ + { field: 'pipingOrderRequirement', title: '绠¤矾', width: 140 }, + { field: 'gasOrderRequirement', title: '姘旀煖', width: 120 }, + ], + width: 150, + }, + { + title: '棰勬祴闇�姹�', + field: 'info', + children: [ + { field: 'pipingPredictionRequirement', title: '绠¤矾', width: 140 }, + { field: 'gasPredictionRequirement', title: '姘旀煖', width: 120 }, + ], + width: 150, + }, + { + title: '棰勭暀绱ф�ヨ鍗曚骇鍑�', + field: 'reserveEmergencyOrderOutput', + width: 150, + }, + { + title: '鍚堣', + field: 'total', + width: 150, + }, + { + title: '澶╂暟', + field: 'days', + width: 150, + }, + { + title: '闇�姹傛棩鐒婄紳', + field: 'requirementDayWeldSeam', + width: 100, + }, + { + title: '鐢熶骇鏃ョ剨缂�', + field: 'productionDayWeldSeam', + width: 150, + }, + { + title: '鏄惁婊¤冻', + field: 'isSatisfy', + width: 150, + }, + { title: '鎿嶄綔', width: 100, fixed:"right", slots: { default: 'buttons' } } +]); + +// 琛ㄦ牸閰嶇疆 +const exampleColumns = ref([ + { type: 'seq', title: '搴忓彿', width: 60 }, + { + title: '宸ュ崟绫诲瀷', + field: 'workOrderType', + width: 100, + }, + /* { + title: '鍛ㄦ棩', + field: 'weekDay', + width: 100, + formatter: (({ cellValue, row, column }) => { + if (cellValue) { + const weekDay = new Date(cellValue); + const year = weekDay.getFullYear(); + const month = String(weekDay.getMonth() + 1).padStart(2, '0'); + const day = String(weekDay.getDate()).padStart(2, '0'); + return `${month}-${day}`; + } + return ''; + }) + }, */ + { + title: '鐗╂枡缂栫爜', + field: 'materialCode', + width: 80, + }, + { + title: '瀹㈡埛鍥惧彿', + field: 'customerDrawingNumber', + width: 150, + }, + { + title: '缁勭粐璐﹀彿', + field: 'organizeNumber', + width: 150, + }, + { + title: '鐢熶骇鍩哄湴', + field: 'productionBase', + width: 200, + }, + { + title: '鍒嗙被(姘旀煖/绠¤矾)', + field: 'classification', + width: 150, + }, + { + title: '鐢熶骇骞翠唤', + field: 'produceYear', + width: 150, + }, + { + title: '鐢熶骇鏈堜唤', + field: 'produceMonth', + width: 150, + }, + { + title: '鐢熸垚鏁伴噺', + field: 'productionQuantity', + width: 100, + }, + { + title: '瀹㈡埛', + field: 'customer', + width: 150, + }, + { + title: '鍗曚欢鐒婄紳', + field: 'singleWeldSeam', + width: 150, + }, + { + title: '鎬荤剨缂�', + field: 'totalWeldSeam', + width: 100, + }, + { + title: '鏈鍙嶉鏃ユ湡', + field: 'thisFeedbackDay', + width: 100, + }, + { + title: '鐗╂枡闇�姹傛棩鏈�', + field: 'materialsRequirementDay', + width: 100, + }, + { + title: '閿�鍞鍗曞彿', + field: 'saleOrderNo', + width: 150, + }, + { + title: '閿�鍞鍗曡', + field: 'saleOrderLine', + width: 150, + }, + { + title: '涓诲伐鍗曞彿', + field: 'mainWorkOrderNo', + width: 100, + }, + { + title: '涓婄骇宸ュ崟鍙�', + field: 'superiorWorkOrderNo', + width: 100, + }, + { + title: '宸ュ崟鍙�', + field: 'workOrderNo', + width: 100, + }, +]); + +const data = reactive({ + form: {}, + queryParams: { + pageNum: 1, + pageSize: 10, + workOrderType: null, + materialCode: null, + customerDrawingNumber: null, + organizeNumber: null, + productionBase: null, + classification: null, + produceYear: null, + produceMonth: null, + productionQuantity: null, + customer: null, + singleWeldSeam: null, + totalWeldSeam: null, + thisFeedbackDay: null, + materialsRequirementDay: null, + saleOrderNo: null, + saleOrderLine: null, + mainWorkOrderNo: null, + superiorWorkOrderNo: null, + workOrderNo: null, + plant: null, + batchNumber: null + }, + rules: { + reserveEmergencyOrderOutput: [ + { + required: true, + message: '璇疯緭鍏ラ鐣欑揣鎬ヨ鍗曚骇鍑�', + trigger: 'blur', + }, + ], + days: [ + { + required: true, + message: '璇疯緭鍏ュぉ鏁�', + trigger: 'blur', + }, + ], + productionDayWeldSeam: [ + { + required: true, + message: '璇疯緭鍏ラ鐣欑揣鎬ヨ鍗曚骇鍑�', + trigger: 'blur', + }, + ], + } +}); + +const { queryParams, form, rules } = toRefs(data); + +/** 鏌ヨ鐒婄紳鍒楄〃 */ +function getList() { + loading.value = true; + 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; + }); +} + +// 鍙栨秷鎸夐挳 +function cancel() { + open.value = false; + reset(); +} + +// 琛ㄥ崟閲嶇疆 +function reset() { + form.value = { + workOrderType: null, + materialCode: null, + customerDrawingNumber: null, + organizeNumber: null, + productionBase: null, + classification: null, + produceYear: null, + produceMonth: null, + productionQuantity: null, + customer: null, + singleWeldSeam: null, + totalWeldSeam: null, + thisFeedbackDay: null, + materialsRequirementDay: null, + saleOrderNo: null, + saleOrderLine: null, + mainWorkOrderNo: null, + superiorWorkOrderNo: null, + workOrderNo: null, + plant: null + }; + proxy.resetForm("weldSeamRef"); +} + +/** 鎼滅储鎸夐挳鎿嶄綔 */ +function handleQuery() { + queryParams.value.pageNum = 1; + getList(); +} + +/** 閲嶇疆鎸夐挳鎿嶄綔 */ +function resetQuery() { + daterangeThisFeedbackDay.value = []; + daterangeMaterialsRequirementDay.value = []; + proxy.resetForm("queryRef"); + handleQuery(); +} + +// 澶氶�夋閫変腑鏁版嵁 +function handleSelectionChange(selection) { + ids.value = selection.map(item => item.id); + single.value = selection.length != 1; + multiple.value = !selection.length; +} + +/** 鏂板鎸夐挳鎿嶄綔 */ +function handleAdd() { + reset(); + open.value = true; + title.value = "娣诲姞鐒婄紳"; +} + +/** 淇敼鎸夐挳鎿嶄綔 */ +function handleUpdate(row) { + reset(); + const _id = row.id || ids.value + getWeldSeam(_id).then(response => { + form.value = response.data; + open.value = true; + title.value = "淇敼鐒婄紳"; + }); +} + +/** 鎻愪氦鎸夐挳 */ +function submitForm() { + proxy.$refs["weldSeamRef"].validate(valid => { + if (valid) { + if (form.value.id != null) { + updateWeldSeam(form.value).then(response => { + proxy.$modal.msgSuccess("淇敼鎴愬姛"); + open.value = false; + getList(); + }); + } else { + addWeldSeam(form.value).then(response => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + } + } + }); +} + +/** 鍒犻櫎鎸夐挳鎿嶄綔 */ +function handleDelete(row) { + const _ids = row.id || ids.value; + proxy.$modal.confirm('鏄惁纭鍒犻櫎鐒婄紳缂栧彿涓�"' + _ids + '"鐨勬暟鎹」锛�').then(function() { + return delWeldSeam(_ids); + }).then(() => { + getList(); + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); +} + +/** 瀵煎叆鎸夐挳鎿嶄綔 */ +function handleImport() { + upload.title = "鐒婄紳宸ュ崟鏁版嵁涓婁紶"; + upload.open = true; +}; + +/** 瀵煎嚭鎸夐挳鎿嶄綔 */ +function handleExport() { + 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鍙栨秷 */ +function dialogCancel(){ + if (uploadRef.value) { + uploadRef.value.clearFiles(); + } + isVisible.value = false; + isError.value = false; + planned.value = true; + upload.open = false; + upload.isUploading = false; +} + +/**鏂囦欢涓婁紶涓鐞� */ +const handleFileUploadProgress = (event, file, fileList) => { + upload.isUploading = true; +}; + +/** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */ +const handleFileSuccess = (response, file, fileList) => { + if(response.code == '200'){ + batchNumber.value = response.data; + isVisible.value = true; + planned.value = false; + isError.value = false; + getExampleList(); + }else{ + isError.value = true; + proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true }); + } + proxy.$refs["uploadRef"].handleRemove(file); + upload.isUploading = false; +}; + +/** 涓婁紶骞惰В鏋愭寜閽搷浣� */ +function uploadParse() { + queryParams.value.params = {}; + queryParams.value.params["batchNumber"] = batchNumber.value; + confirmWeldSeam(queryParams.value).then(response => { + exampleList.value = response.rows; + loading.value = false; + isVisible.value = false; + isError.value = false; + planned.value = true; + upload.open = false; + ElMessage({ + message: '鐒婄紳宸ュ崟鏁版嵁宸叉垚鍔熶笂浼犲拰瑙f瀽', + type: 'success', + }) + getList(); + }); +} + +/** 鏌ヨ闆朵欢璁″垝涓存椂绠$悊鍒楄〃 */ +function getExampleList() { + loading.value = true; + queryParams.value = {}; + queryParams.value.batchNumber = batchNumber.value; + examplePlan(queryParams.value).then(response => { + exampleList.value = response.rows; + total.value = response.total; + loading.value = false; + }); +} + +/** 缂栬緫 */ +// const viewEvent = (row, column, event) => { +// console.log('鐐瑰嚮鐨勮鏁版嵁'); +// console.log('鐐瑰嚮鐨勮鏁版嵁锛�', row); +// }; +function viewEvent(row){ + console.log(row); + 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(); +</script> 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