添加>>
删除<<
@@ -805,6 +815,16 @@ import {
this.modalData.partCostGroupId = this.modalData.partCostGroupId.toUpperCase()
this.modalData.planningMethod = this.modalData.planningMethod.toUpperCase()
}
+ },
+ 'searchData.searchType'(newVal,oldVal){
+ this.searchData.partNo = ''
+ this.searchData.partDesc = ''
+ this.searchTypeChange();
+ },
+ partModelFlag(newVal,oldVal){
+ if (newVal === false){
+ this.refreshDetailList();
+ }
}
},
data() {
@@ -815,8 +835,16 @@ import {
username: this.$store.state.user.name,
projectId: '',
customerId: '',
- searchType: 'Y'
+ searchType: 'Y',
+ partNo: '',
+ partDesc: '',
+ partNos: '',
+ page: 1,
+ limit: 10
},
+ pageIndex: 1,
+ pageSize: 20,
+ totalPage: 0,
visible: false,
dataListLoading: false,
currentRow: '',
@@ -1443,6 +1471,19 @@ import {
},
methods: {
+ // 子明细每页数
+ sizeChangeHandle (val) {
+ this.pageSize = val
+ this.pageIndex = 1
+ this.searchTypeChange()
+ },
+
+ // 子明细当前页
+ currentChangeHandle (val) {
+ this.pageIndex = val
+ this.searchTypeChange()
+ },
+
// 获取用户的bu
getBuBySite () {
let tempData = {
@@ -1588,17 +1629,23 @@ import {
//初始化组件的参数
init(inData) {
//初始化参数
- this.searchData = JSON.parse(JSON.stringify(inData))
- this.searchData.searchType = 'Y'
+ this.searchData = {
+ ...JSON.parse(JSON.stringify(inData)),
+ searchType: 'Y',
+ page: 1,
+ limit: 10,
+ partNo: '',
+ partDesc: '',
+ partNos: '',
+ }
//刷新表格
this.searchTable()
-
},
searchTable(){
getProjectInfoPartList(this.searchData).then(({data}) => {
//区分请求成功和失败的状况
- if (data && data.code == 0) {
+ if (data && data.code === 0) {
this.dataList = data.rows
} else {
this.dataList = []
@@ -1607,7 +1654,7 @@ import {
},
addModal () {
- if (this.searchData.projectId == "" || this.searchData.projectId == null) {
+ if (this.searchData.projectId === "" || this.searchData.projectId == null) {
this.$alert('请选择项目!', '错误', {
confirmButtonText: '确定'
})
@@ -1986,10 +2033,6 @@ import {
this.$message.warning('请选择计量单位!')
return
}
- // if (this.modalData.codeNo === '' || this.modalData.codeNo == null) {
- // this.$message.warning('请选择属性模板!')
- // return
- // }
if (this.modalData.buNo === '' || this.modalData.buNo == null) {
this.$message.warning('请选择BU!')
return
@@ -2044,29 +2087,32 @@ import {
this.partList1 = []
this.partList2 = []
this.searchData.searchType = 'Y'
+ this.searchData.partNo = ''
+ this.searchData.partDesc = ''
+ this.searchData.partNos = ''
+ this.handleGetProjectPartList();
+ },
+ handleGetProjectPartList(){
+ this.searchData.limit = this.pageSize
+ this.searchData.page = this.pageIndex
getProjectPartList(this.searchData).then(({data}) => {
- this.partListAll = data.row1
- this.partList1 = this.partListAll
- this.partData = {
- site: this.$store.state.user.site,
- partNo: '',
- partDesc: ''
+ if (data && data.code === 0){
+ this.partList1 = data.page.list
+ this.pageIndex = data.page.currPage
+ this.pageSize = data.page.pageSize
+ this.totalPage = data.page.totalCount
+ this.partModelFlag = true
}
- this.partModelFlag = true
})
},
// 改变事件
searchTypeChange () {
- getProjectPartList(this.searchData).then(({data}) => {
- this.partListAll = data.row1
- this.partList1 = this.partListAll
- this.partData = {
- site: this.$store.state.user.site,
- partNo: '',
- partDesc: ''
- }
- })
+ // 使用 map 提取 partNo 并加上单引号
+ let partNos = this.partList2.map(part => part.partNo)
+ // 使用 join 将 partNo 连接成一个字符串
+ this.searchData.partNos = partNos.join(",")
+ this.handleGetProjectPartList();
},
// 关闭后刷新列表
@@ -2078,43 +2124,34 @@ import {
* 选择项目物料
*/
getPartList () {
- let tempList = []
- if (this.partData.partNo !== '' && this.partData.partDesc === '') {
- this.partList1.forEach(item => {
- if (item.partNo.includes(this.partData.partNo)) {
- tempList.push(item)
- }
- })
- this.partList1 = tempList
- } else if (this.partData.partDesc !== '' && this.partData.partNo === '') {
- this.partList1.forEach(item => {
- if (item.partDesc.includes(this.partData.partDesc)) {
- tempList.push(item)
- }
- })
- this.partList1 = tempList
- } else if (this.partData.partNo !== '' && this.partData.partDesc !== '') {
- this.partList1.forEach(item => {
- if (item.partNo.includes(this.partData.partNo) && item.partDesc.includes(this.partData.partDesc)) {
- tempList.push(item)
- }
- })
- this.partList1 = tempList
- } else {
- this.partList1 = this.partListAll.filter(x => {
- return this.partList2.every(y => y.partNo !== x.partNo)
- })
- }
- // getPartListBy(this.partData).then(({data}) => {
- // if (data && data.code === 0) {
- // this.partList1 = data.rows
- // } else {
- // this.$alert(data.msg, '错误', {
- // confirmButtonText: '确定'
- // })
- // }
- // })
+ // let tempList = []
+ // if (this.partData.partNo !== '' && this.partData.partDesc === '') {
+ // this.partList1.forEach(item => {
+ // if (item.partNo.includes(this.partData.partNo)) {
+ // tempList.push(item)
+ // }
+ // })
+ // this.partList1 = tempList
+ // } else if (this.partData.partDesc !== '' && this.partData.partNo === '') {
+ // this.partList1.forEach(item => {
+ // if (item.partDesc.includes(this.partData.partDesc)) {
+ // tempList.push(item)
+ // }
+ // })
+ // this.partList1 = tempList
+ // } else if (this.partData.partNo !== '' && this.partData.partDesc !== '') {
+ // this.partList1.forEach(item => {
+ // if (item.partNo.includes(this.partData.partNo) && item.partDesc.includes(this.partData.partDesc)) {
+ // tempList.push(item)
+ // }
+ // })
+ // this.partList1 = tempList
+ // } else {
+ // this.partList1 = this.partListAll.filter(x => {
+ // return this.partList2.every(y => y.partNo !== x.partNo)
+ // })
+ // }
},
// 可选物料
@@ -2141,13 +2178,14 @@ import {
this.partSelections1.forEach(item => {
item.customerPartNo = ''
this.partList2.push(item)
- let index = this.partList1.findIndex(x => {
- if (x.partNo === item.partNo) {
- return true;
- }
- })
- this.partList1.splice(index, 1)
+ // let index = this.partList1.findIndex(x => {
+ // if (x.partNo === item.partNo) {
+ // return true;
+ // }
+ // })
+ // this.partList1.splice(index, 1)
})
+ this.searchTypeChange()
// for (let i = 0; i < this.partSelections1.length; i++) {
// this.partSelections1[i].customerPartNo = ''
@@ -2187,13 +2225,14 @@ import {
}
this.partSelections2.forEach(item => {
this.partList1.push(item)
- let index = this.partList2.findIndex(x => {
- if (x.partNo === item.partNo) {
- return true;
- }
- })
- this.partList2.splice(index, 1)
+ // let index = this.partList2.findIndex(x => {
+ // if (x.partNo === item.partNo) {
+ // return true;
+ // }
+ // })
+ // this.partList2.splice(index, 1)
})
+ this.searchTypeChange()
// for (let i = 0; i < this.partSelections2.length; i++) {