|
|
<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.orderRef1" style="width: 120px"></el-input> </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-item :label="' '"> <el-button type="primary" @click="searchTable()">查询</el-button> <el-button type="primary" @click="addModal()">新增</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="150" fixed="left" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="updateModel(scope.row)">编辑</a> <a type="text" size="small" @click="deleteData(scope.row)">删除</a> <a type="text" size="small" @click="scanRoll(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-table :data="dataList2" :height="height" border v-loading="dataListLoading" style="width: 100%; "> <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-table :data="dataList3" :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 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> </el-tab-pane> </el-tabs>
<el-dialog title="生产发料-新增" :close-on-click-modal="false" v-drag :visible.sync="modelFlag" width="480px" > <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="仓库"> <el-select v-model="modelData.warehouseID" style="width: 150px;"> <el-option :value="i.wareHouseId" :label="i.wareHouseName" v-for="i in wareHouseList" :key="i.menuId"></el-option> </el-select> </el-form-item> <el-form-item label="发料日期"> <el-date-picker style="width: 150px" v-model="modelData.transDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item label=" " > <el-checkbox v-model="jumpFlag">保存后直接扫描</el-checkbox> </el-form-item> </el-form> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="经手人"> <el-input v-model="modelData.receiver" style="width: 150px"></el-input> </el-form-item> <el-form-item label="生产订单"> <el-input v-model="modelData.orderRef1" style="width: 150px"></el-input> </el-form-item> </el-form><!-- <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">--><!-- <el-form-item >--><!-- <span slot="label" style="" @click="getBaseList(23,1)" ><a herf="#">供应商编码</a></span>--><!-- <el-input v-model="modelData.supplierId" style="width: 204px"></el-input>--><!-- </el-form-item>--><!-- <el-form-item label="供应商名称">--><!-- <el-input v-model="modelData.supplierName" disabled style="width: 200px"></el-input>--><!-- </el-form-item>--><!-- </el-form>--> <el-footer style="height:40px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="saveHeaderData()">保存</el-button> <el-button type="primary" @click="modelFlag = false">关闭</el-button> </el-footer> </el-dialog>
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="searchTable" v-drag></add-or-update> <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> </div></template>
<script> import { searchTransHeader ,searchTransDetail ,searchTransDetailSub ,getWareHouseList ,saveTransHeaderData ,deleteTransHeaderData } from "@/api/material/issureSo.js" import { printIssureSoLabel, } from "@/views/modules/label/print_issureSo_label.js" import { getLocationListForSearch } from "@/api/base/normalSearch.js" import addOrUpdate from './com_issureSo_add_or_update' import Chooselist from '@/views/modules/common/Chooselist' export default { components: { Chooselist ,addOrUpdate }, data() { return { height:200, modelFlag:false, activeName: 'detail', dataList: [], dataList2: [], dataList3: [], addOrUpdateVisible:false, searchData: { page: 1, limit: 100, site:this.$store.state.user.site, username: this.$store.state.user.name, orderRef1: '', startDate: '', endDate: '', transTypeDb:'SI', }, wareHouseList:[], jumpFlag:true, modelData:{ transNo:'', site:this.$store.state.user.site, transDate:new Date(), warehouseID:'', receiver:'', orderRef1:'', supplierId:'', supplierName:'', enterBy:'', }, exportList:[], pageIndex: 1, pageSize: 100, totalPage: 0, dataListLoading: false, currentRow:'', headerData:'', columnList1:[ { userId: this.$store.state.user.name, functionId: 200002, serialNumber: '200002Table1TransNo', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "transNo", 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: 200002, serialNumber: '200002Table1TransType', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "transType", 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: 200002, serialNumber: '200002Table1TransDate', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "transDate", 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: 200002, serialNumber: '200002Table1WareHouseID', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "warehouseID", 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: 200002, serialNumber: '200002Table1OrderRef1', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "orderRef1", 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: 200002, serialNumber: '200002Table1ReceiverName', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "receiverName", 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: 200002, serialNumber: '200002Table1EnterDate', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "enterDate", 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: 200002, serialNumber: '200002Table1EnterName', tableId: "200002Table1", tableName: "生产发料主表", columnProp: "enterName", headerAlign: "center", align: "left", columnLabel: "录入人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, ], columnList2:[ { userId: this.$store.state.user.name, functionId: 200002, serialNumber: '200002Table2PartNo', tableId: "200002Table2", 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: 200002, serialNumber: '200002Table2PartDesc', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "partDesc", 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: 200002, serialNumber: '200002Table2TransQty', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "transQty", 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: 200002, serialNumber: '200002Table2BatchNo', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "batchNo", 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: 200002, serialNumber: '200002Table2LocationID', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "locationID", 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: 200002,
// serialNumber: '200002Table2WdrNo',
// tableId: "200002Table2",
// tableName: "生产发料明细",
// columnProp: "wdrNo",
// headerAlign: "center",
// align: "left",
// columnLabel: "W/D/R",
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
},{ userId: this.$store.state.user.name, functionId: 200002, serialNumber: '200002Table2ManufactureDate', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "manufactureDate", 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: 200002, serialNumber: '200002Table2ExpiredDate', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "expiredDate", 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: 200002, serialNumber: '200002Table2EnterDate', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "enterDate", 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: 200002, serialNumber: '200002Table2EnterName', tableId: "200002Table2", tableName: "生产发料明细", columnProp: "enterName", headerAlign: "center", align: "left", columnLabel: "录入人", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 70 }, ], columnList3:[ { userId: this.$store.state.user.name, functionId: 200002, serialNumber: '200002Table3RollNo', tableId: "200002Table3", tableName: "生产发料卷明细", columnProp: "rollNo", 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: 200002, serialNumber: '200002Table3RollQty', tableId: "200002Table3", tableName: "生产发料卷明细", columnProp: "rollQty", 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: 200002, serialNumber: '200002Table3ManufactureDate', tableId: "200002Table3", tableName: "生产发料卷明细", columnProp: "manufactureDate", 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: 200002, serialNumber: '200002Table3ExpiredDate', tableId: "200002Table3", tableName: "生产发料卷明细", columnProp: "expiredDate", 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: 200002, serialNumber: '200002Table3EnterName', tableId: "200002Table3", tableName: "生产发料卷明细", columnProp: "enterName", 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: 200002, serialNumber: '200002Table3EnterDate', tableId: "200002Table3", tableName: "生产发料卷明细", columnProp: "enterDate", headerAlign: "center", align: "center", columnLabel: "录入时间", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, ], dataRole: { partTypeDesc: [ { required: true, message: ' ', trigger: 'change' } ], partName: [ { required: true, message: ' ', trigger: 'change' } ], }, // 导出 start
exportData: [], exportName: '生产发料主表'+this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["生产发料主表"], exportFooter: [], // 导出 end
} }, mounted () { this.$nextTick(() => { this.height = (window.innerHeight- 260) / 2
}) }, methods: { // 获取基础数据列表S
getBaseList (val, type) { this.tagNo = val this.tagNo1 = type this.$nextTick(() => { let strVal = '' if (val === 1013) { if(type==23) { strVal = this.modelData.supplierId } } this.$refs.baseList.init(val, strVal) }) }, /* 列表方法的回调 */ getBaseData (val) { if (this.tagNo === 23) { if(this.tagNo1==1) { this.modelData.supplierId = val.SupplierID this.modelData.supplierName = val.SupplierName } } }, // 每页数
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.headerData=row; this.refreshCurrentTabTable (); }, refreshCurrentTabTable(){ if(this.currentRow===''||this.currentRow===null){ this.currentRow={site:'',transNo:''} } if(this.activeName==='detail'){ searchTransDetail(this.currentRow).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code == 0) { this.dataList2 = data.rows
} else { this.dataList2 = []; } }); }else { searchTransDetailSub(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 searchTransHeader(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 if(this.dataList.length>0){ this.$refs.mainTable.setCurrentRow(this.dataList[0]); this.changeData(this.dataList[0]) }else { this.changeData(null) } } else { this.dataList = []; } }); }, addModal(){ this.getWareHouseList(); setTimeout(() => { this.modelData={ transNo:"0", site:this.$store.state.user.site, transDate:new Date(), warehouseID:this.wareHouseList.length>0?this.wareHouseList[0].wareHouseId:'', receiver:this.$store.state.user.name, orderRef1:'', supplierId:'', supplierName:'', enterBy:this.$store.state.user.name, }; this.modelFlag=true; },200) }, updateModel(row){ this.getWareHouseList(); this.modelData={ transNo:row.transNo, site:row.site, transDate:row.transDate, warehouseID:row.warehouseID, receiver:row.receiver, orderRef1:row.orderRef1, supplierId:row.partnerID, supplierName:row.partnerName, enterBy:row.userName, } this.modelFlag=true; }, deleteData(row){ this.$confirm('确定要删除这条数据?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { deleteTransHeaderData(row).then(({data}) => { if (data && data.code === 0) { this.$message.success( '操作成功') this.searchTable(); } else { this.$message.error(data.msg) } }) }).catch(() => { }) }, saveHeaderData(){ if(this.modelData.warehouseID===''){ this.$alert('请选择仓库!', '错误', { confirmButtonText: '确定' }) return false } if(this.modelData.receiver===''){ this.$alert('请选择经手人!', '错误', { confirmButtonText: '确定' }) return false } if(this.modelData.transDate===''){ this.$alert('请选择发料日期!', '错误', { confirmButtonText: '确定' }) return false } saveTransHeaderData(this.modelData).then(({data}) => { if (data && data.code === 0) { var transNo=data.transNo this.$message.success( '操作成功') this.modelFlag = false this.searchTable() if(this.jumpFlag){ this.$nextTick(function () { setTimeout(() => { let data={ site:this.$store.state.user.site, transNo:transNo, } this.addOrUpdateVisible = true this.$nextTick(() => { this.$refs.addOrUpdate.init(data) }) },500) }) }
} else { this.$message.error(data.msg) } }) }, getWareHouseList(){ getWareHouseList({site:this.$store.state.user.site}).then(({data}) => { if (data && data.code === 0) { this.wareHouseList=data.rows
} }) }, scanRoll(row){ let data={ site:row.site, transNo:row.transNo, } this.addOrUpdateVisible = true this.$nextTick(() => { this.$refs.addOrUpdate.init(data) }) }, printLabel(row){ let rows=[]; rows.push(row)
printIssureSoLabel(rows); }, //导出excel
//导出excel
async createExportData() { this.searchData.limit = -1 this.searchData.page = 1 await searchTransHeader(this.searchData).then(({data}) => { this.exportList= data.page.list; })
return this.exportList; }, 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 }, }, }</script>
<style scoped>
</style>
|