lamphua пре 1 година
родитељ
комит
58850dae09

+ 107
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarExpenseController.java Прегледај датотеку

@@ -0,0 +1,107 @@
1
+package com.ruoyi.web.controller.oa;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+
6
+import com.ruoyi.common.utils.SnowFlake;
7
+import org.springframework.security.access.prepost.PreAuthorize;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.GetMapping;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.PutMapping;
12
+import org.springframework.web.bind.annotation.DeleteMapping;
13
+import org.springframework.web.bind.annotation.PathVariable;
14
+import org.springframework.web.bind.annotation.RequestBody;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RestController;
17
+import com.ruoyi.common.annotation.Log;
18
+import com.ruoyi.common.core.controller.BaseController;
19
+import com.ruoyi.common.core.domain.AjaxResult;
20
+import com.ruoyi.common.enums.BusinessType;
21
+import com.ruoyi.oa.domain.CmcCarExpense;
22
+import com.ruoyi.oa.service.ICmcCarExpenseService;
23
+import com.ruoyi.common.utils.poi.ExcelUtil;
24
+import com.ruoyi.common.core.page.TableDataInfo;
25
+
26
+/**
27
+ * cmc车辆费用Controller
28
+ * 
29
+ * @author cmc
30
+ * @date 2024-03-12
31
+ */
32
+@RestController
33
+@RequestMapping("/oa/carExpense")
34
+public class CmcCarExpenseController extends BaseController
35
+{
36
+    @Autowired
37
+    private ICmcCarExpenseService cmcCarExpenseService;
38
+
39
+    /**
40
+     * 查询cmc车辆费用列表
41
+     */
42
+    @PreAuthorize("@ss.hasPermi('oa:expense:list')")
43
+    @GetMapping("/list")
44
+    public TableDataInfo list(CmcCarExpense cmcCarExpense)
45
+    {
46
+        startPage();
47
+        List<CmcCarExpense> list = cmcCarExpenseService.selectCmcCarExpenseList(cmcCarExpense);
48
+        return getDataTable(list);
49
+    }
50
+
51
+    /**
52
+     * 导出cmc车辆费用列表
53
+     */
54
+    @PreAuthorize("@ss.hasPermi('oa:expense:export')")
55
+    @Log(title = "cmc车辆费用", businessType = BusinessType.EXPORT)
56
+    @PostMapping("/export")
57
+    public void export(HttpServletResponse response, CmcCarExpense cmcCarExpense)
58
+    {
59
+        List<CmcCarExpense> list = cmcCarExpenseService.selectCmcCarExpenseList(cmcCarExpense);
60
+        ExcelUtil<CmcCarExpense> util = new ExcelUtil<CmcCarExpense>(CmcCarExpense.class);
61
+        util.exportExcel(response, list, "cmc车辆费用数据");
62
+    }
63
+
64
+    /**
65
+     * 获取cmc车辆费用详细信息
66
+     */
67
+    @PreAuthorize("@ss.hasPermi('oa:expense:query')")
68
+    @GetMapping(value = "/{carExpenseId}")
69
+    public AjaxResult getInfo(@PathVariable("carExpenseId") String carExpenseId)
70
+    {
71
+        return success(cmcCarExpenseService.selectCmcCarExpenseByCarExpenseId(carExpenseId));
72
+    }
73
+
74
+    /**
75
+     * 新增cmc车辆费用
76
+     */
77
+    @PreAuthorize("@ss.hasPermi('oa:expense:add')")
78
+    @Log(title = "cmc车辆费用", businessType = BusinessType.INSERT)
79
+    @PostMapping
80
+    public AjaxResult add(@RequestBody CmcCarExpense cmcCarExpense)
81
+    {
82
+        cmcCarExpense.setCarExpenseId(new SnowFlake().generateId());
83
+        return toAjax(cmcCarExpenseService.insertCmcCarExpense(cmcCarExpense));
84
+    }
85
+
86
+    /**
87
+     * 修改cmc车辆费用
88
+     */
89
+    @PreAuthorize("@ss.hasPermi('oa:expense:edit')")
90
+    @Log(title = "cmc车辆费用", businessType = BusinessType.UPDATE)
91
+    @PutMapping
92
+    public AjaxResult edit(@RequestBody CmcCarExpense cmcCarExpense)
93
+    {
94
+        return toAjax(cmcCarExpenseService.updateCmcCarExpense(cmcCarExpense));
95
+    }
96
+
97
+    /**
98
+     * 删除cmc车辆费用
99
+     */
100
+    @PreAuthorize("@ss.hasPermi('oa:expense:remove')")
101
+    @Log(title = "cmc车辆费用", businessType = BusinessType.DELETE)
102
+	@DeleteMapping("/{carExpenseIds}")
103
+    public AjaxResult remove(@PathVariable String[] carExpenseIds)
104
+    {
105
+        return toAjax(cmcCarExpenseService.deleteCmcCarExpenseByCarExpenseIds(carExpenseIds));
106
+    }
107
+}

