'20240301'

This commit is contained in:
xd 2024-03-01 14:25:27 +08:00
parent 3d7f734baf
commit 152cada220
17 changed files with 287 additions and 87 deletions

View File

@ -81,6 +81,10 @@ public class CYlMaterialController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody CYlMaterial cYlMaterial)
{
if (!cYlMaterialService.checkMaterialNoUnique(cYlMaterial))
{
return error("新增材料'" + cYlMaterial.getMaterialNo() + "'失败,编码已存在");
}
return toAjax(cYlMaterialService.insertCYlMaterial(cYlMaterial));
}

View File

@ -102,6 +102,10 @@ public class CFactoryController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody CFactory cFactory)
{
if (!cFactoryService.checkFactoryNoUnique(cFactory))
{
return error("新增车间'" + cFactory.getFactoryNo() + "'失败,编码已存在");
}
return toAjax(cFactoryService.insertCFactory(cFactory));
}

View File

@ -86,7 +86,7 @@ public class SysUserController extends BaseController
return getDataTable(list);
}
/*@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysUser user)
@ -94,7 +94,7 @@ public class SysUserController extends BaseController
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.exportExcel(response, list, "用户数据");
}*/
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@ -313,7 +313,7 @@ public class SysUserController extends BaseController
}
/*===============================================测试====================================================*/
@DataSource(DataSourceType.QUOT)
/*@DataSource(DataSourceType.QUOT)
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
@ -328,7 +328,7 @@ public class SysUserController extends BaseController
List<List<temp>> averageAssign = ListUtils.partition(templist, 5000);
/*List<temp> list = averageAssign.get(0);*/
*//*List<temp> list = averageAssign.get(0);*//*
int num = 1;
int num2 = 1;
@ -343,9 +343,9 @@ public class SysUserController extends BaseController
materials.add(m);
num++;
/*
*//*
for(int i=1;i<63;i++){
*/
*//*
if("M001".equals(t.getM_id_M001())){
c = new cost();
@ -849,7 +849,7 @@ public class SysUserController extends BaseController
costs.add(c);num2++;
}
/* }*/
*//* }*//*
}
}
@ -859,11 +859,11 @@ public class SysUserController extends BaseController
System.out.println("materials===================="+materials.size());
System.out.println("costs======================="+costs.size());
/*insertMaterialBatch(materials);
insertCostBatch(costs);*/
*//*insertMaterialBatch(materials);
insertCostBatch(costs);*//*
batchInsert.insertMaterialBatch(materials);
batchInsert.insertCostBatch(costs);
}
}*/
@DataSource(DataSourceType.QUOT)
public void insertMaterialBatch(List<material> temp) {

View File

@ -58,4 +58,11 @@ public interface CYlMaterialMapper
* @return 结果
*/
public int deleteCYlMaterialByMaterialIds(Long[] materialIds);
/**
* 校验材料编码是否存在
* @param materialNo 编码
* @return 结果
*/
CYlMaterial checkMaterialNoUnique(String materialNo);
}

View File

@ -58,4 +58,11 @@ public interface ICYlMaterialService
* @return 结果
*/
public int deleteCYlMaterialByMaterialId(Long materialId);
/**
* 校验材料编码是否存在
* @param cYlMaterial
* @return
*/
boolean checkMaterialNoUnique(CYlMaterial cYlMaterial);
}

View File

@ -1,6 +1,10 @@
package com.ruoyi.clMaterial.service.impl;
import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.clMaterial.mapper.CYlMaterialMapper;
@ -90,4 +94,20 @@ public class CYlMaterialServiceImpl implements ICYlMaterialService
{
return cYlMaterialMapper.deleteCYlMaterialByMaterialId(materialId);
}
/**
* 校验材料编码是否存在
* @param cYlMaterial
* @return
*/
@Override
public boolean checkMaterialNoUnique(CYlMaterial cYlMaterial) {
Long materialId = StringUtils.isNull(cYlMaterial.getMaterialId()) ? -1L : cYlMaterial.getMaterialId();
CYlMaterial info = cYlMaterialMapper.checkMaterialNoUnique(cYlMaterial.getMaterialNo());
if (StringUtils.isNotNull(info) && info.getMaterialId().longValue() != materialId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
}

View File

@ -87,4 +87,11 @@ public interface CFactoryMapper
/*物料类别列表*/
List<CMaterialType> selectCTypelist();
/**
* 校验车间编码是否存在
* @param factoryNo 编码
* @return 结果
*/
CFactory checkFactoryNoUnique(String factoryNo);
}

