cnhis-design-vue 3.0.2 → 3.0.5

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.2",
4
+ "version": "3.0.5",
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;
@@ -729,7 +729,7 @@ const formatterEdit = (params: any, col: any) => {
729
729
  }
730
730
  }
731
731
  const getEditBtn = (row: any, col: any, index: number) => {
732
- return col.tileBtnList.map((btn: any) => {
732
+ return col.tileBtnList?.map((btn: any) => {
733
733
  if (btn.settingObj[0].trigger_type === 'DELETE') {
734
734
  return <NPopconfirm
735
735
  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;
@@ -58,17 +58,15 @@ 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
69
67
  }
70
68
  const props = withDefaults(defineProps<Props>(), {
71
- // baseUrl: '',
69
+ params: () => ([]),
72
70
  btnText: '打印',
73
71
  printText: '直接打印',
74
72
  previewText: '打印预览',
@@ -79,7 +77,6 @@ const props = withDefaults(defineProps<Props>(), {
79
77
  queryPrintFormatByNumber: () => Promise.resolve({}),
80
78
  queryTemplateParams: () => Promise.resolve({}),
81
79
  strategy: 'MULTI',
82
- versionType: '2'
83
80
  });
84
81
  const emit = defineEmits(['success', 'error']);
85
82
 
@@ -140,34 +137,6 @@ const prevFnError = () => {
140
137
  };
141
138
  emit('error', error);
142
139
  }
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
140
  const getPrintParams = (index: number = 0) => {
172
141
  const params = state.printParams[index];
173
142
  return JSON.stringify(params);
@@ -215,55 +184,30 @@ const handleClickPrint = () => {
215
184
  return Promise.reject();
216
185
  })
217
186
  .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
- // 聚合一条
187
+ if (props.strategy === 'MULTI') {
188
+ // 循环多条
189
+ for (let i = 0; i < state.printParams.length; i++) {
254
190
  const queryParams = {
255
191
  formatId: state.currentFormatId,
256
192
  templateId: getTemplateIdByFormatId(state.currentFormatId),
257
- params: getOnceParams()
193
+ params: getPrintParams(i)
258
194
  };
259
- printInstance.printDirect(
260
- queryParams,
261
- (res: any) => {
262
- callLocalServicesSuccessCb(res, 'print');
263
- },
264
- callLocalServicesErrorCb
265
- );
195
+ printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
266
196
  }
197
+ } else {
198
+ // 聚合一条
199
+ const queryParams = {
200
+ formatId: state.currentFormatId,
201
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
202
+ params: getOnceParams()
203
+ };
204
+ printInstance.printDirect(
205
+ queryParams,
206
+ (res: any) => {
207
+ callLocalServicesSuccessCb(res, 'print');
208
+ },
209
+ callLocalServicesErrorCb
210
+ );
267
211
  }
268
212
  })
269
213
  .finally(() => {
@@ -277,31 +221,19 @@ const handleClickPreview = async () => {
277
221
  return Promise.reject();
278
222
  })
279
223
  .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
- }
224
+ const params = props.strategy === 'MULTI' ? getPrintParams() : getOnceParams();
225
+ const queryParams = {
226
+ formatId: state.currentFormatId,
227
+ templateId: getTemplateIdByFormatId(state.currentFormatId),
228
+ params
229
+ };
230
+ printInstance.preview(
231
+ queryParams,
232
+ (res: any) => {
233
+ callLocalServicesSuccessCb(res, 'preview');
234
+ },
235
+ callLocalServicesErrorCb
236
+ );
305
237
  })
306
238
  .finally(() => {
307
239
  state.visible = false;
@@ -314,19 +246,7 @@ const handleClickEdit = () => {
314
246
  return Promise.reject();
315
247
  })
316
248
  .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
- }
249
+ state.identityVerification.visible = true;
330
250
  })
331
251
  .finally(() => {
332
252
  state.visible = false;
@@ -383,12 +303,6 @@ const setOptions = () => {
383
303
  children
384
304
  })
385
305
  }
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
306
  const formatFormatList = (list: any[]): any => {
393
307
  let formatList: any[] = [];
394
308
 
@@ -459,7 +373,7 @@ const formatParams = ({ customizeDataset = [], param = [] }, params: any[] = [])
459
373
  }
