|
|
@@ -2,59 +2,31 @@
|
|
|
|
|
|
<div class="ele-body">
|
|
|
<el-card shadow="never" v-loading="loading">
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px"
|
|
|
- class="ele-form-search">
|
|
|
- <el-form-item label="销售订单" prop="preSalesOrderNumber">
|
|
|
- <el-input v-model="queryParams.preSalesOrderNumber" placeholder="请输入销售订单" clearable
|
|
|
- @keyup.enter.native="handleQuery" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="客户代号" prop="customerCode">
|
|
|
- <el-input v-model="queryParams.customerCode" placeholder="请输入客户代号" clearable
|
|
|
- @keyup.enter.native="handleQuery" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="客户名称" prop="customerName">
|
|
|
- <el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable
|
|
|
- @keyup.enter.native="handleQuery" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="产品编码" prop="productCode">
|
|
|
- <el-input v-model="queryParams.productCode" placeholder="请输入产品编码" clearable
|
|
|
- @keyup.enter.native="handleQuery" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="订单状态" prop="productCode">
|
|
|
- <el-switch v-model="queryParams.status" :active-value="1" :inactive-value="0"
|
|
|
- @change="handleQuery"></el-switch>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
-
|
|
|
- <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQueryUnplanned">只显示未排订单</el-button> -->
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <ele-pro-table ref="tableRef" :columns="columns" :datasource="salesorderList" :pageSize="20"
|
|
|
- :pageSizes="[20, 30, 40, 50, 100]" row-key="id" @selection-change="handleSelectionChange" @reload="salesorderList">
|
|
|
+ <search ref="search" @search="reload"></search>
|
|
|
+
|
|
|
+ <ele-pro-table ref="tableRef" :columns="columns" :datasource="datasource" :pageSize="20"
|
|
|
+ :pageSizes="[20, 30, 40, 50, 100]" row-key="id" @selection-change="handleSelectionChange" :initLoad="false"
|
|
|
+ @done="onDone">
|
|
|
<template v-slot:toolbar>
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
|
|
- <el-button style="background-color: #4e6cef;color: white;border-color: #4e6cef" icon="el-icon-edit" size="mini" :disabled="single"
|
|
|
- @click="handleUpdate">修改</el-button>
|
|
|
- <el-button style="background-color: #dd2c00;color: white;border-color: #dd2c00" icon="el-icon-delete" size="mini" :disabled="multiple"
|
|
|
- @click="handleDelete">删除</el-button>
|
|
|
- <el-button style="background-color: #ec407a;color: white;border-color: #ec407a" icon="el-icon-download" size="mini" :disabled="single"
|
|
|
- @click="handleExpect">交期预估</el-button>
|
|
|
- <el-button style="background-color: #cddc39;color: white;border-color: #cddc39" icon="el-icon-download" size="mini" :disabled="multiple"
|
|
|
- @click="handleAllExpect">全部预估</el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleEstimatedDelivery">交期预估</el-button>
|
|
|
+ <el-button style="background-color: #dd2c00;color: white;border-color: #dd2c00" icon="el-icon-delete"
|
|
|
+ size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
|
|
+ <!-- <el-button style="background-color: #ec407a;color: white;border-color: #ec407a" icon="el-icon-download"
|
|
|
+ size="mini" :disabled="single" @click="handleExpect">交期预估</el-button> -->
|
|
|
+ <el-button style="background-color: #cddc39;color: white;border-color: #cddc39" icon="el-icon-download"
|
|
|
+ size="mini" :disabled="multiple" @click="handleAllExpect">全部预估</el-button>
|
|
|
+ <el-button style="background-color: #ec407a;color: white;border-color: #ec407a" icon="el-icon-download"
|
|
|
+ size="mini" @click="importTemplate">下载模板</el-button>
|
|
|
<el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport">导入</el-button>
|
|
|
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
|
|
- <el-button style="background-color: #8bc34a;color: white;border-color: #8bc34a" icon="el-icon-download" size="mini" :disabled="single"
|
|
|
- @click="handleSaleorder">转销售订单</el-button>
|
|
|
- <el-button type="success" icon="el-icon-download" size="mini"
|
|
|
- @click="handleAllSaleorder">一次性转销售订单</el-button>
|
|
|
+ <el-button style="background-color: #8bc34a;color: white;border-color: #8bc34a" icon="el-icon-download"
|
|
|
+ size="mini" :disabled="ids.length == 0" @click="handleSaleorder">转销售订单</el-button>
|
|
|
+ <!-- <el-button type="success" icon="el-icon-download" size="mini"
|
|
|
+ @click="handleAllSaleorder">一次性转销售订单</el-button> -->
|
|
|
+ </template>
|
|
|
+ <template v-slot:status="{ row }">
|
|
|
+ {{ row.status == 1 ? '启用' : '停用' }}
|
|
|
</template>
|
|
|
- <!-- <template v-slot:status="{ row }">
|
|
|
- {{ row.status ? '启用' : '停用' }}
|
|
|
- </template> -->
|
|
|
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="{ row }">
|
|
|
@@ -75,12 +47,12 @@
|
|
|
</ele-pro-table>
|
|
|
|
|
|
<!-- 添加或修改销售订单对话框 -->
|
|
|
- <el-dialog :title="titleExpect" :visible.sync="openExpect" width="70%" :close-on-click-modal="false"
|
|
|
- modal-append-to-body :fullscreen="fullscreen" class="fullscreen">
|
|
|
+ <ele-modal :title="titleExpect" :visible.sync="openExpect" :before-close="cancelExpect"
|
|
|
+ :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="70%" :maxable="true">
|
|
|
<template slot="title">
|
|
|
<modalTitle :title="titleExpect" @setFullscreen="fullscreen = !fullscreen"></modalTitle>
|
|
|
</template>
|
|
|
- <el-table v-loading="loading" :data="salesorderExpectList">
|
|
|
+ <el-table v-loading="loading" :data="salesOrderExpectList">
|
|
|
<el-table-column label="序号" align="center" prop="id" />
|
|
|
<el-table-column label="年份" align="center" prop="year" />
|
|
|
<el-table-column label="月份" align="center" prop="month" />
|
|
|
@@ -90,18 +62,19 @@
|
|
|
<el-table-column label="已排产产能" align="center" prop="plannedSumCapacity" />
|
|
|
<el-table-column label="未排产产能" align="center" prop="unplannedSumCapacity" />
|
|
|
<el-table-column label="本次排产产能" align="center" prop="currenPlannedSumCapacity" />
|
|
|
- <el-table-column label="已排产单号列表" align="center" prop="plannedOrder" />
|
|
|
- <el-table-column label="已排产产能列表" align="center" prop="plannedOrderCapacity" />
|
|
|
+ <el-table-column label="已排产单号列表" align="center" prop="plannedOrder" show-overflow-tooltip />
|
|
|
+ <el-table-column label="已排产产能列表" align="center" prop="plannedOrderCapacity" show-overflow-tooltip />
|
|
|
</el-table>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" :disabled="single" @click="submitFormExpect">确定交期</el-button>
|
|
|
<el-button type="primary" :disabled="multiple" @click="submitFormAllExpect">确定所有交期</el-button>
|
|
|
<el-button @click="cancelExpect">取 消</el-button>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </ele-modal>
|
|
|
|
|
|
<!-- 添加或修改销售订单对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="70%" :close-on-click-modal="false" modal-append-to-body>
|
|
|
+ <ele-modal :title="title" :visible.sync="open" :before-close="cancel" :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false" append-to-body width="70%" :maxable="true">
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
@@ -199,7 +172,7 @@
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </ele-modal>
|
|
|
|
|
|
<!-- 直报系统导入对话框 -->
|
|
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
|
@@ -216,16 +189,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { createAll, createOrUpdate, exportFile, importFile, listSalesorder, getSalesorder, delSalesorder, addSalesorder, updateSalesorder, listSalesorderExpect, occupyRes, listSalesorderOccupyRes, listSalesorderExpectAll, occupyAllRes } from "@/api/aps/presalesorder";
|
|
|
+import { estimateDeliveryDates, createAll, convertToSalesOrder, importTemplate, exportFile, importFile, listSalesorder, getSalesOrder, delSalesorder, addSalesorder, updateSalesorder, listSalesOrderExpect, occupyRes, listSalesOrderOccupyRes, listSalesorderExpectAll, occupyAllRes } from "@/api/aps/presalesorder";
|
|
|
import { API_BASE_URL, TOKEN_HEADER_NAME, LAYOUT_PATH } from '@/config/setting';
|
|
|
import { getToken, setToken } from '@/utils/token-util';
|
|
|
import { download } from '@/utils/request';
|
|
|
|
|
|
import modalTitle from '@/components/modalTitle.vue';
|
|
|
+
|
|
|
+import search from './search.vue';
|
|
|
+
|
|
|
export default {
|
|
|
name: "PreSalesorder",
|
|
|
|
|
|
- components: { modalTitle },
|
|
|
+ components: { modalTitle, search },
|
|
|
data() {
|
|
|
return {
|
|
|
fullscreen: false,
|
|
|
@@ -249,21 +225,20 @@ export default {
|
|
|
url: API_BASE_URL + "/aps/presalesorder/importData"
|
|
|
},
|
|
|
// 遮罩层
|
|
|
- loading: true,
|
|
|
+ loading: false,
|
|
|
// 选中数组
|
|
|
ids: [],
|
|
|
+ selectionData: [],
|
|
|
// 非单个禁用
|
|
|
single: true,
|
|
|
// 非多个禁用
|
|
|
multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
// 销售订单表格数据
|
|
|
salesorderList: [],
|
|
|
// 销售订单交期预估表格数据
|
|
|
- salesorderExpectList: [],
|
|
|
+ salesOrderExpectList: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
@@ -272,28 +247,7 @@ export default {
|
|
|
titleExpect: "交期确定",
|
|
|
// 是否显示弹出层
|
|
|
openExpect: false,
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- page: 1,
|
|
|
- preSalesOrderNumber: null,
|
|
|
- customerCode: null,
|
|
|
- customerName: null,
|
|
|
- productDescription: null,
|
|
|
- productCode: null,
|
|
|
- orderQuantity: null,
|
|
|
- unit: null,
|
|
|
- weightKg: null,
|
|
|
- customerDeliveryDate: null,
|
|
|
- productionDeliveryDate: null,
|
|
|
- materialCode: null,
|
|
|
- materialDescription: null,
|
|
|
- materialQuantity: null,
|
|
|
- materialUnit: null,
|
|
|
- materialWeightKg: null,
|
|
|
- status: null,
|
|
|
- },
|
|
|
+
|
|
|
columns: [
|
|
|
{
|
|
|
width: 45,
|
|
|
@@ -411,6 +365,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
prop: 'status',
|
|
|
+ slot: 'status',
|
|
|
label: '订单状态',
|
|
|
showOverflowTooltip: true,
|
|
|
align: 'center',
|
|
|
@@ -432,25 +387,174 @@ export default {
|
|
|
preSalesOrderNumber: [
|
|
|
{ required: true, message: "销售订单不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- }
|
|
|
+ },
|
|
|
+ selDataIds: [],
|
|
|
+ whereForm: {}
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getList();
|
|
|
+ async created() {
|
|
|
+ await this.reload();
|
|
|
},
|
|
|
methods: {
|
|
|
- handleChange(file, fileList) {
|
|
|
- this.fileList = fileList;
|
|
|
- console.log(fileList);
|
|
|
+ datasource({ page, where, limit }) {
|
|
|
+ const res = listSalesorder({ ...where, page, limit });
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ reload(where) {
|
|
|
+ console.log(where, 'where22222')
|
|
|
+ this.whereForm = where;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.$refs.tableRef && this.$refs.tableRef.reload)
|
|
|
+ this.$refs.tableRef.reload({ page: 1, where: where });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onDone() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.tableRef.setSelectedRowKeys(this.selDataIds);
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
- //上传限制
|
|
|
- beforeUpload(file) {
|
|
|
- const isLt10M = file.size / 1024 / 1024 < 10;
|
|
|
- if (!isLt10M) {
|
|
|
- this.$message.error('上传文件大小不能超过 10MB!');
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.resetForm();
|
|
|
+ const id = row.id || this.ids
|
|
|
+ getSalesOrder(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改销售订单";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ this.$confirm(`是否确认删除销售订单编号为"${ids}"的数据项?`, '提示')
|
|
|
+ .then(() => {
|
|
|
+ delSalesorder(ids)
|
|
|
+ .then(() => {
|
|
|
+ this.reload();
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
+ this.selectionData = selection
|
|
|
+ console.log(this.ids, 'selection')
|
|
|
+ this.single = selection.length !== 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
+
|
|
|
+
|
|
|
+ // if (selection.length == 1) {
|
|
|
+ // const selSalesOrderNumber = selection[0].preSalesOrderNumber;
|
|
|
+ // const list = this.$refs.tableRef.getData();
|
|
|
+ // const data = []
|
|
|
+ // for (let i = 0; i < list.length; i++) {
|
|
|
+ // if (list[i].preSalesOrderNumber == selSalesOrderNumber) {
|
|
|
+
|
|
|
+ // data.push(list[i].id);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this.selDataIds = data;
|
|
|
+
|
|
|
+ // }
|
|
|
+ // console.log(this.selDataIds, '勾选')
|
|
|
+ // if (this.selDataIds.length > 0) {
|
|
|
+ // this.$refs.tableRef.setSelectedRowKeys(this.selDataIds);
|
|
|
+ // }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ async handleEstimatedDelivery() {
|
|
|
+ if (this.ids.length === 0) {
|
|
|
+ this.$message.warning("请选择");
|
|
|
+ return;
|
|
|
}
|
|
|
- return isLt10M;
|
|
|
+ const res = await estimateDeliveryDates({ ids: this.ids })
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ this.reload();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /*交期预估*/
|
|
|
+ async handleExpect(row) {
|
|
|
+ if (this.ids.length === 0) {
|
|
|
+ this.$message.warning("请选择");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const id = row.id || this.ids;
|
|
|
+
|
|
|
+ const response = await getSalesOrder(id);
|
|
|
+ const saleOrder = response.data;
|
|
|
+ this.form = response.data;
|
|
|
+
|
|
|
+ //如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
+ if (saleOrder.status === "1" || saleOrder.status === "2") {
|
|
|
+ const occupyRes = await listSalesOrderOccupyRes(saleOrder);
|
|
|
+ this.salesOrderExpectList = occupyRes;
|
|
|
+ this.single = true;
|
|
|
+ this.multiple = true;
|
|
|
+ } else if (saleOrder.status === "0") {
|
|
|
+ const expectRes = await listSalesOrderExpect(saleOrder);
|
|
|
+ this.salesOrderExpectList = expectRes;
|
|
|
+ this.single = false;
|
|
|
+ this.multiple = true;
|
|
|
+ }
|
|
|
+ console.log(this.salesOrderExpectList.length, 'this.salesOrderExpectList.length')
|
|
|
+ if (this.salesOrderExpectList.length > 0) {
|
|
|
+ this.submitFormAllExpect();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submitFormAllExpect() {
|
|
|
+ var arr = [];
|
|
|
+ this.salesOrderExpectList.forEach(item => {
|
|
|
+ var node = {};
|
|
|
+ node.id = item.id;
|
|
|
+ node.createTime = item.createTime;
|
|
|
+ node.createUserId = item.createUserId;
|
|
|
+ node.year = item.year;
|
|
|
+ node.month = item.month;
|
|
|
+ node.day = item.day;
|
|
|
+ node.plannedCapacity = item.plannedCapacity;
|
|
|
+ node.unplannedSumCapacity = item.unplannedSumCapacity;
|
|
|
+ node.deliverDay = item.deliverDay;
|
|
|
+ node.currenPlannedSumCapacity = item.currenPlannedSumCapacity;
|
|
|
+ node.plannedSumCapacity = item.plannedSumCapacity;
|
|
|
+ node.plannedOrder = item.plannedOrder;
|
|
|
+ node.plannedOrderCapacity = item.plannedOrderCapacity;
|
|
|
+ node.plannedOrderDate = item.plannedOrderDate;
|
|
|
+ arr.push(node);
|
|
|
+ });
|
|
|
+ console.log(arr, 'arr')
|
|
|
+ occupyAllRes(arr).then(response => {
|
|
|
+ //console.log(response)
|
|
|
+ // this.openExpect = false;
|
|
|
+ this.reload();
|
|
|
+
|
|
|
+ this.$message.success("占用成功");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //全部预估
|
|
|
+ handleAllExpect() {
|
|
|
+
|
|
|
+ listSalesorderExpectAll().then(response => {
|
|
|
+
|
|
|
+ this.salesOrderExpectList = response;
|
|
|
+ this.openExpect = true;
|
|
|
+ this.single = true;
|
|
|
+ this.multiple = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 导入按钮操作 */
|
|
|
+ handleImport() {
|
|
|
+ this.upload.title = "销售订单数据导入";
|
|
|
+ this.upload.open = true;
|
|
|
},
|
|
|
//文件上传
|
|
|
uploadFile(param) {
|
|
|
@@ -461,7 +565,7 @@ export default {
|
|
|
importFile(fd)
|
|
|
.then((res) => {
|
|
|
this.$refs.uploadFile.clearFiles();
|
|
|
- this.handleQuery();
|
|
|
+
|
|
|
this.upload.open = false;
|
|
|
})
|
|
|
.catch((data) => {
|
|
|
@@ -473,29 +577,77 @@ export default {
|
|
|
this.$refs.uploadFile.clearFiles();
|
|
|
});
|
|
|
},
|
|
|
- /** 查询销售订单列表 */
|
|
|
- getList() {
|
|
|
- // console.log("getList")
|
|
|
+ //上传限制
|
|
|
+ beforeUpload(file) {
|
|
|
+ const isLt10M = file.size / 1024 / 1024 < 10;
|
|
|
+ if (!isLt10M) {
|
|
|
+ this.$message.error('上传文件大小不能超过 10MB!');
|
|
|
+ }
|
|
|
+ return isLt10M;
|
|
|
+ },
|
|
|
+ handleChange(file, fileList) {
|
|
|
+ this.fileList = fileList;
|
|
|
+ console.log(fileList);
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ console.log(this.whereForm, 'this.whereForm')
|
|
|
+
|
|
|
this.loading = true;
|
|
|
- listSalesorder(this.queryParams).then(response => {
|
|
|
- // console.log(response)
|
|
|
- this.salesorderList = response;
|
|
|
- this.total = response.total;
|
|
|
+ exportFile(this.whereForm).then(res => {
|
|
|
this.loading = false;
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
+ /** 下载模板操作 */
|
|
|
+ importTemplate() {
|
|
|
+ importTemplate(this.whereForm).then(res => {
|
|
|
+ this.$message.success("模板下载成功");
|
|
|
+ });
|
|
|
},
|
|
|
- // 取消按钮
|
|
|
- cancelExpect() {
|
|
|
- this.openExpect = false;
|
|
|
|
|
|
+ /** 转销售单按钮操作 */
|
|
|
+ handleSaleorder(row) {
|
|
|
+ if (this.ids.length == 0) {
|
|
|
+ this.$message.warning("请选择");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const filteredData = this.selectionData.filter((item) => item.status == 1);
|
|
|
+ console.log(filteredData, 'filteredData');
|
|
|
+ if (filteredData.length > 0) {
|
|
|
+ const ids = filteredData.map(item => item.id)
|
|
|
+ convertToSalesOrder({ ids: ids }).then(response => {
|
|
|
+ this.$message.success("转换成功");
|
|
|
+ this.reload();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // const id = row.id || this.ids
|
|
|
+
|
|
|
+ // getSalesOrder(id).then(response => {
|
|
|
+ // let saleorder = response.data;
|
|
|
+ // this.form = response.data;
|
|
|
+ // console.log(saleorder);
|
|
|
+ // //如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
+ // if (saleorder.status == "1") {
|
|
|
+ // convertToSalesOrder(this.ids).then(response => {
|
|
|
+ // this.$message.success("转换成功");
|
|
|
+ // });
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // else if (saleorder.status == "0") {
|
|
|
+ // //如果没有
|
|
|
+ // this.$message.success("没有交期预估");
|
|
|
+ // } else if (saleorder.status == "2") {
|
|
|
+ // //如果没有
|
|
|
+ // this.$message.success("已经转换过了");
|
|
|
+ // }
|
|
|
+ // });
|
|
|
},
|
|
|
// 表单重置
|
|
|
- reset() {
|
|
|
+ resetForm() {
|
|
|
this.form = {
|
|
|
id: null,
|
|
|
preSalesOrderNumber: null,
|
|
|
@@ -515,49 +667,18 @@ export default {
|
|
|
materialWeightKg: null,
|
|
|
status: null,
|
|
|
};
|
|
|
- //this.resetForm("form");
|
|
|
- },
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- //this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- /** 只显示未排订单按钮操作 */
|
|
|
- resetQueryUnplanned() {
|
|
|
- this.queryParams.status = "0";
|
|
|
- this.handleQuery();
|
|
|
},
|
|
|
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.id)
|
|
|
- this.single = selection.length !== 1
|
|
|
- this.multiple = !selection.length
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "添加销售订单";
|
|
|
- },
|
|
|
- /** 交期预估按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.openExpect = true;
|
|
|
+
|
|
|
+
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.resetForm();
|
|
|
},
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const id = row.id || this.ids
|
|
|
- getSalesorder(id).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改销售订单";
|
|
|
- });
|
|
|
+ // 取消按钮
|
|
|
+ cancelExpect() {
|
|
|
+ this.openExpect = false;
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
@@ -567,13 +688,13 @@ export default {
|
|
|
updateSalesorder(this.form).then(response => {
|
|
|
this.$message.success("修改成功");
|
|
|
this.open = false;
|
|
|
- this.getList();
|
|
|
+ this.reload();
|
|
|
});
|
|
|
} else {
|
|
|
addSalesorder(this.form).then(response => {
|
|
|
this.$message.success("新增成功");
|
|
|
this.open = false;
|
|
|
- this.getList();
|
|
|
+ this.reload();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -582,7 +703,7 @@ export default {
|
|
|
/** 提交交期确定按钮 */
|
|
|
submitFormExpect() {
|
|
|
const id = this.ids
|
|
|
- getSalesorder(id).then(response => {
|
|
|
+ getSalesOrder(id).then(response => {
|
|
|
// console.log(response);
|
|
|
let saleorder = response.data;
|
|
|
if (saleorder.status == "1" || saleorder.status == "2") {
|
|
|
@@ -590,21 +711,21 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
var i = 0;
|
|
|
- this.salesorderExpectList.forEach(item => {
|
|
|
+ this.salesOrderExpectList.forEach(item => {
|
|
|
i++;
|
|
|
item.plannedOrder = saleorder.preSalesOrderNumber + "-" + saleorder.materialCode + "";
|
|
|
item.plannedOrderCapacity = item.currenPlannedSumCapacity;
|
|
|
item.plannedSumCapacity = item.currenPlannedSumCapacity;
|
|
|
});
|
|
|
|
|
|
- var lastNode = this.salesorderExpectList[this.salesorderExpectList.length - 1];
|
|
|
- console.log(lastNode);
|
|
|
+ var lastNode = this.salesOrderExpectList[this.salesOrderExpectList.length - 1];
|
|
|
+ console.log(lastNode, 'lastNode');
|
|
|
var productDay = lastNode.deliverDay;
|
|
|
saleorder.productionDeliveryDate = productDay;
|
|
|
console.log(saleorder.productionDeliveryDate);
|
|
|
|
|
|
var arr = [];
|
|
|
- this.salesorderExpectList.forEach(item => {
|
|
|
+ this.salesOrderExpectList.forEach(item => {
|
|
|
var node = {};
|
|
|
node.id = item.id;
|
|
|
node.createTime = item.createTime;
|
|
|
@@ -630,67 +751,13 @@ export default {
|
|
|
updateSalesorder(saleorder).then(response => {
|
|
|
this.$message.success("修改成功");
|
|
|
this.openExpect = false;
|
|
|
- this.getList();
|
|
|
+ this.reload();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
});
|
|
|
},
|
|
|
- submitFormAllExpect() {
|
|
|
- var arr = [];
|
|
|
- this.salesorderExpectList.forEach(item => {
|
|
|
- var node = {};
|
|
|
- node.id = item.id;
|
|
|
- node.createTime = item.createTime;
|
|
|
- node.createUserId = item.createUserId;
|
|
|
- node.year = item.year;
|
|
|
- node.month = item.month;
|
|
|
- node.day = item.day;
|
|
|
- node.plannedCapacity = item.plannedCapacity;
|
|
|
- node.unplannedSumCapacity = item.unplannedSumCapacity;
|
|
|
- node.deliverDay = item.deliverDay;
|
|
|
- node.currenPlannedSumCapacity = item.currenPlannedSumCapacity;
|
|
|
- node.plannedSumCapacity = item.plannedSumCapacity;
|
|
|
- node.plannedOrder = item.plannedOrder;
|
|
|
- node.plannedOrderCapacity = item.plannedOrderCapacity;
|
|
|
- node.plannedOrderDate = item.plannedOrderDate;
|
|
|
- arr.push(node);
|
|
|
- });
|
|
|
-
|
|
|
- occupyAllRes(arr).then(response => {
|
|
|
- //console.log(response)
|
|
|
- this.openExpect = false;
|
|
|
- this.getList();
|
|
|
-
|
|
|
- this.$message.success("占用成功");
|
|
|
- });
|
|
|
- },
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const ids = row.id || this.ids;
|
|
|
- this.$confirm(`是否确认删除销售订单编号为"${ids}"的数据项?`, '提示')
|
|
|
- .then(() => {
|
|
|
- delSalesorder(ids)
|
|
|
- .then(() => {
|
|
|
- this.getList();
|
|
|
- this.$message.success("删除成功");
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => { });
|
|
|
- },
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- this.loading = true;
|
|
|
- exportFile(this.queryParams).then(res => {
|
|
|
- this.loading = false;
|
|
|
-
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
|
|
|
/** 转销售单按钮操作 */
|
|
|
handleAllSaleorder() {
|
|
|
@@ -703,101 +770,27 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- /** 转销售单按钮操作 */
|
|
|
- handleSaleorder(row) {
|
|
|
- const id = row.id || this.ids
|
|
|
- getSalesorder(id).then(response => {
|
|
|
- let saleorder = response.data;
|
|
|
- this.form = response.data;
|
|
|
- console.log(saleorder);
|
|
|
- //如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
- if (saleorder.status == "1") {
|
|
|
- createOrUpdate(saleorder).then(response => {
|
|
|
- this.$message.success("转换成功");
|
|
|
- });
|
|
|
- return;
|
|
|
-
|
|
|
- }
|
|
|
- else if (saleorder.status == "0") {
|
|
|
- //如果没有
|
|
|
- this.$message.success("没有交期预估");
|
|
|
- } else if (saleorder.status == "2") {
|
|
|
- //如果没有
|
|
|
- this.$message.success("已经转换过了");
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- /*销售单交期预估*/
|
|
|
- handleExpect(row) {
|
|
|
- const id = row.id || this.ids
|
|
|
-
|
|
|
- getSalesorder(id).then(response => {
|
|
|
- let saleorder = response.data;
|
|
|
- this.form = response.data;
|
|
|
- console.log(saleorder);
|
|
|
- //如果是已经占用资源,则显示已经占用的资源,不能重复
|
|
|
- if (saleorder.status == "1" || saleorder.status == "2") {
|
|
|
-
|
|
|
- listSalesorderOccupyRes(saleorder).then(response => {
|
|
|
- this.salesorderExpectList = response;
|
|
|
- this.openExpect = true;
|
|
|
- this.single = true;
|
|
|
- this.multiple = true;
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (saleorder.status == "0") {
|
|
|
-
|
|
|
- listSalesorderExpect(saleorder).then(response => {
|
|
|
- this.salesorderExpectList = response;
|
|
|
- this.openExpect = true;
|
|
|
- this.single = false;
|
|
|
- this.multiple = true;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- },
|
|
|
- //预览
|
|
|
- handleAllExpect() {
|
|
|
|
|
|
- listSalesorderExpectAll().then(response => {
|
|
|
|
|
|
- this.salesorderExpectList = response;
|
|
|
- this.openExpect = true;
|
|
|
- this.single = true;
|
|
|
- this.multiple = false;
|
|
|
- });
|
|
|
- },
|
|
|
- /** 下载模板操作 */
|
|
|
- importTemplate() {
|
|
|
- this.download('aps/salesorder/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`)
|
|
|
- },
|
|
|
- /** 导入按钮操作 */
|
|
|
- handleImport() {
|
|
|
- this.upload.title = "销售订单数据导入";
|
|
|
- this.upload.open = true;
|
|
|
- },
|
|
|
- // 提交上传文件
|
|
|
- submitFileForm() {
|
|
|
- this.$refs.upload.submit();
|
|
|
- },
|
|
|
- // 文件上传中处理
|
|
|
- handleFileUploadProgress(event, file, fileList) {
|
|
|
- this.upload.isUploading = true;
|
|
|
- },
|
|
|
- // 文件上传成功处理
|
|
|
- handleFileSuccess(response, file, fileList) {
|
|
|
- this.upload.open = false;
|
|
|
- this.upload.isUploading = false;
|
|
|
- this.$refs.upload.clearFiles();
|
|
|
- this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- response.msg + "</div>", "导入结果", {
|
|
|
- dangerouslyUseHTMLString: true
|
|
|
- });
|
|
|
- this.getList();
|
|
|
- },
|
|
|
+ // // 提交上传文件
|
|
|
+ // submitFileForm() {
|
|
|
+ // this.$refs.upload.submit();
|
|
|
+ // },
|
|
|
+ // // 文件上传中处理
|
|
|
+ // handleFileUploadProgress(event, file, fileList) {
|
|
|
+ // this.upload.isUploading = true;
|
|
|
+ // },
|
|
|
+ // // 文件上传成功处理
|
|
|
+ // handleFileSuccess(response, file, fileList) {
|
|
|
+ // this.upload.open = false;
|
|
|
+ // this.upload.isUploading = false;
|
|
|
+ // this.$refs.upload.clearFiles();
|
|
|
+ // this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
+ // response.msg + "</div>", "导入结果", {
|
|
|
+ // dangerouslyUseHTMLString: true
|
|
|
+ // });
|
|
|
+ // this.reload();
|
|
|
+ // },
|
|
|
}
|
|
|
};
|
|
|
-</script>
|
|
|
+</script>
|