74cf95b7 by lxs Committed by lihua

新增数据定价

1 parent 616fe8ba
1 import request from "@/utils/request";
2
3 //获取需求表树形列表
4 export const getDemandTreeList = (params) => {
5 return request({
6 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/page-list`,
7 method: "post",
8 data: params,
9 });
10 };
11
12 //获取所有需求表列表
13 export const getDemandAll = (params) => {
14 return request({
15 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/get-list-data`,
16 method: "get",
17 params
18 });
19 };
20
21 //新增需求列表
22 export const saveDemandTree = (params) => {
23 return request({
24 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/save`,
25 method: "post",
26 data: params,
27 });
28 };
29
30 //修改需求列表
31 export const updateDemandTree = (params) => {
32 return request({
33 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/update`,
34 method: "post",
35 data: params,
36 });
37 };
38
39 // 删除需求列表
40 export const deleteDemandTree = (params) => {
41 return request({
42 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-menu/delete`,
43 method: "delete",
44 data: params,
45 });
46 };
47
48 //获取需求表
49 export const getDemandList = (params) => {
50 return request({
51 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/page-list`,
52 method: "post",
53 data: params,
54 });
55 };
56
57 //获取需求表详情
58 export const getDemandDetail = (params) => {
59 return request({
60 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/detail`,
61 method: "get",
62 params,
63 });
64 };
65
66 //新增需求表
67 export const saveDemand = (params) => {
68 return request({
69 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/save`,
70 method: "post",
71 data: params,
72 });
73 };
74
75 //修改需求表
76 export const updateDemand = (params) => {
77 return request({
78 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/update`,
79 method: "post",
80 data: params,
81 });
82 };
83
84 // 删除需求表
85 export const deleteDemand = (params) => {
86 return request({
87 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-demand-table/delete`,
88 method: "delete",
89 data: params,
90 });
91 };
92
93 // 获取疾病列表
94 export const getDiseaseList = (params) => {
95 return request({
96 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/page-list`,
97 method: "post",
98 data: params,
99 });
100 };
101
102 //获取所有疾病列表
103 export const getDiseaseAll = () => {
104 return request({
105 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/get-list-data`,
106 method: "post"
107 });
108 };
109
110 // 获取疾病详情
111 export const getDiseaseDetail = (params) => {
112 return request({
113 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/detail`,
114 method: "get",
115 params,
116 });
117 };
118
119 // 新增疾病
120 export const saveDisease = (params) => {
121 return request({
122 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/save`,
123 method: "post",
124 data: params,
125 });
126 };
127
128 // 修改疾病
129 export const updateDisease = (params) => {
130 return request({
131 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/update`,
132 method: "post",
133 data: params,
134 });
135 };
136
137 // 删除疾病
138 export const deleteDisease = (params) => {
139 return request({
140 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/disease-manage/delete`,
141 method: "delete",
142 data: params,
143 });
144 };
145
146 // 获取定价配置
147 export const getConfigureList = (params) => {
148 return request({
149 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/page-list`,
150 method: "post",
151 data: params,
152 });
153 };
154
155 // 获取配置详情
156 export const getConfigureDetail = (params) => {
157 return request({
158 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/detail`,
159 method: "get",
160 params,
161 });
162 };
163
164 // 新增配置
165 export const saveConfigure = (params) => {
166 return request({
167 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/save`,
168 method: "post",
169 data: params,
170 });
171 };
172
173 // 修改配置
174 export const updateConfigure = (params) => {
175 return request({
176 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/update`,
177 method: "post",
178 data: params,
179 });
180 };
181
182 // 删除配置
183 export const deleteConfigure = (params) => {
184 return request({
185 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-configure/delete`,
186 method: "delete",
187 data: params,
188 });
189 };
190
191 // 获取数据定价
192 export const getPriceList = (params) => {
193 return request({
194 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/page-list`,
195 method: "post",
196 data: params,
197 });
198 };
199
200 // 获取数据定价详情
201 export const getPriceDetail = (params) => {
202 return request({
203 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/detail`,
204 method: "get",
205 params,
206 });
207 };
208
209 // 新增数据定价
210 export const savePrice = (params) => {
211 return request({
212 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/save`,
213 method: "post",
214 data: params,
215 });
216 };
217
218 // 修改数据定价
219 export const updatePrice = (params) => {
220 return request({
221 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/update`,
222 method: "post",
223 data: params,
224 });
225 };
226
227 // 获取数据定价结果
228 export const getPriceResult = (params) => {
229 return request({
230 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/pricing-price`,
231 method: "post",
232 data: params,
233 });
234 };
235
236 // 删除数据定价
237 export const deletePrice = (params) => {
238 return request({
239 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/delete`,
240 method: "delete",
241 data: params,
242 });
243 };
244
245 // 获取数据资源目录
246 export const getDamCatalogList = (params) => {
247 return request({
248 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/dam-catalog-grounding/not-exclude-overview-page-list`,
249 method: "post",
250 data: params,
251 });
252 };
253
254 // 获取模型相关需求表
255 export const getModelDemand = (params) => {
256 return request({
257 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/pricing-model`,
258 method: "get",
259 params,
260 });
261 };
262
263 // 获取质量模型评分
264 export const getModelScore = (params) => {
265 return request({
266 url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-analysis-report/get-quality-score-by-dam-guid`,
267 method: "get",
268 params,
269 });
270 };
271
272 export const exportModelScore = (params) => {
273 return request({
274 url: `${import.meta.env.VITE_APP_PROCESS_BASIC_URL}/pricing-data/download-template`,
275 method: "post",
276 data: params,
277 responseType: 'blob'
278 });
279 };
1 import type { RouteRecordRaw } from 'vue-router'
2
3 function Layout() {
4 return import('@/layouts/index.vue')
5 }
6
7 const routes: RouteRecordRaw[] = [
8 {
9 path: '/data-pricing/pricing-manage',
10 component: Layout,
11 meta: {
12 title: '定价管理',
13 icon: 'ep:grid',
14 },
15 children: [
16 {
17 path: 'demand-manage',
18 name: 'demandManage',
19 component: () => import('@/views/data_pricing/demandManage.vue'),
20 meta: {
21 title: '需求表管理',
22 breadcrumb: false,
23 cache: true
24 },
25 },
26 {
27 path: 'import-file-demand-manage',
28 name: 'importFileDemandManage',
29 component: () => import('@/views/importFile.vue'),
30 meta: {
31 title: '导入数据-需求表管理',
32 sidebar: false,
33 breadcrumb: false,
34 cache: true,
35 reuse: true,
36 activeMenu: '/data-pricing/pricing-manage/demand-manage'
37 }
38 },
39 {
40 path: 'disease-manage',
41 name: 'diseaseManage',
42 component: () => import('@/views/data_pricing/diseaseManage.vue'),
43 meta: {
44 title: '疾病管理',
45 breadcrumb: false,
46 cache: true
47 },
48 },
49 {
50 path: 'import-file-disease',
51 name: 'importFileDisease',
52 component: () => import('@/views/importFile.vue'),
53 meta: {
54 title: '导入数据-疾病管理',
55 sidebar: false,
56 breadcrumb: false,
57 cache: true,
58 reuse: true,
59 activeMenu: '/data-pricing/pricing-manage/disease-manage'
60 }
61 },
62 {
63 path: 'price-config',
64 name: 'priceConfig',
65 component: () => import('@/views/data_pricing/priceConfig.vue'),
66 meta: {
67 title: '定价配置',
68 breadcrumb: false,
69 cache: true
70 },
71 },
72 {
73 path: 'price-model',
74 name: 'priceModel',
75 component: () => import('@/views/data_pricing/priceModel.vue'),
76 meta: {
77 title: '新增配置',
78 sidebar: false,
79 breadcrumb: false,
80 cache: true,
81 reuse: true,
82 editPage: true,
83 activeMenu: '/data-pricing/pricing-manage/price-config'
84 },
85 beforeEnter: (to, from) => {
86 if (to.query.guid) {
87 to.meta.title = `编辑-${to.query.name}`;
88 } else {
89 to.meta.title = `新增配置`;
90 }
91 }
92 },
93 {
94 path: 'price-calculate',
95 name: 'priceCalculate',
96 component: () => import('@/views/data_pricing/priceCalculate.vue'),
97 meta: {
98 title: '数据定价',
99 breadcrumb: false,
100 cache: true
101 }
102 },
103 {
104 path: 'calculate-config',
105 name: 'calculateConfig',
106 component: () => import('@/views/data_pricing/calculateConfig.vue'),
107 meta: {
108 title: '新增数据定价',
109 sidebar: false,
110 breadcrumb: false,
111 cache: true,
112 reuse: true,
113 editPage: true,
114 activeMenu: '/data-pricing/pricing-manage/price-calculate'
115 },
116 beforeEnter: (to, from) => {
117 if (to.query.guid) {
118 to.meta.title = `编辑-${to.query.name}`;
119 } else {
120 to.meta.title = `新增数据定价`;
121 }
122 }
123 },
124 ],
125 },
126 ]
127
128 export default routes
...@@ -10,6 +10,7 @@ import DataTrustedSpace from './modules/dataTrustedSpace'; ...@@ -10,6 +10,7 @@ import DataTrustedSpace from './modules/dataTrustedSpace';
10 import DataAssetRegistry from './modules/dataAssetRegistry'; 10 import DataAssetRegistry from './modules/dataAssetRegistry';
11 import DataEntry from './modules/dataEntry'; 11 import DataEntry from './modules/dataEntry';
12 import SecurityMenu from './modules/securityMenu'; 12 import SecurityMenu from './modules/securityMenu';
13 import DataPricing from './modules/dataPricing';
13 14
14 import useSettingsStore from '@/store/modules/settings' 15 import useSettingsStore from '@/store/modules/settings'
15 16
...@@ -112,7 +113,8 @@ const asyncRoutes: RouteRecordRaw[] = [ ...@@ -112,7 +113,8 @@ const asyncRoutes: RouteRecordRaw[] = [
112 ...DataMeta, 113 ...DataMeta,
113 ...DataQuality, 114 ...DataQuality,
114 ...DataInventory, 115 ...DataInventory,
115 ...DataTrustedSpace 116 ...DataTrustedSpace,
117 ...DataPricing
116 ] 118 ]
117 119
118 const constantRoutesByFilesystem = generatedRoutes.filter((item) => { 120 const constantRoutesByFilesystem = generatedRoutes.filter((item) => {
......
1 <route lang="yaml">
2 name: priceCalculate
3 </route>
4
5 <script lang="ts" setup name="priceCalculate">
6 import { ref } from 'vue';
7 import TableTools from '@/components/Tools/table_tools.vue';
8 import { TableColumnWidth, commonPageConfig } from '@/utils/enum';
9 import { ElMessage, ElMessageBox } from "element-plus";
10 import { CirclePlus } from "@element-plus/icons-vue";
11 import { useRouter, useRoute } from "vue-router";
12 import useUserStore from "@/store/modules/user";
13 import useDataAssetStore from "@/store/modules/dataResource";
14 import { getAllFlowData } from '@/api/modules/configService';
15 import { changeNum } from "@/utils/common";
16 import {
17 getDiseaseAll,
18 getPriceList,
19 deletePrice,
20 } from '@/api/modules/dataPricing';
21
22 const router = useRouter();
23 const userStore = useUserStore()
24 const assetStore = useDataAssetStore();
25 const userData = JSON.parse(userStore.userData)
26 const { proxy } = getCurrentInstance() as any;
27
28 const searchItemList = ref([
29 {
30 type: "input",
31 label: "",
32 field: "dataResourceName",
33 default: "",
34 placeholder: "数据资源名称",
35 clearable: true,
36 },
37 {
38 type: "cascader",
39 label: "",
40 field: "diseaseName",
41 placeholder: "疾病名称",
42 default: "",
43 options: [],
44 showAllLevels: false,
45 props: {
46 checkStrictly: true,
47 label: "diseaseName",
48 value: "guid",
49 children: 'childList',
50 emitPath: false
51 },
52 filterable: true,
53 clearable: true,
54 }
55 ]);
56
57 const typeMap: any = ref({});
58 const selectRowData: any = ref([])
59 const currTableData: any = ref({});
60 const page: any = ref({
61 ...commonPageConfig,
62 dataResourceName: '',
63 diseaseName: ''
64 });
65 const tableField: any = ref([
66 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
67 { label: "定价模型名称", field: "modelName", width: 200 },
68 { label: "数据资源名称", field: "dataResourceName", width: 200 },
69 { label: "疾病名称", field: "diseaseName", width: 200 },
70 {
71 label: "交易价格(元)", field: "dataTransactionPrice", width: 120, align: 'right', getName: (scope) => {
72 return scope.row.dataTransactionPrice ? changeNum(parseFloat(scope.row.dataTransactionPrice), 2) : '-';
73 }
74 },
75 { label: "创建人", field: "createUserName", width: 120 },
76 { label: "创建时间", field: "createTime", width: TableColumnWidth.DATETIME },
77 ]);
78 const tableInfo = ref({
79 id: 'api-data-table',
80 rowKey: 'guid',
81 loading: false,
82 fields: tableField.value,
83 data: [],
84 page: {
85 type: "normal",
86 rows: 0,
87 ...page.value,
88 },
89 actionInfo: {
90 label: "操作",
91 type: "btn",
92 isMore: false,
93 width: 120,
94 btns: [
95 { label: "编辑", value: "edit" },
96 { label: "删除", value: "del" }
97 ]
98 }
99 });
100
101 const setTableField = () => {
102 tableField.value.splice(4, 0, {
103 label: "交易用途", field: "dataUsage", width: 120, getName: (scope) => {
104 return typeMap.value['dataUsage'].find((item) => item.value == scope.row['dataUsage'])?.label || '-';
105 }
106 });
107 tableInfo.value.fields = tableField.value;
108 }
109
110 // 获取所有疾病数据
111 const getDiseaseData = () => {
112 getDiseaseAll().then((res: any) => {
113 if (res.code == proxy.$passCode) {
114 const data = res.data || [];
115 searchItemList.value[1].options = data;
116 }
117 })
118 }
119
120 // 获取数据字典
121 const getDataType = (dictType, fieldName) => {
122 getAllFlowData(dictType).then((res: any) => {
123 if (res.code == proxy.$passCode) {
124 const data = res.data || [];
125 typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
126 setTableField()
127 } else {
128 proxy.$ElMessage.error(res.msg);
129 }
130 })
131 }
132
133 const toSearch = (val: any, clear: boolean = false) => {
134 page.value.curr = 1;
135 if (clear) {
136 searchItemList.value.map((item) => (item.default = ""));
137 page.value.dataResourceName = ''
138 page.value.diseaseName = '';
139 } else {
140 page.value.dataResourceName = val.dataResourceName || '';
141 page.value.diseaseName = val.diseaseName || '';
142 }
143 getTableData();
144 };
145
146 const getTableData = () => {
147 tableInfo.value.loading = true;
148 getPriceList({
149 pageSize: page.value.limit,
150 pageIndex: page.value.curr,
151 dataResourceName: page.value.dataResourceName,
152 diseaseName: page.value.diseaseName,
153 }).then((res: any) => {
154 tableInfo.value.loading = false;
155 if (res.code == proxy.$passCode) {
156 const data = res.data || {};
157 tableInfo.value.data = data.records || [];
158 tableInfo.value.page.limit = data.pageSize
159 tableInfo.value.page.curr = data.pageIndex
160 tableInfo.value.page.rows = data.totalRows
161 } else {
162 proxy.$ElMessage.error(res.msg);
163 }
164 })
165 }
166
167 const tablePageChange = (info) => {
168 page.value.curr = Number(info.curr);
169 page.value.limit = Number(info.limit);
170 tableInfo.value.page.limit = page.value.limit;
171 tableInfo.value.page.curr = page.value.curr;
172 getTableData();
173 };
174
175 const tableBtnClick = (scope, btn) => {
176 const type = btn.value;
177 const row = scope.row;
178 currTableData.value = row;
179 if (type === 'edit') { // 编辑
180 router.push(
181 {
182 name: 'calculateConfig',
183 query: {
184 guid: row.guid,
185 name: row.modelName,
186 type: 'edit'
187 }
188 }
189 );
190 } else if (type === 'del') { // 删除
191 open('确定要删除该条数据吗?', 'warning');
192 }
193 };
194
195 const open = (msg, type, isBatch = false) => {
196 ElMessageBox.confirm(msg, "提示", {
197 confirmButtonText: "确定",
198 cancelButtonText: "取消",
199 type: type,
200 }).then(() => {
201 let guids = [currTableData.value.guid]
202 if (isBatch) {
203 guids = selectRowData.value
204 }
205 deletePrice(guids).then((res: any) => {
206 if (res.code == proxy.$passCode) {
207 getTableData();
208 ElMessage({
209 type: "success",
210 message: "删除成功",
211 });
212 } else {
213 proxy.$ElMessage.error(res.msg);
214 }
215 });
216 });
217 };
218
219 const addDisease = () => {
220 router.push(
221 {
222 name: 'calculateConfig',
223 query: {
224 type: 'create'
225 }
226 }
227 );
228 }
229
230 onBeforeMount(() => {
231 getDiseaseData();
232 getDataType('数据用途', 'dataUsage')
233 });
234
235 onActivated(() => {
236 if (assetStore.isRefresh) {//如果是首次加载,则不需要调用
237 toSearch(null, true);
238 assetStore.set(false);
239 }
240 })
241
242 </script>
243
244 <template>
245 <div class="container_wrap">
246 <div class="table_tool_wrap">
247 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" />
248 <div class="tools_btns">
249 <el-button type="primary" @click="addDisease" v-preReClick>新增</el-button>
250 </div>
251 </div>
252 <div class="table_panel_wrap">
253 <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" @tableBtnClick="tableBtnClick" />
254 </div>
255 </div>
256 </template>
257
258 <style lang="scss" scoped>
259 .table_tool_wrap {
260 width: 100%;
261 height: 84px !important;
262 padding: 0 8px;
263
264 .tools_btns {
265 padding: 0px 0 0;
266 }
267 }
268
269 .table_panel_wrap {
270 width: 100%;
271 height: calc(100% - 84px);
272 padding: 0px 8px 0;
273 }
274 </style>
1 <route lang="yaml">
2 name: priceConfig
3 </route>
4
5 <script lang="ts" setup name="priceConfig">
6 import { ref } from 'vue';
7 import TableTools from '@/components/Tools/table_tools.vue';
8 import { TableColumnWidth, commonPageConfig } from '@/utils/enum';
9 import { ElMessage, ElMessageBox } from "element-plus";
10 import { CirclePlus } from "@element-plus/icons-vue";
11 import { useRouter, useRoute } from "vue-router";
12 import useUserStore from "@/store/modules/user";
13 import useDataAssetStore from "@/store/modules/dataResource";
14 import { getAllFlowData } from '@/api/modules/configService';
15 import {
16 getConfigureList,
17 deleteConfigure,
18 } from '@/api/modules/dataPricing';
19
20 const router = useRouter();
21 const userStore = useUserStore()
22 const assetStore = useDataAssetStore();
23 const userData = JSON.parse(userStore.userData)
24 const { proxy } = getCurrentInstance() as any;
25
26 const searchItemList = ref([
27 {
28 type: "input",
29 label: "",
30 field: "modelName",
31 default: "",
32 placeholder: "定价模型名称",
33 clearable: true,
34 },
35 {
36 type: "select",
37 label: "",
38 field: "institutionType",
39 placeholder: "机构类型",
40 default: "",
41 options: [],
42 clearable: true,
43 }
44 ]);
45
46 const typeMap = ref({});
47 const tableData: any = ref([]);
48 const selectRowData: any = ref([])
49 const currTableData: any = ref({});
50 const page: any = ref({
51 ...commonPageConfig,
52 modelName: '',
53 institutionType: ''
54 });
55 const tableInfo = ref({
56 id: 'api-data-table',
57 rowKey: 'guid',
58 loading: false,
59 fields: [
60 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
61 { label: "定价模型名称", field: "modelName", width: 200 },
62 {
63 label: "机构类型", field: "institutionType", width: 120, getName: (scope) => {
64 return filterVal(scope.row.institutionType, 'institutionType')
65 }
66 },
67 {
68 label: "启用状态", field: "bizState", type: 'tag', width: 120, align: 'center', getName: (scope) => {
69 return scope.row.bizState == 'Y' ? '启用' : '停用';
70 }, tagType: (scope) => {
71 return scope.row.bizState == 'Y' ? 'success' : 'info';
72 }
73 },
74 { label: "创建人", field: "createUserName", width: 120 },
75 { label: "创建时间", field: "createTime", width: TableColumnWidth.DATETIME },
76 ],
77 data: tableData.value,
78 page: {
79 type: "normal",
80 rows: 0,
81 ...page.value,
82 },
83 actionInfo: {
84 label: "操作",
85 type: "btn",
86 isMore: false,
87 width: 120,
88 btns: [
89 { label: "编辑", value: "edit" },
90 { label: "删除", value: "del" }
91 ]
92 }
93 });
94
95 // 过滤
96 const filterVal = (val, name) => {
97 if(typeMap.value[name]){
98 const data = typeMap.value[name].find(item => item.value == val);
99 return data?.label || '--';
100 }
101 };
102
103 // 获取需求类型
104 const getDataType = (dictType, fieldName) => {
105 getAllFlowData(dictType).then((res: any) => {
106 if (res.code == proxy.$passCode) {
107 const data = res.data || [];
108 typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
109 let item = searchItemList.value.find(item => item.field == fieldName);
110 item && (item.options = data);
111 } else {
112 proxy.$ElMessage.error(res.msg);
113 }
114 })
115 }
116
117 const toSearch = (val: any, clear: boolean = false) => {
118 page.value.curr = 1;
119 if (clear) {
120 searchItemList.value.map((item) => (item.default = ""));
121 page.value.modelName = '';
122 page.value.institutionType = '';
123 } else {
124 page.value.modelName = val.modelName || '';
125 page.value.institutionType = val.institutionType || '';
126 }
127 getTableData();
128 };
129
130 const getTableData = () => {
131 tableInfo.value.loading = true;
132 getConfigureList({
133 pageSize: page.value.limit,
134 pageIndex: page.value.curr,
135 modelName: page.value.modelName,
136 institutionType: page.value.institutionType,
137 }).then((res: any) => {
138 tableInfo.value.loading = false;
139 if (res.code == proxy.$passCode) {
140 const data = res.data || {};
141 tableInfo.value.data = data.records || []
142 tableInfo.value.page.limit = data.pageSize
143 tableInfo.value.page.curr = data.pageIndex
144 tableInfo.value.page.rows = data.totalRows
145 } else {
146 proxy.$ElMessage.error(res.msg);
147 }
148 })
149 }
150
151 const tablePageChange = (info) => {
152 page.value.curr = Number(info.curr);
153 page.value.limit = Number(info.limit);
154 tableInfo.value.page.limit = page.value.limit;
155 tableInfo.value.page.curr = page.value.curr;
156 getTableData();
157 };
158
159 const tableBtnClick = (scope, btn) => {
160 const type = btn.value;
161 const row = scope.row;
162 currTableData.value = row;
163 if (type === 'edit') { // 编辑
164 router.push(
165 {
166 name: 'priceModel',
167 query: {
168 guid: row.guid,
169 name: row.modelName,
170 type
171 }
172 }
173 );
174 } else if (type === 'del') { // 删除
175 open('确定要删除该条数据吗?', 'warning');
176 }
177 };
178
179 const open = (msg, type, isBatch = false) => {
180 ElMessageBox.confirm(msg, "提示", {
181 confirmButtonText: "确定",
182 cancelButtonText: "取消",
183 type: type,
184 }).then(() => {
185 let guids = [currTableData.value.guid]
186 if (isBatch) {
187 guids = selectRowData.value
188 }
189 deleteConfigure(guids).then((res: any) => {
190 if (res.code == proxy.$passCode) {
191 getTableData();
192 ElMessage({
193 type: "success",
194 message: "删除成功",
195 });
196 } else {
197 proxy.$ElMessage.error(res.msg);
198 }
199 });
200 });
201 };
202
203 const addDisease = () => {
204 router.push(
205 {
206 name: 'priceModel',
207 query: {
208 type: 'create'
209 }
210 }
211 );
212 }
213
214 onBeforeMount(() => {
215 getDataType('机构类型', 'institutionType')
216 });
217
218 onActivated(() => {
219 if (assetStore.isRefresh) {//如果是首次加载,则不需要调用
220 toSearch(null, true);
221 assetStore.set(false);
222 }
223 })
224
225 </script>
226
227 <template>
228 <div class="container_wrap">
229 <div class="table_tool_wrap">
230 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" />
231 <div class="tools_btns">
232 <el-button type="primary" @click="addDisease" v-preReClick>新增</el-button>
233 </div>
234 </div>
235 <div class="table_panel_wrap">
236 <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" @tableBtnClick="tableBtnClick" />
237 </div>
238 </div>
239 </template>
240
241 <style lang="scss" scoped>
242 .table_tool_wrap {
243 width: 100%;
244 height: 84px !important;
245 padding: 0 8px;
246
247 .tools_btns {
248 padding: 0px 0 0;
249 }
250 }
251
252 .table_panel_wrap {
253 width: 100%;
254 height: calc(100% - 84px);
255 padding: 0px 8px 0;
256 }
257 </style>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!