| | |
| | | <template> |
| | | <view> |
| | | <view class="inspect-value-content"> |
| | | <view class="InSpect-value-content"> |
| | | <view class="form-item"> |
| | | <view class="left">项目序号</view> |
| | | <view class="right disabled"> |
| | |
| | | <view class="form-item"> |
| | | <view class="left">检验值</view> |
| | | <view class="right disabled"> |
| | | <input type="text" v-model="checkData.HInspectVal" disabled /> |
| | | <input type="text" v-model="checkData.HInSpectVal" disabled /> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | |
| | | </view> |
| | | </view> |
| | | <view style="width: 100%;border-bottom: 1px solid #e3e3e3;"></view> |
| | | <view class="inspect-value-list"> |
| | | <view style="width: 100%;text-align: right;"> |
| | | <button type="default" size="mini" class="btn-a" @click="storeInspectValue">缓存检验值</button> |
| | | </view> |
| | | <view class="InSpect-value-list"> |
| | | <!-- <view style="width: 100%;text-align: right;"> |
| | | <button type="default" size="mini" class="btn-a" @click="storeInSpectValue">缓存检验值</button> |
| | | </view> --> |
| | | <view class="item" style="border-top: 2px solid #e3e3e3 ;"> |
| | | <view class="th1">序号</view> |
| | | <view class="th2" style="display: flex; flex-direction: row; align-items: center;"> |
| | |
| | | 检验值({{getAnalysisMethodTitle(checkData.HAnalysisMethod)}}) |
| | | </view> |
| | | </view> |
| | | <view class="item" v-for="(item, index) in inspectValues"> |
| | | <view class="item" v-for="(item, index) in InSpectValues"> |
| | | <view class="th1">{{item.HSEQ}}</view> |
| | | <view class="th2" style="display: flex; flex-direction: row; align-items: center;"> |
| | | <view style="width: 3em; "> |
| | | {{ item.HInspectResult?"合格":"不合格" }} |
| | | {{ item.HInSpectResult == 1?"合格":"不合格" }} |
| | | </view> |
| | | <view> |
| | | <switch style="width: 3em; transform:scale(0.7);" :checked="item.HInspectResult?'checked':''" |
| | | @change="HInspectResultChange(index, $event)" /> |
| | | <switch style="width: 3em; transform:scale(0.7);" |
| | | :checked="item.HInSpectResult == 1?'checked':''" |
| | | @change="HInSpectResultChange(index, $event)" /> |
| | | </view> |
| | | </view> |
| | | <view class="th3"> |
| | | <input type="number" v-model="item.HInspectValue" /> |
| | | <uni-combox v-if="checkData.HAnalysisMethod == 1" :candidates="InitInSpectValNameList" |
| | | v-model="item.HInSpectValueB_Text" |
| | | @update:modelValue="HInSpectValueBChange(index, $event)"></uni-combox> |
| | | <input v-else-if="checkData.HAnalysisMethod == 2" type="number" v-model="item.HInSpectValue" /> |
| | | <input v-else type="number" v-model="item.HInSpectValueT" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getUserInfo |
| | | } from '../../utils/auth'; |
| | | import { |
| | | CommonUtils |
| | | } from '../../utils/common'; |
| | | // 检验值模板 |
| | | export default { |
| | | name: "InspectValueTemplate", |
| | | name: "InSpectValueTemplate", |
| | | data() { |
| | | return { |
| | | checkData: { |
| | |
| | | HResult2: '', |
| | | HStatus: true, |
| | | }, |
| | | inspectValues: [] |
| | | InSpectValues: [], |
| | | InitInSpectValNameList: [], |
| | | InitInSpectValList: [], |
| | | }; |
| | | }, |
| | | props: { |
| | |
| | | }, |
| | | mounted() { |
| | | console.log('bingData: ', this.bindData); |
| | | let {data, list} = this.bindData |
| | | let { |
| | | data, |
| | | list |
| | | } = this.bindData |
| | | this.checkData = Object.assign(data, JSON.parse(JSON.stringify(this.bindData))) |
| | | // 判断是否有缓存数据或者缓存数据是否与样本数一致 |
| | | if(!list || list.length != this.checkData.HSampleQty ){ |
| | | if (!list || list.length != this.checkData.HSampleQty) { |
| | | for (let index = 0; index < this.checkData.HSampleQty; index++) { |
| | | this.inspectValues.push({ |
| | | this.InSpectValues.push({ |
| | | HSEQ: index + 1, |
| | | HInspectResult: true, |
| | | HInspectValue: 0, |
| | | HInSpectResult: 1, |
| | | HInSpectValue: 0, // 定量检测值 |
| | | HInSpectValueB: 0, // 定性检测ID |
| | | HInSpectValueB_Text: '', // 定性检测(内容) |
| | | HInSpectValueT: 0, // 其他检测值 |
| | | }) |
| | | } |
| | | }else { |
| | | this.inspectValues = list |
| | | } else { |
| | | this.InSpectValues = list |
| | | } |
| | | |
| | | this.InitInSpectVal() |
| | | // 实例挂载后,获取InterID 和 EntryID 对应的检验项目的检验值 |
| | | this.getValueList() |
| | | |
| | | this.$forceUpdate() |
| | | }, |
| | | beforeDestroy() { |
| | | // 注销前,提交数据的检验值, 并将最后一次提交的检验值同步至父模块 |
| | | this.set_SaveValue() |
| | | }, |
| | | methods: { |
| | | storeInspectValue(){ |
| | | async set_SaveValue() { |
| | | console.log("InSpect Values: ", this.InSpectValues) |
| | | try { |
| | | let res = await CommonUtils.doRequest2Sync({ |
| | | url: '/QC_FirstPieceCheckBill/set_SaveValue', |
| | | data: { |
| | | msg: `${JSON.stringify(this.InSpectValues)};${this.checkData.HInterID};${this.checkData.num}` |
| | | }, |
| | | method: "POST" |
| | | }) |
| | | |
| | | if (res) { |
| | | return |
| | | } |
| | | let { |
| | | Message, |
| | | count |
| | | } = res.data |
| | | if (count != 1) { |
| | | CommonUtils.showTips({ |
| | | title: '温馨提示', |
| | | message: `保存检验值错误: ${Message}` |
| | | }) |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: '温馨提示', |
| | | message: `保存检验值错误: ${err}` |
| | | }) |
| | | } |
| | | }, |
| | | async getValueList() { |
| | | console.log('checkData: ', this.checkData); |
| | | try { |
| | | let res = await CommonUtils.doRequest2Async({ |
| | | url: "/QC_ValueTable/getValueList", |
| | | data: { |
| | | HInterID: this.checkData.HInterID, |
| | | HEntryID: this.checkData.num, |
| | | user: getUserInfo()['Czymc'] |
| | | } |
| | | }) |
| | | |
| | | let { |
| | | data, |
| | | count |
| | | } = res.data |
| | | if (count == 1) { |
| | | // if (this.InSpectValues.length >= data.length) { |
| | | // console.log('data: ',data); |
| | | |
| | | |
| | | // console.log('this.InSpectValues: ',this.InSpectValues); |
| | | |
| | | // } else { |
| | | // this.InSpectValues = data.slice(0, this.InSpectValues.length) |
| | | // } |
| | | this.InSpectValues = data |
| | | |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | tite: '温馨提示', |
| | | message: `获取检测值错误: ${err}` |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | async InitInSpectVal() { // 初始化定性检测内容 |
| | | try { |
| | | let res = await CommonUtils.doRequest2Async({ |
| | | url: '/Gy_BadReason/Gy_InSpectValueList', |
| | | data: { |
| | | sWhere: ` and 使用组织名称 = '${uni.getStorageSync("Organization")}' and 禁用标志 = '否' and 审核人 !='' `, |
| | | user: getUserInfo()['Czymc'] |
| | | } |
| | | }) |
| | | |
| | | let { |
| | | count, |
| | | Message, |
| | | data |
| | | } = res.data |
| | | |
| | | if (count == 1) { |
| | | this.InitInSpectValNameList = Array.from(data).map(e => e["检测值名称"]) |
| | | this.InitInSpectValList = data |
| | | } else { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `检测值初始化错误: ${Message}` |
| | | }) |
| | | } |
| | | } catch (err) { |
| | | CommonUtils.showTips({ |
| | | title: "温馨提示", |
| | | message: `检测值初始化错误: ${err}` |
| | | }) |
| | | } |
| | | }, |
| | | // 检测值修改 |
| | | HInSpectValueBChange(index, e) { |
| | | let InSpectVal = this.InitInSpectValList.find(elem => elem["检测值名称"] == e) |
| | | if (!InSpectVal) { |
| | | this.InSpectValues[index].HInSpectValueB = 0 |
| | | this.InSpectValues[index].HInSpectValueB_Text = '' |
| | | return |
| | | } |
| | | this.InSpectValues[index].HInSpectValueB = InSpectVal["HItemID"] |
| | | this.InSpectValues[index].HInSpectValueB_Text = InSpectVal["检测值名称"] |
| | | }, |
| | | storeInSpectValue() { |
| | | this.$emit("update", { |
| | | data: this.checkData, |
| | | list: this.inspectValues |
| | | list: this.InSpectValues |
| | | }) |
| | | }, |
| | | getAnalysisMethodTitle(type){ |
| | | if(type == 1) { |
| | | getAnalysisMethodTitle(type) { |
| | | if (type == 1) { |
| | | return '定性分析' |
| | | }else if(type == 2){ |
| | | } else if (type == 2) { |
| | | return '定量分析' |
| | | } |
| | | return '其他分析' |
| | |
| | | HStatusChange(e) { |
| | | this.checkData.HStatus = e.detail.value |
| | | }, |
| | | HInspectResultChange(index, e) { |
| | | console.log('e: ',e.detail.value); |
| | | this.inspectValues[index].HInspectResult = e.detail.value |
| | | HInSpectResultChange(index, e) { |
| | | console.log('e: ', e.detail.value); |
| | | this.InSpectValues[index].HInSpectResult = e.detail.value?1:2 |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | | |
| | |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | .inspect-value-content { |
| | | .InSpect-value-content { |
| | | box-sizing: border-box; |
| | | padding: 20rpx 10rpx; |
| | | display: flex; |
| | |
| | | } |
| | | } |
| | | |
| | | .inspect-value-list { |
| | | .InSpect-value-list { |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | flex-direction: column; |