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.

1769 lines
59 KiB

2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
  1. <script>
  2. import {
  3. downLoadObjectFile, getProvisionalDataList, provisionalDataAlterHandle,
  4. queryFileId,
  5. removeExternalPart,
  6. saveExternalPart, savePartInfoByExcel,
  7. selectExternalPartList, selectExternalPartPage,
  8. selectUnitList,
  9. updateExternalPart
  10. } from '../../../api/part/external'
  11. import Chooselist from '@/views/modules/common/Chooselist_eam'
  12. import dayjs from 'dayjs'
  13. import PictureModule from './picture/picture.vue'
  14. import LinkedCustomer from './customer/linkedCustomer.vue'
  15. import {getExternalPartCustomerList} from '../../../api/part/externalPartCustomer'
  16. import {getExternalPartPictureList} from '../../../api/part/externalPartPicture'
  17. import LinkedManufacturer from './manufacturer/linkedManufacturer.vue'
  18. import {getExternalPartManufacturerList} from '../../../api/part/externalPartManufacturer'
  19. import {getTableDefaultListLanguage, getTableUserListLanguage} from '../../../api/table'
  20. import {Decimal} from 'decimal.js'
  21. import {getCategoryList} from '../../../api/category/category'
  22. import {countryList} from '../../../api/dict/country'
  23. import {getSiteDetail} from '../../../api/factory/site'
  24. import LabelTemplate from './template/labelTemplate.vue'
  25. let part = {
  26. site: '',
  27. partNo: '',
  28. partDesc: '',
  29. umId: '',
  30. freeInfo: '',
  31. freeInfo2: '',
  32. rev: '',
  33. active: '',
  34. tradingMark: 'N',
  35. packingWeight: undefined,
  36. weightUmId: undefined,
  37. moldCode: '',
  38. category: '',
  39. qtyPerCarton: 0,
  40. qtyPerRoll: 0,
  41. rollsPerCarton: 0,
  42. printStr1: '',
  43. printStr2: '',
  44. printStr3: '',
  45. rollLabelFlag: 'Y',
  46. }
  47. export default {
  48. name: 'ExternalPart',
  49. components: {LabelTemplate, LinkedManufacturer, LinkedCustomer, PictureModule,Chooselist},
  50. props: {
  51. height: {
  52. type: Number,
  53. default: 310
  54. },
  55. ofComponents: {
  56. type: Boolean,
  57. default: false
  58. }
  59. },
  60. data(){
  61. return{
  62. // 导出
  63. exportData: [],
  64. exportName: 'Part Info' + this.dayjs().format('YYYYMMDDHHmmss'),
  65. exportHeader: [],
  66. exportFooter: [],
  67. resultList: [],
  68. // 导入
  69. visible: false,
  70. fileList: [],
  71. provisionalDataVisible: false,
  72. provisionalDataList: [],
  73. isLoading: false,
  74. isLoading2: false,
  75. isLoading3: false,
  76. no: 1,
  77. size: 50,
  78. total: 0,
  79. part: {
  80. ...part
  81. },
  82. savePart: {
  83. ...part,
  84. active: 'Y',
  85. },
  86. tempData:{
  87. orderRef1: 'partInfo',
  88. orderRef2: 'partInfoFormat',
  89. site: this.$store.state.user.site,
  90. },
  91. partCategoryList: [],
  92. category: {},
  93. partRules: {
  94. partNo: [{required: true, message: 'Please input Part No', trigger: ['blur', 'change']}],
  95. partDesc: [{required: true, message: 'Please input Part Description', trigger: ['blur', 'change']}],
  96. umId: [{required: true, message: 'Please select UM', trigger: ['blur', 'change']}],
  97. rev: [{required: true, message: 'Please select Rev No', trigger: ['blur', 'change']}],
  98. moldCode: [{required: true, message: 'Please select Mold Code', trigger: ['blur', 'change']}],
  99. qtyPerCarton: [{required: true, message: 'Please input Qty Per Carton', trigger: ['blur', 'change']}],
  100. qtyPerRoll: [{required: true, message: 'Please input Qty Per Roll', trigger: ['blur', 'change']}],
  101. rollsPerCarton: [{required: true, message: 'Please input Rolls Per Carton', trigger: ['blur', 'change']}],
  102. freeInfo2: [{required: true, message: 'Please select OOC', trigger: ['blur', 'change']}],
  103. },
  104. savePartVisible: false,
  105. partTableLoading: false,
  106. partList: [],
  107. unitList: [],
  108. columnList: [
  109. {
  110. userId: this.$store.state.user.name,
  111. functionId: 10002,
  112. serialNumber: '10002TablePartNo',
  113. tableId: '10002Table',
  114. tableName: 'Part Table',
  115. columnProp: 'partNo',
  116. headerAlign: 'center',
  117. align: 'left',
  118. columnLabel: 'Part No',
  119. columnHidden: false,
  120. columnImage: false,
  121. columnSortable: false,
  122. sortLv: 10,
  123. status: true,
  124. fixed: '',
  125. columnWidth: 80
  126. }, {
  127. userId: this.$store.state.user.name,
  128. functionId: 10002,
  129. serialNumber: '10002TablePartDesc',
  130. tableId: '10002Table',
  131. tableName: 'Part Table',
  132. columnProp: 'partDesc',
  133. headerAlign: 'center',
  134. align: 'left',
  135. columnLabel: 'Part Description',
  136. columnHidden: false,
  137. columnImage: false,
  138. columnSortable: false,
  139. sortLv: 10,
  140. status: true,
  141. fixed: '',
  142. columnWidth: 140
  143. }, {
  144. userId: this.$store.state.user.name,
  145. functionId: 10002,
  146. serialNumber: '10002TableRev',
  147. tableId: '10002Table',
  148. tableName: 'Part Table',
  149. columnProp: 'rev',
  150. headerAlign: 'center',
  151. align: 'left',
  152. columnLabel: 'REV No',
  153. columnHidden: false,
  154. columnImage: false,
  155. columnSortable: false,
  156. sortLv: 10,
  157. status: true,
  158. fixed: '',
  159. columnWidth: 80
  160. }, {
  161. userId: this.$store.state.user.name,
  162. functionId: 10002,
  163. serialNumber: '10002TableCategory',
  164. tableId: '10002Table',
  165. tableName: 'Part Table',
  166. columnProp: 'category',
  167. headerAlign: 'center',
  168. align: 'left',
  169. columnLabel: 'Part Category',
  170. columnHidden: false,
  171. columnImage: false,
  172. columnSortable: false,
  173. sortLv: 10,
  174. status: true,
  175. fixed: '',
  176. columnWidth: 140
  177. },
  178. {
  179. userId: this.$store.state.user.name,
  180. functionId: 10002,
  181. serialNumber: '10002TableUmName',
  182. tableId: '10002Table',
  183. tableName: 'Part Table',
  184. columnProp: 'moldCode',
  185. headerAlign: 'center',
  186. align: 'left',
  187. columnLabel: 'Mold Code',
  188. columnHidden: false,
  189. columnImage: false,
  190. columnSortable: false,
  191. sortLv: 10,
  192. status: true,
  193. fixed: '',
  194. columnWidth: 80
  195. }, {
  196. userId: this.$store.state.user.name,
  197. functionId: 10002,
  198. serialNumber: '10002TableUmName',
  199. tableId: '10002Table',
  200. tableName: 'Part Table',
  201. columnProp: 'manufacturer',
  202. headerAlign: 'center',
  203. align: 'left',
  204. columnLabel: 'Manufacturer',
  205. columnHidden: false,
  206. columnImage: false,
  207. columnSortable: false,
  208. sortLv: 10,
  209. status: true,
  210. fixed: '',
  211. columnWidth: 120
  212. }, {
  213. userId: this.$store.state.user.name,
  214. functionId: 10002,
  215. serialNumber: '10002TableUmName',
  216. tableId: '10002Table',
  217. tableName: 'Part Table',
  218. columnProp: 'umName',
  219. headerAlign: 'center',
  220. align: 'left',
  221. columnLabel: 'UM',
  222. columnHidden: false,
  223. columnImage: false,
  224. columnSortable: false,
  225. sortLv: 10,
  226. status: true,
  227. fixed: '',
  228. columnWidth: 60
  229. },
  230. {
  231. userId: this.$store.state.user.name,
  232. functionId: 10002,
  233. serialNumber: '10002TableQtyPerRoll',
  234. tableId: '10002Table',
  235. tableName: 'Part Table',
  236. columnProp: 'qtyPerRoll',
  237. headerAlign: 'center',
  238. align: 'left',
  239. columnLabel: 'Qty Per Roll',
  240. columnHidden: false,
  241. columnImage: false,
  242. columnSortable: false,
  243. sortLv: 10,
  244. status: true,
  245. fixed: '',
  246. columnWidth: 120
  247. }, {
  248. userId: this.$store.state.user.name,
  249. functionId: 10002,
  250. serialNumber: '10002TableRollsPerCarton',
  251. tableId: '10002Table',
  252. tableName: 'Part Table',
  253. columnProp: 'rollsPerCarton',
  254. headerAlign: 'center',
  255. align: 'left',
  256. columnLabel: 'Rolls Per Carton',
  257. columnHidden: false,
  258. columnImage: false,
  259. columnSortable: false,
  260. sortLv: 10,
  261. status: true,
  262. fixed: '',
  263. columnWidth: 120
  264. }, {
  265. userId: this.$store.state.user.name,
  266. functionId: 10002,
  267. serialNumber: '10002TableQtyPerCarton',
  268. tableId: '10002Table',
  269. tableName: 'Part Table',
  270. columnProp: 'qtyPerCarton',
  271. headerAlign: 'center',
  272. align: 'left',
  273. columnLabel: 'Qty Per Carton',
  274. columnHidden: false,
  275. columnImage: false,
  276. columnSortable: false,
  277. sortLv: 10,
  278. status: true,
  279. fixed: '',
  280. columnWidth: 120
  281. },
  282. {
  283. userId: this.$store.state.user.name,
  284. functionId: 10002,
  285. serialNumber: '10002TableFreeInfo',
  286. tableId: '10002Table',
  287. tableName: 'Part Table',
  288. columnProp: 'freeInfo',
  289. headerAlign: 'center',
  290. align: 'left',
  291. columnLabel: 'Free Info',
  292. columnHidden: false,
  293. columnImage: false,
  294. columnSortable: false,
  295. sortLv: 10,
  296. status: true,
  297. fixed: '',
  298. columnWidth: 120
  299. }, {
  300. userId: this.$store.state.user.name,
  301. functionId: 10002,
  302. serialNumber: '10002TableFreeInfo2',
  303. tableId: '10002Table',
  304. tableName: 'Part Table',
  305. columnProp: 'freeInfo2',
  306. headerAlign: 'center',
  307. align: 'left',
  308. columnLabel: 'Free Info2',
  309. columnHidden: false,
  310. columnImage: false,
  311. columnSortable: false,
  312. sortLv: 10,
  313. status: true,
  314. fixed: '',
  315. columnWidth: 120
  316. }, {
  317. userId: this.$store.state.user.name,
  318. functionId: 10002,
  319. serialNumber: '10002TableTradingMark',
  320. tableId: '10002Table',
  321. tableName: 'Part Table',
  322. columnProp: 'tradingMark',
  323. headerAlign: 'center',
  324. align: 'left',
  325. columnLabel: 'Trading Mark',
  326. columnHidden: false,
  327. columnImage: false,
  328. columnSortable: false,
  329. sortLv: 10,
  330. status: true,
  331. fixed: '',
  332. columnWidth: 120
  333. }, {
  334. userId: this.$store.state.user.name,
  335. functionId: 10002,
  336. serialNumber: '10002TablePackingWeight',
  337. tableId: '10002Table',
  338. tableName: 'Part Table',
  339. columnProp: 'packingWeight',
  340. headerAlign: 'center',
  341. align: 'left',
  342. columnLabel: 'Packing Weight',
  343. columnHidden: false,
  344. columnImage: false,
  345. columnSortable: false,
  346. sortLv: 10,
  347. status: true,
  348. fixed: '',
  349. columnWidth: 120
  350. }, {
  351. userId: this.$store.state.user.name,
  352. functionId: 10002,
  353. serialNumber: '10002TableWeightUM',
  354. tableId: '10002Table',
  355. tableName: 'Part Table',
  356. columnProp: 'weightUmName',
  357. headerAlign: 'center',
  358. align: 'left',
  359. columnLabel: 'Weight UM',
  360. columnHidden: false,
  361. columnImage: false,
  362. columnSortable: false,
  363. sortLv: 10,
  364. status: true,
  365. fixed: '',
  366. columnWidth: 120
  367. },
  368. {
  369. userId: this.$store.state.user.name,
  370. functionId: 10002,
  371. serialNumber: '10002TableActive',
  372. tableId: '10002Table',
  373. tableName: 'Part Table',
  374. columnProp: 'active',
  375. headerAlign: 'center',
  376. align: 'left',
  377. columnLabel: 'Active',
  378. columnHidden: false,
  379. columnImage: false,
  380. columnSortable: false,
  381. sortLv: 10,
  382. status: true,
  383. fixed: '',
  384. columnWidth: 80
  385. }, {
  386. userId: this.$store.state.user.name,
  387. functionId: 10002,
  388. serialNumber: '10002TableCreateBy',
  389. tableId: '10002Table',
  390. tableName: 'Part Table',
  391. columnProp: 'createBy',
  392. headerAlign: 'center',
  393. align: 'left',
  394. columnLabel: 'Created By',
  395. columnHidden: false,
  396. columnImage: false,
  397. columnSortable: false,
  398. sortLv: 10,
  399. status: true,
  400. fixed: '',
  401. columnWidth: 80
  402. }, {
  403. userId: this.$store.state.user.name,
  404. functionId: 10002,
  405. serialNumber: '10002TableCreateTime',
  406. tableId: '10002Table',
  407. tableName: 'Part Table',
  408. columnProp: 'createTime',
  409. headerAlign: 'center',
  410. align: 'left',
  411. columnLabel: 'Created Time',
  412. columnHidden: false,
  413. columnImage: false,
  414. columnSortable: false,
  415. sortLv: 10,
  416. status: true,
  417. fixed: '',
  418. columnWidth: 140
  419. }, {
  420. userId: this.$store.state.user.name,
  421. functionId: 10002,
  422. serialNumber: '10002TableUpdateBy',
  423. tableId: '10002Table',
  424. tableName: 'Part Table',
  425. columnProp: 'updateBy',
  426. headerAlign: 'center',
  427. align: 'left',
  428. columnLabel: 'Updated By',
  429. columnHidden: false,
  430. columnImage: false,
  431. columnSortable: false,
  432. sortLv: 10,
  433. status: true,
  434. fixed: '',
  435. columnWidth: 80
  436. }, {
  437. userId: this.$store.state.user.name,
  438. functionId: 10002,
  439. serialNumber: '10002TableUpdateTime',
  440. tableId: '10002Table',
  441. tableName: 'Part Table',
  442. columnProp: 'updateTime',
  443. headerAlign: 'center',
  444. align: 'left',
  445. columnLabel: 'Updated Time',
  446. columnHidden: false,
  447. columnImage: false,
  448. columnSortable: false,
  449. sortLv: 10,
  450. status: true,
  451. fixed: '',
  452. columnWidth: 140
  453. },
  454. ],
  455. pictureColumnList: [
  456. {
  457. userId: this.$store.state.user.name,
  458. functionId: 10002,
  459. serialNumber: '10002Table22PictureNo',
  460. tableId: '10002Table2',
  461. tableName: '外部料号图片信息表',
  462. columnProp: 'certificationNo',
  463. headerAlign: 'center',
  464. align: 'left',
  465. columnLabel: 'Certification Code',
  466. columnHidden: false,
  467. columnImage: false,
  468. columnSortable: false,
  469. sortLv: 10,
  470. status: true,
  471. fixed: '',
  472. columnWidth: 80
  473. }, {
  474. userId: this.$store.state.user.name,
  475. functionId: 10002,
  476. serialNumber: '10002Table22PictureDesc',
  477. tableId: '10002Table2',
  478. tableName: '外部料号图片信息表',
  479. columnProp: 'pictureDesc',
  480. headerAlign: 'center',
  481. align: 'left',
  482. columnLabel: 'Certification Desc',
  483. columnHidden: false,
  484. columnImage: false,
  485. columnSortable: false,
  486. sortLv: 10,
  487. status: true,
  488. fixed: '',
  489. columnWidth: 180
  490. }, {
  491. userId: this.$store.state.user.name,
  492. functionId: 10002,
  493. serialNumber: '10002Table22CreateBy',
  494. tableId: '10002Table2',
  495. tableName: '外部料号图片信息表',
  496. columnProp: 'createBy',
  497. headerAlign: 'center',
  498. align: 'left',
  499. columnLabel: 'Created By',
  500. columnHidden: false,
  501. columnImage: false,
  502. columnSortable: false,
  503. sortLv: 10,
  504. status: true,
  505. fixed: '',
  506. columnWidth: 80
  507. }, {
  508. userId: this.$store.state.user.name,
  509. functionId: 10002,
  510. serialNumber: '10002Table22CreateTime',
  511. tableId: '10002Table2',
  512. tableName: '外部料号图片信息表',
  513. columnProp: 'createTime',
  514. headerAlign: 'center',
  515. align: 'center',
  516. columnLabel: 'Created Time',
  517. columnHidden: false,
  518. columnImage: false,
  519. columnSortable: false,
  520. sortLv: 10,
  521. status: true,
  522. fixed: '',
  523. columnWidth: 180
  524. }, {
  525. userId: this.$store.state.user.name,
  526. functionId: 10002,
  527. serialNumber: '10002Table22UpdateBy',
  528. tableId: '10002Table2',
  529. tableName: '外部料号图片信息表',
  530. columnProp: 'updateBy',
  531. headerAlign: 'center',
  532. align: 'left',
  533. columnLabel: 'Updated By',
  534. columnHidden: false,
  535. columnImage: false,
  536. columnSortable: false,
  537. sortLv: 10,
  538. status: true,
  539. fixed: '',
  540. columnWidth: 80
  541. }, {
  542. userId: this.$store.state.user.name,
  543. functionId: 10002,
  544. serialNumber: '10002Table22UpdateTime',
  545. tableId: '10002Table2',
  546. tableName: '外部料号图片信息表',
  547. columnProp: 'updateTime',
  548. headerAlign: 'center',
  549. align: 'center',
  550. columnLabel: 'Updated Time',
  551. columnHidden: false,
  552. columnImage: false,
  553. columnSortable: false,
  554. sortLv: 10,
  555. status: true,
  556. fixed: '',
  557. columnWidth: 180
  558. },
  559. ],
  560. customerColumnList: [
  561. {
  562. userId: this.$store.state.user.name,
  563. functionId: 10002,
  564. serialNumber: '10002Table3CustomerNo',
  565. tableId: '10002Table3',
  566. tableName: '外部料号客户信息表',
  567. columnProp: 'customerNo',
  568. headerAlign: 'center',
  569. align: 'left',
  570. columnLabel: 'Customer No',
  571. columnHidden: false,
  572. columnImage: false,
  573. columnSortable: false,
  574. sortLv: 10,
  575. status: true,
  576. fixed: '',
  577. columnWidth: 80
  578. }, {
  579. userId: this.$store.state.user.name,
  580. functionId: 10002,
  581. serialNumber: '10002Table3CustomerName',
  582. tableId: '10002Table3',
  583. tableName: '外部料号客户信息表',
  584. columnProp: 'customerName',
  585. headerAlign: 'center',
  586. align: 'left',
  587. columnLabel: 'Customer Name',
  588. columnHidden: false,
  589. columnImage: false,
  590. columnSortable: false,
  591. sortLv: 10,
  592. status: true,
  593. fixed: '',
  594. columnWidth: 120
  595. }, {
  596. userId: this.$store.state.user.name,
  597. functionId: 10002,
  598. serialNumber: '10002Table3CreateTime',
  599. tableId: '10002Table3',
  600. tableName: '外部料号客户信息表',
  601. columnProp: 'createTime',
  602. headerAlign: 'center',
  603. align: 'center',
  604. columnLabel: 'Created Time',
  605. columnHidden: false,
  606. columnImage: false,
  607. columnSortable: false,
  608. sortLv: 10,
  609. status: true,
  610. fixed: '',
  611. columnWidth: 140
  612. }, {
  613. userId: this.$store.state.user.name,
  614. functionId: 10002,
  615. serialNumber: '10002Table3CreateBy',
  616. tableId: '10002Table3',
  617. tableName: '外部料号客户信息表',
  618. columnProp: 'createBy',
  619. headerAlign: 'center',
  620. align: 'left',
  621. columnLabel: 'Created By',
  622. columnHidden: false,
  623. columnImage: false,
  624. columnSortable: false,
  625. sortLv: 10,
  626. status: true,
  627. fixed: '',
  628. columnWidth: 80
  629. }, {
  630. userId: this.$store.state.user.name,
  631. functionId: 10002,
  632. serialNumber: '10002Table3UpdateTime',
  633. tableId: '10002Table3',
  634. tableName: '外部料号客户信息表',
  635. columnProp: 'updateTime',
  636. headerAlign: 'center',
  637. align: 'center',
  638. columnLabel: 'Updated Time',
  639. columnHidden: false,
  640. columnImage: false,
  641. columnSortable: false,
  642. sortLv: 10,
  643. status: true,
  644. fixed: '',
  645. columnWidth: 140
  646. }, {
  647. userId: this.$store.state.user.name,
  648. functionId: 10002,
  649. serialNumber: '10002Table3UpdateBy',
  650. tableId: '10002Table3',
  651. tableName: '外部料号客户信息表',
  652. columnProp: 'updateBy',
  653. headerAlign: 'center',
  654. align: 'left',
  655. columnLabel: 'Updated By',
  656. columnHidden: false,
  657. columnImage: false,
  658. columnSortable: false,
  659. sortLv: 10,
  660. status: true,
  661. fixed: '',
  662. columnWidth: 80
  663. },
  664. ],
  665. manufacturerColumnList: [
  666. {
  667. userId: this.$store.state.user.name,
  668. functionId: 10002,
  669. serialNumber: '10002Table4ManufacturerNo',
  670. tableId: '10002Table4',
  671. tableName: '外部料号供应商信息表',
  672. columnProp: 'manufacturerNo',
  673. headerAlign: 'center',
  674. align: 'left',
  675. columnLabel: 'Manufacturer No',
  676. columnHidden: false,
  677. columnImage: false,
  678. columnSortable: false,
  679. sortLv: 10,
  680. status: true,
  681. fixed: '',
  682. columnWidth: 80
  683. }, {
  684. userId: this.$store.state.user.name,
  685. functionId: 10002,
  686. serialNumber: '10002Table4ManufacturerName',
  687. tableId: '10002Table4',
  688. tableName: '外部料号供应商信息表',
  689. columnProp: 'manufacturerName',
  690. headerAlign: 'center',
  691. align: 'left',
  692. columnLabel: 'Manufacturer Name',
  693. columnHidden: false,
  694. columnImage: false,
  695. columnSortable: false,
  696. sortLv: 10,
  697. status: true,
  698. fixed: '',
  699. columnWidth: 120
  700. }, {
  701. userId: this.$store.state.user.name,
  702. functionId: 10002,
  703. serialNumber: '10002Table4CreateTime',
  704. tableId: '10002Table4',
  705. tableName: '外部料号供应商信息表',
  706. columnProp: 'createTime',
  707. headerAlign: 'center',
  708. align: 'center',
  709. columnLabel: 'Created Time',
  710. columnHidden: false,
  711. columnImage: false,
  712. columnSortable: false,
  713. sortLv: 10,
  714. status: true,
  715. fixed: '',
  716. columnWidth: 140
  717. }, {
  718. userId: this.$store.state.user.name,
  719. functionId: 10002,
  720. serialNumber: '10002Table4CreateBy',
  721. tableId: '10002Table4',
  722. tableName: '外部料号供应商信息表',
  723. columnProp: 'createBy',
  724. headerAlign: 'center',
  725. align: 'left',
  726. columnLabel: 'Created By',
  727. columnHidden: false,
  728. columnImage: false,
  729. columnSortable: false,
  730. sortLv: 10,
  731. status: true,
  732. fixed: '',
  733. columnWidth: 80
  734. }, {
  735. userId: this.$store.state.user.name,
  736. functionId: 10002,
  737. serialNumber: '10002Table4UpdateTime',
  738. tableId: '10002Table4',
  739. tableName: '外部料号供应商信息表',
  740. columnProp: 'updateTime',
  741. headerAlign: 'center',
  742. align: 'center',
  743. columnLabel: 'Updated Time',
  744. columnHidden: false,
  745. columnImage: false,
  746. columnSortable: false,
  747. sortLv: 10,
  748. status: true,
  749. fixed: '',
  750. columnWidth: 140
  751. }, {
  752. userId: this.$store.state.user.name,
  753. functionId: 10002,
  754. serialNumber: '10002Table4UpdateBy',
  755. tableId: '10002Table4',
  756. tableName: '外部料号供应商信息表',
  757. columnProp: 'updateBy',
  758. headerAlign: 'center',
  759. align: 'left',
  760. columnLabel: 'Updated By',
  761. columnHidden: false,
  762. columnImage: false,
  763. columnSortable: false,
  764. sortLv: 10,
  765. status: true,
  766. fixed: '',
  767. columnWidth: 80
  768. },
  769. ],
  770. rules: {
  771. site: [
  772. {
  773. required: true,
  774. message: ' ',
  775. trigger: ['blur', 'change']
  776. }
  777. ],
  778. },
  779. activeName: 'partPicture',
  780. currentPart: {},
  781. externalPartCustomerList: [],
  782. pictureList: [],
  783. externalPartManufacturerList: [],
  784. base64List: [],
  785. countryList: [],
  786. }
  787. },
  788. watch: {
  789. currentPart (newVal, oldVal) {
  790. if (!this.ofComponents) {
  791. // 调用 子组件信息查询
  792. this.getExternalPartCustomerList()
  793. this.getExternalPartPictureList()
  794. this.getExternalPartManufacturerList()
  795. }
  796. },
  797. 'savePart.partNo' (newVal, oldVal) {
  798. this.savePart.partNo = newVal.toUpperCase()
  799. },
  800. 'savePart.category' (newVal, oldVal) {
  801. const category = this.partCategoryList.find((item) => item.categoryValue === newVal)
  802. if (category) {
  803. // this.savePart.manufacturerRequired = category.manufacturerRequired;
  804. // this.savePart.moldCodeRequired = category.moldCodeRequired;
  805. // this.savePart.serialNumberRequired = category.serialNumberRequired;
  806. // this.savePart.rollLabelRequired = category.rollLabelRequired;
  807. // if (this.savePart.serialNumberRequired === 'Y'){
  808. // this.savePart.qtyPerRoll = 1;
  809. // this.savePart.rollsPerCarton = 1;
  810. // }
  811. // if (category.showCartonQtyPerRoll === 'N'){
  812. // this.savePart.qtyPerRoll = 1;
  813. // }
  814. // if (category.showCartonRollsPerCarton === 'N'){
  815. // this.savePart.rollsPerCarton = 1;
  816. // }
  817. // this.partRules.rollsPerCarton[0].message = `Please input ${category.qtyPerRollPart}`
  818. // this.savePart.qtyPerCarton = this.qtyPerCarton();
  819. this.category = JSON.parse(JSON.stringify(category))
  820. }
  821. },
  822. 'part.partNo' (newVal, oldVal) {
  823. this.part.partNo = newVal.toUpperCase()
  824. },
  825. 'savePart.qtyPerRoll' (newVal, oldVal) {
  826. this.savePart.qtyPerCarton = this.qtyPerCarton()
  827. },
  828. 'savePart.rollsPerCarton' (newVal, oldVal) {
  829. this.savePart.qtyPerCarton = this.qtyPerCarton()
  830. },
  831. },
  832. methods: {
  833. // 获取基础数据列表S
  834. getBaseList (val,type) {
  835. this.tagNo = val
  836. this.$nextTick(() => {
  837. let strVal = ''
  838. let conSql = ''
  839. if (val === 93 ) {
  840. strVal = this.tempData.site ? this.tempData.site : ''
  841. }
  842. this.$refs.baseList.init(val, strVal,conSql)
  843. })
  844. },
  845. /* 列表方法的回调 */
  846. getBaseData (val) {
  847. if (this.tagNo === 93) {
  848. this.tempData.site = val.SiteID
  849. }
  850. },
  851. getExternalPartPictureList (val) {
  852. let params = {
  853. partNo: this.currentPart.partNo,
  854. site: this.currentPart.site,
  855. pictureClassify: 'BoxPicture',
  856. }
  857. getExternalPartPictureList(params).then(({data}) => {
  858. if (data && data.code === 0) {
  859. this.pictureList = data.rows
  860. if (val === true) {
  861. this.$nextTick(() => {
  862. this.$refs.picture.handleBasePictureList()
  863. })
  864. }
  865. } else {
  866. this.$message.warning(data.msg)
  867. }
  868. }).catch((error) => {
  869. this.$message.error(error)
  870. })
  871. },
  872. rowPartStyle ({row}) {
  873. if (row.partNo === this.currentPart.partNo) {
  874. return {
  875. background: 'rgb(232,246,246)',
  876. }
  877. }
  878. },
  879. selectUnitList () {
  880. selectUnitList().then(({data}) => {
  881. if (data && data.code === 0) {
  882. this.unitList = data.rows
  883. if (this.unitList.length > 0) {
  884. this.savePart.umId = this.unitList[0].umId
  885. }
  886. } else {
  887. this.$message.warning(data.msg)
  888. }
  889. }).catch((error) => {
  890. this.$message.error(error)
  891. })
  892. },
  893. selectExternalPartList () {
  894. let params = {
  895. ...this.part,
  896. site: this.$store.state.user.site,
  897. provisionalData: 'N',
  898. }
  899. selectExternalPartList(params).then(({data}) => {
  900. if (data && data.code === 0) {
  901. this.partList = data.rows
  902. if (this.partList.length > 0 && !this.ofComponents) {
  903. this.currentPart = {...this.partList[0]}
  904. }
  905. } else {
  906. this.$message.warning(data.msg)
  907. }
  908. }).catch((error) => {
  909. this.$message.error(error)
  910. })
  911. },
  912. handleSave () {
  913. if (this.savePartVisible) {
  914. if ((this.savePart.packingWeight || this.savePart.packingWeight == 0) && !this.savePart.weightUmId) {
  915. this.$message.warning('Please select Weight UM')
  916. return
  917. }
  918. this.$refs.savePartForm.validate((valid, obj) => {
  919. if (valid) {
  920. if (this.savePart.qtyPerCarton === 0) {
  921. this.$message.warning('Qty Per Carton can not be 0')
  922. return
  923. }
  924. let params = {
  925. ...this.savePart,
  926. site: this.$store.state.user.site,
  927. createBy: this.$store.state.user.name,
  928. createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
  929. }
  930. saveExternalPart(params).then(({data}) => {
  931. if (data && data.code === 0) {
  932. this.handleSelectExternalPartPage()
  933. this.savePartVisible = false
  934. this.$message.success(data.msg)
  935. } else {
  936. this.$message.warning(data.msg)
  937. }
  938. }).catch((error) => {
  939. this.$message.error(error)
  940. })
  941. } else {
  942. for (let i = 0; i < Object.keys(obj).length; i++) {
  943. this.$message.warning(obj[Object.keys(obj)[i]][0].message)
  944. break
  945. }
  946. }
  947. })
  948. } else {
  949. this.savePart = {
  950. ...part,
  951. active: 'Y',
  952. umId: this.unitList.length > 0 ? this.unitList[0].umId : '',
  953. category: '',
  954. manufacturerRequired: 'N',
  955. moldCodeRequired: 'N',
  956. serialNumberRequired: 'N',
  957. }
  958. this.getCountryList()
  959. this.savePart.freeInfo2 = this.defaultCountry
  960. this.savePart.category = this.partCategoryList.length > 0 ? this.partCategoryList[0].categoryValue : ''
  961. this.savePartVisible = true
  962. }
  963. },
  964. closeSavePart () {
  965. this.savePart = {
  966. ...part,
  967. active: 'Y',
  968. }
  969. if (this.unitList.length > 0) {
  970. this.savePart.umId = this.unitList[0].umId
  971. }
  972. this.$refs.savePartForm.resetFields()
  973. },
  974. removeExternalPart (row) {
  975. removeExternalPart(row).then(({data}) => {
  976. if (data && data.code === 0) {
  977. this.selectExternalPartList()
  978. this.$message.success(data.msg)
  979. } else {
  980. this.$message.warning(data.msg)
  981. }
  982. }).catch((error) => {
  983. this.$message.error(error)
  984. })
  985. },
  986. handleRowClick (row, column, event, type) {
  987. this.currentPart = {...row}
  988. if (type === 0) {
  989. this.getCountryList()
  990. this.savePart = {...row}
  991. this.savePartVisible = true
  992. }
  993. },
  994. handleDblRowClick (row, column, event, type) {
  995. if (this.ofComponents) {
  996. this.$emit('rowClick', row)
  997. } else {
  998. this.currentPart = {...row}
  999. if (type === 0) {
  1000. this.savePart = {...row}
  1001. this.savePartVisible = true
  1002. }
  1003. }
  1004. },
  1005. handleUpdate () {
  1006. if ((this.savePart.packingWeight || this.savePart.packingWeight == 0) && !this.savePart.weightUmId) {
  1007. this.$message.warning('Please select Weight UM')
  1008. return
  1009. }
  1010. this.$refs.savePartForm.validate((valid, obj) => {
  1011. if (valid) {
  1012. if (this.savePart.qtyPerCarton === 0) {
  1013. this.$message.warning('Qty Per Carton can not be 0')
  1014. return
  1015. }
  1016. let params = {
  1017. ...this.savePart,
  1018. site: this.$store.state.user.site,
  1019. createBy: undefined,
  1020. createTime: undefined,
  1021. updateBy: this.$store.state.user.name,
  1022. updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
  1023. }
  1024. updateExternalPart(params).then(({data}) => {
  1025. if (data && data.code === 0) {
  1026. this.handleSelectExternalPartPage()
  1027. this.savePartVisible = false
  1028. this.$message.success(data.msg)
  1029. } else {
  1030. this.$message.warning(data.msg)
  1031. }
  1032. }).catch((error) => {
  1033. this.$message.error(error)
  1034. })
  1035. } else {
  1036. for (let i = 0; i < Object.keys(obj).length; i++) {
  1037. this.$message.warning(obj[Object.keys(obj)[i]][0].message)
  1038. break
  1039. }
  1040. }
  1041. })
  1042. },
  1043. getExternalPartCustomerList () {
  1044. let params = {
  1045. partNo: this.currentPart.partNo,
  1046. site: this.currentPart.site,
  1047. }
  1048. getExternalPartCustomerList(params).then(({data}) => {
  1049. if (data && data.code === 0) {
  1050. this.externalPartCustomerList = data.rows
  1051. } else {
  1052. this.$message.warning(data.msg)
  1053. }
  1054. }).catch((error) => {
  1055. this.$message.error(error)
  1056. })
  1057. },
  1058. getExternalPartManufacturerList () {
  1059. let params = {
  1060. partNo: this.currentPart.partNo,
  1061. site: this.currentPart.site,
  1062. }
  1063. getExternalPartManufacturerList(params).then(({data}) => {
  1064. if (data && data.code === 0) {
  1065. this.externalPartManufacturerList = data.rows
  1066. } else {
  1067. this.$message.warning(data.msg)
  1068. }
  1069. }).catch((error) => {
  1070. this.$message.error(error)
  1071. })
  1072. },
  1073. async convertToBase64 (fileUrls) {
  1074. this.base64List = []
  1075. for (const fileUrl of fileUrls) {
  1076. const base64Url = await this.getFileAsBase64(fileUrl)
  1077. this.base64List.push(base64Url)
  1078. }
  1079. },
  1080. getFileAsBase64 (fileUrl) {
  1081. return new Promise((resolve, reject) => {
  1082. const img = new Image()
  1083. img.crossOrigin = 'Anonymous'
  1084. img.src = fileUrl
  1085. img.onload = () => {
  1086. const canvas = document.createElement('canvas')
  1087. const ctx = canvas.getContext('2d')
  1088. canvas.width = img.width
  1089. canvas.height = img.height
  1090. ctx.drawImage(img, 0, 0)
  1091. const base64data = canvas.toDataURL('image/jpeg')
  1092. resolve(base64data)
  1093. }
  1094. img.onerror = (error) => {
  1095. reject(error)
  1096. }
  1097. })
  1098. },
  1099. async getTableUserColumn (tableId, columnId) {
  1100. let queryTableUser = {
  1101. userId: this.$store.state.user.name,
  1102. functionId: this.$route.meta.menuId,
  1103. tableId: tableId,
  1104. status: true,
  1105. languageCode: this.$i18n.locale
  1106. }
  1107. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1108. if (data.rows.length > 0) {
  1109. this.caseTable(data.rows, columnId)
  1110. } else {
  1111. this.getColumnList(tableId, columnId)
  1112. }
  1113. })
  1114. },
  1115. // 获取 tableDefault 列
  1116. async getColumnList (tableId, columnId) {
  1117. let queryTable = {
  1118. functionId: this.$route.meta.menuId,
  1119. tableId: tableId,
  1120. languageCode: this.$i18n.locale
  1121. }
  1122. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1123. if (!data.rows.length === 0) {
  1124. this.caseTable(data.rows, columnId)
  1125. } else {
  1126. }
  1127. })
  1128. },
  1129. caseTable (list, columnId) {
  1130. if (list.length > 0) {
  1131. switch (columnId) {
  1132. case 1:
  1133. this.columnList = list
  1134. break
  1135. case 2:
  1136. this.pictureColumnList = list
  1137. break
  1138. case 3:
  1139. this.customerColumnList = list
  1140. break
  1141. case 4:
  1142. this.manufacturerColumnList = list
  1143. break
  1144. }
  1145. }
  1146. },
  1147. qtyPerCarton () {
  1148. return new Decimal(this.savePart.qtyPerRoll).mul(this.savePart.rollsPerCarton).toNumber()
  1149. },
  1150. getCategoryList () {
  1151. let params = {}
  1152. getCategoryList(params).then(({data}) => {
  1153. if (data && data.code === 0) {
  1154. this.partCategoryList = data.rows
  1155. } else {
  1156. this.$message.warning(data.msg)
  1157. }
  1158. }).catch((error) => {
  1159. this.$message.error(error)
  1160. })
  1161. },
  1162. changeQtyRollCarton () {
  1163. this.savePart.qtyPerRoll = this.savePart.qtyPerCarton
  1164. },
  1165. getCountryList () {
  1166. let params = {}
  1167. countryList(params).then(({data}) => {
  1168. if (data && data.code === 0) {
  1169. this.countryList = data.rows
  1170. } else {
  1171. this.$message.warning(data.msg)
  1172. }
  1173. }).catch((error) => {
  1174. this.$message.error(error)
  1175. })
  1176. },
  1177. getUserSiteDefaultCountry () {
  1178. let params = this.$store.state.user.site
  1179. getSiteDetail(params).then(({data}) => {
  1180. if (data && data.code === 0) {
  1181. if (data.row && data.row.defaultCountry) {
  1182. this.defaultCountry = data.row.defaultCountry
  1183. }
  1184. } else {
  1185. this.$message.warning(data.msg)
  1186. }
  1187. }).catch((error) => {
  1188. this.$message.error(error)
  1189. })
  1190. },
  1191. handleSelectExternalPartPage () {
  1192. let params = {
  1193. ...this.part,
  1194. site: this.$store.state.user.site,
  1195. no: this.no,
  1196. size: this.size,
  1197. provisionalData: 'N',
  1198. }
  1199. selectExternalPartPage(params).then(({data}) => {
  1200. if (data && data.code === 0) {
  1201. this.partList = data.rows
  1202. if (this.partList.length > 0 && !this.ofComponents) {
  1203. this.currentPart = {...this.partList[0]}
  1204. }
  1205. this.total = data.total
  1206. } else {
  1207. this.$message.warning(data.msg)
  1208. }
  1209. }).catch((error) => {
  1210. this.$message.error(error)
  1211. })
  1212. },
  1213. handleSizeChange (val) {
  1214. this.size = val
  1215. this.handleSelectExternalPartPage()
  1216. },
  1217. handleCurrentChange (val) {
  1218. this.no = val
  1219. this.handleSelectExternalPartPage()
  1220. },
  1221. changeCategory (val) {
  1222. const category = this.partCategoryList.find((item) => item.categoryValue === val)
  1223. if (category) {
  1224. this.savePart.manufacturerRequired = category.manufacturerRequired
  1225. this.savePart.moldCodeRequired = category.moldCodeRequired
  1226. this.savePart.serialNumberRequired = category.serialNumberRequired
  1227. this.savePart.rollLabelRequired = category.rollLabelRequired
  1228. if (this.savePart.serialNumberRequired === 'Y') {
  1229. this.savePart.qtyPerRoll = 1
  1230. this.savePart.rollsPerCarton = 1
  1231. }
  1232. if (category.showCartonQtyPerRoll === 'N') {
  1233. this.savePart.qtyPerRoll = 1
  1234. }
  1235. if (category.showCartonRollsPerCarton === 'N') {
  1236. this.savePart.rollsPerCarton = 1
  1237. }
  1238. this.partRules.rollsPerCarton[0].message = `Please input ${category.qtyPerRollPart}`
  1239. this.savePart.qtyPerCarton = this.qtyPerCarton()
  1240. this.category = JSON.parse(JSON.stringify(category))
  1241. }
  1242. },
  1243. // ======== 导出相关方法 ========
  1244. /**
  1245. * 导出excel
  1246. */
  1247. async createExportData () {
  1248. let params = {
  1249. ...this.part,
  1250. site: this.$store.state.user.site,
  1251. no:1,
  1252. size:-1,
  1253. }
  1254. await selectExternalPartPage(params).then(({data}) => {
  1255. this.resultList = data.rows
  1256. })
  1257. return this.resultList
  1258. },
  1259. startDownload () {},
  1260. finishDownload () {},
  1261. fields () {
  1262. let json = '{'
  1263. this.columnList.forEach((item, index) => {
  1264. if (index == this.columnList.length - 1) {
  1265. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  1266. } else {
  1267. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  1268. }
  1269. })
  1270. json += '}'
  1271. let s = eval('(' + json + ')')
  1272. return s
  1273. },
  1274. partUpload () {
  1275. this.visible = true
  1276. },
  1277. // 关闭modal
  1278. closeUploadDialog () {
  1279. this.fileList = []
  1280. // 清空文件上传记录
  1281. this.$refs.uploadFile.clearFiles()
  1282. // 关闭当前的页面
  1283. this.visible = false
  1284. },
  1285. // 保修当前的数据
  1286. saveUploadFile () {
  1287. // 判断文件是否上传
  1288. if (null == this.fileList || 0 === this.fileList.length) {
  1289. this.$message.error("Please upload the file first!")
  1290. return false
  1291. }
  1292. // 提示将删除之前的数据
  1293. this.$confirm('Do you confirm the upload? If the Part Info already exists, we will delete it!', 'Warning', {
  1294. confirmButtonText: 'OK',
  1295. cancelButtonText: 'Cancel',
  1296. type: 'warning'
  1297. }).then(() => {
  1298. // 判断文件是否上传
  1299. if (null == this.fileList || 0 === this.fileList.length) {
  1300. this.$message.error("请先上传文件!")
  1301. return false
  1302. }
  1303. const formData = new FormData()
  1304. formData.append("file", this.fileList[0].raw)
  1305. formData.append("createBy", this.$store.state.user.name)
  1306. formData.append("site", this.tempData.site.toString())
  1307. this.isLoading = true
  1308. savePartInfoByExcel(formData).then(({data}) => {
  1309. if (data.code === 0) {
  1310. // 关闭窗口并刷新页面
  1311. this.provisionalDataDialogHandle()
  1312. } else {
  1313. this.isLoading = false
  1314. this.$message.warning(data.msg)
  1315. }
  1316. })
  1317. }).catch(() => {
  1318. this.$message({
  1319. type: 'info',
  1320. message: 'Cancel upload'
  1321. })
  1322. });
  1323. },
  1324. provisionalDataDialogHandle () {
  1325. getProvisionalDataList().then(({data}) => {
  1326. if (data.code === 0) {
  1327. this.provisionalDataList = data.rows
  1328. this.isLoading = false
  1329. this.provisionalDataVisible = true
  1330. } else {
  1331. this.isLoading = false
  1332. this.$message.warning(data.msg)
  1333. }
  1334. })
  1335. },
  1336. // 上传之前
  1337. beforeUploadHandle (file) {
  1338. let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase()
  1339. if (!(extName === '.xlsx' || extName === '.xls')) {
  1340. this.$message.error('数据导入失败,请选择正确的xlsx模板文件')
  1341. return false
  1342. }
  1343. },
  1344. // 选择上传文件时
  1345. onRemove(file, fileList){
  1346. this.fileList = fileList
  1347. },
  1348. onChange(file, fileList){
  1349. this.fileList = fileList
  1350. },
  1351. // 下载
  1352. async downloadFile () {
  1353. let file = {
  1354. id: 0,
  1355. fileName: ''
  1356. }
  1357. let tempData = this.tempData
  1358. await queryFileId(tempData).then(({data}) => {
  1359. if (data && data.code === 0) {
  1360. file.id = data.data.id
  1361. file.fileName = data.data.fileName
  1362. } else {
  1363. this.$alert(data.msg, '错误', {
  1364. confirmButtonText: '确定'
  1365. })
  1366. }
  1367. })
  1368. await downLoadObjectFile(file).then(({data}) => {
  1369. // 不限制文件下载类型
  1370. const blob = new Blob([data], {type: "application/octet-stream"})
  1371. // 下载文件名称
  1372. const fileName = file.fileName
  1373. // a标签下载
  1374. const linkNode = document.createElement('a')
  1375. // a标签的download属性规定下载文件的名称
  1376. linkNode.download = fileName
  1377. linkNode.style.display = 'none'
  1378. // 生成一个Blob URL
  1379. linkNode.href = URL.createObjectURL(blob)
  1380. document.body.appendChild(linkNode)
  1381. // 模拟在按钮上的一次鼠标单击
  1382. linkNode.click()
  1383. // 释放URL 对象
  1384. URL.revokeObjectURL(linkNode.href)
  1385. document.body.removeChild(linkNode)
  1386. })
  1387. },
  1388. provisionalDataAlterHandle (type) {
  1389. if (type === 1){
  1390. this.isLoading2 = true
  1391. } else if (type === 2){
  1392. this.isLoading3 = true
  1393. }
  1394. let inData={
  1395. provisionalDataList: this.provisionalDataList,
  1396. type: type
  1397. }
  1398. provisionalDataAlterHandle(inData).then(({data}) => {
  1399. if (data.code === 0) {
  1400. if (type === 1) {
  1401. this.$message.success(data.msg)
  1402. this.provisionalDataVisible = false
  1403. this.visible = false
  1404. this.handleSelectExternalPartPage()
  1405. this.isLoading2 = false
  1406. } else if (type === 2) {
  1407. this.$message.warning('Import cancelled!')
  1408. this.provisionalDataVisible = false
  1409. this.isLoading3 = false
  1410. }
  1411. } else {
  1412. this.$message.warning(data.msg)
  1413. if (type === 1) {
  1414. this.isLoading2 = false
  1415. } else if (type === 2) {
  1416. this.isLoading3 = false
  1417. }
  1418. }
  1419. })
  1420. },
  1421. },
  1422. computed: {},
  1423. activated () {
  1424. if (this.$route.query.site && this.$route.query.partNo) {
  1425. this.part.site = this.$route.query.site
  1426. this.part.partNo = this.$route.query.partNo
  1427. this.handleSelectExternalPartPage()
  1428. }
  1429. },
  1430. created () {
  1431. this.provisionalDataAlterHandle(3)
  1432. this.selectUnitList()
  1433. this.getCategoryList()
  1434. // this.getCountryList();
  1435. // this.selectExternalPartList();
  1436. this.handleSelectExternalPartPage()
  1437. this.getUserSiteDefaultCountry()
  1438. this.getTableUserColumn('10002Table', 1)
  1439. this.getTableUserColumn('10002Table2', 2)
  1440. this.getTableUserColumn('10002Table3', 3)
  1441. this.getTableUserColumn('10002Table4', 4)
  1442. }
  1443. }
  1444. </script>
  1445. <template>
  1446. <div>
  1447. <el-form :inline="true" label-position="top" :model="part" label-width="100px">
  1448. <el-form-item label="Part No">
  1449. <el-input v-model="part.partNo"></el-input>
  1450. </el-form-item>
  1451. <el-form-item label="Part Description">
  1452. <el-input v-model="part.partDesc"></el-input>
  1453. </el-form-item>
  1454. <el-form-item label="Part Category">
  1455. <el-select v-model="part.category" placeholder="">
  1456. <el-option label="All" value=""></el-option>
  1457. <el-option :label="item.categoryName" :value="item.categoryValue" :key="item.id"
  1458. v-for="item in partCategoryList"></el-option>
  1459. </el-select>
  1460. </el-form-item>
  1461. <el-form-item label="Active">
  1462. <el-select v-model="part.active" placeholder="">
  1463. <el-option label="All" value=""></el-option>
  1464. <el-option label="Active" value="Y"></el-option>
  1465. <el-option label="Not Active" value="N"></el-option>
  1466. </el-select>
  1467. </el-form-item>
  1468. <el-form-item label=" ">
  1469. <el-button type="primary" @click="handleSave" v-if="!ofComponents">New</el-button>
  1470. <!-- <el-button type="primary" @click="selectExternalPartList">Query</el-button>-->
  1471. <el-button type="primary" @click="handleSelectExternalPartPage">Query</el-button>
  1472. <el-button type="primary" icon="el-icon-upload" v-if="this.$store.state.user.userType !== 'Common Users'" @click="partUpload()">Import Part Info</el-button>
  1473. <download-excel
  1474. :fields="fields()"
  1475. :data="exportData"
  1476. type="xls"
  1477. :name="exportName"
  1478. :header="exportHeader"
  1479. :footer="exportFooter"
  1480. :fetch="createExportData"
  1481. :before-generate="startDownload"
  1482. :before-finish="finishDownload"
  1483. worksheet="Export Information"
  1484. class="el-button el-button--primary el-button--medium">
  1485. {{ "Export" }}
  1486. </download-excel>
  1487. </el-form-item>
  1488. </el-form>
  1489. <el-table :data="partList" :height="height" :row-style="rowPartStyle" @row-click="handleRowClick"
  1490. @row-dblclick="handleDblRowClick" :loading="partTableLoading" border style="width: 100%;margin-top: 5px">
  1491. <el-table-column v-if="!ofComponents"
  1492. header-align="center"
  1493. align="center"
  1494. width="100"
  1495. fixed="left"
  1496. label="Actions">
  1497. <template slot-scope="scope">
  1498. <el-link style="cursor:pointer;" @click="handleRowClick(scope.row,null,null,0)">Edit</el-link>
  1499. <el-link style="cursor:pointer;" @click="removeExternalPart(scope.row)">Delete</el-link>
  1500. </template>
  1501. </el-table-column>
  1502. <el-table-column
  1503. v-for="(item,index) in columnList" :key="index"
  1504. :sortable="item.columnSortable"
  1505. :prop="item.columnProp"
  1506. :header-align="item.headerAlign"
  1507. :show-overflow-tooltip="item.showOverflowTooltip"
  1508. :align="item.align"
  1509. :fixed="item.fixed==''?false:item.fixed"
  1510. :min-width="item.columnWidth"
  1511. :label="item.columnLabel">
  1512. <template slot-scope="scope">
  1513. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  1514. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  1515. style="width: 100px; height: 80px"/></span>
  1516. </template>
  1517. </el-table-column>
  1518. </el-table>
  1519. <el-pagination
  1520. @size-change="handleSizeChange"
  1521. @current-change="handleCurrentChange"
  1522. :current-page.sync="no"
  1523. :page-sizes="[50,100, 200, 300, 400]"
  1524. :page-size="size"
  1525. layout="sizes, prev, pager, next,total"
  1526. :total="total">
  1527. </el-pagination>
  1528. <el-tabs v-model="activeName" v-if="!ofComponents">
  1529. <el-tab-pane label="Part Certification" name="partPicture">
  1530. <picture-module ref="picture" :column-list="pictureColumnList" :part="currentPart" :data-list="pictureList"
  1531. @refresh="getExternalPartPictureList"></picture-module>
  1532. </el-tab-pane>
  1533. <el-tab-pane label="Linked Customer" name="linkedCustomer">
  1534. <linked-customer :column-list="customerColumnList" :part="currentPart" :data-list="externalPartCustomerList"
  1535. @refresh="getExternalPartCustomerList" :visible="true"></linked-customer>
  1536. </el-tab-pane>
  1537. <el-tab-pane label="Linked Manufacturer" name="linkedManufacturer">
  1538. <linked-manufacturer :column-list="manufacturerColumnList" :part="currentPart"
  1539. :data-list="externalPartManufacturerList" @refresh="getExternalPartManufacturerList"
  1540. :visible="true"></linked-manufacturer>
  1541. </el-tab-pane>
  1542. <el-tab-pane label="Product Label" name="productLabel" v-if="this.$store.state.user.autoSerialNumber === 'Y'">
  1543. <label-template :part="currentPart"></label-template>
  1544. </el-tab-pane>
  1545. </el-tabs>
  1546. <el-dialog v-drag :title="`Part`" :close-on-click-modal="false" @close="closeSavePart" width="550px"
  1547. :visible.sync="savePartVisible">
  1548. <el-form :model="savePart" label-position="top" ref="savePartForm" :rules="partRules">
  1549. <el-row :gutter="10">
  1550. <el-col :span="8">
  1551. <el-form-item label="Part No" prop="partNo" :show-message="false">
  1552. <el-input :readonly="savePart.site !== ''" :disabled="savePart.site !== ''"
  1553. v-model="savePart.partNo"></el-input>
  1554. </el-form-item>
  1555. </el-col>
  1556. <el-col :span="15">
  1557. <el-form-item label="Part Description" prop="partDesc" :show-message="false">
  1558. <el-input v-model="savePart.partDesc"></el-input>
  1559. </el-form-item>
  1560. </el-col>
  1561. <el-col :span="8" v-if="$store.state.user.autoSerialNumber === 'Y'">
  1562. <el-form-item label="Print Str1" :show-message="false">
  1563. <el-input v-model="savePart.printStr1"></el-input>
  1564. </el-form-item>
  1565. </el-col>
  1566. <el-col :span="7" v-if="$store.state.user.autoSerialNumber === 'Y'">
  1567. <el-form-item label="Print Str2" :show-message="false">
  1568. <el-input v-model="savePart.printStr2"></el-input>
  1569. </el-form-item>
  1570. </el-col>
  1571. <el-col :span="8" v-if="$store.state.user.autoSerialNumber === 'Y'">
  1572. <el-form-item label="Print Str3" :show-message="false">
  1573. <el-input v-model="savePart.printStr3"></el-input>
  1574. </el-form-item>
  1575. </el-col>
  1576. <el-col :span="8">
  1577. <el-form-item label="Part Category" prop="category" :show-message="false">
  1578. <el-select v-model="savePart.category" placeholder="" @change="changeCategory" style="width: 100%">
  1579. <el-option :label="item.categoryName" :value="item.categoryValue" :key="item.id"
  1580. v-for="item in partCategoryList"></el-option>
  1581. </el-select>
  1582. </el-form-item>
  1583. </el-col>
  1584. <el-col :span="7">
  1585. <el-form-item label="UM" prop="umId" :show-message="false">
  1586. <el-select v-model="savePart.umId" placeholder="" :show-message="false" style="width: 100%">
  1587. <el-option v-for="item in unitList" :key="item.umId" :label="item.umName"
  1588. :value="item.umId"></el-option>
  1589. </el-select>
  1590. </el-form-item>
  1591. </el-col>
  1592. <el-col :span="8">
  1593. <el-form-item v-if="savePart.moldCodeRequired === 'Y'" key="moldCode" label="Mold Code" prop="moldCode"
  1594. :show-message="false">
  1595. <el-input v-model="savePart.moldCode"></el-input>
  1596. </el-form-item>
  1597. <el-form-item v-else label="Mold Code">
  1598. <el-input v-model="savePart.moldCode" disabled></el-input>
  1599. </el-form-item>
  1600. </el-col>
  1601. </el-row>
  1602. <el-row :gutter="10">
  1603. <el-col :span="8" v-if="category.rollLabelRequired === 'Y'">
  1604. <el-form-item label="Qty Per Roll" prop="qtyPerRoll" :show-message="false">
  1605. <el-input-number :step="0" :min="0" :controls="false"
  1606. :disabled="this.savePart.serialNumberRequired === 'Y'"
  1607. v-model="savePart.qtyPerRoll"></el-input-number>
  1608. </el-form-item>
  1609. </el-col>
  1610. <el-col :span="7" v-if="category.rollLabelRequired === 'Y'">
  1611. <el-form-item label="Rolls Per Carton" prop="rollsPerCarton" :show-message="false">
  1612. <el-input-number :step="0" :min="0" :controls="false"
  1613. :disabled="this.savePart.serialNumberRequired === 'Y'"
  1614. v-model="savePart.rollsPerCarton"></el-input-number>
  1615. </el-form-item>
  1616. </el-col>
  1617. <el-col :span="8">
  1618. <el-form-item :label="category.qtyPerRollPart" prop="qtyPerCarton" :show-message="false">
  1619. <el-input-number :step="0" :min="0" :controls="false" @change="changeQtyRollCarton"
  1620. :disabled="category.editQtyPerCarton === 'N'"
  1621. v-model="savePart.qtyPerCarton"></el-input-number>
  1622. </el-form-item>
  1623. </el-col>
  1624. </el-row>
  1625. <el-row :gutter="10">
  1626. <el-col :span="8">
  1627. <el-form-item label="OOC" :show-message="false" prop="freeInfo2">
  1628. <el-select v-model="savePart.freeInfo2" placeholder="" style="width: 100%">
  1629. <el-option v-for="item in countryList" :label="item.countryNo" :value="item.countryNo"
  1630. :key="item.countryNo"></el-option>
  1631. </el-select>
  1632. </el-form-item>
  1633. </el-col>
  1634. <el-col :span="7">
  1635. <el-form-item label="Rev No" prop="rev" :show-message="false">
  1636. <el-input v-model="savePart.rev"></el-input>
  1637. </el-form-item>
  1638. </el-col>
  1639. <el-col :span="8">
  1640. <el-form-item label="Free Info" :show-message="false">
  1641. <el-input v-model="savePart.freeInfo"></el-input>
  1642. </el-form-item>
  1643. </el-col>
  1644. </el-row>
  1645. <el-row :gutter="10">
  1646. <el-col :span="3">
  1647. <el-form-item label=" " :show-message="false">
  1648. <el-checkbox v-model="savePart.active" true-label="Y" false-label="N">Active</el-checkbox>
  1649. </el-form-item>
  1650. </el-col>
  1651. <el-col :span="5">
  1652. <el-form-item label=" " :show-message="false">
  1653. <el-checkbox v-model="savePart.tradingMark" true-label="Y" false-label="N">Trading Mark</el-checkbox>
  1654. </el-form-item>
  1655. </el-col>
  1656. <el-col :span="7">
  1657. <el-form-item label="Packing Weight" prop="packingWeight">
  1658. <el-input-number :min="0" :controls="false" v-model="savePart.packingWeight"
  1659. :precision="6"></el-input-number>
  1660. </el-form-item>
  1661. </el-col>
  1662. <el-col :span="4">
  1663. <el-form-item label="Weight UM" prop="weightUmId" :show-message="false">
  1664. <el-select v-model="savePart.weightUmId" placeholder="" :show-message="false" clearable
  1665. style="width: 100%">
  1666. <el-option v-for="item in unitList" :key="item.weightUmId" :label="item.umName"
  1667. :value="item.umId"></el-option>
  1668. </el-select>
  1669. </el-form-item>
  1670. </el-col>
  1671. <el-col :span="3">
  1672. <el-form-item label=" " :show-message="false">
  1673. <el-checkbox v-model="savePart.rollLabelFlag" true-label="Y" false-label="N">45*20 Label</el-checkbox>
  1674. </el-form-item>
  1675. </el-col>
  1676. </el-row>
  1677. </el-form>
  1678. <div slot="footer" class="dialog-footer">
  1679. <el-button type="primary" v-if="savePart.site !== ''" @click="handleUpdate">Save</el-button>
  1680. <el-button type="primary" v-else @click="handleSave">Save</el-button>
  1681. <el-button @click="savePartVisible = false">Cancel</el-button>
  1682. </div>
  1683. </el-dialog>
  1684. <el-dialog title="File Import" :z-index="1999" @close="closeUploadDialog" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;">
  1685. <el-form :inline="true" label-position="top" label-width="80px">
  1686. <el-form-item prop="site" :rules="rules.site">
  1687. <span slot="label" style="" class="big-label">
  1688. <a herf="#" @click="getBaseList(93)">Site</a>
  1689. </span>
  1690. <el-input v-model="tempData.site" style="width: 130px"></el-input>
  1691. </el-form-item>
  1692. <el-form-item label=" ">
  1693. <el-button type="primary" @click="downloadFile()">Download file template</el-button>
  1694. </el-form-item>
  1695. <el-row>
  1696. <el-col :span="24">
  1697. <el-upload class="customer-upload" drag action="javascript:void(0);" ref="uploadFile" :limit="1" accept=".xlsx,.xls"
  1698. :before-upload="beforeUploadHandle" :on-remove="onRemove" :on-change="onChange" :auto-upload="false" style="text-align: left;">
  1699. <i class="el-icon-upload"></i>
  1700. <div class="el-upload__text">Drag the file hereor<em> click to upload</em></div>
  1701. </el-upload>
  1702. </el-col>
  1703. </el-row>
  1704. </el-form>
  1705. <span slot="footer" class="dialog-footer">
  1706. <el-button type="primary" :disabled="isLoading" @click="saveUploadFile">{{ isLoading ? 'Saving...' : 'Save' }} </el-button>
  1707. <el-button type="primary" @click="closeUploadDialog">Cancel</el-button>
  1708. </span>
  1709. </el-dialog>
  1710. <el-dialog title="Import Info View" @close="provisionalDataAlterHandle(3)" :close-on-click-modal="false" :visible.sync="provisionalDataVisible" width="1100px">
  1711. <el-table :data="provisionalDataList" :height="height + 200" border style="width: 100%;margin-top: 5px">
  1712. <el-table-column
  1713. v-for="(item,index) in columnList" :key="index"
  1714. :sortable="item.columnSortable"
  1715. :prop="item.columnProp"
  1716. :header-align="item.headerAlign"
  1717. :show-overflow-tooltip="item.showOverflowTooltip"
  1718. :align="item.align"
  1719. :fixed="item.fixed==''?false:item.fixed"
  1720. :min-width="item.columnWidth"
  1721. :label="item.columnLabel">
  1722. <template slot-scope="scope">
  1723. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  1724. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  1725. style="width: 100px; height: 80px"/></span>
  1726. </template>
  1727. </el-table-column>
  1728. </el-table>
  1729. <span slot="footer" class="dialog-footer">
  1730. <el-button type="primary" @click="provisionalDataAlterHandle(1)">{{ isLoading2 ? 'Saving...' : 'Confirm Import'}}</el-button>
  1731. <el-button type="primary" @click="provisionalDataAlterHandle(2)">{{ isLoading3 ? 'Canceling...' : 'Cancel'}}</el-button>
  1732. </span>
  1733. </el-dialog>
  1734. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  1735. <div v-show="false">
  1736. <img :src="item" v-for="(item,index) in base64List" :key="index" style="display: none">
  1737. </div>
  1738. </div>
  1739. </template>
  1740. <style scoped>
  1741. .big-label {
  1742. font-size: medium; /* 调整字号 */
  1743. }
  1744. </style>