fdc8c87a by lihua

证件管理

1 parent 8993e0da
...@@ -205,13 +205,39 @@ export const getCertificateDetail = (params) => request({ ...@@ -205,13 +205,39 @@ export const getCertificateDetail = (params) => request({
205 params 205 params
206 }) 206 })
207 207
208 /** 发证确认 */ 208 /** 获取登记证件管理的资产列表 */
209 export const getRegisterSelectList = () => request({
210 url: `${import.meta.env.VITE_API_NEW_PORTAL}/register-base/register-select`,
211 method: 'get'
212 })
213
214 /** 新增发证 */
215 export const saveCertificate = (params) => request({
216 url: `${import.meta.env.VITE_API_NEW_PORTAL}/register-document/save`,
217 method: 'post',
218 data: params
219 })
220
209 export const updateCertificate = (params) => request({ 221 export const updateCertificate = (params) => request({
210 url: `${import.meta.env.VITE_API_NEW_PORTAL}/register-document/update-state`, 222 url: `${import.meta.env.VITE_API_NEW_PORTAL}/register-document/update`,
211 method: 'post', 223 method: 'post',
212 data: params 224 data: params
213 }) 225 })
214 226
227 /** 删除发证 */
228 export const delCertificate = (params) => request({
229 url: `${import.meta.env.VITE_API_NEW_PORTAL}/register-document/del`,
230 method: 'delete',
231 data: params
232 })
233
234 /** 发证确认 */
235 // export const updateCertificate = (params) => request({
236 // url: `${import.meta.env.VITE_API_NEW_PORTAL}/register-document/update-state`,
237 // method: 'post',
238 // data: params
239 // })
240
215 /** 获取当前会员分配的交易所 */ 241 /** 获取当前会员分配的交易所 */
216 export const getServiceDetail = (params) => request({ 242 export const getServiceDetail = (params) => request({
217 url: `${import.meta.env.VITE_APP_API_BASEURL}/tenant-service/list-by-tenant?tenantGuid=${params}`, 243 url: `${import.meta.env.VITE_APP_API_BASEURL}/tenant-service/list-by-tenant?tenantGuid=${params}`,
......
...@@ -9,13 +9,17 @@ import TableTools from "@/components/Tools/table_tools.vue"; ...@@ -9,13 +9,17 @@ import TableTools from "@/components/Tools/table_tools.vue";
9 import { ElMessage, ElMessageBox } from 'element-plus'; 9 import { ElMessage, ElMessageBox } from 'element-plus';
10 import { 10 import {
11 getRegistDocumentList, 11 getRegistDocumentList,
12 updateCertificate 12 updateCertificate,
13 getRegisterSelectList,
14 saveCertificate,
15 delCertificate
13 } from "@/api/modules/dataAsset"; 16 } from "@/api/modules/dataAsset";
14 import useUserStore from "@/store/modules/user"; 17 import useUserStore from "@/store/modules/user";
15 import useDataAssetStore from "@/store/modules/dataAsset"; 18 import useDataAssetStore from "@/store/modules/dataAsset";
19 import { useValidator } from '@/hooks/useValidator';
16 20
17 const assetStore = useDataAssetStore(); 21 const assetStore = useDataAssetStore();
18 22 const { required } = useValidator();
19 const router = useRouter(); 23 const router = useRouter();
20 const { proxy } = getCurrentInstance() as any; 24 const { proxy } = getCurrentInstance() as any;
21 25
...@@ -25,6 +29,8 @@ const userData = JSON.parse(userStore.userData); ...@@ -25,6 +29,8 @@ const userData = JSON.parse(userStore.userData);
25 /** 是否时企业端。不是企业端,则是服务端,需要显示企业名称。 */ 29 /** 是否时企业端。不是企业端,则是服务端,需要显示企业名称。 */
26 const isCompanyPlatform = ref(userData.tenantType == 1); 30 const isCompanyPlatform = ref(userData.tenantType == 1);
27 31
32 const registerSelectData: any = ref([]);
33
28 onBeforeMount(() => { 34 onBeforeMount(() => {
29 if (isCompanyPlatform.value) { 35 if (isCompanyPlatform.value) {
30 tableInfo.value.fields = tableFields.value; 36 tableInfo.value.fields = tableFields.value;
...@@ -40,6 +46,14 @@ onActivated(() => { ...@@ -40,6 +46,14 @@ onActivated(() => {
40 getTableData(); 46 getTableData();
41 assetStore.set(false); 47 assetStore.set(false);
42 } 48 }
49 getRegisterSelectList().then((res: any) => {
50 if (res.code == proxy.$passCode) {
51 registerSelectData.value = res.data || [];
52 formItems.value[0].options = registerSelectData.value;
53 } else {
54 ElMessage.error(res.msg);
55 }
56 })
43 }); 57 });
44 58
45 const searchItemList = ref([ 59 const searchItemList = ref([
...@@ -164,7 +178,7 @@ const tableInfo = ref({ ...@@ -164,7 +178,7 @@ const tableInfo = ref({
164 actionInfo: { 178 actionInfo: {
165 label: "操作", 179 label: "操作",
166 type: "btn", 180 type: "btn",
167 width: 120, 181 width: 150,
168 btns: (scope) => { 182 btns: (scope) => {
169 let row = scope.row; 183 let row = scope.row;
170 return getTableBtns(row); 184 return getTableBtns(row);
...@@ -174,10 +188,14 @@ const tableInfo = ref({ ...@@ -174,10 +188,14 @@ const tableInfo = ref({
174 188
175 const getTableBtns = (row) => { 189 const getTableBtns = (row) => {
176 let btnsArr: any[] = []; 190 let btnsArr: any[] = [];
177 if (row.state == 3) { 191 // if (row.state == 3) {
178 btnsArr.push({ label: "确认", value: "confirm" }) 192 // btnsArr.push({ label: "确认", value: "confirm" })
193 // }
194 if (row.state != 0) {
195 btnsArr.push({ label: "编辑", value: "edit" })
179 } 196 }
180 btnsArr.push({ label: "详情", value: "path_detail" }) 197 btnsArr.push({ label: "详情", value: "path_detail" })
198 btnsArr.push({ label: "删除", value: "del" })
181 return btnsArr; 199 return btnsArr;
182 } 200 }
183 201
...@@ -190,7 +208,31 @@ const tableBtnClick = (scope, btn) => { ...@@ -190,7 +208,31 @@ const tableBtnClick = (scope, btn) => {
190 if (type == "confirm") { 208 if (type == "confirm") {
191 formItems.value[0].default = []; 209 formItems.value[0].default = [];
192 dialogInfo.value.visible = true; 210 dialogInfo.value.visible = true;
193 } if (type === 'path_detail') { // 详情 211 } else if (type == "edit") {
212 dialogInfo.value.visible = true;
213 dialogInfo.value.type = 'edit';
214 dialogInfo.value.header.title = '编辑';
215 formItems.value.forEach(item => {
216 item.default = row[item.field];
217 if (item.field == 'registerGuid' || item.field == 'daCode') {
218 item.disabled = true;
219 }
220 })
221 } else if (type == 'del') {
222 proxy.$openMessageBox('确定删除该资产登记证件吗?', () => {
223 delCertificate([row.guid]).then((res: any) => {
224 if (res?.code == proxy.$passCode) {
225 ElMessage.success('删除资产登记证件成功');
226 page.value.curr = 1;
227 getTableData();
228 } else {
229 ElMessage.error(res.msg);
230 }
231 })
232 }, () => {
233 proxy.$ElMessage.info("已取消删除");
234 });
235 } else if (type === 'path_detail') { // 详情
194 router.push({ 236 router.push({
195 name: 'certificateDetail', 237 name: 'certificateDetail',
196 query: { guid: row.registerGuid, certificateGuid: row.guid, type: 'certificate', tenantGuid: row.tenantGuid } 238 query: { guid: row.registerGuid, certificateGuid: row.guid, type: 'certificate', tenantGuid: row.tenantGuid }
...@@ -205,6 +247,104 @@ const tablePageChange = (info) => { ...@@ -205,6 +247,104 @@ const tablePageChange = (info) => {
205 }; 247 };
206 248
207 const formItems = ref([{ 249 const formItems = ref([{
250 label: "资产名称",
251 type: "select",
252 placeholder: "请选择",
253 field: "registerGuid",
254 default: '',
255 options: registerSelectData.value,
256 props: {
257 label: 'daName',
258 value: 'guid'
259 },
260 disabled: false,
261 clearable: true,
262 required: true,
263 }, {
264 label: '资产编码',
265 type: 'input',
266 placeholder: '请输入',
267 field: 'daCode',
268 maxlength: 50,
269 default: '',
270 required: true,
271 visible: true
272 }, {
273 label: '',
274 type: 'input',
275 placeholder: '请输入',
276 field: 'daName',
277 default: '',
278 disabled: true,
279 required: false,
280 col: 'hide',
281 }, {
282 label: '登记时间',
283 type: 'input',
284 placeholder: '请输入',
285 field: 'registerTime',
286 default: '',
287 disabled: true,
288 required: false,
289 visible: true
290 }, {
291 label: '',
292 type: 'input',
293 placeholder: '请输入',
294 field: 'tenantGuid',
295 default: '',
296 disabled: true,
297 required: false,
298 col: 'hide',
299 }, {
300 label: '企业名称',
301 type: 'input',
302 placeholder: '请输入',
303 field: 'tenantName',
304 default: '',
305 disabled: true,
306 required: false,
307 visible: true
308 }, {
309 label: '发证主体',
310 type: 'input',
311 placeholder: '请输入',
312 field: 'issuingEntityName',
313 default: '',
314 disabled: true,
315 required: false,
316 visible: true
317 }, {
318 label: '',
319 type: 'input',
320 placeholder: '请输入',
321 field: 'issuingEntityGuid',
322 default: '',
323 disabled: true,
324 required: false,
325 col: 'hide',
326 }, {
327 label: '有限期',
328 type: 'date',
329 placeholder: '请输入',
330 field: 'effectiveDate',
331 default: "",
332 unlink: true,
333 clearable: true,
334 required: false
335 }, {
336 label: "证件类型",
337 type: "select",
338 placeholder: "请选择",
339 field: "documentType",
340 default: 1,
341 options: [{ label: 'A证', value: 1 },
342 { label: 'B证', value: 2 },
343 { label: 'C证', value: 3 }],
344 disabled: false,
345 clearable: true,
346 required: true,
347 }, {
208 label: '证件上传', 348 label: '证件上传',
209 tip: '支持扩展名:.jpg .png', 349 tip: '支持扩展名:.jpg .png',
210 accept: '.jpg, .png', 350 accept: '.jpg, .png',
...@@ -217,6 +357,10 @@ const formItems = ref([{ ...@@ -217,6 +357,10 @@ const formItems = ref([{
217 }]); 357 }]);
218 358
219 const formRules = ref({ 359 const formRules = ref({
360 damGuid: [required('请选择资产')],
361 effectiveDate: [required('请选择有限期')],
362 documentType: [required('请选择证件类型')],
363 daCode: [required('请输入资产编码')],
220 documentFile: [{ 364 documentFile: [{
221 validator: (rule: any, value: any, callback: any) => { 365 validator: (rule: any, value: any, callback: any) => {
222 if (!value?.length) { 366 if (!value?.length) {
...@@ -230,10 +374,10 @@ const formRules = ref({ ...@@ -230,10 +374,10 @@ const formRules = ref({
230 374
231 const dialogInfo = ref({ 375 const dialogInfo = ref({
232 visible: false, 376 visible: false,
233 size: 400, 377 size: 600,
234 direction: "column", 378 direction: "column",
235 header: { 379 header: {
236 title: "确认发证", 380 title: "新增",
237 }, 381 },
238 type: '', 382 type: '',
239 contents: [ 383 contents: [
...@@ -250,29 +394,42 @@ const dialogInfo = ref({ ...@@ -250,29 +394,42 @@ const dialogInfo = ref({
250 footer: { 394 footer: {
251 btns: [ 395 btns: [
252 { type: "default", label: "取消", value: "cancel" }, 396 { type: "default", label: "取消", value: "cancel" },
253 { type: "primary", label: "确定", value: "submit" }, 397 { type: "primary", label: "确定", value: "submit", loading: false },
254 ], 398 ],
255 }, 399 },
256 }); 400 });
257 401
258 const updatePromise: any = ref(null);
259
260 /** 确认发证上传后的确定按钮处理。 */ 402 /** 确认发证上传后的确定按钮处理。 */
261 const dialogBtnClick = (btn, info) => { 403 const dialogBtnClick = (btn, info) => {
262 if (btn.value == 'submit') { 404 if (btn.value == 'submit') {
263 if (updatePromise.value) { 405 if (info.documentFile?.length) {
264 return; 406 info.documentFile = info.documentFile.map(f => {
407 return {
408 name: f.name,
409 url: f.url
265 } 410 }
266 updatePromise.value = updateCertificate({ 411 })
267 guid: currTableData.value.guid, 412 }
268 tenantGuid: userData.tenantGuid, 413 if (dialogInfo.value.type == 'add') {
269 daCode: currTableData.value.daCode, 414 dialogInfo.value.footer.btns[1].loading = true;
270 state: 4, 415 saveCertificate(info).then((res: any) => {
271 documentFile: info.documentFile?.map(f => f.url) || [] 416 dialogInfo.value.footer.btns[1].loading = false;
272 }).then((res: any) => { 417 if (res?.code == proxy.$passCode) {
273 updatePromise.value = null; 418 ElMessage.success('新增资产登记证件提交成功');
419 dialogInfo.value.visible = false;
420 page.value.curr = 1;
421 getTableData();
422 } else {
423 ElMessage.error(res.msg);
424 }
425 })
426 } else {
427 info.guid = currTableData.value.guid;
428 dialogInfo.value.footer.btns[1].loading = true;
429 updateCertificate(info).then((res: any) => {
430 dialogInfo.value.footer.btns[1].loading = false;
274 if (res?.code == proxy.$passCode) { 431 if (res?.code == proxy.$passCode) {
275 ElMessage.success('该资产发证确认成功'); 432 ElMessage.success('编辑提交成功');
276 dialogInfo.value.visible = false; 433 dialogInfo.value.visible = false;
277 page.value.curr = 1; 434 page.value.curr = 1;
278 getTableData(); 435 getTableData();
...@@ -280,22 +437,59 @@ const dialogBtnClick = (btn, info) => { ...@@ -280,22 +437,59 @@ const dialogBtnClick = (btn, info) => {
280 ElMessage.error(res.msg); 437 ElMessage.error(res.msg);
281 } 438 }
282 }) 439 })
440 }
283 } else if (btn.value == 'cancel') { 441 } else if (btn.value == 'cancel') {
284 dialogInfo.value.visible = false; 442 dialogInfo.value.visible = false;
285 } 443 }
286 }; 444 };
287 445
446 const handleDialogSelectChange = (val, row, info) => {
447 if (row.field == 'registerGuid') {
448 let register = val && registerSelectData.value.find(r => r.guid == val);
449 formItems.value.forEach(item => {
450 item.default = info[item.field];
451 if (item.field == 'daName' || item.field == 'registerTime' || item.field == 'tenantGuid' || item.field == 'tenantName') {
452 item.default = register?.[item.field] || '-';
453 } else if (item.field == 'issuingEntityGuid') {
454 item.default = register?.exchangeGuid || '';
455 } else if (item.field == 'issuingEntityName') {
456 item.default = register?.exchangeName || '-';
457 }
458 })
459 }
460 }
461
462 const handleCreate = () => {
463 dialogInfo.value.visible = true;
464 dialogInfo.value.type = 'add';
465 dialogInfo.value.header.title = '新增';
466 formItems.value.forEach(item => {
467 item.default = '';
468 if (item.field == 'documentType') {
469 item.default = 1;
470 } else if (item.field == 'documentFile') {
471 item.default = [];
472 }
473 if (item.field == 'registerGuid' || item.field == 'daCode') {
474 item.disabled = false;
475 }
476 })
477 }
478
288 </script> 479 </script>
289 480
290 <template> 481 <template>
291 <div class="container_wrap"> 482 <div class="container_wrap">
292 <div class="table_tool_wrap"> 483 <div class="table_tool_wrap">
293 <TableTools :searchItems="searchItemList" :searchId="'register-data-search'" @search="toSearch" :init="true" /> 484 <TableTools :searchItems="searchItemList" :searchId="'register-data-search'" @search="toSearch" :init="true" />
485 <div class="tools_btns">
486 <el-button type="primary" @click="handleCreate">新增登记证件</el-button>
487 </div>
294 </div> 488 </div>
295 <div class="table_panel_wrap"> 489 <div class="table_panel_wrap">
296 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange" /> 490 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange" />
297 </div> 491 </div>
298 <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" /> 492 <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @select-change="handleDialogSelectChange" />
299 </div> 493 </div>
300 </template> 494 </template>
301 495
......
...@@ -558,7 +558,7 @@ function fetchRegisterUrl() { ...@@ -558,7 +558,7 @@ function fetchRegisterUrl() {
558 d.documentTypeDesc = d.documentType === 1 ? 'A证' : d.documentType === 2 ? 'B证' : 'C证'; 558 d.documentTypeDesc = d.documentType === 1 ? 'A证' : d.documentType === 2 ? 'B证' : 'C证';
559 559
560 // 使用注释替换的代码逻辑 560 // 使用注释替换的代码逻辑
561 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(d.documentFile[0]).fileName); 561 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(d.documentFile[0].url).fileName);
562 if (!refSignInfo?.data) { 562 if (!refSignInfo?.data) {
563 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg); 563 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
564 return null; 564 return null;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!