View File

@ -60,4 +60,11 @@ public interface ICFactoryService
public int deleteCFactoryByFactoryId(Long factoryId);
Object selectCTypelist();
/**
* 校验车间编码是否存在
* @param cFactory
* @return
*/
boolean checkFactoryNoUnique(CFactory cFactory);
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.factory.service.impl;
import java.util.List;
import com.ruoyi.clMaterial.domain.CYlMaterial;
import com.ruoyi.common.constant.UserConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -134,4 +137,20 @@ public class CFactoryServiceImpl implements ICFactoryService
}
}
}
/**
* 校验车间编码是否存在
* @param cFactory
* @return
*/
@Override
public boolean checkFactoryNoUnique(CFactory cFactory) {
Long factoryId = StringUtils.isNull(cFactory.getFactoryId()) ? -1L : cFactory.getFactoryId();
CFactory info = cFactoryMapper.checkFactoryNoUnique(cFactory.getFactoryNo());
if (StringUtils.isNotNull(info) && info.getFactoryId().longValue() != factoryId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
}

View File

@ -39,6 +39,10 @@ public class CMaterial extends BaseEntity
@Excel(name = "单位")
private String materialDw;
/** 物料类型 */
@Excel(name = "物料类型")
private String typeName;
/** 物料成本信息 */
private List<CMaterialCost> cMaterialCostList;
@ -107,6 +111,14 @@ public class CMaterial extends BaseEntity
this.cMaterialCostList = cMaterialCostList;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -62,4 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{materialId}
</foreach>
</delete>
<select id="checkMaterialNoUnique" parameterType="String" resultMap="CYlMaterialResult">
select top(1) material_id, material_no from c_yl_material where material_no = #{materialNo}
</select>
</mapper>

View File

@ -128,4 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.typeNo}, #{item.typeName}, #{item.factoryId})
</foreach>
</insert>
<select id="checkFactoryNoUnique" parameterType="String" resultMap="CFactoryResult">
select top(1) factory_id, factory_no from c_factory where factory_no = #{factoryNo}
</select>
</mapper>

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialGuig" column="material_guig" />
<result property="materialDiany" column="material_diany" />
<result property="materialDw" column="material_dw" />
<result property="typeName" column="type_name" />
</resultMap>
<resultMap id="CMaterialCMaterialCostResult" type="CMaterial" extends="CMaterialResult">
@ -29,7 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectCMaterialVo">
select material_id,material_type_id, material_xingh, material_guig, material_diany, material_dw from c_material
select a.material_id,a.material_type_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw,b.type_name
from c_material a
left join c_material_type b on a.material_type_id = b.type_id
</sql>
<select id="selectCMaterialList" parameterType="CMaterial" resultMap="CMaterialResult">

View File

@ -108,10 +108,10 @@
<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="materialNo">
<el-input v-model="form.materialNo" placeholder="请输入编码" />
<el-input v-model="form.materialNo" placeholder="请输入编码" :disabled="isDis"/>
</el-form-item>
<el-form-item label="名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入名称" />
<el-input v-model="form.materialName" placeholder="请输入名称" :disabled="isDis" />
</el-form-item>
<el-form-item label="单价" prop="materialPrice">
<el-input v-model="form.materialPrice" placeholder="请输入单价" />
@ -148,6 +148,8 @@ export default {
clMaterialList: [],
//
title: "",
//
isDis: false,
//
open: false,
//
@ -168,7 +170,12 @@ export default {
{ required: true, message: "名称不能为空", trigger: "blur" }
],
materialPrice: [
{ required: true, message: "单价不能为空", trigger: "blur" }
{ required: true, message: "单价不能为空", trigger: "blur" },
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
message: "金额格式错误",
trigger: "blur"
}
]
}
};
@ -222,6 +229,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加材料管理";
this.isDis = false;
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -231,6 +239,7 @@ export default {
this.form = response.data;
this.open = true;
this.title = "修改材料管理";
this.isDis = true;
});
},
/** 提交按钮 */

View File

