add:新增合批软废球磨时间页面

This commit is contained in:
zhangzhiqiang
2022-12-23 12:47:55 +08:00
parent ccb73eac94
commit 8351f3253f
7 changed files with 907 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
package org.nl.wms.basedata.pdm.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.wms.basedata.pdm.service.WasteBallTimeService;
import org.nl.wms.basedata.pdm.service.dto.WastecchangeDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/*
* @author ZZQ
* @Date 2022/12/23 10:29 上午
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "合批软废球磨时间维护管理")
@RequestMapping("/api/wasteBallTime")
@Slf4j
public class WasteBallTimeController {
private final WasteBallTimeService wasteBallTimeService;
@GetMapping
@Log("查询合批软废球磨时间")
@ApiOperation("查询合批软废球磨时间")
//@PreAuthorize("@el.check('wastecchange:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(wasteBallTimeService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增合批软废球磨时间")
@ApiOperation("新增合批软废球磨时间")
//@PreAuthorize("@el.check('wastecchange:add')")
public ResponseEntity<Object> create(@Validated @RequestBody WastecchangeDto dto) {
wasteBallTimeService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改合批软废球磨时间")
@ApiOperation("修改合批软废球磨时间")
//@PreAuthorize("@el.check('wastecchange:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody WastecchangeDto dto) {
wasteBallTimeService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除合批软废球磨时间")
@ApiOperation("删除合批软废球磨时间")
//@PreAuthorize("@el.check('wastecchange:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
wasteBallTimeService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("确认")
@ApiOperation("确认")
@PostMapping("/confirm")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
wasteBallTimeService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,80 @@
package org.nl.wms.basedata.pdm.service;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* ZZQ
*/
@Data
public class WasteBallTimeDo implements Serializable {
/** 记录标识 */
/** 防止精度丢失 */
@JsonSerialize(using= ToStringSerializer.class)
private Long change_id;
/** 物料标识 */
private Long material_id;
/** CF */
private BigDecimal cf_qty;
/** YZ */
private BigDecimal yz_qty;
/** CX */
private BigDecimal cx_qty;
/** YC */
private BigDecimal yc_qty;
/** JY */
private BigDecimal jy_qty;
/** LT */
private BigDecimal lt_qty;
/** SJ */
private BigDecimal sj_qty;
/** YS */
private BigDecimal ys_qty;
/** DS */
private BigDecimal ds_qty;
/** CQX */
private BigDecimal cqx_qty;
/** XQX */
private BigDecimal xqx_qty;
/** QX */
private BigDecimal qx_qty;
/** JCF */
private BigDecimal jcf_qty;
/** TB */
private BigDecimal tb_qty;
/** YCR */
private BigDecimal ycr_qty;
/** GZ */
private BigDecimal gz_qty;
/** 创建人 */
private Long create_id;
/** 创建人姓名 */
private String create_name;
/** 创建时间 */
private String create_time;
}

View File

