n20-common-lib 2.22.24 → 2.22.25

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": "n20-common-lib",
3
- "version": "2.22.24",
3
+ "version": "2.22.25",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,28 +1,13 @@
1
1
  <template>
2
- <div
3
- class="w-100p flex-box"
4
- :style="{
5
- display: 'grid',
6
- flexWrap: 'wrap',
7
- gridTemplateColumns: `repeat(${columns}, 1fr)`,
8
- gap: '16px',
9
- padding: '0',
10
- overflowX: 'hidden'
11
- }"
12
- >
13
- <div v-for="(item, i) in otherAttData" :key="i" class="flex-box" style="width: 100%; padding: 0 20px">
2
+ <div class="w-100p">
3
+ <div v-for="(item, i) in otherAttData" :key="i" class="flex-box m-l-m m-r-m">
14
4
  <el-form-item
15
5
  class="m-r-ss m-b-s"
16
- :label-width="labelWidth"
17
6
  :class="item.cfgHasRemark === '1' ? 'flex-auto' : 'flex-1'"
18
7
  :label="item.cfgName"
19
8
  >
20
9
  <span slot="label">
21
- <span
22
- v-title="item.cfgName"
23
- style="display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
24
- :style="{ maxWidth: labelWidth }"
25
- >
10
+ <span style="display: inline-block; white-space: wrap">
26
11
  <span v-if="required" style="color: red">*</span>
27
12
  {{ item.cfgName }}
28
13
  </span>
@@ -56,20 +41,10 @@
56
41
  >
57
42
  <el-option v-for="(row, i) in JSON.parse(item.cfgJson)" :key="i" :label="row.value" :value="row.code" />
58
43
  </el-select>
59
- <el-radio-group
60
- v-if="item.cfgType === '22'"
61
- v-model="item.cfgVal"
62
- class="input-w"
63
- @change="(val) => changeFn(val, item)"
64
- >
44
+ <el-radio-group v-if="item.cfgType === '22'" v-model="item.cfgVal" @change="(val) => changeFn(val, item)">
65
45
  <el-radio v-for="(row, i) in JSON.parse(item.cfgJson)" :key="i" :label="row.code">{{ row.value }}</el-radio>
66
46
  </el-radio-group>
67
- <el-checkbox-group
68
- v-if="item.cfgType === '32'"
69
- v-model="item.checkList"
70
- class="input-w"
71
- @change="(val) => changeFn(val, item)"
72
- >
47
+ <el-checkbox-group v-if="item.cfgType === '32'" v-model="item.checkList" @change="(val) => changeFn(val, item)">
73
48
  <el-checkbox v-for="(row, i) in JSON.parse(item.cfgJson || '[]')" :key="i" :label="row.code">{{
74
49
  row.value
75
50
  }}</el-checkbox>
@@ -105,18 +80,10 @@
105
80
  import axios from '../../utils/axios'
106
81
  export default {
107
82
  props: {
108
- labelWidth: {
109
- type: String,
110
- default: '12em'
111
- },
112
83
  taskId: {
113
84
  type: [String, Number],
114
85
  default: ''
115
86
  },
116
- columns: {
117
- type: Number,
118
- default: 1
119
- },
120
87
  form: {
121
88
  type: Object,
122
89
  default: () => ({})
@@ -143,6 +110,34 @@ export default {
143
110
  this.getData(this.otherAttDataA)
144
111
  },
145
112
  methods: {
113
+ setDefaultValue(item) {
114
+ const defaultTypes = ['22', '21', '31', '32']
115
+ // 不满足条件的直接返回
116
+ if (!defaultTypes.includes(item.cfgType) || item.cfgVal) return
117
+
118
+ try {
119
+ // 解析cfgJson,获取默认选项
120
+ const cfgJson = JSON.parse(item.cfgJson || '[]')
121
+ const defaultItems = cfgJson.filter((row) => row.isDefault === '1')
122
+ if (!defaultItems.length) return
123
+ // 获取默认选项的code值
124
+ const defaultCodes = defaultItems.map((row) => row.code)
125
+ if (['22', '21'].includes(item.cfgType)) {
126
+ item.cfgVal = defaultCodes[0]
127
+ item.cfgText = defaultItems[0]?.value
128
+ } else if (['31', '32'].includes(item.cfgType)) {
129
+ item.cfgVal = defaultCodes.join(',')
130
+ item.cfgText = defaultItems.map((row) => row.value).join(',')
131
+ if (item.cfgType === '31') {
132
+ item.selectList = defaultCodes
133
+ } else {
134
+ item.checkList = defaultCodes
135
+ }
136
+ }
137
+ } catch (e) {
138
+ // JSON解析失败时忽略
139
+ }
140
+ },
146
141
  getData(data) {
147
142
  if (data.length) {
148
143
  this.otherAttData = data
@@ -155,6 +150,10 @@ export default {
155
150
  if (['32'].includes(item.cfgType)) {
156
151
  item.checkList = item.checkList ? item.checkList : []
157
152
  }
153
+ if (['31'].includes(item.cfgType)) {
154
+ item.selectList = item.selectList ? item.selectList : []
155
+ }
156
+ this.setDefaultValue(item)
158
157
  return item
159
158
  }) || []
160
159
  }
@@ -33,9 +33,9 @@
33
33
  </el-form-item>
34
34
  </el-form>
35
35
  <ExpandablePane v-if="otherAttDataA.length > 0" title="自定义项" :default-expand="true">
36
- <el-form ref="approveBtnGroup" label-position="right" :label-width="labelWidth">
36
+ <el-form ref="approveBtnGroup" label-position="top">
37
37
  <div
38
- class="p-b-lg p-t-lg p-r-lg"
38
+ class="p-b-s p-t-s"
39
39
  style="max-height: 350px; overflow-y: auto; border: 1px dashed var(--border-color-base); border-radius: 5px"
40
40
  >
41
41
  <show-other-att-new
@@ -44,8 +44,6 @@
44
44
  :other-att-data-a="otherAttDataA"
45
45
  :proc-inst-id="procInstId || this.$route.query.processInstanceId"
46
46
  :required="true"
47
- :columns="columns"
48
- :label-width="labelWidth"
49
47
  />
50
48
  </div>
51
49
  </el-form>
@@ -71,14 +69,7 @@ export default {
71
69
  type: String,
72
70
  default: '85%'
73
71
  },
74
- labelWidth: {
75
- type: String,
76
- default: '12em'
77
- },
78
- columns: {
79
- type: Number,
80
- default: 1
81
- },
72
+
82
73
  afterGetConf: {
83
74
  type: Function,
84
75
  default: undefined