Merge remote-tracking branch 'origin/main'

main
wanglei 2 years ago
commit e6e7fcdda3

@ -0,0 +1,61 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/szxc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: ceshi
password: ruanfa
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

@ -0,0 +1,104 @@
package com.ruoyi.szxc.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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.szxc.domain.SzxcZcss;
import com.ruoyi.szxc.service.ISzxcZcssService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author hs
* @date 2024-04-02
*/
@RestController
@RequestMapping("/szxc/zcss")
public class SzxcZcssController extends BaseController
{
@Autowired
private ISzxcZcssService szxcZcssService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:zcss:list')")
@GetMapping("/list")
public TableDataInfo list(SzxcZcss szxcZcss)
{
startPage();
List<SzxcZcss> list = szxcZcssService.selectSzxcZcssList(szxcZcss);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:zcss:export')")
@Log(title = "资产设施", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SzxcZcss szxcZcss)
{
List<SzxcZcss> list = szxcZcssService.selectSzxcZcssList(szxcZcss);
ExcelUtil<SzxcZcss> util = new ExcelUtil<SzxcZcss>(SzxcZcss.class);
util.exportExcel(response, list, "资产设施数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:zcss:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(szxcZcssService.selectSzxcZcssById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:zcss:add')")
@Log(title = "资产设施", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SzxcZcss szxcZcss)
{
return toAjax(szxcZcssService.insertSzxcZcss(szxcZcss));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:zcss:edit')")
@Log(title = "资产设施", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SzxcZcss szxcZcss)
{
return toAjax(szxcZcssService.updateSzxcZcss(szxcZcss));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:zcss:remove')")
@Log(title = "资产设施", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(szxcZcssService.deleteSzxcZcssByIds(ids));
}
}

@ -0,0 +1,200 @@
package com.ruoyi.szxc.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* szxc_zcss
*
* @author hs
* @date 2024-04-02
*/
public class SzxcZcss extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 资产名称 */
@Excel(name = "资产名称")
private String zcName;
/** 资产类型(字典) */
@Excel(name = "资产类型(字典)")
private String zcType;
/** 安装时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "安装时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date installDate;
/** 负责人 */
@Excel(name = "负责人")
private String fzr;
/** 联系电话 */
@Excel(name = "联系电话")
private String phone;
/** 详细地址 */
@Excel(name = "详细地址")
private String address;
/** 资产照片 */
@Excel(name = "资产照片")
private String picture;
/** 是否巡检 */
@Excel(name = "是否巡检")
private String xj;
/** 部门id */
@Excel(name = "部门id")
private Long deptId;
/** 所属网格 */
@Excel(name = "所属网格")
private String deptName;
/** 创建者ID */
@Excel(name = "创建者ID")
private Long userId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setZcName(String zcName)
{
this.zcName = zcName;
}
public String getZcName()
{
return zcName;
}
public void setZcType(String zcType)
{
this.zcType = zcType;
}
public String getZcType()
{
return zcType;
}
public void setInstallDate(Date installDate)
{
this.installDate = installDate;
}
public Date getInstallDate()
{
return installDate;
}
public void setFzr(String fzr)
{
this.fzr = fzr;
}
public String getFzr()
{
return fzr;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setPicture(String picture)
{
this.picture = picture;
}
public String getPicture()
{
return picture;
}
public void setXj(String xj)
{
this.xj = xj;
}
public String getXj()
{
return xj;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptName(String deptName)
{
this.deptName = deptName;
}
public String getDeptName()
{
return deptName;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("zcName", getZcName())
.append("zcType", getZcType())
.append("installDate", getInstallDate())
.append("fzr", getFzr())
.append("phone", getPhone())
.append("address", getAddress())
.append("picture", getPicture())
.append("xj", getXj())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("deptId", getDeptId())
.append("deptName", getDeptName())
.append("userId", getUserId())
.toString();
}
}

@ -0,0 +1,62 @@
package com.ruoyi.szxc.mapper;
import com.ruoyi.szxc.domain.SzxcZcss;
import java.util.List;
/**
* Mapper
*
* @author hs
* @date 2024-04-02
*/
public interface SzxcZcssMapper
{
/**
*
*
* @param id
* @return
*/
public SzxcZcss selectSzxcZcssById(Long id);
/**
*
*
* @param szxcZcss
* @return
*/
public List<SzxcZcss> selectSzxcZcssList(SzxcZcss szxcZcss);
/**
*
*
* @param szxcZcss
* @return
*/
public int insertSzxcZcss(SzxcZcss szxcZcss);
/**
*
*
* @param szxcZcss
* @return
*/
public int updateSzxcZcss(SzxcZcss szxcZcss);
/**
*
*
* @param id
* @return
*/
public int deleteSzxcZcssById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteSzxcZcssByIds(Long[] ids);
}

@ -0,0 +1,62 @@
package com.ruoyi.szxc.service;
import com.ruoyi.szxc.domain.SzxcZcss;
import java.util.List;
/**
* Service
*
* @author hs
* @date 2024-04-02
*/
public interface ISzxcZcssService
{
/**
*
*
* @param id
* @return
*/
public SzxcZcss selectSzxcZcssById(Long id);
/**
*
*
* @param szxcZcss
* @return
*/
public List<SzxcZcss> selectSzxcZcssList(SzxcZcss szxcZcss);
/**
*
*
* @param szxcZcss
* @return
*/
public int insertSzxcZcss(SzxcZcss szxcZcss);
/**
*
*
* @param szxcZcss
* @return
*/
public int updateSzxcZcss(SzxcZcss szxcZcss);
/**
*
*
* @param ids
* @return
*/
public int deleteSzxcZcssByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteSzxcZcssById(Long id);
}

@ -0,0 +1,62 @@
package com.ruoyi.szxc.service.impl;
import com.ruoyi.szxc.domain.SzxcZcss;
import java.util.List;
/**
* Service
*
* @author hs
* @date 2024-04-02
*/
public interface ISzxcZcssService
{
/**
*
*
* @param id
* @return
*/
public SzxcZcss selectSzxcZcssById(Long id);
/**
*
*
* @param szxcZcss
* @return
*/
public List<SzxcZcss> selectSzxcZcssList(SzxcZcss szxcZcss);
/**
*
*
* @param szxcZcss
* @return
*/
public int insertSzxcZcss(SzxcZcss szxcZcss);
/**
*
*
* @param szxcZcss
* @return
*/
public int updateSzxcZcss(SzxcZcss szxcZcss);
/**
*
*
* @param ids
* @return
*/
public int deleteSzxcZcssByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteSzxcZcssById(Long id);
}

@ -0,0 +1,126 @@
<?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.ruoyi.szxc.mapper.SzxcZcssMapper">
<resultMap type="SzxcZcss" id="SzxcZcssResult">
<result property="id" column="id" />
<result property="zcName" column="zc_name" />
<result property="zcType" column="zc_type" />
<result property="installDate" column="install_date" />
<result property="fzr" column="fzr" />
<result property="phone" column="phone" />
<result property="address" column="address" />
<result property="picture" column="picture" />
<result property="xj" column="xj" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="userId" column="user_id" />
</resultMap>
<sql id="selectSzxcZcssVo">
select id, zc_name, zc_type, install_date, fzr, phone, address, picture, xj, remark, create_by, create_time, update_by, update_time, dept_id, dept_name, user_id from szxc_zcss
</sql>
<select id="selectSzxcZcssList" parameterType="SzxcZcss" resultMap="SzxcZcssResult">
<include refid="selectSzxcZcssVo"/>
<where>
<if test="zcName != null and zcName != ''"> and zc_name like concat('%', #{zcName}, '%')</if>
<if test="zcType != null and zcType != ''"> and zc_type = #{zcType}</if>
<if test="installDate != null "> and install_date = #{installDate}</if>
<if test="fzr != null and fzr != ''"> and fzr = #{fzr}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="picture != null and picture != ''"> and picture = #{picture}</if>
<if test="xj != null and xj != ''"> and xj = #{xj}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
<if test="userId != null "> and user_id = #{userId}</if>
</where>
</select>
<select id="selectSzxcZcssById" parameterType="Long" resultMap="SzxcZcssResult">
<include refid="selectSzxcZcssVo"/>
where id = #{id}
</select>
<insert id="insertSzxcZcss" parameterType="SzxcZcss" useGeneratedKeys="true" keyProperty="id">
insert into szxc_zcss
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="zcName != null">zc_name,</if>
<if test="zcType != null">zc_type,</if>
<if test="installDate != null">install_date,</if>
<if test="fzr != null">fzr,</if>
<if test="phone != null">phone,</if>
<if test="address != null">address,</if>
<if test="picture != null">picture,</if>
<if test="xj != null">xj,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</if>
<if test="userId != null">user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="zcName != null">#{zcName},</if>
<if test="zcType != null">#{zcType},</if>
<if test="installDate != null">#{installDate},</if>
<if test="fzr != null">#{fzr},</if>
<if test="phone != null">#{phone},</if>
<if test="address != null">#{address},</if>
<if test="picture != null">#{picture},</if>
<if test="xj != null">#{xj},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deptId != null">#{deptId},</if>
<if test="deptName != null">#{deptName},</if>
<if test="userId != null">#{userId},</if>
</trim>
</insert>
<update id="updateSzxcZcss" parameterType="SzxcZcss">
update szxc_zcss
<trim prefix="SET" suffixOverrides=",">
<if test="zcName != null">zc_name = #{zcName},</if>
<if test="zcType != null">zc_type = #{zcType},</if>
<if test="installDate != null">install_date = #{installDate},</if>
<if test="fzr != null">fzr = #{fzr},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="address != null">address = #{address},</if>
<if test="picture != null">picture = #{picture},</if>
<if test="xj != null">xj = #{xj},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="userId != null">user_id = #{userId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSzxcZcssById" parameterType="Long">
delete from szxc_zcss where id = #{id}
</delete>
<delete id="deleteSzxcZcssByIds" parameterType="String">
delete from szxc_zcss where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询资产设施列表
export function listZcss(query) {
return request({
url: '/szxc/zcss/list',
method: 'get',
params: query
})
}
// 查询资产设施详细
export function getZcss(id) {
return request({
url: '/szxc/zcss/' + id,
method: 'get'
})
}
// 新增资产设施
export function addZcss(data) {
return request({
url: '/szxc/zcss',
method: 'post',
data: data
})
}
// 修改资产设施
export function updateZcss(data) {
return request({
url: '/szxc/zcss',
method: 'put',
data: data
})
}
// 删除资产设施
export function delZcss(id) {
return request({
url: '/szxc/zcss/' + id,
method: 'delete'
})
}

@ -0,0 +1,392 @@
<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="zcName">
<el-input
v-model="queryParams.zcName"
placeholder="请输入资产名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="安装时间" prop="installDate">
<el-date-picker clearable
v-model="queryParams.installDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择安装时间">
</el-date-picker>
</el-form-item>
<el-form-item label="负责人" prop="fzr">
<el-input
v-model="queryParams.fzr"
placeholder="请输入负责人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入联系电话"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="详细地址" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入详细地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="资产照片" prop="picture">
<el-input
v-model="queryParams.picture"
placeholder="请输入资产照片"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否巡检" prop="xj">
<el-input
v-model="queryParams.xj"
placeholder="请输入是否巡检"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="部门id" prop="deptId">
<el-input
v-model="queryParams.deptId"
placeholder="请输入部门id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="所属网格" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入所属网格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建者ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入创建者ID"
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="['szxc:zcss: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="['szxc:zcss: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="['szxc:zcss: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="['szxc:zcss:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="zcssList" @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="zcName" />
<el-table-column label="资产类型(字典)" align="center" prop="zcType" />
<el-table-column label="安装时间" align="center" prop="installDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.installDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="负责人" align="center" prop="fzr" />
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="详细地址" align="center" prop="address" />
<el-table-column label="资产照片" align="center" prop="picture" />
<el-table-column label="是否巡检" align="center" prop="xj" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="部门id" align="center" prop="deptId" />
<el-table-column label="所属网格" align="center" prop="deptName" />
<el-table-column label="创建者ID" align="center" prop="userId" />
<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="['szxc:zcss:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['szxc:zcss: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="zcName">
<el-input v-model="form.zcName" placeholder="请输入资产名称" />
</el-form-item>
<el-form-item label="安装时间" prop="installDate">
<el-date-picker clearable
v-model="form.installDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择安装时间">
</el-date-picker>
</el-form-item>
<el-form-item label="负责人" prop="fzr">
<el-input v-model="form.fzr" placeholder="请输入负责人" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="详细地址" prop="address">
<el-input v-model="form.address" placeholder="请输入详细地址" />
</el-form-item>
<el-form-item label="资产照片" prop="picture">
<el-input v-model="form.picture" placeholder="请输入资产照片" />
</el-form-item>
<el-form-item label="是否巡检" prop="xj">
<el-input v-model="form.xj" placeholder="请输入是否巡检" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="部门id" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入部门id" />
</el-form-item>
<el-form-item label="所属网格" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入所属网格" />
</el-form-item>
<el-form-item label="创建者ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入创建者ID" />
</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 { listZcss, getZcss, delZcss, addZcss, updateZcss } from "@/api/szxc/zcss";
export default {
name: "Zcss",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
zcssList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
zcName: null,
zcType: null,
installDate: null,
fzr: null,
phone: null,
address: null,
picture: null,
xj: null,
deptId: null,
deptName: null,
userId: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询资产设施列表 */
getList() {
this.loading = true;
listZcss(this.queryParams).then(response => {
this.zcssList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
zcName: null,
zcType: null,
installDate: null,
fzr: null,
phone: null,
address: null,
picture: null,
xj: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
deptName: null,
userId: 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
getZcss(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) {
updateZcss(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addZcss(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 delZcss(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('szxc/zcss/export', {
...this.queryParams
}, `zcss_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save