Browse Source

2024-1-29 测试管理,产品结构

master
zelian_wu 2 years ago
parent
commit
ed82acc75f
  1. 2
      src/api/chooselist/chooselist.js
  2. 12
      src/api/test/testSoBom.js
  3. 113
      src/views/modules/common/chooseListDemo.vue
  4. 16
      src/views/modules/common/numberInput.vue
  5. 2
      src/views/modules/proofing/requestForProofing.vue
  6. 16
      src/views/modules/quotation/sellForQuotation/quotationDetail.vue
  7. 6
      src/views/modules/sys/dict-data-select.vue
  8. 186
      src/views/modules/test/requestForTest.vue
  9. 611
      src/views/modules/test/testSoBom/testTable.vue

2
src/api/chooselist/chooselist.js

@ -5,3 +5,5 @@ export const getChooselist = data => createAPI(`/chooselist/getChooselist/${data
export const getChooselistData = data => createAPI(`/chooselist/getChooselistData`,'post',data) export const getChooselistData = data => createAPI(`/chooselist/getChooselistData`,'post',data)
export const chooseList = data => createAPI(`/chooselist/getChooseList`,'post',data)

12
src/api/test/testSoBom.js

@ -0,0 +1,12 @@
import {createAPI} from "../../utils/httpRequest";
/**
* 查询测试产品结构
* @param data
* @returns {*}
*/
export const selectTestSoBom = (data) => createAPI(`/test/soBom/list`,'post',data)
export const saveTestSoBom = (data) => createAPI(`/test/soBom/save`,'post',data)
export const updateTestSoBom = (data) => createAPI(`/test/soBom/update`,'post',data)
export const removeTestSoBom = (data) => createAPI(`/test/soBom/remove`,'post',data)
export const removeBatchTestSoBom = (data) => createAPI(`/test/soBom/removeBatch`,'post',data)

113
src/views/modules/common/chooseListDemo.vue

@ -0,0 +1,113 @@
<script>
import {chooseList} from "../../../api/chooselist/chooselist";
export default {
name: "chooseListDemo",
props:{
searchList:{
type: Array,
required:true
},
columnList:{
type: Array,
required: true,
},
tagNo:{
type: String,
required: true
},
useSite:{
type:Boolean,
default: true,
}
},
data(){
return{
searchModel:{},
chooseListData:[],
visible:false
}
},
methods:{
openChooseList(){
this.searchList.forEach((item)=>{
this.searchModel = {}
this.$nextTick(() => {
this.$set(this.searchModel, item.value, undefined);
});
})
this.searchBtn()
},
closeChooseList(){
this.chooseListData = [];
},
searchBtn(){
let params = JSON.parse(JSON.stringify(this.searchModel))
params.tagNo = this.tagNo
params.columnList = this.columnList.map((item)=>item.columnProp)
params.site = this.useSite?this.$store.state.user.site:''
chooseList(params).then(({data})=>{
if (data && data.code === 0){
this.chooseListData = data.baseListData;
}else {
this.$message.error(data.msg)
}
})
},
getRowData(row) {
this.visible = false
this.$emit('getBaseData',row)
},
init(){
this.visible = true
}
},
}
</script>
<template>
<div class="chooseListDemo">
<el-dialog v-bind="$attrs" :visible.sync="visible" v-on="$listeners" @open="openChooseList" @close="closeChooseList">
<el-form :model="searchModel" label-position="top">
<el-row :gutter="20">
<el-col :span="6" v-for="(item,index) in searchList" :key="index">
<el-form-item :label="item.label">
<el-input v-model="searchModel[item.value]" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label=" ">
<el-button type="primary" @click="searchBtn">查询</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
height="30vh"
:data="chooseListData"
border @row-dblclick="getRowData"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed===''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
{{ scope.row[item.columnProp] }}
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
</span>
</el-dialog>
</div>
</template>
<style scoped>
</style>

16
src/views/modules/common/numberInput.vue

@ -0,0 +1,16 @@
<script>
export default {
name:"number-input"
}
</script>
<template>
<el-input-number style="width: 100%;margin-top: -5px;" v-on="$listeners" v-bind="$attrs" :controls="false"></el-input-number>
</template>
<style scoped>
.el-input-number /deep/ .el-input__inner{
text-align: right;
padding-right: 5px !important;
}
</style>

2
src/views/modules/proofing/requestForProofing.vue

@ -188,7 +188,7 @@
<el-col :span="10"> <el-col :span="10">
<el-form-item prop="projectId" label="项目编码"> <el-form-item prop="projectId" label="项目编码">
<span slot="label" v-if="modalData.customerNo && modalData.flag === '1'" @click="chooseProjectListFlag = true"><a herf="#">项目编码</a></span> <span slot="label" v-if="modalData.customerNo && modalData.flag === '1'" @click="chooseProjectListFlag = true"><a herf="#">项目编码</a></span>
<el-input :disabled="!modalData.customerNo || modalData.flag !== '1'" :readonly="true" v-model="modalData.projectId"></el-input>
<el-input :disabled="!modalData.customerNo || modalData.flag !== '1'" v-model="modalData.projectId"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="14"> <el-col :span="14">

16
src/views/modules/quotation/sellForQuotation/quotationDetail.vue

@ -975,18 +975,18 @@
:visible.sync="partDialogFlag"> :visible.sync="partDialogFlag">
<!--搜索条件--> <!--搜索条件-->
<el-form :model="partData" ref="partDataForm" label-position="top"> <el-form :model="partData" ref="partDataForm" label-position="top">
<el-row>
<el-row :gutter="10">
<el-col :span="4"> <el-col :span="4">
<el-form-item label="材料编号" prop="toolNo"> <el-form-item label="材料编号" prop="toolNo">
<el-input v-model="partData.partNo" clearable/> <el-input v-model="partData.partNo" clearable/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4" :offset="1">
<el-col :span="4" >
<el-form-item label="材料描述" prop="toolDescription"> <el-form-item label="材料描述" prop="toolDescription">
<el-input v-model="partData.partDesc" clearable/> <el-input v-model="partData.partDesc" clearable/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4" :offset="1">
<el-col :span="4" >
<el-form-item label=" "> <el-form-item label=" ">
<el-button type="primary" @click="initPartList"> </el-button> <el-button type="primary" @click="initPartList"> </el-button>
</el-form-item> </el-form-item>
@ -3416,7 +3416,7 @@ export default {
this.computePartQuotationUnitCost(this.quotationPart); this.computePartQuotationUnitCost(this.quotationPart);
this.partDialogFlag = false; this.partDialogFlag = false;
}, },
//
//
dblClickProjectPartTable(row){ dblClickProjectPartTable(row){
row = JSON.parse(JSON.stringify(row)); row = JSON.parse(JSON.stringify(row));
this.insertQuotationDetail.productNo = row.testPartNo; this.insertQuotationDetail.productNo = row.testPartNo;
@ -3440,7 +3440,7 @@ export default {
this.componentPartModelFlag = false this.componentPartModelFlag = false
}, },
// ==================================================================================================== // ====================================================================================================
//
//
computeQuotationPartCost(){ computeQuotationPartCost(){
let amount = this.quotationPartFormTable.quotationPartList.reduce((total,currentValue)=>{ let amount = this.quotationPartFormTable.quotationPartList.reduce((total,currentValue)=>{
return total + new Decimal(currentValue.quotationUnitCost).toNumber(); return total + new Decimal(currentValue.quotationUnitCost).toNumber();
@ -3467,7 +3467,7 @@ export default {
}, },
// //
adjustCost(){ adjustCost(){
this.computeQuotationPartCost();//
this.computeQuotationPartCost();//
this.computeQuotationToolCost();// this.computeQuotationToolCost();//
this.computeQuotationRoutingCost();// this.computeQuotationRoutingCost();//
this.quotationDetailData.adjustPartCost = new Decimal(this.quotationDetailData.computePartCost).toSignificantDigits().toNumber(); this.quotationDetailData.adjustPartCost = new Decimal(this.quotationDetailData.computePartCost).toSignificantDigits().toNumber();
@ -3514,7 +3514,7 @@ export default {
this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.detailManageCost)).toSignificantDigits().toNumber(); this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.detailManageCost)).toSignificantDigits().toNumber();
}, },
/** /**
* 计算料报价单位成本
* 计算料报价单位成本
* @param row 计算对象 * @param row 计算对象
*/ */
computePartQuotationUnitCost(row){ computePartQuotationUnitCost(row){
@ -3695,7 +3695,7 @@ export default {
for (let filed in objects) { for (let filed in objects) {
let tableName = filed.split(".")[0]; let tableName = filed.split(".")[0];
filed = filed.split(".")[2]; filed = filed.split(".")[2];
tableName = tableName === "quotationToolList" ? "工具" : tableName === "quotationRoutingList" ? "工艺" : "料";
tableName = tableName === "quotationToolList" ? "工具" : tableName === "quotationRoutingList" ? "工艺" : "料";
for (let i = 0; i < labels.length; i++) { for (let i = 0; i < labels.length; i++) {
let quotationToolColumn = labels[i]; let quotationToolColumn = labels[i];
if (quotationToolColumn.label === filed) { if (quotationToolColumn.label === filed) {

6
src/views/modules/sys/dict-data-select.vue

@ -24,6 +24,10 @@ export default {
useDefaultValue:{ useDefaultValue:{
type:Boolean, type:Boolean,
default:true, default:true,
},
useSite:{
type:Boolean,
default:true,
} }
}, },
data () { data () {
@ -48,7 +52,7 @@ export default {
async initOption () { async initOption () {
// //
let params = { let params = {
site:this.$store.state.user.site,
site:this.useSite?this.$store.state.user.site:"*",
dictType:this.dictType dictType:this.dictType
} }
try { try {

186
src/views/modules/test/requestForTest.vue

@ -140,7 +140,7 @@
</el-pagination> </el-pagination>
<!-- 测试模态框 --> <!-- 测试模态框 -->
<el-dialog :title="modalData.title" @close="closeModalDiaLog" @open="getProjectPartList()" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" top="10vh" width="60%">
<el-dialog :title="modalData.title" @close="closeModalDiaLog" @open="getProjectPartList()" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" top="10vh" width="60%">
<el-form label-position="top" ref="modalForm" :model="modalData" :rules="rules"> <el-form label-position="top" ref="modalForm" :model="modalData" :rules="rules">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :span="8"> <el-col :span="8">
@ -239,51 +239,77 @@
</el-row> </el-row>
</el-form> </el-form>
<div class="rq"> <div class="rq">
<el-form :inline="true" label-position="top" :model="projectPartData">
<el-form-item label="产品编码">
<el-input v-model="projectPartData.testPartNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="产品名称">
<el-input v-model="projectPartData.partName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item label=" " v-if="this.modalData.projectId">
<el-button type="primary" @click="getProjectPartList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="projectPartList"
ref="projectPartTable"
@row-click="projectPartClickRow"
@selection-change="selectionProjectPart"
:row-key="getRowKeys"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
:selectable="checkSelectable"
:reserve-selection="true"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in projectPartDetailList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed===''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-tabs v-model="activeTab">
<el-tab-pane label="物料信息" name="part">
<el-form label-position="top" :model="projectPartData">
<el-row :gutter="20">
<el-col :span="4">
<el-form-item label="产品编码">
<el-input v-model="projectPartData.testPartNo" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="产品名称">
<el-input v-model="projectPartData.partName" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label=" ">
<el-button type="primary" @click="getProjectPartList()">查询</el-button>
</el-form-item>
</el-col>
<el-col :span="4" :offset="8">
<el-form-item label=" ">
<el-button v-if="this.modalData.flag === '1'" type="primary" style="float: right;margin-right: 8px" @click="saveData">下一步</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:height="300"
:data="projectPartList"
ref="projectPartTable"
@row-click="projectPartClickRow"
@selection-change="selectionProjectPart"
:row-key="getRowKeys"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
:selectable="checkSelectable"
:reserve-selection="true"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in projectPartDetailList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed===''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="产品结构" :disabled="!activeTabList.includes('product')" name="product">
<test-table ref="dialogSoBom" :data-list="testSoBomList" :test-no="modalData.testNo" v-model:column-list="testSoBomList"></test-table>
</el-tab-pane>
<el-tab-pane label="工艺路线" :disabled="!activeTabList.includes('process')" name="process">
<div>
<el-button type="primary">新增</el-button>
<el-button type="primary">删除</el-button>
</div>
</el-tab-pane>
</el-tabs>
</div> </div>
<el-footer style="height:30px;text-align:center;margin-top: 8px"> <el-footer style="height:30px;text-align:center;margin-top: 8px">
<el-button type="primary" @click="saveData()">保存</el-button> <el-button type="primary" @click="saveData()">保存</el-button>
@ -556,6 +582,9 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="产品结构" name="test_so_bom" style="padding: 5px">
<test-table ref="tabSoBom" :data-list="testSoBomList" :test-no="testCurrentRow.testNo" :height="500" v-model:column-list="testSoBomList"></test-table>
</el-tab-pane>
<!-- 项目信息页签 --> <!-- 项目信息页签 -->
<el-tab-pane label="项目信息" name="project_information"> <el-tab-pane label="项目信息" name="project_information">
<el-form label-position="top" :model="projectInformationData" style="margin-left: 10px;margin-top: 5px;margin-right: 10px"> <el-form label-position="top" :model="projectInformationData" style="margin-left: 10px;margin-top: 5px;margin-right: 10px">
@ -861,8 +890,16 @@
import Chooselist from '@/views/modules/common/Chooselist' import Chooselist from '@/views/modules/common/Chooselist'
import testUploadFile from "./test_upload_file" import testUploadFile from "./test_upload_file"
import DictDataSelect from "../sys/dict-data-select.vue"; import DictDataSelect from "../sys/dict-data-select.vue";
import {
selectTestSoBom,
saveTestSoBom,
removeTestSoBom,
updateTestSoBom
} from "../../../api/test/testSoBom";
import TestTable from "./testSoBom/testTable.vue";
export default { export default {
components: { components: {
TestTable,
DictDataSelect, DictDataSelect,
Chooselist, Chooselist,
testUploadFile testUploadFile
@ -886,6 +923,9 @@
}, },
data () { data () {
return { return {
testSoBomList:[],
activeTab:'part',
activeTabList:['part'],
// //
exportData: [], exportData: [],
exportName: '设备分类' + this.dayjs().format('YYYYMMDDHHmmss'), exportName: '设备分类' + this.dayjs().format('YYYYMMDDHHmmss'),
@ -1524,7 +1564,7 @@
columnProp: 'testPartNo', columnProp: 'testPartNo',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
columnLabel: '产品编码',
columnLabel: '物料编码',
columnHidden: false, columnHidden: false,
columnImage: false, columnImage: false,
columnSortable: false, columnSortable: false,
@ -1542,7 +1582,7 @@
columnProp: 'partDesc', columnProp: 'partDesc',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
columnLabel: '产品名称',
columnLabel: '物料名称',
columnHidden: false, columnHidden: false,
columnImage: false, columnImage: false,
columnSortable: false, columnSortable: false,
@ -1559,7 +1599,7 @@
columnProp: 'partType', columnProp: 'partType',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
columnLabel: '产品类型',
columnLabel: '物料类型',
columnHidden: false, columnHidden: false,
columnImage: false, columnImage: false,
columnSortable: false, columnSortable: false,
@ -1744,7 +1784,8 @@
* @param row * @param row
*/ */
projectPartClickRow (row) { projectPartClickRow (row) {
if (this.modalData.flag === '1'){
if (this.modalData.flag === '1' && this.activeTabList.length === 1){
this.$refs.projectPartTable.clearSelection();
this.$refs.projectPartTable.toggleRowSelection(row); this.$refs.projectPartTable.toggleRowSelection(row);
this.confirmProjectPart(); this.confirmProjectPart();
} }
@ -1946,6 +1987,10 @@
nextToDo: row.nextToDo, nextToDo: row.nextToDo,
updateBy: this.$store.state.user.name updateBy: this.$store.state.user.name
} }
this.activeTabList = ['part','product','process']
this.$nextTick(()=>{
this.$refs.dialogSoBom.clearTable();
})
this.modalDisableFlag = true this.modalDisableFlag = true
this.modalFlag = true this.modalFlag = true
}, },
@ -2074,14 +2119,14 @@
saveTest(){ saveTest(){
testInformationSave(this.modalData).then(({data}) => { testInformationSave(this.modalData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
this.getDataList();
this.activeTabList = ['part','product','process']
this.activeTab = 'product'
this.modalData.testNo = data.row
this.testSoBomList = []
// this.modalFlag = false
this.$message.success("操作成功")
this.selectTestSoBom();
} else { } else {
this.$alert(data.msg, '错误', { this.$alert(data.msg, '错误', {
confirmButtonText: '确定' confirmButtonText: '确定'
@ -2152,6 +2197,12 @@
// this.$refs.testTable.toggleRowSelection(row) // this.$refs.testTable.toggleRowSelection(row)
this.testCurrentRow = JSON.parse(JSON.stringify(row)) this.testCurrentRow = JSON.parse(JSON.stringify(row))
this.testDetailData = JSON.parse(JSON.stringify(row)) this.testDetailData = JSON.parse(JSON.stringify(row))
if (row){
this.$nextTick(()=>{
this.$refs.tabSoBom.clearTable();
})
this.selectTestSoBom()
}
}, },
/** /**
* 复选报价信息 * 复选报价信息
@ -2555,9 +2606,11 @@
updateDate: '', updateDate: '',
updateBy: '' updateBy: ''
} }
this.activeTab = 'part';
this.activeTabList = ['part']
}, },
checkSelectable(row,index){ checkSelectable(row,index){
if (this.modalData.flag === '1'){
if (this.modalData.flag === '1' && this.activeTabList.length === 1){
return true return true
}else { }else {
return false return false
@ -2597,6 +2650,21 @@
return { 'background-color': '#E8F7F6', cursor: 'pointer' }; return { 'background-color': '#E8F7F6', cursor: 'pointer' };
} }
}, },
selectTestSoBom(){
let params = {
testNo:this.modalData.testNo?this.modalData.testNo:this.testCurrentRow.testNo,
site:this.$store.state.user.site
}
selectTestSoBom(params).then(({data})=>{
if (data && data.code === 0 ){
this.testSoBomList = data.rows
}else {
this.$message.error(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
}
} }
} }
</script> </script>

611
src/views/modules/test/testSoBom/testTable.vue

@ -0,0 +1,611 @@
<script>
import {
selectTestSoBom,
saveTestSoBom,
removeTestSoBom,
updateTestSoBom,
removeBatchTestSoBom
} from "../../../../api/test/testSoBom";
import {searchPart, searchPartList} from '@/api/part/partInformation.js';
import numberInput from "../../common/numberInput.vue";
export default {
name: "testTable",
components:{
numberInput,
},
props:{
dataList:{
type: Array,
default:[],
},
testNo:{
type:String,
required:true
},
columnList:{
type: Array,
default: ()=>[],
},
height:{
type:Number,
default:300
}
},
model:{
prop:"dataList",
event:"change"
},
data(){
return{
partList:[],
partData:{
partNo:undefined,
partDesc:undefined,
site:this.$store.state.user.site
},
partDialogFlag:false,
testSoBomLabel:{
componentPartNo: "物料编码",
partDesc:"物料描述",
requiredQty:"需求数量",
assemblyQty:"单位用量",
fixedScrapQty:"固定损耗",
scrapFactor:"报废率"
},
testSoBomRule:{
componentPartNo: [{required: true,message: ' ',trigger: ['change','blur']}],
partDesc: [{required: true,message: ' ',trigger: ['change','blur']}],
requiredQty: [{required: true,message: ' ',trigger: ['change','blur']}],
assemblyQty: [{required: true,message: ' ',trigger: ['change','blur']}],
fixedScrapQty: [{required: true,message: ' ',trigger: ['change','blur']}],
scrapFactor: [{required: true,message: ' ',trigger: ['change','blur']}],
},
testSoBom:{
site:this.$store.state.user.site,
testNo:undefined,
itemNo:undefined,
componentPartNo:undefined,
partDesc:undefined,
assemblyQty:0,
fixedScrapQty:0,
scrapFactor:0,
requiredQty:0,
issuedQty:undefined,
issuedDate:undefined,
reserveQty:0,
mateGroup:undefined,
notifiedQty:undefined,
rmTypeDb:0,
issuedType:undefined,
remark:undefined,
},
selectionTestSoBomList:[],
testSoBomColumnList:[{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3ItemNo',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'itemNo',
headerAlign: 'center',
align: 'center',
columnLabel: '序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3ComponentPartNo',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'componentPartNo',
headerAlign: 'center',
align: 'left',
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3PartDesc',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'partDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3Spec',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'spec',
headerAlign: 'center',
align: 'left',
columnLabel: '规格型号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3AssemblyQty',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'assemblyQty',
headerAlign: 'center',
align: 'left',
columnLabel: '单位用量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3FixedScrapQty',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'fixedScrapQty',
headerAlign: 'center',
align: 'left',
columnLabel: '固定损耗',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3UmName',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'umName',
headerAlign: 'center',
align: 'left',
columnLabel: '计量单位',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3ScrapFactor',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'scrapFactor',
headerAlign: 'center',
align: 'left',
columnLabel: '报废率',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3RequiredQty',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'requiredQty',
headerAlign: 'center',
align: 'left',
columnLabel: '需求数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3ReserveQty',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'reserveQty',
headerAlign: 'center',
align: 'left',
columnLabel: '预留数量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},
// {
// userId: this.$store.state.user.name,
// functionId: 102001,
// serialNumber: '102001Table3IssuedDate',
// tableId: '102001Table3',
// tableName: '',
// columnProp: 'issuedDate',
// headerAlign: 'center',
// align: 'left',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: '',
// columnWidth: 100
// },
{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3Remark',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'remark',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},{
userId: this.$store.state.user.name,
functionId: 102001,
serialNumber: '102001Table3rmTypeDb',
tableId: '102001Table3',
tableName: '测试产品结构',
columnProp: 'rmTypeDb',
headerAlign: 'center',
align: 'left',
columnLabel: '是否主物料',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 100
},],
saveOrUpdateFlag:false,
}
},
created() {
if (this.columnList.length !== 0){
this.testSoBomColumnList = this.columnList
}
},
methods:{
closePartDialog(){
this.partData = {
partNo: undefined,
partDesc: undefined,
site:this.$store.state.user.site
}
this.partList = [];
},
initPartList(){
searchPartList(this.partData).then(({data})=>{
if (data && data.code === 200) {
this.partList = data.data;
}
})
},
dblClickPartTable(row){
this.testSoBom.componentPartNo = row.partNo;
this.testSoBom.partDesc = row.partDesc;
this.partDialogFlag = false;
},
testSoBomClickRow(row,column){
if (column.label !== '操作'){
this.$refs.testSoBomTable.toggleRowSelection(row,true)
}
},
selectionTestSoBom(rows){
this.selectionTestSoBomList = rows;
},
saveTestSoBom(row){
if (row){
this.testSoBom = JSON.parse(JSON.stringify(row))
}
this.saveOrUpdateFlag = true
},
removeBatchTestSoBom(){
if (this.dataList.length === 0){
this.$message.warning("请勾选需要删除的信息")
return
}
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeBatchTestSoBom(this.selectionTestSoBomList).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg)
this.selectTestSoBom();
this.$refs.testSoBomTable.clearSelection()
}else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
}).catch((error)=>{
this.$alert(error, '错误', {
confirmButtonText: '确定'
})
})
}).catch(() => {});
},
closeTestSoBom(){
this.$refs.saveForm.resetFields();
this.testSoBom = {
site:this.$store.state.user.site,
testNo:undefined,
itemNo:undefined,
componentPartNo:undefined,
assemblyQty:0,
fixedScrapQty:0,
scrapFactor:0,
requiredQty:0,
issuedQty:undefined,
issuedDate:undefined,
reserveQty:0,
mateGroup:undefined,
notifiedQty:undefined,
rmTypeDb:0,
issuedType:undefined,
remark:undefined,
}
},
clearTable(){
this.$emit("change",[])
this.$refs.testSoBomTable.clearSelection();
},
selectTestSoBom(){
let params = {
testNo:this.testNo,
site:this.$store.state.user.site
}
this.$emit("change",[])
this.$refs.testSoBomTable.clearSelection();
selectTestSoBom(params).then(({data})=>{
if (data && data.code === 0 ){
this.$emit("change",data.rows)
}else {
this.$message.error(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
saveTestSoBomBtn(){
this.$refs.saveForm.validate((validate,objects)=>{
if (validate){
console.log(this.testSoBom.itemNo)
if (this.testSoBom.itemNo !== undefined && this.testSoBom.itemNo !== null && this.testSoBom.itemNo !== ''){
updateTestSoBom(this.testSoBom).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg)
this.selectTestSoBom()
this.saveOrUpdateFlag = false
}else {
this.$message.error(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
}else {
this.testSoBom.testNo = this.testNo
saveTestSoBom(this.testSoBom).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg)
this.selectTestSoBom()
this.saveOrUpdateFlag = false
}else {
this.$message.error(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
}
}else {
for (let key in objects) {
this.$message.error(this.testSoBomLabel[key]+"不能为空")
}
}
})
}
},
}
</script>
<template>
<div class="testTable">
<div style="margin-bottom: 5px">
<el-button type="primary" @click="saveTestSoBom(null)">新增</el-button>
<el-button type="primary" @click="removeBatchTestSoBom">删除</el-button>
</div>
<el-table
:height="height" border
:data="dataList"
ref="testSoBomTable"
@row-click="testSoBomClickRow"
@selection-change="selectionTestSoBom">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in testSoBomColumnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed===''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right">
<template slot-scope="{row,$index}">
<a type="text" style="cursor:pointer;" @click="saveTestSoBom(row)">编辑</a>
</template>
</el-table-column>
</el-table>
<el-dialog :title="testSoBom.itemNo?'编辑':'新增'+'-产品结构'" v-drag width="35vw" append-to-body :visible.sync="saveOrUpdateFlag" @close="closeTestSoBom">
<el-form ref="saveForm" label-position="top" :model="testSoBom" :rules="testSoBomRule">
<el-row :gutter="15">
<el-col :span="16">
<el-row :gutter="15">
<el-col :span="12">
<el-form-item label="物料编码" prop="componentPartNo">
<span slot="label" @click="partDialogFlag = true"><a>物料编码</a></span>
<el-input readonly v-model="testSoBom.componentPartNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料名称" prop="partDesc">
<el-input disabled v-model="testSoBom.partDesc"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-form-item label="需求数量" prop="requiredQty">
<el-input-number style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.requiredQty" :controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位用量" prop="assemblyQty">
<el-input-number style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.assemblyQty" :controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="固定损耗" prop="fixedScrapQty">
<el-input-number style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.fixedScrapQty" :controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废率%" prop="scrapFactor">
<el-input-number style="width: 100%;margin-top: -5px;" :max="100" :min="0" v-model="testSoBom.scrapFactor" :controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8" v-if="false">
<el-form-item label="发料数量" prop="issuedQty">
<el-input-number style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.issuedQty" :controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8" v-if="false">
<el-form-item label="发料日期" prop="issuedDate">
<el-input v-model="testSoBom.issuedDate"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="预留数量" prop="reserveQty">
<el-input-number style="width: 100%;margin-top: -5px;" :min="0" v-model="testSoBom.reserveQty" :controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label=" " prop="rmTypeDb">
<el-checkbox :true-label="1" :false-label="0" v-model="testSoBom.rmTypeDb">是否主物料</el-checkbox>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark" style="height: 90px">
<el-input type="textarea" resize='none' :autosize="{ minRows: 3, maxRows: 3 }" v-model="testSoBom.remark"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveTestSoBomBtn"> </el-button>
<el-button @click="saveOrUpdateFlag = false"> </el-button>
</span>
</el-dialog>
<el-dialog title="物料列表" width="30%"
@close="closePartDialog" v-drag
:visible.sync="partDialogFlag">
<!--搜索条件-->
<el-form :model="partData" ref="partDataForm" label-position="top">
<el-row :gutter="10">
<el-col :span="6">
<el-form-item label="物料编号" prop="partNo">
<el-input v-model="partData.partNo" clearable/>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label="物料描述" prop="partDesc">
<el-input v-model="partData.partDesc" clearable/>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item label=" ">
<el-button type="primary" @click="initPartList"> </el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!--筛选的数据-->
<el-table :data="partList" ref="partDataTable" :style="{marginTop:'5px'}"
height="200px" stripe border width="30%"
@row-dblclick="dblClickPartTable">
<el-table-column label="物料编号" prop="partNo"/>
<el-table-column label="物料描述" prop="partDesc"/>
</el-table>
</el-dialog>
</div>
</template>
<style scoped>
.el-input-number /deep/ .el-input__inner{
text-align: right;
padding-right: 5px !important;
}
</style>
Loading…
Cancel
Save