From 4d458ebf237e56228a709754c020e47fe252dca1 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期三, 20 十一月 2024 09:57:44 +0800 Subject: [PATCH] - --- billion-main/src/main/java/com/billion/main/da/service/IDaParamCollectionService.java | 63 ++++ billion-ui/src/api/main/da/paramCollection.js | 44 +++ billion-main/src/main/java/com/billion/main/da/controller/DaParamCollectionController.java | 104 +++++++ billion-ui/src/views/main/da/paramCollection/index.vue | 310 ++++++++++++++++++++++ billion-main/src/main/java/com/billion/main/da/domain/DaParamCollection.java | 51 +++ billion-main/src/main/java/com/billion/main/da/service/impl/DaParamCollectionServiceImpl.java | 95 ++++++ billion-main/src/main/java/com/billion/main/da/mapper/DaParamCollectionMapper.java | 63 ++++ billion-main/src/main/resources/mapper/da/DaParamCollectionMapper.xml | 79 +++++ 8 files changed, 809 insertions(+), 0 deletions(-) diff --git a/billion-main/src/main/java/com/billion/main/da/controller/DaParamCollectionController.java b/billion-main/src/main/java/com/billion/main/da/controller/DaParamCollectionController.java new file mode 100644 index 0000000..bd155b6 --- /dev/null +++ b/billion-main/src/main/java/com/billion/main/da/controller/DaParamCollectionController.java @@ -0,0 +1,104 @@ +package com.billion.main.da.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.billion.common.annotation.Log; +import com.billion.common.core.controller.BaseController; +import com.billion.common.core.domain.AjaxResult; +import com.billion.common.enums.BusinessType; +import com.billion.main.da.domain.DaParamCollection; +import com.billion.main.da.service.IDaParamCollectionService; +import com.billion.common.utils.poi.ExcelUtil; +import com.billion.common.core.page.TableDataInfo; + +/** + * 鍙傛暟閲囬泦Controller + * + * @author Billion-Yi + * @date 2024-11-20 + */ +@RestController +@RequestMapping("/da/paramCollection") +public class DaParamCollectionController extends BaseController +{ + @Autowired + private IDaParamCollectionService daParamCollectionService; + + /** + * 鏌ヨ鍙傛暟閲囬泦鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('da:paramCollection:list')") + @GetMapping("/list") + public TableDataInfo list(DaParamCollection daParamCollection) + { + startPage(); + List<DaParamCollection> list = daParamCollectionService.selectDaParamCollectionList(daParamCollection); + return getDataTable(list); + } + + /** + * 瀵煎嚭鍙傛暟閲囬泦鍒楄〃 + */ + @PreAuthorize("@ss.hasPermi('da:paramCollection:export')") + @Log(title = "鍙傛暟閲囬泦", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DaParamCollection daParamCollection) + { + List<DaParamCollection> list = daParamCollectionService.selectDaParamCollectionList(daParamCollection); + ExcelUtil<DaParamCollection> util = new ExcelUtil<DaParamCollection>(DaParamCollection.class); + util.exportExcel(response, list, "鍙傛暟閲囬泦鏁版嵁"); + } + + /** + * 鑾峰彇鍙傛暟閲囬泦璇︾粏淇℃伅 + */ + @PreAuthorize("@ss.hasPermi('da:paramCollection:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(daParamCollectionService.selectDaParamCollectionById(id)); + } + + /** + * 鏂板鍙傛暟閲囬泦 + */ + @PreAuthorize("@ss.hasPermi('da:paramCollection:add')") + @Log(title = "鍙傛暟閲囬泦", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DaParamCollection daParamCollection) + { + return toAjax(daParamCollectionService.insertDaParamCollection(daParamCollection)); + } + + /** + * 淇敼鍙傛暟閲囬泦 + */ + @PreAuthorize("@ss.hasPermi('da:paramCollection:edit')") + @Log(title = "鍙傛暟閲囬泦", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DaParamCollection daParamCollection) + { + return toAjax(daParamCollectionService.updateDaParamCollection(daParamCollection)); + } + + /** + * 鍒犻櫎鍙傛暟閲囬泦 + */ + @PreAuthorize("@ss.hasPermi('da:paramCollection:remove')") + @Log(title = "鍙傛暟閲囬泦", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(daParamCollectionService.deleteDaParamCollectionByIds(ids)); + } +} diff --git a/billion-main/src/main/java/com/billion/main/da/domain/DaParamCollection.java b/billion-main/src/main/java/com/billion/main/da/domain/DaParamCollection.java new file mode 100644 index 0000000..d8cad35 --- /dev/null +++ b/billion-main/src/main/java/com/billion/main/da/domain/DaParamCollection.java @@ -0,0 +1,51 @@ +package com.billion.main.da.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.billion.common.annotation.Excel; +import com.billion.main.common.BaseEntity; + +/** + * 鍙傛暟閲囬泦瀵硅薄 da_param_collection + * + * @author Billion-Yi + * @date 2024-11-20 + */ +@Data +public class DaParamCollection extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 涓婚敭id */ + private Long id; + + /** 鎬绘垚搴忓垪鍙� */ + @Excel(name = "鎬绘垚搴忓垪鍙�") + private String sfcCode; + + /** 宸ヤ綅缂栫爜 */ + @Excel(name = "宸ヤ綅缂栫爜") + private String locationCode; + + /** 鍙傛暟缂栫爜 */ + @Excel(name = "鍙傛暟缂栫爜") + private String paramCode; + + /** 鍙傛暟鍚嶇О */ + @Excel(name = "鍙傛暟鍚嶇О") + private String paramName; + + /** 鍙傛暟鍊� */ + @Excel(name = "鍙傛暟鍊�") + private String paramValue; + + /** 閲囬泦鏃堕棿 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "閲囬泦鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd") + private Date collectTime; + + +} diff --git a/billion-main/src/main/java/com/billion/main/da/mapper/DaParamCollectionMapper.java b/billion-main/src/main/java/com/billion/main/da/mapper/DaParamCollectionMapper.java new file mode 100644 index 0000000..b7a1023 --- /dev/null +++ b/billion-main/src/main/java/com/billion/main/da/mapper/DaParamCollectionMapper.java @@ -0,0 +1,63 @@ +package com.billion.main.da.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.billion.main.da.domain.DaParamCollection; + +/** + * 鍙傛暟閲囬泦Mapper鎺ュ彛 + * + * @author Billion-Yi + * @date 2024-11-20 + */ +public interface DaParamCollectionMapper extends BaseMapper<DaParamCollection> +{ + /** + * 鏌ヨ鍙傛暟閲囬泦 + * + * @param id 鍙傛暟閲囬泦涓婚敭 + * @return 鍙傛暟閲囬泦 + */ + public DaParamCollection selectDaParamCollectionById(Long id); + + /** + * 鏌ヨ鍙傛暟閲囬泦鍒楄〃 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 鍙傛暟閲囬泦闆嗗悎 + */ + public List<DaParamCollection> selectDaParamCollectionList(DaParamCollection daParamCollection); + + /** + * 鏂板鍙傛暟閲囬泦 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 缁撴灉 + */ + public int insertDaParamCollection(DaParamCollection daParamCollection); + + /** + * 淇敼鍙傛暟閲囬泦 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 缁撴灉 + */ + public int updateDaParamCollection(DaParamCollection daParamCollection); + + /** + * 鍒犻櫎鍙傛暟閲囬泦 + * + * @param id 鍙傛暟閲囬泦涓婚敭 + * @return 缁撴灉 + */ + public int deleteDaParamCollectionById(Long id); + + /** + * 鎵归噺鍒犻櫎鍙傛暟閲囬泦 + * + * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteDaParamCollectionByIds(Long[] ids); +} diff --git a/billion-main/src/main/java/com/billion/main/da/service/IDaParamCollectionService.java b/billion-main/src/main/java/com/billion/main/da/service/IDaParamCollectionService.java new file mode 100644 index 0000000..d7970d1 --- /dev/null +++ b/billion-main/src/main/java/com/billion/main/da/service/IDaParamCollectionService.java @@ -0,0 +1,63 @@ +package com.billion.main.da.service; + +import java.util.List; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.billion.main.da.domain.DaParamCollection; + +/** + * 鍙傛暟閲囬泦Service鎺ュ彛 + * + * @author Billion-Yi + * @date 2024-11-20 + */ +public interface IDaParamCollectionService extends IService<DaParamCollection> +{ + /** + * 鏌ヨ鍙傛暟閲囬泦 + * + * @param id 鍙傛暟閲囬泦涓婚敭 + * @return 鍙傛暟閲囬泦 + */ + public DaParamCollection selectDaParamCollectionById(Long id); + + /** + * 鏌ヨ鍙傛暟閲囬泦鍒楄〃 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 鍙傛暟閲囬泦闆嗗悎 + */ + public List<DaParamCollection> selectDaParamCollectionList(DaParamCollection daParamCollection); + + /** + * 鏂板鍙傛暟閲囬泦 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 缁撴灉 + */ + public int insertDaParamCollection(DaParamCollection daParamCollection); + + /** + * 淇敼鍙傛暟閲囬泦 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 缁撴灉 + */ + public int updateDaParamCollection(DaParamCollection daParamCollection); + + /** + * 鎵归噺鍒犻櫎鍙傛暟閲囬泦 + * + * @param ids 闇�瑕佸垹闄ょ殑鍙傛暟閲囬泦涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteDaParamCollectionByIds(Long[] ids); + + /** + * 鍒犻櫎鍙傛暟閲囬泦淇℃伅 + * + * @param id 鍙傛暟閲囬泦涓婚敭 + * @return 缁撴灉 + */ + public int deleteDaParamCollectionById(Long id); +} diff --git a/billion-main/src/main/java/com/billion/main/da/service/impl/DaParamCollectionServiceImpl.java b/billion-main/src/main/java/com/billion/main/da/service/impl/DaParamCollectionServiceImpl.java new file mode 100644 index 0000000..14341b1 --- /dev/null +++ b/billion-main/src/main/java/com/billion/main/da/service/impl/DaParamCollectionServiceImpl.java @@ -0,0 +1,95 @@ +package com.billion.main.da.service.impl; + +import java.util.List; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.billion.main.da.mapper.DaParamCollectionMapper; +import com.billion.main.da.domain.DaParamCollection; +import com.billion.main.da.service.IDaParamCollectionService; + +/** + * 鍙傛暟閲囬泦Service涓氬姟灞傚鐞� + * + * @author Billion-Yi + * @date 2024-11-20 + */ +@Service +public class DaParamCollectionServiceImpl extends ServiceImpl<DaParamCollectionMapper, DaParamCollection> implements IDaParamCollectionService +{ + @Autowired + private DaParamCollectionMapper daParamCollectionMapper; + + /** + * 鏌ヨ鍙傛暟閲囬泦 + * + * @param id 鍙傛暟閲囬泦涓婚敭 + * @return 鍙傛暟閲囬泦 + */ + @Override + public DaParamCollection selectDaParamCollectionById(Long id) + { + return daParamCollectionMapper.selectDaParamCollectionById(id); + } + + /** + * 鏌ヨ鍙傛暟閲囬泦鍒楄〃 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 鍙傛暟閲囬泦 + */ + @Override + public List<DaParamCollection> selectDaParamCollectionList(DaParamCollection daParamCollection) + { + return daParamCollectionMapper.selectDaParamCollectionList(daParamCollection); + } + + /** + * 鏂板鍙傛暟閲囬泦 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 缁撴灉 + */ + @Override + public int insertDaParamCollection(DaParamCollection daParamCollection) + { + return daParamCollectionMapper.insertDaParamCollection(daParamCollection); + } + + /** + * 淇敼鍙傛暟閲囬泦 + * + * @param daParamCollection 鍙傛暟閲囬泦 + * @return 缁撴灉 + */ + @Override + public int updateDaParamCollection(DaParamCollection daParamCollection) + { + return daParamCollectionMapper.updateDaParamCollection(daParamCollection); + } + + /** + * 鎵归噺鍒犻櫎鍙傛暟閲囬泦 + * + * @param ids 闇�瑕佸垹闄ょ殑鍙傛暟閲囬泦涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteDaParamCollectionByIds(Long[] ids) + { + return daParamCollectionMapper.deleteDaParamCollectionByIds(ids); + } + + /** + * 鍒犻櫎鍙傛暟閲囬泦淇℃伅 + * + * @param id 鍙傛暟閲囬泦涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteDaParamCollectionById(Long id) + { + return daParamCollectionMapper.deleteDaParamCollectionById(id); + } +} diff --git a/billion-main/src/main/resources/mapper/da/DaParamCollectionMapper.xml b/billion-main/src/main/resources/mapper/da/DaParamCollectionMapper.xml new file mode 100644 index 0000000..7a2d95b --- /dev/null +++ b/billion-main/src/main/resources/mapper/da/DaParamCollectionMapper.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.billion.main.da.mapper.DaParamCollectionMapper"> + + <resultMap type="DaParamCollection" id="DaParamCollectionResult"> + <result property="id" column="id" /> + <result property="sfcCode" column="sfc_code" /> + <result property="locationCode" column="location_code" /> + <result property="paramCode" column="param_code" /> + <result property="paramName" column="param_name" /> + <result property="paramValue" column="param_value" /> + <result property="collectTime" column="collect_time" /> + </resultMap> + + <sql id="selectDaParamCollectionVo"> + select id, sfc_code, location_code, param_code, param_name, param_value, collect_time from da_param_collection + </sql> + + <select id="selectDaParamCollectionList" parameterType="DaParamCollection" resultMap="DaParamCollectionResult"> + <include refid="selectDaParamCollectionVo"/> + <where> + <if test="sfcCode != null and sfcCode != ''"> and sfc_code = #{sfcCode}</if> + <if test="locationCode != null and locationCode != ''"> and location_code like concat('%', #{locationCode}, '%')</if> + <if test="paramCode != null and paramCode != ''"> and param_code = #{paramCode}</if> + <if test="paramName != null and paramName != ''"> and param_name like concat('%', #{paramName}, '%')</if> + </where> + </select> + + <select id="selectDaParamCollectionById" parameterType="Long" resultMap="DaParamCollectionResult"> + <include refid="selectDaParamCollectionVo"/> + where id = #{id} + </select> + + <insert id="insertDaParamCollection" parameterType="DaParamCollection" useGeneratedKeys="true" keyProperty="id"> + insert into da_param_collection + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="sfcCode != null and sfcCode != ''">sfc_code,</if> + <if test="locationCode != null and locationCode != ''">location_code,</if> + <if test="paramCode != null and paramCode != ''">param_code,</if> + <if test="paramName != null">param_name,</if> + <if test="paramValue != null and paramValue != ''">param_value,</if> + <if test="collectTime != null">collect_time,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="sfcCode != null and sfcCode != ''">#{sfcCode},</if> + <if test="locationCode != null and locationCode != ''">#{locationCode},</if> + <if test="paramCode != null and paramCode != ''">#{paramCode},</if> + <if test="paramName != null">#{paramName},</if> + <if test="paramValue != null and paramValue != ''">#{paramValue},</if> + <if test="collectTime != null">#{collectTime},</if> + </trim> + </insert> + + <update id="updateDaParamCollection" parameterType="DaParamCollection"> + update da_param_collection + <trim prefix="SET" suffixOverrides=","> + <if test="sfcCode != null and sfcCode != ''">sfc_code = #{sfcCode},</if> + <if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if> + <if test="paramCode != null and paramCode != ''">param_code = #{paramCode},</if> + <if test="paramName != null">param_name = #{paramName},</if> + <if test="paramValue != null and paramValue != ''">param_value = #{paramValue},</if> + <if test="collectTime != null">collect_time = #{collectTime},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteDaParamCollectionById" parameterType="Long"> + delete from da_param_collection where id = #{id} + </delete> + + <delete id="deleteDaParamCollectionByIds" parameterType="String"> + delete from da_param_collection where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> +</mapper> \ No newline at end of file diff --git a/billion-ui/src/api/main/da/paramCollection.js b/billion-ui/src/api/main/da/paramCollection.js new file mode 100644 index 0000000..4fb3170 --- /dev/null +++ b/billion-ui/src/api/main/da/paramCollection.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 鏌ヨ鍙傛暟閲囬泦鍒楄〃 +export function listParamCollection(query) { + return request({ + url: '/da/paramCollection/list', + method: 'get', + params: query + }) +} + +// 鏌ヨ鍙傛暟閲囬泦璇︾粏 +export function getParamCollection(id) { + return request({ + url: '/da/paramCollection/' + id, + method: 'get' + }) +} + +// 鏂板鍙傛暟閲囬泦 +export function addParamCollection(data) { + return request({ + url: '/da/paramCollection', + method: 'post', + data: data + }) +} + +// 淇敼鍙傛暟閲囬泦 +export function updateParamCollection(data) { + return request({ + url: '/da/paramCollection', + method: 'put', + data: data + }) +} + +// 鍒犻櫎鍙傛暟閲囬泦 +export function delParamCollection(id) { + return request({ + url: '/da/paramCollection/' + id, + method: 'delete' + }) +} diff --git a/billion-ui/src/views/main/da/paramCollection/index.vue b/billion-ui/src/views/main/da/paramCollection/index.vue new file mode 100644 index 0000000..6c7c33b --- /dev/null +++ b/billion-ui/src/views/main/da/paramCollection/index.vue @@ -0,0 +1,310 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="鎬绘垚搴忓垪鍙�" prop="sfcCode"> + <el-input + v-model="queryParams.sfcCode" + placeholder="璇疯緭鍏ユ�绘垚搴忓垪鍙�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="宸ヤ綅缂栫爜" prop="locationCode"> + <el-input + v-model="queryParams.locationCode" + placeholder="璇疯緭鍏ュ伐浣嶇紪鐮�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍙傛暟缂栫爜" prop="paramCode"> + <el-input + v-model="queryParams.paramCode" + placeholder="璇疯緭鍏ュ弬鏁扮紪鐮�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍙傛暟鍚嶇О" prop="paramName"> + <el-input + v-model="queryParams.paramName" + placeholder="璇疯緭鍏ュ弬鏁板悕绉�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['da:paramCollection:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['da:paramCollection:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['da:paramCollection:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['da:paramCollection:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" :data="paramCollectionList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="涓婚敭id" align="center" prop="id" /> + <el-table-column label="鎬绘垚搴忓垪鍙�" align="center" prop="sfcCode" /> + <el-table-column label="宸ヤ綅缂栫爜" align="center" prop="locationCode" /> + <el-table-column label="鍙傛暟缂栫爜" align="center" prop="paramCode" /> + <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="paramName" /> + <el-table-column label="鍙傛暟鍊�" align="center" prop="paramValue" /> + <el-table-column label="閲囬泦鏃堕棿" align="center" prop="collectTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.collectTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['da:paramCollection:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['da:paramCollection:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀瑰弬鏁伴噰闆嗗璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="鎬绘垚搴忓垪鍙�" prop="sfcCode"> + <el-input v-model="form.sfcCode" placeholder="璇疯緭鍏ユ�绘垚搴忓垪鍙�" /> + </el-form-item> + <el-form-item label="宸ヤ綅缂栫爜" prop="locationCode"> + <el-input v-model="form.locationCode" placeholder="璇疯緭鍏ュ伐浣嶇紪鐮�" /> + </el-form-item> + <el-form-item label="鍙傛暟缂栫爜" prop="paramCode"> + <el-input v-model="form.paramCode" placeholder="璇疯緭鍏ュ弬鏁扮紪鐮�" /> + </el-form-item> + <el-form-item label="鍙傛暟鍚嶇О" prop="paramName"> + <el-input v-model="form.paramName" placeholder="璇疯緭鍏ュ弬鏁板悕绉�" /> + </el-form-item> + <el-form-item label="鍙傛暟鍊�" prop="paramValue"> + <el-input v-model="form.paramValue" placeholder="璇疯緭鍏ュ弬鏁板��" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection"; + +export default { + name: "ParamCollection", + data() { + return { + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 鍙傛暟閲囬泦琛ㄦ牸鏁版嵁 + paramCollectionList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + sfcCode: null, + locationCode: null, + paramCode: null, + paramName: null, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + sfcCode: [ + { required: true, message: "鎬绘垚搴忓垪鍙蜂笉鑳戒负绌�", trigger: "blur" } + ], + locationCode: [ + { required: true, message: "宸ヤ綅缂栫爜涓嶈兘涓虹┖", trigger: "blur" } + ], + paramCode: [ + { required: true, message: "鍙傛暟缂栫爜涓嶈兘涓虹┖", trigger: "blur" } + ], + paramValue: [ + { required: true, message: "鍙傛暟鍊间笉鑳戒负绌�", trigger: "blur" } + ], + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ鍙傛暟閲囬泦鍒楄〃 */ + getList() { + this.loading = true; + listParamCollection(this.queryParams).then(response => { + this.paramCollectionList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + sfcCode: null, + locationCode: null, + paramCode: null, + paramName: null, + paramValue: null, + collectTime: null + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id) + this.single = selection.length!==1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞鍙傛暟閲囬泦"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids + getParamCollection(id).then(response => { + this.form = response.data; + this.open = true; + this.title = "淇敼鍙傛暟閲囬泦"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != null) { + updateParamCollection(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addParamCollection(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const ids = row.id || this.ids; + this.$modal.confirm('鏄惁纭鍒犻櫎鍙傛暟閲囬泦缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() { + return delParamCollection(ids); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('da/paramCollection/export', { + ...this.queryParams + }, `paramCollection_${new Date().getTime()}.xlsx`) + } + } +}; +</script> -- Gitblit v1.9.3