|
|
@@ -619,7 +619,8 @@ export default {
|
|
|
song_yang_yao_qiu: ypInfoList[index].song_yang_yao_qiu || '',
|
|
|
jian_ce_xiang_mu_: xiangMuZh,
|
|
|
shou_yang_ren_:this.$store.getters.userInfo.user.name,
|
|
|
- wei_tuo_lei_xing_:item.wei_tuo_lei_xing_
|
|
|
+ wei_tuo_lei_xing_:item.wei_tuo_lei_xing_,
|
|
|
+ jian_ce_xiang_mu_id: item.jian_ce_xiang_mu_
|
|
|
}
|
|
|
// console.log(obj)
|
|
|
ypdjb.push(obj)
|
|
|
@@ -669,13 +670,14 @@ export default {
|
|
|
}
|
|
|
console.log('样品登记表:',ypdjb)
|
|
|
if(ypdjb.length > 0){
|
|
|
- repostCurd('add', '{"tableName":"t_lhypdjb","paramWhere":' + JSON.stringify(ypdjb) + '}').then(()=>{
|
|
|
- console.log("样品登记表数据添加成功!")
|
|
|
- this.$emit('callback', true)
|
|
|
- }).catch(error =>{
|
|
|
- console.log(error)
|
|
|
- this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
- })
|
|
|
+ this.ypdjbData(ypdjb)
|
|
|
+ // repostCurd('add', '{"tableName":"t_lhypdjb","paramWhere":' + JSON.stringify(ypdjb) + '}').then(()=>{
|
|
|
+ // console.log("样品登记表数据添加成功!")
|
|
|
+ // this.$emit('callback', true)
|
|
|
+ // }).catch(error =>{
|
|
|
+ // console.log(error)
|
|
|
+ // this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
+ // })
|
|
|
}else{
|
|
|
this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
}
|
|
|
@@ -821,7 +823,8 @@ export default {
|
|
|
song_yang_yao_qiu: ypInfoList[index].song_yang_yao_qiu || '',
|
|
|
jian_ce_xiang_mu_: xiangMuZh,
|
|
|
shou_yang_ren_:this.$store.getters.userInfo.user.name,
|
|
|
- wei_tuo_lei_xing_:item.wei_tuo_lei_xing_
|
|
|
+ wei_tuo_lei_xing_:item.wei_tuo_lei_xing_,
|
|
|
+ jian_ce_xiang_mu_id: item.jian_ce_xiang_mu_
|
|
|
}
|
|
|
// console.log(obj)
|
|
|
ypdjb.push(obj)
|
|
|
@@ -873,13 +876,14 @@ export default {
|
|
|
}
|
|
|
console.log('样品登记表:',ypdjb)
|
|
|
if(ypdjb.length > 0){
|
|
|
- repostCurd('add', '{"tableName":"t_lhypdjb","paramWhere":' + JSON.stringify(ypdjb) + '}').then(()=>{
|
|
|
- console.log("样品登记表数据添加成功!")
|
|
|
- this.$emit('callback', true)
|
|
|
- }).catch(error =>{
|
|
|
- console.log(error)
|
|
|
- this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
- })
|
|
|
+ this.ypdjbData(ypdjb)
|
|
|
+ // repostCurd('add', '{"tableName":"t_lhypdjb","paramWhere":' + JSON.stringify(ypdjb) + '}').then(()=>{
|
|
|
+ // console.log("样品登记表数据添加成功!")
|
|
|
+ // this.$emit('callback', true)
|
|
|
+ // }).catch(error =>{
|
|
|
+ // console.log(error)
|
|
|
+ // this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
+ // })
|
|
|
}else{
|
|
|
this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
}
|
|
|
@@ -1005,6 +1009,51 @@ export default {
|
|
|
this.redar = false // 扫码图标隐藏
|
|
|
this.$emit('scanOff', false)
|
|
|
},
|
|
|
+ // 新加有效期至字段
|
|
|
+ async ypdjbData (arr) {
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ console.log(arr, arr[i].jian_ce_xiang_mu_id)
|
|
|
+ const sql = `select bao_gao_zhou_qi_g from t_mjjcnlfw where FIND_IN_SET(id_,'${arr[i].jian_ce_xiang_mu_id}')`
|
|
|
+ var maxAge
|
|
|
+ await repostCurd('sql', sql).then((res) => {
|
|
|
+ const { data = [] } = res.variables || {}
|
|
|
+ maxAge = data.reduce((max, person) => {
|
|
|
+ // 将age从字符串转换为数字
|
|
|
+ maxAge = parseInt(person.bao_gao_zhou_qi_g)
|
|
|
+ // 使用三元表达式比较并更新最大值
|
|
|
+ return maxAge > max ? maxAge : max
|
|
|
+ }, 0)
|
|
|
+ const currentDate = new Date()
|
|
|
+
|
|
|
+ // 创建一个新的日期对象,表示当前日期加上3天
|
|
|
+ const futureDate = new Date(currentDate)
|
|
|
+
|
|
|
+ futureDate.setDate(currentDate.getDate() + Number(maxAge))
|
|
|
+
|
|
|
+ // 获取年、月、日
|
|
|
+ const year = futureDate.getFullYear()
|
|
|
+
|
|
|
+ const month = String(futureDate.getMonth() + 1).padStart(2, '0')
|
|
|
+
|
|
|
+ // 月份从0开始,所以需要加1
|
|
|
+ const day = String(futureDate.getDate()).padStart(2, '0')
|
|
|
+
|
|
|
+ // 格式化为YYYY-MM-DD
|
|
|
+ const formattedDate = `${year}-${month}-${day}`
|
|
|
+ // console.log('maxAge', formattedDate)
|
|
|
+ arr[i].bao_gao_zhou_qi_g = formattedDate
|
|
|
+ console.log(formattedDate)
|
|
|
+ delete arr[i].jian_ce_xiang_mu_id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ repostCurd('add', '{"tableName":"t_lhypdjb","paramWhere":' + JSON.stringify(arr) + '}').then(() => {
|
|
|
+ console.log('样品登记表数据添加成功!')
|
|
|
+ this.$emit('callback', true)
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.handleAnySituation(true, '样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决', 'error')
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|