Bläddra i källkod

车辆费用表

lamphua 1 år sedan
förälder
incheckning
8c9ebb9f5d

+ 12
- 10
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarApprovalController.java Visa fil

@@ -163,17 +163,19 @@ public class CmcCarApprovalController extends BaseController
163 163
         if (formDataJson.getString("dispatchComment") != null) {
164 164
             cmcCarApproval.setDispatcher(getLoginUser().getUserId());
165 165
             cmcCarApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
166
-            String carString = formDataJson.getString("cars").substring(1, formDataJson.getString("cars").length() - 1);
167
-            cmcCarApproval.setCars(carString);
168
-            cmcCarApproval.setDrivers(formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1));
169
-            String[] cars = carString.split(",");
170
-            BigDecimal estimateCost = new BigDecimal(0);
171
-            for (String car : cars) {
172
-                CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(Integer.parseInt(car));
173
-                if (cmcCar.getDayCost() != null)
174
-                    estimateCost = estimateCost.add(cmcCar.getDayCost().multiply(new BigDecimal(cmcCarApproval.getDays())));
166
+            if (formDataJson.getString("cars") != null && formDataJson.getString("drivers") != null) {
167
+                String carString = formDataJson.getString("cars").substring(1, formDataJson.getString("cars").length() - 1);
168
+                cmcCarApproval.setCars(carString);
169
+                cmcCarApproval.setDrivers(formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1));
170
+                String[] cars = carString.split(",");
171
+                BigDecimal estimateCost = new BigDecimal(0);
172
+                for (String car : cars) {
173
+                    CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(Integer.parseInt(car));
174
+                    if (cmcCar.getDayCost() != null)
175
+                        estimateCost = estimateCost.add(cmcCar.getDayCost().multiply(new BigDecimal(cmcCarApproval.getDays())));
176
+                }
177
+                cmcCarApproval.setEstimateCost(estimateCost);
175 178
             }
176
-            cmcCarApproval.setEstimateCost(estimateCost);
177 179
         }
178 180
         cmcCarApprovalService.updateCmcCarApproval(cmcCarApproval);
179 181
         return AjaxResult.success("修改用车审批表成功");

+ 11
- 9
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceApprovalController.java Visa fil

