This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
:rules="allocateRules"
|
||||
label-width="120px"
|
||||
>
|
||||
<ElFormItem :label="$t('enterpriseDevices.form.deviceNos')" prop="device_nos">
|
||||
<ElFormItem :label="$t('enterpriseDevices.form.deviceNos')" prop="virtual_nos">
|
||||
<ElInput
|
||||
v-model="deviceNosText"
|
||||
type="textarea"
|
||||
@@ -93,7 +93,7 @@
|
||||
<div style="margin-top: 4px; font-size: 12px; color: var(--el-color-info)">
|
||||
{{
|
||||
$t('enterpriseDevices.form.selectedCount', {
|
||||
count: allocateForm.device_nos?.length || 0
|
||||
count: allocateForm.virtual_nos?.length || 0
|
||||
})
|
||||
}}
|
||||
</div>
|
||||
@@ -171,7 +171,7 @@
|
||||
}}</ElDivider>
|
||||
<ElTable :data="operationResult.failed_items" border max-height="300">
|
||||
<ElTableColumn
|
||||
prop="device_no"
|
||||
prop="virtual_no"
|
||||
:label="$t('enterpriseDevices.result.deviceNo')"
|
||||
width="180"
|
||||
/>
|
||||
@@ -191,7 +191,7 @@
|
||||
}}</ElDivider>
|
||||
<ElTable :data="operationResult.authorized_devices" border max-height="200">
|
||||
<ElTableColumn
|
||||
prop="device_no"
|
||||
prop="virtual_no"
|
||||
:label="$t('enterpriseDevices.result.deviceNo')"
|
||||
width="180"
|
||||
/>
|
||||
@@ -267,7 +267,7 @@
|
||||
|
||||
// 搜索表单初始值
|
||||
const initialSearchState = {
|
||||
device_no: ''
|
||||
virtual_no: ''
|
||||
}
|
||||
|
||||
// 搜索表单
|
||||
@@ -275,13 +275,13 @@
|
||||
|
||||
// 授权表单
|
||||
const allocateForm = reactive({
|
||||
device_nos: [] as string[],
|
||||
virtual_nos: [] as string[],
|
||||
remark: ''
|
||||
})
|
||||
|
||||
// 授权表单验证规则
|
||||
const allocateRules = reactive<FormRules>({
|
||||
device_nos: [
|
||||
virtual_nos: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
@@ -315,7 +315,7 @@
|
||||
const searchFormItems: SearchFormItem[] = [
|
||||
{
|
||||
label: t('enterpriseDevices.searchForm.deviceNo'),
|
||||
prop: 'device_no',
|
||||
prop: 'virtual_no',
|
||||
type: 'input',
|
||||
config: {
|
||||
clearable: true,
|
||||
@@ -327,7 +327,7 @@
|
||||
// 列配置
|
||||
const columnOptions = [
|
||||
{ label: t('enterpriseDevices.table.deviceId'), prop: 'device_id' },
|
||||
{ label: t('enterpriseDevices.table.deviceNo'), prop: 'device_no' },
|
||||
{ label: t('enterpriseDevices.table.deviceNo'), prop: 'virtual_no' },
|
||||
{ label: t('enterpriseDevices.table.deviceName'), prop: 'device_name' },
|
||||
{ label: t('enterpriseDevices.table.deviceModel'), prop: 'device_model' },
|
||||
{ label: t('enterpriseDevices.table.cardCount'), prop: 'card_count' },
|
||||
@@ -344,7 +344,7 @@
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'device_no',
|
||||
prop: 'virtual_no',
|
||||
label: t('enterpriseDevices.table.deviceNo'),
|
||||
minWidth: 150
|
||||
},
|
||||
@@ -407,7 +407,7 @@
|
||||
const params: any = {
|
||||
page: pagination.page,
|
||||
page_size: pagination.pageSize,
|
||||
device_no: searchForm.device_no || undefined
|
||||
virtual_no: searchForm.virtual_no || undefined
|
||||
}
|
||||
|
||||
// 清理空值
|
||||
@@ -473,7 +473,7 @@
|
||||
const showAllocateDialog = () => {
|
||||
allocateDialogVisible.value = true
|
||||
deviceNosText.value = ''
|
||||
allocateForm.device_nos = []
|
||||
allocateForm.virtual_nos = []
|
||||
allocateForm.remark = ''
|
||||
if (allocateFormRef.value) {
|
||||
allocateFormRef.value.resetFields()
|
||||
@@ -487,7 +487,7 @@
|
||||
.split(/[,\s\n]+/)
|
||||
.map((no) => no.trim())
|
||||
.filter((no) => no.length > 0)
|
||||
allocateForm.device_nos = deviceNos
|
||||
allocateForm.virtual_nos = deviceNos
|
||||
}
|
||||
|
||||
// 执行授权
|
||||
@@ -496,12 +496,12 @@
|
||||
|
||||
await allocateFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (allocateForm.device_nos.length === 0) {
|
||||
if (allocateForm.virtual_nos.length === 0) {
|
||||
ElMessage.warning(t('enterpriseDevices.messages.deviceNosEmpty'))
|
||||
return
|
||||
}
|
||||
|
||||
if (allocateForm.device_nos.length > 100) {
|
||||
if (allocateForm.virtual_nos.length > 100) {
|
||||
ElMessage.warning(t('enterpriseDevices.messages.deviceNosMaxLimit'))
|
||||
return
|
||||
}
|
||||
@@ -509,7 +509,7 @@
|
||||
allocateLoading.value = true
|
||||
try {
|
||||
const res = await EnterpriseService.allocateDevices(enterpriseId.value, {
|
||||
device_nos: allocateForm.device_nos,
|
||||
virtual_nos: allocateForm.virtual_nos,
|
||||
remark: allocateForm.remark || undefined
|
||||
})
|
||||
|
||||
@@ -582,7 +582,7 @@
|
||||
recallLoading.value = true
|
||||
try {
|
||||
const res = await EnterpriseService.recallDevices(enterpriseId.value, {
|
||||
device_nos: selectedDevices.value.map((device) => device.device_no)
|
||||
virtual_nos: selectedDevices.value.map((device) => device.virtual_no)
|
||||
})
|
||||
|
||||
if (res.code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user