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.

207 lines
5.9 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
  4. width="200px" style="height: 580px;" class="customer-dialog">
  5. <el-container style="height: 105px;">
  6. <el-form :inline="true" label-position="top" label-width="80px">
  7. <!-- 材料卷号和BOM序号 -->
  8. <el-row>
  9. <el-col :span="16">
  10. <el-form-item :label="'材料卷号:'">
  11. <el-input ref="rmRollNo" @keyup.native="recordTime"
  12. @keyup.enter.native="checkRmRollNo"
  13. v-model="pageData.rmRollNo"
  14. style="width: 120px">
  15. </el-input>
  16. </el-form-item>
  17. </el-col>
  18. </el-row>
  19. <el-row>
  20. <el-col :span="16">
  21. <el-form-item :label="'BOM 序号:'">
  22. <el-select v-model="pageData.bomItemNo" :disabled="selectFlag" style="width: 120px">
  23. <el-option
  24. v-for="(item, index) in bomList"
  25. :key="index"
  26. :label="item.itemNo"
  27. :value="item.itemNo">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. </el-form>
  34. </el-container>
  35. <span slot="footer" class="dialog-footer">
  36. <el-button type="primary" @click="checkRmRollNo">确定</el-button>
  37. <el-button type="primary" @click="closeDialog">关闭</el-button>
  38. </span>
  39. </el-dialog>
  40. </div>
  41. </template>
  42. <script>
  43. import {
  44. getBomItemNosByPartNo,
  45. } from "@/api/yieldReport/com_produce_material.js";
  46. export default {
  47. data() {
  48. return {
  49. titleCon: '材料',
  50. sfdcTimeList: [],
  51. selectFlag: true,
  52. scheduleData: {
  53. site: this.$store.state.user.site,
  54. userName: this.$store.state.user.name,
  55. seqNo: '',
  56. orderNo: '',
  57. itemNo: 0,
  58. partNo: '',
  59. workCenterNo: '',
  60. workCenterDesc: '',
  61. resourceDesc: '',
  62. rollNo: '',
  63. partDesc: '',
  64. planStartTime: '',
  65. planFinishTime: '',
  66. qtyRequiredOriginal: 0,
  67. scheduledDate: '',
  68. shiftNo: '',
  69. preItemDesc: '',
  70. nextItemDesc: '',
  71. nextItemNo: 0,
  72. operatorId: '',
  73. functionName: '',
  74. currentRollFlag: false
  75. },
  76. timeArray: [],
  77. bomList: [],
  78. pageData: {
  79. site: this.$store.state.user.site,
  80. userName: this.$store.state.user.name,
  81. seqNo: '',
  82. orderNo: '',
  83. itemNo: 0,
  84. workCenterNo: '',
  85. rollNo: '',
  86. rmRollNo: '',
  87. bomItemNo: '',
  88. shiftNo: '',
  89. nextItemNo: 0,
  90. operatorId: '',
  91. closedFlag: 'N'
  92. },
  93. operatorData: {
  94. site: this.$store.state.user.site,
  95. username: this.$store.state.user.name,
  96. operatorId: '',
  97. operatorName: '',
  98. status: '',
  99. seqNo: '',
  100. showFlag: false
  101. },
  102. dataListLoading: false,
  103. }
  104. },
  105. methods: {
  106. //初始化页面的参数
  107. init(scheduleData, operatorData) {
  108. //初始化参数
  109. this.scheduleData = scheduleData;
  110. //初始化操作员对象
  111. this.operatorData = JSON.parse(JSON.stringify(operatorData));
  112. //设置页面的参数
  113. this.pageData.orderNo = scheduleData.orderNo;
  114. this.pageData.itemNo = scheduleData.itemNo;
  115. this.pageData.seqNo = scheduleData.seqNo;
  116. this.pageData.rollNo = scheduleData.rollNo;
  117. this.pageData.rmRollNo = '';
  118. this.pageData.bomItemNo = '';
  119. this.pageData.closedFlag = 'N';
  120. //自动获取焦点
  121. this.$nextTick(() => {
  122. this.$refs.rmRollNo.focus();
  123. });
  124. },
  125. /*关闭modal*/
  126. closeDialog(){
  127. this.$emit('update:visible', false);
  128. },
  129. /*记录每一次录入字符串的时间*/
  130. recordTime(){
  131. this.timeArray.push(new Date().getTime());
  132. },
  133. /*检查材料卷号的数据*/
  134. checkRmRollNo() {
  135. //首先判断时间是否超过100毫秒
  136. let len = this.timeArray.length;
  137. let timeDiff = this.timeArray[len - 1] - this.timeArray[0];
  138. //判断时间是否在范围之内
  139. /*if(timeDiff > 1000){
  140. this.$message.error('请扫码输入!');
  141. }*/
  142. //判断null和空字符串
  143. if (this.pageData.rmRollNo == null || this.pageData.rmRollNo == '') {
  144. this.$message.error('材料卷号不能为空!');
  145. return false;
  146. }else{
  147. this.pageData.rmRollNo = this.pageData.rmRollNo.trim();
  148. }
  149. //处理扫描材料卷号
  150. this.refreshSomItemNos();
  151. },
  152. /*获取BOM行号*/
  153. refreshSomItemNos(){
  154. getBomItemNosByPartNo(this.pageData).then(({data}) => {
  155. //判断是否成功
  156. if(data.code == 500){
  157. this.$message.error(data.msg);
  158. return false;
  159. }
  160. this.bomList = data.rows;
  161. //首先判断行号是否只有一行
  162. if(this.bomList.length == 1){
  163. //禁用下拉框
  164. this.selectFlag = true;
  165. //选中第一个
  166. this.pageData.bomItemNo = data.rows[0].itemNo;
  167. }else{
  168. //启用下拉框
  169. this.selectFlag = false;
  170. //this.bomList.unshift({'itemNo': '请选择'})
  171. }
  172. });
  173. },
  174. /*保存材料上机的记录*/
  175. feedingMaterialRoll(){
  176. //判断卷号是否为空
  177. if (this.pageData.rmRollNo == null || this.pageData.rmRollNo == ''){
  178. this.$message.error('请扫描材料卷号!')
  179. return false;
  180. }
  181. //判断是否选中行号
  182. if(this.pageData.bomItemNo == '请选择' || this.pageData.bomItemNo == ''){
  183. this.$message.error('请选择BOM行号!')
  184. return false;
  185. }
  186. },
  187. },
  188. created() {
  189. // this.factoryList()
  190. // this.getLanguageList()
  191. }
  192. }
  193. </script>
  194. <style scoped lang="scss">
  195. </style>