1
This commit is contained in:
@@ -28,13 +28,14 @@
|
||||
<tables :columns="listColumns" :value="gridOption.data" :pageOption="gridOption.param.pageOption"
|
||||
@changePage="query"></tables>
|
||||
</div>
|
||||
<editModal ref="editModal" :columns="editColumns" :rules="gridOption.rules" @on-save="handleSaveSuccess">
|
||||
<editModal ref="editModal" :columns="editFormColumns" :rules="gridOption.rules" @on-save="handleSaveSuccess">
|
||||
</editModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import jobTypesServer from '@/api/work/job_types_server.js'
|
||||
import plaAccountServer from '@/api/profile/pla_account_server.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -44,8 +45,10 @@ export default {
|
||||
return {
|
||||
seachTypes: [
|
||||
{ key: 'name', value: '职位类型名称' },
|
||||
{ key: 'description', value: '描述' }
|
||||
{ key: 'description', value: '描述' },
|
||||
{ key: 'pla_account_id', value: '关联账户ID' }
|
||||
],
|
||||
plaAccountOptions: [],
|
||||
gridOption: {
|
||||
param: {
|
||||
seachOption: {
|
||||
@@ -63,6 +66,23 @@ export default {
|
||||
},
|
||||
listColumns: [
|
||||
{ title: 'ID', key: 'id', minWidth: 80 },
|
||||
{
|
||||
title: '关联账户',
|
||||
key: 'pla_account',
|
||||
minWidth: 200,
|
||||
render: (h, params) => {
|
||||
const id = params.row.pla_account_id
|
||||
const pa = params.row.pla_account
|
||||
if (id == null || id === '') {
|
||||
return h('span', { style: { color: '#999' } }, '-')
|
||||
}
|
||||
if (pa && (pa.name || pa.sn_code)) {
|
||||
const txt = `${pa.name || ''} (SN:${pa.sn_code || '-'})`
|
||||
return h('span', { attrs: { title: `ID:${id} ${txt}` } }, txt)
|
||||
}
|
||||
return h('span', { attrs: { title: '仅ID,账户可能已删除' } }, `ID:${id}`)
|
||||
}
|
||||
},
|
||||
{ title: '职位类型名称', key: 'name', minWidth: 150 },
|
||||
{ title: '描述', key: 'description', minWidth: 200 },
|
||||
{
|
||||
@@ -77,6 +97,11 @@ export default {
|
||||
{
|
||||
title: '常见技能关键词', key: 'commonSkills', minWidth: 200,
|
||||
},
|
||||
{
|
||||
title: '标题须含关键词',
|
||||
key: 'titleIncludeKeywords',
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
title: '排除关键词', key: 'excludeKeywords', minWidth: 200
|
||||
},
|
||||
@@ -147,6 +172,22 @@ export default {
|
||||
placeholder: '请输入JSON数组格式,例如:["外包", "销售", "客服"]',
|
||||
tooltip: '排除关键词列表,JSON数组格式'
|
||||
},
|
||||
{
|
||||
title: '标题须含关键词',
|
||||
key: 'titleIncludeKeywords',
|
||||
com: 'TextArea',
|
||||
required: false,
|
||||
placeholder: '请输入JSON数组格式,例如:["售前", "工程师"]',
|
||||
tooltip: 'JSON数组格式;仅匹配岗位标题,须同时包含每一项;与「常见技能关键词」无关'
|
||||
},
|
||||
{
|
||||
title: '关联账户',
|
||||
key: 'pla_account_id',
|
||||
type: 'select',
|
||||
required: false,
|
||||
tooltip: '可选;与设备/账号绑定,AI 同步 Tab 时会写入',
|
||||
options: []
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
key: 'is_enabled',
|
||||
@@ -171,12 +212,35 @@ export default {
|
||||
seachTypePlaceholder() {
|
||||
const item = this.seachTypes.find(item => item.key === this.gridOption.param.seachOption.key)
|
||||
return item ? `请输入${item.value}` : '请选择'
|
||||
},
|
||||
editFormColumns() {
|
||||
const accOpts = [{ value: '', label: '不关联' }, ...this.plaAccountOptions]
|
||||
return this.editColumns.map((col) => {
|
||||
if (col.key === 'pla_account_id') {
|
||||
return { ...col, options: accOpts }
|
||||
}
|
||||
return col
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadPlaAccountOptions()
|
||||
this.query(1)
|
||||
},
|
||||
methods: {
|
||||
loadPlaAccountOptions() {
|
||||
plaAccountServer.page({
|
||||
pageOption: { page: 1, pageSize: 999 },
|
||||
seachOption: {}
|
||||
}).then((res) => {
|
||||
if (res.code === 0 && res.data && res.data.rows) {
|
||||
this.plaAccountOptions = res.data.rows.map((r) => ({
|
||||
value: r.id,
|
||||
label: `${r.name || ''} (SN:${r.sn_code || r.id})`
|
||||
}))
|
||||
}
|
||||
}).catch(() => {})
|
||||
},
|
||||
query(page) {
|
||||
if (page) {
|
||||
this.gridOption.param.pageOption.page = page
|
||||
@@ -217,6 +281,8 @@ export default {
|
||||
description: '',
|
||||
commonSkills: '[]',
|
||||
excludeKeywords: '[]',
|
||||
titleIncludeKeywords: '[]',
|
||||
pla_account_id: '',
|
||||
is_enabled: 1,
|
||||
sort_order: 0
|
||||
})
|
||||
@@ -249,12 +315,26 @@ export default {
|
||||
excludeKeywords = JSON.stringify(excludeKeywords, null, 2)
|
||||
}
|
||||
|
||||
let titleIncludeKeywords = row.titleIncludeKeywords || '[]'
|
||||
if (typeof titleIncludeKeywords === 'string') {
|
||||
try {
|
||||
const parsed = JSON.parse(titleIncludeKeywords)
|
||||
titleIncludeKeywords = JSON.stringify(parsed, null, 2)
|
||||
} catch (e) {
|
||||
// 保持原样
|
||||
}
|
||||
} else {
|
||||
titleIncludeKeywords = JSON.stringify(titleIncludeKeywords, null, 2)
|
||||
}
|
||||
|
||||
this.$refs.editModal.editShow({
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
description: row.description || '',
|
||||
commonSkills: commonSkills,
|
||||
excludeKeywords: excludeKeywords,
|
||||
titleIncludeKeywords: titleIncludeKeywords,
|
||||
pla_account_id: row.pla_account_id != null && row.pla_account_id !== '' ? row.pla_account_id : '',
|
||||
is_enabled: row.is_enabled,
|
||||
sort_order: row.sort_order || 0
|
||||
})
|
||||
@@ -281,7 +361,7 @@ export default {
|
||||
// 处理 JSON 字段
|
||||
const formData = { ...data }
|
||||
|
||||
// 处理 commonSkills
|
||||
// 处理 commonSkills(JSON 数组)
|
||||
if (formData.commonSkills) {
|
||||
try {
|
||||
const parsed = typeof formData.commonSkills === 'string'
|
||||
@@ -294,7 +374,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 处理 excludeKeywords
|
||||
// 处理 excludeKeywords(JSON 数组)
|
||||
if (formData.excludeKeywords) {
|
||||
try {
|
||||
const parsed = typeof formData.excludeKeywords === 'string'
|
||||
@@ -307,6 +387,28 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 处理 titleIncludeKeywords(JSON 数组,与上两项一致)
|
||||
if (formData.titleIncludeKeywords) {
|
||||
try {
|
||||
const parsed = typeof formData.titleIncludeKeywords === 'string'
|
||||
? JSON.parse(formData.titleIncludeKeywords)
|
||||
: formData.titleIncludeKeywords
|
||||
formData.titleIncludeKeywords = Array.isArray(parsed) ? parsed : []
|
||||
} catch (e) {
|
||||
this.$Message.warning('标题须含关键词格式错误,将使用空数组')
|
||||
formData.titleIncludeKeywords = []
|
||||
}
|
||||
} else {
|
||||
formData.titleIncludeKeywords = []
|
||||
}
|
||||
|
||||
if (formData.pla_account_id === undefined || formData.pla_account_id === '') {
|
||||
formData.pla_account_id = null
|
||||
} else if (formData.pla_account_id != null) {
|
||||
const n = parseInt(formData.pla_account_id, 10)
|
||||
formData.pla_account_id = Number.isNaN(n) ? null : n
|
||||
}
|
||||
|
||||
const apiMethod = formData.id ? jobTypesServer.update : jobTypesServer.add
|
||||
apiMethod(formData).then(res => {
|
||||
if (res.code === 0) {
|
||||
|
||||
Reference in New Issue
Block a user