+ 97
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcCarExpense.java Прегледај датотеку

@@ -0,0 +1,97 @@
1
+package com.ruoyi.oa.domain;
2
+
3
+import java.math.BigDecimal;
4
+import java.util.Date;
5
+import com.fasterxml.jackson.annotation.JsonFormat;
6
+import org.apache.commons.lang3.builder.ToStringBuilder;
7
+import org.apache.commons.lang3.builder.ToStringStyle;
8
+import com.ruoyi.common.annotation.Excel;
9
+import com.ruoyi.common.core.domain.BaseEntity;
10
+
11
+/**
12
+ * cmc车辆费用对象 cmc_car_expense
13
+ * 
14
+ * @author cmc
15
+ * @date 2024-03-12
16
+ */
17
+public class CmcCarExpense extends BaseEntity
18
+{
19
+    private static final long serialVersionUID = 1L;
20
+
21
+    /** 车辆费用id */
22
+    private String carExpenseId;
23
+
24
+    /** 车辆id */
25
+    @Excel(name = "车辆id")
26
+    private Integer carId;
27
+
28
+    /** 费用类型 */
29
+    @Excel(name = "费用类型")
30
+    private String expenseType;
31
+
32
+    /** 费用金额 */
33
+    @Excel(name = "费用金额")
34
+    private BigDecimal expense;
35
+
36
+    /** 发生日期 */
37
+    @JsonFormat(pattern = "yyyy-MM-dd")
38
+    @Excel(name = "发生日期", width = 30, dateFormat = "yyyy-MM-dd")
39
+    private Date occurrDate;
40
+
41
+    public void setCarExpenseId(String carExpenseId) 
42
+    {
43
+        this.carExpenseId = carExpenseId;
44
+    }
45
+
46
+    public String getCarExpenseId() 
47
+    {
48
+        return carExpenseId;
49
+    }
50
+    public void setCarId(Integer carId) 
51
+    {
52
+        this.carId = carId;
53
+    }
54
+
55
+    public Integer getCarId() 
56
+    {
57
+        return carId;
58
+    }
59
+    public void setExpenseType(String expenseType) 
60
+    {
61
+        this.expenseType = expenseType;
62
+    }
63
+
64
+    public String getExpenseType() 
65
+    {
66
+        return expenseType;
67
+    }
68
+    public void setExpense(BigDecimal expense) 
69
+    {
70
+        this.expense = expense;
71
+    }
72
+
73
+    public BigDecimal getExpense() 
74
+    {
75
+        return expense;
76
+    }
77
+    public void setOccurrDate(Date occurrDate)
78
+    {
79
+        this.occurrDate = occurrDate;
80
+    }
81
+
82
+    public Date getOccurrDate()
83
+    {
84
+        return occurrDate;
85
+    }
86
+
87
+    @Override
88
+    public String toString() {
89
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
90
+            .append("carExpenseId", getCarExpenseId())
91
+            .append("carId", getCarId())
92
+            .append("expenseType", getExpenseType())
93
+            .append("expense", getExpense())
94
+            .append("occurrDate", getOccurrDate())
95
+            .toString();
96
+    }
97
+}

