优化用户
This commit is contained in:
parent
bd1e01b992
commit
3811a5c8a8
@ -72,7 +72,7 @@
|
||||
v-model:visible="editVisible"
|
||||
@success="reloadTable('noRefresh')"
|
||||
/>
|
||||
|
||||
<!-- 上传文件 -->
|
||||
<userUpload v-if="importVisible" v-model:visible="importVisible" @success="reloadTable()" />
|
||||
</div>
|
||||
</template>
|
||||
|
@ -92,8 +92,7 @@
|
||||
label-field="name"
|
||||
value-field="id"
|
||||
placeholder="请选择角色"
|
||||
>
|
||||
</n-select>
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item
|
||||
label="部门"
|
||||
@ -135,8 +134,7 @@
|
||||
:options="optionData.levelList"
|
||||
label-field="name"
|
||||
value-field="id"
|
||||
>
|
||||
</n-select>
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item
|
||||
label="岗位"
|
||||
@ -157,8 +155,7 @@
|
||||
class="flex-1"
|
||||
clearable
|
||||
placeholder="请选择岗位"
|
||||
>
|
||||
</n-select>
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
<div class="flex">
|
||||
@ -288,6 +285,9 @@
|
||||
*/
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
|
||||
/**
|
||||
* 定义模态
|
||||
*/
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.userId ? '编辑用户' : '添加用户',
|
||||
subBtuText: '确定',
|
||||
@ -395,10 +395,18 @@
|
||||
positionList: [],
|
||||
});
|
||||
|
||||
/**
|
||||
* 上传发生变化
|
||||
*/
|
||||
function uploadChange(data: string[]) {
|
||||
formData.avatar = data.fileUrl;
|
||||
formData.avatarName = data.fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param file 文件参数
|
||||
*/
|
||||
const handleDelete = async (file) => {
|
||||
console.log(file);
|
||||
};
|
||||
@ -426,7 +434,10 @@
|
||||
setFormData({ userId: props.userId });
|
||||
}
|
||||
});
|
||||
//导出方法
|
||||
|
||||
/**
|
||||
* 定义函数
|
||||
*/
|
||||
defineExpose({
|
||||
openModal,
|
||||
});
|
||||
|
@ -27,7 +27,6 @@
|
||||
</template>
|
||||
新建
|
||||
</n-button>
|
||||
|
||||
<n-button
|
||||
type="error"
|
||||
@click="handleDelete"
|
||||
@ -73,7 +72,7 @@
|
||||
v-model:visible="editVisible"
|
||||
@success="reloadTable('noRefresh')"
|
||||
/>
|
||||
|
||||
<!-- 上传文件 -->
|
||||
<userUpload v-if="importVisible" v-model:visible="importVisible" @success="reloadTable()" />
|
||||
</div>
|
||||
</template>
|
||||
@ -101,10 +100,8 @@
|
||||
ToTopOutlined,
|
||||
FormOutlined,
|
||||
} from '@vicons/antd';
|
||||
import CreateModal from './CreateModal.vue';
|
||||
import editDialog from './edit.vue';
|
||||
import userUpload from './userUpload.vue';
|
||||
import { basicModal, useModal } from '@/components/Modal';
|
||||
import { downloadByData } from '@/utils/file/download';
|
||||
import { schemas } from './querySchemas';
|
||||
import { renderIcon } from '@/utils';
|
||||
@ -119,13 +116,20 @@
|
||||
const rowKeys = ref([]);
|
||||
const importVisible = ref(false);
|
||||
const exportLoading = ref(false);
|
||||
|
||||
const showModal = ref(false);
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
name: '',
|
||||
realname: '',
|
||||
role: '',
|
||||
status: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 400,
|
||||
title: '操作',
|
||||
@ -171,24 +175,36 @@
|
||||
},
|
||||
});
|
||||
|
||||
function addTable() {
|
||||
showModal.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
rowKeys.value = [];
|
||||
const result = await getUserList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 数据行选中事件
|
||||
* @param keys 参数
|
||||
*/
|
||||
function onCheckedRow(keys) {
|
||||
rowKeys.value = keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -199,6 +215,10 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleReset(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -209,6 +229,9 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||
labelWidth: 80,
|
||||
@ -232,6 +255,7 @@
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
*/
|
||||
@ -241,6 +265,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
*/
|
||||
@ -250,6 +275,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param id 参数
|
||||
@ -267,6 +293,7 @@
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行导出
|
||||
*/
|
||||
|
@ -125,6 +125,9 @@
|
||||
window.open(res.filePath);
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行弹窗提交
|
||||
*/
|
||||
const dialogSubmit = async () => {
|
||||
uploadRef.value?.submit();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user