vue3-upload

[复制链接]
发表于 2025-10-30 11:02:05 | 显示全部楼层 |阅读模式
<publicFormAgGrid :agGridConfig="agGridConfig" v-show= 'true'>
      <template #button>
        <publicUpLoad :url="importExcel" :aggridInstance="agGridConfig" @on-uploadCallBack="uploadCallBack" :default-callback= "false" :data="{aaaa:1000}">
          {{ $t('AssemblyConfigurationI18n.import') }}
        </publicUpLoad>
      </template>
    </publicFormAgGrid>
const uploadErrorRef = ref<uploadErrorApi | null>();
<uploadError ref="uploadErrorRef"></uploadError>
const uploadCallBack = (data: any) => {
  if (data.success) {
    successMsg($t('PartsKitConfiguration.uploadSuccess'))
    agGridConfig.resetCurStore();
  } else {
    if (data.result) {
      uploadErrorRef.value?.openErrorTable(data.result);
    } else {
      errorMsg(data.error);
    }
  }
}
const agGridConfig: any = {
  labelWidth: '120px',
  exportConfig:{fileName: $t('AssemblyConfigurationI18n.exportFileName')},//(公用导出)查询列显示导出按钮 customUrl:自定义url params:参数,proxy:代理url,fileName:文件名称
  fetchApi: KIT_CONFIG_API.listByPage,
  // otherBtnPosition: 'table',//left right table  默认为'' 即''=table gridRight 只展示otherBtnGroup且居右 slotRight 只展示插槽内容
  serviceCode: '',//代理服务编码
  gridCode: '',//表格编码
  rowBtnGroup: [//列操作
    {
      label: $t('AssemblyConfigurationI18n.edit'),
      type: "primary",
      icon: "",
      actionType: "edit",
    },
    {
      label: $t('AssemblyConfigurationI18n.delete'),
      type: "danger",
      icon: "",
      actionType: "delete",
      ondition: (row: any) => {
        return row.kitStatus == '0'; // 状态为禁用时显示编辑按钮
      },
    },
    {
      label: $t('AssemblyConfigurationI18n.disable'),
      type: "primary",
      icon: "",
      actionType: "inValid",
      ondition: (row: any) => {
        return row.kitStatus == '1';
      },
    },
    {
      label: $t('AssemblyConfigurationI18n.enable'),
      type: "primary",
      icon: "",
      actionType: "valid",
      ondition: (row: any) => {
        return row.kitStatus == '0';
      },
    }
  ],
  otherRowConfig: {//列的其他配置,接受一个对象的键值对,可覆盖已有的配置
    "headerName": {
      width: 100,
      cellClassRules: {//列的样式配置
        'rag-green-outer': (params: any) => {
          const { rowIndex, value, data } = params;
          // data   当前行的数据
          // rowIndex 当前行的下标
          // value 当前单元格的内容
          return rowIndex % 3 === 0;
        },
      }
    }
  },
  otherBtnGroup: [
    {
      label: $t('AssemblyConfigurationI18n.add'),
      actionType: "add",
    },
    {
      label: $t('AssemblyConfigurationI18n.downloadTemplate'),
      actionType: "downloadTemplate",
    }
  ],
  rowBtnGroupClick: ({ data, actionType, rowIndex }: any) => {
    if (actionType == 'edit') {
      addLogConfig.open(data, $t('AssemblyConfigurationI18n.edit'))
    }  else if (actionType == 'delete') {
      messageBox($t('AssemblyConfigurationI18n.confirmDelete'), () => { addLogConfig.deleteFunc(data.pkid) });
    } else if (actionType == 'valid') {
      messageBox($t('AssemblyConfigurationI18n.confirmEnable'), () => { addLogConfig.validFunc(data.pkid) });
    } else if (actionType == 'inValid') {
      messageBox($t('AssemblyConfigurationI18n.confirmDisable'), () => { addLogConfig.inValidFunc(data.pkid) });
    }

  }, //行按钮组点击事件  data  actionType rowIndex
  otherBtnGroupClick: ({ data, actionType }: any) => {
    if (actionType == 'add') {
      addLogConfig.open({})
    }
    else if (actionType === "downloadTemplate") {
      KIT_CONFIG_API.downloadTemplate();
    }
  },
  formJson: [
    { type: 'text', field: 'kitNo', label: $t('AssemblyConfigurationI18n.kitNo'),otherField: 'name'   },
    { type: 'select', field: 'lidNo', label: $t('AssemblyConfigurationI18n.lidNo'),otherField: 'name', parentId: 'engineering:STANDARD_CONFIG_LID' , dictParams: { grpFlg }, filterable: true},
    { type: 'select', field: 'subModule', label: $t('AssemblyConfigurationI18n.subModule'), otherField: 'name', parentId: 'engineering:CONFIG_SUB_MODULE' , filterable: true},
    { type: 'select', field: 'wkCenterShortName', label: $t('AssemblyConfigurationI18n.wkCenterShortName'), otherField: 'name' ,parentId: 'production:WKCENTER_SHORT_NAME', dictParams: {  grpFlg }, filterable: true},
    { type: 'select', field: 'kitStatus', label: $t('AssemblyConfigurationI18n.kitStatus'), otherField: 'name', parentId: 'PLAN_DIVIDE_VALID_FLG' },
    { type: 'select', field: 'engType', label: $t('AssemblyConfigurationI18n.engType'), otherField: 'name', parentId: 'engineering:ENG_TYPE', filterable: true}
  ]
};

GMT+8, 2025-12-2 01:23 , Processed in 0.111295 second(s), 34 queries Archiver|手机版|小黑屋|Attic ( 京ICP备2020048627号 )

快速回复 返回顶部 返回列表