This commit is contained in:
张成
2025-12-29 15:27:55 +08:00
parent eed08a30fb
commit 517a320627
4 changed files with 40 additions and 95 deletions

View File

@@ -26,11 +26,11 @@ const baseConfig = {
// 开发环境配置 // 开发环境配置
const developmentConfig = { const developmentConfig = {
...baseConfig, ...baseConfig,
apiUrl: 'http://localhost:9097/admin_api/', // apiUrl: 'http://localhost:9097/admin_api/',
uploadUrl: 'http://localhost:9097/admin_api/upload', // uploadUrl: 'http://localhost:9097/admin_api/upload',
// apiUrl: 'https://work.light120.com/admin_api/', apiUrl: 'https://work.light120.com/admin_api/',
// uploadUrl: 'https://work.light120.com/admin_api/upload', uploadUrl: 'https://work.light120.com/admin_api/upload',
// 开发环境显示更多调试信息 // 开发环境显示更多调试信息
debug: true debug: true
} }

View File

@@ -349,12 +349,12 @@ export default {
{ title: '密码', key: 'pwd', com: 'Password', required: true }, { title: '密码', key: 'pwd', com: 'Password', required: true },
], ],
listColumns: [ listColumns: [
{ title: 'ID', key: 'id' }, { title: '账户名', key: 'name', minWidth: 120 },
{ title: '账户名', key: 'name' }, { title: '设备SN码', key: 'sn_code', minWidth: 150 },
{ title: '设备SN码', key: 'sn_code'},
{ {
title: '平台', title: '平台',
key: 'platform_type', key: 'platform_type',
minWidth: 100,
render: (h, params) => { render: (h, params) => {
const platformMap = { const platformMap = {
'boss': { text: 'Boss直聘', color: 'blue' }, 'boss': { text: 'Boss直聘', color: 'blue' },
@@ -364,26 +364,10 @@ export default {
return h('Tag', { props: { color: platform.color } }, platform.text) return h('Tag', { props: { color: platform.color } }, platform.text)
} }
}, },
{ title: '登录名', key: 'login_name'},
{ title: '搜索关键词', key: 'keyword' },
{ title: '用户地址', key: 'user_address' },
{
title: '经纬度',
key: 'location',
render: (h, params) => {
const lon = params.row.user_longitude;
const lat = params.row.user_latitude;
if (lon && lat) {
return h('span', `${lat}, ${lon}`)
}
return h('span', { style: { color: '#999' } }, '未设置')
}
},
{ {
title: '在线状态', title: '在线状态',
key: 'is_online', key: 'is_online',
minWidth: 90,
render: (h, params) => { render: (h, params) => {
return h('Tag', { return h('Tag', {
props: { color: params.row.is_online ? 'success' : 'default' } props: { color: params.row.is_online ? 'success' : 'default' }
@@ -393,12 +377,7 @@ export default {
{ {
title: '自动投递', title: '自动投递',
key: 'auto_deliver', key: 'auto_deliver',
com: "Radio", minWidth: 90,
options: [
{ value: 1, label: '开启' },
{ value: 0, label: '关闭' }
],
render: (h, params) => { render: (h, params) => {
return h('Tag', { return h('Tag', {
props: { color: params.row.auto_deliver ? 'success' : 'default' } props: { color: params.row.auto_deliver ? 'success' : 'default' }
@@ -408,11 +387,7 @@ export default {
{ {
title: '自动沟通', title: '自动沟通',
key: 'auto_chat', key: 'auto_chat',
"com": "Radio", minWidth: 90,
options: [
{ value: 1, label: '开启' },
{ value: 0, label: '关闭' }
],
render: (h, params) => { render: (h, params) => {
return h('Tag', { return h('Tag', {
props: { color: params.row.auto_chat ? 'success' : 'default' } props: { color: params.row.auto_chat ? 'success' : 'default' }
@@ -422,7 +397,7 @@ export default {
{ {
title: '剩余天数', title: '剩余天数',
key: 'remaining_days', key: 'remaining_days',
minWidth: 100,
render: (h, params) => { render: (h, params) => {
const remainingDays = params.row.remaining_days || 0 const remainingDays = params.row.remaining_days || 0
let color = 'success' let color = 'success'
@@ -436,52 +411,10 @@ export default {
}, remainingDays > 0 ? `${remainingDays}` : '已过期') }, remainingDays > 0 ? `${remainingDays}` : '已过期')
} }
}, },
{
title: '授权日期',
key: 'authorization_date',
render: (h, params) => {
if (!params.row.authorization_date) {
return h('span', { style: { color: '#999' } }, '未授权')
}
const date = new Date(params.row.authorization_date)
return h('span', this.formatDate(date))
}
},
{
title: '过期时间',
key: 'expire_date',
render: (h, params) => {
if (!params.row.authorization_date || !params.row.authorization_days) {
return h('span', { style: { color: '#999' } }, '未授权')
}
const authDate = new Date(params.row.authorization_date)
const expireDate = new Date(authDate.getTime() + params.row.authorization_days * 24 * 60 * 60 * 1000)
const remainingDays = params.row.remaining_days || 0
return h('span', {
style: { color: remainingDays <= 0 ? '#ed4014' : remainingDays <= 7 ? '#ff9900' : '#515a6e' }
}, this.formatDate(expireDate))
}
},
{
title: '自动活跃',
key: 'auto_active',
"com": "Radio",
options: [
{ value: 1, label: '开启' },
{ value: 0, label: '关闭' }
],
render: (h, params) => {
return h('Tag', {
props: { color: params.row.auto_active ? 'success' : 'default' }
}, params.row.auto_active ? '开启' : '关闭')
}
},
{ {
title: '启用状态', title: '启用状态',
key: 'is_enabled', key: 'is_enabled',
minWidth: 100,
render: (h, params) => { render: (h, params) => {
return h('i-switch', { return h('i-switch', {
props: { props: {
@@ -496,7 +429,6 @@ export default {
}) })
} }
}, },
{ title: '创建时间', key: 'create_time', },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
@@ -640,18 +572,21 @@ export default {
} }
this.query(1) this.query(1)
}, },
async handleSaveSuccess({ data }) { async handleSaveSuccess({ data, isEdit } = {}) {
try { try {
// 如果是新增(来自 editModaldata 只包含必填字段,直接保存 // 如果是新增(来自 editModaldata 只包含必填字段,直接保存
if (data && !data.id) { if (data && !data.id && !isEdit) {
await plaAccountServer.add(data) await plaAccountServer.add(data)
this.$Message.success('保存成功!') this.$Message.success('保存成功!')
} }
// 编辑时由 FloatPanel 组件PlaAccountEdit处理保存这里只刷新列表 // 编辑时由 FloatPanel 组件PlaAccountEdit处理保存这里只刷新列表
this.query(this.gridOption.param.pageOption.page) // 刷新列表,保持当前页码
this.query(this.gridOption.param.pageOption.page || 1)
} catch (error) { } catch (error) {
console.error('保存失败:', error) console.error('保存失败:', error)
this.$Message.error('保存失败:' + (error.message || '请稍后重试')) // 优先从 error.response.data.message 获取,然后是 error.message
const errorMsg = error.response?.data?.message || error.message || '请稍后重试'
this.$Message.error('保存失败:' + errorMsg)
} }
}, },
// 显示账号详情 // 显示账号详情

View File

@@ -23,8 +23,10 @@
</FormItem> </FormItem>
<FormItem label="平台" prop="platform_type"> <FormItem label="平台" prop="platform_type">
<Select v-model="formData.platform_type" placeholder="请选择平台"> <Select v-model="formData.platform_type" placeholder="请选择平台">
<Option value="1">Boss直聘</Option> <Option value="boss">Boss直聘</Option>
<Option value="2">猎聘</Option> <Option value="liepin">猎聘</Option>
<Option value="zhipin">智联招聘</Option>
<Option value="58">58同城</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="登录名" prop="login_name"> <FormItem label="登录名" prop="login_name">
@@ -545,7 +547,8 @@ export default {
this.$Message.success('保存成功!') this.$Message.success('保存成功!')
this.$refs.floatPanel.hide() this.$refs.floatPanel.hide()
this.$emit('on-save') // 触发保存成功事件,通知父组件刷新列表
this.$emit('on-save', { isEdit: this.isEdit, data: saveData })
} catch (error) { } catch (error) {
console.error('保存失败:', error) console.error('保存失败:', error)
this.$Message.error('保存失败:' + (error.message || '请稍后重试')) this.$Message.error('保存失败:' + (error.message || '请稍后重试'))

View File

@@ -28,7 +28,7 @@
<tables :columns="listColumns" :value="gridOption.data" :pageOption="gridOption.param.pageOption" <tables :columns="listColumns" :value="gridOption.data" :pageOption="gridOption.param.pageOption"
@changePage="query"></tables> @changePage="query"></tables>
</div> </div>
<editModal ref="editModal" :columns="editColumns" :rules="gridOption.rules" @on-save="handleSaveSuccess"> <editModal ref="editModal" :columns="editColumns" :rules="gridOption.rules" >
</editModal> </editModal>
</div> </div>
</template> </template>
@@ -41,7 +41,7 @@ export default {
let rules = {} let rules = {}
rules["name"] = [{ required: true, message: '请填写套餐名称', trigger: 'blur' }] rules["name"] = [{ required: true, message: '请填写套餐名称', trigger: 'blur' }]
rules["duration"] = [{ required: true, message: '请填写时长描述', trigger: 'blur' }] rules["duration"] = [{ required: true, message: '请填写时长描述', trigger: 'blur' }]
rules["days"] = [{ required: true, message: '请填写天数', trigger: 'blur' }] rules["days"] = [{ required: true, type: 'number', message: '请填写天数', trigger: 'blur' }]
rules["price"] = [{ required: true, message: '请填写价格', trigger: 'blur' }] rules["price"] = [{ required: true, message: '请填写价格', trigger: 'blur' }]
return { return {
@@ -203,7 +203,7 @@ export default {
{ {
title: '是否推荐', title: '是否推荐',
key: 'featured', key: 'featured',
type: 'radio', com: 'Radio',
required: true, required: true,
options: [ options: [
{ value: 1, label: '推荐' }, { value: 1, label: '推荐' },
@@ -213,7 +213,7 @@ export default {
{ {
title: '是否启用', title: '是否启用',
key: 'is_active', key: 'is_active',
type: 'radio', com: 'Radio',
required: true, required: true,
options: [ options: [
{ value: 1, label: '启用' }, { value: 1, label: '启用' },
@@ -221,7 +221,7 @@ export default {
] ]
}, },
{ {
title: '排序顺序', title: '排序',
key: 'sort_order', key: 'sort_order',
type: 'number', type: 'number',
required: false, required: false,
@@ -276,7 +276,8 @@ export default {
this.query(1) this.query(1)
}, },
showAddWarp() { showAddWarp() {
this.$refs.editModal.show({
let editRow={
name: '', name: '',
duration: '', duration: '',
days: 0, days: 0,
@@ -288,7 +289,8 @@ export default {
featured: 0, featured: 0,
is_active: 1, is_active: 1,
sort_order: 0 sort_order: 0
}) }
this.$refs.editModal.show(editRow)
}, },
edit(row) { edit(row) {
// 解析 JSON 字段 // 解析 JSON 字段
@@ -306,7 +308,7 @@ export default {
features = JSON.stringify(features, null, 2) features = JSON.stringify(features, null, 2)
} }
this.$refs.editModal.editShow({ let editRow={
id: row.id, id: row.id,
name: row.name, name: row.name,
duration: row.duration || '', duration: row.duration || '',
@@ -319,6 +321,11 @@ export default {
featured: row.featured, featured: row.featured,
is_active: row.is_active, is_active: row.is_active,
sort_order: row.sort_order || 0 sort_order: row.sort_order || 0
}
this.$refs.editModal.editShow(editRow,(newRow)=>{
debugger
this.handleSaveSuccess(newRow)
}) })
}, },
del(row) { del(row) {