d18e4b9f by lxs

新增数据定价

1 parent 9d37357a
......@@ -92,6 +92,8 @@ VITE_API_CIRCULATION_URL = http://192.168.6.22:29900/circulation
#数据加工交付
VITE_APP_DATA_DELIVERY = http://192.168.6.20:38052/
#数据加工基础服务
VITE_APP_PROCESS_BASIC_URL = 'ms-data-process-basic-service'
# 本地访问地址
......
......@@ -120,6 +120,8 @@ VITE_APP_PERSONAL_URL = ms-daop-personel-service
VITE_APP_CIRCULATION = http://192.168.6.20:18052/
#数据加工交付
VITE_APP_DATA_DELIVERY = http://192.168.6.20:38052/
#数据加工基础服务
VITE_APP_PROCESS_BASIC_URL = 'ms-data-process-basic-service'
# 是否在打包时生成 sourcemap
VITE_BUILD_SOURCEMAP = false
......
import request from "@/utils/request";
//获取需求表树形列表
export const getDemandTreeList = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/page-list`,
method: "post",
data: params,
});
};
//获取所有需求表列表
export const getDemandAll = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/get-list-data`,
method: "get",
params
});
};
//新增需求列表
export const saveDemandTree = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/save`,
method: "post",
data: params,
});
};
//修改需求列表
export const updateDemandTree = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/update`,
method: "post",
data: params,
});
};
// 删除需求列表
export const deleteDemandTree = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/delete`,
method: "delete",
data: params,
});
};
//获取需求表
export const getDemandList = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/page-list`,
method: "post",
data: params,
});
};
//获取需求表详情
export const getDemandDetail = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/detail`,
method: "get",
params,
});
};
//新增需求表
export const saveDemand = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/save`,
method: "post",
data: params,
});
};
//修改需求表
export const updateDemand = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/update`,
method: "post",
data: params,
});
};
// 删除需求表
export const deleteDemand = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/delete`,
method: "delete",
data: params,
});
};
// 获取疾病列表
export const getDiseaseList = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/page-list`,
method: "post",
data: params,
});
};
//获取所有疾病列表
export const getDiseaseAll = () => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/get-list-data`,
method: "post"
});
};
// 获取疾病详情
export const getDiseaseDetail = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/detail`,
method: "get",
params,
});
};
// 新增疾病
export const saveDisease = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/save`,
method: "post",
data: params,
});
};
// 修改疾病
export const updateDisease = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/update`,
method: "post",
data: params,
});
};
// 删除疾病
export const deleteDisease = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/delete`,
method: "delete",
data: params,
});
};
// 获取定价配置
export const getConfigureList = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/page-list`,
method: "post",
data: params,
});
};
// 获取配置详情
export const getConfigureDetail = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/detail`,
method: "get",
params,
});
};
// 新增配置
export const saveConfigure = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/save`,
method: "post",
data: params,
});
};
// 修改配置
export const updateConfigure = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/update`,
method: "post",
data: params,
});
};
// 删除配置
export const deleteConfigure = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/delete`,
method: "delete",
data: params,
});
};
// 获取数据定价
export const getPriceList = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/page-list`,
method: "post",
data: params,
});
};
// 获取数据定价详情
export const getPriceDetail = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/detail`,
method: "get",
params,
});
};
// 新增数据定价
export const savePrice = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/save`,
method: "post",
data: params,
});
};
// 修改数据定价
export const updatePrice = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/update`,
method: "post",
data: params,
});
};
// 获取数据定价结果
export const getPriceResult = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/pricing-price`,
method: "post",
data: params,
});
};
// 删除数据定价
export const deletePrice = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/delete`,
method: "delete",
data: params,
});
};
// 获取数据资源目录
export const getDamCatalogList = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/dam-catalog-grounding/not-exclude-overview-page-list`,
method: "post",
data: params,
});
};
// 获取模型相关需求表
export const getModelDemand = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/pricing-model`,
method: "get",
params,
});
};
// 获取质量模型评分
export const getModelScore = (params) => {
return request({
url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/get-quality-score-by-dam-guid`,
method: "get",
params,
});
};
export const exportModelScore = (params) => {
return request({
url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/download-template`,
method: "post",
data: params,
responseType: 'blob'
});
};
import type { RouteRecordRaw } from 'vue-router'
function Layout() {
return import('@/layouts/index.vue')
}
const routes: RouteRecordRaw[] = [
{
path: '/data-pricing/pricing-manage',
component: Layout,
meta: {
title: '定价管理',
icon: 'ep:grid',
},
children: [
{
path: 'demand-manage',
name: 'demandManage',
component: () => import('@/views/data_pricing/demandManage.vue'),
meta: {
title: '需求表管理',
breadcrumb: false,
cache: true
},
},
{
path: 'import-file-demand-manage',
name: 'importFileDemandManage',
component: () => import('@/views/importFile.vue'),
meta: {
title: '导入数据-需求表管理',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true,
activeMenu: '/data-pricing/pricing-manage/demand-manage'
}
},
{
path: 'disease-manage',
name: 'diseaseManage',
component: () => import('@/views/data_pricing/diseaseManage.vue'),
meta: {
title: '疾病管理',
breadcrumb: false,
cache: true
},
},
{
path: 'import-file-disease',
name: 'importFileDisease',
component: () => import('@/views/importFile.vue'),
meta: {
title: '导入数据-疾病管理',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true,
activeMenu: '/data-pricing/pricing-manage/disease-manage'
}
},
{
path: 'price-config',
name: 'priceConfig',
component: () => import('@/views/data_pricing/priceConfig.vue'),
meta: {
title: '定价配置',
breadcrumb: false,
cache: true
},
},
{
path: 'price-model',
name: 'priceModel',
component: () => import('@/views/data_pricing/priceModel.vue'),
meta: {
title: '新增配置',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true,
editPage: true,
activeMenu: '/data-pricing/pricing-manage/price-config'
},
beforeEnter: (to, from) => {
if (to.query.guid) {
to.meta.title = `编辑-${to.query.name}`;
} else {
to.meta.title = `新增配置`;
}
}
},
{
path: 'price-calculate',
name: 'priceCalculate',
component: () => import('@/views/data_pricing/priceCalculate.vue'),
meta: {
title: '数据定价',
breadcrumb: false,
cache: true
}
},
{
path: 'calculate-config',
name: 'calculateConfig',
component: () => import('@/views/data_pricing/calculateConfig.vue'),
meta: {
title: '新增数据定价',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true,
editPage: true,
activeMenu: '/data-pricing/pricing-manage/price-calculate'
},
beforeEnter: (to, from) => {
if (to.query.guid) {
to.meta.title = `编辑-${to.query.name}`;
} else {
to.meta.title = `新增数据定价`;
}
}
},
],
},
]
export default routes
......@@ -10,6 +10,7 @@ import DataTrustedSpace from './modules/dataTrustedSpace';
import DataAssetRegistry from './modules/dataAssetRegistry';
import DataEntry from './modules/dataEntry';
import SecurityMenu from './modules/securityMenu';
import DataPricing from './modules/dataPricing';
import useSettingsStore from '@/store/modules/settings'
......@@ -112,7 +113,8 @@ const asyncRoutes: RouteRecordRaw[] = [
...DataMeta,
...DataQuality,
...DataInventory,
...DataTrustedSpace
...DataTrustedSpace,
...DataPricing
]
const constantRoutesByFilesystem = generatedRoutes.filter((item) => {
......
<route lang="yaml">
name: priceCalculate
</route>
<script lang="ts" setup name="priceCalculate">
import { ref } from 'vue';
import TableTools from '@/components/Tools/table_tools.vue';
import { TableColumnWidth, commonPageConfig } from '@/utils/enum';
import { ElMessage, ElMessageBox } from "element-plus";
import { CirclePlus } from "@element-plus/icons-vue";
import { useRouter, useRoute } from "vue-router";
import useUserStore from "@/store/modules/user";
import useDataAssetStore from "@/store/modules/dataResource";
import { getAllFlowData } from '@/api/modules/configService';
import { changeNum } from "@/utils/common";
import {
getDiseaseAll,
getPriceList,
deletePrice,
} from '@/api/modules/dataPricing';
const router = useRouter();
const userStore = useUserStore()
const assetStore = useDataAssetStore();
const userData = JSON.parse(userStore.userData)
const { proxy } = getCurrentInstance() as any;
const searchItemList = ref([
{
type: "input",
label: "",
field: "dataResourceName",
default: "",
placeholder: "数据资源名称",
clearable: true,
},
{
type: "cascader",
label: "",
field: "diseaseName",
placeholder: "疾病名称",
default: "",
options: [],
showAllLevels: false,
props: {
checkStrictly: true,
label: "diseaseName",
value: "guid",
children: 'childList',
emitPath: false
},
filterable: true,
clearable: true,
}
]);
const typeMap: any = ref({});
const selectRowData: any = ref([])
const currTableData: any = ref({});
const page: any = ref({
...commonPageConfig,
dataResourceName: '',
diseaseName: ''
});
const tableField: any = ref([
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "定价模型名称", field: "modelName", width: 200 },
{ label: "数据资源名称", field: "dataResourceName", width: 200 },
{ label: "疾病名称", field: "diseaseName", width: 200 },
{
label: "交易价格(元)", field: "dataTransactionPrice", width: 120, align: 'right', getName: (scope) => {
return scope.row.dataTransactionPrice ? changeNum(parseFloat(scope.row.dataTransactionPrice), 2) : '-';
}
},
{ label: "创建人", field: "createUserName", width: 120 },
{ label: "创建时间", field: "createTime", width: TableColumnWidth.DATETIME },
]);
const tableInfo = ref({
id: 'api-data-table',
rowKey: 'guid',
loading: false,
fields: tableField.value,
data: [],
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
isMore: false,
width: 120,
btns: [
{ label: "编辑", value: "edit" },
{ label: "删除", value: "del" }
]
}
});
const setTableField = () => {
tableField.value.splice(4, 0, {
label: "交易用途", field: "dataUsage", width: 120, getName: (scope) => {
return typeMap.value['dataUsage'].find((item) => item.value == scope.row['dataUsage'])?.label || '-';
}
});
tableInfo.value.fields = tableField.value;
}
// 获取所有疾病数据
const getDiseaseData = () => {
getDiseaseAll().then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
searchItemList.value[1].options = data;
}
})
}
// 获取数据字典
const getDataType = (dictType, fieldName) => {
getAllFlowData(dictType).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
setTableField()
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
const toSearch = (val: any, clear: boolean = false) => {
page.value.curr = 1;
if (clear) {
searchItemList.value.map((item) => (item.default = ""));
page.value.dataResourceName = ''
page.value.diseaseName = '';
} else {
page.value.dataResourceName = val.dataResourceName || '';
page.value.diseaseName = val.diseaseName || '';
}
getTableData();
};
const getTableData = () => {
tableInfo.value.loading = true;
getPriceList({
pageSize: page.value.limit,
pageIndex: page.value.curr,
dataResourceName: page.value.dataResourceName,
diseaseName: page.value.diseaseName,
}).then((res: any) => {
tableInfo.value.loading = false;
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.error(res.msg);
}
})
}
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
tableInfo.value.page.limit = page.value.limit;
tableInfo.value.page.curr = page.value.curr;
getTableData();
};
const tableBtnClick = (scope, btn) => {
const type = btn.value;
const row = scope.row;
currTableData.value = row;
if (type === 'edit') { // 编辑
router.push(
{
name: 'calculateConfig',
query: {
guid: row.guid,
name: row.modelName,
type: 'edit'
}
}
);
} else if (type === 'del') { // 删除
open('确定要删除该条数据吗?', 'warning');
}
};
const open = (msg, type, isBatch = false) => {
ElMessageBox.confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: type,
}).then(() => {
let guids = [currTableData.value.guid]
if (isBatch) {
guids = selectRowData.value
}
deletePrice(guids).then((res: any) => {
if (res.code == proxy.$passCode) {
getTableData();
ElMessage({
type: "success",
message: "删除成功",
});
} else {
proxy.$ElMessage.error(res.msg);
}
});
});
};
const addDisease = () => {
router.push(
{
name: 'calculateConfig',
query: {
type: 'create'
}
}
);
}
onBeforeMount(() => {
getDiseaseData();
getDataType('数据用途', 'dataUsage')
});
onActivated(() => {
if (assetStore.isRefresh) {//如果是首次加载,则不需要调用
toSearch(null, true);
assetStore.set(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="addDisease" v-preReClick>新增</el-button>
</div>
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" @tableBtnClick="tableBtnClick" />
</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>
<route lang="yaml">
name: priceConfig
</route>
<script lang="ts" setup name="priceConfig">
import { ref } from 'vue';
import TableTools from '@/components/Tools/table_tools.vue';
import { TableColumnWidth, commonPageConfig } from '@/utils/enum';
import { ElMessage, ElMessageBox } from "element-plus";
import { CirclePlus } from "@element-plus/icons-vue";
import { useRouter, useRoute } from "vue-router";
import useUserStore from "@/store/modules/user";
import useDataAssetStore from "@/store/modules/dataResource";
import { getAllFlowData } from '@/api/modules/configService';
import {
getConfigureList,
deleteConfigure,
} from '@/api/modules/dataPricing';
const router = useRouter();
const userStore = useUserStore()
const assetStore = useDataAssetStore();
const userData = JSON.parse(userStore.userData)
const { proxy } = getCurrentInstance() as any;
const searchItemList = ref([
{
type: "input",
label: "",
field: "modelName",
default: "",
placeholder: "定价模型名称",
clearable: true,
},
{
type: "select",
label: "",
field: "institutionType",
placeholder: "机构类型",
default: "",
options: [],
clearable: true,
}
]);
const typeMap = ref({});
const tableData: any = ref([]);
const selectRowData: any = ref([])
const currTableData: any = ref({});
const page: any = ref({
...commonPageConfig,
modelName: '',
institutionType: ''
});
const tableInfo = ref({
id: 'api-data-table',
rowKey: 'guid',
loading: false,
fields: [
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "定价模型名称", field: "modelName", width: 200 },
{
label: "机构类型", field: "institutionType", width: 120, getName: (scope) => {
return filterVal(scope.row.institutionType, 'institutionType')
}
},
{
label: "启用状态", field: "bizState", type: 'tag', width: 120, align: 'center', getName: (scope) => {
return scope.row.bizState == 'Y' ? '启用' : '停用';
}, tagType: (scope) => {
return scope.row.bizState == 'Y' ? 'success' : 'info';
}
},
{ label: "创建人", field: "createUserName", width: 120 },
{ label: "创建时间", field: "createTime", width: TableColumnWidth.DATETIME },
],
data: tableData.value,
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
isMore: false,
width: 120,
btns: [
{ label: "编辑", value: "edit" },
{ label: "删除", value: "del" }
]
}
});
// 过滤
const filterVal = (val, name) => {
if(typeMap.value[name]){
const data = typeMap.value[name].find(item => item.value == val);
return data?.label || '--';
}
};
// 获取需求类型
const getDataType = (dictType, fieldName) => {
getAllFlowData(dictType).then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || [];
typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
let item = searchItemList.value.find(item => item.field == fieldName);
item && (item.options = data);
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
const toSearch = (val: any, clear: boolean = false) => {
page.value.curr = 1;
if (clear) {
searchItemList.value.map((item) => (item.default = ""));
page.value.modelName = '';
page.value.institutionType = '';
} else {
page.value.modelName = val.modelName || '';
page.value.institutionType = val.institutionType || '';
}
getTableData();
};
const getTableData = () => {
tableInfo.value.loading = true;
getConfigureList({
pageSize: page.value.limit,
pageIndex: page.value.curr,
modelName: page.value.modelName,
institutionType: page.value.institutionType,
}).then((res: any) => {
tableInfo.value.loading = false;
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.error(res.msg);
}
})
}
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
tableInfo.value.page.limit = page.value.limit;
tableInfo.value.page.curr = page.value.curr;
getTableData();
};
const tableBtnClick = (scope, btn) => {
const type = btn.value;
const row = scope.row;
currTableData.value = row;
if (type === 'edit') { // 编辑
router.push(
{
name: 'priceModel',
query: {
guid: row.guid,
name: row.modelName,
type
}
}
);
} else if (type === 'del') { // 删除
open('确定要删除该条数据吗?', 'warning');
}
};
const open = (msg, type, isBatch = false) => {
ElMessageBox.confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: type,
}).then(() => {
let guids = [currTableData.value.guid]
if (isBatch) {
guids = selectRowData.value
}
deleteConfigure(guids).then((res: any) => {
if (res.code == proxy.$passCode) {
getTableData();
ElMessage({
type: "success",
message: "删除成功",
});
} else {
proxy.$ElMessage.error(res.msg);
}
});
});
};
const addDisease = () => {
router.push(
{
name: 'priceModel',
query: {
type: 'create'
}
}
);
}
onBeforeMount(() => {
getDataType('机构类型', 'institutionType')
});
onActivated(() => {
if (assetStore.isRefresh) {//如果是首次加载,则不需要调用
toSearch(null, true);
assetStore.set(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="addDisease" v-preReClick>新增</el-button>
</div>
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" @tableBtnClick="tableBtnClick" />
</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>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!