taskForm.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="">123</view>
  3. </template>
  4. <script>
  5. import { getBusinessOpportunityDetailAPI, businessOpportunityUpdateAPI } from '@/api/wt/index.js'
  6. export default {
  7. props: {
  8. businessId: {
  9. default: ''
  10. },
  11. taskDefinitionKey: {
  12. default: ''
  13. }
  14. },
  15. data() {
  16. return {
  17. form: {},
  18. calendarShow: false,
  19. tableField: [
  20. {
  21. label: '名称',
  22. field: 'productName'
  23. },
  24. {
  25. label: '编码',
  26. field: 'productCode'
  27. },
  28. {
  29. label: '类型',
  30. field: 'productCategoryName'
  31. },
  32. {
  33. label: '单价',
  34. field: 'singlePrice'
  35. },
  36. {
  37. label: '数量',
  38. field: 'totalCount'
  39. },
  40. {
  41. label: '合计',
  42. field: 'totalPrice'
  43. },
  44. {
  45. label: '生产交付交期',
  46. field: 'produceDeliveryDeadline',
  47. type: 'date',
  48. disabled: !['productionSupervisorApprove1', 'productionSupervisorApprove2'].includes(this.taskDefinitionKey)
  49. }
  50. ],
  51. list: ['基本信息', '产品清单'],
  52. totalPrice: 0,
  53. curNow: 0,
  54. curIndex: null,
  55. rules: {
  56. produceDeliveryDeadline: {
  57. type: 'string',
  58. required: true,
  59. message: '请选择生产交付日期',
  60. trigger: ['blur', 'change']
  61. }
  62. }
  63. }
  64. },
  65. methods: {
  66. sectionChange(index) {
  67. this.curNow = index
  68. },
  69. async getDetailData(id) {
  70. const data = await getBusinessOpportunityDetailAPI(id)
  71. if (data) {
  72. this.form = data
  73. console.log(this.form.productList)
  74. this.totalPrice = this.form.productList.reduce((num, row) => (num += row.totalPrice), 0)
  75. }
  76. },
  77. openCalendar(e, index) {
  78. this.calendarShow = true
  79. this.curIndex = index
  80. },
  81. confirm(e) {
  82. this.$set(this.form.productList[this.curIndex], 'produceDeliveryDeadline', ...e)
  83. this.calendarShow = false
  84. },
  85. //
  86. getTableValue() {
  87. let validField = ['produceDeliveryDeadline']
  88. let valid = false
  89. for (var i = 0; i < validField.length; i++) {
  90. valid = this.form.productList.some(item => !!item[validField[i]] == false)
  91. if (valid) break
  92. }
  93. return new Promise(async (resolve, reject) => {
  94. valid ? reject(uni.$u.toast('请完善产品清单信息')) : resolve(this.form)
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style></style>