项目对标管理下的项目评价项管理,事业部管理功能开发

This commit is contained in:
lSun 2025-07-16 17:46:33 +08:00
parent 27f06c264d
commit 5a2521ab42
4 changed files with 681 additions and 0 deletions

54
src/api/basic/pro/eval.js Normal file
View File

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询项目评价列表
export function listEval(query) {
return request({
url: '/basic/pro/evalItem/list',
method: 'get',
params: query
})
}
// 查询项目评价详细
export function getEval(id) {
return request({
url: '/basic/pro/evalItem/' + id,
method: 'get'
})
}
// 新增项目评价
export function addEval(data) {
return request({
url: '/basic/pro/evalItem',
method: 'post',
data: data
})
}
// 修改项目评价
export function updateEval(data) {
return request({
url: '/basic/pro/evalItem',
method: 'put',
data: data
})
}
// 删除项目评价
export function delEval(id) {
return request({
url: '/basic/pro/evalItem/' + id,
method: 'delete'
})
}
// 查询项目评价列表下拉选
export function selectEval(query) {
return request({
url: '/basic/pro/evalItem/getSelectList',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询列表
export function listProUint(query) {
return request({
url: '/basic/pro/proUint/list',
method: 'get',
params: query
})
}
// 查询详细
export function getProUint(id) {
return request({
url: '/basic/pro/proUint/' + id,
method: 'get'
})
}
// 新增
export function addProUint(data) {
return request({
url: '/basic/pro/proUint',
method: 'post',
data: data
})
}
// 修改
export function updateProUint(data) {
return request({
url: '/basic/pro/proUint',
method: 'put',
data: data
})
}
// 删除
export function delProUint(id) {
return request({
url: '/basic/pro/proUint/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,362 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="评价项名称" prop="evalName">
<el-input
v-model="queryParams.evalName"
placeholder="请输入评价项名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['basic:pro:evalItem:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="evalList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="evalName" label="评价项名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="分值" width="200"></el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['basic:pro:evalItem:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['basic:pro:evalItem:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['basic:pro:evalItem:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改评价项对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="评价项名称:" prop="evalName">
<el-input v-model="form.evalName" placeholder="请输入评价项名称" maxlength="50" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="上级评价项:">
<el-select v-model="form.parentId" style="width: 100%">
<el-option label="无上级" :value="0"></el-option>
<el-option
v-for="dict in evalOptions"
:key="dict.id"
:label="dict.evalName"
:value="Number(dict.id)"
>{{dict.evalName}}</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="分值:" class="el-form-item__label" prop="score" v-if="form.parentId !== 0">
<el-input-number
v-model="form.score"
:min="0.01"
:max="100.00"
:step="0.01"
:precision="2"
step-strictly
controls-position="right"
placeholder="请输入分值" style="width: 100%;"
@input="(value) => handleScoreInput(value)"
@paste.native="(e) => e.preventDefault()"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listEval, getEval, delEval, addEval, updateEval, selectEval} from "@/api/basic/pro/eval"
export default {
name: "EvaluativeItems",
data() {
return {
//
loading: true,
//
showSearch: true,
//
evalList: [],
//
evalOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
evalName: undefined,
},
//
form: {},
//
rules: {
parentId: [
{ type: 'number', message: '请选择一个上级评价项', trigger: 'change' }
],
evalName: [
{ required: true, message: "评价项名称不能为空", trigger: "blur" }
],
score: [
{ required: false },
{ validator: (rule, value, callback) => {
if (this.form.parentId !== 0 && (typeof value !== 'number' || value <= 0)) {
callback(new Error('请输入大于0的分数'));
} else if (this.form.parentId !== 0) {
const strVal = value.toString();
const [int, dec] = strVal.split('.');
if (int.length > 5 || (dec && dec.length > 2)) {
callback(new Error('分值最多5位整数和2位小数'));
} else {
callback();
}
} else {
callback();
}
}, trigger: 'blur'
}
]
}
}
},
created() {
this.getList()
},
methods: {
/** 查询评价项列表 */
getList() {
this.loading = true
listEval(this.queryParams).then(response => {
this.evalList = this.handleTree(response.data, "id")
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: undefined,
parentId: 0,
evalName: undefined,
score: undefined,
leve: 1,
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset()
this.form.parentId = 0
this.open = true
this.title = "添加评价项"
selectEval().then(response => {
this.evalOptions = response.data.map(item => ({
...item,
id: Number(item.id) // number
}));
})
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false
this.isExpandAll = !this.isExpandAll
this.$nextTick(() => {
this.refreshTable = true
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
getEval(row.id).then(response => {
const data = response.data;
// parentId number
this.form = {
...data,
parentId: data.parentId ? Number(data.parentId) : 0
};
this.open = true
this.title = "修改评价项"
selectEval().then(response => {
this.evalOptions = response.data.map(item => ({
...item,
id: Number(item.id) // number
}));
})
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if(this.form.parentId ==0){
this.form.leve = 1
}else{
this.form.leve = 2
}
if (this.form.id != undefined) {
updateEval(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addEval(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.evalName + '"的数据项?').then(function() {
return delEval(row.id)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
handleScoreInput(value) {
if (!value && value !== 0) {
this.form.score = undefined;
return;
}
let strValue = value.toString();
//
if (!/^(\d+)(\.\d{0,2})?$/.test(strValue)) {
//
strValue = strValue.replace(/[^0-9.]/g, ''); //
const parts = strValue.split('.');
if (parts.length > 2) {
// ->
strValue = parts[0] + '.' + parts.slice(1).join('');
}
if (parts[1]) {
parts[1] = parts[1].slice(0, 2); //
strValue = parts[0] + '.' + parts[1];
} else {
strValue = parts[0];
}
}
const [integerPart, decimalPart] = strValue.split('.');
// 5
const limitedInteger = integerPart.slice(0, 5);
const limitedDecimal = decimalPart ? decimalPart : '';
const newValue = limitedDecimal
? parseFloat(`${limitedInteger}.${limitedDecimal}`)
: parseInt(limitedInteger);
this.form.score = isNaN(newValue) ? undefined : newValue;
},
}
}
</script>
<style scoped>
.el-form-item__label {
position: relative;
width: 101%;
}
.el-form-item__label::before {
content: '*';
color: #F56C6C; /* 红色 */
margin-right: 4px;
position: absolute;
left: 45px;
top: 0;
}
</style>

View File

@ -0,0 +1,221 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="85px">
<el-form-item label="事业部名称" prop="unitName">
<el-input
v-model="queryParams.unitName"
placeholder="请输入事业部名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['basic:pro:proUint:add']"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="proUintList">
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="事业部名称" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="排序" align="center" prop="deptSort" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['basic:pro:proUint:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['basic:pro:proUint:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="事业部名称:" prop="unitName">
<el-input v-model="form.unitName" placeholder="请输入事业部名称" />
</el-form-item>
<el-form-item label="排序:" prop="deptSort">
<el-input-number
v-model="form.deptSort"
:min="1"
:max="10000"
:step="1"
step-strictly
controls-position="right"
placeholder="请输入排序"
style="width: 100%"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProUint, getProUint, delProUint, addProUint, updateProUint } from "@/api/basic/pro/proUint"
export default {
name: "ProUint",
data() {
return {
//
loading: true,
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
proUintList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
unitName: undefined
},
//
form: {},
//
rules: {
unitName: [
{ required: true, message: "事业部名称不能为空", trigger: "blur" }
],
deptSort: [
{ required: true, message: "排序不能为空", trigger: "blur" }
]
}
}
},
created() {
this.getList()
},
methods: {
/** 查询字典类型列表 */
getList() {
this.loading = true
listProUint(this.queryParams).then(response => {
this.proUintList = response.rows
this.total = response.total
this.loading = false
}
)
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
id: undefined,
unitName: undefined,
deptSort: 0
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加字典类型"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
getProUint(row.id).then(response => {
this.form = response.data
this.open = true
this.title = "修改字典类型"
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
updateProUint(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addProUint(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delProUint(row.id)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
}
}
</script>