yangg il y a 2 mois
Parent
commit
4276361d98

+ 2 - 2
src/views/digitalHuman/list/api.ts

@@ -18,7 +18,7 @@ export function GetObj(id: InfoReq) {
 
 export function AddObj(obj: AddReq) {
 	return request({
-		url: '/api/system/digital_human/create/',
+		url: '/api/system/digital_human/create',
 		method: 'post',
 		data: {...obj,tenant_id:1},
 	});
@@ -26,7 +26,7 @@ export function AddObj(obj: AddReq) {
 
 export function UpdateObj(obj: EditReq) {
 	return request({
-		url:"/api/system/digital_human/update/",// apiPrefix + obj.id + '/',
+		url:"/api/system/digital_human/update",// apiPrefix + obj.id + '/',
 		method: 'post',
 		data: {...obj,tenant_id:1},
 	});

+ 13 - 3
src/views/digitalHuman/list/index.vue

@@ -359,11 +359,21 @@ const handleDelete = (row: any) => {
 const fetchData = () => {
 	crudExpose.doRefresh();
 };
-const voiceList = ref([]);
+const voiceList = ref([
+	{ label: '龙小夏', value: 'longxiaoxia' },
+	{ label: '龙小春', value: 'longxiaochun' },
+	{ label: '龙小瑶', value: 'longxiaoyao' },
+	{ label: '龙小婧', value: 'longxiaojing' },
+	{ label: '龙青周', value: 'longqingzhou' },
+	{ label: '女声清新风格', value: 'female1' },
+	{ label: '女声稳重风格', value: 'female2' },
+	{ label: '男声清新风格', value: 'male1' },
+	{ label: '男声稳重风格', value: 'male2' },
+]);
 /* 获取语音列表 */
 const getVoiceList = async () => {
-	const response = await GetVoiceList();
-	voiceList.value = response.data;
+	/* const response = await GetVoiceList();
+	voiceList.value = response.data; */
 };
 // 页面打开后获取列表数据
 onMounted(async () => {

+ 4 - 3
src/views/position/detail/index.vue

@@ -161,8 +161,8 @@
         <div class="detail-item">
           <div class="detail-label">职位状态</div>
           <div class="detail-value">
-            <el-tag :type="getStatusType(positionData.job_type)">
-              {{ getStatusText(positionData.job_type) }}
+            <el-tag :type="getStatusType(positionData.status)">
+              {{ getStatusText(positionData.status) }}
             </el-tag>
           </div>
         </div>
@@ -1509,7 +1509,8 @@ const positionData = reactive({
   description: '',
   work_experience_required: '',
   education_required: '',
-  competency_tags: []
+  competency_tags: [],
+  status: 0
 });
 
 // 招聘流程数据 - 修改为普通数组而非 ref 对象

+ 12 - 0
src/views/position/list/api.ts

@@ -64,3 +64,15 @@ export function GetCompetencyList(query:any) {
 		params: {...query,tenant_id:1},
 	});
 }
+
+/* 发布职位 */
+export function PublishPosition(data:any) {
+	return request({
+		url: 'api/system/job/update_status',
+		method: 'post',
+		data: JSON.stringify(data),
+		headers: {
+			'Content-Type': 'application/json'
+		}
+	});
+}

+ 11 - 4
src/views/position/list/crud.tsx

@@ -122,12 +122,12 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 				buttons: {
 					view: {
 						show: true,
-						icon:"View",
+						iconRight:"View",
 						type:"text"
 					},
 					edit: {
 						show: auth('role:Update'),
-						icon:"Edit",
+						iconRight:"Edit",
 						type:"text",
 						click: (ctx) => {
 							context.router.push(`/position/detail?id=${ctx.row.id}`);
@@ -135,7 +135,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 					},
 					remove: {
 						show: auth('role:Delete'),
-						icon:"Delete",
+						iconRight:"Delete",
 						type:"text"
 					},
 					qrcode: {
@@ -147,7 +147,14 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
 						},
 						order: 4
 					},
-					
+					publish: {
+						text: '发布',
+						type: "text",
+						icon: '',
+						click: (ctx) => {
+							context.publishPosition(ctx.row);
+						},
+					},
 					/* permission: {
 						type: 'primary',
 						text: '权限配置',

+ 103 - 0
src/views/position/list/index.vue

@@ -26,6 +26,8 @@ import axios from 'axios';
 import { useRouter } from 'vue-router';
 import { successMessage } from '../../../utils/message';
 import BatchTagsDialog from './components/BatchTagsDialog.vue';
+import * as api from './api';
+import { ElMessageBox } from 'element-plus';
 
 const PermissionDrawerCom = defineAsyncComponent(() => import('./components/RoleDrawer.vue'));
 
@@ -72,6 +74,106 @@ async function generateQRCode(row: { id: string | number }) {
 	}
 }
 
+// 检查职位信息是否完整
+function checkPositionComplete(row: any): { isComplete: boolean; missing: string[] } {
+	const required = [
+		{ field: 'title', name: '职位名称' },
+		{ field: 'job_type', name: '职位类型' },
+		{ field: 'salary_range', name: '薪资范围' },
+		{ field: 'location', name: '工作地点' },
+		{ field: 'department', name: '所属部门' },
+		{ field: 'requirements', name: '职位要求' },
+		{ field: 'description', name: '职位描述' },
+		{ field: 'end_date', name: '截止日期' }
+	];
+
+	const missing = required
+		.filter(({ field }) => !row[field] || (typeof row[field] === 'string' && row[field].trim() === ''))
+		.map(({ name }) => name);
+
+	return {
+		isComplete: missing.length === 0,
+		missing
+	};
+}
+
+// 发布职位功能
+async function publishPosition(row: any) {
+	try {
+		const action = row.status === 2 ? '重新发布' : '发布';
+		
+		// 检查职位信息是否完整
+		const { isComplete, missing } = checkPositionComplete(row);
+		if (!isComplete) {
+			await ElMessageBox.alert(
+				`职位信息不完整,缺少以下必填信息:\n${missing.join('、')}\n\n请先完善职位信息后再发布。`,
+				'职位信息不完整',
+				{
+					confirmButtonText: '去完善',
+					type: 'warning',
+				}
+			);
+			// 跳转到编辑页面
+			router.push(`/position/detail?id=${row.id}`);
+			return;
+		}
+
+		// 检查截止日期是否过期
+		if (row.end_date && new Date(row.end_date) < new Date()) {
+			const result = await ElMessageBox.confirm(
+				`职位截止日期已过期(${row.end_date}),是否要更新截止日期后再发布?`,
+				'截止日期已过期',
+				{
+					confirmButtonText: '更新并发布',
+					cancelButtonText: '仍要发布',
+					distinguishCancelAndClose: true,
+					type: 'warning',
+				}
+			);
+			
+			if (result === 'confirm') {
+				// 跳转到编辑页面更新截止日期
+				router.push(`/position/detail?id=${row.id}`);
+				return;
+			}
+		}
+
+		const confirmText = row.status === 2 
+			? `确定要重新发布职位 "${row.title}" 吗?`
+			: `确定要发布职位 "${row.title}" 吗?发布后求职者即可看到此职位。`;
+
+		// 确认发布对话框
+		await ElMessageBox.confirm(
+			confirmText,
+			`确认${action}`,
+			{
+				confirmButtonText: `确定${action}`,
+				cancelButtonText: '取消',
+				type: 'warning',
+			}
+		);
+
+		// 调用发布API
+		const response = await api.PublishPosition({
+			job_id: row.id,
+			tenant_id: 1
+		});
+
+		if (response.code === 2000) {
+			successMessage(`职位${action}成功`);
+			// 刷新列表数据
+			crudExpose.doRefresh();
+		} else {
+			ElMessage.error(response.msg || `${action}失败`);
+		}
+	} catch (error) {
+		if (error !== 'cancel' && error !== 'close') {
+			console.error('发布职位失败:', error);
+			ElMessage.error('操作失败,请稍后重试');
+		}
+	}
+}
+
 // 创建 crud 配置
 const { crudBinding, crudRef, crudExpose } = useFs({
 	createCrudOptions,
@@ -80,6 +182,7 @@ const { crudBinding, crudRef, crudExpose } = useFs({
 		RoleMenuBtn, 
 		RoleMenuField,
 		generateQRCode,
+		publishPosition,
 		router,
 		$message: {
 			warning: (msg: string) => successMessage(msg)