+ 61
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcCarExpenseMapper.java Прегледај датотеку

@@ -0,0 +1,61 @@
1
+package com.ruoyi.oa.mapper;
2
+
3
+import java.util.List;
4
+import com.ruoyi.oa.domain.CmcCarExpense;
5
+
6
+/**
7
+ * cmc车辆费用Mapper接口
8
+ * 
9
+ * @author cmc
10
+ * @date 2024-03-12
11
+ */
12
+public interface CmcCarExpenseMapper 
13
+{
14
+    /**
15
+     * 查询cmc车辆费用
16
+     * 
17
+     * @param carExpenseId cmc车辆费用主键
18
+     * @return cmc车辆费用
19
+     */
20
+    public CmcCarExpense selectCmcCarExpenseByCarExpenseId(String carExpenseId);
21
+
22
+    /**
23
+     * 查询cmc车辆费用列表
24
+     * 
25
+     * @param cmcCarExpense cmc车辆费用
26
+     * @return cmc车辆费用集合
27
+     */
28
+    public List<CmcCarExpense> selectCmcCarExpenseList(CmcCarExpense cmcCarExpense);
29
+
30
+    /**
31
+     * 新增cmc车辆费用
32
+     * 
33
+     * @param cmcCarExpense cmc车辆费用
34
+     * @return 结果
35
+     */
36
+    public int insertCmcCarExpense(CmcCarExpense cmcCarExpense);
37
+
38
+    /**
39
+     * 修改cmc车辆费用
40
+     * 
41
+     * @param cmcCarExpense cmc车辆费用
42
+     * @return 结果
43
+     */
44
+    public int updateCmcCarExpense(CmcCarExpense cmcCarExpense);
45
+
46
+    /**
47
+     * 删除cmc车辆费用
48
+     * 
49
+     * @param carExpenseId cmc车辆费用主键
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcCarExpenseByCarExpenseId(String carExpenseId);
53
+
54
+    /**
55
+     * 批量删除cmc车辆费用
56
+     * 
57
+     * @param carExpenseIds 需要删除的数据主键集合
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcCarExpenseByCarExpenseIds(String[] carExpenseIds);
61
+}

+ 61
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcCarExpenseService.java Прегледај датотеку

@@ -0,0 +1,61 @@
1
+package com.ruoyi.oa.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.oa.domain.CmcCarExpense;
5
+
6
+/**
7
+ * cmc车辆费用Service接口
8
+ * 
9
+ * @author cmc
10
+ * @date 2024-03-12
11
+ */
12
+public interface ICmcCarExpenseService 
13
+{
14
+    /**
15
+     * 查询cmc车辆费用
16
+     * 
17
+     * @param carExpenseId cmc车辆费用主键
18
+     * @return cmc车辆费用
19
+     */
20
+    public CmcCarExpense selectCmcCarExpenseByCarExpenseId(String carExpenseId);
21
+
22
+    /**
23
+     * 查询cmc车辆费用列表
24
+     * 
25
+     * @param cmcCarExpense cmc车辆费用
26
+     * @return cmc车辆费用集合
27
+     */
28
+    public List<CmcCarExpense> selectCmcCarExpenseList(CmcCarExpense cmcCarExpense);
29
+
30
+    /**
31
+     * 新增cmc车辆费用
32
+     * 
33
+     * @param cmcCarExpense cmc车辆费用
34
+     * @return 结果
35
+     */
36
+    public int insertCmcCarExpense(CmcCarExpense cmcCarExpense);
37
+
38
+    /**
39
+     * 修改cmc车辆费用
40
+     * 
41
+     * @param cmcCarExpense cmc车辆费用
42
+     * @return 结果
43
+     */
44
+    public int updateCmcCarExpense(CmcCarExpense cmcCarExpense);
45
+
46
+    /**
47
+     * 批量删除cmc车辆费用
48
+     * 
49
+     * @param carExpenseIds 需要删除的cmc车辆费用主键集合
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcCarExpenseByCarExpenseIds(String[] carExpenseIds);
53
+
54
+    /**
55
+     * 删除cmc车辆费用信息
56
+     * 
57
+     * @param carExpenseId cmc车辆费用主键
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcCarExpenseByCarExpenseId(String carExpenseId);
61
+}

+ 93
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcCarExpenseServiceImpl.java Прегледај датотеку

@@ -0,0 +1,93 @@
1
+package com.ruoyi.oa.service.impl;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.stereotype.Service;
6
+import com.ruoyi.oa.mapper.CmcCarExpenseMapper;
7
+import com.ruoyi.oa.domain.CmcCarExpense;
8
+import com.ruoyi.oa.service.ICmcCarExpenseService;
9
+
10
+/**
11
+ * cmc车辆费用Service业务层处理
12
+ * 
13
+ * @author cmc
14
+ * @date 2024-03-12
15
+ */
16
+@Service
17
+public class CmcCarExpenseServiceImpl implements ICmcCarExpenseService 
18
+{
19
+    @Autowired
20
+    private CmcCarExpenseMapper cmcCarExpenseMapper;
21
+
22
+    /**
23
+     * 查询cmc车辆费用
24
+     * 
25
+     * @param carExpenseId cmc车辆费用主键
26
+     * @return cmc车辆费用
27
+     */
28
+    @Override
29
+    public CmcCarExpense selectCmcCarExpenseByCarExpenseId(String carExpenseId)
30
+    {
31
+        return cmcCarExpenseMapper.selectCmcCarExpenseByCarExpenseId(carExpenseId);
32
+    }
33
+
34
+    /**
35
+     * 查询cmc车辆费用列表
36
+     * 
37
+     * @param cmcCarExpense cmc车辆费用
38
+     * @return cmc车辆费用
39
+     */
40
+    @Override
41
+    public List<CmcCarExpense> selectCmcCarExpenseList(CmcCarExpense cmcCarExpense)
42
+    {
43
+        return cmcCarExpenseMapper.selectCmcCarExpenseList(cmcCarExpense);
44
+    }
45
+
46
+    /**
47
+     * 新增cmc车辆费用
48
+     * 
49
+     * @param cmcCarExpense cmc车辆费用
50
+     * @return 结果
51
+     */
52
+    @Override
53
+    public int insertCmcCarExpense(CmcCarExpense cmcCarExpense)
54
+    {
55
+        return cmcCarExpenseMapper.insertCmcCarExpense(cmcCarExpense);
56
+    }
57
+
58
+    /**
59
+     * 修改cmc车辆费用
60
+     * 
61
+     * @param cmcCarExpense cmc车辆费用
62
+     * @return 结果
63
+     */
64
+    @Override
65
+    public int updateCmcCarExpense(CmcCarExpense cmcCarExpense)
66
+    {
67
+        return cmcCarExpenseMapper.updateCmcCarExpense(cmcCarExpense);
68
+    }
69
+
70
+    /**
71
+     * 批量删除cmc车辆费用
72
+     * 
73
+     * @param carExpenseIds 需要删除的cmc车辆费用主键
74
+     * @return 结果
75
+     */
76
+    @Override
77
+    public int deleteCmcCarExpenseByCarExpenseIds(String[] carExpenseIds)
78
+    {
79
+        return cmcCarExpenseMapper.deleteCmcCarExpenseByCarExpenseIds(carExpenseIds);
80
+    }
81
+
82
+    /**
83
+     * 删除cmc车辆费用信息
84
+     * 
85
+     * @param carExpenseId cmc车辆费用主键
86
+     * @return 结果
87
+     */
88
+    @Override
89
+    public int deleteCmcCarExpenseByCarExpenseId(String carExpenseId)
90
+    {
91
+        return cmcCarExpenseMapper.deleteCmcCarExpenseByCarExpenseId(carExpenseId);
92
+    }
93
+}

+ 73
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcCarExpenseMapper.xml Прегледај датотеку

@@ -0,0 +1,73 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.oa.mapper.CmcCarExpenseMapper">
6
+    
7
+    <resultMap type="CmcCarExpense" id="CmcCarExpenseResult">
8
+        <result property="carExpenseId"    column="car_expense_id"    />
9
+        <result property="carId"    column="car_id"    />
10
+        <result property="expenseType"    column="expense_type"    />
11
+        <result property="expense"    column="expense"    />
12
+        <result property="occurrDate"    column="occurr_date"    />
13
+    </resultMap>
14
+
15
+    <sql id="selectCmcCarExpenseVo">
16
+        select car_expense_id, car_id, expense_type, expense, occurr_date from cmc_car_expense
17
+    </sql>
18
+
19
+    <select id="selectCmcCarExpenseList" parameterType="CmcCarExpense" resultMap="CmcCarExpenseResult">
20
+        <include refid="selectCmcCarExpenseVo"/>
21
+        <where>  
22
+            <if test="carId != null "> and car_id = #{carId}</if>
23
+            <if test="expenseType != null  and expenseType != ''"> and expense_type = #{expenseType}</if>
24
+            <if test="expense != null "> and expense = #{expense}</if>
25
+            <if test="occurrDate != null "> and occurr_date = #{occurrDate}</if>
26
+        </where>
27
+    </select>
28
+    
29
+    <select id="selectCmcCarExpenseByCarExpenseId" parameterType="String" resultMap="CmcCarExpenseResult">
30
+        <include refid="selectCmcCarExpenseVo"/>
31
+        where car_expense_id = #{carExpenseId}
32
+    </select>
33
+        
34
+    <insert id="insertCmcCarExpense" parameterType="CmcCarExpense">
35
+        insert into cmc_car_expense
36
+        <trim prefix="(" suffix=")" suffixOverrides=",">
37
+            <if test="carExpenseId != null">car_expense_id,</if>
38
+            <if test="carId != null">car_id,</if>
39
+            <if test="expenseType != null">expense_type,</if>
40
+            <if test="expense != null">expense,</if>
41
+            <if test="occurrDate != null">occurr_date,</if>
42
+         </trim>
43
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
44
+            <if test="carExpenseId != null">#{carExpenseId},</if>
45
+            <if test="carId != null">#{carId},</if>
46
+            <if test="expenseType != null">#{expenseType},</if>
47
+            <if test="expense != null">#{expense},</if>
48
+            <if test="occurrDate != null">#{occurrDate},</if>
49
+         </trim>
50
+    </insert>
51
+
52
+    <update id="updateCmcCarExpense" parameterType="CmcCarExpense">
53
+        update cmc_car_expense
54
+        <trim prefix="SET" suffixOverrides=",">
55
+            <if test="carId != null">car_id = #{carId},</if>
56
+            <if test="expenseType != null">expense_type = #{expenseType},</if>
57
+            <if test="expense != null">expense = #{expense},</if>
58
+            <if test="occurrDate != null">occurr_date = #{occurrDate},</if>
59
+        </trim>
60
+        where car_expense_id = #{carExpenseId}
61
+    </update>
62
+
63
+    <delete id="deleteCmcCarExpenseByCarExpenseId" parameterType="String">
64
+        delete from cmc_car_expense where car_expense_id = #{carExpenseId}
65
+    </delete>
66
+
67
+    <delete id="deleteCmcCarExpenseByCarExpenseIds" parameterType="String">
68
+        delete from cmc_car_expense where car_expense_id in 
69
+        <foreach item="carExpenseId" collection="array" open="(" separator="," close=")">
70
+            #{carExpenseId}
71
+        </foreach>
72
+    </delete>
73
+</mapper>

+ 1
- 1
oa-back/sql/sql.sql Прегледај датотеку

@@ -1440,7 +1440,7 @@ create table `cmc_car_expense`  (
1440 1440
   `car_id` 			int 			default null 	comment '车辆id',
1441 1441
   `expense_type`	char(1) 		default null 	comment '费用类型(0保险费、1维修费、2保养费、3轮胎费、4其他费)',
1442 1442
   `expense`			decimal(10, 2) 	default null 	comment '费用金额',
1443
-  `occurre_date`	datetime		default null 	comment '发生日期',
1443
+  `occurr_date`		datetime		default null 	comment '发生日期',
1444 1444
   primary key (`car_expense_id`)
1445 1445
 ) engine = innodb comment = 'cmc车辆费用表';
1446 1446
 

+ 50
- 0
oa-ui/src/api/oa/car/carExpense.js Прегледај датотеку

@@ -0,0 +1,50 @@
1
+/*
2
+ * @Author: wrh
3
+ * @Date: 2024-03-12 15:30:58
4
+ * @LastEditors: Please set LastEditors
5
+ * @LastEditTime: 2024-03-12 15:38:27
6
+ */
7
+import request from '@/utils/request'
8
+
9
+// 查询cmc车辆费用列表
10
+export function listCarExpense(query) {
11
+  return request({
12
+    url: '/oa/carExpense/list',
13
+    method: 'get',
14
+    params: query
15
+  })
16
+}
17
+
18
+// 查询cmc车辆费用详细
19
+export function getCarExpense(carExpenseId) {
20
+  return request({
21
+    url: '/oa/carExpense/' + carExpenseId,
22
+    method: 'get'
23
+  })
24
+}
25
+
26
+// 新增cmc车辆费用
27
+export function addCarExpense(data) {
28
+  return request({
29
+    url: '/oa/carExpense',
30
+    method: 'post',
31
+    data: data
32
+  })
33
+}
34
+
35
+// 修改cmc车辆费用
36
+export function updateCarExpense(data) {
37
+  return request({
38
+    url: '/oa/carExpense',
39
+    method: 'put',
40
+    data: data
41
+  })
42
+}
43
+
44
+// 删除cmc车辆费用
45
+export function delCarExpense(carExpenseId) {
46
+  return request({
47
+    url: '/oa/carExpense/' + carExpenseId,
48
+    method: 'delete'
49
+  })
50
+}

+ 285
- 0
oa-ui/src/views/oa/carExpense/index.vue Прегледај датотеку

@@ -0,0 +1,285 @@
1
+<template>
2
+  <div class="app-container">
3
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
4
+      <el-form-item label="车辆id" prop="carId">
5
+        <el-input
6
+          v-model="queryParams.carId"
7
+          placeholder="请输入车辆id"
8
+          clearable
9
+          @keyup.enter.native="handleQuery"
10
+        />
11
+      </el-form-item>
12
+      <el-form-item label="费用金额" prop="expense">
13
+        <el-input
14
+          v-model="queryParams.expense"
15
+          placeholder="请输入费用金额"
16
+          clearable
17
+          @keyup.enter.native="handleQuery"
18
+        />
19
+      </el-form-item>
20
+      <el-form-item label="发生日期" prop="occurrDate">
21
+        <el-date-picker clearable
22
+          v-model="queryParams.occurrDate"
23
+          type="date"
24
+          value-format="yyyy-MM-dd"
25
+          placeholder="请选择发生日期">
26
+        </el-date-picker>
27
+      </el-form-item>
28
+      <el-form-item>
29
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
30
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
31
+      </el-form-item>
32
+    </el-form>
33
+
34
+    <el-row :gutter="10" class="mb8">
35
+      <el-col :span="1.5">
36
+        <el-button
37
+          type="primary"
38
+          plain
39
+          icon="el-icon-plus"
40
+          size="mini"
41
+          @click="handleAdd"
42
+          v-hasPermi="['oa:carExpense:add']"
43
+        >新增</el-button>
44
+      </el-col>
45
+      <el-col :span="1.5">
46
+        <el-button
47
+          type="success"
48
+          plain
49
+          icon="el-icon-edit"
50
+          size="mini"
51
+          :disabled="single"
52
+          @click="handleUpdate"
53
+          v-hasPermi="['oa:carExpense:edit']"
54
+        >修改</el-button>
55
+      </el-col>
56
+      <el-col :span="1.5">
57
+        <el-button
58
+          type="danger"
59
+          plain
60
+          icon="el-icon-delete"
61
+          size="mini"
62
+          :disabled="multiple"
63
+          @click="handleDelete"
64
+          v-hasPermi="['oa:carExpense:remove']"
65
+        >删除</el-button>
66
+      </el-col>
67
+      <el-col :span="1.5">
68
+        <el-button
69
+          type="warning"
70
+          plain
71
+          icon="el-icon-download"
72
+          size="mini"
73
+          @click="handleExport"
74
+          v-hasPermi="['oa:carExpense:export']"
75
+        >导出</el-button>
76
+      </el-col>
77
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
78
+    </el-row>
79
+
80
+    <el-table v-loading="loading" :data="carExpenseList" @selection-change="handleSelectionChange">
81
+      <el-table-column type="selection" width="55" align="center" />
82
+      <el-table-column label="车辆费用id" align="center" prop="carExpenseId" />
83
+      <el-table-column label="车辆id" align="center" prop="carId" />
84
+      <el-table-column label="费用类型" align="center" prop="expenseType" />
85
+      <el-table-column label="费用金额" align="center" prop="expense" />
86
+      <el-table-column label="发生日期" align="center" prop="occurrDate" width="180">
87
+        <template slot-scope="scope">
88
+          <span>{{ parseTime(scope.row.occurrDate, '{y}-{m}-{d}') }}</span>
89
+        </template>
90
+      </el-table-column>
91
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
92
+        <template slot-scope="scope">
93
+          <el-button
94
+            size="mini"
95
+            type="text"
96
+            icon="el-icon-edit"
97
+            @click="handleUpdate(scope.row)"
98
+            v-hasPermi="['oa:carExpense:edit']"
99
+          >修改</el-button>
100
+          <el-button
101
+            size="mini"
102
+            type="text"
103
+            icon="el-icon-delete"
104
+            @click="handleDelete(scope.row)"
105
+            v-hasPermi="['oa:carExpense:remove']"
106
+          >删除</el-button>
107
+        </template>
108
+      </el-table-column>
109
+    </el-table>
110
+    
111
+    <pagination
112
+      v-show="total>0"
113
+      :total="total"
114
+      :page.sync="queryParams.pageNum"
115
+      :limit.sync="queryParams.pageSize"
116
+      @pagination="getList"
117
+    />
118
+
119
+    <!-- 添加或修改cmc车辆费用对话框 -->
120
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
121
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
122
+        <el-form-item label="车辆id" prop="carId">
123
+          <el-input v-model="form.carId" placeholder="请输入车辆id" />
124
+        </el-form-item>
125
+        <el-form-item label="费用金额" prop="expense">
126
+          <el-input v-model="form.expense" placeholder="请输入费用金额" />
127
+        </el-form-item>
128
+        <el-form-item label="发生日期" prop="occurrDate">
129
+          <el-date-picker clearable
130
+            v-model="form.occurrDate"
131
+            type="date"
132
+            value-format="yyyy-MM-dd"
133
+            placeholder="请选择发生日期">
134
+          </el-date-picker>
135
+        </el-form-item>
136
+      </el-form>
137
+      <div slot="footer" class="dialog-footer">
138
+        <el-button type="primary" @click="submitForm">确 定</el-button>
139
+        <el-button @click="cancel">取 消</el-button>
140
+      </div>
141
+    </el-dialog>
142
+  </div>
143
+</template>
144
+
145
+<script>
146
+import { listCarExpense, getCarExpense, delCarExpense, addCarExpense, updateCarExpense } from "@/api/oa/car/carExpense";
147
+
148
+export default {
149
+  name: "CarExpense",
150
+  data() {
151
+    return {
152
+      // 遮罩层
153
+      loading: true,
154
+      // 选中数组
155
+      ids: [],
156
+      // 非单个禁用
157
+      single: true,
158
+      // 非多个禁用
159
+      multiple: true,
160
+      // 显示搜索条件
161
+      showSearch: true,
162
+      // 总条数
163
+      total: 0,
164
+      // cmc车辆费用表格数据
165
+      carExpenseList: [],
166
+      // 弹出层标题
167
+      title: "",
168
+      // 是否显示弹出层
169
+      open: false,
170
+      // 查询参数
171
+      queryParams: {
172
+        pageNum: 1,
173
+        pageSize: 10,
174
+        carId: null,
175
+        expenseType: null,
176
+        expense: null,
177
+        occurrDate: null
178
+      },
179
+      // 表单参数
180
+      form: {},
181
+      // 表单校验
182
+      rules: {
183
+      }
184
+    };
185
+  },
186
+  created() {
187
+    this.getList();
188
+  },
189
+  methods: {
190
+    /** 查询cmc车辆费用列表 */
191
+    getList() {
192
+      this.loading = true;
193
+      listCarExpense(this.queryParams).then(response => {
194
+        this.carExpenseList = response.rows;
195
+        this.total = response.total;
196
+        this.loading = false;
197
+      });
198
+    },
199
+    // 取消按钮
200
+    cancel() {
201
+      this.open = false;
202
+      this.reset();
203
+    },
204
+    // 表单重置
205
+    reset() {
206
+      this.form = {
207
+        carExpenseId: null,
208
+        carId: null,
209
+        expenseType: null,
210
+        expense: null,
211
+        occurrDate: null
212
+      };
213
+      this.resetForm("form");
214
+    },
215
+    /** 搜索按钮操作 */
216
+    handleQuery() {
217
+      this.queryParams.pageNum = 1;
218
+      this.getList();
219
+    },
220
+    /** 重置按钮操作 */
221
+    resetQuery() {
222
+      this.resetForm("queryForm");
223
+      this.handleQuery();
224
+    },
225
+    // 多选框选中数据
226
+    handleSelectionChange(selection) {
227
+      this.ids = selection.map(item => item.carExpenseId)
228
+      this.single = selection.length!==1
229
+      this.multiple = !selection.length
230
+    },
231
+    /** 新增按钮操作 */
232
+    handleAdd() {
233
+      this.reset();
234
+      this.open = true;
235
+      this.title = "添加cmc车辆费用";
236
+    },
237
+    /** 修改按钮操作 */
238
+    handleUpdate(row) {
239
+      this.reset();
240
+      const carExpenseId = row.carExpenseId || this.ids
241
+      getCarExpense(carExpenseId).then(response => {
242
+        this.form = response.data;
243
+        this.open = true;
244
+        this.title = "修改cmc车辆费用";
245
+      });
246
+    },
247
+    /** 提交按钮 */
248
+    submitForm() {
249
+      this.$refs["form"].validate(valid => {
250
+        if (valid) {
251
+          if (this.form.carExpenseId != null) {
252
+            updateCarExpense(this.form).then(response => {
253
+              this.$modal.msgSuccess("修改成功");
254
+              this.open = false;
255
+              this.getList();
256
+            });
257
+          } else {
258
+            addCarExpense(this.form).then(response => {
259
+              this.$modal.msgSuccess("新增成功");
260
+              this.open = false;
261
+              this.getList();
262
+            });
263
+          }
264
+        }
265
+      });
266
+    },
267
+    /** 删除按钮操作 */
268
+    handleDelete(row) {
269
+      const carExpenseIds = row.carExpenseId || this.ids;
270
+      this.$modal.confirm('是否确认删除cmc车辆费用编号为"' + carExpenseIds + '"的数据项?').then(function() {
271
+        return delCarExpense(carExpenseIds);
272
+      }).then(() => {
273
+        this.getList();
274
+        this.$modal.msgSuccess("删除成功");
275
+      }).catch(() => {});
276
+    },
277
+    /** 导出按钮操作 */
278
+    handleExport() {
279
+      this.download('oa/carExpense/export', {
280
+        ...this.queryParams
281
+      }, `carExpense_${new Date().getTime()}.xlsx`)
282
+    }
283
+  }
284
+};
285
+</script>

Loading…
Откажи
Сачувај