n20-common-lib 2.13.7 → 2.13.9

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.13.7",
3
+ "version": "2.13.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <span>
3
+ <slot :customEvent="aiFn">
4
+ <el-button v-title="'AI识别'" type="text" icon="n20-icon-query" @click="aiFn" />
5
+ </slot>
6
+ <cl-dialog v-drag :visible.sync="visible" title="AI识别" :destroy-on-open="true" width="690px">
7
+ <cl-upload
8
+ :drag="true"
9
+ :file-name.sync="fileName"
10
+ :file-url.sync="fileUrl"
11
+ action="/api/neams/eamsbaserecord/batchSavejson"
12
+ :on-success="onSuccess"
13
+ :msg-type="null"
14
+ :data="dataPorp"
15
+ >
16
+ <template slot="trigger">
17
+ <i class="drag-icon n20-icon-shangchuan"></i>
18
+ <span class="drag-text">点击或将文件拖拽到这里上传</span>
19
+ </template>
20
+ </cl-upload>
21
+ </cl-dialog>
22
+ </span>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'AiButton',
28
+ components: {},
29
+ props: {
30
+ AIOptions: {
31
+ type: Object,
32
+ default: () => ({})
33
+ },
34
+ dataPorp: {
35
+ type: Object,
36
+ default: () => {
37
+ return {
38
+ data: JSON.stringify({
39
+ syscode: '010000000',
40
+ appno: 'abcd',
41
+ bussValue: '006001001',
42
+ cltno: '001',
43
+ creator: 'jz'
44
+ })
45
+ }
46
+ }
47
+ }
48
+ },
49
+ data() {
50
+ return {
51
+ visible: false,
52
+ fileName: '',
53
+ fileUrl: ''
54
+ }
55
+ },
56
+ computed: {},
57
+ watch: {},
58
+ created() {},
59
+ mounted() {},
60
+ methods: {
61
+ aiFn() {
62
+ this.visible = true
63
+ },
64
+ onSuccess({ data }) {
65
+ this.AiFn(data)
66
+ },
67
+ // ai识别
68
+ async AiFn(beid) {
69
+ if (!this.AIOptions.bussType) {
70
+ this.$message.error('请先配置bussType')
71
+ return false
72
+ }
73
+ const { data, code } = await this.$axios.post(
74
+ this.apiPrefix ? `${this.apiPrefix}neams/eamsbaserecord/aiAttaFile` : `/neams/eamsbaserecord/aiAttaFile`,
75
+ {
76
+ beid: beid,
77
+ bussType: this.AIOptions.bussType,
78
+ extendPrompt: ''
79
+ }
80
+ )
81
+ if (code === 200) {
82
+ this.$emit('aiFn', data)
83
+ this.visible = false
84
+ this.$message.success('识别成功')
85
+ }
86
+ }
87
+ }
88
+ }
89
+ </script>
90
+ <style lang="scss" scoped></style>
@@ -165,12 +165,14 @@
165
165
  <el-table-column :label="'操作' | $lc" align="center" width="90" fixed="right">
166
166
  <slot slot="header" slot-scope="scope" name="handle-header" :column="scope.column">{{ '操作' | $lc }}</slot>
167
167
  <slot slot-scope="{ row }" name="handle" :row="row">
168
+ <el-button type="text" icon="el-icon-view" :disabled="!row[keys.url]" @click="seeFile(row)" />
168
169
  <el-button
169
- v-if="getOfficeStatus"
170
+ v-if="getOfficeStatus && openAI"
171
+ v-title="'ai识别'"
170
172
  type="text"
171
- icon="el-icon-view"
173
+ icon="n20-icon-query"
172
174
  :disabled="!row[keys.url]"
173
- @click="seeFile(row)"
175
+ @click="AiFn(row)"
174
176
  />
175
177
  <el-button
176
178
  v-if="readonly"
@@ -334,6 +336,14 @@ export default {
334
336
  }
