ci-plus 1.9.0 → 1.9.2

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/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## 历史更新
2
2
 
3
3
  ```js
4
+ 1.9.2
5
+ 1、优化uploadV5.vue组件
6
+ 1.9.1
7
+ 1、优化uploadV5.vue组件
4
8
  1.9.0
5
9
  1、uploadV4.vue组件基础上,新增uploadV5.vue组件(新增功能:配置默认选中归属公司选项)
6
10
  1.8.9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ci-plus",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "ci组件库",
5
5
  "main": "./index.ts",
6
6
  "scripts": {
@@ -179,7 +179,7 @@ interface Props {
179
179
  ifShowWarehouse?: boolean // 是否显示仓库
180
180
  requiredWarehouse?: boolean // 是否必选仓库
181
181
  ifDefaultAffiliation?: boolean // 是否默认选中归属工厂默认值true
182
- defaultAffiliationOrgid?: string // 默认选中归属工厂的 orgid(默认值当前登陆账号的单位)
182
+ defaultAffiliation?: { orgid: string; orgname: string } // 默认选中归属工厂的 orgid(默认值当前登陆账号的单位)
183
183
  filePath?: UploadFile[] //UploadRawFile[] // 父组件传递的附件数据,用于显示附件列表和上传附件后传递给父组件附件数据
184
184
  RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行(用于表格表单中上传附件)
185
185
  templateName?: string //模板名称
@@ -226,8 +226,13 @@ const ifDefaultAffiliation = computed(() => {
226
226
  // 获取本地缓存中当前登陆账号的公司
227
227
  const raw = localStorage.getItem('UserData')
228
228
  const UserData = raw ? JSON.parse(raw) : {}
229
- const defaultAffiliationOrgid = computed(() => {
230
- return props.defaultAffiliationOrgid || UserData?.resOrgId // 默认登陆账号的单位
229
+ const defaultAffiliation = computed<{ orgid: string; orgname: string }>(() => {
230
+ return (
231
+ props.defaultAffiliation || {
232
+ orgid: UserData?.resOrgId || '',
233
+ orgname: UserData?.resOrgName || ''
234
+ }
235
+ ) // 默认登陆账号的单位
231
236
  })
232
237
 
233
238
  const emits = defineEmits<{
@@ -306,13 +311,32 @@ const submitUpload = () => {
306
311
  if (!fileList.value || !fileList.value.length) {
307
312
  return ElMessage.warning(t('fileRelated.pleaseFile'))
308
313
  }
314
+
315
+ // 判断是否归属公司必选并且选择了值
316
+ console.log(
317
+ '%c Line:312 🍤 判断',
318
+ 'color:#33a5ff',
319
+ requiredAffiliation.value && !datas.value.factory_affiliation_id,
320
+ requiredAffiliation.value,
321
+ datas.value.factory_affiliation_id
322
+ )
309
323
  console.log(fileList.value.length)
310
- if (!datas.value.warehouse_id && requiredWarehouse.value) {
311
- return ElMessage.warning(t('fileRelated.pleaseSelectWarehouse'))
312
- }
324
+ console.log(
325
+ '%c Line:312 🍤 判断',
326
+ 'color:#33a5ff',
327
+ requiredAffiliation.value && !datas.value.factory_affiliation_id,
328
+ requiredAffiliation.value,
329
+ datas.value.factory_affiliation_id
330
+ )
331
+ console.log('%c Line:312 🍎 选中归属公司', 'color:#ed9ec7', datas.value.factory_affiliation_id)
332
+ console.log('%c Line:319 🍔 必填', 'color:#93c0a4', requiredAffiliation.value)
313
333
  if (!datas.value.factory_affiliation_id && requiredAffiliation.value) {
314
334
  return ElMessage.warning(t('fileRelated.selectCompany'))
315
335
  }
336
+ // 判断 出库是否必填 并且选择了值
337
+ if (!datas.value.warehouse_id && requiredWarehouse.value) {
338
+ return ElMessage.warning(t('fileRelated.pleaseSelectWarehouse'))
339
+ }
316
340
  // exporLoading.value = ElLoading.service({ text: t('fileRelated.importing') })
317
341
  exporLoading.value = true
318
342
  console.log('upload.value', upload.value)
@@ -438,7 +462,9 @@ onMounted(async () => {
438
462
 
439
463
  // 判断是否默认选中归属公司
440
464
  if (ifDefaultAffiliation.value) {
441
- affiliationAll.value = defaultAffiliationOrgid.value
465
+ affiliationAll.value = defaultAffiliation.value.orgid // 下拉框赋值
466
+ datas.value.factory_affiliation_id = defaultAffiliation.value.orgid // 赋值给表单
467
+ datas.value.factory_affiliation_name = defaultAffiliation.value.orgname // 赋值给表单
442
468
  }
443
469
  })
444
470
  </script>