w-ui-v1 1.0.30 → 1.0.31

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
package/w-add/w-add.vue CHANGED
@@ -40,7 +40,7 @@ export default {
40
40
 
41
41
  <!-- 卡片 -->
42
42
  <view v-else class="card-list">
43
- <w-card @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
43
+ <w-card @edit="()=>{editItem(item, subitem, subindex)}" @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
44
44
  v-for="(subitem, subindex) in selectData[item.id]" :key="subindex" :car-index="subindex"
45
45
  :page="{
46
46
  rowActions: item.rowActions || [],
@@ -109,36 +109,21 @@ const pointSourceId = ref('')
109
109
  onLoad((option: any) => {
110
110
  sourceId.value = props.sourceId || option.sourceId
111
111
  getPageConfig()
112
-
113
- //监听勾选列表页面事件
114
- uni.$on('getCheckData', function (data: any) {
115
- checkboxvalue.value = data.checkData
116
- })
117
-
118
- //监听添加数据完成事件
119
- uni.$on('addDataSAC', function (data: any) {
120
- console.log(data,'addDataSAC')
121
- checkboxvalue.value.push(data.entityCode)
122
- })
123
112
  })
124
113
 
125
114
  watch(checkboxvalue, (value) => {
126
- if (value.length === 0) return
127
- //获取勾选数据
128
- let codes = ''
129
- value.forEach((item: any) => {
130
- codes += `codes=${item}&`
131
- })
132
- getSelectDataPxoy(codes)
115
+
116
+ getSelectDataPxoy(value)
133
117
  }, {
134
- immediate: false
118
+ immediate: false,
119
+ deep: true
120
+
135
121
  })
136
122
 
137
123
  onUnload(() => {
138
124
  // 取消监听勾选列表页面事件
139
125
  uni.$off('getCheckData')
140
- // 取消监听添加数据完成事件
141
- uni.$off('addDataSAC')
126
+
142
127
  })
143
128
 
144
129
  // 获取页面配置
@@ -230,7 +215,7 @@ async function handleSubmit() {
230
215
  toast.success("保存成功")
231
216
  uni.navigateBack({
232
217
  success: () => {
233
- uni.$emit('addDataSAC', { entityCode:res.data.entityCode,sourceId:res.data.sourceId })
218
+ uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
234
219
  }
235
220
  })
236
221
  } else {
@@ -252,6 +237,10 @@ async function handleSubmit() {
252
237
 
253
238
  //跳转勾选页面数据
254
239
  function selectrow(item: any) {
240
+ //监听勾选列表页面事件
241
+ uni.$on('getCheckData', function (data: any) {
242
+ checkboxvalue.value = data.checkData
243
+ })
255
244
  relationID.value = item.id
256
245
  pointSourceId.value = item.pointSourceId
257
246
  let data = selectData.value[relationID.value]?.map((item) => {
@@ -266,8 +255,16 @@ function selectrow(item: any) {
266
255
  }
267
256
  const selectData = ref({})
268
257
  //获取勾选数据
269
- async function getSelectDataPxoy(codes: string) {
258
+ async function getSelectDataPxoy(values: string[]) {
259
+ if (values.length === 0) return model.value[relationID.value]=[]
260
+ //获取勾选数据
261
+ let codes = ''
262
+ values.forEach((item: any) => {
263
+ codes += `codes=${item}&`
264
+ })
265
+
270
266
  relationLoading[relationID.value] = true
267
+ if (!relationID.value) return
271
268
  const res = await getSelectData(relationID.value, codes)
272
269
  selectData.value[relationID.value] = res.data.entities
273
270
  model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
@@ -278,6 +275,7 @@ async function getSelectDataPxoy(codes: string) {
278
275
 
279
276
  //删除勾选数据
280
277
  const deletItem = (item: any, subitem: any, index: any) => {
278
+ relationID.value = item.id
281
279
  selectData.value[item.id].splice(index, 1)
282
280
  let data = selectData.value[item.id].map((item: any) => {
283
281
  return item.code
@@ -285,8 +283,30 @@ const deletItem = (item: any, subitem: any, index: any) => {
285
283
  checkboxvalue.value = data || []
286
284
  }
287
285
 
286
+ //点击编辑勾选数据按钮
287
+ const editItem=( item: any, subitem: any, index: any )=>{
288
+ relationID.value = item.id
289
+ //监听编辑页面事件
290
+ uni.$on('editeDataSAC', function (data: any) {
291
+
292
+ checkboxvalue.value=selectData.value[item.id].map((item: any) => {
293
+ return item.code
294
+ })
295
+ // 取消监听编辑页面事件
296
+ uni.$off('editeDataSAC')
297
+ })
298
+ }
299
+
288
300
  //新增
289
- const add=(item:any)=>{
301
+ const add = (item: any) => {
302
+ relationID.value = item.id
303
+ //监听添加数据完成事件
304
+ uni.$on('addDataSAC', function (data: any) {
305
+ checkboxvalue.value.push(data.entityCode)
306
+ // 取消监听添加数据完成事件
307
+ uni.$off('addDataSAC')
308
+ })
309
+ //跳转新增页面
290
310
  uni.navigateTo({
291
311
  url: `/pages/add/add?sourceId=${item.pointSourceId}`,
292
312
  })
@@ -47,7 +47,7 @@ export function getValue(content: any, title: any): any {
47
47
  }
48
48
 
49
49
  //文件链接
50
- if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat'))) {
50
+ if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat')|| obj.base?.type.includes('md'))) {
51
51
 
52
52
  return {
53
53
  url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
@@ -81,21 +81,42 @@ function splitString(str: string) {
81
81
  return str
82
82
  }
83
83
 
84
- if (str) {
84
+
85
85
  // 判断是否有 "@R@"
86
86
  if (str.includes('@R@')) {
87
87
  // 分割字符串
88
- const splitStr = str.split('@R@')
89
- // 返回分割后的数组的最后一项
90
- return splitStr[splitStr.length - 1]
88
+ const splitStr =splitStringtoArr(str).map((item:string)=>{
89
+ let splitItem = item.split('@R@')
90
+ return {
91
+ label:splitItem[1],
92
+ value:splitItem[0]
93
+ }
94
+ })
95
+ // 返回分割后的对象数组
96
+ return splitStr
91
97
  }
92
98
  else {
93
99
  // 返回原字符串
94
100
  return str
95
101
  }
96
- }
97
- // 返回原字符串
98
- return str
102
+
103
+ }
104
+
105
+ // 根据 "@,@" 分割字符串,得到数组
106
+ function splitStringtoArr(str: string) {
107
+
108
+ // 判断是否有 "@,@" 字符串
109
+ if (str.includes('@,@')) {
110
+ // 分割字符串
111
+ const splitStr = str.split('@,@')
112
+ // 返回分割后的数组
113
+ return splitStr
114
+ }
115
+ else {
116
+ // 返回原字符串
117
+ return [str]
118
+ }
119
+
99
120
  }
100
121
 
101
122
  // 判断字符串中是否存在'y'字符
package/w-card/w-card.vue CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  import { hasY, getValue, downloadFile } from './utils/utils'
10
10
  import { deletePageData } from '../utils/apis/pageConfig'
11
11
  import { useMessage, useToast } from 'wot-design-uni'
12
- const emits = defineEmits(['refresh', 'delet'])
12
+ const emits = defineEmits(['refresh', 'delet','edit'])
13
13
  const toast = useToast()
14
14
  const message = useMessage()
15
15
  const props = defineProps({
@@ -110,7 +110,7 @@ function toggleExpand() {
110
110
  }
111
111
 
112
112
  // 跳转页页面
113
- function goto(type: string, item: any = {}, subItem: string = '') {
113
+ function goto(type: string, item: any = {}, subItem: any) {
114
114
 
115
115
  switch (type) {
116
116
  case 'detail':
@@ -119,20 +119,17 @@ function goto(type: string, item: any = {}, subItem: string = '') {
119
119
  })
120
120
  break
121
121
  case 'link':
122
- let data = null
123
- if (Array.isArray(item.data)) {
124
- data = item.data.find((item: any) => {
125
- return item.includes(subItem)
126
- }).split('@R@')[0]
127
- } else {
128
- data = item.data.split('@R@')[0]
129
- }
122
+ let code = subItem.value
123
+
130
124
 
131
125
  uni.navigateTo({
132
- url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${data}`,
126
+ url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${code}`,
133
127
  })
134
128
  break
135
129
  case 'edit':
130
+ if (props.actionType === 'relation') {
131
+ emits('edit')
132
+ }
136
133
  uni.navigateTo({
137
134
  url: `/pages/edit/edit?sourceId=${props.sourceId}&code=${props.itemData.code}`,
138
135
  })
@@ -211,8 +208,8 @@ const actionBtn = (item: any) => {
211
208
  </view>
212
209
  <view v-else-if="item.buttons.includes('detail')">
213
210
  <view @click="goto('link', item, subItem)" class="link"
214
- v-for="(subItem, subIndex) in item.content?.split(',')" :key="subIndex">
215
- <text> {{ subItem }}</text>
211
+ v-for="(subItem, subIndex) in item.content" :key="subIndex">
212
+ <text> {{ subItem.label }}</text>
216
213
  </view>
217
214
  </view>
218
215
  <view v-else-if="item.content?.type === '文件'" class="value">
@@ -59,7 +59,15 @@ function getPageData() {
59
59
  }
60
60
 
61
61
  // 跳转详情页
62
- function goto(PItem: any, item: any) {
62
+ function goto(type = '', PItem: any, item: any) {
63
+
64
+ if (type == 'link') {
65
+ uni.navigateTo({
66
+ url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${PItem.value}`
67
+ })
68
+ return
69
+ }
70
+
63
71
  uni.navigateTo({
64
72
  url: `/pages/detail/detail?sourceId=${item.pointSourceId}&code=${PItem.code}`
65
73
  })
@@ -101,6 +109,14 @@ function goto(PItem: any, item: any) {
101
109
  :author="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).author"
102
110
  :name="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name"
103
111
  controls></audio>
112
+
113
+ <view v-else-if="subItem.buttons.includes('detail')">
114
+ <view @click="goto('link', bItem, subItem)" class="link"
115
+ v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
116
+ :key="bIndex">
117
+ <text> {{ bItem.label }}</text>
118
+ </view>
119
+ </view>
104
120
  <view v-else class="value">
105
121
  {{ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
106
122
  </view>
@@ -119,33 +135,39 @@ function goto(PItem: any, item: any) {
119
135
  v-for="(PItem, PIndex) in pageData.arrayMap[item.id]" :key="PIndex">
120
136
  <view v-for="(subItem, subIndex) in item.fields" :key='subIndex' style='margin-bottom: 8px;'>
121
137
  <view v-if="!subItem.hidden" class="row">
122
-
123
- <view class="label">
124
- {{ subItem.title }}:
125
- </view>
126
-
127
- <wd-img
128
- v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
129
- width="100rpx" height="100rpx"
130
- :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
131
- :enable-preview="true" />
132
- <view
133
- v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
134
- class="value">
135
- <wd-text type="primary"
136
- @click="downloadFile(getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url)"
137
- :text="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name" />
138
- </view>
139
- <audio
140
- v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
141
- :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
142
- :author="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).author"
143
- :name="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name"
144
- controls></audio>
145
- <view v-else class="value">
146
- {{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
138
+
139
+ <view class="label">
140
+ {{ subItem.title }}:
141
+ </view>
142
+
143
+ <wd-img v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
144
+ width="100rpx" height="100rpx"
145
+ :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
146
+ :enable-preview="true" />
147
+ <view
148
+ v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
149
+ class="value">
150
+ <wd-text type="primary"
151
+ @click="downloadFile(getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url)"
152
+ :text="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name" />
153
+ </view>
154
+ <audio
155
+ v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
156
+ :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
157
+ :author="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).author"
158
+ :name="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name"
159
+ controls></audio>
160
+ <view v-else-if="subItem.buttons.includes('detail')">
161
+ <view @click="goto('link', bItem, subItem)" class="link"
162
+ v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
163
+ :key="bIndex">
164
+ <text> {{ bItem.label }}</text>
147
165
  </view>
148
-
166
+ </view>
167
+ <view v-else class="value">
168
+ {{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
169
+ </view>
170
+
149
171
  </view>
150
172
  </view>
151
173
 
@@ -179,13 +201,18 @@ function goto(PItem: any, item: any) {
179
201
  word-break: break-all;
180
202
  color: #333;
181
203
  }
204
+
205
+ .link {
206
+ color: #4d80f0;
207
+ }
182
208
  }
183
209
 
184
210
 
185
211
  :deep(.card-custom-class) {
186
212
  margin: 0 !important;
187
213
  }
188
- :deep(.card-custom-class-relation){
214
+
215
+ :deep(.card-custom-class-relation) {
189
216
  margin: 0 0 8px 0 !important;
190
217
  }
191
218
 
package/w-edit/w-edit.vue CHANGED
@@ -12,24 +12,25 @@ export default {
12
12
  <wd-loading />
13
13
  </view>
14
14
  <view v-else>
15
- <wd-collapse v-model="value" >
16
- <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id" v-for="(item, index) in pageConf.groups" :key="index">
17
- <view
18
- v-if="item.type === 'fieldGroup'">
19
- <wd-form ref="form" :model="model">
20
- <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
21
- <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn" v-model:model-value="model[subItem.id]"/>
22
- </wd-cell-group>
23
-
24
- </wd-form>
25
-
26
- </view>
27
- <view v-if="item.type === 'relation'">
28
- <view class="row-add">
15
+ <wd-collapse v-model="value">
16
+ <wd-collapse-item custom-body-class="collapse-custom-class" :title="item.title" :name="item.id"
17
+ v-for="(item, index) in pageConf.groups" :key="index">
18
+ <view v-if="item.type === 'fieldGroup'">
19
+ <wd-form ref="form" :model="model">
20
+ <wd-cell-group v-for="(subItem, subIndex) in item.fields" :key="subIndex">
21
+ <wFromControl :subItem="subItem" :model="model" :Enumcolumn="Enumcolumn"
22
+ v-model:model-value="model[subItem.id]" />
23
+ </wd-cell-group>
24
+
25
+ </wd-form>
26
+
27
+ </view>
28
+ <view v-if="item.type === 'relation'">
29
+ <view class="row-add">
29
30
  <wd-button v-if="item.buttons.includes('selectAdd')" hairline type="info" size="small"
30
31
  icon="add" @click="selectrow(item)">选择</wd-button>
31
32
  <wd-button v-if="item.buttons.includes('dtmplAdd')" hairline type="info" size="small"
32
- icon="add" @click="addrow(item.id)">新增</wd-button>
33
+ icon="add" @click="add(item)">新增</wd-button>
33
34
  </view>
34
35
 
35
36
  <view v-if="relationLoading[item.id]"
@@ -39,7 +40,8 @@ export default {
39
40
 
40
41
  <!-- 卡片 -->
41
42
  <view v-else class="card-list">
42
- <w-card v-for="(subitem, index) in selectData[item.id]" :key="index" :car-index="index"
43
+ <w-card @edit="()=>{editItem(item, subitem, subindex)}" @delet="() => { deletItem(item, subitem, subindex) }" :actionType="item.type"
44
+ v-for="(subitem, subindex) in selectData[item.id]" :key="subindex" :car-index="subindex"
43
45
  :page="{
44
46
  rowActions: item.rowActions || [],
45
47
  buttons: item.buttons || [],
@@ -53,15 +55,15 @@ export default {
53
55
  @click="addrow(item.id)">加一条</wd-button>
54
56
  </view>
55
57
 
56
- </view>
58
+ </view>
57
59
 
58
60
 
59
- </wd-collapse-item>
60
- </wd-collapse>
61
- <view class="footer-button">
62
- <wd-button block @click="handleSubmit" icon="save">保存</wd-button>
61
+ </wd-collapse-item>
62
+ </wd-collapse>
63
+ <view class="footer-button">
64
+ <wd-button block @click="handleSubmit" icon="save">保存</wd-button>
65
+ </view>
63
66
  </view>
64
- </view>
65
67
  <wd-message-box />
66
68
  <wd-popup safe-area-inset-bottom position="right" v-model="showSelectRow" custom-style="width: 100vw;">
67
69
  <WSelectTable :sourceId="pointSourceId">
@@ -81,8 +83,8 @@ export default {
81
83
  import wCard from '../w-card/w-card.vue'
82
84
  import wFromControl from '../w-form-control/w-form-control.vue'
83
85
  import WSelectTable from '../w-table/w-selectTable.vue';
84
- import { onLoad ,onUnload} from '@dcloudio/uni-app'
85
- import { ref, defineProps, reactive ,watch} from 'vue';
86
+ import { onLoad, onUnload } from '@dcloudio/uni-app'
87
+ import { ref, defineProps, reactive, watch } from 'vue';
86
88
  import {
87
89
  editPageConfig,
88
90
  getEnum,
@@ -102,9 +104,9 @@ const props = defineProps({
102
104
  type: String,
103
105
  default: ''
104
106
  },
105
- code:{
106
- type: String,
107
- default: ''
107
+ code: {
108
+ type: String,
109
+ default: ''
108
110
  }
109
111
 
110
112
  })
@@ -125,32 +127,30 @@ const relationID = ref('')
125
127
  const selectData = ref({})
126
128
  onLoad((option: any) => {
127
129
  sourceId.value = props.sourceId || option.sourceId
128
- code.value = props.code|| option.code
130
+ code.value = props.code || option.code
129
131
  getPageConfig()
130
- //监听勾选列表页面事件
131
- uni.$on('getCheckData', function (data: any) {
132
+ //监听勾选列表页面事件
133
+ uni.$on('getCheckData', function (data: any) {
132
134
  checkboxvalue.value = data.checkData
135
+ // 取消监听勾选列表页面事件
136
+ uni.$off('getCheckData')
133
137
  })
138
+
134
139
  })
135
140
  watch(checkboxvalue, (value) => {
136
- if (value.length === 0) return
137
- //获取勾选数据
138
- let codes = ''
139
- value.forEach((item: any) => {
140
- codes += `codes=${item}&`
141
- })
142
- getSelectDataPxoy(codes)
141
+
142
+ getSelectDataPxoy(value)
143
143
  }, {
144
- immediate: false
144
+ immediate: false,
145
+ deep: true
145
146
  })
146
147
  onUnload(() => {
147
- // 取消监听勾选列表页面事件
148
- uni.$off('getCheckData')
148
+
149
149
  })
150
150
  //获取页面配置
151
151
  function getPageConfig() {
152
152
  loading.value = true
153
- editPageConfig(sourceId.value,code.value).then((res: any) => {
153
+ editPageConfig(sourceId.value, code.value).then((res: any) => {
154
154
  pageConf.value = res.data.dtmplConfig
155
155
  let fieldGroup = {}
156
156
  let relation = {}
@@ -158,7 +158,7 @@ function getPageConfig() {
158
158
  value.value.push(item.id)
159
159
  if (item.type === 'relation') {
160
160
  let t = []
161
- t=res.data.dtmplConfig.entity?.arrayMap[item.id]?.map((item:any)=>item.code)
161
+ t = res.data.dtmplConfig.entity?.arrayMap[item.id]?.map((item: any) => item.code)
162
162
  relation[item.id] = t
163
163
  relationLoading[item.id] = false
164
164
  selectData.value[item.id] = res.data.dtmplConfig.entity?.arrayMap[item.id] || []
@@ -167,14 +167,14 @@ function getPageConfig() {
167
167
  item.fields.forEach((subItem: any) => {
168
168
  fieldGroup[subItem.id] = res.data.dtmplConfig.entity?.fieldMap[subItem.id] || ''
169
169
  })
170
- fieldGroup['唯一编码']=res.data.dtmplConfig.entity?.code
170
+ fieldGroup['唯一编码'] = res.data.dtmplConfig.entity?.code
171
171
  }
172
172
 
173
173
  })
174
174
  model.value = {
175
175
  ...relation,
176
176
  ...fieldGroup,//一般为基本信息
177
- 唯一编码:res.data.dtmplConfig.entity?.code
177
+ 唯一编码: res.data.dtmplConfig.entity?.code
178
178
  }
179
179
  getEnumer()
180
180
  loading.value = false
@@ -197,8 +197,16 @@ async function getEnumer() {
197
197
  }
198
198
 
199
199
  //获取勾选数据
200
- async function getSelectDataPxoy(codes: string) {
200
+ async function getSelectDataPxoy(values: string[]) {
201
+ if (values.length === 0) return model.value[relationID.value]=[]
202
+ //获取勾选数据
203
+ let codes = ''
204
+ values.forEach((item: any) => {
205
+ codes += `codes=${item}&`
206
+ })
207
+
201
208
  relationLoading[relationID.value] = true
209
+ if (!relationID.value) return
202
210
  const res = await getSelectData(relationID.value, codes)
203
211
  selectData.value[relationID.value] = res.data.entities
204
212
  model.value[relationID.value] = selectData.value[relationID.value].map((item: any) => {
@@ -232,21 +240,25 @@ async function handleSubmit() {
232
240
  })
233
241
  }
234
242
  })
235
- data['唯一编码']=model.value['唯一编码']
243
+ data['唯一编码'] = model.value['唯一编码']
236
244
  try {
237
245
  const res = await addPageDataSave(sourceId.value, data)
238
- if (res.data.status==='success'){
246
+ if (res.data.status === 'success') {
239
247
  toast.success("保存成功")
240
- uni.navigateBack()
241
- }else{
242
- toast.error(res.data.message||'保存失败"')
248
+ uni.navigateBack({
249
+ success: () => {
250
+ uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
251
+ }
252
+ })
253
+ } else {
254
+ toast.error(res.data.message || '保存失败"')
243
255
  }
244
-
256
+
245
257
  } catch (error) {
246
258
  toast.error(error)
247
259
  }
248
260
 
249
-
261
+
250
262
  }
251
263
  })
252
264
  .catch((error) => {
@@ -259,17 +271,57 @@ async function handleSubmit() {
259
271
  function selectrow(item: any) {
260
272
  relationID.value = item.id
261
273
  pointSourceId.value = item.pointSourceId
262
- let data=selectData.value[relationID.value]?.map((item)=>{
274
+ let data = selectData.value[relationID.value]?.map((item) => {
263
275
  return item.code
264
276
  })
265
277
  uni.navigateTo({
266
278
  url: `/pages/selectTable/selectTable?sourceId=${pointSourceId.value}`,
267
279
  success: () => {
268
- uni.$emit('checkeDData', { checkData: data||[] })
280
+ uni.$emit('checkeDData', { checkData: data || [] })
269
281
  }
270
282
  })
271
283
  }
272
284
 
285
+ //删除勾选数据
286
+ const deletItem = (item: any, subitem: any, index: any) => {
287
+ relationID.value = item.id
288
+ selectData.value[item.id].splice(index, 1)
289
+ let data = selectData.value[item.id].map((item: any) => {
290
+ return item.code
291
+ })
292
+ checkboxvalue.value = data || []
293
+ }
294
+
295
+ //点击编辑勾选数据按钮
296
+ const editItem=( item: any, subitem: any, index: any )=>{
297
+ relationID.value = item.id
298
+ //监听编辑页面事件
299
+ uni.$on('editeDataSAC', function (data: any) {
300
+
301
+ checkboxvalue.value=selectData.value[item.id].map((item: any) => {
302
+ return item.code
303
+ })
304
+ // 取消监听编辑页面事件
305
+ uni.$off('editeDataSAC')
306
+ })
307
+ }
308
+
309
+ //新增
310
+ const add = (item: any) => {
311
+ relationID.value = item.id
312
+ //监听添加数据完成事件
313
+ uni.$on('addDataSAC', function (data: any) {
314
+ checkboxvalue.value.push(data.entityCode)
315
+ // 取消监听添加数据完成事件
316
+ uni.$off('addDataSAC')
317
+ })
318
+ //跳转新增页面
319
+ uni.navigateTo({
320
+ url: `/pages/add/add?sourceId=${item.pointSourceId}`,
321
+ })
322
+ }
323
+
324
+
273
325
  //新加一行
274
326
  function addrow(key: any) {
275
327
 
@@ -9,23 +9,26 @@
9
9
  label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
10
10
  :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
11
11
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :columns="Enumcolumn[subItem.mstrucId]"
12
- @confirm="(e) => { change(e) }" @clear="clear"/>
12
+ @confirm="(e) => { change(e) }" @clear="clear" />
13
13
  <wd-textarea auto-height v-else-if="subItem.extControlType === 'textarea'" :disabled="subItem.disabled"
14
14
  :label="subItem.title" label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
15
15
  :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
16
- :rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }" @clear="clear"/>
16
+ :rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
17
+ @clear="clear" />
17
18
  <wd-input v-else-if="subItem.extControlType === 'decimal' || subItem.extControlType === 'int'"
18
19
  :disabled="subItem.disabled" :label="subItem.title" label-width="100px" :prop="subItem.id" clearable
19
20
  :modelValue="modelValue" type="number" :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
20
- :rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }" @clear="clear"/>
21
+ :rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
22
+ @clear="clear" />
21
23
  <wd-calendar v-else-if="subItem.extControlType === 'datetime'" :disabled="subItem.disabled" :label="subItem.title"
22
24
  label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue" type="datetime"
23
25
  :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
24
- :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }" @clear="clear"/>
26
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
27
+ @clear="clear" />
25
28
  <wSelectPicker @confirm="wSelectPickerconfirm" :prop="subItem.id" v-else-if="subItem.extControlType === 'relselect'"
26
- :modelValue="modelValue" :disabled="subItem.disabled" :label="subItem.title" type="radio"
29
+ :modelValue="modelValue" :disabled="subItem.disabled" :label="subItem.title" :type="subItem.max===1?'radio':'checkbox'"
27
30
  :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`" :source-id="subItem.sourceId" filterable
28
- :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @clear="clear"/>
31
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @clear="clear" />
29
32
  <wd-cell v-else-if="subItem.extControlType === 'file'"
30
33
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}文件` }]" :title="subItem.title"
31
34
  title-width="100px" :prop="subItem.id">
@@ -34,9 +37,8 @@
34
37
  :file-list="modelValue" :disabled="subItem.disabled" :action="`${baseUrl}/v3/upload`"
35
38
  @success="success"></wd-upload>
36
39
  </wd-cell>
37
- <wd-input v-else :disabled="subItem.disabled" :label="subItem.title"
38
- label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
39
- :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
40
+ <wd-input v-else :disabled="subItem.disabled" :label="subItem.title" label-width="100px" :prop="subItem.id"
41
+ clearable :modelValue="modelValue" :placeholder="subItem.disabled ? '无需输入' : `请输入${subItem.title}`"
40
42
  :rules="[{ required: subItem.required, message: `请填写${subItem.title}` }]" @input="(e) => { change(e) }"
41
43
  @clear="clear" />
42
44
  </view>
@@ -75,7 +77,20 @@ const modelValue = computed(() => {
75
77
  return props.model[props.subItem.id] ? dayjs(props.model[props.subItem.id]).valueOf() : null
76
78
 
77
79
  case 'relselect':
78
- return props.model[props.subItem.id] ? props.model[props.subItem.id].split('@R@')[0] : ''
80
+ if (props.subItem.max === 1) {
81
+ return props.model[props.subItem.id] ? props.model[props.subItem.id].split('@R@')[0] : ''
82
+ } else {
83
+ if(!props.model[props.subItem.id]) return []
84
+
85
+ let selectArr= props.model[props.subItem.id].split('@,@')
86
+
87
+ let selectArr2= selectArr.map((item:any)=>{
88
+ return item.split('@R@')[0]
89
+ })
90
+
91
+ return selectArr2
92
+ }
93
+
79
94
  case 'file':
80
95
  return props.model[props.subItem.id] ? JSON.parse(props.model[props.subItem.id]).valid === 'new' ? [{ url: JSON.parse(props.model[props.subItem.id]).base.path }] : [{ url: baseUrl + "/v3/files" + JSON.parse(props.model[props.subItem.id]).base.path }] : []
81
96
 
@@ -97,7 +112,11 @@ const success = (e: any) => {
97
112
  const wSelectPickerconfirm = (e) => {
98
113
  console.log(e)
99
114
  if (Array.isArray(e.selectedItems)) {
100
-
115
+ let selectArr1= e.selectedItems.map((item:any)=>{
116
+ return `${item.value}@R@${item.label}`
117
+ })
118
+ let selectArr= selectArr1.join('@,@')
119
+ emit('update:modelValue', selectArr)
101
120
  } else {
102
121
  emit('update:modelValue', `${e.selectedItems.value}@R@${e.selectedItems.label}`)
103
122
  }
@@ -114,8 +114,11 @@ const search = () => {
114
114
  data.push(d)
115
115
  break;
116
116
  case 'entity-select':
117
+ d = `c_${key}=${element.value}@R@${element.label}`
118
+ data.push(d)
119
+ break;
117
120
  case 'relselectvalue':
118
- console.log(element)
121
+
119
122
  d = `c_${key}=${element.label}`
120
123
  data.push(d)
121
124
  break;