fbd63610 by lihua

估值模型功能提交

1 parent 5e79007f
...@@ -48,3 +48,39 @@ export const sendEntryMsg = (params) => request({ ...@@ -48,3 +48,39 @@ export const sendEntryMsg = (params) => request({
48 method: 'post', 48 method: 'post',
49 params 49 params
50 }); 50 });
51
52 /** ----------------------------------------估值模型接口--------------------------------- */
53
54 /** 获取数据产品估值模型列表 */
55 export const getValuationModelList = (params) => request({
56 url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/page-list`,
57 method: 'post',
58 data: params
59 })
60
61 /** 保存估值模型 */
62 export const saveValuationMode = (params) => request({
63 url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/save`,
64 method: 'post',
65 data: params
66 })
67
68 /** 更新估值模型 */
69 export const updateValuationMode = (params) => request({
70 url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/update`,
71 method: 'put',
72 data: params
73 })
74
75 /** 删除估值模型 */
76 export const deleteValuationMode = (params) => request({
77 url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/delete`,
78 method: 'delete',
79 data: params
80 })
81
82 /** 获取估值模型详情 */
83 export const getValuationModelDetail = (params) => request({
84 url: `${import.meta.env.VITE_API_NEW_PORTAL}/valuation-model/detail?guid=${params.guid}`,
85 method: 'get'
86 })
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -68,6 +68,45 @@ const routes: RouteRecordRaw[] = [ ...@@ -68,6 +68,45 @@ const routes: RouteRecordRaw[] = [
68 }, 68 },
69 ], 69 ],
70 }, 70 },
71 {
72 path: '/data-entry/valuation-model',
73 component: Layout,
74 meta: {
75 title: '估值模型',
76 icon: 'sidebar-videos',
77 },
78 children: [
79 {
80 path: '',
81 name: 'valuationModel',
82 component: () => import('@/views/data_transaction/valuationModel.vue'),
83 meta: {
84 title: '估值模型',
85 sidebar: false,
86 breadcrumb: false,
87 cache: true
88 },
89 },
90 {
91 path: 'valuation-model-create',
92 name: 'valuationModelCreate',
93 component: () => import('@/views/data_transaction/valuationModelCreate.vue'),
94 meta: {
95 title: '新建估值模型',
96 sidebar: false,
97 breadcrumb: false,
98 cache: true,
99 editPage: true,
100 reuse: true
101 },
102 beforeEnter: (to, from) => {
103 if (to.query.guid) {
104 to.meta.title = `编辑-${to.query.name}`;
105 }
106 }
107 },
108 ],
109 },
71 ] 110 ]
72 111
73 export default routes 112 export default routes
......
1 const useEntryStore = defineStore(
2 // api标签分类guid
3 'isRefresh',
4
5 () => {
6
7 const isRefresh = ref(false);
8 function setIsRefresh(update: boolean) {
9 isRefresh.value = update;
10 }
11
12 return {
13 isRefresh,
14 setIsRefresh,
15 }
16 },
17 )
18
19 export default useEntryStore
...\ No newline at end of file ...\ No newline at end of file
1 <script lang="ts" setup name="valuationModel">
2 import TableTools from "@/components/Tools/table_tools.vue";
3 import { commonPageConfig } from '@/components/PageNav/index';
4 import {
5 getValuationModelList,
6 deleteValuationMode
7 } from '@/api/modules/dataEntry';
8 import { TableColumnWidth } from "@/utils/enum";
9 import { changeNum } from "@/utils/common";
10 import useEntryStore from "@/store/modules/dataEntry";
11
12 const entryStore = useEntryStore();
13
14 const router = useRouter()
15
16 const { proxy } = getCurrentInstance() as any;
17
18 /** 头部搜索框配置 */
19 const searchItemList = ref([
20 {
21 type: "input",
22 label: "",
23 field: "damName",
24 default: "",
25 placeholder: "数据产品名称",
26 clearable: true,
27 },
28 {
29 type: "select",
30 label: "",
31 field: "evaluateMethod",
32 default: "",
33 placeholder: "评估方法",
34 options: [
35 { label: "成本法", value: "1" },
36 { label: "收益法", value: "2" },
37 ],
38 clearable: true,
39 }
40 ]);
41
42 /** 分页及搜索传参信息配置。 */
43 const page = ref({
44 ...commonPageConfig,
45 damName: '',
46 evaluateMethod: ''
47 });
48
49 const tableSelectRowData: any = ref([]);
50
51 const tableInfo = ref({
52 id: 'valuation-model-table',
53 multiple: true,
54 fields: [
55 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
56 { label: "数据产品名称", field: "damName", width: 160 },
57 {
58 label: "评估方法", field: "evaluateMethod", width: 140, getName: (scope) => {
59 return scope.row.evaluateMethod == '1' ? '成本法' : '收益法';
60 }
61 },
62 { label: "评估基准日", field: "evaluateBaseDate", width: TableColumnWidth.DATE, },
63 {
64 label: "评估价值(元)", field: "damValuation", width: 160, align: 'right'
65 },
66 { label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME },
67 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
68 ],
69 data: [],
70 page: {
71 type: "normal",
72 rows: 0,
73 ...page.value,
74 },
75 actionInfo: {
76 label: "操作",
77 type: "btn",
78 width: 140,
79 fixed: 'right',
80 btns: (scope) => {
81 let btnsArr: any = [];
82 btnsArr.push({
83 label: "编辑", value: "edit", click: (scope) => {
84 router.push({
85 name: 'valuationModelCreate',
86 query: {
87 guid: scope.row.guid,
88 name: scope.row.damName
89 }
90 })
91 }
92 });
93 btnsArr.push({
94 label: "删除", value: "delete", click: (scope) => {
95 proxy.$openMessageBox('此操作将永久删除, 是否继续?', () => {
96 deleteValuationMode([scope.row.guid]).then((res: any) => {
97 if (res.code == proxy.$passCode) {
98 page.value.curr = 1;
99 getTableData();
100 proxy.$ElMessage({
101 type: "success",
102 message: "删除成功",
103 });
104 } else {
105 proxy.$ElMessage({
106 type: 'error',
107 message: res.msg,
108 })
109 }
110 })
111 }, () => {
112 proxy.$ElMessage.info("已取消删除");
113 })
114 }
115 });
116 return btnsArr
117 },
118 },
119 loading: false
120 })
121
122 const toSearch = (val: any, clear: boolean = false) => {
123 if (clear) {
124 searchItemList.value.map((item) => (item.default = ""));
125 page.value.damName = '';
126 page.value.evaluateMethod = "";
127 } else {
128 page.value.damName = val.damName;
129 page.value.evaluateMethod = val.evaluateMethod;
130 }
131 getTableData();
132 };
133
134 const getTableData = () => {
135 tableInfo.value.loading = true
136 getValuationModelList({
137 pageIndex: page.value.curr,
138 pageSize: page.value.limit,
139 damName: page.value.damName,
140 evaluateMethod: page.value.evaluateMethod
141 }).then((res: any) => {
142 if (res.code == proxy.$passCode) {
143 const data = res.data || {}
144 tableInfo.value.data = data.records || []
145 tableInfo.value.page.limit = data.pageSize
146 tableInfo.value.page.curr = data.pageIndex
147 tableInfo.value.page.rows = data.totalRows
148 } else {
149 proxy.$ElMessage({
150 type: 'error',
151 message: res.msg,
152 })
153 }
154 tableInfo.value.loading = false
155 }).catch(() => {
156 tableInfo.value.loading = false
157 })
158 };
159
160 const tablePageChange = (info) => {
161 page.value.curr = Number(info.curr);
162 page.value.limit = Number(info.limit);
163 tableInfo.value.page.curr = page.value.curr;
164 tableInfo.value.page.limit = page.value.limit;
165 getTableData();
166 };
167
168 const tableSelectionChange = (val) => {
169 tableSelectRowData.value = val;
170 };
171
172 const newCreate = () => {
173 router.push({
174 name: 'valuationModelCreate'
175 });
176 }
177
178 const batchDelete = () => {
179 if (tableSelectRowData.value.length == 0) {
180 proxy.$ElMessage({
181 type: 'error',
182 message: '请选择需要删除的数据',
183 })
184 return
185 }
186 proxy.$openMessageBox('此操作将永久删除, 是否继续?', () => {
187 deleteValuationMode(tableSelectRowData.value.map(d => d.guid)).then((res: any) => {
188 if (res.code == proxy.$passCode) {
189 page.value.curr = 1;
190 getTableData();
191 proxy.$ElMessage.success('删除成功');
192 } else {
193 proxy.$ElMessage.error(res.msg);
194 }
195 })
196 }, () => {
197 proxy.$ElMessage.info("已取消删除");
198 })
199 }
200
201 onBeforeMount(() => {
202 // toSearch({})
203 })
204
205 onActivated(() => {
206 if (entryStore.isRefresh) {
207 getTableData();
208 entryStore.setIsRefresh(false);
209 }
210 })
211
212 </script>
213
214 <template>
215 <div class="container_wrap">
216 <div class="table_tool_wrap">
217 <!-- 头部搜索 -->
218 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" />
219 <div class="tools_btns">
220 <el-button type="primary" @click="newCreate">新建</el-button>
221 <el-button @click="batchDelete">批量删除</el-button>
222 </div>
223 </div>
224 <div class="table_panel_wrap">
225 <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" @tableSelectionChange="tableSelectionChange" />
226 </div>
227 </div>
228 </template>
229
230 <style lang="scss" scoped>
231 .table_tool_wrap {
232 width: 100%;
233 height: 84px !important;
234 padding: 0 8px;
235
236 .tools_btns {
237 padding: 0px 0 0;
238 }
239 }
240
241 .table_panel_wrap {
242 width: 100%;
243 height: calc(100% - 84px);
244 padding: 0px 8px 0;
245 }
246 </style>
...\ No newline at end of file ...\ 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!