华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
5.9 KiB

  1. <!-- 天平校验(单点) -->
  2. <template>
  3. <StepFormPackage :fieldItemLabel = "fieldItemLabel"
  4. ref = "stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_tpjydd'" @resetRecord = "resetRecord"
  5. @clickButton="onHandleClickButton"
  6. @beforeSaveRecord="onBeforeSaveRecord"
  7. @blur = "onBlur"
  8. :form-config="formConfig" :formData = "formData" />
  9. </template>
  10. <script>
  11. import StepFormPackage from '@/components/Template/StepFormPackage.vue';
  12. import stepMixins from '@/components/Template/mixins/stepMixins.js';
  13. import {convertMass} from "@/utils/massTool";
  14. export default {
  15. mixins: [stepMixins],
  16. components: {
  17. StepFormPackage
  18. },
  19. computed: {
  20. formConfig() {
  21. return [{
  22. config:{
  23. text1:{
  24. label:"校验天平编号为",
  25. type:"text",
  26. },
  27. ddsys:{
  28. type:"yq",
  29. fillType:"actFill",
  30. },
  31. text2:{
  32. label:"皮重显示值为",
  33. type:"text",
  34. },
  35. pz:{
  36. type:"inputNumber",
  37. fillType:"actFill",
  38. disabled:true,
  39. },
  40. button1:{
  41. type:"button",
  42. dataSource:"tp",//数据来源
  43. yqCode:"ddsys",//选择天平的字段
  44. fillField:"pz",//回填的字段
  45. buttonName:"获取值",
  46. },
  47. text3:{
  48. label:",标准砝码编号为",
  49. type:"text",
  50. },
  51. sjsr1:{
  52. type:"input",
  53. fillType:"actFill",
  54. },
  55. text4:{
  56. label:",标准砝码实际值为",
  57. type:"text",
  58. },
  59. sjsr2:{
  60. type:"inputNumber",
  61. fillType:"actFill",
  62. },
  63. sjsrdw2:{
  64. type:"select",
  65. fillType:"actFill",
  66. options:this.getDictOptions("business_zldw")
  67. },
  68. text5:{
  69. label:"标准砝码修正值为",
  70. type:"text",
  71. },
  72. sjsr3:{
  73. type:"inputNumber",
  74. fillType:"actFill",
  75. },
  76. sjsrdw3:{
  77. type:"select",
  78. fillType:"actFill",
  79. options:this.getDictOptions("business_zldw")
  80. },
  81. text6:{
  82. label:",标准砝码显示值为",
  83. type:"text",
  84. },
  85. fmz:{
  86. type:"inputNumber",
  87. fillType:"actFill",
  88. disabled:true,
  89. },
  90. button2:{
  91. type:"button",
  92. dataSource:"tp",//数据来源
  93. yqCode:"ddsys",//选择天平的字段
  94. fillField:"fmz",//回填的字段
  95. buttonName:"获取值",
  96. },
  97. text7:{
  98. label:"允许的偏差范围为±",
  99. type:"text",
  100. },
  101. sjsr4:{
  102. type:"inputNumber",
  103. fillType:"actFill",
  104. },
  105. sjsrdw4:{
  106. type:"select",
  107. fillType:"actFill",
  108. options:this.getDictOptions("business_zldw")
  109. },
  110. text8:{
  111. label:",结果判定",
  112. type:"text",
  113. },
  114. jgpd:{
  115. type:"input",
  116. fillType:"actFill",
  117. disabled:true,
  118. compareText:"不通过",
  119. },
  120. text9:{
  121. label:"。",
  122. type:"text",
  123. }
  124. }
  125. }]
  126. }
  127. },
  128. methods: {
  129. onBlur(values) {
  130. const {fmz,sjsr2,sjsr3,sjsrdw2,sjsrdw3,sjsr4,sjsrdw4} = values;
  131. if(!fmz || !sjsr2 || !sjsr3 || !sjsrdw2 || !sjsrdw3 || !sjsr4 || !sjsrdw4){
  132. return;
  133. }
  134. const result = fmz.match(/(\d+)([a-zA-Z]+)/);
  135. if(!result){
  136. return;
  137. }
  138. const fmzValue = Number(result[1]);
  139. const fmzUnit = result[2];
  140. const sjsr2Value = convertMass(sjsr2+sjsrdw2, fmzUnit);
  141. const sjsr3Value = convertMass(sjsr3+sjsrdw3, fmzUnit);
  142. const sjsr4Value = convertMass(sjsr4+sjsrdw4, fmzUnit);
  143. const deviationValue = fmzValue-(sjsr2Value + sjsr3Value );
  144. const des = deviationValue<=sjsr4Value?"通过":"不通过";
  145. this.$refs.stepFormPackageRef.updateFormData("jgpd", des);
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. </style>