Files
JY1.0/src/views/Inventory/CreatePickingList/index.vue
liushuai d3ce0baf0b 更新
2019-10-30 13:15:38 +08:00

918 lines
37 KiB
Vue

<template>
<div class="app-container">
<el-card style="width: 57%">
<div slot="header">
<el-row>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable style="width: 120px" @change="machineChange">
<el-option
v-for="item in machineNumber"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.name }}</div>
</el-option>
</el-select>
<el-select v-model="groupNumberValue" placeholder="组号" size="small" style="width: 120px" clearable>
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-select v-model="PickingValue" placeholder="领料情况" size="small" style="width: 120px" clearable>
<el-option
v-for="item in Picking"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-input v-model="Name" placeholder="名称" clearable style="width: 120px" size="small"/>
<el-input v-model="materialSpec" placeholder="物料规格" style="width: 120px" clearable size="small"/>
<el-input v-model="materialModel" placeholder="物料型号" style="width: 120px" clearable size="small"/>
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="pageCurrent0=1;pageSize0=300;pageCurrent1=1;pageSize1=300;pageCurrent2=1;pageSize2=300;pageCurrent4=1;pageSize4=20;searchTable()">查询</el-button>
</el-row>
</div>
<el-tabs v-model="PartType" type="card" @tab-click="searchTable()">
<el-tab-pane label="标准件" name="标准件">
<el-table ref="multipleTable" :data="tableData0" size="mini" style="max-height: 600px" height="500px" border stripe @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50"/>
<el-table-column align="center" prop="机床图号" label="机床图号" width="130px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="组号" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="物料名称" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>date
</el-table-column>
<el-table-column align="center" prop="型号" label="型号" min-width="120px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" prop="规格排序" label="规格" min-width="150px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="总数量" width="60px">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="备件数" width="60px">
<template slot-scope="scope">
{{ scope.row.备件总数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="领料单编号" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.领料单编号 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent0"
:page-sizes="[10, 20, 30, 40, 300]"
:page-size="pageSize0"
:total="total0"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange0"
@current-change="handleCurrentChange0"/>
</div>
</el-tab-pane>
<el-tab-pane label="外购件" name="外购件">
<el-table ref="multipleTable" :data="tableData1" size="mini" style="max-height: 500px" height="600px" border stripe @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50"/>
<el-table-column align="center" prop="机床图号" label="机床图号" width="130px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="组号" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="物料名称" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" prop="型号" label="型号" min-width="130px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" prop="物料规格" label="规格" min-width="200px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="总数量" width="60px">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="备件数" width="60px">
<template slot-scope="scope">
{{ scope.row.备件总数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="领料单编号" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.领料单编号 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40, 300]"
:page-size="pageSize1"
:total="total1"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-tab-pane>
<el-tab-pane label="基本件" name="基本件">
<el-table ref="multipleTable" :data="tableData2" size="mini" style="max-height: 500px" height="600px" border stripe @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50"/>
<el-table-column align="center" prop="机床图号" label="机床图号" width="130px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="组号" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="零件名称" label="名称" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="图号" sortable prop="零件图号" min-width="130px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" prop="规格" label="规格" min-width="80px">
<template slot-scope="scope">
{{ scope.row.规格 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="材料" width="80px">
<template slot-scope="scope">
{{ scope.row.材料 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="总数量" width="60px">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="备件数" width="60px">
<template slot-scope="scope">
{{ scope.row.备件总数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="领料单编号" width="100px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.领料单编号 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40, 300]"
:page-size="pageSize2"
:total="total2"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
<el-tab-pane label="离线采购件" name="离线采购件">
<el-table v-loading="listLoading" :data="tableDataBasic" highlight-current-row size="mini" border stripe style="width: 100%;" height="500px" @selection-change="handleSelectionChange1">
<el-table-column :selectable="selectable1" type="selection" align="center" width="50"/>
<el-table-column label="物料名称" prop="物料名称" align="center" min-width="140" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="物料型号" prop="物料型号" align="center" min-width="150" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="物料规格" prop="物料规格" align="center" min-width="200" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="库存量" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.货位存量 }}
</template>
</el-table-column>
<el-table-column label="领用数量" align="center" width="130px" show-overflow-tooltip>
<template slot-scope="scope">
<el-input-number v-model="scope.row.领用数量" :min="0" :precision="2" size="mini" style="margin: 0;width: 100%"/>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent4"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize4"
:total="total4"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange5"
@current-change="handleCurrentChange5"/>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
<div slot="header">
<el-card>
<el-row style="margin-top: 5px">
<el-input v-model="pickingListNumber" clearable size="small" placeholder="领料单编号" style="width:120px;margin-left: 10px" />
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchList()">查询</el-button>
<el-button size="small" type="primary" icon="el-icon-plus" style="margin: 0 0 0 10px" @click="createList()">创建领料单</el-button>
<el-tooltip :open-delay="1200" effect="dark" content="为所选领料单增加物料明细" placement="top">
<el-button size="small" type="warning" icon="el-icon-bottom" style="margin: 0 0 5px 10px" @click="selectInto()">选入物料</el-button>
</el-tooltip>
<el-button :disabled="Number(审批情况)===1" size="small" type="danger" icon="el-icon-delete" style="margin: 0 0 0 10px" @click="dropList()">删除领料单</el-button>
<el-button :disabled="Number(审批情况)===1" size="small" plain type="danger" icon="el-icon-delete" style="margin-right: 20px;float: right" @click="dropListDetail()">移除领料明细</el-button>
</el-row>
</el-card>
</div>
<div style="width: 26%;float: left;margin-right: 16px">
<el-card>
<el-table :data="pickListTable1" :row-class-name="tableRowClassName" class="shenpi" highlight-current-row border size="mini" width="100%" height="400px" @row-click="clickList">
<el-table-column prop="领料单编号" label="领料单编号" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.领料单编号 }}
</template>
</el-table-column>
<el-table-column label="领料人" prop="领料人" align="center" min-width="90px">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="备注" prop="备注" align="center" min-width="130px">
<template slot-scope="scope">
{{ scope.row.领料单备注 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="float:left;margin: 10px 0;">
<el-pagination
:current-page="pageCurrent3"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize3"
:total="total3"
layout="total, sizes, prev, pager, next"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
</el-card>
</div>
<div style="width: 72.5%;float: left">
<el-card>
<el-table :data="pickListTable2" border style="width: 100%;" size="mini" highlight-current-row height="400px" @row-click="searchMX">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="名称" align="center" prop="名称" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" align="center" prop="图号或型号" min-width="110px" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.图号或型号 || '—' }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" prop="规格" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.规格 || '—' }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" prop="机床图号" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" prop="组号" min-width="70">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="领用数" align="center" width="60">
<template slot-scope="scope">
{{ scope.row.总数量 }}
</template>
</el-table-column>
<el-table-column label="备件数" align="center" width="60">
<template slot-scope="scope">
{{ scope.row.备件数量 }}
</template>
</el-table-column>
<el-table-column label="已领数" align="center" width="60">
<template slot-scope="scope">
{{ scope.row.出库数量1 }}
</template>
</el-table-column>
<el-table-column v-if="true" label="备料确认" align="center" prop="是否备料确认" min-width="75px">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否备料确认)===1" type="success" size="mini">已备料</el-tag>
<el-tag v-else type="warning" size="mini">未备料</el-tag>
</template>
</el-table-column>
<el-table-column v-if="true" label="领料确认" align="center" prop="是否领料确认" width="75px">
<template slot-scope="scope">
<el-tag v-if="(Number(scope.row.总数量) <= Number(scope.row.出库数量1)) || Number(scope.row.是否领料确认) === 1" type="success" size="mini">已领料</el-tag>
<el-tag v-else-if="Number(scope.row.总数量) > Number(scope.row.出库数量1) && Number(scope.row.出库数量1) > 0" type="primary" size="mini">未领完</el-tag>
<el-tag v-else-if="Number(scope.row.出库数量1) === 0" type="warning" size="mini">未领料</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="120px">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini" show-summary>
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="100" align="center" label="姓名">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column min-width="150" align="center" label="领料时间">
<template slot-scope="scope">
{{ scope.row.操作日期 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="数量" prop="出库数量">
<template slot-scope="scope">
{{ scope.row.出库数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="primary" size="mini" icon="el-icon-search" plain @click="searchTable02(scope.row)">领料详情</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" title="创建领料单" center width="380px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left">
<el-form-item label="领料人" prop="领料人流水号" label-width="100px" size="small">
<el-select v-model="form1.领料人流水号" placeholder="请选择" size="small" clearable filterable>
<el-option
v-for="item in pickPerson"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="领料单备注" prop="领料单备注" label-width="100px">
<el-input v-model="form1.领料单备注" size="small" placeholder="备注" style="width: 200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1=false">取消</el-button>
<el-button type="primary" @click="submitCreateList()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initPickPerson, initMachineProject, searchgroup, searchTable, searchList, createList, dropList, selectIntoList, searchListDetail, dropListDetail, searchListDetailMX, searchPart, IntoMateerial } from '@/api/Inventory/CreatePickingList'
import request from '@/utils/request'
import { mapGetters } from 'vuex'
export default {
name: 'CreatePickingList',
data() {
return {
审批情况: '',
peopleName: '',
ListMX: '',
PartType: '基本件',
machineNumberValue: '',
machineNumber: [],
MachineNumber: '',
tableDataBasic: [],
PickingValue: '',
Picking: [{
value: 0,
label: '未领'
}, {
value: 1,
label: '已领'
}],
Name: '',
gridData: [],
groupNumberValue: '',
groupNumber: [],
tableData0: [],
tableData1: [],
tableData2: [],
pageCurrent0: 1,
pageSize0: 300,
total0: 0,
pageCurrent1: 1,
pageSize1: 300,
total1: 0,
pageCurrent2: 1,
pageSize2: 300,
total2: 0,
pickListTable1: [],
pageCurrent3: 1,
pageSize3: 20,
total3: 0,
pageCurrent4: 1,
pageSize4: 20,
total4: 0,
pickListTable2: [],
dialogFormVisible1: false,
listLoading: false,
materialSpec: '', // 物料规格
materialModel: '', // 物料型号
form1: {
领料人流水号: '',
领料单备注: ''
},
rules1: {
领料人流水号: [{ required: true, message: '请选择领料人' }]
},
pickPerson: [],
pickingListNumber: '', // 领料单编号
pickingListNumberShow: '', // 领料单编号
pickingListNum: '', // 领料单流水号
multipleSelection: [],
multipleSelection1: []
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
mounted() {
this.fetchData()
this.searchList()
},
methods: {
// 审批通过
approvalPass(row) {
this.$confirm('是否审批通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: '',
method: 'post',
data: {
type: '4',
name: `update 车间装配管理_领料单 set 是否审批 = 1 where 领料单流水号 = ${row.领料单流水号}`
}
}
request(param).then(res => {
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.pickingListNumber = ''
this.searchList()
} else {
this.$message.error('操作失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
// 初始化数据
fetchData() {
initPickPerson().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.pickPerson.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
// 根据机床查分组
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
tableRowClassName({ row }) {
if (parseInt(row.是否审批) === 1) {
return 'shenpi-row'
} else {
return ''
}
},
selectable(row, index) { // 控制某行是否可选
return row.领料单编号 === null // 未采购&&确认物料修改
},
selectable1(row) {
return row.领用数量 !== 0
},
// 查三表
searchTable() {
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) {
this.multipleSelection = []
this.multipleSelection1 = []
if (this.PartType === '标准件') {
this.searchTable0()
} else if (this.PartType === '外购件') {
this.searchTable1()
} else if (this.PartType === '基本件') {
this.searchTable2()
} else if (this.PartType === '离线采购件') {
this.searchTable4()
}
} else {
this.$message.warning('请选择机床后再查询')
}
},
// 标准件
searchTable0() {
let check1, check2, check3, check4, check5, check6
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.materialModel ? check4 = 1 : check4 = 0
this.materialSpec ? check5 = 1 : check5 = 0
if (this.PickingValue !== 0 && this.PickingValue !== 1) {
check6 = 0
} else {
check6 = 1
}
searchTable(check1, this.machineNumberValue, check2, this.groupNumberValue, check3, this.Name, check4, this.materialModel, check5, this.materialSpec, check6, this.PickingValue, this.pageCurrent0, this.pageSize0, 1).then(response => {
this.tableData0 = response.data.rows
this.total0 = response.data.total
})
},
// 外购件
searchTable1() {
let check1, check2, check3, check4, check5, check6
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.materialModel ? check4 = 1 : check4 = 0
this.materialSpec ? check5 = 1 : check5 = 0
if (this.PickingValue !== 0 && this.PickingValue !== 1) {
check6 = 0
} else {
check6 = 1
}
searchTable(check1, this.machineNumberValue, check2, this.groupNumberValue, check3, this.Name, check4, this.materialModel, check5, this.materialSpec, check6, this.PickingValue, this.pageCurrent1, this.pageSize1, 2).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
// 基本件
searchTable2() {
let check1, check2, check3, check4, check5, check6
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.materialModel ? check4 = 1 : check4 = 0
this.materialSpec ? check5 = 1 : check5 = 0
if (this.PickingValue !== 0 && this.PickingValue !== 1) {
check6 = 0
} else {
check6 = 1
}
searchTable(check1, this.machineNumberValue, check2, this.groupNumberValue, check3, this.Name, check4, this.materialModel, check5, this.materialSpec, check6, this.PickingValue, this.pageCurrent2, this.pageSize2, 3).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
// 离线采购件
searchTable4() {
this.listLoading = true
this.tableDataBasic = []
let check1, check2, check3
this.Name ? check1 = 1 : check1 = 0
this.materialSpec ? check2 = 1 : check2 = 0
this.materialModel ? check3 = 1 : check3 = 0
searchPart(check1, this.Name, check2, this.materialSpec, check3, this.materialModel, this.pageCurrent4, this.pageSize4).then(response => {
this.tableDataBasic = response.data.rows
this.total4 = response.data.total
this.listLoading = false
})
},
searchTable02(row) {
searchListDetailMX(row.领料单流水号, row.基本件流水号, row.标准件和外购件流水号, row.离线采购件流水号).then(response => {
this.gridData = response.data
})
},
handleSizeChange0(val) {
this.pageSize0 = val
this.pageCurrent0 = 1
this.searchTable0()
},
handleCurrentChange0(val) {
this.pageCurrent0 = val
this.searchTable0()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
handleSizeChange5(val) {
this.pageSize4 = val
this.pageCurrent4 = 1
this.searchTable4()
},
handleCurrentChange5(val) {
this.pageCurrent4 = val
this.searchTable4()
},
// 查询领料单列表
searchList() {
let check, isElectrical
this.pickingListNumber ? check = 1 : check = 0
Number(this.token) === 37 || Number(this.token) === 36 || Number(this.token) === 35 ? isElectrical = 1 : isElectrical = 0 // 35电工 36电气部长 37电气副部长
searchList(this.pageCurrent3, this.pageSize3, check, this.pickingListNumber, isElectrical).then(response => {
this.pickListTable1 = response.data.rows
this.total3 = response.data.total
})
},
handleSizeChange3(val) {
this.pageSize3 = val
this.pageCurrent3 = 1
this.searchList()
},
handleCurrentChange3(val) {
this.pageCurrent3 = val
this.searchList()
},
handleSizeChange4(val) {
this.pageSize3 = val
this.pageCurrent3 = 1
this.searchList()
},
handleCurrentChange4(val) {
this.pageCurrent3 = val
this.searchList()
},
// 创建领料单
createList() {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.form1.领料人流水号 = ''
this.form1.领料单备注 = ''
this.dialogFormVisible1 = true
},
// 提交创建领料单
submitCreateList() {
let isElectrical
Number(this.token) === 37 || Number(this.token) === 36 || Number(this.token) === 35 ? isElectrical = 1 : isElectrical = 0 // 35电工 36电气部长 37电气副部长
createList(this.form1.领料人流水号, this.form1.领料单备注, isElectrical).then(response => {
if (response.data[0].result === '1') {
this.$message.success('创建成功')
this.dialogFormVisible1 = false
this.searchList()
} else { this.$message.error('操作失败') }
})
},
// 确认领料单
checkList(row) {
this.$confirm('是否确认领回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: '',
method: 'post',
data: {
type: '4',
name: `update 车间装配管理_领料单 set 是否启用 = 0 where 领料单流水号 = ${row.领料单流水号}`
}
}
request(param).then(res => {
if (res.data[0].result === '1') {
this.$message.success('操作成功')
this.pickingListNumber = ''
this.searchList()
} else {
this.$message.error('操作失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
// 删除领料单
dropList() {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dropList(this.pickingListNum).then(response => {
if (Number(response.data[0].result) === 1) {
this.$message.success('删除成功')
this.searchList()
} else {
this.$message.error('数据占用')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val
},
// 选入
selectInto() {
if (this.PartType === '离线采购件') {
const materialGroup = []
const groupPartGroup = []
const numGroup = []
this.multipleSelection1.map(v => {
materialGroup.push(v.物料流水号)
groupPartGroup.push(v.组件零件基本件流水号)
numGroup.push(v.领用数量)
})
if (materialGroup.length === 0) {
this.$message.warning('请勾选零件')
return
}
if (!this.pickingListNum || !this.pickingListNumberShow) {
this.$message.warning('请选择领料单')
return
}
if (!this.machineNumberValue) {
this.$message.warning('请选择机床')
return
}
IntoMateerial(materialGroup, groupPartGroup, numGroup, this.pickingListNum, this.machineNumberValue).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable()
this.clickList()
} else { this.$message.error('操作失败') }
})
} else {
const basePartGroup = []
const purchasePartGroup = []
this.multipleSelection.map(v => {
v.基本件流水号 ? basePartGroup.push(v.基本件流水号) : purchasePartGroup.push(v.标准件和外购件流水号)
})
if (basePartGroup.length === 0 && purchasePartGroup.length === 0) {
this.$message.warning('请勾选零件')
return
}
if (!this.pickingListNum || !this.pickingListNumberShow) {
this.$message.warning('请选择领料单')
return
}
if (basePartGroup.length) { // 基本件
selectIntoList(basePartGroup, null, this.pickingListNum).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable()
this.clickList()
} else { this.$message.error('操作失败') }
})
} else { // 标准件外购件
selectIntoList(null, purchasePartGroup, this.pickingListNum).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable()
this.clickList()
} else { this.$message.error('操作失败') }
})
}
}
},
// 查看领料单明细
clickList(row) {
row ? this.审批情况 = row.是否审批 : this.审批情况
row ? this.pickingListNum = row.领料单流水号 : this.pickingListNum
row ? this.pickingListNumberShow = row.领料单编号 : this.pickingListNumberShow
row ? this.peopleName = row.姓名 : this.peopleName
searchListDetail(this.pickingListNum).then(res => {
this.pickListTable2 = res.data
})
},
searchMX(row) {
this.ListMX = row.领料单明细流水号
},
// 删除领料单明细
dropListDetail() {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dropListDetail(this.ListMX).then(response => {
if (Number(response.data[0].result) === 1) {
this.$message.success('删除成功')
this.searchTable()
this.clickList()
} else {
this.$message.error('已领取,不可删除')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style scoped>
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>
<style>
.el-table .shenpi-row {
background: #9BD7FC !important;
}
</style>