|
|
@@ -0,0 +1,682 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <layout>
|
|
|
+ <layout-header>
|
|
|
+ <div class="">
|
|
|
+ <!-- 按钮部分-->
|
|
|
+ <el-form ref="elSearchFormRef" class="demo-form-inline" :rules="searchRule" >
|
|
|
+ <el-form-item>
|
|
|
+ <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px" @keyup.enter="onSubmit"></el-input>
|
|
|
+ <el-button type="primary" class="bt" icon="download" @click="hzToExcel" >导出到Excel(汇总)</el-button>
|
|
|
+ <el-button type="primary" class="bt" icon="download" @click="mxToExcel" >导出到Excel(明细)</el-button> -->
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </layout-header>
|
|
|
+
|
|
|
+ <layout>
|
|
|
+ <!-- 左侧树侧形结构-->
|
|
|
+ <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
|
|
|
+ <div class="JKWTree-tree" style="height: 200px">
|
|
|
+ <h3>样衣生产月份</h3>
|
|
|
+ <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" class="treecolor">
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </layout-sider>
|
|
|
+
|
|
|
+ <!-- 右侧区域 -->
|
|
|
+ <layout-content >
|
|
|
+ <el-main>
|
|
|
+ <div class="gva-table-box">
|
|
|
+ <!-- <div style="margin-bottom: 10px; text-align: right;">
|
|
|
+ <el-button size="small" type="primary" @click="addFirstRow">新增一行</el-button>
|
|
|
+ </div> -->
|
|
|
+ <!-- 表格数据 -->
|
|
|
+ <el-table ref="multipleTable" style="width: 100%;height: 70vh" tooltip-effect="dark"
|
|
|
+ :row-style="{ height: '25px' }" :header-cell-style="{ padding: '0px' }"
|
|
|
+ :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
+ :data="tableData" border row-key="ID"
|
|
|
+ size="small"
|
|
|
+ :cell-class-name="gxbgCellClass"
|
|
|
+ highlight-current-row="true"
|
|
|
+ @row-click="tableRowClick" :show-overflow-tooltip="true"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ @cell-click="handleTableCellClick"
|
|
|
+ @row-dblclick="handleRowDblclick">
|
|
|
+ <el-table-column sortable align="center" label="客户编号" prop="客户编号" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '客户编号'"
|
|
|
+ v-model="row.客户编号"
|
|
|
+ @blur="handleCellBlur(row, '客户编号')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '客户编号')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '客户编号')" class="cell-span">{{ row.客户编号 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="款号" prop="款号" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '款号'"
|
|
|
+ v-model="row.款号"
|
|
|
+ @blur="handleCellBlur(row, '款号')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '款号')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '款号')" class="cell-span">{{ row.款号 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="款式" prop="款式" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '款式'"
|
|
|
+ v-model="row.款式"
|
|
|
+ @blur="handleCellBlur(row, '款式')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '款式')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '款式')" class="cell-span">{{ row.款式 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="样办种类" prop="样办种类" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '样办种类'"
|
|
|
+ v-model="row.样办种类"
|
|
|
+ @blur="handleCellBlur(row, '样办种类')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '样办种类')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '样办种类')" class="cell-span">{{ row.样办种类 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="做办部门" prop="做办部门" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '做办部门'"
|
|
|
+ v-model="row.做办部门"
|
|
|
+ @blur="handleCellBlur(row, '做办部门')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '做办部门')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '做办部门')" class="cell-span">{{ row.做办部门 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="数量" prop="数量" width="100">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '数量'"
|
|
|
+ v-model="row.数量"
|
|
|
+ @blur="handleCellBlur(row, '数量')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '数量')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '数量')" class="cell-span">{{ row.数量 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="下单日期" prop="下单日期" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-date-picker v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '下单日期'"
|
|
|
+ v-model="row.下单日期"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="选择日期"
|
|
|
+ style="width: 100%"
|
|
|
+ @blur="handleCellBlur(row, '下单日期')" />
|
|
|
+ <span v-else @click="handleCellClick(row, '下单日期')" class="cell-span">{{ row.下单日期 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="面料进度" prop="面料进度" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '面料进度'"
|
|
|
+ v-model="row.面料进度"
|
|
|
+ @blur="handleCellBlur(row, '面料进度')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '面料进度')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '面料进度')" class="cell-span">{{ row.面料进度 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="辅料进度" prop="辅料进度" width="120">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '辅料进度'"
|
|
|
+ v-model="row.辅料进度"
|
|
|
+ @blur="handleCellBlur(row, '辅料进度')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '辅料进度')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '辅料进度')" class="cell-span">{{ row.辅料进度 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="计划交办日期" prop="计划交办日期" width="140">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-date-picker v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '计划交办日期'"
|
|
|
+ v-model="row.计划交办日期"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="选择日期"
|
|
|
+ style="width: 100%"
|
|
|
+ @blur="handleCellBlur(row, '计划交办日期')" />
|
|
|
+ <span v-else @click="handleCellClick(row, '计划交办日期')" class="cell-span">{{ row.计划交办日期 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="实际交办日期" prop="实际交办日期" width="140">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-date-picker v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '实际交办日期'"
|
|
|
+ v-model="row.实际交办日期"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ placeholder="选择日期"
|
|
|
+ style="width: 100%"
|
|
|
+ @blur="handleCellBlur(row, '实际交办日期')" />
|
|
|
+ <span v-else @click="handleCellClick(row, '实际交办日期')" class="cell-span">{{ row.实际交办日期 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column sortable align="center" label="备注" prop="备注" width="150">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-input v-if="editingCell.rowId === (row.UniqId || row.tempId) && editingCell.prop === '备注'"
|
|
|
+ v-model="row.备注"
|
|
|
+ @blur="handleCellBlur(row, '备注')"
|
|
|
+ @keyup.enter="handleCellBlur(row, '备注')"
|
|
|
+ :ref="el => { if (el) el.focus() }" />
|
|
|
+ <span v-else @click="handleCellClick(row, '备注')" class="cell-span">{{ row.备注 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" label="操作" width="230" fixed="right">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-button size="small" type="primary" @click="addRow($index)">新增一行</el-button>
|
|
|
+ <el-button size="small" type="warning" @click="handleRowDblclick(row)">详情</el-button>
|
|
|
+ <el-button size="small" type="danger" @click="deleteRow(row, $index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <!-- 分页 -->
|
|
|
+ <div class="gva-pagination">
|
|
|
+ <el-pagination layout="total" :current-page="page" :page-size="pageSize"
|
|
|
+ :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 日志弹窗 -->
|
|
|
+ <el-dialog title="修改记录" v-model="logDialogVisible" width="800px">
|
|
|
+ <el-table :data="logTableData" border size="small">
|
|
|
+ <el-table-column prop="ModifyField" label="修改字段" width="120" />
|
|
|
+ <el-table-column prop="OriginalValue" label="原值" width="150" />
|
|
|
+ <el-table-column prop="Modified" label="新值" width="150" />
|
|
|
+ <el-table-column prop="修改人" label="修改人" width="100" />
|
|
|
+ <el-table-column prop="修改日期" label="修改日期" width="180" />
|
|
|
+ </el-table>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-main>
|
|
|
+ </layout-content>
|
|
|
+ </layout>
|
|
|
+ </layout>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <script setup>
|
|
|
+ import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
|
|
|
+ import * as XLSX from 'xlsx'
|
|
|
+ import FileSaver from 'file-saver'
|
|
|
+ import {ref, reactive} from 'vue'
|
|
|
+ import { exportExcelFile } from '@/utils/excel'
|
|
|
+ import {ElMessage} from "element-plus";
|
|
|
+ import { getDateTree, getMonthlyGarmentsList, saveMonthlyGarments, updateMonthlyGarments, deleteMonthlyGarments, getLogs, } from '@/api/mes/job'
|
|
|
+ import { useUserStore } from '@/pinia/modules/user';
|
|
|
+ //获取登录用户信息
|
|
|
+ const userStore = useUserStore()
|
|
|
+ const _username = ref('')
|
|
|
+ _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
|
|
|
+ defineOptions({name: 'Company'})
|
|
|
+
|
|
|
+ const treeData = ref([])
|
|
|
+ const defaultProps = {
|
|
|
+ children: 'children',
|
|
|
+ label: 'label'
|
|
|
+ }
|
|
|
+
|
|
|
+ const getTree = async () => {
|
|
|
+ try {
|
|
|
+ const response = await getDateTree()
|
|
|
+ const data = response.data || {}
|
|
|
+
|
|
|
+ const sortedYearMonths = Object.keys(data).sort((a, b) => {
|
|
|
+ const yearMonthA = parseInt(a);
|
|
|
+ const yearMonthB = parseInt(b);
|
|
|
+ return yearMonthB - yearMonthA;
|
|
|
+ });
|
|
|
+
|
|
|
+ treeData.value = sortedYearMonths.map(yearMonth => {
|
|
|
+ return {
|
|
|
+ label: `${yearMonth}`,
|
|
|
+ children: data[yearMonth].map(customer => {
|
|
|
+ return {
|
|
|
+ label: `${customer.客户编号} (${customer.total}条)`,
|
|
|
+ yearMonth: yearMonth,
|
|
|
+ customerCode: customer.客户编号,
|
|
|
+ total: customer.total,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (treeData.value.length === 0 && tableData.value.length === 0) {
|
|
|
+ tableData.value.push({
|
|
|
+ tempId: 'empty_row_' + Date.now(),
|
|
|
+ '客户编号': '',
|
|
|
+ '款号': '',
|
|
|
+ '款式': '',
|
|
|
+ '样办种类': '',
|
|
|
+ '做办部门': '',
|
|
|
+ '数量': '',
|
|
|
+ '下单日期': '',
|
|
|
+ '面料进度': '',
|
|
|
+ '辅料进度': '',
|
|
|
+ '计划交办日期': '',
|
|
|
+ '实际交办日期': '',
|
|
|
+ '备注': ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error('获取数据失败')
|
|
|
+ console.error('获取树形数据失败:', error)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getTree()
|
|
|
+
|
|
|
+ const tableData = ref([])
|
|
|
+ const _noderq = ref('')
|
|
|
+ const _nodecode = ref('')
|
|
|
+ const page = ref(1)
|
|
|
+ const pageSize = ref(20)
|
|
|
+ const total = ref(0)
|
|
|
+ const editingCell = reactive({ rowId: null, prop: null })
|
|
|
+ const editingOriginalValue = ref('')
|
|
|
+ const logDialogVisible = ref(false)
|
|
|
+ const logTableData = ref([])
|
|
|
+
|
|
|
+ const handleNodeClick = async (node) => {
|
|
|
+ const allNodes = document.querySelectorAll('.treecolor .el-tree-node');
|
|
|
+ allNodes.forEach(node => {
|
|
|
+ node.querySelector('.el-tree-node__label').style.color = '';
|
|
|
+ });
|
|
|
+
|
|
|
+ const clickedNodeId = node['$treeNodeId'];
|
|
|
+ const clickedNode = document.querySelector(`.treecolor .el-tree-node[data-key="${clickedNodeId}"]`);
|
|
|
+ if (clickedNode) {
|
|
|
+ clickedNode.querySelector('.el-tree-node__label').style.color = 'red';
|
|
|
+ }
|
|
|
+
|
|
|
+ _noderq.value = node.yearMonth
|
|
|
+ _nodecode.value = node.customerCode
|
|
|
+
|
|
|
+ if (!node.children) {
|
|
|
+ const res = await getMonthlyGarmentsList({sys_rq: node.yearMonth, customer: node.customerCode})
|
|
|
+ if(res.code === 0){
|
|
|
+ tableData.value = res.data.result || []
|
|
|
+ total.value = res.data.total || res.data.result.length
|
|
|
+ }
|
|
|
+ if (tableData.value.length === 0) {
|
|
|
+ tableData.value.push({
|
|
|
+ tempId: 'empty_row_' + Date.now(),
|
|
|
+ '客户编号': '',
|
|
|
+ '款号': '',
|
|
|
+ '款式': '',
|
|
|
+ '样办种类': '',
|
|
|
+ '做办部门': '',
|
|
|
+ '数量': '',
|
|
|
+ '下单日期': '',
|
|
|
+ '面料进度': '',
|
|
|
+ '辅料进度': '',
|
|
|
+ '计划交办日期': '',
|
|
|
+ '实际交办日期': '',
|
|
|
+ '备注': ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const searchInfo = ref('')
|
|
|
+ const searchRule = {}
|
|
|
+ const elSearchFormRef = ref()
|
|
|
+
|
|
|
+ const onSubmit = async () => {
|
|
|
+ if (!searchInfo.value) {
|
|
|
+ ElMessage.warning('请输入搜索内容');
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ const res = await getMonthlyGarmentsList({search: searchInfo.value})
|
|
|
+ if(res.code === 0){
|
|
|
+ tableData.value = res.data.result
|
|
|
+ total.value = res.data.total || res.data.result.length
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const tableRowClick = (row) => {
|
|
|
+ console.log('当前行数据:', row)
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleSelectionChange = (selectedItems) => {
|
|
|
+ console.log('选中项:', selectedItems)
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleCurrentChange = (val) => {
|
|
|
+ page.value = val
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleSizeChange = (val) => {
|
|
|
+ pageSize.value = val
|
|
|
+ }
|
|
|
+
|
|
|
+ const updateCompanyFunc = (row) => {
|
|
|
+ console.log('双击行:', row)
|
|
|
+ }
|
|
|
+
|
|
|
+ const gxbgCellClass = ({row, column, rowIndex, columnIndex}) => {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+
|
|
|
+ const addRow = (index) => {
|
|
|
+ const newRow = {
|
|
|
+ tempId: 'temp_' + Date.now(),
|
|
|
+ '客户编号': '',
|
|
|
+ '款号': '',
|
|
|
+ '款式': '',
|
|
|
+ '样办种类': '',
|
|
|
+ '做办部门': '',
|
|
|
+ '数量': '',
|
|
|
+ '下单日期': '',
|
|
|
+ '面料进度': '',
|
|
|
+ '辅料进度': '',
|
|
|
+ '计划交办日期': '',
|
|
|
+ '实际交办日期': '',
|
|
|
+ '备注': ''
|
|
|
+ }
|
|
|
+ tableData.value.splice(index + 1, 0, newRow)
|
|
|
+ }
|
|
|
+
|
|
|
+ const addFirstRow = () => {
|
|
|
+ const newRow = {
|
|
|
+ tempId: 'temp_' + Date.now(),
|
|
|
+ '客户编号': '',
|
|
|
+ '款号': '',
|
|
|
+ '款式': '',
|
|
|
+ '样办种类': '',
|
|
|
+ '做办部门': '',
|
|
|
+ '数量': '',
|
|
|
+ '下单日期': '',
|
|
|
+ '面料进度': '',
|
|
|
+ '辅料进度': '',
|
|
|
+ '计划交办日期': '',
|
|
|
+ '实际交办日期': '',
|
|
|
+ '备注': ''
|
|
|
+ }
|
|
|
+ tableData.value.push(newRow)
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleRowDblclick = async (row) => {
|
|
|
+ if (!row.UniqId) return
|
|
|
+ const res = await getLogs({ UniqId: row.UniqId })
|
|
|
+ if (res.code === 0) {
|
|
|
+ logTableData.value = res.data.result || []
|
|
|
+ logDialogVisible.value = true
|
|
|
+ } else {
|
|
|
+ ElMessage.error('获取日志失败')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const deleteRow = async (row, index) => {
|
|
|
+ try {
|
|
|
+ if (row.UniqId) {
|
|
|
+ const res = await deleteMonthlyGarments({ UniqId: row.UniqId, nickName: userStore.userInfo.nickName })
|
|
|
+ if(res.code !== 0){
|
|
|
+ ElMessage.error('删除失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tableData.value.splice(index, 1)
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ await refreshData()
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error('删除失败')
|
|
|
+ console.error('删除失败:', error)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleCellClick = (row, prop) => {
|
|
|
+ editingCell.rowId = row.UniqId || row.tempId
|
|
|
+ editingCell.prop = prop
|
|
|
+ editingOriginalValue.value = row[prop]
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleTableCellClick = (row, column, cell, event) => {
|
|
|
+ console.log('cell-click triggered:', { rowId: row.UniqId || row.tempId, columnLabel: column.label, columnProp: column.prop, columnIndex: column.index })
|
|
|
+ if (column.prop && column.prop !== '') {
|
|
|
+ handleCellClick(row, column.prop)
|
|
|
+ console.log('editingCell after click:', editingCell)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const refreshData = async () => {
|
|
|
+ await getTree()
|
|
|
+ if (_noderq.value && _nodecode.value) {
|
|
|
+ const res = await getMonthlyGarmentsList({sys_rq: _noderq.value, customer: _nodecode.value})
|
|
|
+ if(res.code === 0){
|
|
|
+ tableData.value = res.data.result || []
|
|
|
+ total.value = res.data.total || res.data.result.length
|
|
|
+ if (tableData.value.length === 0) {
|
|
|
+ tableData.value.push({
|
|
|
+ tempId: 'empty_row_' + Date.now(),
|
|
|
+ '客户编号': '',
|
|
|
+ '款号': '',
|
|
|
+ '款式': '',
|
|
|
+ '样办种类': '',
|
|
|
+ '做办部门': '',
|
|
|
+ '数量': '',
|
|
|
+ '下单日期': '',
|
|
|
+ '面料进度': '',
|
|
|
+ '辅料进度': '',
|
|
|
+ '计划交办日期': '',
|
|
|
+ '实际交办日期': '',
|
|
|
+ '备注': ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleCellBlur = async (row, prop) => {
|
|
|
+ try {
|
|
|
+ if (row.UniqId) {
|
|
|
+ if (String(row[prop]) === String(editingOriginalValue.value)) {
|
|
|
+ editingCell.rowId = null
|
|
|
+ editingCell.prop = null
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const res = await updateMonthlyGarments({
|
|
|
+ UniqId: row.UniqId,
|
|
|
+ nickName: userStore.userInfo.nickName,
|
|
|
+ '客户编号': row['客户编号'],
|
|
|
+ '款号': row['款号'],
|
|
|
+ '款式': row['款式'],
|
|
|
+ '样办种类': row['样办种类'],
|
|
|
+ '做办部门': row['做办部门'],
|
|
|
+ '数量': row['数量'],
|
|
|
+ '下单日期': row['下单日期'],
|
|
|
+ '面料进度': row['面料进度'],
|
|
|
+ '辅料进度': row['辅料进度'],
|
|
|
+ '计划交办日期': row['计划交办日期'],
|
|
|
+ '实际交办日期': row['实际交办日期'],
|
|
|
+ '备注': row['备注']
|
|
|
+ })
|
|
|
+ if(res.code !== 0){
|
|
|
+ ElMessage.error('修改失败')
|
|
|
+ editingCell.rowId = null
|
|
|
+ editingCell.prop = null
|
|
|
+ return
|
|
|
+ }
|
|
|
+ await refreshData()
|
|
|
+ } else if (row.tempId) {
|
|
|
+ const res = await saveMonthlyGarments({
|
|
|
+ '客户编号': row['客户编号'],
|
|
|
+ '款号': row['款号'],
|
|
|
+ '款式': row['款式'],
|
|
|
+ '样办种类': row['样办种类'],
|
|
|
+ '做办部门': row['做办部门'],
|
|
|
+ '数量': row['数量'],
|
|
|
+ '下单日期': row['下单日期'],
|
|
|
+ '面料进度': row['面料进度'],
|
|
|
+ '辅料进度': row['辅料进度'],
|
|
|
+ '计划交办日期': row['计划交办日期'],
|
|
|
+ '实际交办日期': row['实际交办日期'],
|
|
|
+ '备注': row['备注']
|
|
|
+ })
|
|
|
+ if(res.code === 0){
|
|
|
+ row.UniqId = parseInt(res.data.id)
|
|
|
+ delete row.tempId
|
|
|
+ await refreshData()
|
|
|
+ } else {
|
|
|
+ ElMessage.error('保存失败')
|
|
|
+ editingCell.rowId = null
|
|
|
+ editingCell.prop = null
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ editingCell.rowId = null
|
|
|
+ editingCell.prop = null
|
|
|
+ ElMessage.success('保存成功')
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage.error('保存失败')
|
|
|
+ console.error('保存失败:', error)
|
|
|
+ editingCell.rowId = null
|
|
|
+ editingCell.prop = null
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const exportToExcel = (data, filename = '导出数据.xlsx', sheetName = 'Sheet1') => {
|
|
|
+ try {
|
|
|
+ const wb = XLSX.utils.book_new();
|
|
|
+
|
|
|
+ if (typeof data === 'object' && data.nodeType === 1) {
|
|
|
+ const worksheet = XLSX.utils.table_to_sheet(data, { raw: true });
|
|
|
+ XLSX.utils.book_append_sheet(wb, worksheet, sheetName);
|
|
|
+ } else if (Array.isArray(data)) {
|
|
|
+ const worksheet = XLSX.utils.json_to_sheet(data);
|
|
|
+ XLSX.utils.book_append_sheet(wb, worksheet, sheetName);
|
|
|
+ } else if (data['!ref']) {
|
|
|
+ XLSX.utils.book_append_sheet(wb, data, sheetName);
|
|
|
+ } else {
|
|
|
+ throw new Error('不支持的导出数据类型');
|
|
|
+ }
|
|
|
+
|
|
|
+ XLSX.writeFile(wb, filename);
|
|
|
+ return true;
|
|
|
+ } catch (error) {
|
|
|
+ console.error('导出Excel失败:', error);
|
|
|
+ ElMessage.error('导出失败: ' + error.message);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const hzToExcel = () => {
|
|
|
+ if (tableData.value.length === 0) {
|
|
|
+ ElMessage.warning('暂无数据可导出');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ exportToExcel(tableData.value, '月份样衣生产进度表.xlsx', '月份样衣生产进度表');
|
|
|
+ }
|
|
|
+
|
|
|
+ const mxToExcel = () => {
|
|
|
+ if (tableData.value.length === 0) {
|
|
|
+ ElMessage.warning('暂无数据可导出');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ exportToExcel(tableData.value, '月份样衣生产进度明细表.xlsx', '月份样衣生产进度明细表');
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <style scoped>
|
|
|
+ .form-container {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ .form-column {
|
|
|
+ /*flex: 1;*/
|
|
|
+ margin-right: 15px; /* 调整列之间的间距 */
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 左侧输入框宽度调整 */
|
|
|
+ .form-column .el-form-item .el-input {
|
|
|
+ width: 150px; /* 调整左侧输入框的宽度 */
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.hui-plan-usage-lows div) {
|
|
|
+ color: #8c939d !important;
|
|
|
+ }
|
|
|
+ :deep(.lan-plan-usage-lows div) {
|
|
|
+ color: blue !important;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /* 媒体查询,根据需要调整断点 */
|
|
|
+ @media screen and (max-width: 768px) {
|
|
|
+ .form-column {
|
|
|
+ flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*:deep(.el-table td .cell) {*/
|
|
|
+ /* line-height: 30px !important;*/
|
|
|
+ /*}*/
|
|
|
+ .JKWTree-container {
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+ .JKWTree-tree {
|
|
|
+ /*width: 300px;*/
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 10px;
|
|
|
+ margin-right: 20px;
|
|
|
+ }
|
|
|
+ .JKWTree-tree h3 {
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 700;
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
+ .JKWTree-content {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /* 选中某行时的背景色 */
|
|
|
+ :deep(.el-table__body tr.current-row) > td {
|
|
|
+ background: #ff80ff !important;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <style scoped>
|
|
|
+ :deep(.el-table td .cell) {
|
|
|
+ line-height: 20px !important;
|
|
|
+ }
|
|
|
+ :deep(.el-tabs__header){
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+ .search{
|
|
|
+ margin-left: 0px !important;
|
|
|
+ margin-right: 10px !important;
|
|
|
+ }
|
|
|
+ .bt{
|
|
|
+ margin-left: 2px !important;
|
|
|
+ padding: 3px !important;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ .el-tabs__header{
|
|
|
+ margin: 0px !important;
|
|
|
+ }
|
|
|
+ .gva-table-box{
|
|
|
+ padding: 0px !important;
|
|
|
+ }
|
|
|
+ .mab{
|
|
|
+ margin-bottom: 5px;
|
|
|
+ }
|
|
|
+ .cell-span {
|
|
|
+ display: inline-block;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ cursor: pointer;
|
|
|
+ padding: 4px 0;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+
|