@@ -159,16 +159,18 @@ public class CmcDeviceApprovalController extends BaseController
159 159
         if (formDataJson.getString("dispatchComment") != null) {
160 160
             cmcDeviceApproval.setDispatcher(getLoginUser().getUserId());
161 161
             cmcDeviceApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
162
-            String deviceString = formDataJson.getString("devices").substring(1, formDataJson.getString("devices").length() - 1);
163
-            cmcDeviceApproval.setDevices(deviceString);
164
-            String[] devices = deviceString.split(",");
165
-            BigDecimal estimateCost = new BigDecimal(0);
166
-            for (String device : devices) {
167
-                CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
168
-                if (cmcDevice.getDayCost() != null)
169
-                    estimateCost = estimateCost.add(cmcDevice.getDayCost().multiply(new BigDecimal(cmcDeviceApproval.getDays())));
162
+            if (formDataJson.getString("devices") != null) {
163
+                String deviceString = formDataJson.getString("devices").substring(1, formDataJson.getString("devices").length() - 1);
164
+                cmcDeviceApproval.setDevices(deviceString);
165
+                String[] devices = deviceString.split(",");
166
+                BigDecimal estimateCost = new BigDecimal(0);
167
+                for (String device : devices) {
168
+                    CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
169
+                    if (cmcDevice.getDayCost() != null)
170
+                        estimateCost = estimateCost.add(cmcDevice.getDayCost().multiply(new BigDecimal(cmcDeviceApproval.getDays())));
171
+                }
172
+                cmcDeviceApproval.setEstimateCost(estimateCost);
170 173
             }
171
-            cmcDeviceApproval.setEstimateCost(estimateCost);
172 174
         }
173 175
         cmcDeviceApprovalService.updateCmcDeviceApproval(cmcDeviceApproval);
174 176
         return AjaxResult.success("修改设备审批表成功");

+ 24
- 10
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcCar.java Visa fil

@@ -42,13 +42,17 @@ public class CmcCar extends BaseEntity
42 42
     @Excel(name = "预计使用年限")
43 43
     private Integer expectLife;
44 44
 
45
-    /** 车系 */
46
-    @Excel(name = "车系")
45
+    /** 预计行驶里程 */
46
+    @Excel(name = "预计行驶里程(万千米)")
47
+    private Integer expectKm;
48
+
49
+    /** 车型 */
50
+    @Excel(name = "车型")
47 51
     private String series;
48 52
 
49
-    /** 车级 */
50
-    @Excel(name = "车级")
51
-    private String level;
53
+    /** 品牌 */
54
+    @Excel(name = "品牌")
55
+    private String brand;
52 56
 
53 57
     /** 是否为租车 */
54 58
     @Excel(name = "是否为租车")
@@ -112,6 +116,15 @@ public class CmcCar extends BaseEntity
112 116
     {
113 117
         return expectLife;
114 118
     }
119
+    public void setExpectKm(Integer expectKm)
120
+    {
121
+        this.expectKm = expectKm;
122
+    }
123
+
124
+    public Integer getExpectKm()
125
+    {
126
+        return expectKm;
127
+    }
115 128
     public void setSeries(String series)
116 129
     {
117 130
         this.series = series;
@@ -121,14 +134,14 @@ public class CmcCar extends BaseEntity
121 134
     {
122 135
         return series;
123 136
     }
124
-    public void setLevel(String level)
137
+    public void setBrand(String brand)
125 138
     {
126
-        this.level = level;
139
+        this.brand = brand;
127 140
     }
128 141
 
129
-    public String getLevel()
142
+    public String getBrand()
130 143
     {
131
-        return level;
144
+        return brand;
132 145
     }
133 146
     public void setIsRent(String isRent)
134 147
     {
@@ -158,8 +171,9 @@ public class CmcCar extends BaseEntity
158 171
                 .append("acquisitionTime", getAcquisitionTime())
159 172
                 .append("cost", getCost())
160 173
                 .append("expectLife", getExpectLife())
174
+                .append("expectKm", getExpectKm())
161 175
                 .append("series", getSeries())
162
-                .append("level", getLevel())
176
+                .append("brand", getBrand())
163 177
                 .append("isRent", getIsRent())
164 178
                 .append("dayCost", getDayCost())
165 179
                 .toString();

+ 11
- 6
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcCarMapper.xml Visa fil

@@ -11,14 +11,15 @@
11 11
         <result property="acquisitionTime"    column="acquisition_time"    />
12 12
         <result property="cost"    column="cost"    />
13 13
         <result property="expectLife"    column="expect_life"    />
14
+        <result property="expectKm"    column="expect_km"    />
14 15
         <result property="series"    column="series"    />
15
-        <result property="level"    column="level"    />
16
+        <result property="brand"    column="brand"    />
16 17
         <result property="isRent"    column="is_rent"    />
17 18
         <result property="dayCost"    column="day_cost"    />
18 19
     </resultMap>
19 20
 
20 21
     <sql id="selectCmcCarVo">
21
-        select car_id, license_plate, driver, acquisition_time, cost, expect_life, series, level, is_rent, day_cost from cmc_car
22
+        select car_id, license_plate, driver, acquisition_time, cost, expect_life, expect_km, series, brand, is_rent, day_cost from cmc_car
22 23
     </sql>
23 24
 
24 25
     <select id="selectCmcCarList" parameterType="CmcCar" resultMap="CmcCarResult">
@@ -29,8 +30,9 @@
29 30
             <if test="acquisitionTime != null "> and acquisition_time = #{acquisitionTime}</if>
30 31
             <if test="cost != null "> and cost = #{cost}</if>
31 32
             <if test="expectLife != null "> and expect_life = #{expectLife}</if>
33
+            <if test="expectKm != null "> and expect_km = #{expectKm}</if>
32 34
             <if test="series != null  and series != ''"> and series like concat('%', #{series}, '%')</if>
33
-            <if test="level != null  and level != ''"> and level like concat('%', #{level}, '%')</if>
35
+            <if test="brand != null  and brand != ''"> and brand like concat('%', #{brand}, '%')</if>
34 36
             <if test="isRent != null  and isRent != ''"> and isRent = #{isRent}</if>
35 37
             <if test="dayCost != null  and dayCost != ''"> and day_cost = #{dayCost}</if>
36 38
         </where>
@@ -49,8 +51,9 @@
49 51
             <if test="acquisitionTime != null">acquisition_time,</if>
50 52
             <if test="cost != null">cost,</if>
51 53
             <if test="expectLife != null">expect_life,</if>
54
+            <if test="expectKm != null">expect_km,</if>
52 55
             <if test="series != null">series,</if>
53
-            <if test="level != null">level,</if>
56
+            <if test="brand != null">brand,</if>
54 57
             <if test="isRent != null">is_rent,</if>
55 58
             <if test="dayCost != null">day_cost,</if>
56 59
         </trim>
@@ -60,8 +63,9 @@
60 63
             <if test="acquisitionTime != null">#{acquisitionTime},</if>
61 64
             <if test="cost != null">#{cost},</if>
62 65
             <if test="expectLife != null">#{expectLife},</if>
66
+            <if test="expectKm != null">#{expectKm},</if>
63 67
             <if test="series != null">#{series},</if>
64
-            <if test="level != null">#{level},</if>
68
+            <if test="brand != null">#{brand},</if>
65 69
             <if test="isRent != null">#{isRent},</if>
66 70
             <if test="dayCost != null">#{dayCost},</if>
67 71
         </trim>
@@ -75,8 +79,9 @@
75 79
             <if test="acquisitionTime != null">acquisition_time = #{acquisitionTime},</if>
76 80
             <if test="cost != null">cost = #{cost},</if>
77 81
             <if test="expectLife != null">expect_life = #{expectLife},</if>
82
+            <if test="expectKm != null">expect_km = #{expectKm},</if>
78 83
             <if test="series != null">series = #{series},</if>
79
-            <if test="level != null">level = #{level},</if>
84
+            <if test="brand != null">brand = #{brand},</if>
80 85
             <if test="isRent != null">is_rent = #{isRent},</if>
81 86
             <if test="dayCost != null">day_cost = #{dayCost},</if>
82 87
         </trim>

+ 61
- 24
oa-back/sql/sql.sql
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 22
- 9
oa-ui/src/views/oa/car/index.vue Visa fil

@@ -38,8 +38,8 @@
38 38
       <!-- <el-table-column label="车辆id" align="center" prop="carId" /> -->
39 39
       <el-table-column label="车牌号" align="center" prop="licensePlate" />
40 40
       <!-- <el-table-column label="驾驶员" align="center" prop="driver" /> -->
41
-      <el-table-column label="车系" align="center" prop="series" />
42
-      <el-table-column label="车级" align="center" prop="level" />
41
+      <el-table-column label="品牌" align="center" prop="brand" />
42
+      <el-table-column label="车型" align="center" prop="series" />
43 43
       <el-table-column label="购置时间" align="center" prop="acquisitionTime" />
44 44
       <el-table-column label="是否为租车" align="center" prop="isRent" >{{ idRent == "0" ? "否" : "是" }}</el-table-column>
45 45
       <el-table-column label="总价" align="center" prop="cost">
@@ -47,8 +47,17 @@
47 47
           {{ scope.row.cost + '万元' }}
48 48
         </template>
49 49
       </el-table-column>
50
-      <el-table-column label="预计使用年限" align="center" prop="expectLife" />
51
-      <el-table-column label="使用成本(天)" align="center" prop="dayCost" />
50
+      <el-table-column label="预计使用年限" align="center" prop="expectLife" >        
51
+        <template slot-scope="scope">
52
+          {{ scope.row.expectLife + '年' }}
53
+        </template>
54
+      </el-table-column>
55
+      <el-table-column label="预计行驶里程" align="center" prop="expectKm" >        
56
+        <template slot-scope="scope">
57
+          {{ scope.row.expectKm + '万千米' }}
58
+        </template>
59
+      </el-table-column>
60
+      <el-table-column label="单日成本" align="center" prop="dayCost" />
52 61
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
53 62
 
54 63
         <template slot-scope="scope">
@@ -69,11 +78,11 @@
69 78
         <el-form-item label="车牌号" prop="licensePlate">
70 79
           <el-input v-model="form.licensePlate" placeholder="请输入车牌号" />
71 80
         </el-form-item>
72
-        <el-form-item label="车系" prop="series">
73
-          <el-input v-model="form.series" placeholder="请输入车系" />
81
+        <el-form-item label="品牌" prop="brand">
82
+          <el-input v-model="form.brand" placeholder="请输入品牌" />
74 83
         </el-form-item>
75
-        <el-form-item label="车级" prop="level">
76
-          <el-input v-model="form.level" placeholder="请输入车级" />
84
+        <el-form-item label="车型" prop="series">
85
+          <el-input v-model="form.series" placeholder="请输入车型" />
77 86
         </el-form-item>
78 87
         <el-form-item label="购置时间" prop="acquisitionTime">
79 88
           <el-date-picker v-model="form.acquisitionTime" type="date" placeholder="选择日期" format="yyyy-MM-dd"
@@ -88,6 +97,10 @@
88 97
           <el-input v-model="form.expectLife" placeholder="请输入年限" style="width:130px;margin-right:10px;" />
89 98
           <span>年</span>
90 99
         </el-form-item>
100
+        <el-form-item label="预计行驶里程" prop="expectKm">
101
+          <el-input v-model="form.expectKm" placeholder="请输入里程" style="width:130px;margin-right:10px;" />
102
+          <span>万千米</span>
103
+        </el-form-item>
91 104
         <el-form-item label="驾驶员" prop="driver">
92 105
           <el-select v-model="form.driver" filterable placeholder="请选择" clearable>
93 106
             <el-option v-for="item in driverList" :key="item.userId" :label="item.nickName" :value="item.userId">
@@ -100,7 +113,7 @@
100 113
             <el-radio label="1">是</el-radio>
101 114
           </el-radio-group>
102 115
         </el-form-item>
103
-        <el-form-item v-if="form.isRent == '1'" label="使用成本(天)" prop="dayCost">
116
+        <el-form-item v-if="form.isRent == '1'" label="单日成本" prop="dayCost">
104 117
           <el-input style="width:130px;margin-right:10px;" v-model="form.dayCost" placeholder="请输入金额" />
105 118
           <span>元</span>
106 119
         </el-form-item>

Loading…
Avbryt
Spara