|
|
- <!-- 天平校验(单点) -->
- <template>
- <StepFormPackage :fieldItemLabel = "fieldItemLabel"
- ref = "stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_tpjydd'" @resetRecord = "resetRecord"
- @clickButton="onHandleClickButton"
- @beforeSaveRecord="onBeforeSaveRecord"
- @blur = "onBlur"
- :form-config="formConfig" :formData = "formData" />
- </template>
-
- <script>
- import StepFormPackage from '@/components/Template/StepFormPackage.vue';
- import stepMixins from '@/components/Template/mixins/stepMixins.js';
- import {convertMass} from "@/utils/massTool";
- export default {
- mixins: [stepMixins],
- components: {
- StepFormPackage
- },
- computed: {
- formConfig() {
- return [{
- config:{
- text1:{
- label:"校验天平编号为",
- type:"text",
- },
- ddsys:{
- type:"yq",
- fillType:"actFill",
- },
- text2:{
- label:"皮重显示值为",
- type:"text",
- },
- pz:{
- type:"inputNumber",
- fillType:"actFill",
- disabled:true,
- },
- button1:{
- type:"button",
- dataSource:"tp",//数据来源
- yqCode:"ddsys",//选择天平的字段
- fillField:"pz",//回填的字段
- buttonName:"获取值",
- },
- text3:{
- label:",标准砝码编号为",
- type:"text",
- },
- sjsr1:{
- type:"input",
- fillType:"actFill",
- },
- text4:{
- label:",标准砝码实际值为",
- type:"text",
- },
- sjsr2:{
- type:"inputNumber",
- fillType:"actFill",
- },
- sjsrdw2:{
- type:"select",
- fillType:"actFill",
- options:this.getDictOptions("business_zldw")
- },
- text5:{
- label:"标准砝码修正值为",
- type:"text",
- },
- sjsr3:{
- type:"inputNumber",
- fillType:"actFill",
- },
- sjsrdw3:{
- type:"select",
- fillType:"actFill",
- options:this.getDictOptions("business_zldw")
- },
- text6:{
- label:",标准砝码显示值为",
- type:"text",
- },
- fmz:{
- type:"inputNumber",
- fillType:"actFill",
- disabled:true,
- },
- button2:{
- type:"button",
- dataSource:"tp",//数据来源
- yqCode:"ddsys",//选择天平的字段
- fillField:"fmz",//回填的字段
- buttonName:"获取值",
- },
- text7:{
- label:"允许的偏差范围为±",
- type:"text",
- },
- sjsr4:{
- type:"inputNumber",
- fillType:"actFill",
- },
- sjsrdw4:{
- type:"select",
- fillType:"actFill",
- options:this.getDictOptions("business_zldw")
- },
- text8:{
- label:",结果判定",
- type:"text",
- },
- jgpd:{
- type:"input",
- fillType:"actFill",
- disabled:true,
- compareText:"不通过",
- },
- text9:{
- label:"。",
- type:"text",
- }
- }
- }]
- }
- },
- methods: {
- onBlur(values) {
- const {fmz,sjsr2,sjsr3,sjsrdw2,sjsrdw3,sjsr4,sjsrdw4} = values;
- if(!fmz || !sjsr2 || !sjsr3 || !sjsrdw2 || !sjsrdw3 || !sjsr4 || !sjsrdw4){
- return;
- }
- const result = fmz.match(/(\d+)([a-zA-Z]+)/);
- if(!result){
- return;
- }
- const fmzValue = Number(result[1]);
- const fmzUnit = result[2];
- const sjsr2Value = convertMass(sjsr2+sjsrdw2, fmzUnit);
- const sjsr3Value = convertMass(sjsr3+sjsrdw3, fmzUnit);
- const sjsr4Value = convertMass(sjsr4+sjsrdw4, fmzUnit);
- const deviationValue = fmzValue-(sjsr2Value + sjsr3Value );
- const des = deviationValue<=sjsr4Value?"通过":"不通过";
- this.$refs.stepFormPackageRef.updateFormData("jgpd", des);
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
-
- </style>
|