冷凝胶前端
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.

353 lines
10 KiB

  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
  4. :visible.sync="visible"
  5. width="200px" style="height: 680px;" class="customer-dialog">
  6. <el-form :inline="true" label-position="top" style="height: 100px;"
  7. label-width="80px">
  8. <!-- 半成品卷卷号 -->
  9. <el-row>
  10. <el-col :span="24" style="margin-top: -5px;">
  11. <el-form-item label="材料卷号:">
  12. <el-input ref="rmRollNo" v-model="pageData.rmRollNo" style="width: 180px;" @keyup.enter.native="checkRmRollNo" ></el-input>
  13. </el-form-item>
  14. </el-col>
  15. </el-row>
  16. <el-row>
  17. <el-col :span="24" style="margin-top: -5px;">
  18. <el-form-item :label=labels.rollQty>
  19. <el-input ref="rollQty" v-model="pageData.rollQty" style="width: 180px;" ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="24" style="margin-top: -5px;">
  25. <el-form-item :label=labels.rollNums>
  26. <el-input v-model="pageData.rollNums" style="width: 180px;" ></el-input>
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. </el-form>
  31. <span slot="footer" class="dialog-footer">
  32. <el-button type="primary" @click="createSeparateRollFun">{{ buttons.confirmButton }}</el-button>
  33. <el-button type="primary" @click="closeDialog">{{ buttons.closeButton }}</el-button>
  34. </span>
  35. </el-dialog>
  36. </div>
  37. </template>
  38. <script>
  39. import {
  40. getSeqStandardRollQty,
  41. createSeparateRoll,/*执行创建分卷的操作*/
  42. } from '@/api/scheduleReport/com_separate_roll.js';
  43. /*打印标签专用的js*/
  44. import {
  45. printDieCuttingLabel,
  46. } from "@/views/modules/label/print_die_cutting_label.js"
  47. var functionId = 'C10000003';
  48. export default {
  49. data() {
  50. return {
  51. titleCon: '创建分卷',
  52. visible: false,
  53. scheduleData: {
  54. site: this.$store.state.user.site,
  55. username: this.$store.state.user.name,
  56. seqNo: '',
  57. orderNo: '',
  58. itemNo: 0,
  59. partNo: '',
  60. workCenterNo: '',
  61. rollNo: '',
  62. functionName: '',
  63. currentRollFlag: false
  64. },
  65. pageData: {
  66. site: this.$store.state.user.site,
  67. username: this.$store.state.user.name,
  68. orderNo: '',
  69. itemNo: '',
  70. rmRollNo: '',
  71. seqNo: '',
  72. rollNo: '',
  73. reportDate: '',
  74. reportTime: '',
  75. rollQty: 0,
  76. standardRollQty: 0,
  77. rollNums: 1
  78. },
  79. buttons: {
  80. confirmButton: '确定',
  81. closeButton: '关闭',
  82. },
  83. buttonList: [
  84. {
  85. functionId: functionId,
  86. languageValue: '确定',
  87. objectId: 'confirmButton',
  88. objectType: 'button',
  89. tableId: '*'
  90. }, {
  91. functionId: functionId,
  92. languageValue: '关闭',
  93. objectId: 'closeButton',
  94. objectType: 'button',
  95. tableId: '*'
  96. },
  97. ],
  98. queryButton: {
  99. functionId: functionId,
  100. table_id: '*',
  101. languageCode: this.$i18n.locale,
  102. objectType: 'button'
  103. },
  104. labels: {
  105. titleCon: '创建分卷',
  106. rollQty: '良品数量:',
  107. rollNums: '卷数:',
  108. confirmLabel: '确认',
  109. cancelLabel: '取消',
  110. },
  111. labelsList: [
  112. {
  113. functionId: functionId,
  114. languageValue: '创建分卷',
  115. objectId: 'titleCon',
  116. objectType: 'label',
  117. tableId: '*'
  118. }, {
  119. functionId: functionId,
  120. languageValue: '当前时间:',
  121. objectId: 'currentTime',
  122. objectType: 'label',
  123. tableId: '*'
  124. }, {
  125. functionId: functionId,
  126. languageValue: '良品数量:',
  127. objectId: 'rollQty',
  128. objectType: 'label',
  129. tableId: '*'
  130. }, {
  131. functionId: functionId,
  132. languageValue: '卷数:',
  133. objectId: 'rollNums',
  134. objectType: 'label',
  135. tableId: '*'
  136. }, {
  137. functionId: functionId,
  138. languageValue: '良品数量必须是正整数!',
  139. objectId: 'approvedQtyMustBeInteger',
  140. objectType: 'label',
  141. tableId: '*'
  142. }, {
  143. functionId: functionId,
  144. languageValue: '卷数必须是正整数!',
  145. objectId: 'rollQtyMustBeInteger',
  146. objectType: 'label',
  147. tableId: '*'
  148. }, {
  149. functionId: functionId,
  150. languageValue: '良品数量必须大于零且是整数!',
  151. objectId: 'approvedQtyMustMoreTanZeroAndBeInteger',
  152. objectType: 'label',
  153. tableId: '*'
  154. }, {
  155. functionId: functionId,
  156. languageValue: '卷数必须大于零且是整数!',
  157. objectId: 'rollQtyMustMoreTanZeroAndBeInteger',
  158. objectType: 'label',
  159. tableId: '*'
  160. }, {
  161. functionId: functionId,
  162. languageValue: '请先切换人员!',
  163. objectId: 'pleaseSwitchOperator',
  164. objectType: 'label',
  165. tableId: '*'
  166. }, {
  167. functionId: functionId,
  168. languageValue: '确认',
  169. objectId: 'confirmLabel',
  170. objectType: 'label',
  171. tableId: '*'
  172. }, {
  173. functionId: functionId,
  174. languageValue: '取消',
  175. objectId: 'cancelLabel',
  176. objectType: 'label',
  177. tableId: '*'
  178. },
  179. ],
  180. queryLabel: {
  181. functionId: functionId,
  182. table_id: '*',
  183. languageCode: this.$i18n.locale,
  184. objectType: 'label'
  185. },
  186. printList: [],
  187. }
  188. },
  189. methods: {
  190. //页面初始化是的方法
  191. init(scheduleData) {
  192. //初始化参数
  193. this.scheduleData = scheduleData;
  194. //设置参数
  195. this.pageData.orderNo = scheduleData.orderNo;
  196. this.pageData.itemNo = scheduleData.itemNo;
  197. this.pageData.seqNo = scheduleData.seqNo;
  198. //调用方法 获取标准卷的数量
  199. this.getSeqStandardRollQtyFun();
  200. //清空参数
  201. this.pageData.rollNums = 1;
  202. this.pageData.rmRollNo = '';
  203. this.visible = true;
  204. //获取焦点
  205. this.$nextTick(() => {
  206. this.$refs.rmRollNo.focus();
  207. });
  208. this.titleCon = this.labels.titleCon;//重置标题
  209. },
  210. //调用方法 获取标准卷的数量
  211. getSeqStandardRollQtyFun() {
  212. // 获取标准卷的数量
  213. getSeqStandardRollQty(this.pageData).then(({data}) => {
  214. if (data.code == 200) {
  215. this.pageData.standardRollQty = data.standardRollQty;
  216. this.pageData.rollQty = data.standardRollQty;
  217. }else{
  218. this.$message.error(data.msg);
  219. }
  220. })
  221. },
  222. /*关闭modal*/
  223. closeDialog(){
  224. //刷新报工的页面
  225. this.$emit('refreshCurrentTabTable', 'sfdc_roll');
  226. //关闭当前的页面
  227. this.visible = false;
  228. },
  229. /*检查材料卷号的数据*/
  230. checkValidQty() {
  231. //获取当前是的数量
  232. let rollQty = parseFloat(this.pageData.rollQty);
  233. //判断是否可以修改
  234. if (rollQty <= 0 || !Number.isInteger(rollQty)){
  235. this.$message.error('卷数量无效!');
  236. return false;
  237. }
  238. },
  239. /*检查材料卷号的数据*/
  240. checkRollNums() {
  241. //获取当前是的数量
  242. let rollNums = parseFloat(this.pageData.rollNums);
  243. //判断是否是正整数
  244. if (rollNums <= 0 || !Number.isInteger(rollNums)){
  245. this.$message.error('卷数量无效!');
  246. return false;
  247. }
  248. },
  249. /*检查材料卷号的数据*/
  250. checkRmRollNo() {
  251. //判断null和空字符串
  252. if (this.pageData.rmRollNo == null || this.pageData.rmRollNo == '') {
  253. this.$message.error('卷号不能为空!');
  254. return false;
  255. } else {
  256. //分拆site 和 卷号
  257. let siteAndRollNo = this.pageData.rmRollNo.trim().split(',');
  258. //判断材料卷号是否合规
  259. if(siteAndRollNo.length != 2){
  260. this.$message.error('材料卷号非法!');
  261. return false;
  262. }
  263. this.pageData.rmRollNo = siteAndRollNo[1];
  264. }
  265. this.pageData.rollNo = this.pageData.rmRollNo;
  266. },
  267. //检查创建
  268. createSeparateRollFun() {
  269. let rmRollNo = this.pageData.rmRollNo;
  270. //获取当前是的数量
  271. let rollQty = parseInt(this.pageData.rollQty);
  272. //判断是否可以修改
  273. if (rollQty <= 0 || !Number.isInteger(rollQty)){
  274. this.$message.error('卷数量无效!');
  275. return false;
  276. }
  277. //判断是否是尾数卷
  278. if(rollQty < this.pageData.standardRollQty){
  279. let rollNums = parseInt(this.pageData.rollNums);
  280. if(rollNums > 1){
  281. this.$message.error('当前的工单得尾数卷只能有一卷!');
  282. return false;
  283. }
  284. }
  285. //获取当前是的数量
  286. let rollNums = parseFloat(this.pageData.rollNums);
  287. //判断是否是正整数
  288. if (rollNums <= 0 || !Number.isInteger(rollNums)){
  289. this.$message.error('当前卷数无效!');
  290. return false;
  291. }
  292. //校验是否继续
  293. createSeparateRoll(this.pageData).then(({data}) => {
  294. //判断是否成功
  295. if (data.code == 200) {
  296. this.$message.success(data.msg);
  297. //this.closeDialog();
  298. //清空卷数 重置数据量
  299. this.pageData.rollQty = this.pageData.standardRollQty;
  300. this.pageData.rollNums = 1;
  301. this.printList = data.printList;
  302. //调用打印方法 打印数
  303. printDieCuttingLabel(this.printList);
  304. //关闭当前的弹窗
  305. this.closeDialog();
  306. } else {
  307. this.$message.error(data.msg);
  308. }
  309. });
  310. },
  311. },
  312. created() {
  313. // this.factoryList()
  314. // this.getLanguageList()
  315. }
  316. }
  317. </script>
  318. <style scoped lang="scss">
  319. /*调节页面button和input的上下间距*/
  320. .customer-css .customer-button{
  321. margin-top: 25px;
  322. }
  323. /*调节fieldset下的样式*/
  324. .customer-fieldset .customer-item{
  325. margin-top: -15px;
  326. }
  327. /*fieldset下table的样式*/
  328. .customer-fieldset /deep/ .el-table__header th.is-leaf{
  329. line-height: 16px;
  330. }
  331. /deep/ .customer-tab .el-tabs__content{
  332. padding: 0px !important;
  333. }
  334. </style>