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.

334 lines
9.7 KiB

  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
  4. width="800px" style="height: 485px;" class="customer-dialog">
  5. <el-form :inline="true" label-position="top" style="height: 350px;"
  6. label-width="80px">
  7. <!-- 菜单信息 -->
  8. <el-row>
  9. <el-col :span="4" >
  10. <el-form-item :label="'物料编码:'">
  11. <el-input v-model="pageData.partNo" readonly="readonly" style="width: 120px"></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="7" >
  15. <el-form-item :label="'物料描述:'">
  16. <el-input v-model="pageData.partDesc" readonly="readonly" style="width: 180px"></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="4" >
  20. <el-form-item :label="'原物料编码:'">
  21. <el-input v-model="pageData.oriPartNo" readonly="readonly" style="width: 120px"></el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="7" >
  25. <el-form-item :label="'原物料描述:'">
  26. <el-input v-model="pageData.oriPartDesc" readonly="readonly" style="width: 180px"></el-input>
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. <el-row>
  31. <el-col :span="5" >
  32. <el-form-item :label="'扫描卷号:'">
  33. <el-input v-model="pageData.rollNo" ref="rollNo" style="width: 120px"
  34. @keyup.enter.native="scanTransformOrderRollNo"></el-input>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="8">
  38. <el-form-item class="customer-button">
  39. <el-button type="primary" @click="transformRollPartBun" style="margin-left: 10px; margin-bottom: 5px;">
  40. 转换</el-button>
  41. </el-form-item>
  42. </el-col>
  43. </el-row>
  44. <!-- 主材料 -->
  45. <el-form>
  46. <fieldset class="customer-fieldset" style="width: 775px;">
  47. <legend>扫描卷列表</legend>
  48. <el-table height="220"
  49. :data="transformPartList"
  50. border
  51. v-loading="dataListLoading"
  52. style="width: 100%; margin-top: -5px;">
  53. <el-table-column
  54. v-for="(item,index) in transformPartColumns" :key="index"
  55. :sortable="item.columnSortable"
  56. :prop="item.columnProp"
  57. :header-align="item.headerAlign"
  58. :show-overflow-tooltip="item.showOverflowTooltip"
  59. :align="item.align"
  60. :fixed="item.fixed"
  61. :width="item.columnWidth"
  62. :label="item.columnLabel">
  63. <template slot-scope="scope">
  64. <el-input type="number" class="table-input" align="right" v-if="item.columnHidden"
  65. v-model="scope.row[item.columnProp]"></el-input>
  66. <span v-else>{{scope.row[item.columnProp]}}</span>
  67. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  68. style="width: 100px; height: 80px"/></span>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </fieldset>
  73. </el-form>
  74. </el-form>
  75. </el-dialog>
  76. </div>
  77. </template>
  78. <script>
  79. import {
  80. getTransformOrderBomData,
  81. getTransformRollTable,
  82. scanTransformPartRollNo,
  83. transformRollPart,
  84. } from '@/api/yieldReport/com_transform_part.js';
  85. export default {
  86. data() {
  87. return {
  88. titleCon: '物料转换',
  89. pageData: {
  90. site: this.$store.state.user.site,
  91. username: this.$store.state.user.name,
  92. orderNo: '',
  93. itemNo: 0,
  94. rollNo: '',
  95. oriPartNo: '',
  96. oriPartDesc: '',
  97. partNo: '',
  98. partDesc: '',
  99. transType: 'sw-part',
  100. status: 'N',
  101. reportTime: '',
  102. },
  103. bomData: {},
  104. transformPartList: [],
  105. transformPartColumns: [
  106. {
  107. userId: this.$store.state.user.name,
  108. functionId: 5305,
  109. serialNumber: '5305TransRollSortNo',
  110. tableId: "5305TransRoll",
  111. tableName: "转换卷号",
  112. columnProp: "sortNo",
  113. headerAlign: "center",
  114. align: "center",
  115. columnLabel: "序号",
  116. columnWidth: 60,
  117. columnHidden: false,
  118. columnImage: false,
  119. columnSortable: false,
  120. sortLv: 0,
  121. status: true,
  122. fixed: false
  123. },
  124. {
  125. userId: this.$store.state.user.name,
  126. functionId: 5305,
  127. serialNumber: '5305TransRollRollNo',
  128. tableId: "5305TransRoll",
  129. tableName: "转换卷号",
  130. columnProp: "rollNo",
  131. headerAlign: "center",
  132. align: "center",
  133. columnLabel: "卷号",
  134. columnWidth: 120,
  135. columnHidden: false,
  136. columnImage: false,
  137. columnSortable: false,
  138. sortLv: 0,
  139. status: true,
  140. fixed: false
  141. },
  142. {
  143. userId: this.$store.state.user.name,
  144. functionId: 5305,
  145. serialNumber: '5305TransRollRollQty',
  146. tableId: "5305TransRoll",
  147. tableName: "转换卷号",
  148. columnProp: "rollQty",
  149. headerAlign: "center",
  150. align: "center",
  151. columnLabel: "数量",
  152. columnWidth: 60,
  153. columnHidden: false,
  154. columnImage: false,
  155. columnSortable: false,
  156. sortLv: 0,
  157. status: true,
  158. fixed: false
  159. },
  160. {
  161. userId: this.$store.state.user.name,
  162. functionId: 5305,
  163. serialNumber: '5305TransRollPartNo',
  164. tableId: "5305TransRoll",
  165. tableName: "转换卷号",
  166. columnProp: "partNo",
  167. headerAlign: "center",
  168. align: "center",
  169. columnLabel: "物料编码",
  170. columnWidth: 100,
  171. columnHidden: false,
  172. columnImage: false,
  173. columnSortable: false,
  174. sortLv: 0,
  175. status: true,
  176. fixed: false
  177. },
  178. {
  179. userId: this.$store.state.user.name,
  180. functionId: 5305,
  181. serialNumber: '5305TransRollPartDesc',
  182. tableId: "5305TransRoll",
  183. tableName: "转换卷号",
  184. columnProp: "partDesc",
  185. headerAlign: "center",
  186. align: "center",
  187. columnLabel: "物料描述",
  188. columnWidth: '',
  189. columnHidden: false,
  190. columnImage: false,
  191. columnSortable: false,
  192. sortLv: 0,
  193. status: true,
  194. fixed: false
  195. },
  196. ],
  197. dataListLoading: false,
  198. }
  199. },
  200. methods: {
  201. /*初始化页面参数*/
  202. init(transformOrder) {
  203. //设置参数
  204. this.pageData.orderNo = transformOrder.orderNo;
  205. this.pageData.itemNo = transformOrder.orderItemNo;
  206. this.pageData.rollNo = '';
  207. this.pageData.partNo = transformOrder.partNo;
  208. this.pageData.partDesc = transformOrder.partDescription;
  209. this.pageData.oriPartNo = '';
  210. this.pageData.oriPartDesc = '';
  211. //获取焦点
  212. this.$nextTick(() => {
  213. this.$refs.rollNo.focus();
  214. })
  215. //获取BOM的信息
  216. this.refreshTransformOrderBomData();
  217. //刷新当前派工单的信息
  218. this.refreshPageTableData();
  219. },
  220. /*关闭modal*/
  221. closeDialog(){
  222. this.$emit('update:visible', false);
  223. },
  224. /*刷新当前的页面参数*/
  225. refreshPageTableData(){
  226. //刷新材料的数据
  227. this.refreshTransformRollTable();
  228. },
  229. //刷新当前卷的时间数据
  230. refreshTransformRollTable(){
  231. //清空卷号
  232. this.pageData.rollNo = '';
  233. getTransformRollTable(this.pageData).then(({data}) => {
  234. this.transformPartList = data.rows;
  235. });
  236. },
  237. //刷新当前卷的时间数据
  238. refreshTransformOrderBomData(){
  239. //查询当前的页面表格
  240. getTransformOrderBomData(this.pageData).then(({data}) => {
  241. this.bomData = data.row;
  242. //参数赋值
  243. this.pageData.oriPartNo = data.row.partNo;
  244. this.pageData.oriPartDesc = data.row.partDesc;
  245. });
  246. },
  247. //扫描卷号
  248. scanTransformOrderRollNo(){
  249. scanTransformPartRollNo(this.pageData).then(({data}) => {
  250. //判断操作是否成功
  251. if(data.code == 500){
  252. this.$message.error(data.msg);
  253. }else{
  254. //二次扫描使用
  255. this.pageData.rollNo = '';
  256. //刷新页面的数据
  257. this.refreshTransformRollTable();
  258. }
  259. });
  260. },
  261. /*执行转换卷操作*/
  262. transformRollPartBun(){
  263. //判断是否存在卷
  264. if(this.transformPartList.length == 0){
  265. this.$message.error('请先扫描卷后再试!');
  266. return false;
  267. }
  268. //验证通过执行转换卷
  269. transformRollPart(this.pageData).then(({data}) => {
  270. //判断操作是否成功
  271. if(data.code == 500){
  272. this.$message.error(data.msg);
  273. }else{
  274. //二次扫描使用
  275. this.pageData.rollNo = '';
  276. //刷新页面的数据
  277. this.refreshTransformRollTable();
  278. }
  279. });
  280. },
  281. },
  282. created() {
  283. //
  284. }
  285. }
  286. </script>
  287. <style scoped lang="scss">
  288. /*调节页面button和input的上下间距*/
  289. .customer-css .customer-button{
  290. margin-top: 25px;
  291. }
  292. /*调节样式*/
  293. .customer-item{
  294. margin-top: -10px;
  295. }
  296. /*fieldset下table的样式*/
  297. .customer-fieldset /deep/ .el-table__header th.is-leaf{
  298. line-height: 16px;
  299. }
  300. /deep/ .customer-tab .el-tabs__content{
  301. padding: 0px !important;
  302. }
  303. /*table中input 修改样式*/
  304. /deep/ div.table-input {
  305. padding: 0px 0px;
  306. height: 25px !important;
  307. }
  308. /*table中input*/
  309. div.table-input /deep/ input.el-input__inner{
  310. padding: 0px 0px;
  311. height: 23px !important;
  312. text-align: right;
  313. }
  314. </style>