460
374
  const initCRM = async (formatListResult: any) => {
461
375
  state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
462
- setOptions();
376
+ console.log('formatListResult', formatListResult)
463
377
  state.currentFormatId = getDefaultFormatId(state.formatList, 'defaultFlag');
464
378
 
465
379
  if (!state.currentFormatId) {
@@ -488,11 +402,7 @@ const init = async () => {
488
402
 
489
403
  instantiatePrintSDK();
490
404
  const formatListResult = await props.queryPrintFormatByNumber()
491
- if (props.versionType == 1 || props.versionType == 3) {
492
- initHIS(formatListResult);
493
- } else {
494
- await initCRM(formatListResult);
495
- }
405
+ await initCRM(formatListResult);
496
406
 
497
407
  setLoaded();
498
408
 
@@ -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
  };
@@ -1,14 +1,16 @@
1
1
  import type { App } from "vue";
2
2
 
3
3
  // 导入组件
4
- // import Grid, { VXETable } from "./src/Grid"
4
+ import 'vxe-table/lib/style.css'
5
+ import 'xe-utils'
6
+ import VXETable from 'vxe-table'
5
7
  import Grid from "./src/Grid"
6
8
 
7
9
  // type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
8
10
 
9
11
  // 为组件提供 install 安装方法,供按需引入
10
12
  Grid.install = function(app: App) {
11
- // app.use(VXETable);
13
+ app.use(VXETable);
12
14
  app.component(Grid.name, Grid);
13
15
  };
14
16
 
@@ -1,17 +1,12 @@
1
1
  import { defineComponent } from "vue"
2
- import 'xe-utils'
3
- // import VXETable, { Grid } from 'vxe-table'
4
- import { Grid } from 'vxe-table'
5
- // import 'vxe-table/lib/style.css'
6
2
  import create from '@/core/create.js';
7
3
  import { useMethods } from './hooks'
8
4
 
9
- // export { VXETable }
10
5
 
11
6
  export default defineComponent(create({
12
7
  name: "Grid",
13
8
  setup(props: any, { attrs, slots }: any) {
14
- const renderVN = () => <Grid ref="xGrid" { ...attrs }>{slots}</Grid>
9
+ const renderVN = () => <vxe-grid ref="xGrid" { ...attrs }>{slots}</vxe-grid>
15
10
  return {
16
11
  ...useMethods(),
17
12
  renderVN
@@ -156,8 +156,7 @@ export const useMethods = () => {
156
156
  const funcs: any = {}
157
157
  methodKeys.forEach(name => {
158
158
  funcs[name] = (...args: any[]) => {
159
- const $xGrid: any = xGrid.value
160
- return $xGrid && $xGrid[name](...args)
159
+ return xGrid.value && xGrid.value[name](...args)
161
160
  }
162
161
  })
163
162
 
package/packages/index.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  import type { App } from "vue";
2
2
  // 导入组件
3
- import { default as Grid } from './grid';
4
- import { default as BigTable } from './big-table';
5
- import { default as DragLayout } from './drag-layout';
6
- import { default as ButtonPrint } from './button-print';
3
+ import { default as CGrid } from './grid';
4
+ import { default as CBigTable } from './big-table';
5
+ import { default as CFieldSet } from './field-set';
6
+ import { default as CDragLayout } from './drag-layout';
7
+ import { default as CButtonPrint } from './button-print';
7
8
 
8
9
  // 存储组件列表
9
10
  const components: any[] = [
10
- Grid,
11
- BigTable,
12
- DragLayout,
13
- ButtonPrint
11
+ CGrid,
12
+ CBigTable,
13
+ CFieldSet,
14
+ CDragLayout,
15
+ CButtonPrint
14
16
  ];
15
17
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
16
18
  const install = function(app: App) {
@@ -21,10 +23,11 @@ const install = function(app: App) {
21
23
  };
22
24
 
23
25
  export {
24
- Grid as CGrid,
25
- BigTable as CBigTable,
26
- DragLayout as CDragLayout,
27
- ButtonPrint as CButtonPrint
26
+ CGrid,
27
+ CBigTable,
28
+ CFieldSet,
29
+ CDragLayout,
30
+ CButtonPrint
28
31
  }
29
32
 
30
33
  export default {
@@ -4,5 +4,5 @@
4
4
  "module": "esnext",
5
5
  "moduleResolution": "node"
6
6
  },
7
- "include": ["vite.config.ts"]
7
+ "include": ["vite.config.ts", "build/*.ts"]
8
8
  }