cnhis-design-vue 3.0.3 → 3.0.6

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,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.0.3",
4
+ "version": "3.0.6",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
7
7
  "scripts": {
@@ -2,21 +2,16 @@ import type { App } from "vue";
2
2
  // import XEUtils from "xe-utils";
3
3
  // 导入组件
4
4
  import BigTable from "./src/BigTable.vue"
5
- import FieldSet from './src/FieldSet.vue'
6
5
 
7
6
  // type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
8
7
 
9
8
  // 为组件提供 install 安装方法,供按需引入
10
9
  BigTable.install = function(app: App) {
11
10
  app.component(BigTable.name, BigTable);
12
- app.component(FieldSet.name, FieldSet)
13
11
  // app.config.globalProperties.$utils = XEUtils;
14
12
  };
15
13
 
16
14
  // const CBigTable: SFCWithInstall<typeof BigTable> = BigTable; // 增加类型
17
15
 
18
- Object.assign(BigTable, {
19
- FieldSet
20
- });
21
16
  // 默认导出组件
22
17
  export default BigTable;
@@ -176,9 +176,9 @@ import { SettingsSharp, SyncOutline, CopyOutline, CaretDown, CaretForward } from
176
176
  import NoData from "./components/NoData.vue";
177
177
  import TextOverTooltip from "./components/TextOverTooltip.vue";
178
178
  import SvgIcon from '@/component/svg/index.vue';
179
- import EditSelectTable from './components/edit-form/edit-select-table.vue'
180
179
  import EditInput from './components/edit-form/edit-input.vue'
181
180
  import EditSelect from './components/edit-form/edit-select.vue'
181
+ import EditDate from './components/edit-form/edit-date.vue'
182
182
  import {
183
183
  NButton,
184
184
  NCheckbox,
@@ -271,7 +271,7 @@ const {
271
271
  recordClickBtnInfo,
272
272
  getInlineOpreateRow
273
273
  }: any = useBatchEditing(props, state, emit, xGrid);
274
- const { initEditTable, activeMethod, deleteRow, onClickSelectTable, onUpdateInput, getDefaultValue } = useEdit(props, state, emit, xGrid)
274
+ const { initEditTable, activeMethod, deleteRow, onClickSelectTable, onFormChange, getDefaultValue } = useEdit(props, state, emit, xGrid)
275
275
 
276
276
  const {
277
277
  isAboutNestTable,
@@ -377,7 +377,7 @@ const unBindDocumentClick = () => {
377
377
  }
378
378
  onMounted(() => {
379
379
  bindDocumentClick();
380
- state.tableHeight = handleTableHeight(state, props);
380
+ state.tableHeight = handleTableHeight(state, props) || 'auto';
381
381
 
382
382
  // // 子列表在mounted后初始化 直接watch无法触发
383
383
  if (!props.isNestTable) return;
@@ -706,13 +706,6 @@ const formatColumns = (map: any) => {
706
706
  const formatterEdit = (params: any, col: any) => {
707
707
  let { row, column, $rowIndex, rowIndex } = params
708
708
  let formType = column.formType || col.formType || ''
709
- // if (formType === 'selectTable') {
710
- // const propsData = {
711
- // row,
712
- // col
713
- // }
714
- // return <EditSelectTable {...propsData} v-model={[row[col.columnName], 'value']} onClickSelectTable={onClickSelectTable} />
715
- // }
716
709
  if (formType === 'custom') {
717
710
  return col.slotFn(params)
718
711
  }
@@ -722,14 +715,17 @@ const formatterEdit = (params: any, col: any) => {
722
715
  index: $rowIndex
723
716
  }
724
717
  if (formType === 'input' || formType === 'number') {
725
- return <EditInput {...propsData} type={formType} v-model={[row[col.columnName], 'value']} onUpdateInput={onUpdateInput} />
718
+ return <EditInput {...propsData} type={formType} v-model={[row[col.columnName], 'value']} onFormChange={onFormChange} />
726
719
  }
727
720
  if (formType === 'select') {
728
- return <EditSelect {...propsData} v-model={[row[col.columnName], 'value']} onSetOptions={(options: any[]) => row[`${col.columnName}_options`] = options} />
721
+ return <EditSelect {...propsData} v-model={[row[col.columnName], 'value']} onSetOptions={(options: any[]) => row[`${col.columnName}_options`] = options} onFormChange={onFormChange} />
722
+ }
723
+ if (formType === 'date') {
724
+ return <EditDate {...propsData} v-model={[row[col.columnName], 'formattedValue']} onFormChange={onFormChange} />
729
725
  }
730
726
  }
731
727
  const getEditBtn = (row: any, col: any, index: number) => {
732
- return col.tileBtnList.map((btn: any) => {
728
+ return col.tileBtnList?.map((btn: any) => {
733
729
  if (btn.settingObj[0].trigger_type === 'DELETE') {
734
730
  return <NPopconfirm
735
731
  onPositiveClick={() => deleteRow(row, col, index)}
@@ -1,7 +1,8 @@
1
+ /*
1
2
  @font-face {
2
- font-family: "iconfont"; /* Project id */
3
+ font-family: "iconfont";
3
4
  src: url('iconfont.ttf?t=1631151904509') format('truetype');
4
- }
5
+ }*/
5
6
 
6
7
  .iconfont {
7
8
  font-family: "iconfont" !important;
@@ -41,9 +41,11 @@
41
41
  display: inline-block;
42
42
  }
43
43
 
44
+ /*
44
45
  .sort-icon-asc {
45
46
  background-image: url('../img/icon-asc.png');
46
47
  }
48
+ */
47
49
 
48
50
  .sort-text {
49
51
  margin-left: 11px;
@@ -52,9 +54,11 @@
52
54
  color: rgba(0, 0, 0, 0.8);
53
55
  }
54
56
 
57
+ /*
55
58
  .sort-icon-desc {
56
59
  background-image: url('../img/icon-desc.png');
57
60
  }
61
+ */
58
62
 
59
63
  .filter-header {
60
64
  padding: 0 13px;
@@ -41,8 +41,7 @@ const bigTableEmits: string[] = [
41
41
  "selectionChangeLocal",
42
42
  "switchBtnOnChange",
43
43
  "asyncTableChange",
44
- // "clickSelectTable"
45
- "updateInput"
44
+ "formChange"
46
45
  ];
47
46
 
48
47
  export default bigTableEmits;
@@ -0,0 +1,42 @@
1
+ <script lang="tsx">
2
+ import { defineComponent, ref, reactive, resolveComponent } from 'vue'
3
+ import { NDatePicker } from 'naive-ui'
4
+
5
+ export default defineComponent({
6
+ name: 'EditDate',
7
+ inheritAttrs: false,
8
+ components: {
9
+ NDatePicker
10
+ },
11
+ props: {
12
+ col: {
13
+ type: Object,
14
+ default: () => ({})
15
+ },
16
+ row: {
17
+ type: Object,
18
+ default: () => ({})
19
+ },
20
+ index: {
21
+ type: [Number, Object],
22
+ default: 0
23
+ }
24
+ },
25
+ emits: ['formChange'],
26
+ setup (props, { attrs, slots, emit }) {
27
+ const onConfirm = (value: number | [number, number] | null, formattedValue: string | [string, string] | null) => {
28
+ console.log('时间选择->', value)
29
+ emit('formChange', { value, row: props.row, column: props.col, index: props.index })
30
+ }
31
+ const config = {
32
+ type: props.col.type || 'datetime',
33
+ clearable: props.col.clearable || true,
34
+ disabled: props.col.disabled || false,
35
+ valueFormat: props.col.valueFormat || 'yyyy-MM-dd HH:mm:ss',
36
+ to: false
37
+ }
38
+ return () => <NDatePicker {...attrs} {...config} onConfirm={onConfirm} />
39
+ }
40
+ })
41
+ </script>
42
+ <style lang="less" scoped></style>
@@ -27,10 +27,10 @@ export default defineComponent({
27
27
  default: 0
28
28
  }
29
29
  },
30
- emits: ['updateInput'],
30
+ emits: ['formChange'],
31
31
  setup (props, { attrs, slots, emit }) {
32
32
  const onUpdateValue = (value: number | string | null) => {
33
- emit('updateInput', { value, row: props.row, column: props.col, index: props.index })
33
+ emit('formChange', { value, row: props.row, column: props.col, index: props.index })
34
34
  }
35
35
  return () => props.type === 'input' ? <NInput {...attrs} onUpdateValue={onUpdateValue } /> : <NInputNumber {...attrs} onUpdateValue={onUpdateValue} />
36
36
  }
@@ -11,14 +11,18 @@ export default defineComponent({
11
11
  props: {
12
12
  col: {
13
13
  type: Object,
14
- default: () => {}
14
+ default: () => ({})
15
15
  },
16
16
  row: {
17
17
  type: Object,
18
- default: () => {}
18
+ default: () => ({})
19
+ },
20
+ index: {
21
+ type: [Number, Object],
22
+ default: 0
19
23
  }
20
24
  },
21
- emits: ['setOptions'],
25
+ emits: ['setOptions', 'formChange'],
22
26
  setup (props, { attrs, slots, emit }) {
23
27
 
24
28
  const state = reactive({
@@ -40,6 +44,10 @@ export default defineComponent({
40
44
 
41
45
  setOptions()
42
46
 
47
+ const onUpdateValue = (value: any[] | string | number | null) => {
48
+ emit('formChange', { value, row: props.row, column: props.col, index: props.index })
49
+ }
50
+
43
51
  return () => [
44
52
  <NSelect
45
53
  {...attrs}
@@ -49,6 +57,7 @@ export default defineComponent({
49
57
  filterable
50
58
  to={false}
51
59
  placeholder="请选择"
60
+ onUpdateValue={onUpdateValue}
52
61
  />
53
62
  ]
54
63
  }
@@ -71,8 +71,8 @@ export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
71
71
  xGrid.value.clearActived()
72
72
  }
73
73
 
74
- const onUpdateInput = ({ value, row, column }: {value: number | string | null, row: any, column: any}) => {
75
- emit('updateInput', { value, row, column })
74
+ const onFormChange = ({ value, row, column }: {value: number | string | null, row: any, column: any}) => {
75
+ emit('formChange', { value, row, column })
76
76
  }
77
77
 
78
78
  const getDefaultValue = (params: any, item: any) => {
@@ -94,7 +94,7 @@ export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
94
94
  activeMethod,
95
95
  deleteRow,
96
96
  onClickSelectTable,
97
- onUpdateInput,
97
+ onFormChange,
98
98
  getDefaultValue
99
99
  }
100
100
  }
@@ -58,17 +58,16 @@ interface Props {
58
58
  previewText?: string
59
59
  formatEditText?: string
60
60
  identityVerificationTitle?: string
61
- params: any[],
62
- hisParams: any
61
+ params?: any[],
63
62
  prevFn?: Function
64
63
  verifyUser?: Function
65
64
  queryPrintFormatByNumber: Function
66
65
  queryTemplateParams?: Function
67
66
  strategy?: string
68
- versionType?: number | string
67
+ printParams?: any[]
69
68
  }
70
69
  const props = withDefaults(defineProps<Props>(), {
71
- // baseUrl: '',
70
+ params: () => ([]),
72
71
  btnText: '打印',
73
72
  printText: '直接打印',
74
73
  previewText: '打印预览',
@@ -79,7 +78,6 @@ const props = withDefaults(defineProps<Props>(), {
79
78
  queryPrintFormatByNumber: () => Promise.resolve({}),
80
79
  queryTemplateParams: () => Promise.resolve({}),
81
80
  strategy: 'MULTI',
82
- versionType: '2'
83
81
  });
84
82
  const emit = defineEmits(['success', 'error']);
85
83
 
@@ -140,36 +138,8 @@ const prevFnError = () => {
140
138
  };
141
139
  emit('error', error);
142
140
  }
143
- const getHisParams = (index: number = 0) => {
144
- const { reportid = '280' } = (props.hisParams as any);
145
- const { id, name } = (state.templateParams as any);
146
- return {
147
- reportid,
148
- formatid: state.currentFormatId || id,
149
- formatname: name,
150
- param: props.params[index]
151
- };
152
- }
153
- const getOnceHisParams = () => {
154
- const { reportid = '280' } = (props.hisParams as any);
155
- const { id, name } = (state.templateParams as any);
156
- const obj: any = {}
157
- Object.keys((props.params as any)[0]).forEach(v => {
158
- obj[v] = [];
159
- props.params.forEach((k: any) => {
160
- obj[v].push(k[v]);
161
- });
162
- obj[v] = obj[v].join(',');
163
- });
164
- return {
165
- reportid,
166
- formatid: state.currentFormatId || id,
167
- formatname: name,
168
- param: obj
169
- };
170
- }
171
141
  const getPrintParams = (index: number = 0) => {
172
- const params = state.printParams[index];
142
+ const params = props.printParams?.length ? props.printParams[index] : state.printParams[index];
173
143
  return JSON.stringify(params);
174
144
  }
175
145
  const getOnceParams = () => {
@@ -215,55 +185,30 @@ const handleClickPrint = () => {
215
185
  return Promise.reject();
216
186
  })
217
187
  .then(() => {
218
- if (props.versionType == 1 || props.versionType == 3) {
219
- const printFn = props.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
220
- if (props.strategy === 'MULTI') {
221
- for (let i = 0; i < props.params.length; i++) {
222
- const params = getHisParams(i);
223
- printInstance[printFn](7, params)
224
- .then((res: any) => {
225
- console.log(res, '777777777777');
226
- })
227
- .catch((error:any) => {
228
- console.log(error, 'error777');
229
- });
230
- }
231
- } else {
232
- const params = getOnceHisParams();
233
- printInstance[printFn](7, params)
234
- .then((res: any) => {
235
- console.log(res, '777777777777');
236
- })
237
- .catch((error:any) => {
238
- console.log(error, 'error777');
239
- });
240
- }
241
- } else {
242
- if (props.strategy === 'MULTI') {
243
- // 循环多条
244
- for (let i = 0; i < state.printParams.length; i++) {
245
- const queryParams = {
246
- formatId: state.currentFormatId,
247
- templateId: getTemplateIdByFormatId(state.currentFormatId),
248
- params: getPrintParams(i)
249
- };
250
- printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
251
- }
252
- } else {
253
- // 聚合一条
188
+ if (props.strategy === 'MULTI') {
189
+ // 循环多条
190
+ for (let i = 0; i < state.printParams.length; i++) {
254
191
  const queryParams = {
255
192
  formatId: state.currentFormatId,
256
193
  templateId: getTemplateIdByFormatId(state.currentFormatId),
257
- params: getOnceParams()
194
+ params: getPrintParams(i)
258
195
  };
259
- printInstance.printDirect(
260
- queryParams,
261
- (res: any) => {
262
- callLocalServicesSuccessCb(res, 'print');
263
- },
264
- callLocalServicesErrorCb
265
- );
196
+ printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
266
197
  }
198
+ } else {
199
+ // 聚合一条
200
+ const queryParams = {
201
+ formatId: state.currentFormatId,
202
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
203
+ params: getOnceParams()
204
+ };
205
+ printInstance.printDirect(
206
+ queryParams,
207
+ (res: any) => {
208
+ callLocalServicesSuccessCb(res, 'print');
209
+ },
210
+ callLocalServicesErrorCb
211
+ );
267
212
  }
268
213
  })
269
214
  .finally(() => {
@@ -277,31 +222,19 @@ const handleClickPreview = async () => {
277
222
  return Promise.reject();
278
223
  })
279
224
  .then(() => {
280
- if (props.versionType == 1 || props.versionType == 3) {
281
- const params = props.strategy === 'MULTI' ? getHisParams() : getOnceHisParams();
282
- const printFn = props.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
283
- printInstance[printFn](8, params)
284
- .then((res: any) => {
285
- console.log(res, 88888888);
286
- })
287
- .catch((error: any) => {
288
- console.log(error, 'error888');
289
- });
290
- } else {
291
- const params = props.strategy === 'MULTI' ? getPrintParams() : getOnceParams();
292
- const queryParams = {
293
- formatId: state.currentFormatId,
294
- templateId: getTemplateIdByFormatId(state.currentFormatId),
295
- params
296
- };
297
- printInstance.preview(
298
- queryParams,
299
- (res: any) => {
300
- callLocalServicesSuccessCb(res, 'preview');
301
- },
302
- callLocalServicesErrorCb
303
- );
304
- }
225
+ const params = props.strategy === 'MULTI' ? getPrintParams() : getOnceParams();
226
+ const queryParams = {
227
+ formatId: state.currentFormatId,
228
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
229
+ params
230
+ };
231
+ printInstance.preview(
232
+ queryParams,
233
+ (res: any) => {
234
+ callLocalServicesSuccessCb(res, 'preview');
235
+ },
236
+ callLocalServicesErrorCb
237
+ );
305
238
  })
306
239
  .finally(() => {
307
240
  state.visible = false;
@@ -314,19 +247,7 @@ const handleClickEdit = () => {
314
247
  return Promise.reject();
315
248
  })
316
249
  .then(() => {
317
- if (props.versionType == 1 || props.versionType == 3) {
318
- const params = props.strategy === 'MULTI' ? getHisParams() : getOnceHisParams();
319
- const printFn = props.versionType == 1 ? 'handleHisPrint' : 'handleOldHisPrint'
320
- printInstance[printFn](9, params)
321
- .then((res: any) => {
322
- console.log(res, 999999);
323
- })
324
- .catch((error: any) => {
325
- console.log(error, 'error999');
326
- });
327
- } else {
328
- state.identityVerification.visible = true;
329
- }
250
+ state.identityVerification.visible = true;
330
251
  })
331
252
  .finally(() => {
332
253
  state.visible = false;
@@ -383,12 +304,6 @@ const setOptions = () => {
383
304
  children
384
305
  })
385
306
  }
386
- const initHIS = (formatListResult: any) => {
387
- state.formatList = formatListResult ? formatListResult.list.filter((item: any) => item.printmark == 1) : [];
388
- setOptions();
389
- state.currentFormatId = getDefaultFormatId(state.formatList, 'printmark');
390
- state.templateParams = state.formatList[0];
391
- }
392
307
  const formatFormatList = (list: any[]): any => {
393
308
  let formatList: any[] = [];
394
309
 
@@ -459,7 +374,7 @@ const formatParams = ({ customizeDataset = [], param = [] }, params: any[] = [])
459
374
  }
460
375
  const initCRM = async (formatListResult: any) => {
461
376
  state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
462
- setOptions();
377
+ console.log('formatListResult', formatListResult)
463
378
  state.currentFormatId = getDefaultFormatId(state.formatList, 'defaultFlag');
464
379
 
465
380
  if (!state.currentFormatId) {
@@ -488,11 +403,7 @@ const init = async () => {
488
403
 
489
404
  instantiatePrintSDK();
490
405
  const formatListResult = await props.queryPrintFormatByNumber()
491
- if (props.versionType == 1 || props.versionType == 3) {
492
- initHIS(formatListResult);
493
- } else {
494
- await initCRM(formatListResult);
495
- }
406
+ await initCRM(formatListResult);
496
407
 
497
408
  setLoaded();
498
409
 
@@ -0,0 +1,15 @@
1
+ import type { App } from "vue";
2
+ // 导入组件
3
+ import FieldSet from './src/FieldSet.vue'
4
+
5
+ // type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
6
+
7
+ // 为组件提供 install 安装方法,供按需引入
8
+ FieldSet.install = function(app: App) {
9
+ app.component(FieldSet.name, FieldSet);
10
+ };
11
+
12
+ // const CBigTable: SFCWithInstall<typeof BigTable> = BigTable; // 增加类型
13
+
14
+ // 默认导出组件
15
+ export default FieldSet;
@@ -128,7 +128,6 @@ export default create({
128
128
  </script>
129
129
  <script lang="ts" setup>
130
130
  import { reactive, onMounted, computed, ref, toRefs } from "vue";
131
- import { useRoute, useRouter } from "vue-router";
132
131
  import draggable from "vuedraggable";
133
132
  import { NButton, NCheckbox, NSpin, NTooltip } from "naive-ui";
134
133
 
@@ -170,7 +169,6 @@ type Istate = {
170
169
  };
171
170
  fields: Ifields[];
172
171
  };
173
- const route = useRoute();
174
172
 
175
173
  const emit = defineEmits(["onSave", "onClose"]);
176
174
 
@@ -216,10 +214,6 @@ const leftStyle = (ele: Ifields) => {
216
214
 
217
215
  const isMiddleAndAdmin = computed(() => props.menuSource == "middle");
218
216
 
219
- const isMenuSource = computed(() => {
220
- return route.fullPath.includes("middleListDetail");
221
- });
222
-
223
217
  const showCheckBox = (key: string) => {
224
218
  return state.fields.some((i: Ifields) => Object.prototype.hasOwnProperty.call(i, key));
225
219
  };
package/packages/index.ts CHANGED
@@ -2,6 +2,7 @@ import type { App } from "vue";
2
2
  // 导入组件
3
3
  import { default as CGrid } from './grid';
4
4
  import { default as CBigTable } from './big-table';
5
+ import { default as CFieldSet } from './field-set';
5
6
  import { default as CDragLayout } from './drag-layout';
6
7
  import { default as CButtonPrint } from './button-print';
7
8
 
@@ -9,6 +10,7 @@ import { default as CButtonPrint } from './button-print';
9
10
  const components: any[] = [
10
11
  CGrid,
11
12
  CBigTable,
13
+ CFieldSet,
12
14
  CDragLayout,
13
15
  CButtonPrint
14
16
  ];
@@ -23,6 +25,7 @@ const install = function(app: App) {
23
25
  export {
24
26
  CGrid,
25
27
  CBigTable,
28
+ CFieldSet,
26
29
  CDragLayout,
27
30
  CButtonPrint
28
31
  }