imeik-bizui 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,13 +11,14 @@ import { getTypeItems } from './data'
11
11
  import FieldSeleceDoctor from '../FieldSeleceDoctor/index.vue'
12
12
  import { getTagManageList, getEcsErpCode } from '../../api/applycenter'
13
13
  import Axios from 'axios'
14
+ const defaultBelongCompany = '201'
14
15
  export default {
15
16
  name: 'applyTypeView',
16
17
  components: {
17
18
  FieldSeleceDoctor
18
19
  },
19
20
  inject: {
20
- formProps: {
21
+ getFormProps: {
21
22
  default: () => {}
22
23
  }
23
24
  },
@@ -49,7 +50,7 @@ export default {
49
50
  },
50
51
  formItems: []
51
52
  },
52
- belongCompany: ''
53
+ belongCompany: defaultBelongCompany
53
54
  }
54
55
  },
55
56
  computed: {
@@ -82,52 +83,43 @@ export default {
82
83
  }
83
84
  },
84
85
  watch: {
85
- value: {
86
- handler(val) {
87
- this.formConfig.props = val
88
- console.log(this.formConfig.props, 'this.formConfig.props')
89
- this.changeShowItems()
90
- },
91
- immediate: true
92
- },
93
86
  formItems: {
94
87
  handler(val) {
95
88
  this.formConfig.formItems = val
96
89
  },
97
90
  immediate: true
98
91
  },
99
- 'formConfig.props.promiseTargetDate': {
92
+ value: {
100
93
  handler(val) {
101
- this.formatData(val)
94
+ this.formConfig.props = val
102
95
  },
103
- deep: true
96
+ immediate: true
104
97
  },
105
98
  'formConfig.props': {
106
99
  handler(val) {
107
100
  this.setPropsData()
108
101
  },
109
102
  deep: true
110
- },
111
- 'formProps.belongCompany': {
112
- handler(val) {
113
- if (!this.isView) {
114
- this.belongCompany = val
115
- this.setTypeDataOnChange()
116
- }
117
- },
118
- immediate: true,
119
- deep: true
120
103
  }
121
104
  },
122
105
  mounted() {
123
- if (this.$bizui.bus && !this.isView) {
124
- this.$bizui.bus.$on('applySubmit', (val) => {
125
- this.handleValidate()
126
- })
127
- }
106
+ this.handleBusEvent()
128
107
  this.getApplyList()
129
108
  },
130
109
  methods: {
110
+ handleBusEvent() {
111
+ if (this.$bizui.bus && !this.isView) {
112
+ // 监听点击表单提交的回调
113
+ this.$bizui.bus.$on('applySubmit', (val) => {
114
+ this.handleValidate()
115
+ })
116
+ // 监听主体切换的回调
117
+ this.$bizui.bus.$on('formBelongCompanyChange', (val) => {
118
+ this.belongCompany = val
119
+ this.setProjectCode()
120
+ })
121
+ }
122
+ },
131
123
  getApplyList() {
132
124
  getTagManageList({ tagModel: 'APPLY', tagName: '申请出库类型' }).then((res) => {
133
125
  if (res.code === 200) {
@@ -141,6 +133,7 @@ export default {
141
133
  }
142
134
  })
143
135
  },
136
+ // 校验提交的数据
144
137
  handleValidate() {
145
138
  this.$refs.ImForm?.validate((valid) => {
146
139
  this.formConfig.props.valid = valid
@@ -166,33 +159,36 @@ export default {
166
159
  })
167
160
  }
168
161
  this.formConfig.formItems[0].attrs.options = resData
169
- if (this.attrs.applyTypeOptions.default) {
162
+ if (!this.formConfig.props.applyType && this.attrs.applyTypeOptions.default) {
170
163
  this.formConfig.props.applyType = this.attrs.applyTypeOptions.default
171
- this.onApplyTypechange()
172
164
  }
165
+ this.changeShowItems()
166
+ this.setTypeDataOnChange()
173
167
  },
174
168
  changeShowItems() {
175
169
  const items = getTypeItems(this.formConfig.props.applyType, this.isView)
176
170
  this.formConfig.formItems = [this.formConfig.formItems[0], ...items]
171
+ this.setProjectCode()
177
172
  },
178
173
  onApplyTypechange() {
179
- // 清楚数据
180
- if (!this.isView) {
181
- this.formConfig.props = {
182
- applyType: this.formConfig.props.applyType,
183
- applyTypeName: this.getTypeName()
184
- }
174
+ this.formConfig.props = {
175
+ applyType: this.formConfig.props.applyType,
176
+ applyTypeName: this.getTypeName()
185
177
  }
186
178
  this.changeShowItems()
187
179
  this.setTypeDataOnChange()
188
180
  },
189
181
  // 与大表单同步数据,更新数据
190
182
  setPropsData() {
183
+ this.formatData()
191
184
  this.$emit('input', this.formConfig.props)
192
185
  this.$emit('change', this.formConfig.props)
193
186
  },
194
187
  setTypeDataOnChange() {
195
- this.setProjectCode()
188
+ // 假如有值,就不更新
189
+ if (this.formConfig.props.budgetSubjectCode) {
190
+ return
191
+ }
196
192
  getEcsErpCode({ applyType: this.formConfig.props.applyType, belongCompany: this.belongCompany }).then((res) => {
197
193
  if (res.code === 200) {
198
194
  this.formConfig.props.budgetSubjectCode = res.data.budgetSubjectCode
@@ -204,14 +200,13 @@ export default {
204
200
  }
205
201
  })
206
202
  },
207
- // 设置上市后临床研究项目编号
208
- setProjectCode() {
203
+ // 设置上市后临床研究项目编号
204
+ async setProjectCode() {
209
205
  const index = this.getFormItemIndex('projectCode')
210
206
  if (!index) return
211
- if (this.belongCompany === '201') {
207
+ if (!this.formConfig.props.projectCode && this.belongCompany === defaultBelongCompany) {
212
208
  this.formConfig.props.projectCode = 'Q202003-01_CH'
213
209
  this.$set(this.formConfig.formItems[index].attrs, 'disabled', true)
214
- return
215
210
  } else {
216
211
  this.formConfig.props.projectCode = undefined
217
212
  this.$set(this.formConfig.formItems[index].attrs, 'disabled', false)
@@ -233,7 +228,7 @@ export default {
233
228
  }
234
229
  })
235
230
  } else {
236
- // this.$message.error(res.msg)
231
+ this.$message.error(res.msg)
237
232
  }
238
233
  })
239
234
  },
@@ -88,30 +88,26 @@ export default {
88
88
  this.selectOrderList = val.subOrderMaterialsPlans || []
89
89
  },
90
90
  immediate: true
91
- },
92
- 'formProps.belongCompany': {
93
- handler(val, old) {
94
- if (!this.isView && val !== old) {
91
+ }
92
+ },
93
+ mounted() {
94
+ this.handleBusEvent()
95
+ },
96
+ methods: {
97
+ handleBusEvent() {
98
+ if (this.$bizui.bus && !this.isView) {
99
+ // 监听主体切换的回调
100
+ this.$bizui.bus.$on('formBelongCompanyChange', (val) => {
95
101
  this.deliveryTimeEffectiveness = '1'
96
102
  this.selectOrderList = []
97
- }
98
- },
99
- immediate: true,
100
- deep: true
101
- },
102
- 'formProps.applicationApplyCustomer': {
103
- handler(val, old) {
104
- if (!this.isView && val !== old) {
103
+ })
104
+ // 监听客户切换的回调
105
+ this.$bizui.bus.$on('formCustomChange', (val) => {
105
106
  this.deliveryTimeEffectiveness = '1'
106
107
  this.selectOrderList = []
107
- }
108
- },
109
- immediate: true,
110
- deep: true
111
- }
112
- },
113
- mounted() {},
114
- methods: {
108
+ })
109
+ }
110
+ },
115
111
  showBatchDialog() {
116
112
  this.showDialog = true
117
113
  },
@@ -1,6 +1,15 @@
1
1
  <template>
2
2
  <div>
3
- <CustomerSelect v-show="showSelect" ref="CustomerSelect" v-model="myValue" :show-list="showList" :selected-text="value && value.customerName" class="w-full" :ruleInfo="ruleInfo" @change="onSelectChanged"></CustomerSelect>
3
+ <CustomerSelect
4
+ v-show="showSelect"
5
+ ref="CustomerSelect"
6
+ v-model="myValue"
7
+ :show-list="showList"
8
+ :selected-text="value && value.customerName"
9
+ class="w-full"
10
+ :ruleInfo="ruleInfo"
11
+ @change="onSelectChanged"
12
+ ></CustomerSelect>
4
13
  <div v-if="!showSelect" class="customerDetails">
5
14
  <CustomShow :custom-data="selectedItem" :detail-show="true" :show-list="showList"></CustomShow>
6
15
  <div v-if="!isView" class="button">
@@ -70,22 +79,22 @@ export default {
70
79
  handler() {
71
80
  this.setMyValue()
72
81
  }
73
- },
74
- 'formProps.belongCompany': {
75
- handler(val, old) {
76
- if (!this.isView && val !== old) {
77
- this.selectedItem = {}
78
- this.myValue = ''
79
- }
80
- },
81
- immediate: true,
82
- deep: true
83
82
  }
84
83
  },
84
+ created() {
85
+ this.handleBusEvent()
86
+ },
85
87
  methods: {
88
+ handleBusEvent() {
89
+ if (this.$bizui.bus && !this.isView) {
90
+ // 监听主体切换的回调
91
+ this.$bizui.bus.$on('formBelongCompanyChange', (val) => {
92
+ this.clearInfo()
93
+ })
94
+ }
95
+ },
86
96
  setMyValue() {
87
97
  try {
88
- console.log(this.value, 'this.valuethis.valuethis.valuethis.value');
89
98
  this.myValue = this.value.customerUniqueCode
90
99
  this.selectedItem = JSON.parse(JSON.stringify(this.value))
91
100
  } catch (error) {
@@ -113,7 +122,7 @@ export default {
113
122
  .customerDetails {
114
123
  display: flex;
115
124
  align-items: center;
116
- background: #F2F5FA;
125
+ background: #f2f5fa;
117
126
  padding: 3px 16px;
118
127
  border-radius: 3px;
119
128
  .button {
@@ -68,37 +68,30 @@ export default {
68
68
  },
69
69
  deep: true,
70
70
  immediate: true
71
- },
72
- 'formProps.belongCompany': {
73
- handler(val, old) {
74
- if (!this.isView && val !== old) {
75
- this.tableData = []
76
- }
77
- },
78
- immediate: true,
79
- deep: true
80
- },
81
- 'formProps.applicationApplyCustomer': {
82
- handler(val, old) {
83
- if (!this.isView && val !== old) {
84
- this.tableData = []
85
- }
86
- },
87
- immediate: true,
88
- deep: true
89
71
  }
90
72
  },
91
73
  created() {
92
- if (this.$bizui.bus) {
93
- this.$bizui.bus.$on('applySubmit', (val) => {
94
- this.handleValidate()
95
- })
96
- }
74
+ this.handleBusEvent()
97
75
  this.handleTableData()
98
76
  },
99
77
  methods: {
78
+ handleBusEvent() {
79
+ if (this.$bizui.bus && !this.isView) {
80
+ this.$bizui.bus.$on('applySubmit', (val) => {
81
+ this.handleValidate()
82
+ })
83
+ // 监听主体切换的回调
84
+ this.$bizui.bus.$on('formBelongCompanyChange', (val) => {
85
+ this.tableData = []
86
+ })
87
+ // 监听客户切换的回调
88
+ this.$bizui.bus.$on('formCustomChange', (val) => {
89
+ this.tableData = []
90
+ })
91
+ }
92
+ },
100
93
  handleValidate() {
101
- this.tableData.forEach(item => {
94
+ this.tableData.forEach((item) => {
102
95
  if (!item.materialQuantity) {
103
96
  this.$message.error('请检查物料数量')
104
97
  item.valid = false
@@ -121,7 +114,7 @@ export default {
121
114
  purpose: this.purpose,
122
115
  address: this.address
123
116
  }
124
- this.attrs.materialConfig?.forEach(item => {
117
+ this.attrs.materialConfig?.forEach((item) => {
125
118
  this.tableItemArr = this.tableItemArr.concat(allData[item])
126
119
  })
127
120
  // 不是查看就添加操作列
@@ -134,7 +127,6 @@ export default {
134
127
  },
135
128
  addProduct(data) {
136
129
  this.tableData = [...this.tableData, ...data]
137
- console.log(this.tableData, '假如产品')
138
130
  this.onUpdate()
139
131
  },
140
132
  onRemoveItem(record, index) {
@@ -147,7 +139,7 @@ export default {
147
139
  onUpdate() {
148
140
  const data = JSON.parse(JSON.stringify(this.tableData))
149
141
  // 删掉木方案选择列表
150
- data.forEach(item => {
142
+ data.forEach((item) => {
151
143
  if (item.motherSchemeList) {
152
144
  delete item.motherSchemeList
153
145
  }