|
|
@@ -0,0 +1,566 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="计划编号" prop="planCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.planCode"
|
|
|
+ placeholder="请输入计划编号"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="计划名称" prop="planName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.planName"
|
|
|
+ placeholder="请输入计划名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="制单时间" prop="planDate">
|
|
|
+ <el-date-picker clearable
|
|
|
+ v-model="queryParams.planDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择制单时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="单据状态" prop="status">
|
|
|
+ <el-select v-model="queryParams.status" placeholder="单据状态" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.sys_normal_disable"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['ems:pro:plan:add']"
|
|
|
+ >新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="mini"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ v-hasPermi="['ems:pro:plan:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="mini"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['ems:pro:plan:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['ems:pro:plan:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="计划编号" align="center" prop="planCode" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="handleView(scope.row)"
|
|
|
+ >{{scope.row.planCode}}</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="计划名称" align="center" prop="planName" />
|
|
|
+ <el-table-column label="制单时间" align="center" prop="planDate" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="单据状态" align="center" prop="status" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['ems:pro:plan:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['ems:pro:plan:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改生产计划对话框 -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="计划编号" prop="planCode">
|
|
|
+ <el-input v-model="form.planCode" placeholder="请输入计划编号" :readonly="optType == 'view'"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item label-width="80">
|
|
|
+ <el-switch v-model="autoGenFlag"
|
|
|
+ active-color="#13ce66"
|
|
|
+ active-text="自动生成"
|
|
|
+ @change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
|
|
+ </el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="计划名称" prop="planName">
|
|
|
+ <el-input v-model="form.planName" placeholder="请输入计划名称" :readonly="optType == 'view'"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="制单时间" prop="planDate">
|
|
|
+ <el-date-picker clearable
|
|
|
+ v-model="form.planDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择制单时间"
|
|
|
+ :readonly="optType == 'view'">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="单据状态">
|
|
|
+ <el-radio-group v-model="form.status" :disabled="optType == 'view'">
|
|
|
+ <el-radio
|
|
|
+ v-for="dict in dict.type.sys_normal_disable"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.value"
|
|
|
+ >{{dict.label}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" :readonly="optType == 'view'"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-divider content-position="center">生产计划明细信息</el-divider>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" v-if="optType !='view'" icon="el-icon-plus" size="mini" @click="handleAddProPlanLine">添加</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="danger" v-if="optType !='view'" icon="el-icon-delete" size="mini" @click="handleDeleteProPlanLine">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleLineExport"
|
|
|
+ v-hasPermi="['ems:pro:plan:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-table :data="proPlanLineList" :row-class-name="rowProPlanLineIndex" @selection-change="handleProPlanLineSelectionChange" ref="proPlanLine">
|
|
|
+ <el-table-column type="selection" width="50" align="center" />
|
|
|
+ <el-table-column label="设备名称" prop="machineryName" width="220">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.machineryName" placeholder="设备名称" readonly />
|
|
|
+ <el-input v-model="scope.row.machineryCode" placeholder="请选择设备编号" readonly>
|
|
|
+ <el-button style="border-color: #46a6ff; background-color: #46a6ff;color: white;" slot="append"
|
|
|
+ @click="handleSelectMachinery(scope.row.index)" icon="el-icon-search" v-if="optType !='view'"></el-button>
|
|
|
+ </el-input>
|
|
|
+ <MachinerySelectSingle ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelectSingle>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="物料名称/编号" prop="itemName" width="220">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.itemName" placeholder="物料名称" readonly />
|
|
|
+ <el-input v-model="scope.row.itemCode" placeholder="请选择物料编号" readonly>
|
|
|
+ <el-button style="border-color: #46a6ff; background-color: #46a6ff;color: white;" slot="append"
|
|
|
+ @click="handleSelect(scope.row.index)" icon="el-icon-search" v-if="optType !='view'"></el-button>
|
|
|
+ </el-input>
|
|
|
+ <ItemSelectSingle ref="itemSelect" @onSelected="onItemAdd"></ItemSelectSingle>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="模具工装" prop="moldName" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.moldName" placeholder="请输入模具工装" :readonly="optType == 'view'"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="排产数量" prop="plannedQty" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number v-model="scope.row.plannedQty" placeholder="请输入排产数量" style="width: 150px;" :disabled="optType == 'view'"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="开始时间" prop="startDate" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-date-picker clearable v-model="scope.row.startDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择开始时间" style="width: 160px;" :readonly="optType == 'view'"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="结束时间" prop="endDate" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-date-picker clearable v-model="scope.row.endDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择结束时间" style="width: 160px;" :readonly="optType == 'view'"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注" prop="remark" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.remark" type="textarea" placeholder="请输入内容" :readonly="optType == 'view'"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm" v-if="optType != 'view'">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/mes/pro/plan";
|
|
|
+import {genCode} from "@/api/system/autocode/rule"
|
|
|
+import ItemSelectSingle from "@/views/mes/md/mditem/components/single.vue";
|
|
|
+import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Plan",
|
|
|
+ components: {ItemSelectSingle, MachinerySelectSingle},
|
|
|
+ dicts: ['sys_normal_disable'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ autoGenFlag:false,
|
|
|
+ optType: undefined,
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 子表选中数据
|
|
|
+ checkedProPlanLine: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 生产计划表格数据
|
|
|
+ planList: [],
|
|
|
+ // 生产计划明细表格数据
|
|
|
+ proPlanLineList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ planId: null,
|
|
|
+ planCode: null,
|
|
|
+ planName: null,
|
|
|
+ planDate: null,
|
|
|
+ status: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ planCode: [
|
|
|
+ { required: true, message: "计划编号不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ planName: [
|
|
|
+ { required: true, message: "计划名称不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ planDate: [
|
|
|
+ { required: true, message: "制单日期不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询生产计划列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listPlan(this.queryParams).then(response => {
|
|
|
+ this.planList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ planId: null,
|
|
|
+ planCode: null,
|
|
|
+ planName: null,
|
|
|
+ planDate: null,
|
|
|
+ status: "0",
|
|
|
+ remark: null,
|
|
|
+ attr1: null,
|
|
|
+ attr2: null,
|
|
|
+ attr3: null,
|
|
|
+ attr4: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null
|
|
|
+ };
|
|
|
+ this.proPlanLineList = [];
|
|
|
+ this.autoGenFlag = false;
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.planId)
|
|
|
+ this.single = selection.length!==1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加生产计划";
|
|
|
+ this.optType = "add";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const planId = row.planId || this.ids
|
|
|
+ getPlan(planId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.proPlanLineList = response.data.proPlanLineList;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改生产计划";
|
|
|
+ this.optType = "edit";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ let isExit = this.proPlanLineList.every((item, index) => {
|
|
|
+ if(item.plannedQty == null || item.plannedQty === '' || item.plannedQty <= 0){
|
|
|
+ this.$message.error("第" + (index + 1) + "行排产数量必须大于0");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(item.startDate == null || item.startDate === ''){
|
|
|
+ this.$message.error("第" + (index + 1) + "行开始时间不能为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(item.endDate == null || item.endDate === ''){
|
|
|
+ this.$message.error("第" + (index + 1) + "行结束时间不能为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(new Date(item.startDate).getTime() > new Date(item.endDate).getTime()){
|
|
|
+ this.$message.error("第" + (index + 1) + "行开始时间不能大于结束时间");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(item.machineryId == null || item.machineryId === ''){
|
|
|
+ this.$message.error("第" + (index + 1) + "行设备名称不能为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(item.itemId == null || item.itemId === ''){
|
|
|
+ this.$message.error("第" + (index + 1) + "行物料名称不能为空");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ if(isExit == false){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.form.proPlanLineList = this.proPlanLineList;
|
|
|
+ if (this.form.planId != null) {
|
|
|
+ updatePlan(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addPlan(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const planIds = row.planId || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除生产计划编号为"' + planIds + '"的数据项?').then(function() {
|
|
|
+ return delPlan(planIds);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 生产计划明细序号 */
|
|
|
+ rowProPlanLineIndex({ row, rowIndex }) {
|
|
|
+ row.index = rowIndex + 1;
|
|
|
+ },
|
|
|
+ /** 生产计划明细添加按钮操作 */
|
|
|
+ handleAddProPlanLine() {
|
|
|
+ let obj = {};
|
|
|
+ obj.machineryId = "";
|
|
|
+ obj.machineryName = "";
|
|
|
+ obj.machineryCode = "";
|
|
|
+ obj.moldName = "";
|
|
|
+ obj.itemId = "";
|
|
|
+ obj.itemName = "";
|
|
|
+ obj.specification = "";
|
|
|
+ obj.plannedQty = "";
|
|
|
+ obj.producedQty = "";
|
|
|
+ obj.startDate = "";
|
|
|
+ obj.endDate = "";
|
|
|
+ obj.status = "";
|
|
|
+ obj.remark = "";
|
|
|
+ obj.attr1 = "";
|
|
|
+ obj.attr2 = "";
|
|
|
+ obj.attr3 = "";
|
|
|
+ obj.attr4 = "";
|
|
|
+ this.proPlanLineList.push(obj);
|
|
|
+ },
|
|
|
+ /** 生产计划明细删除按钮操作 */
|
|
|
+ handleDeleteProPlanLine() {
|
|
|
+ if (this.checkedProPlanLine.length == 0) {
|
|
|
+ this.$modal.msgError("请先选择要删除的生产计划明细数据");
|
|
|
+ } else {
|
|
|
+ const proPlanLineList = this.proPlanLineList;
|
|
|
+ const checkedProPlanLine = this.checkedProPlanLine;
|
|
|
+ this.proPlanLineList = proPlanLineList.filter(function(item) {
|
|
|
+ return checkedProPlanLine.indexOf(item.index) == -1
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 复选框选中数据 */
|
|
|
+ handleProPlanLineSelectionChange(selection) {
|
|
|
+ this.checkedProPlanLine = selection.map(item => item.index)
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('pro/plan/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `plan_${new Date().getTime()}.xlsx`)
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleLineExport() {
|
|
|
+ this.queryParams.planId = this.form.planId;
|
|
|
+ this.download('pro/line/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `plan_${new Date().getTime()}.xlsx`)
|
|
|
+ },
|
|
|
+ /** 设备选择 */
|
|
|
+ handleSelectMachinery(index){
|
|
|
+ this.addIndex = index;
|
|
|
+ this.$refs.machinerySelect.showFlag = true;
|
|
|
+ },
|
|
|
+ //设备资源选择回调
|
|
|
+ onMachineryAdd(rows){
|
|
|
+ console.log("=====" + rows);
|
|
|
+ const item = this.proPlanLineList[this.addIndex-1];
|
|
|
+ item.machineryId = rows.machineryId;
|
|
|
+ item.machineryCode = rows.machineryCode;
|
|
|
+ item.machineryName = rows.machineryName;
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 物料选择 */
|
|
|
+ handleSelect(index) {
|
|
|
+ this.addIndex = index;
|
|
|
+ this.$refs.itemSelect.showFlag = true;
|
|
|
+ },
|
|
|
+ //物料资源选择回调
|
|
|
+ onItemAdd(rows){
|
|
|
+ console.log("=====" + rows);
|
|
|
+ const item = this.proPlanLineList[this.addIndex-1];
|
|
|
+ item.itemId = rows.itemId;
|
|
|
+ item.itemCode = rows.itemCode;
|
|
|
+ item.itemName = rows.itemName;
|
|
|
+ item.specification = rows.specification;
|
|
|
+ },
|
|
|
+ handleView(row){
|
|
|
+ this.reset();
|
|
|
+ const planId = row.planId || this.ids
|
|
|
+ getPlan(planId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.proPlanLineList = response.data.proPlanLineList;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改生产计划";
|
|
|
+ this.optType = "view";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //自动生成编码
|
|
|
+ handleAutoGenChange(autoGenFlag){
|
|
|
+ if(autoGenFlag){
|
|
|
+ genCode('PRO_PLAN_CODE').then(response =>{
|
|
|
+ this.form.planCode = response;
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.form.planCode = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|