@ -69,20 +69,20 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table width="1000" v-loading="loading" :data="factoryList" @selection-change="handleSelectionChange">
<el-table width="100%" v-loading="loading" :data="factoryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="factoryId" v-if="false"/>
<el-table-column label="编码" align="center" prop="factoryNo" />
<el-table-column label="名称" align="center" prop="factoryName" />
<el-table-column label="人工成本占比" align="center" prop="factoryRgRatio" />
<el-table-column label="五金费用占比" align="center" prop="factoryWjRatio" />
<el-table-column label="辅料费用占比" align="center" prop="factoryFlRatio" />
<el-table-column label="电费占比" align="center" prop="factoryDfRatio" />
<el-table-column label="天然气费用占比" width="120" align="center" prop="factoryTrqRatio" />
<el-table-column label="运输费用占比" align="center" prop="factoryYsRatio" />
<el-table-column label="盘具费用占比" align="center" prop="factoryPjRatio" />
<el-table-column label="编码" width="100" align="center" prop="factoryNo" />
<el-table-column label="名称" width="100" align="center" prop="factoryName" />
<el-table-column label="人工成本占比" width="150" align="center" prop="factoryRgRatio" />
<el-table-column label="五金费用占比" width="150" align="center" prop="factoryWjRatio" />
<el-table-column label="辅料费用占比" width="150" align="center" prop="factoryFlRatio" />
<el-table-column label="电费占比" width="150" align="center" prop="factoryDfRatio" />
<el-table-column label="天然气费用占比" width="150" align="center" prop="factoryTrqRatio" />
<el-table-column label="运输费用占比" width="150" align="center" prop="factoryYsRatio" />
<el-table-column label="盘具费用占比" width="150" align="center" prop="factoryPjRatio" />
<el-table-column label="总占比" align="center" prop="factoryTotalRatio" />
<el-table-column fixed="right" label="操作" align="center" width="150" >
<el-table-column fixed="right" label="操作" align="center" width="150">
<template slot-scope="scope">
<el-button
size="mini"
@ -116,54 +116,54 @@
<el-row>
<el-col :span="12">
<el-form-item label="编码" prop="factoryNo" label-width="120px">
<el-input v-model="form.factoryNo" placeholder="请输入编码" />
<el-input v-model="form.factoryNo" placeholder="请输入编码" :disabled="isDis"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="factoryName" label-width="120px">
<el-input v-model="form.factoryName" placeholder="请输入名称" />
<el-input v-model="form.factoryName" placeholder="请输入名称" :disabled="isDis" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="人工成本占比" prop="factoryRgRatio" label-width="120px">
<el-input v-model="form.factoryRgRatio" placeholder="请输入人工成本占比" />
<el-input v-model="form.factoryRgRatio" placeholder="请输入人工成本占比" @input="wat()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="五金费用占比" prop="factoryWjRatio" label-width="120px">
<el-input v-model="form.factoryWjRatio" placeholder="请输入五金费用占比" />
<el-input v-model="form.factoryWjRatio" placeholder="请输入五金费用占比" @input="wat()"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="辅料费用占比" prop="factoryFlRatio" label-width="120px">
<el-input v-model="form.factoryFlRatio" placeholder="请输入辅料费用占比" />
<el-input v-model="form.factoryFlRatio" placeholder="请输入辅料费用占比" @input="wat()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电费占比" prop="factoryDfRatio" label-width="120px">
<el-input v-model="form.factoryDfRatio" placeholder="请输入电费占比" />
<el-input v-model="form.factoryDfRatio" placeholder="请输入电费占比" @input="wat()"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="天然气费用占比" prop="factoryTrqRatio" label-width="120px">
<el-input v-model="form.factoryTrqRatio" placeholder="请输入天然气费用占比" />
<el-input v-model="form.factoryTrqRatio" placeholder="请输入天然气费用占比" @input="wat()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运输费用占比" prop="factoryYsRatio" label-width="120px">
<el-input v-model="form.factoryYsRatio" placeholder="请输入运输费用占比" />
<el-input v-model="form.factoryYsRatio" placeholder="请输入运输费用占比" @input="wat()"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="盘费用占比" prop="factoryPjRatio" label-width="120px">
<el-form-item label="盘费用占比" prop="factoryPjRatio" label-width="120px">
<el-input v-model="form.factoryPjRatio" placeholder="请输入盘踞费用占比" />
</el-form-item>
</el-col>
@ -186,15 +186,15 @@
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" width="50" align="center" prop="index"/>
<el-table-column label="编码" prop="typeNo">
<template slot-scope="scope">
<!--<template slot-scope="scope">
<el-input v-model="scope.row.typeNo" placeholder="请输入编码" />
</template>
</template>-->
<template slot-scope="scope">
<el-select v-model="scope.row.typeNo" placeholder="请选择" @change="selectTypeChange(scope.row)">
<el-option
v-for="item in cTypeList"
:key="item.typeNo"
:label="item.typeNo"
:label="item.typeNo + '-' + item.typeName"
:value="item.typeNo"
/>
</el-select>
@ -219,6 +219,7 @@
</style>
<script>
import { listFactory, getFactory, delFactory, addFactory, updateFactory,listMaterialType } from "@/api/factory/factory";
import { numAdd,numSub,numMulti,numDiv } from "@/utils/operation";
export default {
name: "Factory",
@ -245,6 +246,9 @@ export default {
cMaterialTypeList: [],
cTypeList: [],
cTypeMap: {},
//
isDis: false,
//
title: "",
//
@ -260,6 +264,55 @@ export default {
form: {},
//
rules: {
factoryRgRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
factoryWjRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
factoryFlRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
factoryDfRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
factoryTrqRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
factoryYsRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
factoryPjRatio: [
{
pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/,
message: "格式错误",
trigger: "blur"
}
],
}
};
},
@ -335,6 +388,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加车间管理";
this.isDis = false;
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -345,6 +399,7 @@ export default {
this.cMaterialTypeList = response.data.cmaterialTypeList;
this.open = true;
this.title = "修改车间管理";
this.isDis = true;
});
},
/** 提交按钮 */
@ -415,6 +470,17 @@ export default {
selectTypeChange(row){
console.log(row.typeNo)
row.typeName = this.cTypeMap[row.typeNo];
},
//
wat(){
var RgRatio = this.form.factoryRgRatio?parseFloat(this.form.factoryRgRatio):0;
var WjRatio = this.form.factoryWjRatio?parseFloat(this.form.factoryWjRatio):0;
var FlRatio = this.form.factoryFlRatio?parseFloat(this.form.factoryFlRatio):0;
var DfRatio = this.form.factoryDfRatio?parseFloat(this.form.factoryDfRatio):0;
var TrqRatio = this.form.factoryTrqRatio?parseFloat(this.form.factoryTrqRatio):0;
var YsRatio = this.form.factoryYsRatio?parseFloat(this.form.factoryYsRatio):0;
this.form.factoryTotalRatio = (RgRatio+WjRatio+FlRatio+DfRatio+TrqRatio+YsRatio).toFixed(3)
}
}
};

