From 412651bfede590a00f97a0f4b1f17dfad158f92f Mon Sep 17 00:00:00 2001 From: jiyufei <67400194@qq.com> Date: Tue, 30 Jul 2024 13:58:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(front):=E8=BD=A6=E8=BE=86=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jnpf/controller/VehicleController.java | 158 ++++++++++-------- .../jnpf-web/src/views/scm/person/form.vue | 111 ++++++------ .../jnpf-web/src/views/scm/vehicle/form.vue | 9 +- 3 files changed, 148 insertions(+), 130 deletions(-) diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/VehicleController.java b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/VehicleController.java index 29b20ff..b521475 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/VehicleController.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/VehicleController.java @@ -13,24 +13,31 @@ import jnpf.entity.*; import jnpf.util.*; import jnpf.model.vehicle.*; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; import javax.validation.Valid; import java.util.*; + import jnpf.annotation.JnpfField; import jnpf.base.vo.PageListVO; import jnpf.base.vo.PaginationVO; import jnpf.base.vo.DownloadVO; import jnpf.config.ConfigValueUtil; import jnpf.base.entity.ProvinceEntity; + import java.io.IOException; import java.util.stream.Collectors; + import jnpf.engine.entity.FlowTaskEntity; import jnpf.exception.WorkFlowException; import org.springframework.transaction.annotation.Transactional; /** * Vehicle + * * @版本: V3.5 * @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com) * @作者: JNPF开发平台组 @@ -38,7 +45,7 @@ import org.springframework.transaction.annotation.Transactional; */ @Slf4j @RestController -@Tag(name = "Vehicle" , description = "example") +@Tag(name = "Vehicle", description = "example") @RequestMapping("/api/example/Vehicle") public class VehicleController { @@ -51,24 +58,26 @@ public class VehicleController { @Autowired private VehicleService vehicleService; + @Resource + private EnterpriseMerchantsService enterpriseMerchantsService; /** - * 列表 - * - * @param vehiclePagination - * @return - */ + * 列表 + * + * @param vehiclePagination + * @return + */ @Operation(summary = "获取列表") @PostMapping("/getList") - public ActionResult list(@RequestBody VehiclePagination vehiclePagination)throws IOException{ - List list= vehicleService.getList(vehiclePagination); - List> realList=new ArrayList<>(); + public ActionResult list(@RequestBody VehiclePagination vehiclePagination) throws IOException { + List list = vehicleService.getList(vehiclePagination); + List> realList = new ArrayList<>(); for (VehicleEntity entity : list) { - Map vehicleMap=JsonUtil.entityToMap(entity); - vehicleMap.put("id", vehicleMap.get("id")); - //副表数据 - //子表数据 + Map vehicleMap = JsonUtil.entityToMap(entity); + vehicleMap.put("id", vehicleMap.get("id")); + //副表数据 + //子表数据 realList.add(vehicleMap); } //数据转换 @@ -81,110 +90,123 @@ public class VehicleController { vo.setPagination(page); return ActionResult.success(vo); } + /** - * 创建 - * - * @param vehicleForm - * @return - */ + * 创建 + * + * @param vehicleForm + * @return + */ @PostMapping() @Operation(summary = "创建") public ActionResult create(@RequestBody @Valid VehicleForm vehicleForm) { - String b = vehicleService.checkForm(vehicleForm,0); - if (StringUtil.isNotEmpty(b)){ - return ActionResult.fail(b ); + String b = vehicleService.checkForm(vehicleForm, 0); + if (StringUtil.isNotEmpty(b)) { + return ActionResult.fail(b); } - try{ - vehicleService.saveOrUpdate(vehicleForm, null ,true); - }catch(Exception e){ + try { + vehicleService.saveOrUpdate(vehicleForm, null, true); + } catch (Exception e) { return ActionResult.fail("新增数据失败"); } return ActionResult.success("创建成功"); } + /** - * 编辑 - * @param id - * @param vehicleForm - * @return - */ + * 编辑 + * + * @param id + * @param vehicleForm + * @return + */ @PutMapping("/{id}") @Operation(summary = "更新") - public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid VehicleForm vehicleForm, - @RequestParam(value = "isImport", required = false) boolean isImport){ + public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid VehicleForm vehicleForm, + @RequestParam(value = "isImport", required = false) boolean isImport) { vehicleForm.setId(id); if (!isImport) { - String b = vehicleService.checkForm(vehicleForm,1); - if (StringUtil.isNotEmpty(b)){ - return ActionResult.fail(b ); + String b = vehicleService.checkForm(vehicleForm, 1); + if (StringUtil.isNotEmpty(b)) { + return ActionResult.fail(b); } } - VehicleEntity entity= vehicleService.getInfo(id); - if(entity!=null){ - try{ - vehicleService.saveOrUpdate(vehicleForm,id,false); - }catch(Exception e){ + VehicleEntity entity = vehicleService.getInfo(id); + if (entity != null) { + try { + vehicleService.saveOrUpdate(vehicleForm, id, false); + } catch (Exception e) { return ActionResult.fail("修改数据失败"); } return ActionResult.success("更新成功"); - }else{ + } else { return ActionResult.fail("更新失败,数据不存在"); } } + /** - * 删除 - * @param id - * @return - */ + * 删除 + * + * @param id + * @return + */ @Operation(summary = "删除") @DeleteMapping("/{id}") @Transactional - public ActionResult delete(@PathVariable("id") String id){ - VehicleEntity entity= vehicleService.getInfo(id); - if(entity!=null){ + public ActionResult delete(@PathVariable("id") String id) { + VehicleEntity entity = vehicleService.getInfo(id); + if (entity != null) { //假删除 entity.setDeleteMark(1); - vehicleService.update(id,entity); + vehicleService.update(id, entity); } return ActionResult.success("删除成功"); } + /** - * 表单信息(详情页) - * 详情页面使用-转换数据 - * @param id - * @return - */ + * 表单信息(详情页) + * 详情页面使用-转换数据 + * + * @param id + * @return + */ @Operation(summary = "表单信息(详情页)") @GetMapping("/detail/{id}") - public ActionResult detailInfo(@PathVariable("id") String id){ - VehicleEntity entity= vehicleService.getInfo(id); - if(entity==null){ + public ActionResult detailInfo(@PathVariable("id") String id) { + VehicleEntity entity = vehicleService.getInfo(id); + if (entity == null) { return ActionResult.fail("表单数据不存在!"); } - Map vehicleMap=JsonUtil.entityToMap(entity); + Map vehicleMap = JsonUtil.entityToMap(entity); vehicleMap.put("id", vehicleMap.get("id")); //副表数据 //子表数据 - vehicleMap = generaterSwapUtil.swapDataDetail(vehicleMap,VehicleConstant.getFormData(),"582912646513169797",false); + vehicleMap = generaterSwapUtil.swapDataDetail(vehicleMap, VehicleConstant.getFormData(), "582912646513169797", false); + if ("null".equals(vehicleMap.get("ascriptionId")) && "商户".equals(vehicleMap.get("vehicleAscription"))) { + //手动查询商户赋值 + vehicleMap.put("ascriptionId", enterpriseMerchantsService.findNameById(entity.getAscriptionId())); + } return ActionResult.success(vehicleMap); } + /** - * 获取详情(编辑页) - * 编辑页面使用-不转换数据 - * @param id - * @return - */ + * 获取详情(编辑页) + * 编辑页面使用-不转换数据 + * + * @param id + * @return + */ @Operation(summary = "信息") @GetMapping("/{id}") - public ActionResult info(@PathVariable("id") String id){ - VehicleEntity entity= vehicleService.getInfo(id); - if(entity==null){ + public ActionResult info(@PathVariable("id") String id) { + VehicleEntity entity = vehicleService.getInfo(id); + if (entity == null) { return ActionResult.fail("表单数据不存在!"); } - Map vehicleMap=JsonUtil.entityToMap(entity); + Map vehicleMap = JsonUtil.entityToMap(entity); vehicleMap.put("id", vehicleMap.get("id")); //副表数据 //子表数据 - vehicleMap = generaterSwapUtil.swapDataForm(vehicleMap,VehicleConstant.getFormData(),VehicleConstant.TABLEFIELDKEY,VehicleConstant.TABLERENAMES); + vehicleMap = generaterSwapUtil.swapDataForm(vehicleMap, VehicleConstant.getFormData(), VehicleConstant.TABLEFIELDKEY, VehicleConstant.TABLERENAMES); return ActionResult.success(vehicleMap); } diff --git a/jnpf-java-boot/jnpf-web/src/views/scm/person/form.vue b/jnpf-java-boot/jnpf-web/src/views/scm/person/form.vue index b8f66c1..75e2990 100644 --- a/jnpf-java-boot/jnpf-web/src/views/scm/person/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/scm/person/form.vue @@ -45,8 +45,8 @@ + :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" + clearable :style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd"> @@ -54,15 +54,15 @@ + :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" + clearable :style='{ "width": "100%" }' type="datetime" format="yyyy-MM-dd"> - + @@ -81,18 +81,17 @@ :style='{ "width": "100%" }'> - - - - 生成 - - -
-
-
-
+ + + 生成 + + +
+
+
+ @@ -284,46 +283,46 @@ export default { mounted() { }, methods: { getQRimg() { - if (this.dataForm.userCode == null || this.dataForm.userName == null || - this.dataForm.phone == null || this.dataForm.userAscription == null || this.dataForm.idCard == null - || this.dataForm.effectiveStartTime == null || this.dataForm.effectiveEndTime == null|| this.dataForm.entryCodes == null) { - this.$message.error('请完善必填信息'); - return - } - let qrCodeJsonString = JSON.stringify(this.dataForm); - this.qrcode = qrCodeJsonString; - if (!this.qrcode) { - return - } - this.$refs.qrCode.innerHTML = ""; - let qrcode = new QRCode(this.$refs.qrCode, { - width: 265, - height: 265, // 高度 - text: this.qrcode, // 二维码内容 - // render: 'canvas' // 设置渲染方式(有两种方式 table和canvas,默认是canvas) - // background: '#f0f' - // foreground: '#ff0' - correctLevel: QRCode.CorrectLevel.H //容错级别 容错级别有:(1)QRCode.CorrectLevel.L (2)QRCode.CorrectLevel.M (3)QRCode.CorrectLevel.Q (4)QRCode.CorrectLevel.H - }) - }, - getBarcode() { - let reg = /^[A-Za-z0-9]+$/ - if (!reg.test(this.barcode)) { - this.$message({ - message: '请输入数字或者英文字母', - type: 'error', - duration: 1500, - }) - return - } - JsBarcode("#barcode", this.barcode, { - // format: "pharmacode", - // lineColor: "#0aa", - width: 4, - height: 80, - displayValue: false - }); - }, + if (this.dataForm.userCode == null || this.dataForm.userName == null || + this.dataForm.phone == null || this.dataForm.userAscription == null || this.dataForm.idCard == null + || this.dataForm.effectiveStartTime == null || this.dataForm.effectiveEndTime == null || this.dataForm.entryCodes == null) { + this.$message.error('请完善必填信息'); + return + } + let qrCodeJsonString = JSON.stringify(this.dataForm); + this.qrcode = qrCodeJsonString; + if (!this.qrcode) { + return + } + this.$refs.qrCode.innerHTML = ""; + let qrcode = new QRCode(this.$refs.qrCode, { + width: 265, + height: 265, // 高度 + text: this.qrcode, // 二维码内容 + // render: 'canvas' // 设置渲染方式(有两种方式 table和canvas,默认是canvas) + // background: '#f0f' + // foreground: '#ff0' + correctLevel: QRCode.CorrectLevel.H //容错级别 容错级别有:(1)QRCode.CorrectLevel.L (2)QRCode.CorrectLevel.M (3)QRCode.CorrectLevel.Q (4)QRCode.CorrectLevel.H + }) + }, + getBarcode() { + let reg = /^[A-Za-z0-9]+$/ + if (!reg.test(this.barcode)) { + this.$message({ + message: '请输入数字或者英文字母', + type: 'error', + duration: 1500, + }) + return + } + JsBarcode("#barcode", this.barcode, { + // format: "pharmacode", + // lineColor: "#0aa", + width: 4, + height: 80, + displayValue: false + }); + }, selectChangeData(var1, var2) { this.dataForm.merchantId = var2.id; this.dataForm.merchantName = var2.cmp_nm; diff --git a/jnpf-java-boot/jnpf-web/src/views/scm/vehicle/form.vue b/jnpf-java-boot/jnpf-web/src/views/scm/vehicle/form.vue index 71dbb88..900cadc 100644 --- a/jnpf-java-boot/jnpf-web/src/views/scm/vehicle/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/scm/vehicle/form.vue @@ -41,7 +41,7 @@ - + - - - @@ -316,8 +313,8 @@ export default { mounted() { }, methods: { selectChangeData(var1, var2) { - this.dataForm.ascriptionId = var1.id; - this.dataForm.ascriptionName = var1.cmp_nm; + this.dataForm.ascriptionId = var2.id; + this.dataForm.ascriptionName = var2.cmp_nm; }, depSelectChangeData(var1, var2) { this.dataForm.ascriptionId = var2.id;