fix(前端): 后台摘掉公司这一维度——列表列/筛选/建号选择/顶栏旁白全部去掉
用户定案:隔离该由数据和后端自己做,不该把"公司"摆到操作员眼前多一个选错的机会。 于是原计划里给品牌库/去重库两页加公司列(Task 9)反向执行,顺带把一期已上线的展示也收掉。 建号归属改为请求体不带 company_id,由后端 resolveTargetCompanyId 落操作者自己的公司。 这条前端删下拉的安全依据完全靠后端那两条分支撑着,所以用跨仓读 Java 源码的方式钉成可执行断言: 谁把那边改成"必填公司"或删掉任一分支,这边立刻红。 副作用要说清——超管建的号一律归公司 1,给第 2 家建号得用那家公司自己的管理员登录。 「公司管理」页的引导语原写"建号时选哪家公司",下拉没了就成了错的承诺; "停用后不能再用于新建账号"也不再成立(requireActive 两个调用点都要求显式传 company_id, 而页面现在一律不传)。文案改成真实口径,并断言这三句失效说法不得回流。 1683 例 / 0 红,vue-tsc 干净,变异 6/6 被杀。
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { submitCreateUser } from './user-create-adapter'
|
||||
import {
|
||||
createEmptyCreateUserForm,
|
||||
initialCompanyId,
|
||||
selectableCompanies,
|
||||
type CreateOperatorScope,
|
||||
type CreateUserForm,
|
||||
type CreateUserFormErrors,
|
||||
validateCreateUserForm,
|
||||
} from './user-create-model'
|
||||
import type { CompanyItem } from '@/api/companies-dto'
|
||||
import { showAdminFeedback } from '@/components/admin-feedback-ui'
|
||||
import { actionableErrorText } from '@/components/admin-feedback'
|
||||
import UserMenuAuthTree from './UserMenuAuthTree.vue'
|
||||
@@ -20,10 +16,6 @@ const props = defineProps<{
|
||||
operatorSuper?: boolean
|
||||
/** 所属管理员候选(列表响应 admins;仅超管创建普通账号时展示)。 */
|
||||
adminOptions?: Array<{ id: number; username: string }>
|
||||
/** 整份公司目录(GET /api/admin/companies,后端已按操作者收窄)。 */
|
||||
companies?: CompanyItem[]
|
||||
/** 操作者角色与归属:决定公司下拉是否必选。 */
|
||||
operator?: CreateOperatorScope
|
||||
}>()
|
||||
const emit = defineEmits<{ (e: 'update:modelValue', v: boolean): void; (e: 'created'): void }>()
|
||||
|
||||
@@ -31,9 +23,6 @@ const form = reactive<CreateUserForm>(createEmptyCreateUserForm())
|
||||
const errors = reactive<CreateUserFormErrors>({})
|
||||
const busy = ref(false)
|
||||
|
||||
/** 可选项收窄规则与后端 resolveTargetCompanyId 同源,写在这里而不是父页模板里。 */
|
||||
const companyOptions = computed(() => selectableCompanies(props.companies || [], props.operator || {}))
|
||||
|
||||
/** 角色下拉(对齐 admin.html:普通账号/管理员;超管才显示可改)。 */
|
||||
const ROLE_CHOICES: Array<{ value: 'admin' | 'normal'; label: string }> = [
|
||||
{ value: 'normal', label: '普通账号' },
|
||||
@@ -49,10 +38,8 @@ watch(
|
||||
form.role = 'normal'
|
||||
form.columnIds = []
|
||||
form.createdBy = null
|
||||
form.companyId = initialCompanyId(props.operator || {}, props.companies || [])
|
||||
errors.username = undefined
|
||||
errors.password = undefined
|
||||
errors.company = undefined
|
||||
},
|
||||
)
|
||||
|
||||
@@ -61,7 +48,7 @@ function close(): void {
|
||||
}
|
||||
|
||||
async function create(): Promise<void> {
|
||||
const { valid, errors: errs } = validateCreateUserForm(form, props.operator)
|
||||
const { valid, errors: errs } = validateCreateUserForm(form)
|
||||
Object.assign(errors, errs)
|
||||
if (!valid) return
|
||||
busy.value = true
|
||||
@@ -120,22 +107,6 @@ async function create(): Promise<void> {
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="companyOptions.length" label="所属公司" :error="errors.company">
|
||||
<el-select
|
||||
v-model="form.companyId"
|
||||
filterable
|
||||
:placeholder="operatorSuper ? '请选择所属公司' : '所属公司'"
|
||||
style="width: 200px"
|
||||
@change="errors.company = undefined"
|
||||
>
|
||||
<el-option
|
||||
v-for="company in companyOptions"
|
||||
:key="company.id"
|
||||
:label="company.companyName"
|
||||
:value="company.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单权限(勾选上级菜单会继承全部子菜单)">
|
||||
<div class="auth-tree-box">
|
||||
<UserMenuAuthTree v-model:checked="form.columnIds" />
|
||||
|
||||
Reference in New Issue
Block a user