generated from Leo_Ding/web-template
招聘
This commit is contained in:
parent
f980db53c7
commit
e820e58250
@ -82,6 +82,55 @@
|
||||
</a-row>
|
||||
|
||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||
|
||||
<a-modal v-model:visible="showEditModal" title="编辑区域" @ok="submitEdit" @cancel="showEditModal = false">
|
||||
<a-form :model="editFormData">
|
||||
<a-form-item label="选择区域">
|
||||
<a-select v-model:value="currentAreaId" @change="onAreaChange" placeholder="请选择区域">
|
||||
<a-select-option v-for="item in areaList" :key="item.id" :value="item.id">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="名称">
|
||||
<a-input v-model:value="editFormData.name" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="序号">
|
||||
<a-input-number v-model:value="editFormData.sequence" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="状态">
|
||||
<a-select v-model:value="editFormData.status">
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">禁用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <a-modal v-model:visible="showEditModal" title="编辑区域" @ok="submitEdit" @cancel="showEditModal = false">-->
|
||||
<!-- <a-form :model="editFormData">-->
|
||||
<!-- <a-form-item label="名称">-->
|
||||
<!-- <a-input v-model:value="editFormData.name" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="序号">-->
|
||||
<!-- <a-input-number v-model:value="editFormData.sequence" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <a-form-item label="状态">-->
|
||||
<!-- <a-select v-model:value="editFormData.status">-->
|
||||
<!-- <a-select-option value="enabled">启用</a-select-option>-->
|
||||
<!-- <a-select-option value="disabled">禁用</a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-form>-->
|
||||
<!-- </a-modal>-->
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -110,13 +159,16 @@ const columns = [
|
||||
{ title: '状态', dataIndex: 'status',width:80 , align: 'center'},
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
|
||||
const areaList = ref([]); // 列表数据
|
||||
const editDialogVisible = ref(false); // 弹框开关
|
||||
const editForm = reactive({
|
||||
const showEditModal = ref(false);
|
||||
const editFormData = ref({
|
||||
name: '',
|
||||
sequence: 0,
|
||||
status: 'disabled',
|
||||
});
|
||||
const currentAreaId = ref(null);
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||
usePagination()
|
||||
|
||||
@ -229,11 +281,44 @@ async function handleCreateJD() {
|
||||
if (config('http.code.success') === success) {
|
||||
areaList.value = data;
|
||||
console.log(areaList.value);
|
||||
openEditModal(data[0] || { name: '', sequence: 0, status: 'enabled' });
|
||||
paginationState.total = total;
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading();
|
||||
console.error('Error in handleCreateJD:', error);
|
||||
console.error('Error in handleCreateJD:', error?.message || error);
|
||||
|
||||
}
|
||||
}
|
||||
function openEditModal(areaItem) {
|
||||
editFormData.value = { ...areaItem };
|
||||
currentAreaId.value = areaItem.id;
|
||||
showEditModal.value = true;
|
||||
}
|
||||
|
||||
function onAreaChange(id) {
|
||||
const target = areaList.value.find(item => item.id === id);
|
||||
if (target) {
|
||||
editFormData.value = { ...target };
|
||||
}
|
||||
}
|
||||
|
||||
async function submitEdit() {
|
||||
try {
|
||||
showLoading();
|
||||
const res = await apis.recruitment.updateArea(editFormData.value);
|
||||
hideLoading();
|
||||
if (config('http.code.success') === res.success) {
|
||||
ElMessage.success('修改成功');
|
||||
showEditModal.value = false;
|
||||
handleCreateJD(); // 重新刷新列表
|
||||
} else {
|
||||
ElMessage.error('修改失败');
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading();
|
||||
console.error('Error in submitEdit:', error);
|
||||
ElMessage.error('请求异常');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user