|
|
@@ -214,6 +214,10 @@ export default {
|
|
|
codeRuleDescription: null,
|
|
|
//左侧表格当前行
|
|
|
leftCurrent: null,
|
|
|
+ //通过条码类型和当前工厂查询结果
|
|
|
+ barcodeSetData: null,
|
|
|
+ //数据种类 生码项类
|
|
|
+ kindTypeData: [],
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -373,71 +377,80 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
- * @desc : 获取点击行类型的生码项类
|
|
|
- * @date : 2023/6/20 9:52
|
|
|
- * @author : 寇珊珊
|
|
|
+ * @desc : 查询生码项类
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2024-04-15 15:39
|
|
|
*/
|
|
|
- getKindTags(row) {
|
|
|
+ getKindTags() {
|
|
|
let params = {
|
|
|
kindType: this.$config.dataKind.generativeItemClass,
|
|
|
- kindCodeList: [row.formatKind]
|
|
|
}
|
|
|
this.excute(this.$service.commonService, this.$service.commonService.getDataKind, params, false).then(res => {//调用api查询方法
|
|
|
if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- let list = res.data
|
|
|
- for (let i of list) {
|
|
|
- i.value = i.kindTags
|
|
|
- row.value = i.value
|
|
|
- row.value[0].maxNumber = '9'
|
|
|
- for (let i = 1; i < row.value[0].max; i++) {
|
|
|
- row.value[0].maxNumber += '9'
|
|
|
- }
|
|
|
- row.value[0].maxNumber = parseInt(row.value[0].maxNumber)
|
|
|
- row.value[0].minNumber = '1'
|
|
|
- for (let i = 1; i < row.value[0].min; i++) {
|
|
|
- row.value[0].minNumber += '0'
|
|
|
- }
|
|
|
- row.value[0].minNumber = parseInt(row.value[0].minNumber)
|
|
|
- //文本
|
|
|
- if (row.formatKind == this.$config.barCodeTypes.text && i.kindCode == this.$config.barCodeTypes.text) {
|
|
|
- this.completionMethodList = i.value[1].items
|
|
|
- for (let i of this.completionMethodList) {
|
|
|
- i.name = i.name[this.$store.state.app.local_lan]
|
|
|
- }
|
|
|
- this.truncationMethodList = i.value[3].items
|
|
|
- for (let i of this.truncationMethodList) {
|
|
|
- i.name = i.name[this.$store.state.app.local_lan]
|
|
|
- }
|
|
|
- //最大值,最小值
|
|
|
- if (row.value && row.value[0].max) {
|
|
|
- this.max = row.value[0].max
|
|
|
- }
|
|
|
- if (row.value && row.value[0].min) {
|
|
|
- this.min = row.value[0].min
|
|
|
- }
|
|
|
- }
|
|
|
- //数字
|
|
|
- else if (row.formatKind == this.$config.barCodeTypes.number && i.kindCode == this.$config.barCodeTypes.number) {
|
|
|
- //最大值,最小值
|
|
|
- if (row.value && row.value[0].max) {
|
|
|
- this.max = row.value[0].max
|
|
|
- }
|
|
|
- if (row.value && row.value[0].min) {
|
|
|
- this.min = row.value[0].min
|
|
|
- }
|
|
|
- //todo 看后续是否需要补充
|
|
|
- }
|
|
|
- //日期
|
|
|
- else {
|
|
|
- //todo 看后续是否需要补充
|
|
|
- }
|
|
|
- }
|
|
|
- //获取右侧表格数据
|
|
|
- this.getRightTable({row})
|
|
|
+ this.kindTypeData = res.data
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(res.message)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
+ * @desc : 获取点击行类型的生码项类
|
|
|
+ * @date : 2023/6/20 9:52
|
|
|
+ * @author : 寇珊珊
|
|
|
+ */
|
|
|
+ setKindTags(row) {
|
|
|
+ let list = JSON.parse(JSON.stringify(this.kindTypeData.filter(f => f.kindCode === row.formatKind)))
|
|
|
+ for (let i of list) {
|
|
|
+ i.value = i.kindTags
|
|
|
+ row.value = i.value
|
|
|
+ row.value[0].maxNumber = '9'
|
|
|
+ for (let i = 1; i < row.value[0].max; i++) {
|
|
|
+ row.value[0].maxNumber += '9'
|
|
|
+ }
|
|
|
+ row.value[0].maxNumber = parseInt(row.value[0].maxNumber)
|
|
|
+ row.value[0].minNumber = '1'
|
|
|
+ for (let i = 1; i < row.value[0].min; i++) {
|
|
|
+ row.value[0].minNumber += '0'
|
|
|
+ }
|
|
|
+ row.value[0].minNumber = parseInt(row.value[0].minNumber)
|
|
|
+ //文本
|
|
|
+ if (row.formatKind == this.$config.barCodeTypes.text && i.kindCode == this.$config.barCodeTypes.text) {
|
|
|
+ this.completionMethodList = i.value[1].items
|
|
|
+ for (let i of this.completionMethodList) {
|
|
|
+ i.name = i.name[this.$store.state.app.local_lan]
|
|
|
+ }
|
|
|
+ this.truncationMethodList = i.value[3].items
|
|
|
+ for (let i of this.truncationMethodList) {
|
|
|
+ i.name = i.name[this.$store.state.app.local_lan]
|
|
|
+ }
|
|
|
+ //最大值,最小值
|
|
|
+ if (row.value && row.value[0].max) {
|
|
|
+ this.max = row.value[0].max
|
|
|
+ }
|
|
|
+ if (row.value && row.value[0].min) {
|
|
|
+ this.min = row.value[0].min
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //数字
|
|
|
+ else if (row.formatKind == this.$config.barCodeTypes.number && i.kindCode == this.$config.barCodeTypes.number) {
|
|
|
+ //最大值,最小值
|
|
|
+ if (row.value && row.value[0].max) {
|
|
|
+ this.max = row.value[0].max
|
|
|
+ }
|
|
|
+ if (row.value && row.value[0].min) {
|
|
|
+ this.min = row.value[0].min
|
|
|
+ }
|
|
|
+ //todo 看后续是否需要补充
|
|
|
+ }
|
|
|
+ //日期
|
|
|
+ else {
|
|
|
+ //todo 看后续是否需要补充
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //获取右侧表格数据
|
|
|
+ this.getRightTable({row})
|
|
|
+ },
|
|
|
+ /**
|
|
|
* @desc : 左侧列表点击事件
|
|
|
* @date : 2023/6/16 17:27
|
|
|
* @author : 寇珊珊
|
|
|
@@ -453,6 +466,11 @@ export default {
|
|
|
this.setFormat = null
|
|
|
this.oldSetFormat = null
|
|
|
|
|
|
+ //获取当前工厂数据
|
|
|
+ if (row && row.kindCode) {
|
|
|
+ this.getByKindCode(row.kindCode)
|
|
|
+ }
|
|
|
+
|
|
|
if (!flag) {
|
|
|
this.leftCurrent = row.kindCode
|
|
|
|
|
|
@@ -506,7 +524,7 @@ export default {
|
|
|
//获取中间表格数据
|
|
|
this.getCenterTable(centerRow.kindCode)
|
|
|
//获取右侧表格数据
|
|
|
- this.currentChangeCenterEvent(rightRow)
|
|
|
+ // this.currentChangeCenterEvent(rightRow)
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
@@ -542,6 +560,8 @@ export default {
|
|
|
index++
|
|
|
//赋值格式列
|
|
|
this.setTableCenterDataSetFormat(i)
|
|
|
+ //条码规则表里没有数据,生产条码外箱条码的状态都应该是false
|
|
|
+ i.flgValid = false
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
@@ -596,8 +616,26 @@ export default {
|
|
|
this.numberFlag = false
|
|
|
this.textFlag = false
|
|
|
}
|
|
|
- this.getKindTags(row)
|
|
|
+ this.setKindTags(row)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 通过条码类型查询
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2024-04-15 15:15
|
|
|
+ */
|
|
|
+ getByKindCode(kindCode) {
|
|
|
+ let params = {
|
|
|
+ setKind: kindCode,
|
|
|
+ ftyId: this.ftyId
|
|
|
}
|
|
|
+ this.excute(this.$service.barcodeSetService, this.$service.barcodeSetService.selectByCode, params, false).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.barcodeSetData = res.data
|
|
|
+ } else {
|
|
|
+ this.$Message.error(res.messages)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
/**
|
|
|
* @desc : 获取右侧表格数据
|
|
|
@@ -610,38 +648,102 @@ export default {
|
|
|
this.formData = JSON.parse(JSON.stringify(row.formData))
|
|
|
return
|
|
|
}
|
|
|
- let params = {
|
|
|
- setKind: this.$refs['leftTable'].batchRows[0].kindCode,
|
|
|
- ftyId: this.ftyId
|
|
|
- }
|
|
|
- this.excute(this.$service.barcodeSetService, this.$service.barcodeSetService.selectByCode, params, false).then(res => {//调用api查询方法
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- //是否已有生成条码参数
|
|
|
- if (res.data == null) {
|
|
|
- //没有取数据库默认
|
|
|
- //条码格式
|
|
|
+ //是否已有生成条码参数
|
|
|
+ if (this.barcodeSetData == null) {
|
|
|
+ //没有取数据库默认
|
|
|
+ //条码格式
|
|
|
|
|
|
- //有效标识
|
|
|
- this.flgValid = true
|
|
|
- this.oldFlgValid = true
|
|
|
+ //有效标识
|
|
|
+ this.flgValid = true
|
|
|
+ this.oldFlgValid = true
|
|
|
+ //文本
|
|
|
+ if (row.formatKind == this.$config.barCodeTypes.text) {
|
|
|
+ //文本固定长度
|
|
|
+ this.formData.textFixedLength = row.defFormat.FIX_LEN
|
|
|
+ //补齐方式
|
|
|
+ this.formData.completionMethod = row.defFormat.CUT_TYPE
|
|
|
+ //补齐字符
|
|
|
+ this.formData.completionCharacter = row.defFormat.PAD_STR
|
|
|
+ //截断方式
|
|
|
+ this.formData.truncationMethod = row.defFormat.PAD_TYPE
|
|
|
+ }
|
|
|
+ //数字
|
|
|
+ else if (row.formatKind == this.$config.barCodeTypes.number) {
|
|
|
+ this.formData.flowingWaterTextFixedLength = row.defFormat.FIX_LEN
|
|
|
+ }
|
|
|
+ //日期
|
|
|
+ else {
|
|
|
+ this.formData.dateFormat = row.defFormat.DATE_FORMAT
|
|
|
+ //年月日 时分秒
|
|
|
+ if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('m') >= 0 || this.formData.dateFormat.indexOf('M') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('d') >= 0 || this.formData.dateFormat.indexOf('D') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('h') >= 0 || this.formData.dateFormat.indexOf('H') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('M') >= 0 || this.formData.dateFormat.indexOf('m') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('S') >= 0 || this.formData.dateFormat.indexOf('s') >= 0)
|
|
|
+ ) {
|
|
|
+ row.dateType = 'datetime'
|
|
|
+ row.sampleText = new Date()
|
|
|
+ }
|
|
|
+ //年月日
|
|
|
+ else if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('m') >= 0 || this.formData.dateFormat.indexOf('M') >= 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('d') >= 0 || this.formData.dateFormat.indexOf('D') >= 0)
|
|
|
+ ) {
|
|
|
+ row.dateType = 'date'
|
|
|
+ row.sampleText = new Date()
|
|
|
+ }
|
|
|
+ //年
|
|
|
+ else if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0)
|
|
|
+ ) {
|
|
|
+ row.dateType = 'year'
|
|
|
+ row.sampleText = new Date()
|
|
|
+ }
|
|
|
+ //年 月
|
|
|
+ else if ((this.formData.dateFormat.indexOf('y') > 0 || this.formData.dateFormat.indexOf('Y') > 0) &&
|
|
|
+ (this.formData.dateFormat.indexOf('m') > 0 || this.formData.dateFormat.indexOf('M') > 0)) {
|
|
|
+ row.dateType = 'month'
|
|
|
+ row.sampleText = new Date()
|
|
|
+ }
|
|
|
+ //判断是否值和原来的值发生变化
|
|
|
+ row.sampleTextBack = row.sampleText
|
|
|
+ }
|
|
|
+ //当前行表单
|
|
|
+ row.formData = JSON.parse(JSON.stringify(this.formData))
|
|
|
+ row.formDataBack = JSON.parse(JSON.stringify(this.formData))
|
|
|
+ }
|
|
|
+ //已有生成条码参数
|
|
|
+ else {
|
|
|
+ //条码格式
|
|
|
+ if (!this.setFormat) {
|
|
|
+ this.setFormat = this.barcodeSetData.setFormat
|
|
|
+ this.oldSetFormat = this.barcodeSetData.setFormat
|
|
|
+ }
|
|
|
+ if (this.barcodeSetData && this.barcodeSetData.setItems) {
|
|
|
+ //中间表格选中的当前行类型 等于保存数据里的类型
|
|
|
+ let findRow = this.barcodeSetData.setItems.filter(it => it.kind == row.kind && it.code == row.code)[0]
|
|
|
+ if (findRow) {
|
|
|
+ //有数据库默认
|
|
|
+ let rowMessage = findRow
|
|
|
+ rowMessage.defFormat = findRow.format
|
|
|
//文本
|
|
|
- if (row.formatKind == this.$config.barCodeTypes.text) {
|
|
|
+ if (findRow.kind == this.$config.barCodeTypes.text) {
|
|
|
//文本固定长度
|
|
|
- this.formData.textFixedLength = row.defFormat.FIX_LEN
|
|
|
+ this.formData.textFixedLength = rowMessage.defFormat.FIX_LEN
|
|
|
//补齐方式
|
|
|
- this.formData.completionMethod = row.defFormat.CUT_TYPE
|
|
|
+ this.formData.completionMethod = rowMessage.defFormat.CUT_TYPE
|
|
|
//补齐字符
|
|
|
- this.formData.completionCharacter = row.defFormat.PAD_STR
|
|
|
+ this.formData.completionCharacter = rowMessage.defFormat.PAD_STR
|
|
|
//截断方式
|
|
|
- this.formData.truncationMethod = row.defFormat.PAD_TYPE
|
|
|
+ this.formData.truncationMethod = rowMessage.defFormat.PAD_TYPE
|
|
|
}
|
|
|
//数字
|
|
|
- else if (row.formatKind == this.$config.barCodeTypes.number) {
|
|
|
- this.formData.flowingWaterTextFixedLength = row.defFormat.FIX_LEN
|
|
|
+ else if (findRow.kind == this.$config.barCodeTypes.number) {
|
|
|
+ this.formData.flowingWaterTextFixedLength = rowMessage.defFormat.FIX_LEN
|
|
|
}
|
|
|
//日期
|
|
|
- else {
|
|
|
- this.formData.dateFormat = row.defFormat.DATE_FORMAT
|
|
|
+ else if (findRow.kind == this.$config.barCodeTypes.date) {
|
|
|
+ this.formData.dateFormat = rowMessage.defFormat.DATE_FORMAT
|
|
|
//年月日 时分秒
|
|
|
if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0) &&
|
|
|
(this.formData.dateFormat.indexOf('m') >= 0 || this.formData.dateFormat.indexOf('M') >= 0) &&
|
|
|
@@ -676,102 +778,30 @@ export default {
|
|
|
//判断是否值和原来的值发生变化
|
|
|
row.sampleTextBack = row.sampleText
|
|
|
}
|
|
|
- //当前行表单
|
|
|
- row.formData = JSON.parse(JSON.stringify(this.formData))
|
|
|
- row.formDataBack = JSON.parse(JSON.stringify(this.formData))
|
|
|
}
|
|
|
- //已有生成条码参数
|
|
|
- else {
|
|
|
- //条码格式
|
|
|
- if (!this.setFormat) {
|
|
|
- this.setFormat = res.data.setFormat
|
|
|
- this.oldSetFormat = res.data.setFormat
|
|
|
- }
|
|
|
- if (res.data && res.data.setItems) {
|
|
|
- //中间表格选中的当前行类型 等于保存数据里的类型
|
|
|
- let findRow = res.data.setItems.filter(it => it.kind == row.kind && it.code == row.code)[0]
|
|
|
- if (findRow) {
|
|
|
- //有数据库默认
|
|
|
- let rowMessage = findRow
|
|
|
- rowMessage.defFormat = findRow.format
|
|
|
- //文本
|
|
|
- if (findRow.kind == this.$config.barCodeTypes.text) {
|
|
|
- //文本固定长度
|
|
|
- this.formData.textFixedLength = rowMessage.defFormat.FIX_LEN
|
|
|
- //补齐方式
|
|
|
- this.formData.completionMethod = rowMessage.defFormat.CUT_TYPE
|
|
|
- //补齐字符
|
|
|
- this.formData.completionCharacter = rowMessage.defFormat.PAD_STR
|
|
|
- //截断方式
|
|
|
- this.formData.truncationMethod = rowMessage.defFormat.PAD_TYPE
|
|
|
- }
|
|
|
- //数字
|
|
|
- else if (findRow.kind == this.$config.barCodeTypes.number) {
|
|
|
- this.formData.flowingWaterTextFixedLength = rowMessage.defFormat.FIX_LEN
|
|
|
- }
|
|
|
- //日期
|
|
|
- else if (findRow.kind == this.$config.barCodeTypes.date) {
|
|
|
- this.formData.dateFormat = rowMessage.defFormat.DATE_FORMAT
|
|
|
- //年月日 时分秒
|
|
|
- if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('m') >= 0 || this.formData.dateFormat.indexOf('M') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('d') >= 0 || this.formData.dateFormat.indexOf('D') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('h') >= 0 || this.formData.dateFormat.indexOf('H') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('M') >= 0 || this.formData.dateFormat.indexOf('m') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('S') >= 0 || this.formData.dateFormat.indexOf('s') >= 0)
|
|
|
- ) {
|
|
|
- row.dateType = 'datetime'
|
|
|
- row.sampleText = new Date()
|
|
|
- }
|
|
|
- //年月日
|
|
|
- else if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('m') >= 0 || this.formData.dateFormat.indexOf('M') >= 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('d') >= 0 || this.formData.dateFormat.indexOf('D') >= 0)
|
|
|
- ) {
|
|
|
- row.dateType = 'date'
|
|
|
- row.sampleText = new Date()
|
|
|
- }
|
|
|
- //年
|
|
|
- else if ((this.formData.dateFormat.indexOf('y') >= 0 || this.formData.dateFormat.indexOf('Y') >= 0)
|
|
|
- ) {
|
|
|
- row.dateType = 'year'
|
|
|
- row.sampleText = new Date()
|
|
|
- }
|
|
|
- //年 月
|
|
|
- else if ((this.formData.dateFormat.indexOf('y') > 0 || this.formData.dateFormat.indexOf('Y') > 0) &&
|
|
|
- (this.formData.dateFormat.indexOf('m') > 0 || this.formData.dateFormat.indexOf('M') > 0)) {
|
|
|
- row.dateType = 'month'
|
|
|
- row.sampleText = new Date()
|
|
|
- }
|
|
|
- //判断是否值和原来的值发生变化
|
|
|
- row.sampleTextBack = row.sampleText
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //当前行表单
|
|
|
- row.formData = JSON.parse(JSON.stringify(this.formData))
|
|
|
- row.formDataBack = JSON.parse(JSON.stringify(this.formData))
|
|
|
- //处理中间表格行格式
|
|
|
- for (let i of this.tableCenterData) {
|
|
|
- for (let it of res.data.setItems) {
|
|
|
- if (i.code == it.code) {
|
|
|
- i.defFormat = it.format
|
|
|
- if (this.lefTableIndex == 0) {
|
|
|
- i.flgValid = it.flgValid
|
|
|
- //有效标识
|
|
|
- this.flgValid = res.data.flgValid
|
|
|
- this.oldFlgValid = res.data.flgValid
|
|
|
- }
|
|
|
- //中间表格行格式赋值
|
|
|
- this.setTableCenterDataSetFormat(i)
|
|
|
- }
|
|
|
+ }
|
|
|
+ //当前行表单
|
|
|
+ row.formData = JSON.parse(JSON.stringify(this.formData))
|
|
|
+ row.formDataBack = JSON.parse(JSON.stringify(this.formData))
|
|
|
+ //处理中间表格行格式
|
|
|
+ for (let i of this.tableCenterData) {
|
|
|
+ for (let it of this.barcodeSetData.setItems) {
|
|
|
+ if (i.code == it.code) {
|
|
|
+ i.defFormat = it.format
|
|
|
+ if (this.lefTableIndex == 0) {
|
|
|
+ i.flgValid = it.flgValid
|
|
|
+ //有效标识
|
|
|
+ this.flgValid = this.barcodeSetData.flgValid
|
|
|
+ this.oldFlgValid = this.barcodeSetData.flgValid
|
|
|
}
|
|
|
+ //中间表格行格式赋值
|
|
|
+ this.setTableCenterDataSetFormat(i)
|
|
|
}
|
|
|
- //用来判断是否是左侧表格切换(只有当左侧表格切换才需要重新赋值中间表格‘状态’)
|
|
|
- this.lefTableIndex++
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ //用来判断是否是左侧表格切换(只有当左侧表格切换才需要重新赋值中间表格‘状态’)
|
|
|
+ this.lefTableIndex++
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* @desc : 校验参数
|
|
|
@@ -918,6 +948,7 @@ export default {
|
|
|
this.routeObjName = 'barcodeSet' // 设置路由名称
|
|
|
this.getData()
|
|
|
this.getCodeRule()
|
|
|
+ this.getKindTags()
|
|
|
},
|
|
|
}
|
|
|
</script>
|