2025-10-24 18:33:58 +08:00
|
|
|
|
<template>
|
2025-11-03 13:48:00 +08:00
|
|
|
|
<!-- 业绩库页面:引用TableModel组件 -->
|
|
|
|
|
|
<el-card class="tool-container">
|
|
|
|
|
|
<!-- 返回按钮 -->
|
|
|
|
|
|
<div class="back-container">
|
|
|
|
|
|
<el-button type="default" size="small" @click="handleBack" class="back-btn">
|
|
|
|
|
|
返回
|
2025-10-24 18:33:58 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
|
</div>
|
2025-11-03 13:48:00 +08:00
|
|
|
|
<div class="table-container">
|
|
|
|
|
|
<TableModel
|
|
|
|
|
|
:formLabel="formLabel"
|
|
|
|
|
|
:columnsList="columnsList"
|
|
|
|
|
|
:request-api="listPerformance"
|
|
|
|
|
|
:sendParams="{ enterpriseId: enterpriseId }"
|
|
|
|
|
|
:showOperation="true"
|
|
|
|
|
|
:showRightTools="false"
|
|
|
|
|
|
ref="performanceTableRef"
|
|
|
|
|
|
>
|
|
|
|
|
|
<!-- 表格标题插槽 -->
|
|
|
|
|
|
<template slot="tableTitle">
|
|
|
|
|
|
<h3>业绩库列表</h3>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 表格顶部操作按钮插槽(新增按钮) -->
|
|
|
|
|
|
<template slot="tableActions">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
|
v-hasPermi="['enterpriseLibrary:performance:add']"
|
|
|
|
|
|
class="add-btn"
|
|
|
|
|
|
>
|
|
|
|
|
|
新增业绩
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 合同金额格式化插槽(适配金额保留2位小数) -->
|
|
|
|
|
|
<template slot="contractAmount" slot-scope="{ data }">
|
|
|
|
|
|
<span>{{ formatCurrency(data.contractAmount) }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 操作列插槽(查看/编辑/删除) -->
|
|
|
|
|
|
<template slot="handle" slot-scope="{ data }">
|
2025-10-24 18:33:58 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
type="text"
|
2025-11-03 13:48:00 +08:00
|
|
|
|
@click="handleView(data)"
|
2025-10-24 18:33:58 +08:00
|
|
|
|
v-hasPermi="['enterpriseLibrary:performance:detail']"
|
2025-11-03 13:48:00 +08:00
|
|
|
|
class="action-btn"
|
2025-10-24 18:33:58 +08:00
|
|
|
|
>
|
|
|
|
|
|
查看
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
type="text"
|
2025-11-03 13:48:00 +08:00
|
|
|
|
@click="handleEdit(data)"
|
2025-10-24 18:33:58 +08:00
|
|
|
|
v-hasPermi="['enterpriseLibrary:performance:edit']"
|
2025-11-03 13:48:00 +08:00
|
|
|
|
class="action-btn"
|
|
|
|
|
|
style="color: #EAA819;"
|
2025-10-24 18:33:58 +08:00
|
|
|
|
>
|
|
|
|
|
|
编辑
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
type="text"
|
2025-11-03 13:48:00 +08:00
|
|
|
|
@click="handleDelete(data)"
|
2025-10-24 18:33:58 +08:00
|
|
|
|
v-hasPermi="['enterpriseLibrary:performance:del']"
|
2025-11-03 13:48:00 +08:00
|
|
|
|
class="action-btn"
|
|
|
|
|
|
style="color: #DB3E29;"
|
2025-10-24 18:33:58 +08:00
|
|
|
|
>
|
|
|
|
|
|
删除
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</template>
|
2025-11-03 13:48:00 +08:00
|
|
|
|
</TableModel>
|
2025-10-24 18:33:58 +08:00
|
|
|
|
</div>
|
2025-11-03 13:48:00 +08:00
|
|
|
|
</el-card>
|
2025-10-24 18:33:58 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-11-03 13:48:00 +08:00
|
|
|
|
// 导入TableModel组件、配置文件、工具函数和接口
|
|
|
|
|
|
import TableModel from '@/components/TableModel2'
|
|
|
|
|
|
import { formLabel, columnsList } from './config'
|
|
|
|
|
|
import { encryptWithSM4, decryptWithSM4 } from '@/utils/sm'
|
|
|
|
|
|
import { listPerformance, delPerformance } from "@/api/enterpriseLibrary/performance/performance";
|
|
|
|
|
|
import { listAPI } from "@/api/enterpriseLibrary/personnel/personnel";
|
2025-10-24 18:33:58 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'Performance',
|
2025-11-03 13:48:00 +08:00
|
|
|
|
components: { TableModel }, // 注册TableModel组件
|
2025-10-24 18:33:58 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
formLabel, // 导入查询表单配置
|
|
|
|
|
|
columnsList, // 导入表格列配置
|
|
|
|
|
|
listPerformance, // 导入列表查询接口
|
|
|
|
|
|
enterpriseId: decryptWithSM4(this.$route.query.enterpriseId) || '0' // 解密企业ID
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
this.loadVoltageLevelDict()
|
|
|
|
|
|
this.loadProjectManagers()
|
2025-11-17 19:31:42 +08:00
|
|
|
|
this.loadProjcetTypeDict()
|
2025-11-03 13:48:00 +08:00
|
|
|
|
// 初始化时给表格组件传递企业ID参数,并加载列表
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
if (this.$refs.performanceTableRef) {
|
|
|
|
|
|
this.$refs.performanceTableRef.queryParams.enterpriseId = this.enterpriseId
|
|
|
|
|
|
this.$refs.performanceTableRef.getTableList()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-10-24 18:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2025-11-17 19:31:42 +08:00
|
|
|
|
|
|
|
|
|
|
loadProjcetTypeDict() {
|
|
|
|
|
|
// getDicts 的参数是字典类型编码:project_type
|
|
|
|
|
|
this.getDicts('project_type').then(response => {
|
|
|
|
|
|
const proTypeOptions = response.data.map(item => ({
|
|
|
|
|
|
label: item.dictLabel,
|
|
|
|
|
|
value: item.dictLabel
|
|
|
|
|
|
}))
|
|
|
|
|
|
const proTypeItem = this.formLabel.find(item => item.f_model === 'proType')
|
|
|
|
|
|
if (proTypeItem) {
|
|
|
|
|
|
proTypeItem.f_selList = proTypeOptions // 动态设置下拉选项
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
|
console.error('加载项目类型字典失败:', error)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
loadVoltageLevelDict() {
|
|
|
|
|
|
this.getDicts('voltage_level').then(response => {
|
|
|
|
|
|
const voltageOptions = response.data.map(item => ({
|
|
|
|
|
|
label: item.dictLabel,
|
|
|
|
|
|
value: item.dictLabel
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
const voltageItem = this.formLabel.find(item => item.f_model === 'voltageLevel')
|
|
|
|
|
|
if (voltageItem) {
|
|
|
|
|
|
voltageItem.f_selList = voltageOptions // 动态设置下拉选项
|
|
|
|
|
|
}
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}).catch(error => {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
console.error('加载电压等级字典失败:', error)
|
2025-10-24 18:33:58 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
loadProjectManagers() {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
enterpriseId: this.enterpriseId,
|
|
|
|
|
|
personnelPosition: 'project_manager'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
listAPI(params).then(response => {
|
|
|
|
|
|
const projectManagerOptions = (response.rows || []).map(person => ({
|
|
|
|
|
|
label: person.personnelName,
|
|
|
|
|
|
value: person.personnelName
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
const projectManagerItem = this.formLabel.find(item => item.f_model === 'projectManager');
|
|
|
|
|
|
if (projectManagerItem) {
|
|
|
|
|
|
projectManagerItem.f_selList = projectManagerOptions;
|
|
|
|
|
|
}
|
2025-10-24 18:33:58 +08:00
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
this.projectManager = projectManagerOptions;
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
|
console.error('主组件获取项目经理列表失败:', error);
|
|
|
|
|
|
this.projectManager = [];
|
|
|
|
|
|
const projectManagerItem = this.formLabel.find(item => item.f_model === 'projectManager');
|
|
|
|
|
|
if (projectManagerItem) {
|
|
|
|
|
|
projectManagerItem.f_selList = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-10-24 18:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
// 格式化金额:保留2位小数
|
|
|
|
|
|
formatCurrency(amount) {
|
|
|
|
|
|
if (!amount) return '0.00'
|
|
|
|
|
|
return parseFloat(amount).toFixed(2)
|
|
|
|
|
|
},
|
2025-11-17 19:31:42 +08:00
|
|
|
|
// 新增业绩:跳转新增/编辑共用页面(type=add)
|
2025-10-24 18:33:58 +08:00
|
|
|
|
handleAdd() {
|
|
|
|
|
|
this.$router.push({
|
2025-11-03 13:48:00 +08:00
|
|
|
|
name: "PerformanceForm",
|
2025-10-24 18:33:58 +08:00
|
|
|
|
query: {
|
|
|
|
|
|
type: encryptWithSM4('add'),
|
2025-11-03 13:48:00 +08:00
|
|
|
|
id: encryptWithSM4(''),
|
|
|
|
|
|
enterpriseId: encryptWithSM4(this.enterpriseId)
|
2025-10-24 18:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
title: '新增业绩'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-11-03 13:48:00 +08:00
|
|
|
|
// 查看业绩:跳转详情页
|
|
|
|
|
|
handleView(data) {
|
2025-10-24 18:33:58 +08:00
|
|
|
|
this.$router.push({
|
|
|
|
|
|
name: "PerformanceDetail",
|
|
|
|
|
|
query: {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
id: encryptWithSM4((data.performanceId ?? '').toString()),
|
|
|
|
|
|
enterpriseId: encryptWithSM4(this.enterpriseId)
|
2025-10-24 18:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
title: '业绩详情'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-11-17 19:31:42 +08:00
|
|
|
|
// 编辑业绩:跳转新增/编辑共用页面(type=edit)
|
2025-11-03 13:48:00 +08:00
|
|
|
|
handleEdit(data) {
|
2025-10-24 18:33:58 +08:00
|
|
|
|
this.$router.push({
|
2025-11-17 19:31:42 +08:00
|
|
|
|
name: "PerformanceForm", // 改为与新增共用同一页面组件
|
2025-10-24 18:33:58 +08:00
|
|
|
|
query: {
|
2025-11-17 19:31:42 +08:00
|
|
|
|
type: encryptWithSM4('edit'), // 传递操作类型为编辑
|
|
|
|
|
|
id: encryptWithSM4((data.performanceId ?? '').toString()), // 传递业绩ID
|
2025-11-03 13:48:00 +08:00
|
|
|
|
enterpriseId: encryptWithSM4(this.enterpriseId)
|
2025-10-24 18:33:58 +08:00
|
|
|
|
},
|
|
|
|
|
|
title: '编辑业绩'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-11-03 13:48:00 +08:00
|
|
|
|
// 删除业绩:调用接口并刷新列表
|
|
|
|
|
|
handleDelete(data) {
|
|
|
|
|
|
this.$confirm(`确定要删除【${data.proName}】吗?`, '警告', {
|
2025-10-24 18:33:58 +08:00
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
this.$modal.loading("正在删除,请稍候...")
|
|
|
|
|
|
// 调用删除接口(传递业绩ID和企业ID)
|
|
|
|
|
|
delPerformance({
|
|
|
|
|
|
performanceId: data.performanceId,
|
|
|
|
|
|
enterpriseId: this.enterpriseId
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
this.$modal.closeLoading()
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
this.$modal.msgSuccess("删除成功")
|
|
|
|
|
|
this.$refs.performanceTableRef.getTableList() // 重新加载表格
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$modal.msgError(res.msg || "删除失败")
|
|
|
|
|
|
}
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}).catch(error => {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
this.$modal.closeLoading()
|
|
|
|
|
|
this.$modal.msgError(error.message || "删除失败")
|
2025-10-24 18:33:58 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 返回上级页面
|
|
|
|
|
|
handleBack() {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
const obj = {
|
|
|
|
|
|
path: "/enterpriseKnowledge/index",
|
|
|
|
|
|
query: {
|
|
|
|
|
|
enterpriseId: encryptWithSM4(this.enterpriseId || '0')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-24 18:33:58 +08:00
|
|
|
|
this.$tab.closeOpenPage(obj)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2025-11-03 13:48:00 +08:00
|
|
|
|
.tool-container {
|
|
|
|
|
|
height: calc(100vh - 84px);
|
2025-11-21 14:59:16 +08:00
|
|
|
|
overflow: auto;
|
2025-11-05 14:21:39 +08:00
|
|
|
|
background: linear-gradient(180deg, #F1F6FF 20%, #E5EFFF 100%);
|
2025-11-21 14:59:16 +08:00
|
|
|
|
padding: 20px;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
.back-container {
|
2025-10-24 18:33:58 +08:00
|
|
|
|
display: flex;
|
2025-11-03 13:48:00 +08:00
|
|
|
|
justify-content: flex-end;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
align-items: center;
|
2025-11-03 13:48:00 +08:00
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
padding: 0 20px;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
|
|
|
|
|
|
.back-btn {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
width: 98px;
|
|
|
|
|
|
height: 36px;
|
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
|
box-shadow: 0px 4px 8px 0px rgba(76, 76, 76, 0.2);
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
transition: all 0.3s ease;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
|
|
|
|
|
|
&:hover {
|
2025-11-03 13:48:00 +08:00
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
color: #409EFF;
|
|
|
|
|
|
box-shadow: 0px 6px 12px 0px rgba(76, 76, 76, 0.3);
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
.add-btn {
|
|
|
|
|
|
width: 121px;
|
|
|
|
|
|
height: 36px;
|
|
|
|
|
|
background: #1F72EA;
|
|
|
|
|
|
box-shadow: 0px 4px 8px 0px rgba(51, 135, 255, 0.5);
|
2025-10-24 18:33:58 +08:00
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
color: #fff;
|
2025-11-03 13:48:00 +08:00
|
|
|
|
border: none;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
transition: all 0.3s;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
&:hover {
|
|
|
|
|
|
background: #4A8BFF;
|
|
|
|
|
|
box-shadow: 0px 6px 12px 0px rgba(51, 135, 255, 0.6);
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
.action-btn {
|
|
|
|
|
|
margin-right: 8px;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
|
2025-11-03 13:48:00 +08:00
|
|
|
|
&:last-child {
|
|
|
|
|
|
margin-right: 0;
|
2025-10-24 18:33:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|