代码更新
This commit is contained in:
@@ -40,6 +40,14 @@ public class DevicerepairmstController {
|
||||
return new ResponseEntity<>(devicerepairmstService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryBom")
|
||||
@Log("查询备件bom")
|
||||
@ApiOperation("查询备件bom")
|
||||
//@PreAuthorize("@el.check('devicerepairmst:list')")
|
||||
public ResponseEntity<Object> queryBom(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(devicerepairmstService.queryBom(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增维修单维护")
|
||||
@ApiOperation("新增维修单维护")
|
||||
@@ -166,4 +174,12 @@ public class DevicerepairmstController {
|
||||
public ResponseEntity<Object> getFileBom(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(devicerepairmstService.getFileBom(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("保存维修领用")
|
||||
@ApiOperation("保存维修领用")
|
||||
@PostMapping("/submitReceive")
|
||||
public ResponseEntity<Object> submitReceive(@RequestBody JSONObject whereJson) {
|
||||
devicerepairmstService.submitReceive(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,4 +163,13 @@ public interface DevicerepairmstService {
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getFileBom(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 保存维修领用
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submitReceive(JSONObject whereJson);
|
||||
|
||||
Map<String, Object> queryBom(Map whereJson, Pageable page);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,13 @@ import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.st.service.StorattrService;
|
||||
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
||||
import org.nl.wms.sb.core.service.impl.SparePartInServiceImpl;
|
||||
import org.nl.wms.sb.repair.service.DevicerepairmstService;
|
||||
import org.nl.wms.sb.repair.service.dto.DevicerepairmstDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -43,6 +47,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
@Slf4j
|
||||
public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
private final ClassstandardService classstandardService;
|
||||
private final StorattrService storattrService;
|
||||
private final SparePartInServiceImpl sparePartInService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
@@ -514,6 +520,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
String material_id = whereJson.getString("material_id");
|
||||
String device_id = whereJson.getString("device_id");
|
||||
String device_code = whereJson.getString("device_code");
|
||||
String repair_dtl_id = whereJson.getString("repair_dtl_id");
|
||||
int qty = whereJson.getIntValue("qty");
|
||||
|
||||
WQLObject itemTab = WQLObject.getWQLObject("EM_BI_DeviceRepairItems");
|
||||
@@ -542,8 +549,186 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
jsonObject.put("repair_item_code", jsonItem.getString("repair_item_code"));
|
||||
jsonObject.put("device_id", device_id);
|
||||
jsonObject.put("device_code", device_code);
|
||||
jsonObject.put("repair_dtl_id", repair_dtl_id);
|
||||
}
|
||||
return resultArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submitReceive(JSONObject whereJson) {
|
||||
JSONObject jsonMst = whereJson.getJSONObject("mst"); // 维修单主表
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData"); // 更换备件明细
|
||||
|
||||
WQLObject recoudTab = WQLObject.getWQLObject("EM_BI_DeviceRepairReplaceRecord"); // 设备维修单更换记录表
|
||||
WQLObject spareBOMTab = WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM"); // 设备档案BOM备件表
|
||||
WQLObject mst_wql = WQLObject.getWQLObject("EM_BI_IOStorInv"); // 出入库主表
|
||||
WQLObject dtl_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDtl"); // 出入库明细表
|
||||
WQLObject dis_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDis"); // 出入库分配表
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_attachment = '1'").uniqueResult(0);
|
||||
String stor_id = stor.getString("stor_id");
|
||||
// 出库单主表标识
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
|
||||
// 插入设备维修单更换记录表
|
||||
JSONObject jsonRecord = new JSONObject();
|
||||
jsonRecord.put("repair_recode_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonRecord.put("repair_dtl_id", json.get("repair_dtl_id"));
|
||||
jsonRecord.put("repair_id", jsonMst.get("repair_id"));
|
||||
jsonRecord.put("repair_item_id", json.get("repair_item_id"));
|
||||
jsonRecord.put("old_sparepart_only_id", json.get("sparepart_only_id"));
|
||||
jsonRecord.put("new_sparepart_only_id", json.get("change_only_id"));
|
||||
jsonRecord.put("material_id", json.get("material_id"));
|
||||
jsonRecord.put("pcsn", json.getString("pcsn"));
|
||||
jsonRecord.put("real_qty", json.get("qty"));
|
||||
jsonRecord.put("qty_unit_id", json.get("qty_unit_id"));
|
||||
jsonRecord.put("qty_unit_name", json.get("qty_unit_name"));
|
||||
recoudTab.insert(jsonRecord);
|
||||
|
||||
// 如果维修更换记录表中 ‘原备件唯一标识为空’ 则插入 ‘设备档案BOM备件表’
|
||||
String old_sparepart_only_id = jsonRecord.getString("old_sparepart_only_id");
|
||||
if (ObjectUtil.isEmpty(old_sparepart_only_id)) {
|
||||
JSONObject jsonSpareBom = new JSONObject();
|
||||
jsonSpareBom.put("device_file_spare_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonSpareBom.put("devicerecord_id",jsonMst.get("devicerecord_id"));
|
||||
jsonSpareBom.put("sparepart_only_id", json.get("change_only_id"));
|
||||
jsonSpareBom.put("material_id", json.get("material_id"));
|
||||
jsonSpareBom.put("pcsn", json.getString("pcsn"));
|
||||
jsonSpareBom.put("qty", json.get("qty"));
|
||||
jsonSpareBom.put("qty_unit_id", json.get("qty_unit_id"));
|
||||
jsonSpareBom.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||
spareBOMTab.insert(jsonSpareBom);
|
||||
} else {
|
||||
JSONObject jsonSpareBom = spareBOMTab.query("sparepart_only_id = '" + old_sparepart_only_id + "'").uniqueResult(0);
|
||||
jsonSpareBom.put("sparepart_only_id",json.get("change_only_id"));
|
||||
jsonSpareBom.put("material_id", json.get("material_id"));
|
||||
jsonSpareBom.put("pcsn", json.getString("pcsn"));
|
||||
jsonSpareBom.put("qty", json.get("qty"));
|
||||
jsonSpareBom.put("qty_unit_id", json.get("qty_unit_id"));
|
||||
jsonSpareBom.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||
spareBOMTab.update(jsonSpareBom);
|
||||
}
|
||||
|
||||
// 插入备件出入库明细
|
||||
JSONObject dis_jo = new JSONObject();
|
||||
//判断该分配是否存在明细
|
||||
JSONObject dtl = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"' AND material_id = '"+json.getString("material_id")+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dtl)){
|
||||
//插入一条入库明细
|
||||
dtl = new JSONObject();
|
||||
dtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
dtl.put("iostorinv_id", iostorinv_id);
|
||||
JSONArray dtl_rows = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
dtl.put("seq_no", (dtl_rows.size() + 1) + "");
|
||||
dtl.put("bill_status", "40");
|
||||
dtl.put("material_id",json.get("material_id"));
|
||||
dtl.put("pcsn",json.getString("pcsn"));
|
||||
dtl.put("qty_unit_id",json.get("qty_unit_id"));
|
||||
dtl.put("qty_unit_name",json.getString("qty_unit_name"));
|
||||
dtl.put("source_billdtl_id",jsonMst.getString("repair_id"));
|
||||
dtl.put("base_billdtl_id",jsonMst.getString("repair_id"));
|
||||
dtl.put("source_bill_type",jsonMst.getString("maintenancecycle"));
|
||||
dtl.put("base_bill_type",jsonMst.getString("maintenancecycle"));
|
||||
dtl.put("source_bill_code",jsonMst.getString("repair_code"));
|
||||
dtl.put("base_bill_code",jsonMst.getString("repair_code"));
|
||||
dtl.put("source_bill_table","EM_BI_DeviceRepairMst");
|
||||
dtl.put("base_bill_table","EM_BI_DeviceRepairMst");
|
||||
dtl.put("plan_qty","1");
|
||||
dtl.put("real_qty","1");
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").insert(dtl);
|
||||
}else {
|
||||
dtl.put("plan_qty",dtl.getDoubleValue("plan_qty")+1);
|
||||
dtl.put("real_qty",dtl.getDoubleValue("real_qty")+1);
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").update(dtl);
|
||||
}
|
||||
|
||||
dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dis_jo.put("iostorinv_id", iostorinv_id);
|
||||
dis_jo.put("iostorinvdtl_id", dtl.getString("iostorinvdtl_id"));
|
||||
dis_jo.put("disseq_no", i + 1);
|
||||
dis_jo.put("material_id", dtl.getString("material_id"));
|
||||
dis_jo.put("pcsn", "999999");
|
||||
dis_jo.put("real_qty", json.get("qty"));
|
||||
dis_jo.put("work_status", "99");
|
||||
dis_jo.put("qty_unit_id", dtl.getString("qty_unit_id"));
|
||||
dis_jo.put("qty_unit_name", dtl.getString("qty_unit_name"));
|
||||
JSONObject jsonIvt = WQLObject.getWQLObject("ST_IVT_StructIvt").query("stor_id = '"+stor.getString("stor_id")+"' and material_id = '"+json.getString("material_id")+"' and pcsn = '"+json.getString("pcsn")+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("库存不足");
|
||||
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("struct_id = '"+jsonIvt.getString("struct_id")+"'").uniqueResult(0);
|
||||
dis_jo.put("sect_id", struct.getString("sect_id"));
|
||||
dis_jo.put("sect_code", struct.getString("sect_code"));
|
||||
dis_jo.put("sect_name", struct.getString("sect_name"));
|
||||
dis_jo.put("struct_id", struct.getString("struct_id"));
|
||||
dis_jo.put("struct_code", struct.getString("struct_code"));
|
||||
dis_jo.put("struct_name", struct.getString("struct_name"));
|
||||
dis_jo.put("sparepart_only_id", json.get("change_only_id"));
|
||||
dis_jo.put("operate_optid", currentUserId);
|
||||
dis_jo.put("operate_optname", nickName);
|
||||
dis_jo.put("operate_time", now);
|
||||
dis_wql.insert(dis_jo);
|
||||
}
|
||||
|
||||
//插入主表
|
||||
JSONObject io_mst = new JSONObject();
|
||||
String bill_code = CodeUtil.getNewCode("IO_CODE");
|
||||
io_mst.put("iostorinv_id", iostorinv_id);
|
||||
io_mst.put("bill_code", bill_code);
|
||||
io_mst.put("buss_type","0109");
|
||||
io_mst.put("io_type", "1");
|
||||
io_mst.put("bill_type", "010901");
|
||||
io_mst.put("biz_date", DateUtil.today());
|
||||
StorattrDto storattrDto = storattrService.findById(Long.parseLong(stor_id));
|
||||
String stor_code = storattrDto.getStor_code();
|
||||
String stor_name = storattrDto.getStor_name();
|
||||
io_mst.put("stor_id", stor_id);
|
||||
io_mst.put("stor_code", stor_code);
|
||||
io_mst.put("stor_name", stor_name);
|
||||
JSONArray dis_num = dis_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
io_mst.put("total_qty", dis_num.size());
|
||||
JSONArray dtl_num = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
io_mst.put("detail_count", dtl_num.size());
|
||||
io_mst.put("bill_status", "40");
|
||||
io_mst.put("create_mode", "01");
|
||||
io_mst.put("input_optid", currentUserId + "");
|
||||
io_mst.put("input_optname", nickName);
|
||||
io_mst.put("input_time", now);
|
||||
io_mst.put("update_optid", currentUserId + "");
|
||||
io_mst.put("update_optname", nickName);
|
||||
io_mst.put("update_time", now);
|
||||
io_mst.put("device_id", jsonMst.get("device_id"));
|
||||
io_mst.put("device_code", jsonMst.get("device_code"));
|
||||
io_mst.put("device_name", jsonMst.get("device_name"));
|
||||
io_mst.put("is_delete", "0");
|
||||
io_mst.put("is_upload", "0");
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
io_mst.put("sysdeptid", deptId + "");
|
||||
io_mst.put("syscompanyid", deptId + "");
|
||||
io_mst.put("bizdeptid", deptId + "");
|
||||
|
||||
mst_wql.insert(io_mst);
|
||||
sparePartInService.confirmMst(iostorinv_id);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryBom(Map whereJson, Pageable page) {
|
||||
String sparepart_only_id = MapUtil.getStr(whereJson, "sparepart_only_id");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "5");
|
||||
if (ObjectUtil.isNotEmpty(sparepart_only_id)) map.put("sparepart_only_id", "%"+sparepart_only_id+"'%");
|
||||
|
||||
JSONObject jsonObject = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "");
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.device_bom_id TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.sparepart_only_id TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -162,6 +163,29 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mst.*,
|
||||
file.device_code,
|
||||
file.device_name,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
FROM
|
||||
EM_BI_EquipmentSpareBOM mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = mst.material_id
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
OPTION 输入.sparepart_only_id <> ""
|
||||
mst.sparepart_only_id like 输入.sparepart_only_id
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -128,4 +128,12 @@ export function getFileBom(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getDtl, submit, startRepair, endRepair, submitRepair, confirmRepair, submitResuft, getResult, outRepair, checkRepair, uditRepair, getNormBom, getFileBom }
|
||||
export function submitReceive(data) {
|
||||
return request({
|
||||
url: 'api/devicerepairmst/submitReceive',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getDtl, submit, startRepair, endRepair, submitRepair, confirmRepair, submitResuft, getResult, outRepair, checkRepair, uditRepair, getNormBom, getFileBom, submitReceive }
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<el-table-column show-overflow-tooltip prop="sparepart_only_id" label="备件唯一标识" align="center" />
|
||||
<el-table-column prop="change_only_id" label="更换备件唯一标识" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-show="!scope.row.edit" v-model="scope.row.change_only_id" class="input-with-select"/>
|
||||
<el-input v-show="!scope.row.edit" v-model="scope.row.change_only_id" @focus="addIvt(scope.$index, scope.row)" class="input-with-select"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||
@@ -107,6 +107,7 @@
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<BomDialog :dialog-show.sync="bomShow" :is-single="true" @tableChanged2="tableChanged2"/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -114,10 +115,11 @@
|
||||
|
||||
import crudDevicerepairmst from '@/api/wms/sb/devicerepairmst'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
import BomDialog from '@/views/wms/sb/repair/devicerepairpa/BomDialog'
|
||||
|
||||
export default {
|
||||
name: 'AddChangeDialog',
|
||||
components: { },
|
||||
components: { BomDialog },
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
@@ -133,6 +135,9 @@ export default {
|
||||
form4: {},
|
||||
normBomData: [],
|
||||
fileBom: [],
|
||||
fileBomJson: null,
|
||||
fileBomindex: null,
|
||||
bomShow: false,
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
@@ -166,6 +171,7 @@ export default {
|
||||
'material_id': row.material_id,
|
||||
'qty': row.qty,
|
||||
'repair_item_id': this.form4.repair_item_id,
|
||||
'repair_dtl_id': this.form4.repair_dtl_id,
|
||||
'device_id': this.form4.device_id,
|
||||
'device_code': this.form4.device_code
|
||||
}
|
||||
@@ -181,6 +187,21 @@ export default {
|
||||
}
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', rows)
|
||||
},
|
||||
addIvt(index, row) {
|
||||
this.bomShow = true
|
||||
this.fileBomJson = row
|
||||
this.fileBomindex = index
|
||||
},
|
||||
tableChanged2(row) {
|
||||
debugger
|
||||
const arr = this.fileBom
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (i === this.fileBomindex) {
|
||||
arr[i].change_only_id = row.sparepart_only_id
|
||||
}
|
||||
}
|
||||
this.fileBom = arr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
153
mes/qd/src/views/wms/sb/repair/devicerepairpa/BomDialog.vue
Normal file
153
mes/qd/src/views/wms/sb/repair/devicerepairpa/BomDialog.vue
Normal file
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="选择"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1000px"
|
||||
@close="close"
|
||||
>
|
||||
<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.sparepart_only_id"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="唯一标识"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
<el-table-column v-if="isSingle" label="选择" width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="sparepart_only_id" label="唯一标识" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="pcsn" label="批次号" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="qty" label="数量" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="qty_unit_name" label="单位" min-width="130" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import CRUD, { header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudDevicerepairmst from '@/api/wms/sb/devicerepairmst'
|
||||
|
||||
export default {
|
||||
name: 'Device',
|
||||
components: { rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '备件Bom',
|
||||
url: 'api/devicerepairmst/queryBom',
|
||||
crudMethod: { ...crudDevicerepairmst }, optShow: {}})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isSingle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableRadio: null,
|
||||
checkrow: null,
|
||||
rows: [],
|
||||
XLList: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickChange(item) {
|
||||
this.tableRadio = item
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
if (this.isSingle) {
|
||||
if (val.length > 1) {
|
||||
this.$refs.table.clearSelection()
|
||||
this.$refs.table.toggleRowSelection(val.pop())
|
||||
} else {
|
||||
this.checkrow = row
|
||||
}
|
||||
}
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
close() {
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
// 处理单选
|
||||
if (this.isSingle && this.tableRadio) {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged2', this.tableRadio)
|
||||
return
|
||||
}
|
||||
this.rows = this.$refs.table.selection
|
||||
if (this.rows.length <= 0) {
|
||||
this.$message('请先勾选设备')
|
||||
return
|
||||
}
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged2', this.rows)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -234,18 +234,28 @@ export default {
|
||||
this.form3.repair_item_code = row.repair_item_code
|
||||
this.form3.repair_item_id = row.repair_item_id
|
||||
this.form3.repair_item_name = row.repair_item_name
|
||||
this.form3.repair_dtl_id = row.repair_dtl_id
|
||||
this.form3.device_id = row.device_id
|
||||
},
|
||||
tableChanged(rows) {
|
||||
debugger
|
||||
const arr = rows
|
||||
arr.forEach((item) => {
|
||||
this.tableData.push(item)
|
||||
})
|
||||
},
|
||||
submitReceive() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
if (_selectData.length === 0) {
|
||||
const data = {
|
||||
'tableData': this.tableData,
|
||||
'mst': this.form3
|
||||
}
|
||||
if (this.tableData.length === 0) {
|
||||
return this.crud.notify('设备bom不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudDevicerepairmst.submitReceive(data).then(res => {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user