@@ -0,0 +1,79 @@
package org.nl.wms.basedata.pdm.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata.pdm.service.dto.WastecchangeDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author ZZQ
* @description 服务接口
* @date 2022-12-20
**/
public interface WasteBallTimeService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<WastecchangeDto>
*/
List<WastecchangeDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param change_id ID
* @return Wastecchange
*/
WastecchangeDto findById(Long change_id);
/**
* 根据编码查询
*
* @param code code
* @return Wastecchange
*/
WastecchangeDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(WastecchangeDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(WastecchangeDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 确认
*
* @param whereJson /
*/
void confirm(JSONObject whereJson);
}

View File

@@ -0,0 +1,193 @@
package org.nl.wms.basedata.pdm.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.exception.BadRequestException;
import org.nl.utils.SecurityUtils;
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
import org.nl.wms.basedata.pdm.service.WasteBallTimeService;
import org.nl.wms.basedata.pdm.service.WastecchangeService;
import org.nl.wms.basedata.pdm.service.dto.WastecchangeDto;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author ZZQ
* @description 服务实现
* @date 2022-12-20
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class WasteBallTimeServiceImpl implements WasteBallTimeService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_code = MapUtil.getStr(whereJson, "material_code");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
if (ObjectUtil.isNotEmpty(material_code)) {
map.put("material_code", "%" + material_code + "%");
}
map.put("class_ids", MaterOptTypeEnum.THW.getClass_idStr());
JSONObject allmaterialIds = WQL.getWO("PDM_WASTEBALLTIME").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mater.material_code");
JSONArray array = allmaterialIds.getJSONArray("content");
JSONArray array2 = new JSONArray();
if (ObjectUtil.isNotEmpty(array)){
for(int i=0;i<array.size();i++){
JSONObject jo = array.getJSONObject(i);
jo.put("edit","0");
array2.add(jo);
}
allmaterialIds.put("content",array2);
}
return allmaterialIds;
}
@Override
public List<WastecchangeDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("PDM_WASTEBALLTIME");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(WastecchangeDto.class);
return null;
}
@Override
public WastecchangeDto findById(Long change_id) {
WQLObject wo = WQLObject.getWQLObject("PDM_WASTEBALLTIME");
JSONObject json = wo.query("change_id = '" + change_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(WastecchangeDto.class);
}
return null;
}
@Override
public WastecchangeDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("PDM_WASTEBALLTIME");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(WastecchangeDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(WastecchangeDto dto) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
dto.setChange_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("PDM_WASTEBALLTIME");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(WastecchangeDto dto) {
WastecchangeDto entity = this.findById(dto.getChange_id());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
WQLObject wo = WQLObject.getWQLObject("PDM_WASTEBALLTIME");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("PDM_WASTEBALLTIME");
for (Long change_id : ids) {
JSONObject param = new JSONObject();
param.put("change_id", String.valueOf(change_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void confirm(JSONObject whereJson) {
/*
* 修改软废碳平衡
* 1找软废软废类型为负压脱蜡 则根据条件:
* a.粉料牌号包含 "新"、 软废编码包含软废类型后缀 例如:软废编码 like "-F"、 未删除且启用
* b.查询此软废的产品bom表的明细中是否包含此碳化钨
* 2.找软废对应的PG粉
* a.软废编码去掉 "-CF"
* 3.修改软废碳平衡:
* a.软废碳平衡=PG粉碳平衡+CF软废修正值
* 4.若工艺为氢气脱蜡:软废粉料牌号为不包含"新",其它都一样
*/
WQLObject wasTab = WQLObject.getWQLObject("PDM_BI_WasteBallTime");
// 3.插入软废碳平衡修正表
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
// 先删除在插入
JSONObject jsonObject = wasTab.query("material_id = '" + whereJson.getString("material_id")+"'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) wasTab.delete("material_id = '"+whereJson.getString("material_id")+"'");
JSONObject jsonWas = new JSONObject();
jsonWas.put("change_id", IdUtil.getSnowflake(1,1).nextId());
jsonWas.put("material_id", whereJson.getString("material_id"));
jsonWas.put("cf_qty", whereJson.getDoubleValue("cf_qty"));
jsonWas.put("yz_qty", whereJson.getDoubleValue("yz_qty"));
jsonWas.put("cx_qty", whereJson.getDoubleValue("cx_qty"));
jsonWas.put("yc_qty", whereJson.getDoubleValue("yc_qty"));
jsonWas.put("jy_qty", whereJson.getDoubleValue("jy_qty"));
jsonWas.put("lt_qty", whereJson.getDoubleValue("lt_qty"));
jsonWas.put("sj_qty", whereJson.getDoubleValue("sj_qty"));
jsonWas.put("ys_qty", whereJson.getDoubleValue("ys_qty"));
jsonWas.put("ds_qty", whereJson.getDoubleValue("ds_qty"));
jsonWas.put("cqx_qty", whereJson.getDoubleValue("cqx_qty"));
jsonWas.put("xqx_qty", whereJson.getDoubleValue("xqx_qty"));
jsonWas.put("qx_qty", whereJson.getDoubleValue("qx_qty"));
jsonWas.put("jcf_qty", whereJson.getDoubleValue("jcf_qty"));
jsonWas.put("tb_qty", whereJson.getDoubleValue("tb_qty"));
jsonWas.put("ycr_qty", whereJson.getDoubleValue("ycr_qty"));
jsonWas.put("gz_qty", whereJson.getDoubleValue("gz_qty"));
jsonWas.put("create_id", currentUserId);
jsonWas.put("create_name", nickName);
jsonWas.put("create_time", DateUtil.now());
wasTab.insert(jsonWas);
}
}

View File

@@ -0,0 +1,87 @@
[交易说明]
交易名: 软废碳平衡修正维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.material_code TYPEAS s_string
输入.class_ids TYPEAS f_string
输入.material_id TYPEAS s_string
输入.code TYPEAS s_string
输入.tech_type TYPEAS s_string
输入.materialIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
mater.material_code,
mater.material_id,
mater.material_name,
mater.material_model,
chan.change_id,
IFNULL(chan.cf_qty,'99') as cf_qty,
IFNULL(chan.yz_qty,'99') as yz_qty,
IFNULL(chan.cx_qty,'99') as cx_qty,
IFNULL(chan.yc_qty,'99') as yc_qty,
IFNULL(chan.jy_qty,'99') as jy_qty,
IFNULL(chan.lt_qty,'99') as lt_qty,
IFNULL(chan.sj_qty,'99') as sj_qty,
IFNULL(chan.ys_qty,'99') as ys_qty,
IFNULL(chan.ds_qty,'99') as ds_qty,
IFNULL(chan.cqx_qty,'99') as cqx_qty,
IFNULL(chan.xqx_qty,'99') as xqx_qty,
IFNULL(chan.qx_qty,'99') as qx_qty,
IFNULL(chan.jcf_qty,'99') as jcf_qty,
IFNULL(chan.tb_qty,'99') as tb_qty,
IFNULL(chan.ycr_qty,'99') as ycr_qty,
IFNULL(chan.gz_qty,'99') as gz_qty,
chan.create_id,
chan.create_name,
chan.create_time
FROM
md_me_materialbase mater
LEFT JOIN PDM_BI_WasteBallTime chan ON mater.material_id = chan.material_id
WHERE
mater.is_delete = '0'
AND mater.is_used = '1'
and mater.material_type_id='1503644361664106496'
OPTION 输入.material_code <> ""
(mater.material_code like 输入.material_code or
mater.material_name like 输入.material_code)
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/wasteBallTime',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/wasteBallTime/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/wasteBallTime',
method: 'put',
data
})
}
export function confirm(data) {
return request({
url: 'api/wasteBallTime/confirm',
method: 'post',
data
})
}
export default { add, edit, del, confirm }

View File

@@ -0,0 +1,359 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="碳化钨">
<el-input
v-model="query.material_code"
clearable
size="mini"
placeholder="编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
&nbsp;&nbsp;&nbsp;
<span style="font-size:16px" id="tishiAccount" :style="tishiAccount_style">{{ msg }}</span>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column prop="material_code" label="物料编码" min-width="110" align="center" />
<el-table-column prop="material_name" label="物料名称" min-width="120" align="center" />
<el-table-column prop="material_model" label="型号" align="center" />
<el-table-column prop="cf_qty" label="CF" width="95" align="center" >
<template scope="scope">
<span v-show="scope.row.edit">{{ scope.row.cf_qty }}</span>
<el-input-number
v-model="scope.row.cf_qty"
size="small"
v-show="!scope.row.edit"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="yz_qty" label="YZ" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.yz_qty }}</span>
<el-input-number
v-model="scope.row.yz_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="cx_qty" label="CX" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.cx_qty }}</span>
<el-input-number
v-model="scope.row.cx_qty"
v-show="!scope.row.edit"
size="small"
:controls="false"
style="width: 80px"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="yc_qty" label="YC" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.yc_qty }}</span>
<el-input-number
v-model="scope.row.yc_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="jy_qty" label="JY" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.jy_qty }}</span>
<el-input-number
v-model="scope.row.jy_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="lt_qty" label="LT" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.lt_qty }}</span>
<el-input-number
v-model="scope.row.lt_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="sj_qty" label="SJ" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.sj_qty }}</span>
<el-input-number
v-model="scope.row.sj_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="ys_qty" label="YS" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.ys_qty }}</span>
<el-input-number
v-model="scope.row.ys_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="ds_qty" label="DS" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.ds_qty }}</span>
<el-input-number
v-model="scope.row.ds_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="cqx_qty" label="CQX" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.cqx_qty }}</span>
<el-input-number
v-model="scope.row.cqx_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="xqx_qty" label="XQX" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.xqx_qty }}</span>
<el-input-number
v-model="scope.row.xqx_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="qx_qty" label="QX" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.qx_qty }}</span>
<el-input-number
v-model="scope.row.qx_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="jcf_qty" label="JCF" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.jcf_qty }}</span>
<el-input-number
v-model="scope.row.jcf_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="tb_qty" label="TB" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.tb_qty }}</span>
<el-input-number
v-model="scope.row.tb_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="ycr_qty" label="YCR" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.ycr_qty }}</span>
<el-input-number
v-model="scope.row.ycr_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="gz_qty" label="GZ" width="95" align="center" >
<template slot-scope="scope">
<span v-show="scope.row.edit">{{ scope.row.gz_qty }}</span>
<el-input-number
v-model="scope.row.gz_qty"
v-show="!scope.row.edit"
size="small"
style="width: 80px"
:controls="false"
controls-position="right"
:precision="2"
:min="0"
/>
</template>
</el-table-column>
<el-table-column prop="create_time" label="维护时间" min-width="140"/>
<el-table-column prop="create_name" label="维护人" min-width="120" />
<el-table-column label="操作" width="180" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-show="!scope.row.edit" type="primary" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button v-show="scope.row.edit" type="success" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">完成</el-button>
<el-button type="success" size="mini" :loading="confirm_flg" icon="el-icon-check" @click="confirm(scope.row)">确认</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudWasteBallTime from '@/api/wms/basedata/pdm/wasteBallTime'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
const defaultForm = { change_id: null, material_id: null, cf_qty: null, yz_qty: null, cx_qty: null, yc_qty: null, jy_qty: null, lt_qty: null, sj_qty: null, ys_qty: null, ds_qty: null, cqx_qty: null, xqx_qty: null, qx_qty: null, jcf_qty: null, tb_qty: null, ycr_qty: null, gz_qty: null, create_id: null, create_name: null, create_time: null }
export default {
name: 'WasteBallTime',
components: { pagination, crudOperation, rrOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '合批软废球磨时间维护',
url: 'api/wasteBallTime',
idField: 'change_id',
sort: 'change_id,desc',
crudMethod: { ...crudWasteBallTime },
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
},
query: {}
})
},
data() {
return {
msg: '(注意:球磨时间单位为小时, 若无此软废修正填为99)',
tishiAccount_style: {
color: 'red'
},
confirm_flg: false,
permission: {
},
rules: {
}}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
this.crud.data = []
return true
},
handleEdit(index, row) {
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
},
confirm(row) {
this.confirm_flg = true
crudWasteBallTime.confirm(row).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.confirm_flg = false
}).catch(() => {
this.confirm_flg = false
})
}
}
}
</script>
<style scoped>
</style>