|
|
@@ -179,7 +179,7 @@
|
|
|
|
|
|
<u-popup v-model="lhypbShow" mode="bottom" height="80%" border-radius="20">
|
|
|
<view>
|
|
|
- <lhypb-message ref="lhypbMessage" :type="lhypbIndexData" :jianCeTypeList="jianCeTypeList" :taoCanShow="taoCanShow" :heTongId="form.heTongId" :itemType="itemType" :chuJuBaoGaoYaoQiu="form.chuJuBaoGaoYaoQiu" @deletClick="deletClick" @sumbitSingClick="sumbitSingClick" @getParentContent="getJianXiangData">
|
|
|
+ <lhypb-message ref="lhypbMessage" :type="lhypbIndexData" :jianCeTypeList="jianCeTypeList" :taoCanShow="taoCanShow" :heTongId="form.heTongId" :itemType="itemType" :chuJuBaoGaoYaoQiu="form.chuJuBaoGaoYaoQiu" @deletClick="deletClick" @sumbitSingClick="sumbitSingClick" @getParentContent="getJianXiangData" @refreshJianCe="refreshJianCe">
|
|
|
</lhypb-message>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
@@ -743,7 +743,9 @@
|
|
|
}
|
|
|
},
|
|
|
//根据合同id选择检测项目
|
|
|
- getJiance(id, type, weiTouId) {
|
|
|
+ //isRefresh: 是否为刷新模式(刷新时重建检测类型,并保留已勾选状态)
|
|
|
+ //callback: 数据更新完成后的回调(回传最新的检测项目与检测类型)
|
|
|
+ getJiance(id, type, weiTouId, isRefresh = false, callback) {
|
|
|
let sql =
|
|
|
`select tw.*,tb.zhe_hou_jia_ge_,tb.xiang_mu_dan_jia_ from t_htjcxmjmb tb left join t_mjjcnlfw tw on tb.jian_ce_xiang_mu_ = tw.id_ and tb.shi_fou_you_xiao_='有效' where tb.parent_id_ = '${id}' and tw.xiang_mu_bian_hao not like '%/%' order by tw.nodekey1_ asc`
|
|
|
let requestData = this.$sig(sql)
|
|
|
@@ -751,6 +753,17 @@
|
|
|
if (res.data.state == 200) {
|
|
|
let result = res.data.variables.data
|
|
|
if (result.length > 0) {
|
|
|
+ //刷新时记录已勾选的项目,刷新后保持勾选状态
|
|
|
+ let checkedIds = []
|
|
|
+ if (isRefresh) {
|
|
|
+ this.jianCeList.forEach(it => {
|
|
|
+ if (it.checked) {
|
|
|
+ checkedIds.push(it.id_)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //刷新时重建检测类型,保证能拿到最新加入的检测类型
|
|
|
+ this.jianCeTypeList = []
|
|
|
+ }
|
|
|
|
|
|
result.forEach((item, index) => {
|
|
|
|
|
|
@@ -780,15 +793,24 @@
|
|
|
})
|
|
|
result.forEach((item, index) => {
|
|
|
item.zhe_hou_jia_ge_ = (parseFloat(item.zhe_hou_jia_ge_)).toFixed(2)
|
|
|
- this.$set(item, 'checked', false)
|
|
|
+ this.$set(item, 'checked', checkedIds.indexOf(item.id_) > -1)
|
|
|
})
|
|
|
this.jianCeList = result
|
|
|
|
|
|
if (type != "") {
|
|
|
this.getYangPin(weiTouId)
|
|
|
}
|
|
|
+
|
|
|
+ if (typeof callback === 'function') {
|
|
|
+ callback(this.jianCeList, this.jianCeTypeList)
|
|
|
+ }
|
|
|
} else {
|
|
|
- meth.getPrompt('该合同没有检测项目')
|
|
|
+ if (!isRefresh) {
|
|
|
+ meth.getPrompt('该合同没有检测项目')
|
|
|
+ }
|
|
|
+ if (typeof callback === 'function') {
|
|
|
+ callback([], this.jianCeTypeList)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1441,6 +1463,36 @@
|
|
|
deletClick() {
|
|
|
this.lhypbShow = false
|
|
|
},
|
|
|
+ //样品弹窗点击检测类型选择时,重新获取最新的检测项目数据
|
|
|
+ refreshJianCe(callback) {
|
|
|
+ if (!this.form.heTongId) {
|
|
|
+ if (typeof callback === 'function') {
|
|
|
+ callback(this.jianCeList, this.jianCeTypeList)
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.getJiance(this.form.heTongId, '', '', true, (list, typeList) => {
|
|
|
+ //同步所有样品的检测项目,保留各自已勾选状态
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ this.form.lhypb.forEach(sample => {
|
|
|
+ if (!sample.jianCeList) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let oldList = sample.jianCeList
|
|
|
+ let newArr = JSON.parse(JSON.stringify(list))
|
|
|
+ newArr.forEach(it => {
|
|
|
+ let old = oldList.find(o => o.id_ == it.id_)
|
|
|
+ it.checked = old ? !!old.checked : false
|
|
|
+ })
|
|
|
+ sample.jianCeList = newArr
|
|
|
+ })
|
|
|
+ this.getTotal()
|
|
|
+ }
|
|
|
+ if (typeof callback === 'function') {
|
|
|
+ callback(list, typeList)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
//样品保存返回数据保存到样品表上,修改样品对对应的样品表
|
|
|
sumbitSingClick(item) {
|
|
|
if (this.lhypbIndexData == 'add') {
|