feat: 更新权限字段名称,移除导入组件
This commit is contained in:
parent
cf3af673b3
commit
3136e3ebbe
|
|
@ -117,7 +117,7 @@ async function submit() {
|
||||||
console.log('output >>>>> formData', formData);
|
console.log('output >>>>> formData', formData);
|
||||||
await formRef.value?.validate();
|
await formRef.value?.validate();
|
||||||
const permissions = formData.permissions.map((item, index) => ({
|
const permissions = formData.permissions.map((item, index) => ({
|
||||||
name: PERMISSIONS[index].label,
|
name: PERMISSIONS[index].name,
|
||||||
enabled: item,
|
enabled: item,
|
||||||
}));
|
}));
|
||||||
const params = {
|
const params = {
|
||||||
|
|
@ -154,9 +154,6 @@ async function submit() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onSwitchChange = ({ key, value, model }) => {
|
|
||||||
console.log(`开关 ${key} 变为 ${value},当前状态:`, model);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 页面加载时
|
// 页面加载时
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
||||||
|
|
@ -50,27 +50,33 @@ export const STATUS_CONST: Record<string, IValue> = {
|
||||||
|
|
||||||
export const PERMISSIONS = [
|
export const PERMISSIONS = [
|
||||||
{
|
{
|
||||||
label: '海外独家',
|
label: '海外先机',
|
||||||
value: 1, // 0:不可见;1:可见
|
value: 1, // 0:不可见;1:可见
|
||||||
|
name: 'hwxj',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '编辑精选',
|
label: '编辑精选',
|
||||||
value: 1,
|
value: 1,
|
||||||
|
name: 'bjjx',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '宏观知微',
|
label: '宏观知微',
|
||||||
value: 1,
|
value: 1,
|
||||||
|
name: 'hgzw',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '智能资讯榜',
|
label: '智能资讯榜',
|
||||||
value: 1,
|
value: 1,
|
||||||
|
name: 'znzx',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '热门行业',
|
label: '热门行业',
|
||||||
value: 1,
|
value: 1,
|
||||||
|
name: 'rthx',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '风口概念',
|
label: '风口概念',
|
||||||
value: 1,
|
value: 1,
|
||||||
|
name: 'fkgn',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,147 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="index">
|
|
||||||
<el-dialog v-model="dialogTableVisible" title="批量导入" width="600" @closed="close">
|
|
||||||
<div style="display: flex; flex-direction: column">
|
|
||||||
<el-button @click="downloadTemplate" style="width: 120px">下载标准模版</el-button>
|
|
||||||
<div v-if="errorMsg" class="error-message">{{ errorMsg }}</div>
|
|
||||||
</div>
|
|
||||||
<!-- :auto-upload="false"
|
|
||||||
:on-change="handleFileChange" -->
|
|
||||||
<el-upload
|
|
||||||
ref="uploadRef"
|
|
||||||
class="upload"
|
|
||||||
drag
|
|
||||||
:action="baseUrl + '/jnh/accounts/import'"
|
|
||||||
accept=".xlsx,.xls"
|
|
||||||
:headers="uploadHeader"
|
|
||||||
:on-success="handleSuccess"
|
|
||||||
>
|
|
||||||
<div class="upload_text">点击或拖拽文件至此处导入</div>
|
|
||||||
<div class="upload_tips">支持格式.xlsx/.xls,文件大小≤10MB</div>
|
|
||||||
</el-upload>
|
|
||||||
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="close">取消</el-button>
|
|
||||||
<el-button type="primary" @click="submit()"> 确认 </el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts" name="loginIndex">
|
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
|
||||||
import { NextLoading } from '/@/utils/loading';
|
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
||||||
import { getUploadUrl } from '/@/api/jnh';
|
|
||||||
import { Session } from '/@/utils/storage';
|
|
||||||
|
|
||||||
const baseUrl = ref(import.meta.env.VITE_API_UR);
|
|
||||||
const emit = defineEmits(['close']);
|
|
||||||
const rules = reactive({
|
|
||||||
name: [{ required: true, message: '必须填写姓名', trigger: 'blur' }],
|
|
||||||
mobile: [{ required: true, message: '必须填写手机号码', trigger: 'blur' }],
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = ref({});
|
|
||||||
const dialogTableVisible = ref(false);
|
|
||||||
const uploadRef = ref(null);
|
|
||||||
const selectedFile = ref(null);
|
|
||||||
|
|
||||||
const uploadHeader = ref({
|
|
||||||
'auth-token': `${Session.get('token')}`,
|
|
||||||
});
|
|
||||||
|
|
||||||
function open(data) {
|
|
||||||
dialogTableVisible.value = true;
|
|
||||||
if (data) {
|
|
||||||
form.value = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function close() {
|
|
||||||
// 清除上传组件中的文件
|
|
||||||
if (uploadRef.value) {
|
|
||||||
uploadRef.value.clearFiles();
|
|
||||||
}
|
|
||||||
// 重置相关变量
|
|
||||||
selectedFile.value = null;
|
|
||||||
errorMsg.value = '';
|
|
||||||
dialogTableVisible.value = false;
|
|
||||||
emit('close');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理文件选择
|
|
||||||
function handleFileChange(file, fileList) {
|
|
||||||
selectedFile.value = file;
|
|
||||||
// 清除之前的错误信息
|
|
||||||
errorMsg.value = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 确认上传
|
|
||||||
function submit() {
|
|
||||||
// if (!selectedFile.value) {
|
|
||||||
// errorMsg.value = '请选择要上传的文件';
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
close();
|
|
||||||
// // 手动触发上传
|
|
||||||
// if (uploadRef.value) {
|
|
||||||
// uploadRef.value.submit();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadTemplate() {
|
|
||||||
window.open('https://cankao.obs.cn-east-3.myhuaweicloud.com/%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx');
|
|
||||||
}
|
|
||||||
|
|
||||||
const errorMsg = ref('');
|
|
||||||
function handleSuccess(res) {
|
|
||||||
console.log('🚀 ~ handleSuccess ~ res:', res);
|
|
||||||
if (res.code === 200) {
|
|
||||||
ElMessage.success('导入成功');
|
|
||||||
errorMsg.value = res.data;
|
|
||||||
// 关闭对话框
|
|
||||||
// dialogTableVisible.value = false;
|
|
||||||
emit('close');
|
|
||||||
} else {
|
|
||||||
errorMsg.value = res.msg || '导入失败';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 页面加载时
|
|
||||||
onMounted(() => {
|
|
||||||
NextLoading.done();
|
|
||||||
baseUrl.value = import.meta.env.VITE_API_URL;
|
|
||||||
});
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
open,
|
|
||||||
close,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.upload {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload_text {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
|
|
||||||
.upload_tips {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #606266;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: red;
|
|
||||||
margin-top: 10px;
|
|
||||||
white-space: pre-line;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -75,7 +75,6 @@
|
||||||
</tableComponents>
|
</tableComponents>
|
||||||
|
|
||||||
<addDialog ref="addDialogRef" @close="getData"></addDialog>
|
<addDialog ref="addDialogRef" @close="getData"></addDialog>
|
||||||
<importDialog ref="importDialogRef" @close="getData"></importDialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -85,7 +84,6 @@ import { NextLoading } from '/@/utils/loading';
|
||||||
import tableComponents from '/@/components/tableComponents/index.vue';
|
import tableComponents from '/@/components/tableComponents/index.vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import addDialog from './add.vue';
|
import addDialog from './add.vue';
|
||||||
import importDialog from './import.vue';
|
|
||||||
import { Plus } from '@element-plus/icons-vue';
|
import { Plus } from '@element-plus/icons-vue';
|
||||||
import { disableTenant, enableTenant, getTenantList, exportTenant } from '/@/api/tenant';
|
import { disableTenant, enableTenant, getTenantList, exportTenant } from '/@/api/tenant';
|
||||||
import { COMPANYTYPE_CONST, ACCOUNTTYPE_CONST, STATUS_CONST } from './constant';
|
import { COMPANYTYPE_CONST, ACCOUNTTYPE_CONST, STATUS_CONST } from './constant';
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,8 @@ import { NextLoading } from '/@/utils/loading';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { Session } from '/@/utils/storage';
|
import { Session } from '/@/utils/storage';
|
||||||
|
|
||||||
const baseUrl = ref(import.meta.env.VITE_API_UR);
|
const baseUrl = ref(import.meta.env.VITE_API_URL);
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close']);
|
||||||
const rules = reactive({
|
|
||||||
name: [{ required: true, message: '必须填写姓名', trigger: 'blur' }],
|
|
||||||
mobile: [{ required: true, message: '必须填写手机号码', trigger: 'blur' }],
|
|
||||||
});
|
|
||||||
|
|
||||||
const form = ref({});
|
const form = ref({});
|
||||||
const dialogTableVisible = ref(false);
|
const dialogTableVisible = ref(false);
|
||||||
const uploadRef = ref(null);
|
const uploadRef = ref(null);
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<!-- <el-form-item>
|
||||||
<el-select v-model="formData.accountType" placeholder="账号类型(全部)" class="input" clearable @change="getData">
|
<el-select v-model="formData.accountType" placeholder="账号类型(全部)" class="input" clearable @change="getData">
|
||||||
<el-option v-for="item of ACCOUNTTYPE_CONST" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item of ACCOUNTTYPE_CONST" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="formData.status" placeholder="账号状态(全部)" class="input" clearable @change="getData">
|
<el-select v-model="formData.status" placeholder="账号状态(全部)" class="input" clearable @change="getData">
|
||||||
<el-option v-for="item of STATUS_CONST" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item of STATUS_CONST" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue