导入订单功能

This commit is contained in:
磷叶 2025-02-25 15:47:03 +08:00
parent 14e30d9f56
commit 0eed3a4f14
7 changed files with 124 additions and 57 deletions

View File

@ -281,3 +281,16 @@ aside {
justify-content: flex-end; /* 使用标准值 */
}
}
.table-form.el-table {
.cell {
padding-left: 0px;
padding-right: 0px;
}
}
.table-form.el-table th.el-table__cell > .cell {
padding-left: 0px;
padding-right: 0px;
}

View File

@ -39,7 +39,7 @@
@row-click="changeSelection"
@row-dblclick="select"
@select-all="selectionAll"
@select="changeSelection"
@select="handleSelect"
highlight-current-row
style="width: 100%"
size="small"
@ -185,6 +185,9 @@ export default {
}
})
},
handleSelect(selection, row) {
this.changeSelection(row);
},
//
changeSelection(row){
if(this.multiple){

View File

@ -15,9 +15,9 @@
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip">
<!-- <div class="el-upload__tip" slot="tip">
<el-checkbox v-model="updateSupport">更新已经存在的数据</el-checkbox>
</div>
</div> -->
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
</div>
@ -92,8 +92,8 @@ export default {
this.isUploading = false;
this.$refs.upload.clearFiles();
if (response.code === 200) {
this.$message.success(`扫描到${response.data}条数据,正在导入中,可在导入日志中查看导入结果`);
this.$emit('success');
// this.$message.success(`${response.data}`);
this.$emit('success', response.data);
}
},
//

View File

@ -38,3 +38,9 @@ export const StoreStatus = {
return [this.WAIT_STORE];
}
}
// 加工方式
export const ProdWorkType = {
SELF: "1", // 自加工
BUY: "2", // 外派
}

View File

@ -5,7 +5,7 @@
size="mini"
stripe
:header-cell-style="headerCellStyle"
class="mini-table"
class="mini-table table-form"
ref="table"
>
<el-table-column type="expand" width="20" align="left">
@ -21,22 +21,39 @@
</div>
</template>
</el-table-column>
<el-table-column type="index" width="20" align="center" label="#"/>
<table-form-col label="主图" prop-prefix="prodList" prop="picture" width="80" >
<table-form-col label="加工方式" prop-prefix="prodList" prop="workType" :rules="rules.workType" required width="90">
<el-select slot-scope="d" v-model="d.row.workType" placeholder="请选择加工方式">
<el-option v-for="item in dict.type.order_prod_work_type" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</table-form-col>
<table-form-col label="加工商" prop-prefix="prodList" prop="workName" :rules="rules.workName" >
<el-input slot-scope="d" v-if="d.row.workType === ProdWorkType.BUY" v-model="d.row.workName" placeholder="请输入加工商"/>
</table-form-col>
<table-form-col label="序号" prop-prefix="prodList" prop="no" :rules="rules.no" width="60" >
<el-input slot-scope="d" v-model="d.row.no" placeholder="请输入序号"/>
</table-form-col>
<table-form-col label="图片" prop-prefix="prodList" prop="picture" width="60">
<template slot-scope="d">
<hover-show>
<template #show>
<image-preview :src="d.row.picture" :width="50" :height="50"/>
<image-preview :src="d.row.picture" :width="48" :height="48"/>
</template>
<image-upload v-model="d.row.picture" :limit="1" :is-show-tip="false" width="50px" height="50px"/>
</hover-show>
</template>
</table-form-col>
<table-form-col label="名称" prop-prefix="prodList" prop="name" required :rules="rules.name" show-overflow-tooltip>
<table-form-col label="物料编号" prop-prefix="prodList" prop="materialNo">
<template v-slot:content-tip="d">{{d.row.materialNo}}</template>
<el-input slot-scope="d" v-model="d.row.materialNo" placeholder="请输入物料编号"/>
</table-form-col>
<table-form-col label="产品名称" prop-prefix="prodList" prop="name" required :rules="rules.name" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.name}}</template>
<el-input slot-scope="d" v-model="d.row.name" placeholder="请输入名称"/>
</table-form-col>
<table-form-col label="装量" prop-prefix="prodList" prop="contentNum" required :rules="rules.contentNum">
<!-- <table-form-col label="成品" prop-prefix="prodList" prop="isEnd" width="60" tips="成品,表示该产品是成品,订单有且仅有一个成品">
<el-checkbox slot-scope="d" :value="d.row.isEnd" @change="handleIsEndChange(d.index)"/>
</table-form-col> -->
<table-form-col label="装量" prop-prefix="prodList" prop="contentNum" required :rules="rules.contentNum" width="100">
<el-input-number
slot-scope="d"
v-model="d.row.contentNum"
@ -47,41 +64,9 @@
@change="(nv, ov) => handleContentNumChange(d.row, nv, ov)"
/>
</table-form-col>
<table-form-col label="生产数量" prop-prefix="prodList" prop="num" required :rules="rules.num">
<table-form-col label="订单数量" prop-prefix="prodList" prop="num" required :rules="rules.num">
<el-input-number slot-scope="d" v-model="d.row.num" placeholder="请输入数量" :min="0" :precision="0" controls-position="right" style="width: 100%"/>
</table-form-col>
<table-form-col label="加工商" prop-prefix="prodList" prop="workType" :rules="rules.workType" required>
<el-select slot-scope="d" v-model="d.row.workType" placeholder="请选择加工商">
<el-option v-for="item in dict.type.order_prod_work_type" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</table-form-col>
<table-form-col label="成品" prop-prefix="prodList" prop="isEnd" width="60" tips="成品,表示该产品是成品,订单有且仅有一个成品">
<el-checkbox slot-scope="d" :value="d.row.isEnd" @change="handleIsEndChange(d.index)"/>
</table-form-col>
<table-form-col label="物料编码" prop-prefix="prodList" prop="materialNo">
<template v-slot:content-tip="d">{{d.row.materialNo}}</template>
<el-input slot-scope="d" v-model="d.row.materialNo" placeholder="请输入物料编码"/>
</table-form-col>
<table-form-col label="规格" prop-prefix="prodList" prop="spec" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.spec}}</template>
<el-input slot-scope="d" v-model="d.row.spec" placeholder="请输入规格"/>
</table-form-col>
<table-form-col label="效果" prop-prefix="prodList" prop="effect" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.effect}}</template>
<el-input slot-scope="d" v-model="d.row.effect" placeholder="请输入效果"/>
</table-form-col>
<table-form-col label="颜色" prop-prefix="prodList" prop="color" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.color}}</template>
<el-input slot-scope="d" v-model="d.row.color" placeholder="请输入颜色"/>
</table-form-col>
<table-form-col label="盖子颜色" prop-prefix="prodList" prop="coverColor" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.coverColor}}</template>
<el-input slot-scope="d" v-model="d.row.coverColor" placeholder="请输入盖子颜色"/>
</table-form-col>
<table-form-col label="备注" prop-prefix="prodList" prop="remark" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.remark}}</template>
<el-input slot-scope="d" v-model="d.row.remark" placeholder="请输入备注" maxlength="200" show-word-limit type="textarea"/>
</table-form-col>
<table-form-col label="处理方式" prop-prefix="prodList" prop="handleWay" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.handleWay}}</template>
<!-- <el-input slot-scope="d" v-model="d.row.handleWay" placeholder="请输入处理方式"/> -->
@ -91,6 +76,26 @@
</el-button>
</template>
</table-form-col>
<!-- <table-form-col label="规格" prop-prefix="prodList" prop="spec" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.spec}}</template>
<el-input slot-scope="d" v-model="d.row.spec" placeholder="请输入规格"/>
</table-form-col> -->
<table-form-col label="效果/包装尺寸" prop-prefix="prodList" prop="effect" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.effect}}</template>
<el-input slot-scope="d" v-model="d.row.effect" placeholder="请输入效果"/>
</table-form-col>
<table-form-col label="颜色" prop-prefix="prodList" prop="color" show-overflow-tooltip width="80">
<template v-slot:content-tip="d">{{d.row.color}}</template>
<el-input slot-scope="d" v-model="d.row.color" placeholder="请输入颜色"/>
</table-form-col>
<table-form-col label="球盖颜色/外箱尺寸" prop-prefix="prodList" prop="coverColor" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.coverColor}}</template>
<el-input slot-scope="d" v-model="d.row.coverColor" placeholder="请输入盖子颜色"/>
</table-form-col>
<table-form-col label="备注" prop-prefix="prodList" prop="remark" show-overflow-tooltip>
<template v-slot:content-tip="d">{{d.row.remark}}</template>
<el-input slot-scope="d" v-model="d.row.remark" placeholder="请输入备注" maxlength="200" show-word-limit type="textarea"/>
</table-form-col>
<el-table-column label="操作" align="center" width="120">
<template #header>
@ -128,6 +133,7 @@ import BooleanTag from '@/components/BooleanTag/index.vue'
import HoverShow from '@/components/HoverShow/index.vue'
import { listDept } from '@/api/system/dept'
import { isEmpty } from '@/utils/index'
import { ProdWorkType } from '@/utils/enums'
export default {
name: "OrderProdList",
dicts: ['order_prod_work_type'],
@ -150,6 +156,7 @@ export default {
backgroundColor: "#f5f7fa",
},
deptList: [],
ProdWorkType,
}
},
created() {

View File

@ -1,13 +1,14 @@
<template>
<div v-loading="loading">
<edit-header :title="title">
<el-button plain @click="importExcel" icon="el-icon-upload" size="small" type="success">从Excel导入</el-button>
<el-button plain @click="cancel" icon="el-icon-close" size="small">取消</el-button>
<el-button type="primary" plain @click="submitForm(false)" icon="el-icon-check" size="small">保存</el-button>
<el-button type="primary" @click="submitForm(true)" icon="el-icon-s-check" size="small" v-if="form.id == null || OrderStatus.canRelease().includes(form.status)">保存并发布</el-button>
</edit-header>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="6em">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="6em">
<div class="edit-title">基础信息</div>
<el-row>
<form-col :span="5" label="主图" prop="picture">
@ -15,8 +16,8 @@
</form-col>
<el-col :span="19">
<el-row>
<form-col :span="span" label="生产单" prop="orderNo">
<el-input v-model="form.orderNo" placeholder="请输入生产单编号"/>
<form-col :span="span" label="生产" prop="orderNo">
<el-input v-model="form.orderNo" placeholder="请输入生产单编号"/>
</form-col>
<form-col :span="span" label="客户订单" prop="customOrderNo">
<el-input v-model="form.customOrderNo" placeholder="请输入客户订单编号"/>
@ -27,24 +28,24 @@
<form-col :span="span" label="交货日期" prop="deliveryDate">
<el-date-picker v-model="form.deliveryDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" :clearable="false" style="width: 100%;"/>
</form-col>
<form-col :span="span" label="客" prop="customer">
<el-input v-model="form.customer" placeholder="请输入客"/>
<form-col :span="span" label="客人代码" prop="customer">
<el-input v-model="form.customer" placeholder="请输入客人代码"/>
</form-col>
<form-col :span="span" label="产品名称" prop="name">
<!-- <form-col :span="span" label="产品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入产品名称"/>
</form-col>
</form-col> -->
<form-col :span="span" label="数量" prop="num">
<el-input-number v-model="form.num" :min="0" controls-position="right" style="width: 100%;"/>
</form-col>
<form-col :span="span" label="用料" prop="material">
<el-input v-model="form.material" placeholder="请输入用料"/>
</form-col>
<form-col :span="span" label="装量" prop="contentNum">
<!-- <form-col :span="span" label="装量" prop="contentNum">
<el-input-number v-model="form.contentNum" :min="0" controls-position="right" style="width: 100%;" placeholder="请输入装量"/>
</form-col>
<form-col :span="span" label="包装尺寸" prop="packageSize">
</form-col> -->
<!-- <form-col :span="span" label="包装尺寸" prop="packageSize">
<el-input v-model="form.packageSize" placeholder="请输入包装尺寸"/>
</form-col>
</form-col> -->
<form-col :span="24" label="特殊要求" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入特殊要求" :maxlength="1000" show-word-limit :autosize="{minRows: 3, maxRows: 10}"/>
</form-col>
@ -61,6 +62,16 @@
/>
</el-form>
</div>
<import-dialog
ref="importDialog"
:visible.sync="importDialogVisible"
title="从Excel导入"
template-name="生产订单导入模板"
url="/bst/order/parseExcelData"
templateUrl="/bst/order/importExcelTemplate"
@success="handleImportSuccess"
/>
</div>
</template>
@ -71,12 +82,14 @@ import FormCol from '@/components/FormCol/index.vue'
import OrderProdList from '@/views/bst/order/edit/components/orderProdList.vue'
import { parseTime } from '@/utils/ruoyi'
import { OrderStatus } from '@/utils/enums'
import ImportDialog from '@/components/ImportDialog/index.vue'
export default {
name: "OrderEdit",
components: { OrderProdList, FormCol, EditHeader },
components: { OrderProdList, FormCol, EditHeader, ImportDialog },
data() {
return {
importDialogVisible: false,
OrderStatus,
title: null,
form: {},
@ -101,7 +114,7 @@ export default {
{ required: true, message: "数量不能为空", trigger: "blur" }
],
workType: [
{ required: true, message: "加工方式不能为空", trigger: "blur" }
{ required: true, message: "加工方式不能为空", trigger: "blur" }
],
processList: {
deptId: [
@ -126,6 +139,27 @@ export default {
}
},
methods: {
handleImportSuccess(data) {
let head = data.head;
if (head != null) {
this.form.orderNo = head['生产单编号'];
this.form.orderDate = head['下单日期'];
this.form.deliveryDate = head['交货日期'];
this.form.customer = head['客人代码'];
this.form.num = head['数量'];
this.form.material = head['用料'];
this.form.remark = head['特殊要求'];
}
let body = data.body;
if (body != null) {
this.form.prodList.push(...body);
}
this.$message.success('导入成功');
this.importDialogVisible = false;
},
importExcel() {
this.importDialogVisible = true;
},
getDetail(id) {
this.loading = true;
getOrder(id).then(res => {

View File

@ -72,6 +72,7 @@
</template>
</template>
</el-table-column>
<el-table-column label="工序简称" align="center" prop="process"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@ -126,6 +127,9 @@
<form-col :span="span" label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" style="width: 100%" placeholder="请输入显示排序" />
</form-col>
<form-col :span="span" label="工序简称" prop="process">
<el-input v-model="form.process" placeholder="请输入工序简称,多个工序用逗号分隔" />
</form-col>
<form-col :span="span" label="负责人" prop="leaderId">
<user-input v-model="form.leaderIds" multiple/>
</form-col>