|
|
@@ -509,12 +509,25 @@
|
|
|
<!--切换子品-->
|
|
|
<DkModal
|
|
|
width="900"
|
|
|
+ ref="chlid_modal"
|
|
|
v-model="showModal"
|
|
|
@modalOk="modalOk"
|
|
|
- title="请选择需要替换的商品">
|
|
|
- <DkTable :primaryKey="controlId" ref="table-exchange" :id="'table-'+$options.name" name="table"
|
|
|
+ title="请选择需要替换的产品">
|
|
|
+ <BaseIndexButtonGroup>
|
|
|
+ <template #left>
|
|
|
+ <BaseIndexButton ref="search" name="search" @click="searchData"></BaseIndexButton>
|
|
|
+ <BaseIndexButton :finalFlag="true" ref="clear" name="clear" @click="clear"></BaseIndexButton>
|
|
|
+ </template>
|
|
|
+ </BaseIndexButtonGroup>
|
|
|
+
|
|
|
+ <DkTable :primaryKey="controlId" ref="table-exchange"
|
|
|
+ :id="'table-'+$options.name" name="table"
|
|
|
:data="exchangeData"
|
|
|
- size="mini" :link-click-checked="true" :page-flag="false">
|
|
|
+ :choose-flag="false"
|
|
|
+ :page-total="pageInfo.total"
|
|
|
+ :current-page="pageInfo.currentPage"
|
|
|
+ @pageChange="pageSizeChange"
|
|
|
+ size="mini" >
|
|
|
<DkTableColumn v-for="(item,index) in columnsDetail" :key="index" :field="item.field"
|
|
|
:title="item.title"></DkTableColumn>
|
|
|
</DkTable>
|
|
|
@@ -668,7 +681,12 @@
|
|
|
mouseEnterEditFlag: {
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
|
- }
|
|
|
+ },
|
|
|
+ //绑定条码标识
|
|
|
+ bindBarCodeFlag:{
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
const vm = window.vm
|
|
|
@@ -715,6 +733,11 @@
|
|
|
nonGlassForm: {}, // 非标玻璃的form表单
|
|
|
settingLeft: null, // 设置图标居左的位置
|
|
|
settingTop: null, // 设置图标居上的位置
|
|
|
+ pageInfo: {
|
|
|
+ total: 0,
|
|
|
+ pageSize: this.$config.pageSize,
|
|
|
+ currentPage: 1
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -742,6 +765,7 @@
|
|
|
})
|
|
|
// 编辑
|
|
|
if (data && data.length > 0) {
|
|
|
+ console.log("data",data)
|
|
|
this.tableData = JSON.parse(JSON.stringify(data))
|
|
|
this.handleSelectData()
|
|
|
this.loadChildrenInit(this.tableData) // 处理子级数据
|
|
|
@@ -758,6 +782,32 @@
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
+ * @desc : 清空事件
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2022/3/4 8:19
|
|
|
+ */
|
|
|
+ clear() {
|
|
|
+ this.searchList = {}
|
|
|
+ this.searchCond._value = {}
|
|
|
+ if (this.$refs.searchCond) {
|
|
|
+ this.$refs.searchCond.clearCondition();
|
|
|
+ }
|
|
|
+ this.searchData() // 重新查询
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 查询,从第一页开始
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2023/2/24 10:45
|
|
|
+ */
|
|
|
+ searchData() {
|
|
|
+ this.pageInfo.currentPage = 1;
|
|
|
+ this.getDataTable();
|
|
|
+ },
|
|
|
+ pageSizeChange(pageInfo) {
|
|
|
+ this.pageInfo = pageInfo
|
|
|
+ this.getDataTable() // 查询数据
|
|
|
+ },
|
|
|
+ /**
|
|
|
* @desc : 单元格样式
|
|
|
* @author : 周兴
|
|
|
* @date : 2022/8/23 17:23
|
|
|
@@ -1778,6 +1828,7 @@
|
|
|
let childs = this.children.filter(it => it.parentId === row.id && it.hasChild == 0)
|
|
|
resolve(childs)
|
|
|
}
|
|
|
+ console.log('row',row,this.tableData)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -3568,33 +3619,55 @@
|
|
|
// 查询可替换商品
|
|
|
this.getDataTable(row)
|
|
|
}
|
|
|
- }
|
|
|
- ,
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 查询可切换的数据
|
|
|
* @author : 周兴
|
|
|
* @date : 2022/5/27 16:04
|
|
|
*/
|
|
|
getDataTable(row) {
|
|
|
- let param = {}
|
|
|
- param.ftyId = this.$store.state.user.ftyId
|
|
|
- // 根据传入的数据进行检索
|
|
|
- param[this.exchangeField] = row[this.exchangeField]
|
|
|
- console.log("this.methodsNameExchange",this.methodsNameExchange)
|
|
|
- console.log("row[this.exchangeField]",row[this.exchangeField])
|
|
|
- this.service[this.methodsNameExchange](param).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.exchangeData = res.data.list
|
|
|
- //过滤掉当前数据
|
|
|
- this.exchangeData = this.exchangeData.filter(it => it[this.controlId] !== row[this.controlId])
|
|
|
- //显示可替换的界面
|
|
|
- this.showModal = true
|
|
|
- } else {
|
|
|
- this.$Message.error(res.message)
|
|
|
+ //显示可替换的界面
|
|
|
+ this.showModal = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let param = { ...this.$refs['table-exchange'].pageInfo }
|
|
|
+ param.currentPage = this.pageInfo.currentPage ? this.pageInfo.currentPage : 1
|
|
|
+ param.pageSize = this.pageInfo.pageSize
|
|
|
+ param.ftyId = this.$store.state.user.ftyId
|
|
|
+ // 根据传入的数据进行检索
|
|
|
+ if(!row){
|
|
|
+ row = this.focusedRow
|
|
|
}
|
|
|
+ param[this.exchangeField] = row[this.exchangeField]
|
|
|
+ if (this.bindBarCodeFlag && row['moldlineId']) {
|
|
|
+ param.pdtGlueKind = row['pdtGlueKind']
|
|
|
+ //todo 查出所有数据 zdl 2023年4月25日09:01:27
|
|
|
+ // param.moldlineId = row['moldlineId']
|
|
|
+ //todo 暂时注掉 2023年4月25日08:46:09 zdl
|
|
|
+ // param.moldlineItemNoList = this.children.map(it=>it.moldlineItemNo).unique()
|
|
|
+ }
|
|
|
+ this.excute(this.service, this.service[this.methodsNameExchange], param).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ let arr = []
|
|
|
+ if (res.data && res.data.list && res.data.list.length > 0) {
|
|
|
+ arr = [...res.data.list]
|
|
|
+ }
|
|
|
+ if ((!arr || arr.length === 0) && res.data && res.data.length > 0) {
|
|
|
+ arr = [...res.data]
|
|
|
+ }
|
|
|
+ this.exchangeData = arr
|
|
|
+ //过滤掉当前数据 不是绑定条码事需要
|
|
|
+ if(!this.bindBarCodeFlag){
|
|
|
+ this.exchangeData = this.exchangeData.filter(it => it[this.controlId] !== row[this.controlId])
|
|
|
+ }
|
|
|
+ this.$refs['table-exchange'].pageInfo.total = res.data.total
|
|
|
+ //显示可替换的界面
|
|
|
+ // this.showModal = true
|
|
|
+ } else {
|
|
|
+ this.$Message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }
|
|
|
- ,
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 判断交换图标是否可见
|
|
|
* @author : 周兴
|
|
|
@@ -3619,39 +3692,76 @@
|
|
|
return
|
|
|
}
|
|
|
let row = this.$refs['table-exchange'].batchRows[0]
|
|
|
- // 判断替品是否有标价
|
|
|
- if (!row.priceStandard && row.priceStandard != 0) {
|
|
|
- this.$Message.error(this.$t('W_069', { 'param': this.$t('priceStandard') }))
|
|
|
- return
|
|
|
- }
|
|
|
- // 关闭弹窗
|
|
|
- this.showModal = false
|
|
|
- // 全局中的children也要改变
|
|
|
- let child = this.children.filter(it => it['id'] === this.focusedRow['id'])
|
|
|
- // 把选择的数据进行覆盖当前列表
|
|
|
- this.columnsUpdate.forEach(col => {
|
|
|
- if (col.field !== 'id' && col.field !== 'parentId'
|
|
|
- && this.focusedRow && this.focusedRow[col.field] && row[col.field]) {
|
|
|
- this.focusedRow[col.field] = row[col.field]
|
|
|
- child[0][col.field] = row[col.field]
|
|
|
+ //如果是绑定条码
|
|
|
+ if(this.bindBarCodeFlag){
|
|
|
+ //判断页面中是否已有选择数据
|
|
|
+ //没有重复数据
|
|
|
+ if (this.children.filter(it => it.pdtModelId == row.pdtModelId &&
|
|
|
+ it.moldlineId == row.moldlineId && it.moldlineItemNo == row.moldlineItemNo).length == 0) {
|
|
|
+ //替换明细
|
|
|
+ this.checkDetailByBindBarCode(row)
|
|
|
+ this.showModal = false
|
|
|
}
|
|
|
- })
|
|
|
- //hasChild也需要替换
|
|
|
- this.focusedRow['hasChild'] = row['hasChild'] ? row['hasChild'] : 0
|
|
|
- this.focusedRow['bomItems'] = row['bomItems'] ? row['bomItems'] : []
|
|
|
- child['hasChild'] = row['hasChild'] ? row['hasChild'] : 0
|
|
|
- child['bomItems'] = row['bomItems'] ? row['bomItems'] : []
|
|
|
- //修改子级的价格等信息
|
|
|
- let parentRows = this.tableData.filter(it => it['id'] === this.focusedRow['parentId'])
|
|
|
- if (parentRows && parentRows.length > 0) {
|
|
|
- // 先计算父级
|
|
|
- this.shareToParentData(parentRows[0]).then(res => {
|
|
|
- // 再根据父级计算子级其他数据
|
|
|
- this.shareFromParentData(parentRows[0], parentRows[0].children)
|
|
|
+ //有重复数据
|
|
|
+ else {
|
|
|
+ this.$Message.error(this.$t('W_141'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 判断替品是否有标价
|
|
|
+ if (!row.priceStandard && row.priceStandard != 0) {
|
|
|
+ this.$Message.error(this.$t('W_069', { 'param': this.$t('priceStandard') }))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 关闭弹窗
|
|
|
+ this.showModal = false
|
|
|
+ // 全局中的children也要改变
|
|
|
+ let child = this.children.filter(it => it['id'] === this.focusedRow['id'])
|
|
|
+ // 把选择的数据进行覆盖当前列表
|
|
|
+ this.columnsUpdate.forEach(col => {
|
|
|
+ if (col.field !== 'id' && col.field !== 'parentId'
|
|
|
+ && this.focusedRow && this.focusedRow[col.field] && row[col.field]) {
|
|
|
+ this.focusedRow[col.field] = row[col.field]
|
|
|
+ child[0][col.field] = row[col.field]
|
|
|
+ }
|
|
|
})
|
|
|
+ //hasChild也需要替换
|
|
|
+ this.focusedRow['hasChild'] = row['hasChild'] ? row['hasChild'] : 0
|
|
|
+ this.focusedRow['bomItems'] = row['bomItems'] ? row['bomItems'] : []
|
|
|
+ child['hasChild'] = row['hasChild'] ? row['hasChild'] : 0
|
|
|
+ child['bomItems'] = row['bomItems'] ? row['bomItems'] : []
|
|
|
+ //修改子级的价格等信息
|
|
|
+ let parentRows = this.tableData.filter(it => it['id'] === this.focusedRow['parentId'])
|
|
|
+ if (parentRows && parentRows.length > 0) {
|
|
|
+ // 先计算父级
|
|
|
+ this.shareToParentData(parentRows[0]).then(res => {
|
|
|
+ // 再根据父级计算子级其他数据
|
|
|
+ this.shareFromParentData(parentRows[0], parentRows[0].children)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ,
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 替换明细--当前绑定条码用
|
|
|
+ * @date : 2023/4/24 14:40
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ checkDetailByBindBarCode(row){
|
|
|
+ for(let i in this.children){
|
|
|
+ //找到明细中需要替换的数据
|
|
|
+ if(this.children[i].id==this.focusedRow.id){
|
|
|
+ row.parentId = this.children[i].parentId
|
|
|
+ row.hasChild = this.children[i].hasChild
|
|
|
+ row.id = this.children[i].id
|
|
|
+ row.readOnlyUniqueCode = this.children[i].readOnlyUniqueCode
|
|
|
+ this.children[i]=row
|
|
|
+ this.children.moldingItemId = this.children[i].itemId
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$emit('check-detail-by-bind-bar-code',this.focusedRow,row)
|
|
|
+
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 计算父级数据
|
|
|
* @author : 周兴
|
|
|
@@ -3817,9 +3927,9 @@
|
|
|
//绑定条码- 产品
|
|
|
else if(col.treeNode && col.dataType === this.$config.tableSelectType.product){
|
|
|
//设置后台接口服务
|
|
|
- this.methodsName = 'selectByMoldineId'
|
|
|
- this.methodsNameExchange = 'selectByMoldineId'
|
|
|
- this.service = this.$service.commonService
|
|
|
+ this.methodsName = 'selectProductByBindBarcode'
|
|
|
+ this.methodsNameExchange = 'selectProductByBindBarcode'
|
|
|
+ this.service = this.$service.moldingRecordItemService
|
|
|
//替换的列
|
|
|
this.columnsUpdate.push(
|
|
|
{ field: 'moldlineItemNo',title: this.$t('groupNo') }, // 分组序号
|
|
|
@@ -3842,6 +3952,10 @@
|
|
|
)
|
|
|
//弹窗的列
|
|
|
this.columnsDetail.push(
|
|
|
+ // 成型批次
|
|
|
+ { field: 'moldingBatch', type: 'disabled', width: 'auto' },
|
|
|
+ // 成型日期
|
|
|
+ { field: 'moldingDate', type: 'disabled', width: 'auto' },
|
|
|
// 分组序号
|
|
|
{ field: 'moldlineItemNo', title: this.$t('groupNo'), treeNode: true, type: 'disabled', width: 'auto' },
|
|
|
// 分组名称
|