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.

64 lines
1.5 KiB

4 years ago
  1. <template>
  2. <kr-print-designer ref="printDesigner" :temp-value="value" :widget-options="widgets" @save="handleSave" />
  3. </template>
  4. <script>
  5. import { OutStockOptions, InStockOptions } from '../data/options'
  6. import {
  7. getColumnsAttr
  8. } from '../api/base.js'
  9. export default {
  10. data() {
  11. return {
  12. id : '',
  13. site : '',
  14. index: '',
  15. value: {
  16. title: 'demo',
  17. width: 750,
  18. height: 550,
  19. pageWidth: 750,
  20. pageHeight: 550,
  21. tempItems: [],
  22. },
  23. widgets: OutStockOptions,
  24. }
  25. },
  26. created() {
  27. this.index = this.$route.query.index
  28. this.id = this.$route.query.id
  29. try {
  30. let tempList = JSON.parse(localStorage.getItem('tempList')) || []
  31. this.value = tempList[this.index]
  32. this.widgets = this.value.type == 1 ? OutStockOptions : InStockOptions
  33. } catch (err) {
  34. console.error(err)
  35. }
  36. this.getColumnsAttrList()
  37. },
  38. methods: {
  39. getColumnsAttrList(){
  40. let jsonData = {
  41. supplierId : 1,
  42. site : this.site,
  43. }
  44. getColumnsAttr(jsonData).then(({data}) =>{
  45. this.widgets = data.rows
  46. })
  47. },
  48. handleSave(data) {
  49. // let tempList = JSON.parse(localStorage.getItem('tempList')) || []
  50. // tempList[this.index] = data
  51. // localStorage.setItem('tempList', JSON.stringify(tempList))
  52. this.$router.back()
  53. },
  54. // 手动初始话模板数据
  55. initTemp(){
  56. // this.$refs.printDesigner.initTemp(this.value,this.widgets)
  57. }
  58. },
  59. }
  60. </script>