View File

@ -81,6 +81,7 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="id" align="center" prop="materialId" v-if="false"/>
<el-table-column label="类型" align="center" prop="typeName" />
<el-table-column label="型号" align="center" prop="materialXingh" />
<el-table-column label="规格" align="center" prop="materialGuig" />
<el-table-column label="电压" align="center" prop="materialDiany" />
@ -122,9 +123,9 @@
<el-select v-model="form.materialTypeId" placeholder="请选择">
<el-option
v-for="item in cTypeList"
:key="item.typeNo"
:label="item.typeNo"
:value="item.typeNo"
:key="item.typeId"
:label="item.typeName"
:value="item.typeId"
/>
</el-select>
</el-form-item>
@ -166,10 +167,10 @@
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteCMaterialCost">删除</el-button>
</el-col>
</el-row>
<el-table :data="cMaterialCostList" height="350" width="100%" :row-class-name="rowCMaterialCostIndex" @selection-change="handleCMaterialCostSelectionChange" ref="cMaterialCost" :show-summary="showSum" :summary-method="tableHJ">
<el-table :data="cmaterialCostList" height="350" width="100%" :row-class-name="rowCMaterialCostIndex" @selection-change="handleCMaterialCostSelectionChange" ref="cMaterialCost" :show-summary="showSum" :summary-method="tableHJ">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="关联用料id" prop="costClId">
<el-table-column label="关联用料" width="300" prop="costClId">
<template slot-scope="scope">
<!--
<el-input v-model="scope.row.costClId" placeholder="请输入关联用料id" />
@ -178,21 +179,27 @@
<el-option
v-for="item in cmaterials"
:key="item.materialId"
:label="item.materialNo"
:label="item.materialNo + '-' +item.materialName"
:value="item.materialNo"
/>
</el-select>
</template>
</el-table-column>
<!--
<el-table-column label="关联用料" prop="materialName"></el-table-column>
-->
<el-table-column label="用量" prop="costClQty">
<template slot-scope="scope">
<el-form-item class="offset" :prop="'cmaterialCostList.' + scope.$index + '.costClQty'" :rules="rules.costClQty" label-width="0" >
<el-input v-model="scope.row.costClQty" placeholder="请输入用量" @input="wat(scope.$index)"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="用量2" prop="costClQty2">
<template slot-scope="scope">
<el-form-item class="offset" :prop="'cmaterialCostList.' + scope.$index + '.costClQty2'" :rules="rules.costClQty2" label-width="0" >
<el-input v-model="scope.row.costClQty2" placeholder="请输入用量2" @input="wat(scope.$index)"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="单价" prop="materialPrice"></el-table-column>
@ -206,7 +213,13 @@
</el-dialog>
</div>
</template>
<style scoped>
/* 根据需求设置位置上下偏移 */
.offset {
margin-top: 15px; /* 向上偏移5像素 */
margin-bottom: 15px; /* 向下偏移5像素 */
}
</style>
<script>
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, listClMaterial, listMaterialType } from "@/api/material/material";
import log from "../../monitor/job/log";
@ -235,7 +248,7 @@ export default {
//
materialList: [],
//
cMaterialCostList: [],
cmaterialCostList: [],
//
cTypeList: [],
//
@ -263,6 +276,15 @@ export default {
materialGuig: [
{ required: true, message: "规格不能为空", trigger: "blur" }
],
materialTypeId: [
{ required: true, message: "类别不能为空", trigger: "blur" }
],
costClQty: [
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误',trigger: "blur"}
],
costClQty2: [
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误',trigger: "blur"}
],
}
};
},
@ -328,7 +350,7 @@ export default {
materialDiany: null,
materialDw: null
};
this.cMaterialCostList = [];
this.cmaterialCostList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
@ -359,7 +381,7 @@ export default {
const materialId = row.materialId || this.ids
getMaterial(materialId).then(response => {
this.form = response.data;
this.cMaterialCostList = response.data.cmaterialCostList;
this.cmaterialCostList = response.data.cmaterialCostList;
this.open = true;
this.title = "修改物料管理";
this.sumPriceTotal()
@ -369,7 +391,7 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.cMaterialCostList = this.cMaterialCostList;
this.form.cmaterialCostList = this.cMaterialCostList;
if (this.form.materialId != null) {
updateMaterial(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
@ -407,16 +429,16 @@ export default {
obj.costClQty = "";
obj.costClQty2 = "";
obj.materialPrice = "";
this.cMaterialCostList.push(obj);
this.cmaterialCostList.push(obj);
},
/** 物料成本删除按钮操作 */
handleDeleteCMaterialCost() {
if (this.checkedCMaterialCost.length == 0) {
this.$modal.msgError("请先选择要删除的物料成本数据");
} else {
const cMaterialCostList = this.cMaterialCostList;
const cmaterialCostList = this.cmaterialCostList;
const checkedCMaterialCost = this.checkedCMaterialCost;
this.cMaterialCostList = cMaterialCostList.filter(function(item) {
this.cmaterialCostList = cmaterialCostList.filter(function(item) {
return checkedCMaterialCost.indexOf(item.index) == -1
});
}
@ -438,7 +460,7 @@ export default {
//
sumPriceTotal(){
this.cMaterialCostList.forEach((row, index) => {
this.cmaterialCostList.forEach((row, index) => {
this.wat(index)
})
},
@ -446,7 +468,7 @@ export default {
//
wat(index){
this.showSum = false;
let tmpObj = this.cMaterialCostList[index];
let tmpObj = this.cmaterialCostList[index];
var costClQty = tmpObj.costClQty?tmpObj.costClQty:0;
var costClQty2 = tmpObj.costClQty2?tmpObj.costClQty2:0;
var qty = numAdd(costClQty,costClQty2);

View File

@ -106,7 +106,7 @@
<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="typeNo">
<el-input v-model="form.typeNo" placeholder="请输入编码" />
<el-input v-model="form.typeNo" placeholder="请输入编码" :disabled="isDis"/>
</el-form-item>
<el-form-item label="名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入名称" />
@ -143,6 +143,8 @@ export default {
materialTypeList: [],
//
title: "",
//
isDis:false,
//
open: false,
//
@ -214,6 +216,7 @@ export default {
this.reset();
this.open = true;
this.title = "添加物料类别";
this.isDis = false;
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -223,6 +226,7 @@ export default {
this.form = response.data;
this.open = true;
this.title = "修改物料类别";
this.isDis = true;
});
},
/** 提交按钮 */