Browse Source

增加成品物料模块

java8
赵宏斌 2 months ago
parent
commit
294fdcc166
  1. 15
      src/api/qc/qc.js
  2. 527
      src/views/modules/eamReport/productPart.vue

15
src/api/qc/qc.js

@ -231,3 +231,18 @@ export const queryEquipmentFolderLocationList = data => createAPI(`/pms/qc/query
export const deleteEquipmentFolderLocationList = data => createAPI(`/pms/qc/deleteEquipmentFolderLocationList`,'post',data) export const deleteEquipmentFolderLocationList = data => createAPI(`/pms/qc/deleteEquipmentFolderLocationList`,'post',data)
export const getSuffixList = data => createAPI(`/pms/qc/getSuffixList`,'post',data) export const getSuffixList = data => createAPI(`/pms/qc/getSuffixList`,'post',data)
export const saveEquipmentFolderLocationList = data => createAPI(`/pms/qc/saveEquipmentFolderLocationList`,'post',data) export const saveEquipmentFolderLocationList = data => createAPI(`/pms/qc/saveEquipmentFolderLocationList`,'post',data)
// ===================================== 成品物料模块 =====================================
// 查询
export const queryProductPartList = data => createAPI(`/pms/qc/queryProductPartList`,'post',data)
// 新增
export const saveProductPartData = data => createAPI(`/pms/qc/saveProductPartData`,'post',data)
// 修改
export const updateProductPartData = data => createAPI(`/pms/qc/updateProductPartData`,'post',data)
// 删除
export const deleteProductPartList = data => createAPI(`/pms/qc/deleteProductPartList`,'post',data)
// 根据site bu partNo查询物料信息
export const selectPartData = data => createAPI(`/pms/qc/selectPartData`,'post',data)
// 查询用户按钮权限
export const getButtonsPermission = data => createAPI(`/pms/qc/getButtonsPermission`,'post',data)

527
src/views/modules/eamReport/productPart.vue

@ -0,0 +1,527 @@
<script>
import {queryOperationForResourceList,
saveOperationForResource,
queytOperationList,
getSiteAndBuByUserName,
queryEquipmentFolderLocationList,
deleteEquipmentFolderLocationList,
getSuffixList,
saveEquipmentFolderLocationList
} from "@/api/qc/qc.js"
import excel from "@/utils/excel-util.js";
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {
deleteProductPartList, getButtonsPermission,
queryProductPartList,
saveProductPartData,
selectPartData,
updateProductPartData
} from "../../../api/qc/qc";
export default {
name: 'productPart',
components: {
Chooselist
},
data () {
return {
searchFlag: false,
addFlag: false,
updateFlag: false,
deleteFlag: false,
exportFlag: false,
queryParams: {
page: 1,
pageCount: 50,
bu: '',
partNo: '',
sku: '',
productDesc: ''
},
exportName: "成品物料编码" + this.dayjs().format('YYYYMMDDHHmmss'),
dataList: [],
dataListSelections: [],
total: 0,
modalFlag: false,
resourceFlag:false,
ifexist:0,
resourData:{
resourceId:'',
resourceDesc:''
},
operationList:[],
suffixList:[],
userBuList: [],
editFlag: false,
modalData: {
page: 1,
pageCount: 50,
equipmentNo: '',
equipmentDesc: '',
},
columns: [
{
userId: this.$store.state.user.name,
functionId: 101005012,
serialNumber: '101005012Table1BuDesc',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'buDesc',
headerAlign: 'center',
align: 'center',
columnLabel: 'BU',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 101005012,
serialNumber: '101005012Table1PartNo',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'partNo',
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: 101005012,
serialNumber: '101005012Table1ProductDesc',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'productDesc',
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: 101005012,
serialNumber: '101005012Table1Spec',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'spec',
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: 101005012,
serialNumber: '101005012Table1Sku',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'sku',
headerAlign: 'center',
align: 'center',
columnLabel: 'SKU',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 101005012,
serialNumber: '101005012Table1Roll',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'roll',
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: 101005012,
serialNumber: '101005012Table1CreateBy',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'createBy',
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: 101005012,
serialNumber: '101005012Table1CreateTime',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'createTime',
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: 101005012,
serialNumber: '101005012Table1Remark',
tableId: '101005012Table1',
tableName: '成品物料模块表',
columnProp: 'remark',
headerAlign: 'center',
align: 'center',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
}
]
}
},
methods: {
handleQuery () {
queryProductPartList(this.queryParams).then(({data}) => {
if (data.code == 0) {
this.dataList = data.rows
this.total = data.total
}
}).catch((errer) => {
this.$message.error(errer)
})
},
// bu
getSiteAndBuByUserName () {
let tempData = {
username: this.$store.state.user.name,
}
getSiteAndBuByUserName(tempData).then(({data}) => {
if (data.code === 0) {
this.userBuList = data.rows
this.$set(this.queryParams, 'bu', this.userBuList[0].buNo)
//
this.handleQuery()
}
})
},
getButtonsPermission(){
let param = {
adminID: this.$store.state.user.name
}
getButtonsPermission(param).then(({data})=>{
console.log(data)
if (data.code == 0) {
if (data.flag == 'all'){
this.searchFlag = true
this.addFlag = true
this.updateFlag = true
this.deleteFlag = true
this.exportFlag = true
} else if (data.flag == 'search'){
this.searchFlag = true
this.exportFlag = true
}
}
})
},
//
selectionChangeHandle (val) {
this.dataListSelections = val
},
addDialog () {
this.editFlag = false
this.modalData = {
flag: 0,
page: 1,
pageCount: 50,
editFlag: 0,
bu: this.userBuList[0].buNo,
partNo: '',
productDesc: '',
sku: '',
roll: '',
remark: '',
createBy: this.$store.state.user.name
}
this.modalFlag = true
},
editData(row) {
this.modalData = row
this.modalData.flag = 1
this.modalData.bu = row.site + '_' + row.buNo
this.editFlag = true
this.modalFlag = true
},
selectPartData(){
let params = {
site: this.modalData.bu.split('_')[0],
buNo: this.modalData.bu.split('_')[1],
partNo: this.modalData.partNo
}
selectPartData(params).then(({data}) => {
if (data.total > 0) {
this.$set(this.modalData,'productDesc',data.rows[0].partDesc)
this.$set(this.modalData,'sku',data.rows[0].sku)
// this.modalData.productDesc = data.rows[0].partDesc
// this.modalData.sku = data.rows[0].sku
} else {
this.$message.warning('未查询到物料信息')
}
})
},
saveModalData(){
if (!this.modalData.bu || this.modalData.bu==null || this.modalData.bu==''){
this.$message.warning("请选择BU!")
return
}
if (this.modalData.partNo == null || this.modalData.partNo == ''){
this.$message.warning("请输入物料编码!")
return
}
if (this.modalData.sku == null || this.modalData.sku == ''){
this.$message.warning("sku不能为空!")
return
}
if (this.modalData.spec == null || this.modalData.spec == ''){
this.$message.warning("规格型号不能未空!")
return
}
if (this.modalData.roll == null || this.modalData.roll == ''){
this.$message.warning("张/卷 不能为空!")
return
}
let param = this.modalData
param.site = this.modalData.bu.split('_')[0]
param.buNo = this.modalData.bu.split('_')[1]
if (this.modalData.flag == 0){
saveProductPartData(param).then(({data})=>{
if (data.code == 0) {
this.modalFlag = false
this.$message.success(data.msg)
this.handleQuery()
} else {
this.$message.error(data.msg)
}
}).catch()
} else {
updateProductPartData(param).then(({data})=>{
if (data.code == 0) {
this.modalFlag = false
this.$message.success(data.msg)
this.handleQuery()
} else {
this.$message.error(data.msg)
}
}).catch()
}
},
deleteData(){
if (!this.dataListSelections || this.dataListSelections.length === 0) {
this.$message.warning("请选择要删除的记录")
return
}
this.$confirm(`确认删除选中的` + this.dataListSelections.length +'条记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(()=>{
deleteProductPartList(this.dataListSelections).then(({data})=>{
if (data.code==0){
this.$message.success("删除成功")
this.handleQuery()
}
}).catch()
})
},
async exportExcel() {
this.queryParams.page = 1
this.queryParams.pageCount = -1
excel.exportTable({
url: "/pms/qc/queryEquipmentFolderLocationList",
columnMapping: this.columns,//table
mergeSetting: [],//
params: this.queryParams,
fileName: this.exportName+".xlsx",
rowFetcher: res => res.data,
columnFormatter: [],
dropColumns: [],//dropColumns: ["netWeight"]
})
}
},
created () {
// site bu
this.getSiteAndBuByUserName()
//
this.getButtonsPermission()
}
}
</script>
<template>
<div class="box-container">
<!-- 查询条件-->
<el-form :inline="true" label-position="top" :model="queryParams">
<el-form-item :label="'BU'">
<el-select v-model="queryParams.bu" placeholder="请选择" style="width: 80px">
<el-option
v-for = "i in userBuList"
:key = "i.buNo"
:label = "i.buDesc"
:value = "i.buNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="'物料编码'">
<el-input v-model="queryParams.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'SKU'">
<el-input v-model="queryParams.sku" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'产品说明'">
<el-input v-model="queryParams.productDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" :disabled="!searchFlag" @click="handleQuery">查询</el-button>
<el-button type="primary" :disabled="!addFlag" @click="addDialog()">新增</el-button>
<el-button type="primary" :disabled="!deleteFlag" @click="deleteData()">删除</el-button>
<el-button @click="exportExcel()" :disabled="!exportFlag" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
</el-form-item>
</el-form>
<!-- 主表信息-->
<div style="height: 90%">
<el-table :data="dataList" border
highlight-current-row
@selection-change="selectionChangeHandle"
height="100%" ref="table">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in columns" :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-column label="操作" align="center" width="100">
<template slot-scope="scope">
<a @click="editData(scope.row)" v-if="updateFlag" type="primary" style="margin-left: 2px">{{'编辑'}}</a>
<!-- <a @click="viewData(scope.row)" type="primary" style="margin-left: 2px">{{'详情'}}</a>-->
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页信息-->
<el-pagination
style="margin-top: 5px"
:current-page="queryParams.page"
:page-sizes="[50, 100, 500, 1000]"
:page-size="queryParams.pageCount"
:total="total"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 新增数据dialog-->
<el-dialog :title="!editFlag?'新增':'编辑'" :visible.sync="modalFlag" width="380px"
:close-on-click-modal="false" :close-on-press-escape="false">
<el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="BU" prop="bu">
<el-select v-model="modalData.bu" placeholder="请选择" :disabled="editFlag" style="width: 221px">
<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-form>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="物料编码">
<el-input v-model="modalData.partNo" @change="selectPartData()" :disabled="editFlag" style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="产品说明">
<el-input v-model="modalData.productDesc" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="规格型号">
<el-input v-model="modalData.spec" :disabled="editFlag" style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="sku">
<el-input v-model="modalData.sku" readonly :disabled="editFlag" style="width: 200px"></el-input>
</el-form-item>
<el-form-item label="张/卷">
<el-input v-model="modalData.roll" style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="modalData.remark" style="width: 200px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="saveModalData()"> </el-button>
<el-button @click="modalFlag = false"> </el-button>
</el-footer>
</el-dialog>
</div>
</template>
<style scoped>
</style>
Loading…
Cancel
Save