潘志宝
8 天以前 ca22cdd5550cfa0defb0f430c538698182cdaec1
src/views/system/app/AppForm.vue
@@ -9,6 +9,32 @@
    >
      <el-row>
        <el-col :span="12">
          <el-form-item label="应用类型">
            <el-select v-model="formData.type" placeholder="请选择">
              <el-option
                v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_APP_TYPE)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="应用分组" prop="groupId">
            <el-select v-model="formData.groupId" clearable placeholder="请选择分组">
              <el-option
                v-for="item in groupList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="应用编号" prop="appCode">
            <el-input v-model="formData.appCode" placeholder="请输入应用编号" />
          </el-form-item>
@@ -25,52 +51,35 @@
            <el-input v-model="formData.appDomain" placeholder="请输入应用域名" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="接口域名" prop="apiDomain">
            <el-input v-model="formData.apiDomain" placeholder="请输入接口域名" />
          </el-form-item>
        </el-col>
<!--        <el-col :span="12">-->
<!--          <el-form-item label="接口域名" prop="apiDomain">-->
<!--            <el-input v-model="formData.apiDomain" placeholder="请输入接口域名" />-->
<!--          </el-form-item>-->
<!--        </el-col>-->
      </el-row>
<!--      <el-row>-->
<!--        <el-col :span="12">-->
<!--          <el-form-item label="应用账号" prop="appKey">-->
<!--            <el-input v-model="formData.appKey" placeholder="请输入应用账号" />-->
<!--          </el-form-item>-->
<!--        </el-col>-->
<!--        <el-col :span="12">-->
<!--          <el-form-item label="应用密码" prop="appSecret">-->
<!--            <el-input v-model="formData.appSecret" placeholder="请输入应用密码" />-->
<!--          </el-form-item>-->
<!--        </el-col>-->
<!--      </el-row>-->
      <el-row>
        <el-col :span="12">
          <el-form-item label="应用账号" prop="appKey">
            <el-input v-model="formData.appKey" placeholder="请输入应用账号" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="应用密码" prop="appSecret">
            <el-input v-model="formData.appSecret" placeholder="请输入应用密码" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="应用分组" prop="appGroup">
            <el-input v-model="formData.appGroup" placeholder="请输入应用分组" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="加载类型" prop="loadType">
            <el-input v-model="formData.loadType" placeholder="请输入加载类型" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
        <el-col :span="24">
          <el-form-item label="应用图标" prop="icon">
            <el-input v-model="formData.icon" placeholder="请输入应用图标" />
            <UploadImg v-model="formData.icon" :limit="1" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="排序" prop="orderNum">
            <el-input v-model="formData.orderNum" placeholder="请输入排序" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="开发者" prop="devName">
            <el-input v-model="formData.devName" placeholder="请输入开发者" />
            <el-input-number v-model="formData.orderNum" placeholder="请输入排序" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
@@ -105,6 +114,8 @@
  import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
  import * as AppApi from '@/api/system/app'
  import { CommonStatusEnum } from '@/utils/constants'
  import * as TenantApi from "@/api/system/tenant";
  import * as AppGroupApi from "@/api/system/appgroup";
  defineOptions({ name: 'SystemAppForm' })
@@ -118,18 +129,20 @@
    id: undefined,
    appCode: undefined,
    appName: undefined,
    type: undefined,
    appDomain: undefined,
    apiDomain: undefined,
    appKey: undefined,
    appSecret: undefined,
    appGroup: undefined,
    groupId: undefined,
    loadType: undefined,
    icon: undefined,
    orderNum: undefined,
    status: CommonStatusEnum.ENABLE,
    devId: undefined,
    devName: undefined,
    remark: undefined
    remark: undefined,
    tenantId: undefined
  })
  const formRules = reactive({
    appCode: [{ required: true, message: '应用编号不能为空', trigger: 'blur' }],
@@ -138,7 +151,8 @@
    appSecret: [{ required: true, message: '应用密码不能为空', trigger: 'blur' }]
  })
  const formRef = ref() // 表单 Ref
  const tenantList = ref([] as TenantApi.TenantVO[]) // 租户列表
  const groupList = ref([] as AppGroupApi.AppGroupVO[]) // 分组列表
  /** 打开弹窗 */
  const open = async (type: string, id?: number) => {
    dialogVisible.value = true
@@ -154,6 +168,8 @@
        formLoading.value = false
      }
    }
    tenantList.value = await TenantApi.getSimpleTenant()
    groupList.value = await AppGroupApi.getAppGroupList()
  }
  defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -187,16 +203,21 @@
  const resetForm = () => {
    formData.value = {
      id: undefined,
      name: undefined,
      packageId: undefined,
      contactName: undefined,
      contactMobile: undefined,
      accountCount: undefined,
      expireTime: undefined,
      website: undefined,
      appCode: undefined,
      appName: undefined,
      appDomain: undefined,
      apiDomain: undefined,
      appKey: undefined,
      appSecret: undefined,
      groupId: undefined,
      loadType: undefined,
      icon: undefined,
      orderNum: undefined,
      status: CommonStatusEnum.ENABLE,
      username: undefined,
      password: undefined
      devId: undefined,
      devName: undefined,
      remark: undefined,
      tenantId: undefined
    }
    formRef.value?.resetFields()
  }