|
|
<template> <div class="mod-config"> <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;"> <el-form :inline="true" label-position="top" style="margin-top: 0px"> <el-form-item :label="'申请单号'"> <el-input v-model="searchData.notifyNo" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'申请账号'"> <el-input v-model="searchData.userName" style="width: 120px"></el-input> </el-form-item> <el-form-item label="状态" > <el-select v-model="searchData.status" clearable placeholder="请选择" style="width: 120px"> <el-option label="草稿" value="草稿"></el-option> <el-option label="待确认" value="待确认"></el-option> <el-option label="待检验" value="待检验"></el-option> <el-option label="编辑中" value="编辑中"></el-option> <el-option label="待出库" value="待出库"></el-option> <el-option label="已完成" value="已完成"></el-option> <el-option label="已关闭" value="已关闭"></el-option> <el-option label="已归档" value="已归档"></el-option> </el-select> </el-form-item> <el-form-item :label="'申请单日期'"> <el-date-picker style="width: 120px" v-model="searchData.startDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item style="margin-top: 23px;"> <label style="margin-left: 0px;font-size: 19px">➞</label> </el-form-item> <el-form-item :label="' '"> <el-date-picker style="width: 120px" v-model="searchData.endDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> </el-form> <el-form :inline="true" label-position="top" style="margin-top: 0px"> <el-form-item label="是否领料" > <el-select v-model="searchData.issueFlag" placeholder="请选择" style="width: 120px"> <el-option label="全部" value=""></el-option> <el-option label="Y" value="Y"></el-option> <el-option label="N" value="N"></el-option> </el-select> </el-form-item> <el-form-item label="领料结果" > <el-select v-model="searchData.issueResult" placeholder="请选择" style="width: 120px"> <el-option label="全部" value=""></el-option> <el-option label="部分发料" value="部分发料"></el-option> <el-option label="全部发料" value="全部发料"></el-option> </el-select> </el-form-item> <el-form-item :label="' '"> <el-button type="primary" @click="searchTable()">查询</el-button> <el-button type="primary" @click="createNotifyModal()">新增</el-button> <download-excel :fields="fields()" :data="exportData" type="xls" :name="exportName" :header="exportHeader" :footer="exportFooter" :fetch="createExportData" :before-generate="startDownload" :before-finish="finishDownload" worksheet="导出信息" class="el-button el-button--primary el-button--medium"> {{ '导出' }} </download-excel> </el-form-item> </el-form> </el-form>
<el-table :data="dataList" @row-click="changeData" :height="height" border highlight-current-row ref="mainTable" v-loading="dataListLoading" style="width: 100%; "> <el-table-column v-for="(item,index) in columnList1" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column header-align="center" align="center" width="140" label="操作"> <template slot-scope="scope"> <el-link style="cursor: pointer" v-if="scope.row.status==='草稿'" @click="submitNotifyModel(scope.row)">提交</el-link> <span v-if="scope.row.status==='草稿'"> | </span> <el-link style="cursor: pointer" v-if="scope.row.status==='待确认' || scope.row.status==='编辑中'" @click="xiadaNotifyModel(scope.row)">下达</el-link> <el-link style="cursor: pointer" v-if="scope.row.status==='待出库'" @click="editNotifyMaterialFun(scope.row)">编辑</el-link> <el-link style="cursor: pointer" v-if="scope.row.status!=='已完成' && scope.row.status!=='已关闭' && scope.row.status!=='待出库'" @click="closeNotifyModel(scope.row)">关闭</el-link> <span v-if="scope.row.status==='草稿'"> | </span> <el-link style="cursor: pointer" v-if="scope.row.status==='草稿' " @click="deleteNotifyConfirm(scope.row)">删除</el-link><!-- <a type="text" size="small" v-if="scope.row.status==='已关闭'" @click="openNotify(scope.row)">开启</a>--> </template> </el-table-column> </el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 1000]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination>
<el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick"> <el-tab-pane label="申请单明细" name="detail"> <el-form :inline="true" label-position="top" label-width="100px"> <el-button @click="createOrderDetail()" type="primary" style="margin-left: 10px" :disabled="(currentRow.status !== '草稿' && currentRow.status !== '编辑中' && currentRow.status !== '待确认')">{{'新增'}}</el-button> </el-form> <el-table :data="dataList2" :height="height" border v-loading="dataListLoading" style="width: 100%; "> <el-table-column header-align="center" align="center" width="60" label="操作"> <template slot-scope="scope"> <el-link style="cursor: pointer" @click="deleteNotifySOSPlus(scope.row)" :class="{ 'disabled-link': currentRow.status !== '草稿' && currentRow.status !== '编辑中' && currentRow.status !== '待确认' }">删除</el-link> </template> </el-table-column> <el-table-column v-for="(item,index) in columnList2" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table>
</el-tab-pane> <el-tab-pane label="材料明细" name="sub"> <el-form label-position="top" style="margin-left: 2px;"> <el-button v-if="!editBatchVisible" type="primary" @click="editBatchModel">批量编辑</el-button> <el-button v-if="!editBatchVisible" type="success" @click="addMaterialModal">新增</el-button> <el-button v-if="editBatchVisible" type="primary" @click="batchModel" :loading="saveLoading">批量保存</el-button> </el-form> <el-table :data="dataList3" :height="height" border :row-class-name="tableRowClassName" v-loading="dataListLoading" style="width: 100%; "> <el-table-column v-for="(item,index) in columnList3" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column prop="componentScrap" header-align="center" align="right" min-width="100" label="调机用量"> <template slot-scope="scope"> <span v-if="editBatchVisible"> <el-input :controls="false" v-model="scope.row.componentScrap" @input="value => { scope.row.componentScrap = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''; updateQtyToIssue(scope.row); }" style="height: 11px; width: 98%;"> </el-input> </span> <span v-else> <span>{{scope.row.componentScrap}}</span> </span> </template> </el-table-column> <el-table-column prop="firstInspectionQty" header-align="center" align="right" min-width="100" label="首检用量"> <template slot-scope="scope"> <span v-if="editBatchVisible"> <el-input :controls="false" v-model="scope.row.firstInspectionQty" @input="value => { scope.row.firstInspectionQty = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''; updateQtyToIssue(scope.row); }" style="height: 11px; width: 98%;"> </el-input> </span> <span v-else> <span>{{scope.row.firstInspectionQty}}</span> </span> </template> </el-table-column> <el-table-column prop="standardDosage" header-align="center" align="right" min-width="100" label="标准用量"> <template slot-scope="scope"> <span v-if="editBatchVisible"> <el-input :controls="false" v-model="scope.row.standardDosage" @input="value => { scope.row.standardDosage = value.match(/^(\d+\.?\d*|\.\d+)$/) ? value : ''; updateQtyToIssue(scope.row); }" style="height: 11px; width: 98%;"> </el-input> </span> <span v-else> <span>{{scope.row.standardDosage}}</span> </span> </template> </el-table-column> <el-table-column v-for="(item,index) in columnList3s" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作"> <template slot-scope="scope"> <el-link style="cursor: pointer" @click="getAlternativePart(scope.row)">替代料</el-link> <el-link style="cursor: pointer;margin-left: 5px;" type="danger" @click="deleteNotifyMaterial(scope.row)">删除</el-link> </template> </el-table-column> </el-table> </el-tab-pane> <el-tab-pane label="材料汇总" name="sum"> <el-table ref="sum" :data="dataList4" :height="height+20" border v-loading="dataListLoading" style="width: 100%; "> <el-table-column v-for="(item,index) in columnList4" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作"> <template slot-scope="scope"> <el-link style="cursor: pointer;" @click="outboundDetailModal(scope.row)">出库明细</el-link> </template> </el-table-column> </el-table> </el-tab-pane><!-- <el-tab-pane label="删除记录" name="change">--><!-- <el-table--><!-- :data="dataList5"--><!-- :height="height"--><!-- border--><!-- v-loading="dataListLoading"--><!-- style="width: 100%; ">--><!-- <!– <el-table-column–>--><!-- <!– header-align="center"–>--><!-- <!– align="center"–>--><!-- <!– width="80"–>--><!-- <!– fixed="left"–>--><!-- <!– label="操作">–>--><!-- <!– <template slot-scope="scope">–>--><!-- <!– <a type="text" size="small" @click="printLabel(scope.row)">打印标签</a>–>--><!-- <!– </template>–>--><!-- <!– </el-table-column>–>--><!-- <el-table-column--><!-- v-for="(item,index) in columnList5" :key="index"--><!-- :sortable="item.columnSortable"--><!-- :prop="item.columnProp"--><!-- :header-align="item.headerAlign"--><!-- :show-overflow-tooltip="item.showOverflowTooltip"--><!-- :align="item.align"--><!-- :fixed="item.fixed==''?false:item.fixed"--><!-- :min-width="item.columnWidth"--><!-- :label="item.columnLabel">--><!-- <template slot-scope="scope">--><!-- <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>--><!-- <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"--><!-- style="width: 100px; height: 80px"/></span>--><!-- </template>--><!-- </el-table-column>--><!-- </el-table>--><!-- </el-tab-pane>--><!-- <el-tab-pane label="关闭记录" name="close">--><!-- <el-table--><!-- :data="dataList6"--><!-- :height="height"--><!-- border--><!-- v-loading="dataListLoading"--><!-- style="width: 100%; ">--><!-- <!– <el-table-column–>--><!-- <!– header-align="center"–>--><!-- <!– align="center"–>--><!-- <!– width="80"–>--><!-- <!– fixed="left"–>--><!-- <!– label="操作">–>--><!-- <!– <template slot-scope="scope">–>--><!-- <!– <a type="text" size="small" @click="printLabel(scope.row)">打印标签</a>–>--><!-- <!– </template>–>--><!-- <!– </el-table-column>–>--><!-- <el-table-column--><!-- v-for="(item,index) in columnList6" :key="index"--><!-- :sortable="item.columnSortable"--><!-- :prop="item.columnProp"--><!-- :header-align="item.headerAlign"--><!-- :show-overflow-tooltip="item.showOverflowTooltip"--><!-- :align="item.align"--><!-- :fixed="item.fixed==''?false:item.fixed"--><!-- :min-width="item.columnWidth"--><!-- :label="item.columnLabel">--><!-- <template slot-scope="scope">--><!-- <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>--><!-- <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"--><!-- style="width: 100px; height: 80px"/></span>--><!-- </template>--><!-- </el-table-column>--><!-- </el-table>--><!-- </el-tab-pane>--> </el-tabs>
<el-dialog title="关闭原因" :close-on-click-modal="false" v-drag :visible.sync="closeModalFlag" width="450px"> <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;"> <el-row :gutter="20"> <el-col :span="24"> <el-form-item > <el-input type="textarea" v-model="closeData.closeRemark " :rows="3" resize='none' maxlength="200" show-word-limit style="height: 60px" > </el-input> </el-form-item> </el-col> </el-row> </el-form> <el-footer style="height:40px;margin-top: 60px;text-align:center"> <el-button type="primary" @click="closeNotify()">保存</el-button> <el-button type="primary" @click="closeModalFlag=false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="新建领料申请单" :close-on-click-modal="false" v-drag :visible.sync="createNotifyFlag" width="300px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-row :gutter="20"> <el-col :span="12"> <el-form-item :label="'工厂_BU'" style="width: 97%"> <el-select v-model="notifyData.bu" placeholder="请选择" style="width: 100%"> <el-option v-for = "i in userBuList" :key = "i.buNo" :label = "i.sitename" :value = "i.buNo"> <span style="float: left;width: 100px">{{ i.sitename }}</span> <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px"> {{ i.buDesc }} </span> </el-option> </el-select> </el-form-item> </el-col> <el-col :span="12"> <el-form-item :label="'车间'"> <el-select v-model="notifyData.workCenterNo" clearable placeholder="请选择" style="width: 100%"> <el-option v-for = "i in workCenterList" :key = "i.workCenterNo" :label = "i.workCenterDesc" :value = "i.workCenterNo"> </el-option> </el-select> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="24"> <el-form-item :label="'备注'" style="width: 97%"> <el-input type="textarea" :rows="3" v-model="notifyData.remark" style="width: 100%;"> </el-input><!-- <el-input type="textarea" v-model="notifyData.remark" style="width: 100%"></el-input>--> </el-form-item> </el-col> </el-row> </el-form> <el-footer style="height:35px;margin-top: 55px;text-align:center"> <el-button type="primary" @click="saveNotify()">保存</el-button> <el-button type="primary" @click="createNotifyFlag=false">关闭</el-button> </el-footer> </el-dialog>
<!-- 选择物料模态框 --> <el-dialog width="1000px" title="选择物料" :close-on-click-modal="false" :visible.sync="choosePartModalFlag"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-row :gutter="20"> <el-col :span="6"> <el-form-item :label="'物料编码'" > <el-input v-model="choosePartData.partNo"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'物料名称'" > <el-input v-model="choosePartData.partDesc"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'规格型号'" > <el-input v-model="choosePartData.spec"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item > <el-button type="primary" @click="searchPartModel" style="margin-top: 5px" class="">查询</el-button> </el-form-item> </el-col> </el-row> </el-form> <el-table :height="400" :data="choosePartList" border style="width: 100%;"> <el-table-column prop="partNo" header-align="center" align="left" min-width="80" label="物料编码"> </el-table-column> <el-table-column prop="partDesc" header-align="center" align="left" min-width="120" label="物料描述"> </el-table-column> <el-table-column prop="spec" header-align="center" align="left" min-width="120" label="规格型号"> </el-table-column> <el-table-column prop="sku" header-align="center" align="left" min-width="80" label="SKU"> </el-table-column> <el-table-column prop="umid" header-align="center" align="left" min-width="60" label="计量单位"> </el-table-column> <el-table-column fixed="left" header-align="center" align="center" width="60" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="choosePart(scope.row)">选择</a> </template> </el-table-column> </el-table> <el-pagination @size-change="pp_sizeChangeHandle" @current-change="pp_currentChangeHandle" :current-page="pp_pageIndex" :page-sizes="[20, 50, 100, 1000]" :page-size="pp_pageSize" :total="pp_totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="choosePartModalFlag=false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="选择派工单" :close-on-click-modal="false" v-drag :visible.sync="chooseSOSModalFlag" width="1000px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-row :gutter="20"> <el-col :span="4"> <el-form-item :label="'生产订单'" > <el-input v-model="chooseSOSData.orderno" ></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item :label="'派工单号'" > <el-input v-model="chooseSOSData.seqno" ></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item :label="'机台'" > <el-input v-model="chooseSOSData.sResourceid" ></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item :label="'派工日期'" > <el-date-picker style="width: 100%" v-model="chooseSOSData.startDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> </el-col> <el-col :span="4"> <el-form-item :label="'到'" > <el-date-picker style="width: 100%" v-model="chooseSOSData.endDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="6"> <el-form-item > <el-button type="primary" @click="searchSOSRouting()" style="margin-top: 5px" class="">查询</el-button> </el-form-item> </el-col> </el-row> </el-form> <el-table :height="400" :data="chooseSOSList" border style="width: 100%;"> <el-table-column v-for="(item,index) in chooseSOSColumnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="left" header-align="center" align="center" width="60" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="chooseSOS(scope.row)">选择</a> </template> </el-table-column> </el-table> <el-pagination @size-change="ss_sizeChangeHandle" @current-change="ss_currentChangeHandle" :current-page="ss_pageIndex" :page-sizes="[20, 50, 100, 1000]" :page-size="ss_pageSize" :total="ss_totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="chooseSOSModalFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="选择工单" :close-on-click-modal="false" v-drag :visible.sync="chooseOrderModalFlag" width="1000px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-row :gutter="20"> <el-col :span="6"> <el-form-item :label="'生产订单'" > <el-input v-model="chooseOrderData.orderNo"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'工单状态'" > <el-select multiple collapse-tags v-model="chooseOrderData.statusList" clearable style="width: 220px"> <el-option label="全部" value=""></el-option> <el-option label="已停工" value="已停工"></el-option> <el-option label="已开工" value="已开工"></el-option> <el-option label="已取消" value="已取消"></el-option> <el-option label="已计划" value="已计划"></el-option> <el-option label="已排产" value="已排产"></el-option> <el-option label="已下达" value="已下达"></el-option> <el-option label="已关闭" value="已关闭"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'开始日期'" > <el-date-picker style="width: 100%" v-model="chooseOrderData.date3" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'结束日期'" > <el-date-picker style="width: 100%" v-model="chooseOrderData.date4" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="6"> <el-form-item > <el-button type="primary" @click="searchOrder()" style="margin-top: 5px" class="">查询</el-button> </el-form-item> </el-col> </el-row> </el-form> <el-table :height="400" :data="chooseOrderList" border style="width: 100%;"> <el-table-column v-for="(item,index) in chooseOrderColumnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="left" header-align="center" align="center" width="60" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="chooseOrder(scope.row)">选择</a> </template> </el-table-column> </el-table> <el-pagination @size-change="co_sizeChangeHandle" @current-change="co_currentChangeHandle" :current-page="co_pageIndex" :page-sizes="[20, 50, 100, 1000]" :page-size="co_pageSize" :total="co_totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="chooseOrderModalFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="选择工序" :close-on-click-modal="false" v-drag :visible.sync="chooseOperationModalFlag" width="800px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-row :gutter="20"> <el-col :span="6"> <el-form-item :label="'工序名称'" > <el-input v-model="chooseOperationData.itemDesc"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item > <el-button type="primary" @click="searchOperation()" style="margin-top: 5px" class="">查询</el-button> </el-form-item> </el-col> </el-row> </el-form> <el-table :height="400" :data="chooseOperationList" border style="width: 100%;"> <el-table-column v-for="(item,index) in chooseOperationColumnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="left" header-align="center" align="center" width="60" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="chooseOperation(scope.row)">选择</a> </template> </el-table-column> </el-table> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="chooseOperationModalFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="选择机台" :close-on-click-modal="false" v-drag :visible.sync="chooseResourceModalFlag" width="800px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-row :gutter="20"> <el-col :span="6"> <el-form-item :label="'机台编号'" > <el-input v-model="chooseResourceData.resourceId"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'机台描述'" > <el-input v-model="chooseResourceData.resourceDesc"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item > <el-button type="primary" @click="searchResource()" style="margin-top: 5px" class="">查询</el-button> </el-form-item> </el-col> </el-row> </el-form> <el-table :height="400" :data="chooseResourceList" border style="width: 100%;"> <el-table-column v-for="(item,index) in chooseResourceColumnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="left" header-align="center" align="center" width="60" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="chooseResource(scope.row)">选择</a> </template> </el-table-column> </el-table> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="chooseResourceModalFlag = false">关闭</el-button> </el-footer> </el-dialog>
<el-dialog title="申请单明细" :close-on-click-modal="false" v-drag :visible.sync="saveOrderDetailFlag" width="750px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <!-- BOM物料和非BOM物料选择 --> <el-row :gutter="20" style="margin-bottom: 15px;"> <el-col :span="24"> <el-form-item :label="'物料类型'" style="display: none;"> <el-radio-group v-model="orderDetailData.materialType" @change="onMaterialTypeChange"> <el-radio label="BOM物料">BOM物料</el-radio> <el-radio label="非BOM物料">非BOM物料</el-radio> </el-radio-group> </el-form-item> </el-col> </el-row>
<el-row :gutter="20"> <el-col :span="6"> <el-form-item> <template slot="label"> <span v-if="orderDetailData.materialType === '非BOM物料'" slot="label">生产订单</span> <span v-else style="cursor: pointer" slot="label" @click="openChooseOrderModal"><a>生产订单</a></span> </template> <el-input v-model="orderDetailData.orderNo" disabled placeholder="请选择生产订单"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <template slot="label"> <span v-if="orderDetailData.materialType === '非BOM物料'" slot="label">派工单号</span> <span v-else style="cursor: pointer" slot="label" @click="openChooseSOSModal"><a>派工单号</a></span> </template> <el-input v-model="orderDetailData.seqNo" disabled></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <template slot="label"> <span v-if="orderDetailData.orderNo && !orderDetailData.seqNo" style="cursor: pointer" slot="label" @click="openChooseOperationModal"><a>工序名称</a></span> <span v-else slot="label">工序名称</span> </template> <el-input v-model="orderDetailData.itemDesc" disabled placeholder="请选择工序"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <template slot="label"> <span v-if="orderDetailData.orderNo && !orderDetailData.seqNo" style="cursor: pointer" slot="label" @click="openChooseResourceModal"><a>机台</a></span> <span v-else slot="label">机台</span> </template> <el-input v-model="orderDetailData.resourceDesc" disabled placeholder="请选择机台"></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="6"> <el-form-item> <template slot="label"> <span v-if="orderDetailData.materialType === 'BOM物料'" slot="label">物料编码</span> <span v-else style="cursor: pointer" slot="label" @click="openChoosePartModal"><a>物料编码</a></span> </template> <el-input v-model="orderDetailData.partNo" disabled></el-input> </el-form-item> </el-col> <el-col :span="18"> <el-form-item :label="'物料描述'" style="display: block"> <el-input v-model="orderDetailData.partDesc" disabled></el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="20"> <el-col :span="4"> <el-form-item :label="'工单/派工数量'"> <el-input v-model="orderDetailData.qtyRequired" disabled style="text-align: right" class="text-right"></el-input> </el-form-item> </el-col> <el-col :span="4"> <el-form-item :label="'此次领料数量'"> <el-input-number v-model="orderDetailData.issureQty" style="line-height: 20px;padding: 0;width: 100%" :controls="false" :step="0" :min="0" class="text-right"></el-input-number> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="'要求发料时间'"> <el-date-picker style="width: 100%" v-model="orderDetailData.needDate" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"> </el-date-picker> </el-form-item> </el-col> <el-col :span="10"> <el-form-item style="margin-top: 17px"> <span style="line-height: 32px;font-size: 12px;"> 已排产未开工机台数:<span style="color: rgb(38, 92, 147);font-weight: bold;">{{ orderDetailData.notYetStartedResourceTotal || 0 }}</span> <span style="margin-left: 15px;">已排产机台总数:<span style="color: rgb(38, 92, 147);font-weight: bold;">{{ orderDetailData.apsResourceTotal || 0 }}</span></span> </span> </el-form-item> </el-col> </el-row> </el-form> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="saveIssueNoOrderDetail()">保存</el-button> <el-button type="primary" @click="saveOrderDetailFlag=false">关闭</el-button> </el-footer> </el-dialog>
<!-- 出库明细 --> <el-dialog title="出库明细" :close-on-click-modal="false" v-drag :visible.sync="detailModal2" width="900px"> <el-table height="400px" :data="detailList2" border style="width: 100%;"> <el-table-column v-for="(item,index) in columnDetailList2" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed===''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> </el-table-column> </el-table> <el-footer style="height:35px;margin-top: 15px;text-align:center"> <el-button type="primary" @click="detailModal2 = false">关闭</el-button> </el-footer> </el-dialog>
<!-- 新增材料模态框 --> <el-dialog title="新增材料明细" :close-on-click-modal="false" v-drag :visible.sync="addMaterialModalFlag" width="525px"> <el-form :inline="true" label-position="top" :model="newMaterialData" style="margin-left: 7px;margin-top: -5px;"> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(508)"><a href="#">物料信息</a></span> <el-input v-model="newMaterialData.componentPartNo" @change="partBlur(508)" style="width: 120px"></el-input> <el-input v-model="newMaterialData.partDesc" disabled style="width: 362px"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="newMaterialData" style="margin-left: 7px"> <el-form-item label="生产订单"> <el-select v-model="newMaterialData.orderNo" @change="onOrderNoChange" placeholder="请选择生产订单" style="width: 215px"> <el-option v-for="item in orderOptions" :key="item.orderNo" :label="item.orderNo" :value="item.orderNo"> </el-option> </el-select> </el-form-item> <el-form-item label="申请单序号"> <el-input v-model="newMaterialData.itemNo" disabled style="width: 122px"></el-input> </el-form-item> <el-form-item label="类型"> <el-input v-model="newMaterialData.issueType" value="替代料" disabled style="width: 122px"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="newMaterialData" style="margin-left: 7px"> <el-form-item label="调机量"> <el-input-number :controls="false" :step="0" v-model="newMaterialData.componentScrap" :min="0" style="width: 152px"></el-input-number> </el-form-item> <el-form-item label="首检量"> <el-input-number :controls="false" :step="0" v-model="newMaterialData.firstInspectionQty" :min="0" style="width: 152px"></el-input-number> </el-form-item> <el-form-item label="标准用量"> <el-input-number :controls="false" :step="0" v-model="newMaterialData.standardDosage" :min="0" style="width: 152px"></el-input-number> </el-form-item> </el-form> <el-form :inline="true" label-position="top" style="margin-left: 7px"> <el-form-item :label="'备注'"> <el-input type="textarea" v-model="newMaterialData.remark" :rows="3" resize='none' show-word-limit style="width: 485px;height: 20px"></el-input> </el-form-item> </el-form> <el-footer style="height:35px;margin-top: 55px;text-align:center"> <el-button type="primary" @click="saveNewMaterial">保存</el-button> <el-button type="primary" @click="addMaterialModalFlag=false">取消</el-button> </el-footer> </el-dialog>
<!-- 替代料模态框 --> <el-dialog title="替代料列表" :close-on-click-modal="false" v-drag :visible.sync="alternativePartsModalFlag" width="900px"> <el-table :data="alternativePartsList" border v-loading="alternativePartsLoading" style="width: 100%;" height="400"><!-- <el-table-column prop="partNo" label="母件编码" align="center" min-width="120"></el-table-column>--><!-- <el-table-column prop="partDesc" label="母件名称" align="left" min-width="150" show-overflow-tooltip></el-table-column>--><!-- <el-table-column prop="componentPartNo" label="子件编码" align="center" min-width="120"></el-table-column>--><!-- <el-table-column prop="componentPartDesc" label="子件名称" align="left" min-width="150" show-overflow-tooltip></el-table-column>--> <el-table-column prop="alternativePartNo" label="替代料编码" align="left" min-width="120"></el-table-column> <el-table-column prop="alternativePartDesc" label="替代料名称" align="left" min-width="150" show-overflow-tooltip></el-table-column> <el-table-column prop="replacementRatio" label="替代比例" align="right" min-width="100"></el-table-column> <el-table-column prop="priority" label="优先级" align="right" min-width="80"></el-table-column> </el-table> <span slot="footer" class="dialog-footer"> <el-button @click="alternativePartsModalFlag = false">关闭</el-button> </span> </el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> </div></template>
<script> import { searchNotifyHeader , searchNotifyOrderList , searchNotifyMaterialList , searchSumNotifyMaterialList , deleteNotifySOSPlus , updateNotifyStatus , deleteNotifyMaterial , searchNotifyLog , searchNotifyLogClose , getSiteAndBuByUserName , createNotify , getSOScheduledRoutingListForIssureByPaging , getPartListByPaging , xiadaNotify , editNotifyMaterial , deleteNotify, updateNotifyDetail, saveSOIssueNotifyOrderMateria, getBomAlternativeParts, getWorkCenterList } from "@/api/orderIssure/soIssueNotify.js" import { searchShopOrderByPaging , getRouteInShopOrder } from "@/api/shopOrder/shopOrder.js" import { searchAllResource } from "@/api/base/site.js"
import { getTableDefaultListLanguage, getTableUserListLanguage, } from "@/api/table.js" import {saveIssueNoOrderDetail} from "../../../../api/orderIssure/soIssueNotify"; import { getOutboundDetail2, // 获取出库明细
} from "@/api/qc/outbound_notification.js" import Chooselist from '@/views/modules/common/Chooselist_eam' import {verifyData} from "@/api/chooselist/chooselist.js"
export default { components: { Chooselist, }, data() { return { height:200, activeName: 'detail', dataList: [], dataList2: [], dataList3: [], dataList4: [], dataList5: [], dataList6: [], userBuList:[], workCenterList: [], createNotifyFlag: false, saveOrderDetailFlag: false, closeData:{ site:'', notifyNo:'', closeRemark:'', username:this.$store.state.user.name, }, closeModalFlag:false, addMaterialModalFlag: false, newMaterialData: { componentPartNo: '', partDesc: '', issueType: '替代料', orderNo: '', itemNo: '', remark: '', componentScrap: 0, firstInspectionQty: 0, standardDosage: 0, bomSeqNo: '', warehouseId: '', qtyToIssueOriginal: '' }, alternativePartsModalFlag: false, alternativePartsList: [], alternativePartsLoading: false, orderOptions: [], searchData: { page: 1, limit: 100, site: '', userName: '', notifyNo: '', status: '草稿', issueFlag: '', loginUserName: this.$store.state.user.name, issueResult: '', startDate: '', endDate: '', sql: "", }, notifyData:{ site: '', bu: '', notifyNo: '', notifyDate: '', enteredDate: '', userName: this.$store.state.user.name, userDisplay: '', remark: '', planIssueDate: '', workCenterNo: '' }, pageIndex: 1, pageSize: 100, totalPage: 0, //工单分页
co_pageIndex: 1, co_pageSize: 100, co_totalPage: 0, //派工单分页
ss_pageIndex: 1, ss_pageSize: 100, ss_totalPage: 0, //非BOM物料分页
pp_pageIndex: 1, pp_pageSize: 100, pp_totalPage: 0, dataListLoading: false, currentRow:'', columnList1:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1NotifyNo', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "notifyNo", headerAlign: "center", align: "center", columnLabel: "申请单单号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1Bu', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "bu", headerAlign: "center", align: "center", columnLabel: "BU", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1NotifyDate', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "notifyDate", headerAlign: "center", align: "center", columnLabel: "申请日期", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1UserName', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "userName", headerAlign: "center", align: "left", columnLabel: "申请账号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1UserDisplay', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "userDisplay", headerAlign: "center", align: "left", columnLabel: "申请人姓名", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1IssueFlag', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "issueFlag", headerAlign: "center", align: "center", columnLabel: "是否领料", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 60 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1IssueResult', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "issueResult", headerAlign: "center", align: "left", columnLabel: "领料结果", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1Status', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "status", headerAlign: "center", align: "left", columnLabel: "状态", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table1Remark', tableId: "701002Table1", tableName: "领料申请主表", columnProp: "remark", headerAlign: "center", align: "left", columnLabel: "备注", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200 }, ], columnList2:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2ItemNo', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "itemNo", headerAlign: "center", align: "right", columnLabel: "序号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 40 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2NeedDate', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: 'needDate', headerAlign: "center", align: "center", columnLabel: '要求发料日期', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2SOOrderNo', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "sOOrderNo", headerAlign: "center", align: "left", columnLabel: "生产订单", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2OpsItemNo', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "opsItemNo", headerAlign: "center", align: "right", columnLabel: "工序", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 50 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2ItemDesc', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "itemDesc", headerAlign: "center", align: "left", columnLabel: "工序名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2SeqNo', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "seqNo", headerAlign: "center", align: "left", columnLabel: "派工单号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2FGPartNo', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "fGPartNo", headerAlign: "center", align: "left", columnLabel: "派工单物料", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2PartDesc', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "物料名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 300 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2ResourceId', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: 'resourceId', headerAlign: "center", align: "left", columnLabel: '机台', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80, }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2NotYetStartedResourceTotal', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: 'notYetStartedResourceTotal', headerAlign: "center", align: "right", columnLabel: '已排产未开工机台数', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2ApsResourceTotal', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: 'apsResourceTotal', headerAlign: "center", align: "right", columnLabel: '已排产机台总数', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table2IssureQty', tableId: "701002Table2", tableName: "申请单工单信息明细表", columnProp: "issureQty", headerAlign: "center", align: "right", columnLabel: "发料数量", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, ], columnList3:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3OrderNo', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "orderNo", headerAlign: "center", align: "left", columnLabel: "生产订单号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3BOMItemNo', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "bOMItemNo", headerAlign: "center", align: "right", columnLabel: "BOM序号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3ComponentPartNo', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "componentPartNo", headerAlign: "center", align: "center", columnLabel: "材料编码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3PartDesc', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "材料名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 300 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3IssueMethod', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "issueMethod", headerAlign: "center", align: "left", columnLabel: "领料方式", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3OutboundWarehouseId', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "warehouseName", headerAlign: "center", align: "left", columnLabel: "领料仓库", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3IssueType', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "issueType", headerAlign: "center", align: "left", columnLabel: "类型", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, ], columnList3s:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3QtyToIssue', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "qtyToIssue", headerAlign: "center", align: "right", columnLabel: "申请数量", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, // {
// userId: this.$store.state.user.name,
// functionId: 701002,
// serialNumber: '701002Table3Remark',
// tableId: "701002Table3",
// tableName: "申请单材料明细表",
// columnProp: "remark",
// headerAlign: "center",
// align: "left",
// columnLabel: "备注",
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 160
// },
{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3OpsItemNo', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "opsItemNo", headerAlign: "center", align: "right", columnLabel: "领料工序", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3LocationNo', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "locationNo", headerAlign: "center", align: "left", columnLabel: "领料机台", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table3SeqNo', tableId: "701002Table3", tableName: "申请单材料明细表", columnProp: "seqNo", headerAlign: "center", align: "left", columnLabel: "派工单号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150 }, ], columnList4:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table4IssueType', tableId: "701002Table4", tableName: "申请单材料明细表", columnProp: "issueType", headerAlign: "center", align: "left", columnLabel: "类型", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table4ComponentPartNo', tableId: "701002Table4", tableName: "申请单材料明细表", columnProp: "componentPartNo", headerAlign: "center", align: "left", columnLabel: "材料编码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table4PartDesc', tableId: "701002Table4", tableName: "申请单材料明细表", columnProp: "partDesc", headerAlign: "center", align: "left", columnLabel: "材料名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table4PartDesc', tableId: "701002Table4", tableName: "申请单材料明细表", columnProp: "warehouseName", headerAlign: "center", align: "left", columnLabel: "领料仓库", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table4QtyToIssue', tableId: "701002Table4", tableName: "申请单材料明细表", columnProp: "qtyToIssue", headerAlign: "center", align: "right", columnLabel: "合计申请数量", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 },{ userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table4QtyToIssueOriginal', tableId: "701002Table4", tableName: "申请单材料明细表", columnProp: "qtyToIssueOriginal", headerAlign: "center", align: "right", columnLabel: "合计已发数量", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, ], columnList5:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5UpdateType', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "updateType", headerAlign: "center", align: "center", columnLabel: "删除类型", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5ItemNo', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "itemNo", headerAlign: "center", align: "right", columnLabel: "领料单序号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5SOOrderNo', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "sOOrderNo", headerAlign: "center", align: "left", columnLabel: "生产订单", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5SeqNo', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "seqNo", headerAlign: "center", align: "left", columnLabel: "派工单", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5ComponentPartNo', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "componentPartNo", headerAlign: "center", align: "left", columnLabel: "材料物料编码", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5IssueType', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "issueType", headerAlign: "center", align: "left", columnLabel: "材料类型", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5QtyToIssue', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "qtyToIssue", headerAlign: "center", align: "right", columnLabel: "要求领料数量", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5UpdateBy', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "updateBy", headerAlign: "center", align: "left", columnLabel: "删除账号", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table5UpdateDate', tableId: "701002Table5", tableName: "申请单材料删除记录表", columnProp: "updateDate", headerAlign: "center", align: "center", columnLabel: "删除时间", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, ], columnList6:[ { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table6UserDisplay', tableId: "701002Table6", tableName: "申请单材料关闭明细", columnProp: "userDisplay", headerAlign: "center", align: "left", columnLabel: "操作人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table6ActionTime', tableId: "701002Table6", tableName: "申请单材料关闭明细", columnProp: "actionTime", headerAlign: "center", align: "left", columnLabel: "操作时间", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130 }, { userId: this.$store.state.user.name, functionId: 701002, serialNumber: '701002Table6ActionRemark', tableId: "701002Table6", tableName: "申请单材料关闭明细", columnProp: "actionRemark", headerAlign: "center", align: "left", columnLabel: "关闭原因", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 300 }, ],
// 导出 start
exportData: [], exportName: '发料申请单'+this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["发料申请单"], exportFooter: [], // 导出 end
orderDetailData:{ orderNo:'', seqNo:'', locationNo:'', qtyrequired:'', issureQty:0, partDesc:'', partNo:'', resourceId:'', resourceDesc:'', needDate:'', itemDesc:'', workCenterNo:'', itemNo:0, materialType:'BOM物料', alreadyApplyTotal: 0, apsResourceTotal: 0, notYetStartedResourceTotal: 0 }, chooseSOSModalFlag: false, chooseSOSData: { page: 1, limit: 100, orderno: '', seqno: '', sResourceid: '', startDate: '', endDate: '', }, chooseOrderModalFlag: false, chooseOrderData: { page: 1, limit: 100, orderNo: '', status: '', date3: '', date4: '', statusList: '', }, chooseOrderList: [], chooseOperationModalFlag: false, chooseOperationData: { orderNo: '', site: '', itemDesc: '' }, chooseOperationList: [], chooseResourceModalFlag: false, chooseResourceData: { site: '', workCenterNo: '', resourceID: '', resourceDesc: '', }, chooseResourceList: [], chooseSOSList: [], choosePartModalFlag: false, choosePartData: { page: 1, limit: 100, site: '', sourceBu: '', partNo: '', partDesc: '', spec: '', }, choosePartList: [], chooseSOSColumnList: [ { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2Orderno', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'orderno', headerAlign: "center", align: "center", columnLabel: '生产订单', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2Seqno', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'seqno', headerAlign: "center", align: "center", columnLabel: '派工单号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2PartNo', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'partNo', headerAlign: "center", align: "left", columnLabel: '物料编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2PartDesc', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'partDesc', headerAlign: "center", align: "left", columnLabel: '物料描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2Qtyrequired', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'qtyrequired', headerAlign: "center", align: "right", columnLabel: '派工数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2SResourceid', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'sResourceid', headerAlign: "center", align: "left", columnLabel: '机台编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 60, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2ResourceDesc', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'resourceDesc', headerAlign: "center", align: "left", columnLabel: '机台名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2StartDate', tableId: "701001Table2", tableName: "查询派工单", columnProp: 'startDate', headerAlign: "center", align: "left", columnLabel: '开始日期', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, ], chooseOrderColumnList: [ { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2Orderno', tableId: "701001Table2", tableName: "查询工单", columnProp: 'orderNo', headerAlign: "center", align: "center", columnLabel: '工单号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2PartNo', tableId: "701001Table2", tableName: "查询工单", columnProp: 'partNo', headerAlign: "center", align: "left", columnLabel: '物料编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2PartDescription', tableId: "701001Table2", tableName: "查询工单", columnProp: 'partDescription', headerAlign: "center", align: "left", columnLabel: '物料描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2LotSize', tableId: "701001Table2", tableName: "查询工单", columnProp: 'lotSize', headerAlign: "center", align: "right", columnLabel: '工单数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2Status', tableId: "701001Table2", tableName: "查询工单", columnProp: 'status', headerAlign: "center", align: "center", columnLabel: '状态', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80, }, ], chooseOperationColumnList: [ { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2ItemNo', tableId: "701001Table2", tableName: "查询工序", columnProp: 'itemNo', headerAlign: "center", align: "center", columnLabel: '工序号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2OperationDesc', tableId: "701001Table2", tableName: "查询工序", columnProp: 'operationDesc', headerAlign: "center", align: "left", columnLabel: '工序名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, } ], chooseResourceColumnList: [ { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2ResourceID', tableId: "701001Table2", tableName: "查询机台", columnProp: 'resourceID', headerAlign: "center", align: "left", columnLabel: '机台编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 701001, serialNumber: '701001Table2ResourceDesc', tableId: "701001Table2", tableName: "查询机台", columnProp: 'resourceDesc', headerAlign: "center", align: "left", columnLabel: '机台描述', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, ], detailModal2: false, detailList2: [], columnDetailList2: [ { columnProp: 'subNo', headerAlign: "center", align: "left", columnLabel: '标签条码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { columnProp: 'subQty', headerAlign: "center", align: "right", columnLabel: '出库数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { columnProp: 'orderRef4', headerAlign: "center", align: "left", columnLabel: '出库仓库', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, { columnProp: 'orderRef5', headerAlign: "center", align: "left", columnLabel: '出库库位', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, { columnProp: 'userName', headerAlign: "center", align: "left", columnLabel: '操作员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { columnProp: 'transDate', headerAlign: "center", align: "center", columnLabel: '操作时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, }, ], editBatchVisible: false, saveLoading: false, } }, computed: { // 计算属性:判断当前状态是否可编辑
isEditableStatusComputed() { if (!this.currentRow || !this.currentRow.status) { return false; } return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中' || this.currentRow.status === '待确认'; } }, mounted () { this.$nextTick(() => { this.height = (window.innerHeight- 315) / 2 }) },
created () { this.getSiteAndBuByUserName() this.searchTable() },
methods: {
// 批量编辑模态框
editBatchModel() { if (this.currentRow.status !== '草稿' && this.currentRow.status !== '编辑中' && this.currentRow.status !== '待确认') { this.$message.warning('该类型单据不能编辑!') return } if (this.editBatchVisible) { this.editBatchVisible = false } else { this.editBatchVisible = true } },
// 批量保存
batchModel() { let params = [] params = this.dataList3 this.saveLoading = true updateNotifyDetail(params).then(({data}) => { if (data && data.code === 0) { this.getNotifyMaterialList() this.$message.success(data.msg) this.editBatchVisible = false } else { this.$message.error(data.msg) } }).finally(() => { this.saveLoading = false }) },
// 出库明细
outboundDetailModal (row) { let tempData = { site: row.site, buNo: row.bu, orderNo: row.notifyNo, partNo: row.componentPartNo, orderType: '生产领料' } getOutboundDetail2(tempData).then(({data}) => { if (data && data.code === 0) { this.detailList2 = data.rows } else { this.detailList2 = [] } }) this.detailModal2 = true },
// 动态列开始 获取 用户保存的 格式列
async getTableUserColumn(tableId, columnId) { let queryTableUser = { userId: this.$store.state.user.name, functionId: this.$route.meta.menuId, tableId: tableId, status: true, languageCode: this.$i18n.locale } await getTableUserListLanguage(queryTableUser).then(({data}) => { if (data.rows.length > 0) { //this.columnList1 = []
switch (columnId) { case 1: this.columnList1 = data.rows break; case 2: this.columnList2 = data.rows break; case 3: this.columnList3 = data.rows break; case 4: this.columnList4 = data.rows break; case 5: this.columnList5 = data.rows break; case 6: this.columnList6 = data.rows break; } } else { this.getColumnList(tableId, columnId) } }) },
// 获取 tableDefault 列
async getColumnList (tableId, columnId) { let queryTable= { functionId: this.$route.meta.menuId, tableId: tableId, languageCode: this.$i18n.locale } await getTableDefaultListLanguage(queryTable).then(({data}) => { if (!data.rows.length == 0) { switch (columnId) { case 1: this.columnList1 = data.rows break; case 2: this.columnList2 = data.rows break; case 3: this.columnList3 = data.rows break; case 4: this.columnList4 = data.rows break; case 5: this.columnList5 = data.rows break; case 6: this.columnList6 = data.rows break; } } else { // this.showDefault = true.
} })
},
// 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.searchTable() }, // 当前页
currentChangeHandle (val) { this.pageIndex = val this.searchTable() }, tabClick (tab, event) { // 刷新列表数据
this.refreshCurrentTabTable() }, changeData(row){ this.currentRow = JSON.parse(JSON.stringify(row)); this.refreshCurrentTabTable (); }, refreshCurrentTabTable(){ if(this.currentRow===''||this.currentRow===null){ this.currentRow={site:'',notifyNo:''} } if(this.activeName==='detail'){ searchNotifyOrderList(this.currentRow).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code == 0) { this.dataList2 = data.rows
} else { this.dataList2 = []; } }); }else if(this.activeName==='sub'){ searchNotifyMaterialList(this.currentRow).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code == 0) { this.dataList3 = data.rows } else { this.dataList3 = []; } }); } // else if(this.activeName==='change'){
// searchNotifyLog(this.currentRow).then(({data}) => {
// //区分请求成功和失败的状况
// if (data && data.code == 0) {
// this.dataList5 = data.rows
//
// } else {
// this.dataList5 = [];
// }
// });
// }
// else if(this.activeName==='close'){
// searchNotifyLogClose(this.currentRow).then(({data}) => {
// //区分请求成功和失败的状况
// if (data && data.code == 0) {
// this.dataList6 = data.rows
//
// } else {
// this.dataList6 = [];
// }
// });
// }
else { searchSumNotifyMaterialList(this.currentRow).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code == 0) { this.dataList4 = data.rows } else { this.dataList4 = []; } this.$nextTick(() => { this.$refs.sum.doLayout(); // 重新计算布局
}); }); } },
getNotifyMaterialList () { searchNotifyMaterialList(this.currentRow).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code == 0) { this.dataList3 = data.rows } else { this.dataList3 = [] } }) },
searchTable(){ this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex // 返回 Promise,让外部可以等它完成
return new Promise((resolve, reject) => { searchNotifyHeader(this.searchData).then(({ data }) => { if (data && data.code == 0) { this.dataList = data.page.list; this.pageIndex = data.page.currPage; this.pageSize = data.page.pageSize; this.totalPage = data.page.totalCount; resolve(); // 请求成功,执行 resolve
} else { this.dataList = []; reject(new Error(data ? data.msg : '请求失败')); } }).catch(err => { this.dataList = []; reject(err); // 请求出错
}); }); }, closeNotifyModel(row){ this.closeData.site=row.site this.closeData.notifyNo=row.notifyNo this.closeData.closeRemark='' this.closeModalFlag=true }, closeNotify(){ if(this.closeData.closeRemark==null||this.closeData.closeRemark===''){ this.$alert("必须输入关闭原因", '错误', { confirmButtonText: '确定' }) return false; }
let inData={ site:this.closeData.site, notifyNo:this.closeData.notifyNo, closeRemark:this.closeData.closeRemark, username:this.$store.state.user.name, status:'已关闭', } updateNotifyStatus(inData).then(({data}) => { if (data && data.code === 0) { this.closeModalFlag=false this.searchTable() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }, deleteNotifyConfirm(row){ this.$confirm('确认删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { let inData={ site:row.site, notifyNo:row.notifyNo } deleteNotify(inData).then(({data}) => { if (data && data.code === 0) { this.searchTable() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }) }, openNotify(row){ this.$confirm('确认打开?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { let inData={ site:row.site, notifyNo:row.notifyNo, status:'已下达', } updateNotifyStatus(inData).then(({data}) => { if (data && data.code === 0) { this.searchTable() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }) }, deleteNotifyMaterial(row){ this.$confirm('确认删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { deleteNotifyMaterial(row).then(({data}) => { if (data && data.code === 0) { this.refreshCurrentTabTable() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }) }, deleteNotifySOSPlus(row){ // 检查当前状态是否允许编辑
if (!this.isEditableStatusComputed) { this.$alert('当前状态不允许编辑!只有草稿、编辑中或待确认状态才能删除明细。', '提示', { confirmButtonText: '确定' }) return false }
this.$confirm('确认删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { deleteNotifySOSPlus(row).then(({data}) => { if (data && data.code === 0) { this.refreshCurrentTabTable() this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }) },
//申请单主表新增方法
//新增领料申请单模态框
createNotifyModal(){ this.notifyData = { site: '', bu: this.userBuList[0].buNo, notifyNo: '', notifyDate: '', enteredDate: '', userName: this.$store.state.user.name, userDisplay: '', remark: '', planIssueDate: '', workCenterNo: '' } this.createNotifyFlag = true },
getSiteAndBuByUserName() { let inData = { username: this.$store.state.user.name } getSiteAndBuByUserName(inData).then(({data}) =>{ if (data && data.code === 0) { this.userBuList = data.rows if (this.userBuList.length > 0) { this.getWorkCenterList() } } }) },
// 查加工中心
getWorkCenterList() { let inData = { site: this.userBuList[0].buNo.split('_')[0], buNo: this.userBuList[0].buNo.split('_')[1] } getWorkCenterList(inData).then(({data}) =>{ if (data && data.code === 0) { this.workCenterList = data.rows } }) },
//保存领料申请单
saveNotify() { let buValue = this.notifyData.bu let site = buValue.split('_')[0] let bu = buValue.split('_')[1] let inData = { site: site, bu: bu, userName: this.$store.state.user.name, remark: this.notifyData.remark, workCenterNo: this.notifyData.workCenterNo, } createNotify(inData).then(({data})=>{ if (data.code === 0) { this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) this.createNotifyFlag = false // 刷新主表数据
this.searchTable() }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
//新增派工单明细
createOrderDetail(){ // 检查是否选择了主表行
if (!this.currentRow || !this.currentRow.notifyNo) { this.$alert('请先选择一条主表记录!', '提示', { confirmButtonText: '确定' }) return false }
// 检查当前状态是否允许编辑
if (!this.isEditableStatusComputed) { this.$alert('当前状态不允许编辑!只有草稿、编辑中或待确认状态才能新增明细。', '提示', { confirmButtonText: '确定' }) return false }
// 清除所有数据,设置默认值
this.orderDetailData = { orderNo: '', seqNo: '', operationNo: '', locationNo: '', qtyRequired: '', issureQty: 0, partDesc: '', partNo: '', resourceId: '', resourceDesc: '', itemDesc: '', itemNo: 0, workCenterNo: '', needDate: '', materialType: 'BOM物料', alreadyApplyTotal: 0, apsResourceTotal: 0, notYetStartedResourceTotal: 0 }
this.saveOrderDetailFlag = true },
saveIssueNoOrderDetail(){ // 数据验证
// 非BOM物料时,只校验领取数量和要求发料时间
if (this.orderDetailData.materialType === 'BOM物料') { if (!this.orderDetailData.orderNo ) { this.$message.error('请选择工单或者派工单'); return false } if (!this.orderDetailData.itemNo) { this.$message.error('请选择工序'); return false } /*//校验如果是BOM物料的话,领料数量不能大于工单数量 if (this.orderDetailData.issureQty > this.orderDetailData.qtyRequired){ this.$message.error('领取数量不可大于工单/派工数量!'); return false }
//校验如果是BOM物料的话,领料数量不能大于工单数量
if ((this.orderDetailData.issureQty + this.orderDetailData.alreadyApplyTotal) > this.orderDetailData.qtyRequired){ this.$message.error('申请总和不可超出工单/派工数量!'); return false }*/ }
if (!this.orderDetailData.needDate) { this.$message.error('请选择要求发料时间'); return false }
if (!this.orderDetailData.issureQty || this.orderDetailData.issureQty <= 0) { this.$message.error('请填写领取数量'); return false }
// 构建API请求参数
let inData = { site: this.currentRow.site, bu: this.currentRow.bu, notifyNo: this.currentRow.notifyNo, materialType: this.orderDetailData.materialType, sOOrderNo: this.orderDetailData.orderNo, seqNo: this.orderDetailData.seqNo, fGPartNo: this.orderDetailData.partNo, opsItemNo: this.orderDetailData.itemNo, issureQty: this.orderDetailData.issureQty, needDate: this.orderDetailData.needDate, outWorkOrderFlag: 'N', username: this.$store.state.user.name, // 扩展字段
itemDesc: this.orderDetailData.itemDesc, partDesc: this.orderDetailData.partDesc, resourceDesc: this.orderDetailData.resourceDesc, resourceId: this.orderDetailData.resourceId, workCenterNo: this.orderDetailData.workCenterNo, qtyrequired: this.orderDetailData.qtyRequired, apsResourceTotal: this.orderDetailData.apsResourceTotal, notYetStartedResourceTotal: this.orderDetailData.notYetStartedResourceTotal }
// 调用API保存派工单数据
saveIssueNoOrderDetail(inData).then(({data}) => { if (data && data.code === 0) { this.$message({ message: '保存成功', type: 'success', duration: 1500, onClose: () => {} })
// 关闭模态框
this.saveOrderDetailFlag = false
// 刷新当前标签页数据
this.refreshCurrentTabTable()
// 清空表单数据
this.orderDetailData = { orderNo: '', seqNo: '', operationNo: '', locationNo: '', qtyRequired: '', issureQty: 0, partDesc: '', partNo: '', resourceId: '', resourceDesc: '', itemDesc: '', itemNo: 0, workCenterNo: '', needDate: '', materialType: 'BOM物料', alreadyApplyTotal: 0, apsResourceTotal: 0, notYetStartedResourceTotal: 0 } } else { this.$alert(data.msg || '保存失败', '错误', { confirmButtonText: '确定' }) } }).catch(error => { console.error('保存派工单明细失败:', error) this.$alert('保存失败,请稍后重试', '错误', { confirmButtonText: '确定' }) }) },
//导出excel
async createExportData() { this.searchData.limit = -1 this.searchData.page = 1 const {data} = await searchNotifyHeader(this.searchData) return data.page.list; }, startDownload() { // this.exportData = this.dataList
}, finishDownload() { }, fields() { let json = "{" this.columnList1.forEach((item, index) => { if (index == this.columnList1.length - 1) { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" } else { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + "," } }) json += "}" let s = eval("(" + json + ")")
return s },
tableRowClassName ({row, rowIndex}) {
if (row.qtyToIssueOriginal<row.qtyToIssue&&new Date(row.needDate)<new Date(this.dayjs().format("YYYY-MM-DD HH:mm"))) { return 'error-row' }
return '' },
onMaterialTypeChange(value) { // 清空相关字段
this.orderDetailData.orderNo = ''; this.orderDetailData.seqNo = ''; this.orderDetailData.operationNo = ''; this.orderDetailData.partNo = ''; this.orderDetailData.partDesc = ''; this.orderDetailData.locationNo = ''; this.orderDetailData.resourceId = ''; this.orderDetailData.resourceDesc = ''; this.orderDetailData.qtyRequired = ''; this.orderDetailData.itemDesc = ''; this.orderDetailData.itemNo = ''; this.orderDetailData.workCenterNo = ''; this.orderDetailData.issureQty = 0; this.orderDetailData.alreadyApplyTotal = 0; },
//派工单选择部分
openChooseSOSModal() { // 检查是否选择了主表行
if (!this.currentRow || !this.currentRow.notifyNo) { this.$alert('请先选择一条主表记录!', '提示', { confirmButtonText: '确定' }) return false }
this.ss_totalPage= 0;
// 初始化选择派工单数据
this.chooseSOSData = { page: 1, limit: 100, site: this.currentRow.site, bu: this.currentRow.bu, orderNo: '', seqNo: '', sResourceid: '', startDate: this.dayjs().format('YYYY-MM-DD'), endDate: this.dayjs().format('YYYY-MM-DD'), } // 清空选择列表
this.chooseSOSList = [] // 打开选择模态框
this.chooseSOSModalFlag = true }, searchSOSRouting() { this.chooseSOSData.limit = this.ss_pageSize this.chooseSOSData.page = this.ss_pageIndex // 调用API查询派工单信息
getSOScheduledRoutingListForIssureByPaging(this.chooseSOSData).then(({data}) => { if (data.code === 0) { this.chooseSOSList = data.page.list; if (this.chooseSOSList.length === 0) { this.$message.warning('未查询到符合条件的派工单'); } this.ss_pageIndex = data.page.currPage this.ss_pageSize = data.page.pageSize this.ss_totalPage = data.page.totalCount } else { // 清空选择列表
this.chooseSOSList = [] this.$message.error(data.msg || '查询失败'); } }).catch(error => { // 清空选择列表
this.chooseSOSList = [] console.error('查询派工单失败:', error); this.$message.error('查询失败,请稍后重试'); }); }, // 每页数 工单分页信息
ss_sizeChangeHandle(val) { this.ss_pageSize = val this.ss_pageIndex = 1 this.searchSOSRouting() }, // 当前页 工单分页信息
ss_currentChangeHandle(val) { this.ss_pageIndex = val this.searchSOSRouting() }, chooseSOS(row) { // 关闭选择模态框
this.chooseSOSModalFlag = false
// 将选择的数据填入到保存派工单模态框中
this.orderDetailData.orderNo = row.orderno || ''; this.orderDetailData.seqNo = row.seqno || ''; this.orderDetailData.itemNo = row.itemno || ''; this.orderDetailData.itemDesc = row.itemDesc || ''; this.orderDetailData.resourceId = row.sResourceid || ''; this.orderDetailData.resourceDesc = row.resourceDesc || ''; this.orderDetailData.qtyRequired = row.qtyrequired || ''; this.orderDetailData.partDesc = row.partDesc || ''; this.orderDetailData.partNo = row.partNo || ''; this.orderDetailData.workCenterNo = row.sWorkcenterno || ''; this.orderDetailData.alreadyApplyTotal = row.alreadyApplyTotal || 0; this.orderDetailData.needDate = this.dayjs().format('YYYY-MM-DD HH:mm:ss');
// 根据物料类型设置
if (row.issueType === '非BOM物料') { this.orderDetailData.materialType = '非BOM物料'; } else { this.orderDetailData.materialType = 'BOM物料'; }
this.$message.success('选择派工单成功,数据已填入表单'); },
//工单选择部分
// 打开选择工单模态框
openChooseOrderModal() { // 检查是否选择了主表行
if (!this.currentRow || !this.currentRow.notifyNo) { this.$alert('请先选择一条主表记录!', '提示', { confirmButtonText: '确定' }) return false } this.co_totalPage= 0; // 初始化选择工单数据
this.chooseOrderData = { page: 1, limit: 100, site: this.currentRow.site, buNo: this.currentRow.bu, user: this.$store.state.user.name, orderNo: '', statusList: ['已下达', '已计划', '已排产'], date3: this.dayjs().format('YYYY-MM-DD'), date4: this.dayjs().format('YYYY-MM-DD'), }
// 清空选择列表
this.chooseOrderList = []
// 打开选择模态框
this.chooseOrderModalFlag = true }, // 查询工单信息
searchOrder() { this.chooseOrderData.limit = this.co_pageSize this.chooseOrderData.page = this.co_pageIndex searchShopOrderByPaging(this.chooseOrderData).then(({data}) => { if (data.code === 0) { this.chooseOrderList = data.page.list; if (this.chooseOrderList.length === 0) { this.$message.warning('未查询到符合条件的工单'); } this.co_pageIndex = data.page.currPage this.co_pageSize = data.page.pageSize this.co_totalPage = data.page.totalCount } else { this.chooseOrderList = []; this.$message.error(data.msg || '查询失败'); } }).catch(error => { this.chooseOrderList = []; console.error('查询工单失败:', error); this.$message.error('查询失败,请稍后重试'); }); }, // 每页数 工单分页信息
co_sizeChangeHandle(val) { this.co_pageSize = val this.co_pageIndex = 1 this.searchOrder() }, // 当前页 工单分页信息
co_currentChangeHandle(val) { this.co_pageIndex = val this.searchOrder() }, // 选择工单
chooseOrder(row) { // 关闭选择模态框
this.chooseOrderModalFlag = false
// 将选择的数据填入到保存派工单模态框中
this.orderDetailData.orderNo = row.orderNo || ''; this.orderDetailData.partNo = row.partNo || ''; this.orderDetailData.partDesc = row.partDescription || ''; this.orderDetailData.qtyRequired = row.lotSize || ''; this.orderDetailData.alreadyApplyTotal = row.alreadyApplyTotal || 0; this.orderDetailData.apsResourceTotal = row.apsResourceTotal || 0; this.orderDetailData.notYetStartedResourceTotal = row.notYetStartedResourceTotal || 0;
// 清空相关字段
this.orderDetailData.seqNo = ''; this.orderDetailData.operationNo = ''; this.orderDetailData.locationNo = ''; },//工序选择部分
// 打开选择工序模态框
openChooseOperationModal() { // 检查是否选择了工单
if (!this.orderDetailData.orderNo) { this.$alert('请先选择工单!', '提示', { confirmButtonText: '确定' }) return false }
// 初始化选择工序数据
this.chooseOperationData = { orderNo: this.orderDetailData.orderNo, site: this.currentRow.site, }
// 清空选择列表
this.chooseOperationList = [] //
this.searchOperation(); // 打开选择模态框
this.chooseOperationModalFlag = true }, // 查询工序信息
searchOperation() { // 调用API查询工序信息
getRouteInShopOrder(this.chooseOperationData).then(({data}) => { if (data.code === 0) { this.chooseOperationList = data.dataList; if (this.chooseOperationList.length === 0) { this.$message.warning('未查询到符合条件的工序'); } } else { // 清空选择列表
this.chooseOperationList = []; this.$message.error(data.msg || '查询失败'); } }).catch(error => { // 清空选择列表
this.chooseOperationList = []; console.error('查询工序失败:', error); this.$message.error('查询失败,请稍后重试'); }); }, // 选择工序
chooseOperation(row) { // 关闭选择模态框
this.chooseOperationModalFlag = false
// 将选择的数据填入到保存派工单模态框中
this.orderDetailData.itemDesc = row.operationDesc || ''; this.orderDetailData.itemNo = row.itemNo || ''; this.orderDetailData.workCenterNo = row.workCenterNo || '';
this.$message.success('操作成功'); },//机台选择部分
// 打开选择机台模态框
openChooseResourceModal() { // 检查是否选择了工单
if (!this.orderDetailData.orderNo) { this.$alert('请先选择工单!', '提示', { confirmButtonText: '确定' }) return false }
// 初始化选择机台数据
this.chooseResourceData = { site: this.currentRow.site, workCenterNo: this.orderDetailData.workCenterNo, resourceID: '', resourceDesc: '', }
// 清空选择列表
this.chooseResourceList = [] this.searchResource(); // 打开选择模态框
this.chooseResourceModalFlag = true }, // 查询机台信息
searchResource() { // 调用API查询机台信息
searchAllResource(this.chooseResourceData).then(({data}) => { if (data.code === 0) { this.chooseResourceList = data.rows; if (this.chooseResourceList.length === 0) { this.$message.warning('未查询到符合条件的机台'); } } else { // 清空选择列表
this.chooseResourceList = []; this.$message.error(data.msg || '查询失败'); } }).catch(error => { // 清空选择列表
this.chooseResourceList = []; console.error('查询机台失败:', error); this.$message.error('查询失败,请稍后重试'); }); }, // 选择机台
chooseResource(row) { // 关闭选择模态框
this.chooseResourceModalFlag = false
// 将选择的数据填入到保存派工单模态框中
this.orderDetailData.resourceId = row.resourceId || ''; this.orderDetailData.resourceDesc = row.resourceDesc || '';
this.$message.success('操作成功'); },//非BOM物料选择部分
// 打开选择物料模态框
openChoosePartModal() { // 检查是否选择了主表行
if (!this.currentRow || !this.currentRow.notifyNo) { this.$alert('请先选择一条主表记录!', '提示', { confirmButtonText: '确定' }) return false }
// 初始化选择物料数据
this.choosePartData = { site: this.currentRow.site, sourceBu: this.currentRow.bu, partNo: '', partDesc: '', spec: '', }
// 清空选择列表
this.choosePartList = []
// 打开选择模态框
this.choosePartModalFlag = true this.searchPartModel() }, // 查询物料信息
searchPartModel() { this.choosePartData.limit = this.pp_pageSize this.choosePartData.page = this.pp_pageIndex // 调用API查询物料信息
getPartListByPaging(this.choosePartData).then(({data}) => { if (data.code === 0) { this.choosePartList = data.page.list; if (this.choosePartList.length === 0) { this.$message.warning('未查询到符合条件的物料'); } this.pp_pageIndex = data.page.currPage this.pp_pageSize = data.page.pageSize this.pp_totalPage = data.page.totalCount } else { // 清空选择列表
this.choosePartList = [] this.$message.error(data.msg || '查询失败'); } }).catch(error => { // 清空选择列表
this.choosePartList = [] console.error('查询物料失败:', error); this.$message.error('查询失败,请稍后重试'); }); },
// 每页数 工单分页信息
pp_sizeChangeHandle(val) { this.pp_pageSize = val this.pp_pageIndex = 1 this.searchPartModel() },
// 当前页 工单分页信息
pp_currentChangeHandle(val) { this.pp_pageIndex = val this.searchPartModel() },
// 选择物料
choosePart(row) { // 关闭选择模态框
this.choosePartModalFlag = false
// 将选择的数据填入到保存派工单模态框中
this.orderDetailData.partNo = row.partNo || ''; this.orderDetailData.partDesc = row.partDesc || ''; this.orderDetailData.materialType = '非BOM物料';
this.$message.success('选择物料成功,数据已填入表单'); },
//提交申请单方法
async submitNotifyModel(row){ // 设置当前行为要提交的行
this.currentRow = JSON.parse(JSON.stringify(row));
// 先刷新子表数据,确保获取最新数据
await this.refreshAllSubTables();
console.log('申请单明细数据:', this.dataList2); console.log('材料明细数据:', this.dataList3);
if(this.dataList2.length==0 || this.dataList3.length==0){ this.$alert('没有明细记录无法提交!', '提示', { confirmButtonText: '确定' }) return false }
// 调用更新状态接口,将状态改为"待确认"
let inData = { site: row.site, notifyNo: row.notifyNo, status: '待确认', } updateNotifyStatus(inData).then(({data})=>{ if (data.code === 0) { //刷新主表数据
this.searchTable().then(() => { // 等刷新完成
const foundRow = this.dataList.find(item => item.notifyNo === row.notifyNo); if (foundRow) { this.currentRow = JSON.parse(JSON.stringify(foundRow)); this.$nextTick(() => { this.$refs.mainTable.setCurrentRow(foundRow); }); } }); this.$message.success('提交成功') }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }, //下达申请单方法
async xiadaNotifyModel(row){ // 设置当前行为要下达的行
this.currentRow = JSON.parse(JSON.stringify(row));
// 先刷新子表数据,确保获取最新数据
await this.refreshAllSubTables();
console.log('申请单明细数据:', this.dataList2); console.log('材料明细数据:', this.dataList3);
if(this.dataList2.length==0 || this.dataList3.length==0){ this.$alert('没有明细记录无法下达!!', '提示', { confirmButtonText: '确定' }) return false }
xiadaNotify(row).then(({data})=>{ if (data.code === 0) { //刷新主表数据
this.searchTable().then(() => { // 等刷新完成
const foundRow = this.dataList.find(item => item.notifyNo === row.notifyNo); if (foundRow) { this.currentRow = JSON.parse(JSON.stringify(foundRow)); this.$nextTick(() => { this.$refs.mainTable.setCurrentRow(foundRow); }); } }); this.$message.success( '操作成功') }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }, // 刷新所有子表数据
async refreshAllSubTables() { if(!this.currentRow || !this.currentRow.notifyNo) { console.warn('当前行数据为空,无法刷新子表数据'); return; }
try { // 并行请求所有子表数据
const [detailData, materialData] = await Promise.all([ searchNotifyOrderList(this.currentRow), searchNotifyMaterialList(this.currentRow) ]);
// 更新申请单明细数据
if (detailData.data && detailData.data.code == 0) { this.dataList2 = detailData.data.rows; } else { this.dataList2 = []; }
// 更新材料明细数据
if (materialData.data && materialData.data.code == 0) { this.dataList3 = materialData.data.rows; } else { this.dataList3 = []; }
} catch (error) { console.error('刷新子表数据失败:', error); this.$message.error('刷新子表数据失败,请稍后重试'); } },
editNotifyMaterialFun(row){ // 设置当前行为要编辑的行
this.currentRow = JSON.parse(JSON.stringify(row));
editNotifyMaterial(row).then(({data})=>{ if (data.code === 0) { //刷新主表数据
this.searchTable().then(() => { // 等刷新完成
const foundRow = this.dataList.find(item => item.notifyNo === row.notifyNo); if (foundRow) { this.currentRow = JSON.parse(JSON.stringify(foundRow)); this.$nextTick(() => { this.$refs.mainTable.setCurrentRow(foundRow); }); } }); this.$message.success( '操作成功') }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
// 判断当前状态是否可编辑
isEditableStatus() { if (!this.currentRow || !this.currentRow.status) { return false; } return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中' || this.currentRow.status === '待确认'; },
// 计算申请数量
calculateQtyToIssue(row) { const componentScrap = parseFloat(row.componentScrap) || 0; const firstInspectionQty = parseFloat(row.firstInspectionQty) || 0; const standardDosage = parseFloat(row.standardDosage) || 0; return (componentScrap + firstInspectionQty + standardDosage).toFixed(2); },
// 更新申请数量
updateQtyToIssue(row) { const componentScrap = parseFloat(row.componentScrap) || 0; const firstInspectionQty = parseFloat(row.firstInspectionQty) || 0; const standardDosage = parseFloat(row.standardDosage) || 0; // 使用 $set 确保响应式更新
this.$set(row, 'qtyToIssue', (componentScrap + firstInspectionQty + standardDosage).toFixed(2)); },
// 打开新增材料模态框
addMaterialModal() { if (!this.currentRow || !this.currentRow.notifyNo) { this.$alert('请先选择一条主表记录!', '提示', { confirmButtonText: '确定' }); return false; }
if (!this.isEditableStatus()) { this.$alert('当前状态不允许编辑!只有草稿、编辑中或待确认状态才能新增材料。', '提示', { confirmButtonText: '确定' }); return false; }
// 重置表单数据
this.newMaterialData = { componentPartNo: '', partDesc: '', issueType: '替代料', orderNo: '', itemNo: '', // 申请单序号,将在选择生产订单时自动填充
remark: '', componentScrap: 0, firstInspectionQty: 0, standardDosage: 0, bomSeqNo: '', warehouseId: '', qtyToIssueOriginal: 0 }; // 加载生产订单选项
this.loadOrderOptions(); this.addMaterialModalFlag = true; },
// 加载生产订单选项
loadOrderOptions() { // 从申请单明细中获取生产订单列表
this.orderOptions = this.dataList2.map(item => ({ orderNo: item.sOOrderNo, itemNo: item.itemNo // 添加申请单序号
})); },
// 生产订单选择变化时的处理
onOrderNoChange(selectedOrderNo) { if (selectedOrderNo) { // 根据选择的生产订单,从申请单明细中找到对应的申请单序号
const selectedOrder = this.dataList2.find(item => item.sOOrderNo === selectedOrderNo); if (selectedOrder) { this.newMaterialData.itemNo = selectedOrder.itemNo; } } else { this.newMaterialData.itemNo = ''; } },
// 保存新增材料
saveNewMaterial() { // 验证必填字段
if (!this.newMaterialData.componentPartNo) { this.$message.error('请选择材料编码') return; } if (!this.newMaterialData.orderNo) { this.$message.error('请选择生产订单') return; }
// 计算申请数量
const qtyToIssue = this.calculateQtyToIssue(this.newMaterialData)
// 构建保存数据
const saveData = { ...this.newMaterialData, site: this.currentRow.site, notifyNo: this.currentRow.notifyNo, qtyToIssue: qtyToIssue, } saveSOIssueNotifyOrderMateria(saveData).then(({data}) => { if (data && data.code === 0) { // 刷新材料明细列表
this.getNotifyMaterialList(); this.addMaterialModalFlag = false this.$message.success('操作成功') } else { this.$message.error(data.msg) } }) },
// 查询替代料
getAlternativePart(row) { if (!this.currentRow || !this.currentRow.notifyNo) { this.$message.warning('请先选择一条申请单记录!'); return; } if (!row.orderNo) { this.$message.warning('该记录没有关联工单,无法查询替代料!'); return; } const params = { site: row.site, notifyNo: row.notifyNo, orderNo: row.orderNo, componentPart: row.componentPartNo }; this.alternativePartsLoading = true; this.alternativePartsModalFlag = true; getBomAlternativeParts(params).then(({data}) => { if (data && data.code === 0) { this.alternativePartsList = data.rows || [] } else { this.$message.error(data.msg || '查询替代料失败'); this.alternativePartsList = []; } }).finally(() => { this.alternativePartsLoading = false; }); },
// 获取基础数据列表S
getBaseList (val, type) { this.tagNo = val this.tagType = type this.$nextTick(() => { let strVal = '' if (val === 508) { strVal = this.newMaterialData.componentPartNo this.$refs.baseList.init(val, strVal) } }) },
// 列表方法的回调
getBaseData (val) { if (this.tagNo === 508) { this.newMaterialData.componentPartNo = val.PartNo this.newMaterialData.partDesc = val.PartDescription this.newMaterialData.warehouseId = val.outbound_warehouse_id } },
// 输入校验
partBlur (tagNo) { let tempData = { tagno: tagNo, conditionSql: " and PartNo = '" + this.newMaterialData.componentPartNo + "'" + " and site = '" + this.newMaterialData.site + "'" } verifyData(tempData).then(({data}) => { if (data && data.code === 0) { if (data.baseListData.length > 0) { this.newMaterialData.componentPartNo = data.baseListData[0].PartNo this.newMaterialData.partDesc = data.baseListData[0].PartDescription } else { this.newMaterialData.partDesc = '' } } }) },
}, }</script>
<style scoped>/deep/ .customer-tab .el-tabs__content { padding: 5px !important;}
.disabled { cursor: not-allowed !important; color: #C0C4CC !important; pointer-events: none;}
.text-right >>> .el-input__inner { text-align: right !important;}
.text-right >>> .el-input-number__input { text-align: right !important;}
.single-line-multi-select >>> .el-select__tags { display: flex; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; max-width: 100%;}
.single-line-multi-select >>> .el-tag { flex-shrink: 0; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.single-line-multi-select >>> .el-select__input { flex-shrink: 0; min-width: 30px;}
.disabled-link { cursor: not-allowed !important; color: #C0C4CC !important; pointer-events: none;}
.disabled-text { color: #C0C4CC !important; cursor: not-allowed !important;}
.el-table /deep/ .cell{ height: auto; line-height: 1.5;}</style>
|