335
337
  },
336
338
  props: {
339
+ AIOptions: {
340
+ type: Object,
341
+ default: () => ({})
342
+ },
343
+ openAI: {
344
+ type: Boolean,
345
+ default: false
346
+ },
337
347
  readonly: {
338
348
  type: Boolean,
339
349
  default: false
@@ -466,6 +476,24 @@ export default {
466
476
  this.getConfiguration()
467
477
  },
468
478
  methods: {
479
+ // ai识别
480
+ async AiFn(row) {
481
+ if (!this.AIOptions.bussType) {
482
+ this.$message.error('请先配置bussType')
483
+ return false
484
+ }
485
+ const { data, code } = await this.$axios.post(
486
+ this.apiPrefix ? `${this.apiPrefix}neams/eamsbaserecord/aiAttaFile` : `/neams/eamsbaserecord/aiAttaFile`,
487
+ {
488
+ beid: row.beid,
489
+ bussType: this.AIOptions.bussType,
490
+ extendPrompt: ''
491
+ }
492
+ )
493
+ if (code === 200) {
494
+ this.$emit('aiFn', data)
495
+ }
496
+ },
469
497
  getConfiguration() {
470
498
  getJsonc('portal/server-config.jsonc', null, true)
471
499
  .then(({ loginConf }) => {
@@ -536,7 +564,7 @@ export default {
536
564
  $uploadwrap.submit()
537
565
  },
538
566
  batchSuccess(response, file, fileList) {
539
- let row = {...this.dataPorp.keys}
567
+ let row = { ...this.dataPorp.keys }
540
568
  this.tableData.splice(0, 0, row)
541
569
  this.$nextTick(() => {
542
570
  this.onSuccessFn(response, file, fileList, row)
@@ -23,6 +23,7 @@
23
23
  :show-word-limit="showWordLimit"
24
24
  :maxlength="maxlength"
25
25
  class="w-100p"
26
+ :placeholder="placeholder"
26
27
  />
27
28
  </el-form-item>
28
29
  </el-form>
@@ -88,7 +89,9 @@ export default {
88
89
  reason: '',
89
90
  otherAttDataA: [],
90
91
  procInstId: '',
91
- whether: false
92
+ whether: false,
93
+ optionsRequired: false,
94
+ placeholder: ''
92
95
  }
93
96
  },
94
97
  methods: {
@@ -109,6 +112,12 @@ export default {
109
112
  if (code === 200) {
110
113
  this.otherAttDataA = data.customizationList || []
111
114
  this.whether = data.whether
115
+ this.optionsRequired = data.optionsRequired
116
+ if (data.optionsRequired) {
117
+ this.placeholder = '请选择或输入意见(必填)'
118
+ } else {
119
+ this.placeholder = '请选择或输入意见(选填)'
120
+ }
112
121
  this.visible = data.whether === true || this.otherAttDataA.length > 0
113
122
  this.flowOptions = data?.opinions?.map((d) => {
114
123
  return {
@@ -159,6 +168,10 @@ export default {
159
168
  this.reason = val
160
169
  },
161
170
  submit() {
171
+ if (this.whether && this.optionsRequired && !this.reason) {
172
+ this.$message.warning('请选择或输入意见')
173
+ return
174
+ }
162
175
  const getOtherAttData = this.$refs['showOtherAttNew'] && this.$refs['showOtherAttNew']?.getOtherAttData()
163
176
  this.visible = false
164
177
  if (this.beforeSubmit) {
@@ -334,12 +334,17 @@ export default {
334
334
  },
335
335
  // 计算列宽
336
336
  calcColumnWidth(columns) {
337
+ columns = columns.map((item) => {
338
+ return {
339
+ ...item,
340
+ _width_: 0
341
+ }
342
+ })
337
343
  const wrapperEl = document.querySelector('div#app')
338
344
  const notHasWidth = columns.filter((column) => !column.width && !column.minWidth && column.label !== $lc('操作'))
339
345
  if (!wrapperEl || notHasWidth.length > 0) {
340
346
  return columns
341
347
  }
342
- columns = XEUtils.clone(columns, true)
343
348
  const { width: windowWidth } = wrapperEl.getBoundingClientRect()
344
349
  function calc(columns) {
345
350
  let columnsWidth = 0
@@ -368,7 +373,6 @@ export default {
368
373
  return column
369
374
  })
370
375
  }
371
-
372
376
  return calc(columns)
373
377
  }
374
378
  }
package/src/index.js CHANGED
@@ -66,6 +66,7 @@ import WornPagination from './components/WornPagination/index.vue'
66
66
 
67
67
  import AdvancedFilter from './components/AdvancedFilter/index.vue'
68
68
  import AttachmentPass from './components/AttachmentPass/index.vue'
69
+ import AIButton from './components/AIButton/index.vue'
69
70
  import DateChoose from './components/DateChoose/index.vue'
70
71
  import ElectronicArchive from './components/ElectronicArchive/index.vue'
71
72
  import HandlingAdvice from './components/HandlingAdvice/index.vue'
@@ -232,6 +233,7 @@ const components = [
232
233
  ElectronicArchive,
233
234
  Preview,
234
235
  AttachmentPass,
236
+ AIButton,
235
237
  HandlingAdvice,
236
238
  /* old */
237
239
  TableO,
@@ -303,6 +305,7 @@ export {
303
305
  ApproveCard,
304
306
  ApproveCardZjk,
305
307
  AttachmentPass,
308
+ AIButton,
306
309
  BusiDatePicker,
307
310
  Button,
308
311
  ButtonGroup,
@@ -102,22 +102,24 @@ export function getCertInfo(dn) {
102
102
  }
103
103
  return new Promise((resolve, reject) => {
104
104
  let certInfo
105
- IWSAGetAllCertsListInfo('infosec.sm2', 'SignAndEncrypt', 0, (dnList) => {
106
- if (!dn) {
107
- Message.error('没有获取到签名参数DN!')
108
- reject()
109
- }
110
- if (!dnList) {
111
- Message.error('没有获取到证书列表!')
112
- reject()
113
- }
114
- if (dnList.length === 0) {
115
- Message.error('用户证书信息与当前用户不匹配!')
116
- reject()
117
- }
105
+ IWSAGetAllCertsListInfo('infosec.sm2', 'Sign', 0, (dnList) => {
106
+ IWSAGetAllCertsListInfo('infosec.sm2', 'Sign', 2, (dnList2) => {
107
+ if (!dn) {
108
+ Message.error('没有获取到签名参数DN!')
109
+ reject()
110
+ }
111
+ if (!dnList && !dnList2) {
112
+ Message.error('没有获取到证书列表!')
113
+ reject()
114
+ }
115
+ if (dnList.length === 0 && dnList2.length === 0) {
116
+ Message.error('用户证书信息与当前用户不匹配!')
117
+ reject()
118
+ }
118
119
 
119
- certInfo = verifyDn(dnList, dn)
120
- resolve(certInfo)
120
+ certInfo = verifyDn([...dnList, ...dnList2], dn)
121
+ resolve(certInfo)
122
+ })
121
123
  })
122
124
  })
123
125
  }
@@ -169,10 +171,10 @@ function verifyDn(dnList, dn) {
169
171
  }
170
172
  })
171
173
  if (index === -1) {
172
- let dnList = dnList?.map((res) => res.certDN)?.join(',')
174
+ let dnListA = dnList?.map((res) => res.certDN)?.join(',')
173
175
  Message({
174
176
  type: 'error',
175
- text: `证书Dn不匹配:${dnList}里面无法匹配===>${dn}`,
177
+ text: `证书Dn不匹配:${dnListA}里面无法匹配===>${dn}`,
176
178
  duration: 5000
177
179
  })
178
180
  return index