mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-11-04 08:06:12 +08:00 
			
		
		
		
	vue3:review 租户列表、租户套餐、用户管理
This commit is contained in:
		@ -13,7 +13,7 @@ export const rules = reactive({
 | 
				
			|||||||
  phone: [
 | 
					  phone: [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      pattern:
 | 
					      pattern:
 | 
				
			||||||
        /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
 | 
					        /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, // TODO @星语:前端只校验长度,格式交给后端;因为号码格式不断在变的
 | 
				
			||||||
      trigger: 'blur',
 | 
					      trigger: 'blur',
 | 
				
			||||||
      message: '请输入正确的手机号码'
 | 
					      message: '请输入正确的手机号码'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -204,7 +204,7 @@ const handleDelete = async (rowId: number) => {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const userNicknameFormat = (row) => {
 | 
					const userNicknameFormat = (row) => {
 | 
				
			||||||
  if (!row || !row.leaderUserId || row.leaderUserId == null) {
 | 
					  if (!row || !row.leaderUserId) {
 | 
				
			||||||
    return '未设置'
 | 
					    return '未设置'
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  for (const user of userOption.value) {
 | 
					  for (const user of userOption.value) {
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,7 @@ export const rules = reactive({
 | 
				
			|||||||
// CrudSchema.
 | 
					// CrudSchema.
 | 
				
			||||||
const crudSchemas = reactive<VxeCrudSchema>({
 | 
					const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			||||||
  primaryKey: 'id',
 | 
					  primaryKey: 'id',
 | 
				
			||||||
 | 
					  primaryTitle: '租户编号',
 | 
				
			||||||
  primaryType: 'seq',
 | 
					  primaryType: 'seq',
 | 
				
			||||||
  action: true,
 | 
					  action: true,
 | 
				
			||||||
  columns: [
 | 
					  columns: [
 | 
				
			||||||
@ -121,7 +122,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      title: t('table.createTime'),
 | 
					      title: t('table.createTime'),
 | 
				
			||||||
      field: 'createTime',
 | 
					      field: 'createTime',
 | 
				
			||||||
      formatter: 'formatDate',
 | 
					      formatter: 'formatDate', // TODO 星语:要不给 formatter = formatDate 的时候,设置一个它的默认宽度,避免缩进
 | 
				
			||||||
      isForm: false
 | 
					      isForm: false
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
 | 
				
			|||||||
@ -19,6 +19,7 @@ export const rules = reactive({
 | 
				
			|||||||
const crudSchemas = reactive<VxeCrudSchema>({
 | 
					const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			||||||
  primaryKey: 'id',
 | 
					  primaryKey: 'id',
 | 
				
			||||||
  primaryType: 'seq',
 | 
					  primaryType: 'seq',
 | 
				
			||||||
 | 
					  primaryTitle: '套餐编号',
 | 
				
			||||||
  action: true,
 | 
					  action: true,
 | 
				
			||||||
  columns: [
 | 
					  columns: [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -35,7 +36,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      title: '菜单权限',
 | 
					      title: '菜单权限',
 | 
				
			||||||
      field: 'menuIds',
 | 
					      field: 'menuIds', // TODO 星语:菜单权限,表单可以搞大点哇?
 | 
				
			||||||
      isTable: false
 | 
					      isTable: false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
@ -28,8 +28,8 @@
 | 
				
			|||||||
      </template>
 | 
					      </template>
 | 
				
			||||||
      <!-- 列表 -->
 | 
					      <!-- 列表 -->
 | 
				
			||||||
      <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
 | 
					      <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
 | 
				
			||||||
        <!-- 操作:新增 -->
 | 
					 | 
				
			||||||
        <template #toolbar_buttons>
 | 
					        <template #toolbar_buttons>
 | 
				
			||||||
 | 
					          <!-- 操作:新增 -->
 | 
				
			||||||
          <XButton
 | 
					          <XButton
 | 
				
			||||||
            type="primary"
 | 
					            type="primary"
 | 
				
			||||||
            preIcon="ep:zoom-in"
 | 
					            preIcon="ep:zoom-in"
 | 
				
			||||||
@ -37,6 +37,7 @@
 | 
				
			|||||||
            v-hasPermi="['system:user:create']"
 | 
					            v-hasPermi="['system:user:create']"
 | 
				
			||||||
            @click="handleCreate()"
 | 
					            @click="handleCreate()"
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
 | 
					          <!-- 操作:导入用户 -->
 | 
				
			||||||
          <XButton
 | 
					          <XButton
 | 
				
			||||||
            type="warning"
 | 
					            type="warning"
 | 
				
			||||||
            preIcon="ep:upload"
 | 
					            preIcon="ep:upload"
 | 
				
			||||||
@ -44,6 +45,7 @@
 | 
				
			|||||||
            v-hasPermi="['system:user:import']"
 | 
					            v-hasPermi="['system:user:import']"
 | 
				
			||||||
            @click="importDialogVisible = true"
 | 
					            @click="importDialogVisible = true"
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
 | 
					          <!-- 操作:导出用户 -->
 | 
				
			||||||
          <XButton
 | 
					          <XButton
 | 
				
			||||||
            type="warning"
 | 
					            type="warning"
 | 
				
			||||||
            preIcon="ep:download"
 | 
					            preIcon="ep:download"
 | 
				
			||||||
@ -52,6 +54,7 @@
 | 
				
			|||||||
            @click="exportList('用户数据.xls')"
 | 
					            @click="exportList('用户数据.xls')"
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        </template>
 | 
					        </template>
 | 
				
			||||||
 | 
					        <!-- TODO @星语:貌似没生效? -->
 | 
				
			||||||
        <template #status="{ row }">
 | 
					        <template #status="{ row }">
 | 
				
			||||||
          <el-switch
 | 
					          <el-switch
 | 
				
			||||||
            v-model="row.status"
 | 
					            v-model="row.status"
 | 
				
			||||||
@ -61,6 +64,7 @@
 | 
				
			|||||||
          />
 | 
					          />
 | 
				
			||||||
        </template>
 | 
					        </template>
 | 
				
			||||||
        <template #actionbtns_default="{ row }">
 | 
					        <template #actionbtns_default="{ row }">
 | 
				
			||||||
 | 
					          <!-- 操作:编辑 -->
 | 
				
			||||||
          <XTextButton
 | 
					          <XTextButton
 | 
				
			||||||
            preIcon="ep:edit"
 | 
					            preIcon="ep:edit"
 | 
				
			||||||
            :title="t('action.edit')"
 | 
					            :title="t('action.edit')"
 | 
				
			||||||
@ -74,12 +78,15 @@
 | 
				
			|||||||
            v-hasPermi="['system:user:update']"
 | 
					            v-hasPermi="['system:user:update']"
 | 
				
			||||||
            @click="handleDetail(row.id)"
 | 
					            @click="handleDetail(row.id)"
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
 | 
					          <!-- TODO 芋艿:可以重置角色、密码收起来么,形成【更多】 -->
 | 
				
			||||||
 | 
					          <!-- 操作:重置密码 -->
 | 
				
			||||||
          <XTextButton
 | 
					          <XTextButton
 | 
				
			||||||
            preIcon="ep:key"
 | 
					            preIcon="ep:key"
 | 
				
			||||||
            title="重置密码"
 | 
					            title="重置密码"
 | 
				
			||||||
            v-hasPermi="['system:user:update-password']"
 | 
					            v-hasPermi="['system:user:update-password']"
 | 
				
			||||||
            @click="handleResetPwd(row)"
 | 
					            @click="handleResetPwd(row)"
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
 | 
					          <!-- 操作:分配角色 -->
 | 
				
			||||||
          <XTextButton
 | 
					          <XTextButton
 | 
				
			||||||
            preIcon="ep:key"
 | 
					            preIcon="ep:key"
 | 
				
			||||||
            title="分配角色"
 | 
					            title="分配角色"
 | 
				
			||||||
@ -349,6 +356,7 @@ const handleCreate = async () => {
 | 
				
			|||||||
  deptId.value = null
 | 
					  deptId.value = null
 | 
				
			||||||
  postIds.value = []
 | 
					  postIds.value = []
 | 
				
			||||||
  await nextTick()
 | 
					  await nextTick()
 | 
				
			||||||
 | 
					  // TODO 星语:要不要这个放到新增里?这样和 handleUpdate 统一一点
 | 
				
			||||||
  if (allSchemas.formSchema[0].field !== 'username') {
 | 
					  if (allSchemas.formSchema[0].field !== 'username') {
 | 
				
			||||||
    unref(formRef)?.addSchema(
 | 
					    unref(formRef)?.addSchema(
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@ -371,7 +379,7 @@ const handleCreate = async () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// 修改操作
 | 
					// 修改操作
 | 
				
			||||||
const handleUpdate = async (rowId: number) => {
 | 
					const handleUpdate = async (rowId: number) => {
 | 
				
			||||||
  setDialogTile('update')
 | 
					  setDialogTile('update') // TODO @星语:有警告
 | 
				
			||||||
  await nextTick()
 | 
					  await nextTick()
 | 
				
			||||||
  unref(formRef)?.delSchema('username')
 | 
					  unref(formRef)?.delSchema('username')
 | 
				
			||||||
  unref(formRef)?.delSchema('password')
 | 
					  unref(formRef)?.delSchema('password')
 | 
				
			||||||
@ -475,6 +483,7 @@ const submitRole = async () => {
 | 
				
			|||||||
  roleDialogVisible.value = false
 | 
					  roleDialogVisible.value = false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// ========== 导入相关 ==========
 | 
					// ========== 导入相关 ==========
 | 
				
			||||||
 | 
					// TODO @星语:这个要不要把导入用户,封装成一个小组件?可选哈
 | 
				
			||||||
const importDialogVisible = ref(false)
 | 
					const importDialogVisible = ref(false)
 | 
				
			||||||
const uploadDisabled = ref(false)
 | 
					const uploadDisabled = ref(false)
 | 
				
			||||||
const importDialogTitle = ref('用户导入')
 | 
					const importDialogTitle = ref('用户导入')
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,7 @@ export const rules = reactive({
 | 
				
			|||||||
  mobile: [
 | 
					  mobile: [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      pattern:
 | 
					      pattern:
 | 
				
			||||||
        /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
 | 
					        /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, // TODO @星语:前端只校验长度,格式交给后端;因为号码格式不断在变的
 | 
				
			||||||
      trigger: 'blur',
 | 
					      trigger: 'blur',
 | 
				
			||||||
      message: '请输入正确的手机号码'
 | 
					      message: '请输入正确的手机号码'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -24,6 +24,7 @@ export const rules = reactive({
 | 
				
			|||||||
const crudSchemas = reactive<VxeCrudSchema>({
 | 
					const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			||||||
  primaryKey: 'id',
 | 
					  primaryKey: 'id',
 | 
				
			||||||
  primaryType: 'seq',
 | 
					  primaryType: 'seq',
 | 
				
			||||||
 | 
					  primaryTitle: '用户编号',
 | 
				
			||||||
  action: true,
 | 
					  action: true,
 | 
				
			||||||
  actionWidth: '400px',
 | 
					  actionWidth: '400px',
 | 
				
			||||||
  columns: [
 | 
					  columns: [
 | 
				
			||||||
@ -56,12 +57,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      title: '部门',
 | 
					      title: '部门',
 | 
				
			||||||
      field: 'deptId',
 | 
					      field: 'deptId', // TODO 星语:详情的部门没展示
 | 
				
			||||||
      isTable: false
 | 
					      isTable: false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      title: '岗位',
 | 
					      title: '岗位',
 | 
				
			||||||
      field: 'postIds',
 | 
					      field: 'postIds', // TODO 星语:岗位为空的时候,要不要不展示
 | 
				
			||||||
      isTable: false
 | 
					      isTable: false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -74,7 +75,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      title: '最后登录时间',
 | 
					      title: '最后登录时间',
 | 
				
			||||||
      field: 'loginDate',
 | 
					      field: 'loginDate',
 | 
				
			||||||
      formatter: 'formatDate',
 | 
					      formatter: 'formatDate', // TODO 星语:未登录的时候,不要展示 Invalid Date
 | 
				
			||||||
      isForm: false
 | 
					      isForm: false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user