eab1ac74 by lihua

估值模型功能提交

1 parent 2a4a9f87
......@@ -48,3 +48,39 @@ export const sendEntryMsg = (params) => request({
method: 'post',
params
});
/** ----------------------------------------估值模型接口--------------------------------- */
/** 获取数据产品估值模型列表 */
export const getValuationModelList = (params) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/page-list`,
method: 'post',
data: params
})
/** 保存估值模型 */
export const saveValuationMode = (params) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/save`,
method: 'post',
data: params
})
/** 更新估值模型 */
export const updateValuationMode = (params) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/update`,
method: 'put',
data: params
})
/** 删除估值模型 */
export const deleteValuationMode = (params) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/delete`,
method: 'delete',
data: params
})
/** 获取估值模型详情 */
export const getValuationModelDetail = (params) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/detail?guid=${params.guid}`,
method: 'get'
})
\ No newline at end of file
......
......@@ -68,6 +68,45 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
path: '/data-entry/valuation-model',
component: Layout,
meta: {
title: '估值模型',
icon: 'sidebar-videos',
},
children: [
{
path: '',
name: 'valuationModel',
component: () => import('@/views/data_transaction/valuationModel.vue'),
meta: {
title: '估值模型',
sidebar: false,
breadcrumb: false,
cache: true
},
},
{
path: 'valuation-model-create',
name: 'valuationModelCreate',
component: () => import('@/views/data_transaction/valuationModelCreate.vue'),
meta: {
title: '新建估值模型',
sidebar: false,
breadcrumb: false,
cache: true,
editPage: true,
reuse: true
},
beforeEnter: (to, from) => {
if (to.query.guid) {
to.meta.title = `编辑-${to.query.name}`;
}
}
},
],
},
]
export default routes
......
const useEntryStore = defineStore(
// api标签分类guid
'isRefresh',
() => {
const isRefresh = ref(false);
function setIsRefresh(update: boolean) {
isRefresh.value = update;
}
return {
isRefresh,
setIsRefresh,
}
},
)
export default useEntryStore
\ No newline at end of file
<script lang="ts" setup name="valuationModel">
import TableTools from "@/components/Tools/table_tools.vue";
import { commonPageConfig } from '@/components/PageNav/index';
import {
getValuationModelList,
deleteValuationMode
} from '@/api/modules/dataEntry';
import { TableColumnWidth } from "@/utils/enum";
import { changeNum } from "@/utils/common";
import useEntryStore from "@/store/modules/dataEntry";
const entryStore = useEntryStore();
const router = useRouter()
const { proxy } = getCurrentInstance() as any;
/** 头部搜索框配置 */
const searchItemList = ref([
{
type: "input",
label: "",
field: "damName",
default: "",
placeholder: "数据产品名称",
clearable: true,
},
{
type: "select",
label: "",
field: "evaluateMethod",
default: "",
placeholder: "评估方法",
options: [
{ label: "成本法", value: "1" },
{ label: "收益法", value: "2" },
],
clearable: true,
}
]);
/** 分页及搜索传参信息配置。 */
const page = ref({
...commonPageConfig,
damName: '',
evaluateMethod: ''
});
const tableSelectRowData: any = ref([]);
const tableInfo = ref({
id: 'valuation-model-table',
multiple: true,
fields: [
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "数据产品名称", field: "damName", width: 160 },
{
label: "评估方法", field: "evaluateMethod", width: 140, getName: (scope) => {
return scope.row.evaluateMethod == '1' ? '成本法' : '收益法';
}
},
{ label: "评估基准日", field: "evaluateBaseDate", width: TableColumnWidth.DATE, },
{
label: "评估价值(元)", field: "damValuation", width: 160, align: 'right'
},
{ label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME },
{ label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
],
data: [],
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
width: 140,
fixed: 'right',
btns: (scope) => {
let btnsArr: any = [];
btnsArr.push({
label: "编辑", value: "edit", click: (scope) => {
router.push({
name: 'valuationModelCreate',
query: {
guid: scope.row.guid,
name: scope.row.damName
}
})
}
});
btnsArr.push({
label: "删除", value: "delete", click: (scope) => {
proxy.$openMessageBox('此操作将永久删除, 是否继续?', () => {
deleteValuationMode([scope.row.guid]).then((res: any) => {
if (res.code == proxy.$passCode) {
page.value.curr = 1;
getTableData();
proxy.$ElMessage({
type: "success",
message: "删除成功",
});
} else {
proxy.$ElMessage({
type: 'error',
message: res.msg,
})
}
})
}, () => {
proxy.$ElMessage.info("已取消删除");
})
}
});
return btnsArr
},
},
loading: false
})
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
searchItemList.value.map((item) => (item.default = ""));
page.value.damName = '';
page.value.evaluateMethod = "";
} else {
page.value.damName = val.damName;
page.value.evaluateMethod = val.evaluateMethod;
}
getTableData();
};
const getTableData = () => {
tableInfo.value.loading = true
getValuationModelList({
pageIndex: page.value.curr,
pageSize: page.value.limit,
damName: page.value.damName,
evaluateMethod: page.value.evaluateMethod
}).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || {}
tableInfo.value.data = data.records || []
tableInfo.value.page.limit = data.pageSize
tableInfo.value.page.curr = data.pageIndex
tableInfo.value.page.rows = data.totalRows
} else {
proxy.$ElMessage({
type: 'error',
message: res.msg,
})
}
tableInfo.value.loading = false
}).catch(() => {
tableInfo.value.loading = false
})
};
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
tableInfo.value.page.curr = page.value.curr;
tableInfo.value.page.limit = page.value.limit;
getTableData();
};
const tableSelectionChange = (val) => {
tableSelectRowData.value = val;
};
const newCreate = () => {
router.push({
name: 'valuationModelCreate'
});
}
const batchDelete = () => {
if (tableSelectRowData.value.length == 0) {
proxy.$ElMessage({
type: 'error',
message: '请选择需要删除的数据',
})
return
}
proxy.$openMessageBox('此操作将永久删除, 是否继续?', () => {
deleteValuationMode(tableSelectRowData.value.map(d => d.guid)).then((res: any) => {
if (res.code == proxy.$passCode) {
page.value.curr = 1;
getTableData();
proxy.$ElMessage.success('删除成功');
} else {
proxy.$ElMessage.error(res.msg);
}
})
}, () => {
proxy.$ElMessage.info("已取消删除");
})
}
onBeforeMount(() => {
// toSearch({})
})
onActivated(() => {
if (entryStore.isRefresh) {
getTableData();
entryStore.setIsRefresh(false);
}
})
</script>
<template>
<div class="container_wrap">
<div class="table_tool_wrap">
<!-- 头部搜索 -->
<TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" />
<div class="tools_btns">
<el-button type="primary" @click="newCreate">新建</el-button>
<el-button @click="batchDelete">批量删除</el-button>
</div>
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" @tableSelectionChange="tableSelectionChange" />
</div>
</div>
</template>
<style lang="scss" scoped>
.table_tool_wrap {
width: 100%;
height: 84px !important;
padding: 0 8px;
.tools_btns {
padding: 0px 0 0;
}
}
.table_panel_wrap {
width: 100%;
height: calc(100% - 84px);
padding: 0px 8px 0;
}
</style>
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!