|
|
|
@ -49,7 +49,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
v-hasPermi="['mes:pro:order:add']"
|
|
|
|
|
>SAP同步</el-button>
|
|
|
|
|
>SAP同步
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!--
|
|
|
|
|
<el-button
|
|
|
|
@ -69,7 +70,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
v-hasPermi="['mes:pro:order:export']"
|
|
|
|
|
>导出</el-button>
|
|
|
|
|
>导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -78,7 +80,8 @@
|
|
|
|
|
icon="el-icon-sort"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="toggleExpandAll"
|
|
|
|
|
>展开/折叠</el-button>
|
|
|
|
|
>展开/折叠
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
@ -117,90 +120,119 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
@click="handleAdd(scope.row)"
|
|
|
|
|
@click="splitBtn(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:pro:order:add']"
|
|
|
|
|
v-if="scope.row.parentOrder == 0"
|
|
|
|
|
>拆分</el-button>
|
|
|
|
|
>拆分
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改订单对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
<!-- 拆分模块 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
|
|
|
|
<!-- 拆分头pro -->
|
|
|
|
|
<el-table
|
|
|
|
|
border
|
|
|
|
|
v-if="refreshProTable"
|
|
|
|
|
v-loading="proLoading"
|
|
|
|
|
:data="productData"
|
|
|
|
|
row-key="orderCode"
|
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column width="60" align="center" label="序号" type="index" :index="indexMethod"></el-table-column>
|
|
|
|
|
<el-table-column width="150" label="订单编号" prop="orderCode"/>
|
|
|
|
|
<el-table-column width="380" label="产品名称" align="center" prop="prodDesc"/>
|
|
|
|
|
<el-table-column width="130" label="产品数量" align="center" prop="quantity"/>
|
|
|
|
|
<el-table-column label="已拆分数量" align="center" prop="quantitySplit"/>
|
|
|
|
|
<el-table-column label="拆分数量" align="center" prop="atrr1"/>
|
|
|
|
|
</el-table>
|
|
|
|
|
<el-form class="my-margin" :model="form" ref="dynamicForm" label-width="80px">
|
|
|
|
|
<!-- 编辑框 -->
|
|
|
|
|
<!-- 第一行 -->
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="计划工厂编码" prop="planFactoryCode">
|
|
|
|
|
<el-input v-model="form.planFactoryCode" placeholder="请输入计划工厂编码" />
|
|
|
|
|
<!-- 选择产线 -->
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
<el-form-item label="选择产线:">
|
|
|
|
|
<el-select size="small" v-model="form.prodLineCode" placeholder="请选择产线">
|
|
|
|
|
<el-option v-for="item in proline" :key="item.key" :label="item.label" :value="item.key"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="订单号" prop="orderCode">
|
|
|
|
|
<el-input v-model="form.orderCode" placeholder="请输入订单号" />
|
|
|
|
|
<!-- 拆分数量 -->
|
|
|
|
|
<el-col :offset="2" :span="7">
|
|
|
|
|
<el-form-item size="small" label="拆分数量:">
|
|
|
|
|
<el-input required type="number" @input="splitNumChange" v-model="form.splitNum"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="物料号" prop="prodCode">
|
|
|
|
|
<el-input v-model="form.prodCode" placeholder="请输入物料号" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="物料名称" prop="prodDesc">
|
|
|
|
|
<el-input v-model="form.prodDesc" placeholder="请输入物料名称" />
|
|
|
|
|
<!-- 工单日期 -->
|
|
|
|
|
<el-col :offset="1" :span="5">
|
|
|
|
|
<el-form-item size="small" label="工单日期: ">
|
|
|
|
|
<el-date-picker v-model="form.productDate" type="date" placeholder="选择日期"></el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 第二行 -->
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="订单数量" prop="quantity">
|
|
|
|
|
<el-input v-model="form.quantity" placeholder="请输入订单数量" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="单位" prop="unit">
|
|
|
|
|
<el-input v-model="form.unit" placeholder="请输入单位" />
|
|
|
|
|
<el-col :span="6">
|
|
|
|
|
<!-- 选择班次 -->
|
|
|
|
|
<el-form-item size="small" label="选择班次:" class="my-select my-first">
|
|
|
|
|
<el-select v-model="form.shiftId" placeholder="请选择班次">
|
|
|
|
|
<el-option v-for="item in workShift" :key="item.shiftId" :label="item.shiftDesc"
|
|
|
|
|
:value="item.shiftId"></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="任务清单" prop="workerOrder">
|
|
|
|
|
<el-input v-model="form.workerOrder" placeholder="请输入任务清单" />
|
|
|
|
|
<!-- 第三行 -->
|
|
|
|
|
<el-row v-for="(item, index) in formFields" :key="index">
|
|
|
|
|
<!-- 批次编号 -->
|
|
|
|
|
<el-col :span="7">
|
|
|
|
|
<el-form-item size="small" label="批次编号">
|
|
|
|
|
<el-input v-model="item.batchCode"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="上级工单" prop="parentOrder">
|
|
|
|
|
<treeselect v-model="form.parentOrder" :options="orderOptions" :normalizer="normalizer" placeholder="请选择上级工单" />
|
|
|
|
|
<!-- 批次数量 -->
|
|
|
|
|
<el-col :offset="1" :span="4">
|
|
|
|
|
<el-form-item size="small" label="批次数量">
|
|
|
|
|
<el-input required @input="inBatch" type="number" v-model="item.batchQuantity"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<!-- 操作 -->
|
|
|
|
|
<el-col :offset="1" :span="4">
|
|
|
|
|
<el-button size="small" v-if="formFields.length > 1" @click="removeField(index)" type="danger">删除
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button size="small" v-if="index === formFields.length - 1" @click="addField" type="primary">添加
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 第四行 -->
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="计划生产日期" prop="planProDate">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planProDate"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划生产日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="计划完成日期" prop="planComplete">
|
|
|
|
|
<el-date-picker clearable
|
|
|
|
|
v-model="form.planComplete"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
placeholder="选择计划完成日期">
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-col :offset="11" :span="8">
|
|
|
|
|
<el-button @click="batchBtn" type="primary">提交</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<!-- 拆分尾 -->
|
|
|
|
|
<el-table
|
|
|
|
|
border
|
|
|
|
|
:data="splitData"
|
|
|
|
|
v-if="refreshWorkerTable"
|
|
|
|
|
v-loading="workerLoading"
|
|
|
|
|
row-key="workorderCode"
|
|
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column width="60" align="center" label="序号" type="index" :index="indexMethod"></el-table-column>
|
|
|
|
|
<el-table-column width="120" align="center" prop="prodLineCode" label="产线"></el-table-column>
|
|
|
|
|
<el-table-column width="300" align="center" prop="workorderCode" label="工单号"></el-table-column>
|
|
|
|
|
<el-table-column width="120" align="center" prop="quantitySplit" label="数量"></el-table-column>
|
|
|
|
|
<el-table-column align="center" prop="batchCodeList" label="批次号"></el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 测试 -->
|
|
|
|
|
<!-- 操作按钮 -->
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitForm">关 闭</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
@ -208,7 +240,18 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listOrder, getOrder, delOrder, addOrder, updateOrder } from "@/api/mes/pro/order";
|
|
|
|
|
import {
|
|
|
|
|
getWorkOrderList,
|
|
|
|
|
getOrderList,
|
|
|
|
|
subSplitOrder,
|
|
|
|
|
getConvert,
|
|
|
|
|
getprodLineShift,
|
|
|
|
|
listOrder,
|
|
|
|
|
getOrder,
|
|
|
|
|
delOrder,
|
|
|
|
|
addOrder,
|
|
|
|
|
updateOrder
|
|
|
|
|
} from "@/api/mes/pro/order";
|
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
|
|
|
|
@ -219,6 +262,38 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
|
|
//以下为新内容
|
|
|
|
|
productList:[],
|
|
|
|
|
//工单遮罩层
|
|
|
|
|
workerLoading: false,
|
|
|
|
|
//工单重新渲染表格
|
|
|
|
|
refreshWorkerTable: true,
|
|
|
|
|
//订单遮罩层
|
|
|
|
|
proLoading: true,
|
|
|
|
|
//订单重新渲染表格
|
|
|
|
|
refreshProTable: true,
|
|
|
|
|
//二级换算值
|
|
|
|
|
secConvert: null,
|
|
|
|
|
//三级换算值
|
|
|
|
|
thiConvert: null,
|
|
|
|
|
//拆分头pro
|
|
|
|
|
productData: [],
|
|
|
|
|
//拆分下部分
|
|
|
|
|
splitData: [],
|
|
|
|
|
//选择产线list表
|
|
|
|
|
proline: [],
|
|
|
|
|
//TODO
|
|
|
|
|
splitnum: null,
|
|
|
|
|
//TODO 班次
|
|
|
|
|
workShift: [],
|
|
|
|
|
// 调试
|
|
|
|
|
formFields: [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 显示搜索条件
|
|
|
|
@ -254,17 +329,133 @@ export default {
|
|
|
|
|
parentOrder: null,
|
|
|
|
|
prodType: null
|
|
|
|
|
},
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
// 拆分表单参数
|
|
|
|
|
form: {
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCode: null,
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: [],
|
|
|
|
|
},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
}
|
|
|
|
|
rules: {}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 拆分提交按钮 */
|
|
|
|
|
batchBtn() {
|
|
|
|
|
//整理订单传入到后端
|
|
|
|
|
this.form.formFields = this.formFields;
|
|
|
|
|
//整理数据往后端发送
|
|
|
|
|
//下面是请求处理
|
|
|
|
|
const data = {
|
|
|
|
|
formFields : this.formFields,
|
|
|
|
|
prodLineCode : this.form.prodLineCode,
|
|
|
|
|
productDate : this.form.productDate,
|
|
|
|
|
shiftId : this.form.shiftId,
|
|
|
|
|
splitNum : this.form.splitNum,
|
|
|
|
|
product : this.productData[0],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subSplitOrder(data).then(response => {
|
|
|
|
|
if(response.code == 500){
|
|
|
|
|
this.$modal.msgFaile(response.msg);
|
|
|
|
|
}
|
|
|
|
|
this.$modal.msgSuccess("提交成功");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let id = this.productData[0].id;
|
|
|
|
|
// 清除缓存
|
|
|
|
|
this.form = {
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCode: null,
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: [],
|
|
|
|
|
}
|
|
|
|
|
this.formFields = [],
|
|
|
|
|
// 获取该订单下最新订单列表
|
|
|
|
|
getOrderList(id).then(response => {
|
|
|
|
|
if(response.code == 500){
|
|
|
|
|
this.$modal.msgFaile(response.msg);
|
|
|
|
|
};
|
|
|
|
|
// 设置最新数据
|
|
|
|
|
this.productData[0] = response.data;
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true; // 设置加载状态为true,表示正在加载
|
|
|
|
|
this.refreshProTable = false; // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true; // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false; // 设置加载状态为false,表示加载完成
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 获取该订单下的最新工单列表
|
|
|
|
|
getWorkOrderList(id).then(response => {
|
|
|
|
|
if(response.code == 500){
|
|
|
|
|
this.$modal.msgFaile(response.msg);
|
|
|
|
|
};
|
|
|
|
|
// 设置最新数据
|
|
|
|
|
this.splitData = response.data;
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 调试
|
|
|
|
|
submitForm(formName) {
|
|
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
alert('submit!');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('error submit!!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
removeDomain(item) {
|
|
|
|
|
var index = this.dynamicValidateForm.domains.indexOf(item)
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
this.dynamicValidateForm.domains.splice(index, 1)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
addDomain() {
|
|
|
|
|
this.dynamicValidateForm.domains1.push({
|
|
|
|
|
value: '',
|
|
|
|
|
key: Date.now()
|
|
|
|
|
})
|
|
|
|
|
this.dynamicValidateForm.domains.push({
|
|
|
|
|
value: '',
|
|
|
|
|
key: Date.now()
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 动态添加表单 */
|
|
|
|
|
addField() {
|
|
|
|
|
//如果批次数量大于等于拆分数量则不允许拆分
|
|
|
|
|
let sum = 0;
|
|
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
|
|
sum += Number(this.formFields[i].batchQuantity);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
if (sum >= this.productData[0].atrr1) {
|
|
|
|
|
alert("无法添加!您批次数量已满!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
this.formFields.push({batchCode: '', batchQuantity: ''});
|
|
|
|
|
//自动填充
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(sum);
|
|
|
|
|
},
|
|
|
|
|
/** 动态删除表单 */
|
|
|
|
|
removeField(index) {
|
|
|
|
|
this.formFields.splice(index, 1);
|
|
|
|
|
},
|
|
|
|
|
/** 查询订单列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
@ -325,6 +516,28 @@ export default {
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
},
|
|
|
|
|
/** 拆分表单重置 */
|
|
|
|
|
resetBatch() {
|
|
|
|
|
this.form = {
|
|
|
|
|
id: null,
|
|
|
|
|
prodLineCode: null,
|
|
|
|
|
splitNum: null,
|
|
|
|
|
productDate: null,
|
|
|
|
|
shiftId: null,
|
|
|
|
|
formFields: [],
|
|
|
|
|
}
|
|
|
|
|
this.splitData = [],
|
|
|
|
|
this.secConvert = null,
|
|
|
|
|
this.thiConvert = null,
|
|
|
|
|
this.productData = [],
|
|
|
|
|
this.proline = [],
|
|
|
|
|
this.splitnum = null,
|
|
|
|
|
this.workShift = [],
|
|
|
|
|
this.formFields = [{
|
|
|
|
|
batchCode: '',
|
|
|
|
|
batchQuantity: ''
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.getList();
|
|
|
|
@ -344,7 +557,7 @@ export default {
|
|
|
|
|
this.form.parentOrder = 0;
|
|
|
|
|
}
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加订单";
|
|
|
|
|
this.title = "拆分";
|
|
|
|
|
},
|
|
|
|
|
/** 展开/折叠操作 */
|
|
|
|
|
toggleExpandAll() {
|
|
|
|
@ -368,7 +581,7 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
submitFormbak() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
@ -388,14 +601,196 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
handleDeletebak(row) {
|
|
|
|
|
this.$modal.confirm('是否确认删除订单编号为"' + row.id + '"的数据项?').then(function () {
|
|
|
|
|
return delOrder(row.id);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 拆分按钮操作 */
|
|
|
|
|
splitBtn(row) {
|
|
|
|
|
//数据初始化
|
|
|
|
|
//一级
|
|
|
|
|
row.atrr1 = 0;
|
|
|
|
|
//二级
|
|
|
|
|
if (row.children !== undefined) {
|
|
|
|
|
for (let i = 0; i < row.children.length; i++) {
|
|
|
|
|
row.children[i].atrr1 = 0;
|
|
|
|
|
//三级
|
|
|
|
|
if (row.children[i].children !== undefined) {
|
|
|
|
|
for (let j = 0; j < row.children[i].children.length; j++) {
|
|
|
|
|
row.children[i].children[j].atrr1 = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true; // 设置加载状态为true,表示正在加载
|
|
|
|
|
// 发送请求或执行异步操作获取最新的数据
|
|
|
|
|
//重置表单
|
|
|
|
|
this.resetBatch();
|
|
|
|
|
//将数据放入到productData中
|
|
|
|
|
this.productData.push(row);
|
|
|
|
|
//存放id
|
|
|
|
|
this.form.id = row.id;
|
|
|
|
|
this.refreshProTable = false; // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true; // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false; // 设置加载状态为false,表示加载完成
|
|
|
|
|
});
|
|
|
|
|
//初始化日期为默认今天
|
|
|
|
|
this.form.productDate = new Date();
|
|
|
|
|
//获取线体和班次
|
|
|
|
|
getprodLineShift().then(response => {
|
|
|
|
|
this.proline = response.data.lines;
|
|
|
|
|
this.workShift = response.data.shifts;
|
|
|
|
|
});
|
|
|
|
|
//获取换算值
|
|
|
|
|
getConvert().then(response => {
|
|
|
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
|
|
|
if (response.data[i].dictSort == 2) {
|
|
|
|
|
this.secConvert = response.data[i];
|
|
|
|
|
} else if (response.data[i].dictSort == 3) {
|
|
|
|
|
this.thiConvert = response.data[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取工单
|
|
|
|
|
getWorkOrderList(row.id).then(response => {
|
|
|
|
|
this.splitData = response.data;
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "拆分";
|
|
|
|
|
},
|
|
|
|
|
/** 拆分数量方法 */
|
|
|
|
|
splitNumChange(e) {
|
|
|
|
|
//打印换算值
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
e = 1;
|
|
|
|
|
this.form.splitNum = 1;
|
|
|
|
|
}
|
|
|
|
|
if (e != '' && e > 0) {
|
|
|
|
|
let max = Number(this.productData[0].quantity) - Number(this.productData[0].quantitySplit);
|
|
|
|
|
if (e > max) {
|
|
|
|
|
alert("最大值不能超过" + max + "!");
|
|
|
|
|
this.form.splitNum = max;
|
|
|
|
|
}
|
|
|
|
|
//前端数据同步
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true; // 设置加载状态为true,表示正在加载
|
|
|
|
|
//一级
|
|
|
|
|
this.productData[0].atrr1 = this.form.splitNum;
|
|
|
|
|
//二级
|
|
|
|
|
if (this.productData[0].children !== undefined) {
|
|
|
|
|
for (let i = 0; i < this.productData[0].children.length; i++) {
|
|
|
|
|
this.productData[0].children[i].atrr1 = Number(this.form.splitNum) * Number(this.secConvert.dictValue);
|
|
|
|
|
//三级
|
|
|
|
|
if (this.productData[0].children[i].children !== undefined) {
|
|
|
|
|
for (let j = 0; j < this.productData[0].children[i].children.length; j++) {
|
|
|
|
|
this.productData[0].children[i].children[j].atrr1 = Number(this.form.splitNum) * Number(this.secConvert.dictValue) * Number(this.thiConvert.dictValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.refreshProTable = false; // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true; // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false; // 设置加载状态为false,表示加载完成
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
//前端数据同步
|
|
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
|
|
this.proLoading = true; // 设置加载状态为true,表示正在加载
|
|
|
|
|
//一级
|
|
|
|
|
this.productData[0].atrr1 = 0;
|
|
|
|
|
//二级
|
|
|
|
|
if (this.productData[0].children !== undefined) {
|
|
|
|
|
for (let i = 0; i < this.productData[0].children.length; i++) {
|
|
|
|
|
this.productData[0].children[i].atrr1 = 0;
|
|
|
|
|
//三级
|
|
|
|
|
if (this.productData[0].children[i].children !== undefined) {
|
|
|
|
|
for (let j = 0; j < this.productData[0].children[i].children.length; j++) {
|
|
|
|
|
this.productData[0].children[i].children[j].atrr1 = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.refreshProTable = false; // 先将refreshProTable设置为false,隐藏表格
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
|
|
this.refreshProTable = true; // 立即将refreshProTable设置为true,显示表格
|
|
|
|
|
this.proLoading = false; // 设置加载状态为false,表示加载完成
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.product = this.productData[0];
|
|
|
|
|
},
|
|
|
|
|
/** 填写批次数量 */
|
|
|
|
|
inBatch(e) {
|
|
|
|
|
//不能为负数
|
|
|
|
|
if (e <= 0) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1;
|
|
|
|
|
}
|
|
|
|
|
//逻辑判断
|
|
|
|
|
let sum = 0;
|
|
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
|
|
sum += Number(this.formFields[i].batchQuantity);
|
|
|
|
|
}
|
|
|
|
|
//如果超过拆分数量,提示并清空当前输入
|
|
|
|
|
if (sum > this.productData[0].atrr1) {
|
|
|
|
|
alert("你的批次数量总和不能超过拆分数量");
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(Number(sum) - Number(e));
|
|
|
|
|
}
|
|
|
|
|
//如果拆分数量为空
|
|
|
|
|
if (this.productData[0].atrr1 == '' || this.productData[0].atrr1 == null) {
|
|
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.el-row {
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-col {
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bg-purple-dark {
|
|
|
|
|
background: #99a9bf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bg-purple {
|
|
|
|
|
background: #d3dce6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bg-purple-light {
|
|
|
|
|
background: #e5e9f2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.grid-content {
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
min-height: 36px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.row-bg {
|
|
|
|
|
padding: 10px 0;
|
|
|
|
|
background-color: #f9fafc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.my-margin {
|
|
|
|
|
margin-top: 40px;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|