Commit 9354b86d authored by 耿迪迪's avatar 耿迪迪

发货

parent 9c4fb6dd
package com.zehong.web.controller.track;
import java.util.List;
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.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TProductLogistics;
import com.zehong.system.service.ITProductLogisticsService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 出货物流Controller
*
* @author zehong
* @date 2024-08-30
*/
@RestController
@RequestMapping("/track/logistics")
public class TProductLogisticsController extends BaseController
{
@Autowired
private ITProductLogisticsService tProductLogisticsService;
/**
* 查询出货物流列表
*/
// @PreAuthorize("@ss.hasPermi('system:logistics:list')")
@GetMapping("/list")
public TableDataInfo list(TProductLogistics tProductLogistics)
{
startPage();
List<TProductLogistics> list = tProductLogisticsService.selectTProductLogisticsList(tProductLogistics);
return getDataTable(list);
}
/**
* 导出出货物流列表
*/
//@PreAuthorize("@ss.hasPermi('system:logistics:export')")
@Log(title = "出货物流", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TProductLogistics tProductLogistics)
{
List<TProductLogistics> list = tProductLogisticsService.selectTProductLogisticsList(tProductLogistics);
ExcelUtil<TProductLogistics> util = new ExcelUtil<TProductLogistics>(TProductLogistics.class);
return util.exportExcel(list, "出货物流数据");
}
/**
* 获取出货物流详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:logistics:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tProductLogisticsService.selectTProductLogisticsById(id));
}
/**
* 新增出货物流
*/
//@PreAuthorize("@ss.hasPermi('system:logistics:add')")
@Log(title = "出货物流", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TProductLogistics tProductLogistics)
{
return toAjax(tProductLogisticsService.insertTProductLogistics(tProductLogistics));
}
/**
* 修改出货物流
*/
//@PreAuthorize("@ss.hasPermi('system:logistics:edit')")
@Log(title = "出货物流", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TProductLogistics tProductLogistics)
{
return toAjax(tProductLogisticsService.updateTProductLogistics(tProductLogistics));
}
/**
* 删除出货物流
*/
//@PreAuthorize("@ss.hasPermi('system:logistics:remove')")
@Log(title = "出货物流", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tProductLogisticsService.deleteTProductLogisticsByIds(ids));
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 出货物流对象 t_product_logistics
*
* @author zehong
* @date 2024-08-30
*/
public class TProductLogistics extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 执行编号 */
private Long inspectId;
@Excel(name = "批次号")
private String batchNo;
/** 快递公司 */
@Excel(name = "快递公司")
private String express;
/** 快递员 */
@Excel(name = "快递员")
private String username;
/** 快递员电话 */
@Excel(name = "快递员电话")
private String tel;
/** 运单号 */
@Excel(name = "运单号")
private String expressNo;
/** 发货照片 */
@Excel(name = "发货照片")
private String imgUrl;
/** 创建人 */
@Excel(name = "创建人")
private Long createId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setInspectId(Long inspectId)
{
this.inspectId = inspectId;
}
public Long getInspectId()
{
return inspectId;
}
public String getBatchNo() {
return batchNo;
}
public void setBatchNo(String batchNo) {
this.batchNo = batchNo;
}
public void setExpress(String express)
{
this.express = express;
}
public String getExpress()
{
return express;
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return username;
}
public void setTel(String tel)
{
this.tel = tel;
}
public String getTel()
{
return tel;
}
public void setExpressNo(String expressNo)
{
this.expressNo = expressNo;
}
public String getExpressNo()
{
return expressNo;
}
public void setImgUrl(String imgUrl)
{
this.imgUrl = imgUrl;
}
public String getImgUrl()
{
return imgUrl;
}
public void setCreateId(Long createId)
{
this.createId = createId;
}
public Long getCreateId()
{
return createId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("inspectId", getInspectId())
.append("express", getExpress())
.append("username", getUsername())
.append("tel", getTel())
.append("expressNo", getExpressNo())
.append("imgUrl", getImgUrl())
.append("createTime", getCreateTime())
.append("createId", getCreateId())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TProductLogistics;
/**
* 出货物流Mapper接口
*
* @author zehong
* @date 2024-08-30
*/
public interface TProductLogisticsMapper
{
/**
* 查询出货物流
*
* @param id 出货物流ID
* @return 出货物流
*/
public TProductLogistics selectTProductLogisticsById(Long id);
/**
* 查询出货物流列表
*
* @param tProductLogistics 出货物流
* @return 出货物流集合
*/
public List<TProductLogistics> selectTProductLogisticsList(TProductLogistics tProductLogistics);
/**
* 新增出货物流
*
* @param tProductLogistics 出货物流
* @return 结果
*/
public int insertTProductLogistics(TProductLogistics tProductLogistics);
/**
* 修改出货物流
*
* @param tProductLogistics 出货物流
* @return 结果
*/
public int updateTProductLogistics(TProductLogistics tProductLogistics);
/**
* 删除出货物流
*
* @param id 出货物流ID
* @return 结果
*/
public int deleteTProductLogisticsById(Long id);
/**
* 批量删除出货物流
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTProductLogisticsByIds(Long[] ids);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TProductLogistics;
/**
* 出货物流Service接口
*
* @author zehong
* @date 2024-08-30
*/
public interface ITProductLogisticsService
{
/**
* 查询出货物流
*
* @param id 出货物流ID
* @return 出货物流
*/
public TProductLogistics selectTProductLogisticsById(Long id);
/**
* 查询出货物流列表
*
* @param tProductLogistics 出货物流
* @return 出货物流集合
*/
public List<TProductLogistics> selectTProductLogisticsList(TProductLogistics tProductLogistics);
/**
* 新增出货物流
*
* @param tProductLogistics 出货物流
* @return 结果
*/
public int insertTProductLogistics(TProductLogistics tProductLogistics);
/**
* 修改出货物流
*
* @param tProductLogistics 出货物流
* @return 结果
*/
public int updateTProductLogistics(TProductLogistics tProductLogistics);
/**
* 批量删除出货物流
*
* @param ids 需要删除的出货物流ID
* @return 结果
*/
public int deleteTProductLogisticsByIds(Long[] ids);
/**
* 删除出货物流信息
*
* @param id 出货物流ID
* @return 结果
*/
public int deleteTProductLogisticsById(Long id);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TProductLogisticsMapper;
import com.zehong.system.domain.TProductLogistics;
import com.zehong.system.service.ITProductLogisticsService;
/**
* 出货物流Service业务层处理
*
* @author zehong
* @date 2024-08-30
*/
@Service
public class TProductLogisticsServiceImpl implements ITProductLogisticsService
{
@Autowired
private TProductLogisticsMapper tProductLogisticsMapper;
/**
* 查询出货物流
*
* @param id 出货物流ID
* @return 出货物流
*/
@Override
public TProductLogistics selectTProductLogisticsById(Long id)
{
return tProductLogisticsMapper.selectTProductLogisticsById(id);
}
/**
* 查询出货物流列表
*
* @param tProductLogistics 出货物流
* @return 出货物流
*/
@Override
public List<TProductLogistics> selectTProductLogisticsList(TProductLogistics tProductLogistics)
{
return tProductLogisticsMapper.selectTProductLogisticsList(tProductLogistics);
}
/**
* 新增出货物流
*
* @param tProductLogistics 出货物流
* @return 结果
*/
@Override
public int insertTProductLogistics(TProductLogistics tProductLogistics)
{
tProductLogistics.setCreateTime(DateUtils.getNowDate());
tProductLogistics.setCreateId(SecurityUtils.getLoginUser().getUser().getUserId());
return tProductLogisticsMapper.insertTProductLogistics(tProductLogistics);
}
/**
* 修改出货物流
*
* @param tProductLogistics 出货物流
* @return 结果
*/
@Override
public int updateTProductLogistics(TProductLogistics tProductLogistics)
{
return tProductLogisticsMapper.updateTProductLogistics(tProductLogistics);
}
/**
* 批量删除出货物流
*
* @param ids 需要删除的出货物流ID
* @return 结果
*/
@Override
public int deleteTProductLogisticsByIds(Long[] ids)
{
return tProductLogisticsMapper.deleteTProductLogisticsByIds(ids);
}
/**
* 删除出货物流信息
*
* @param id 出货物流ID
* @return 结果
*/
@Override
public int deleteTProductLogisticsById(Long id)
{
return tProductLogisticsMapper.deleteTProductLogisticsById(id);
}
}
......@@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTProductDeviceList" parameterType="TProductDevice" resultMap="TProductDeviceResult">
<include refid="selectTProductDeviceVo"/>
<where>
<if test="inspectId != null "> and device.inspect_id like concat('%', #{inspectId}, '%')</if>
<if test="batchNo != null and batchNo != ''"> and ins.batch_no like concat('%', #{batchNo}, '%')</if>
<if test="deviceNo != null and deviceNo != ''"> and device.device_no like concat('%', #{deviceNo}, '%')</if>
<if test="title != null and title != ''"> and device.title like concat('%', #{title}, '%')</if>
<if test="status != null and status != ''"> and device.status = #{status}</if>
......
<?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.zehong.system.mapper.TProductLogisticsMapper">
<resultMap type="TProductLogistics" id="TProductLogisticsResult">
<result property="id" column="id" />
<result property="inspectId" column="inspect_id" />
<result property="express" column="express" />
<result property="username" column="username" />
<result property="tel" column="tel" />
<result property="expressNo" column="express_no" />
<result property="imgUrl" column="img_url" />
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
</resultMap>
<sql id="selectTProductLogisticsVo">
SELECT
log.id,
log.inspect_id,
log.express,
log.username,
log.tel,
log.express_no,
log.img_url,
log.create_time,
log.create_id,
ins.batch_no as batchNo,
(select nick_name from sys_user us where us.user_id = log.create_id) as createBy
FROM
t_product_logistics log
LEFT JOIN t_product_inspect ins ON ins.id = log.inspect_id
</sql>
<select id="selectTProductLogisticsList" parameterType="TProductLogistics" resultMap="TProductLogisticsResult">
<include refid="selectTProductLogisticsVo"/>
<where>
<if test="inspectId != null "> and log.inspect_id = #{inspectId}</if>
<if test="express != null and express != ''"> and log.express like concat('%', #{express}, '%')</if>
<if test="username != null and username != ''"> and log.username like concat('%', #{username}, '%')</if>
<if test="expressNo != null and expressNo != ''"> and log.express_no like concat('%', #{expressNo}, '%')</if>
<if test="batchNo != null and batchNo != ''"> and ins.batch_no like concat('%', #{batchNo}, '%')</if>
</where>
</select>
<select id="selectTProductLogisticsById" parameterType="Long" resultMap="TProductLogisticsResult">
<include refid="selectTProductLogisticsVo"/>
where log.id = #{id}
</select>
<insert id="insertTProductLogistics" parameterType="TProductLogistics" useGeneratedKeys="true" keyProperty="id">
insert into t_product_logistics
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inspectId != null">inspect_id,</if>
<if test="express != null and express != ''">express,</if>
<if test="username != null and username != ''">username,</if>
<if test="tel != null and tel != ''">tel,</if>
<if test="expressNo != null and expressNo != ''">express_no,</if>
<if test="imgUrl != null">img_url,</if>
<if test="createTime != null">create_time,</if>
<if test="createId != null">create_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inspectId != null">#{inspectId},</if>
<if test="express != null and express != ''">#{express},</if>
<if test="username != null and username != ''">#{username},</if>
<if test="tel != null and tel != ''">#{tel},</if>
<if test="expressNo != null and expressNo != ''">#{expressNo},</if>
<if test="imgUrl != null">#{imgUrl},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createId != null">#{createId},</if>
</trim>
</insert>
<update id="updateTProductLogistics" parameterType="TProductLogistics">
update t_product_logistics
<trim prefix="SET" suffixOverrides=",">
<if test="inspectId != null">inspect_id = #{inspectId},</if>
<if test="express != null and express != ''">express = #{express},</if>
<if test="username != null and username != ''">username = #{username},</if>
<if test="tel != null and tel != ''">tel = #{tel},</if>
<if test="expressNo != null and expressNo != ''">express_no = #{expressNo},</if>
<if test="imgUrl != null">img_url = #{imgUrl},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createId != null">create_id = #{createId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTProductLogisticsById" parameterType="Long">
delete from t_product_logistics where id = #{id}
</delete>
<delete id="deleteTProductLogisticsByIds" parameterType="String">
delete from t_product_logistics where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询出货物流列表
export function listLogistics(query) {
return request({
url: '/track/logistics/list',
method: 'get',
params: query
})
}
// 查询出货物流详细
export function getLogistics(id) {
return request({
url: '/track/logistics/' + id,
method: 'get'
})
}
// 新增出货物流
export function addLogistics(data) {
return request({
url: '/track/logistics',
method: 'post',
data: data
})
}
// 修改出货物流
export function updateLogistics(data) {
return request({
url: '/track/logistics',
method: 'put',
data: data
})
}
// 删除出货物流
export function delLogistics(id) {
return request({
url: '/track/logistics/' + id,
method: 'delete'
})
}
// 导出出货物流
export function exportLogistics(query) {
return request({
url: '/track/logistics/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="执行编号" prop="inspectId">
<el-form-item label="批次号" prop="batchNo">
<el-input
v-model="queryParams.inspectId"
placeholder="请输入执行编号"
v-model="queryParams.batchNo"
placeholder="请输入批次号"
clearable
size="small"
@keyup.enter.native="handleQuery"
......@@ -264,6 +264,7 @@ export default {
deviceNo: null,
title: null,
status: null,
batchNo: null
},
// 表单参数
form: {},
......
<template>
<el-dialog title="详情" :visible.sync="detailOpen" width="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form label-width="100px">
<el-row class="el-row-table">
<el-col :span="12">
<el-form-item label="批次号" prop="inspectId">
<span v-if="detailInfo.batchNo">{{ detailInfo.batchNo }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递公司" prop="express">
<span v-if="detailInfo.express">{{ detailInfo.express }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递员" prop="username">
<span v-if="detailInfo.username">{{ detailInfo.username }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递员电话" prop="tel">
<span v-if="detailInfo.tel">{{ detailInfo.tel }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运单号" prop="expressNo">
<span v-if="detailInfo.expressNo">{{ detailInfo.expressNo }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="发货照片">
<el-image
v-if="detailInfo.imgUrl"
:src="detailInfo.imgUrl"
:preview-src-list="[detailInfo.imgUrl]"
:z-index="9999"
style="width: 200px;height: 200px;"
></el-image>
<span v-else>-</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import { getLogistics } from "@/api/project/info";
export default {
name: "detail-info",
data(){
return{
detailOpen: false,
detailInfo: {}
}
},
methods:{
getDetailInfo(id){
getLogistics(id).then(res =>{
if(res.code == 200){
this.detailInfo = res.data;
this.detailOpen = true;
}
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="批次号" prop="batchNo">
<el-input
v-model="queryParams.batchNo"
placeholder="请输入批次号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="快递公司" prop="express">
<el-input
v-model="queryParams.express"
placeholder="请输入快递公司"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="快递员" prop="username">
<el-input
v-model="queryParams.username"
placeholder="请输入快递员"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="运单号" prop="expressNo">
<el-input
v-model="queryParams.expressNo"
placeholder="请输入运单号"
clearable
size="small"
@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"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="logisticsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="批次号" align="center" prop="batchNo" />
<el-table-column label="快递公司" align="center" prop="express" />
<el-table-column label="快递员" align="center" prop="username" />
<el-table-column label="快递员电话" align="center" prop="tel" />
<el-table-column label="运单号" align="center" prop="expressNo" />
<el-table-column label="发货照片" align="center" prop="imgUrl">
<template slot-scope="scope">
<el-image
v-if="scope.row.imgUrl"
:src="scope.row.imgUrl"
:preview-src-list="[scope.row.imgUrl]"
:z-index="9999"
style="width: 30px;height: 30px;"
></el-image>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<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-document"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</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="800px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row class="el-row-table">
<el-col :span="12">
<el-form-item label="批次号" prop="inspectId">
<el-select
style="width:100%"
v-model="form.inspectId"
placeholder="请选择批次号"
clearable size="small"
>
<el-option
v-for="execute in executeData"
:key="execute.id"
:label="execute.batchNo"
:value="execute.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递公司" prop="express">
<el-input v-model="form.express" placeholder="请输入快递公司" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递员" prop="username">
<el-input v-model="form.username" placeholder="请输入快递员" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="快递员电话" prop="tel">
<el-input v-model="form.tel" placeholder="请输入快递员电话" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运单号" prop="expressNo">
<el-input v-model="form.expressNo" placeholder="请输入运单号" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="发货照片">
<imageUpload v-model="form.imgUrl"/>
</el-form-item>
</el-col>
</el-row>
</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>
<!-- 详情 -->
<DetailInfo ref="detail"/>
</div>
</template>
<script>
import { listLogistics, getLogistics, delLogistics, addLogistics, updateLogistics, exportLogistics } from "@/api/track/logistics";
import ImageUpload from '@/components/ImageUpload';
import { executeInfoList } from "@/api/track/execute";
import DetailInfo from "./components/DetailInfo";
export default {
name: "Logistics",
components: {
ImageUpload,
DetailInfo
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 出货物流表格数据
logisticsList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
inspectId: null,
express: null,
username: null,
expressNo: null,
batchNo: null
},
// 表单参数
form: {},
// 表单校验
rules: {
inspectId: [
{ required: true, message: "执行编号不能为空", trigger: "change" }
],
express: [
{ required: true, message: "快递公司不能为空", trigger: "blur" }
],
username: [
{ required: true, message: "快递员不能为空", trigger: "blur" }
],
tel: [
{ required: true, message: "快递员电话不能为空", trigger: "blur" },
{
type: 'number',
message: '手机号格式不正确',
trigger: 'blur',
transform(value) {
let phonereg = 11 && /^((13|14|15|16|17|18|19)[0-9]{1}\d{8})$/
if (value && !phonereg.test(value)) {
return false
} else {
return Number(value)
}
}
}
],
expressNo: [
{ required: true, message: "运单号不能为空", trigger: "blur" }
],
},
executeData: [],
};
},
created() {
this.getList();
},
methods: {
/** 查询出货物流列表 */
getList() {
this.loading = true;
listLogistics(this.queryParams).then(response => {
this.logisticsList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
inspectId: null,
express: null,
username: null,
tel: null,
expressNo: null,
imgUrl: null,
createTime: null,
createId: 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.getExecuteInfo();
this.open = true;
this.title = "添加出货物流";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLogistics(id).then(response => {
this.form = response.data;
this.getExecuteInfo();
this.open = true;
this.title = "修改出货物流";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateLogistics(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLogistics(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除出货物流编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delLogistics(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有出货物流数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportLogistics(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
//获取执行信息
getExecuteInfo(){
executeInfoList().then(res =>{
if(res.code == 200){
this.executeData = res.data;
}
})
},
//详情
handleDetail(row){
this.$refs.detail.getDetailInfo(row.id);
},
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment