家里的样式

This commit is contained in:
zhangdingyu
2019-09-18 09:34:02 +08:00
commit 02d1678fff
681 changed files with 133918 additions and 0 deletions

View File

@@ -0,0 +1,422 @@
<template>
<div>
<el-card>
<el-row>
<el-radio-group v-show="false" v-model="radio" style="margin: 10px;" @change="radioChange">
<el-radio :label="1">未编制</el-radio>
<el-radio :label="2">已编制</el-radio>
</el-radio-group>
<!--<span>项目名称:</span>-->
<!--<el-select v-model="entryNameValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="项目名称" @change="typeChange()">-->
<!--<el-option-->
<!--v-for="item in entryName"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<span>机床名称:</span>
<el-select v-model="toolNumValue" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="机床号" @change="typeChange1()">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<!--<el-select v-model="toolNumValue" clearable filterable size="small" placeholder="机床号" style="margin-bottom:10px" @change="typeChange1()">-->
<!--<el-option-->
<!--v-for="item in toolNum"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<span>分组:</span>
<el-select v-model="NumValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="机床组号">
<el-option
v-for="item in Num"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span>
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize2=10; pageCurrent2=1;searchPartNum()">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="tableData2" highlight-current-row height="370" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="零件图号" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="220px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="种类" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.零件类型名称 }}
</template>
</el-table-column>
<el-table-column label="投产数量" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center">
<template slot-scope="scope">
{{ scope.row.原材料规格 }}
</template>
</el-table-column>
<!--<el-table-column label="面积" width="110" align="center">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.面积 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column label="重量" width="110" align="center">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.重量 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column label="材料费" width="110" align="center">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.材料费 }}-->
<!--</template>-->
<!--</el-table-column>-->
<!--<el-table-column label="操作" align="center" width="150px" fixed="right">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--size="mini"-->
<!--type="primary"-->
<!--class="el-icon-edit"-->
<!--@click="edit(scope.$index, scope.row, 'form')">编辑</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" :summary-method="getSummaries" border style="width: 100%;max-height: 390px;" height="340px" size="small" stripe show-summary>
<el-table-column label="序号" width="80" align="center" type="index"/>
<el-table-column label="工艺名称" width="200" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].工艺名称" size="mini" placeholder="工艺名称" readonly/>
</template>
</el-table-column>
<el-table-column label="工艺要求" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].工艺要求" :autosize="{ minRows: 1, maxRows: 1}" size="mini" readonly type="textarea"/>
</template>
</el-table-column>
<el-table-column label="单件" width="110" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].单件定额工时_系数" size="mini" readonly/>
</template>
</el-table-column>
<el-table-column label="准结" width="110" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].准结定额工时" size="mini" readonly/>
</template>
</el-table-column>
<el-table-column label="外协预算价格" width="110" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].外协预算价格_计算" size="mini" />
</template>
</el-table-column>
</el-table>
<el-button size="small" type="primary" style="float:right;margin: 10px" @click="saveRowPrice">保存</el-button>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="编辑" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="面积" prop="面积" style="margin-left: 200px">
<el-input v-model="form.面积" placeholder="面积" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="重量" prop="重量" style="margin-left: 200px">
<el-input v-model="form.重量" placeholder="重量" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="材料费" prop="材料费" style="margin-left: 200px">
<el-input v-model="form.材料费" placeholder="材料费" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { machine, getToolNum, getNum, searchPartNum1, searchTable, saveWeightArea, saveMaterialPrice, saveRowPrice } from '@/api/Outsourcing/InterBudgetaryBudgets'
export default {
data() {
return {
a: '',
entryNameValue: '',
entryName: [], // 项目名称
toolNumValue: '',
toolNum: [], // 机床号
NumValue: '',
Num: [], // 分组
lingjianhao: '',
dialogFormVisible: false,
form: {
面积: '',
重量: '',
材料费: ''
},
rules: {
},
cailiaofei: '',
result: [],
result2: [],
radio: 1,
partName: '', // 零件名称
loading0: false,
tableData: [],
loading2: false,
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1 // 后台获取页
}
},
created() {
this.typeChange()
this.searchPartNum()
},
methods: {
radioChange() {
this.tableData2 = []
this.entryNameValue = ''
this.toolNumValue = ''
this.NumValue = ''
},
fetchData() {
this.entryNameValue = ''
this.entryName = []
machine().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.entryName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
this.NumValue = ''
this.Num = []
getToolNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
},
typeChange1() {
this.NumValue = ''
this.Num = []
getNum(this.toolNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Num.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
// 查零件号
searchPartNum() {
if (this.partName === null) {
this.partName = ''
}
if (this.entryNameValue !== null && this.entryNameValue !== '') {
this.check_entryNameValue = 1
} else {
this.check_entryNameValue = 0
}
if (this.toolNumValue !== null && this.toolNumValue !== '') {
this.check_toolNumValue = 1
} else {
this.check_toolNumValue = 0
}
if (this.NumValue !== null && this.NumValue !== '') {
this.check_NumValue = 1
} else {
this.check_NumValue = 0
}
if (this.partName !== null && this.partName !== '') {
this.check_partName = 1
} else {
this.check_partName = 0
}
this.loading2 = true
this.tableData2 = []
this.tableData = []
if (this.radio === 1) {
searchPartNum1(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, 0, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
} else {
searchPartNum1(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, 1, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
}
},
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = ['', '', '', '', '', 0]
columns.forEach((column, index) => {
if (index === 1) {
sums[1] = '统计总价:'
return
} else if (index === 5) {
for (let i = 0; i < data.length; i++) {
sums[5] += parseFloat(data[i].外协预算价格_计算)
}
sums[5] = parseInt(sums[5] * 100) / 100
}
})
return sums
},
searchTable(row) {
this.loading0 = true
this.tableData = []
searchTable(row.工艺计划流水号, 1).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].外协预算价格_计算 !== 0) {
response.data[i].外协预算价格_计算 = response.data[i].外协预算价格_计算.toFixed(2)
}
}
this.cailiaofei = row.材料费
this.tableData = response.data
this.loading0 = false
})
},
// 打开编辑
edit(index, row) {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.面积 = row.面积
this.form.重量 = row.重量
this.form.材料费 = row.材料费
this.lingjianhao = row.工艺计划流水号
this.dialogFormVisible = true
},
// 编辑确定
submit(formName) {
this.WithdrawingEdit()
this.dialogFormVisible = false
},
// 编辑
WithdrawingEdit() {
if ((this.form.重量 === '' || this.form.重量 === null) && (this.form.面积 === '' || this.form.面积 === null)) {
this.form.重量 = null
this.form.面积 = null
}
saveWeightArea(this.lingjianhao, this.form.重量, this.form.面积).then(response => {
this.WithdrawingEdit2()
})
},
WithdrawingEdit2() {
if (this.form.材料费 === '' || this.form.材料费 === null) {
this.form.材料费 = 0
}
saveMaterialPrice(this.lingjianhao, this.form.材料费).then(response => {
this.$message.success('保存成功')
this.searchPartNum()
})
},
// 关闭扣款编辑
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
// 保存行价格
saveRowPrice() {
if (this.tableData.length === 0) {
this.$message.error('请选择零件')
} else {
this.a = 0
for (let i = 0; i < this.tableData.length; i++) {
saveRowPrice(this.tableData[i].工序流水号, parseFloat(this.tableData[i].外协预算价格_计算), this.tableData[i].工艺计划流水号, this.cailiaofei).then(response => {
this.a += parseInt(response.data[0].result)
if (this.a === this.tableData.length) {
this.$message.success('保存成功')
this.searchPartNum()
}
})
}
}
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.searchPartNum()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchPartNum()
}
}
}
</script>
<style scoped>
span{
margin: 10px 0 10px 10px;
}
.el-date-editor{
width:150px
}
.el-card{
margin-bottom: 15px;
}
</style>

View File

@@ -0,0 +1,415 @@
<template>
<div class="app-container">
<el-card>
<span>厂家名称</span>
<el-input v-model="ManufacturerName" clearable size="small" style="width:200px;margin:10px;"/>
<span>电话</span>
<el-input v-model="phNumber" size="small" clearable style="width:200px;margin:10px;"/>
<el-button type="success" class="el-icon-search" size="small" @click="pageCurrent=1;pageSize=10;searchTable()">查询</el-button>
<el-button type="primary" class="el-icon-circle-plus-outline" size="small" @click="editType1('form');param = 0">新增</el-button>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" height="650" style="width: 100%;" border>
<el-table-column
label=" "
align="center"
type="index"
width="50"/>
<el-table-column label="外协厂家名称" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="外协厂家简称" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.外协厂家简称 }}
</template>
</el-table-column>
<el-table-column label="地址" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.地址 }}
</template>
</el-table-column>
<el-table-column label="联系人" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.联系人 }}
</template>
</el-table-column>
<el-table-column label="电话" align="center" width="200px">
<template slot-scope="scope">
{{ scope.row.电话 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150px" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="handleChange1(scope.$index, scope.row, 'form');param = 1">编辑</el-button>
<!--<el-button-->
<!--size="mini"-->
<!--type="danger"-->
<!--class="el-icon-delete"-->
<!--@click="handleDelete(scope.$index, scope.row)">删除</el-button>-->
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading0"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :title="title1" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="厂家名称" prop="ManufacturerName" >
<el-input v-model="form.ManufacturerName" placeholder="厂家名称" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厂家简称" prop="ManufacturerAbbreviation">
<el-input v-model="form.ManufacturerAbbreviation" placeholder="厂家简称" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="地址" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人" prop="roleName">
<el-input v-model="form.roleName" placeholder="联系人" clearable size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="电话" prop="phNumber">
<el-input v-model="form.phNumber" placeholder="电话" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="传真" prop="Fax">
<el-input v-model="form.Fax" placeholder="传真" clearable size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备情况" prop="EquipmentCondition">
<el-input v-model="form.EquipmentCondition" placeholder="设备情况" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="Remarks">
<el-input v-model="form.Remarks" placeholder="备注" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')" >确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchtable, edittype, handlechange, handledelete } from '@/api/Outsourcing/OutFactoryMaintenance'
export default {
data() {
return {
loading0: false,
count1: 0,
count2: 0, // 清表单验证计数器
ManufacturerNumber: '', // 厂家序号
num1: '',
ManufacturerName: '', // 厂家名称
num2: '',
address: '', // 地址
num3: '',
roleName: '', // 联系人
num4: '',
phNumber: '', // 电话
num5: '',
Fax: '', // 传真
num6: '',
Remarks: '', // 备注
num7: '',
category: '', // 类别
num8: '',
EquipmentCondition: '', // 设备情况
num9: '',
ManufacturerAbbreviation: '', // 厂家简称
num10: '',
attention: '', // 关注
num11: '',
tableData: [], // 表格数据
pageSize: 10,
pageCurrent: 1,
total: 0,
CoManufacturerFlowNumber: '', // 外协厂家流水号
CoManufacturerFlowNumber1: '',
dialogFormVisible: false,
title1: '',
form: {
ManufacturerNumber: '', // 厂家序号
ManufacturerName: '', // 厂家名称
address: '', // 地址
roleName: '', // 联系人
phNumber: '', // 电话
Fax: '', // 传真
Remarks: '', // 备注
category: '', // 类别
EquipmentCondition: '', // 设备情况
ManufacturerAbbreviation: '', // 厂家简称
attention: '' // 关注
},
rules: {
ManufacturerName: [{ required: true, message: '请输入厂家名称', trigger: 'blur' }],
ManufacturerAbbreviation: [{ required: true, message: '请输入厂家简称', trigger: 'blur' }]
}
}
},
created() {
this.searchTable()
},
methods: {
// 查询
searchTable() {
this.loading0 = true
if (this.ManufacturerNumber !== '' && this.ManufacturerNumber !== null) {
this.num1 = 1
} else {
this.num1 = 0
this.ManufacturerNumber = ''
}
if (this.ManufacturerName !== '' && this.ManufacturerName !== null) {
this.num2 = 1
} else {
this.num2 = 0
this.ManufacturerName = ''
}
if (this.ManufacturerAbbreviation !== '' && this.ManufacturerAbbreviation !== null) {
this.num10 = 1
} else {
this.num10 = 0
this.ManufacturerAbbreviation = ''
}
if (this.address !== '' && this.address !== null) {
this.num3 = 1
} else {
this.num3 = 0
this.address = ''
}
if (this.roleName !== '' && this.roleName !== null) {
this.num4 = 1
} else {
this.num4 = 0
this.roleName = ''
}
if (this.phNumber !== '' && this.phNumber !== null) {
this.num5 = 1
} else {
this.num5 = 0
this.phNumber = ''
}
if (this.Fax !== '' && this.Fax !== null) {
this.num6 = 1
} else {
this.num6 = 0
this.Fax = ''
}
if (this.Remarks !== '' && this.Remarks !== null) {
this.num7 = 1
} else {
this.num7 = 0
this.Remarks = ''
}
if (this.category !== '' && this.category !== null) {
this.num8 = 1
} else {
this.num8 = 0
this.category = ''
}
if (this.attention !== '' && this.attention !== null) {
this.num11 = 1
} else {
this.num11 = 0
this.attention = ''
}
if (this.EquipmentCondition !== '' && this.EquipmentCondition !== null) {
this.num9 = 1
} else {
this.num9 = 0
this.EquipmentCondition = ''
}
searchtable(this.pageCurrent, this.pageSize, this.num1, this.ManufacturerNumber, this.num2, this.ManufacturerName, this.num10, this.ManufacturerAbbreviation, this.num3, this.address, this.num4, this.roleName, this.num5, this.phNumber, this.num6, this.Fax, this.num7, this.Remarks, this.num8, this.category, this.num11, this.attention, this.num9, this.EquipmentCondition).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading0 = false
})
},
// 点击增加
editType1(formName) {
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
this.title1 = '增加'
this.form.ManufacturerName = ''
this.form.ManufacturerNumber = ''
this.form.address = ''
this.form.roleName = ''
this.form.phNumber = ''
this.form.Fax = ''
this.form.Remarks = ''
this.form.category = ''
this.form.EquipmentCondition = ''
this.form.ManufacturerAbbreviation = ''
this.form.attention = ''
this.dialogFormVisible = true
},
// 增加确定
editType() {
edittype(this.form.ManufacturerNumber, this.form.ManufacturerName, this.form.ManufacturerAbbreviation, this.form.address, this.form.roleName, this.form.phNumber, this.form.Fax, this.form.Remarks, this.form.category, this.form.attention, this.form.EquipmentCondition).then(response => {
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息增加成功',
type: 'success'
})
this.pageCurrent = 1
this.pageSize = 10
this.searchTable()
} else {
this.$message.error('信息增加失败')
}
})
this.dialogFormVisible = false
},
// 编辑打开
handleChange1(index, row, formName) {
this.count2 = this.count2 + 1
if (this.count2 !== 1) {
this.$refs[formName].resetFields()
}
this.form.ManufacturerNumber = row.序号
this.form.ManufacturerName = row.外协厂家名称
this.form.address = row.地址
this.form.roleName = row.联系人
this.form.phNumber = row.电话
this.form.Fax = row.传真
this.form.Remarks = row.备注
this.form.category = row.类别
this.form.EquipmentCondition = row.设备情况
this.form.ManufacturerAbbreviation = row.外协厂家简称
this.form.attention = row.关注
this.dialogFormVisible = true
this.title1 = '编辑'
this.CoManufacturerFlowNumber1 = row.外协厂家流水号
},
// 编辑确定
handleChange() {
handlechange(this.CoManufacturerFlowNumber1, this.form.ManufacturerNumber, this.form.ManufacturerName, this.form.ManufacturerAbbreviation, this.form.address, this.form.roleName, this.form.phNumber, this.form.Fax, this.form.Remarks, this.form.category, this.form.attention, this.form.EquipmentCondition).then(response => {
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.searchTable()
} else {
this.$message.error('信息修改失败')
}
})
this.dialogFormVisible = false
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.param === 0) {
this.editType()
} else {
this.handleChange()
}
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
handledelete(row.外协厂家流水号).then(response => {
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息删除成功',
type: 'success'
})
this.searchTable()
} else {
this.$message.error('信息删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-input{
width: 210px;
}
</style>

View File

@@ -0,0 +1,375 @@
<template>
<div class="app-container">
<el-card>
<span>工艺名称</span>
<el-input v-model="Code" placeholder="工艺名称" clearable size="small" style="width: 15%;top: 1px;"/>
<span style="margin-left: 10px">工艺分类</span>
<el-select v-model="processClassificationValue" size="small" filterable clearable placeholder="工艺分类">
<el-option
v-for="item in processClassification"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" class="el-icon-search" size="small" style="margin-left: 10px" @click="pageSize=10;pageList=1;getTableData()">查询</el-button>
<el-button v-if="false" type="primary" class="el-icon-circle-plus-outline" size="small" @click="addData('form1')">新增</el-button>
</el-card>
<el-card class="box-card">
<el-table
v-loading="loading"
:data="tableData3"
border
stripe
size="small"
tooltip-effect="dark"
style="width: 100%;"
height="650">
<el-table-column
align="center"
label="序号"
type="index"
width="55"/>
<el-table-column
align="center"
label="工艺名称"
width="300">
<template slot-scope="scope">{{ scope.row.工艺名称 }}</template>
</el-table-column>
<el-table-column
align="center"
label="工艺名称简称"
width="280">
<template slot-scope="scope">{{ scope.row.工艺名称简称 }}</template>
</el-table-column>
<el-table-column label="计算方式" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.外协价格计算标准流水号)===1" type="success" size="small">工时</el-tag>
<el-tag v-if="parseInt(scope.row.外协价格计算标准流水号)===2" type="success" size="small">重量</el-tag>
<el-tag v-if="parseInt(scope.row.外协价格计算标准流水号)===3" type="success" size="small">面积</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="工时价格(元/分)">
<template slot-scope="scope">
{{ scope.row.外协价格1 }}
</template>
</el-table-column>
<el-table-column align="center" label="重量价格(元/kg)">
<template slot-scope="scope">
{{ scope.row.重量价格1 }}
</template>
</el-table-column>
<el-table-column align="center" label="面积价格(元/m2)">
<template slot-scope="scope">
{{ scope.row.面积价格1 }}
</template>
</el-table-column>
<el-table-column label="操作" width="130px" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="handleEdit(scope.$index, scope.row, 'form')">编辑</el-button>
<el-button
v-if="false"
size="mini"
type="danger"
class="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible1" title="外协价格计算系数维护" center width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" class="demo-ruleForm" label-width="100px" style="width: 90%;margin: auto">
<el-row style="margin: 2px 0 30px 30px;">
<el-radio-group v-model="radio">
<el-radio :label="1">工时</el-radio>
<el-radio :label="2">重量</el-radio>
<el-radio :label="3">面积</el-radio>
</el-radio-group>
</el-row>
<el-form-item v-if="radio === 1" label="工时(元/分)" prop="Price">
<el-input v-model="form.Price" size="small" placeholder="请输入工时价格"/>
</el-form-item>
<el-form-item v-if="radio === 2" label="重量(元/kg)" prop="weightPrice">
<el-input v-model="form.weightPrice" size="small" placeholder="请输入重量价格"/>
</el-form-item>
<el-form-item v-if="radio === 3" label="面积(元/m2)" prop="areaPrice">
<el-input v-model="form.areaPrice" size="small" placeholder="请输入面积价格"/>
</el-form-item>
<el-row>
<el-col :span="14"/>
<el-form-item >
<el-button size="small" @click="callOff('form')">取消</el-button>
<el-button size="small" type="primary" @click="submit('form')"> </el-button>
</el-form-item>
</el-row>
</el-form>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="新增工艺" center width="28%">
<el-form ref="form1" :model="form1" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="工艺名称" prop="Name">
<el-input v-model="form1.Name" size="small" />
</el-form-item>
<el-form-item label="工艺名称简称" prop="ShortName">
<el-input v-model="form1.ShortName" size="small" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff1('form1')">取消</el-button>
<el-button size="small" type="primary" @click="submit1('form1')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getType, getTable, delList, Add, editList } from '@/api/Outsourcing/OutsourcingDataMaintenance'
export default {
data() {
return {
colorCode1: [],
colorCode2: [],
colorCode3: [],
radio: 1,
processClassificationValue: '',
processClassification: [],
form: { // 添加修改表单
Price: '', // 外协价格
weightPrice: '', // 重量价格
areaPrice: '' // 面积价格
},
count1: 0,
count2: 0,
form1: {
Name: '',
ShortName: ''
},
EditCode: '',
loading: false,
Code_Check: false,
Code_Check1: false,
Code: '', // 工艺计划流水号
dialogFormVisible1: false,
dialogFormVisible2: false, // 新增编辑弹框
total: null, // 总条数
pageSize: 30, // 每页显示条数
pageList: 1, // 后台获取页
currentPage: 1, // 显示当前页
tableData3: [], // 表格数据
rules: { // 表单验证规则
Price: [{ required: true, message: '请输入工时价格', trigger: 'change' }],
weightPrice: [{ required: true, message: '请输入重量价格', trigger: 'change' }],
areaPrice: [{ required: true, message: '请输入面积价格', trigger: 'change' }],
Name: [{ required: true, message: '请输入工艺名称', trigger: 'change' }],
ShortName: [{ required: true, message: '请输入工艺名称简称', trigger: 'change' }]
}
}
},
created() {
this.getTableData()
this.fetchData()
},
methods: {
// 初始化获取工艺分类
fetchData() {
this.processClassificationValue = ''
this.processClassification = []
getType().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.processClassification.push({
label: response.data[i].工艺分类名称,
value: response.data[i].工艺分类流水号
})
}
})
},
// 按条件查询
getTableData() {
this.loading = true
this.tableData3 = []
this.colorCode1 = []
this.colorCode2 = []
this.colorCode3 = []
if (this.Code === '' || this.Code === null) {
this.Code_Check = false
} else {
this.Code_Check = true
}
if (this.processClassificationValue === '' || this.processClassificationValue === null) {
this.Code_Check1 = false
} else {
this.Code_Check1 = true
}
getTable(this.Code_Check, this.Code, this.Code_Check1, this.processClassificationValue, this.pageList, this.pageSize).then(response => {
this.total = parseInt(response.data.total)
if (response.data.rows.length !== 0) {
this.tableData3 = response.data.rows
}
})
this.loading = false
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delList(row.工艺编号).then(response => {
if (response.data[0].result === '1') {
this.getTableData()
this.$message({
message: '已被成功删除',
type: 'success'
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 打开添加
addData(formName) {
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
this.form1.Name = ''
this.form1.ShortName = ''
this.dialogFormVisible2 = true
},
// 添加
submitAdd() {
Add(this.form1.Name, this.form1.ShortName).then(response => {
if (response.data[0].result === '1') {
this.dialogFormVisible2 = false
this.$message({
type: 'success',
message: '添加成功!'
})
this.pageList = 1
this.pageSize = 10
this.getTableData()
} else {
this.$message.error('添加失败')
this.dialogFormVisible2 = false
}
})
},
// 打开编辑
handleEdit(index, row, formName) {
this.count2 = this.count2 + 1
if (this.count2 !== 1) {
this.$refs[formName].resetFields()
}
this.radio = parseInt(row.外协价格计算标准流水号)
this.form.Price = row.外协价格1
this.EditCode = row.工艺编号
this.form.weightPrice = row.重量价格1
this.form.areaPrice = row.面积价格1
this.dialogFormVisible1 = true
},
// 提交编辑
submitEdit() {
if (this.form.Price === '0') {
this.form.Price = ''
}
if (this.form.weightPrice === '0') {
this.form.weightPrice = ''
}
if (this.form.areaPrice === '0') {
this.form.areaPrice = ''
}
editList(this.EditCode, this.form.Price, this.form.weightPrice, this.form.areaPrice, this.radio).then(response => {
if (response.data[0].result === '1') {
this.dialogFormVisible1 = false
this.$message({
type: 'success',
message: '信息更新成功!'
})
this.getTableData()
} else {
this.dialogFormVisible1 = false
this.$message.error('信息更新失败')
}
})
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.submitEdit()
} else {
return false
}
})
},
submit1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.submitAdd()
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible1 = false
this.$refs[formName].resetFields()
},
callOff1(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
// 分页
handleSizeChange(val) {
this.pageList = 1
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.pageList = val
this.getTableData()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.mianji{
background-color: #7EE3FC;
border: 1px solid #1f2d3d;
}
</style>

View File

@@ -0,0 +1,344 @@
<template>
<div class="app-container">
<el-card>
<span>合同号:</span>
<el-input v-model="contractNum" placeholder="合同号" size="small" clearable style="width:200px"/>
<span>外协厂家:</span>
<el-select v-model="outHelpValue" size="small" filterable remote clearable placeholder="外协厂家">
<el-option
v-for="item in outHelp"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件号:</span>
<el-input v-model="partNum" placeholder="零件号" size="small" clearable style="width:200px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="PageCurrent=1;PageSize=10;searchTable()">查询</el-button>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" border style="width: 100%;" height="650" stripe>
<el-table-column label="合同号" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="厂家" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.外协厂家简称 }}
</template>
</el-table-column>
<el-table-column label="零件号" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" width="140" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="数量" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="保存" width="100" align="center">
<template slot-scope="scope">
<el-button size="mini" icon="el-icon-cjn-09" type="primary" @click="saveRow(scope.row)">保存</el-button>
</template>
</el-table-column>
<el-table-column label="废品" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].废品数量" size="mini" disabled/>
</template>
</el-table-column>
<el-table-column label="1检" align="center">
<el-table-column label="交检日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:readonly="readonly1[scope.$index]"
v-model="tableData[scope.$index].交检日期1"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="外协科长填选"/>
</template>
</el-table-column>
<el-table-column label="交检数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].交检数量1" :readonly="readonly1[scope.$index]" size="mini"/>
</template>
</el-table-column>
<el-table-column label="检查日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled2[scope.$index]"
:readonly="true"
v-model="tableData[scope.$index].检查日期1"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="检查员填选"/>
</template>
</el-table-column>
<el-table-column label="合格数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].合格数量1" :disabled="disabled2[scope.$index]" :readonly="true" size="mini"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="2检" align="center">
<el-table-column label="交检日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled3[scope.$index]"
:readonly="readonly2[scope.$index]"
v-model="tableData[scope.$index].交检日期2"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="外协科长填选"/>
</template>
</el-table-column>
<el-table-column label="交检数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].交检数量2" :disabled="disabled3[scope.$index]" :readonly="readonly2[scope.$index]" size="mini"/>
</template>
</el-table-column>
<el-table-column label="检查日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled4[scope.$index]"
:readonly="true"
v-model="tableData[scope.$index].检查日期2"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="检查员填选"/>
</template>
</el-table-column>
<el-table-column label="合格数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].合格数量2" :disabled="disabled4[scope.$index]" :readonly="true" size="mini"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="3检" align="center">
<el-table-column label="交检日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled5[scope.$index]"
v-model="tableData[scope.$index].交检日期3"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="外协科长填选"/>
</template>
</el-table-column>
<el-table-column label="交检数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].交检数量3" :disabled="disabled5[scope.$index]" size="mini"/>
</template>
</el-table-column>
<el-table-column label="检查日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled6[scope.$index]"
:readonly="true"
v-model="tableData[scope.$index].检查日期3"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="检查员填选"/>
</template>
</el-table-column>
<el-table-column label="合格数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].合格数量3" :disabled="disabled6[scope.$index]" :readonly="true" size="mini"/>
</template>
</el-table-column>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading0"
:current-page="PageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</div>
</template>
<script>
import { initOutHelp, searchTable, saveRow } from '@/api/Outsourcing/OutsourcingInspectionEntry'
export default {
data() {
return {
loading0: false,
contractNum: '',
outHelpValue: '',
outHelp: [],
partNum: '',
tableData: [],
readonly1: [],
readonly2: [],
readonly3: [],
disabled2: [],
disabled3: [],
disabled4: [],
disabled5: [],
disabled6: [],
PageCurrent: 1,
PageSize: 10,
total: null
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.outHelp = []
initOutHelp().then(response => { // 初始化外协厂家;*这里模糊查询省一个存储过程
for (let i = 0; i < response.data.length; i++) {
this.outHelp.push({
label: response.data[i].外协厂家名称,
value: response.data[i].外协厂家流水号
})
}
})
},
searchTable() {
this.loading0 = true
this.tableData = []
if (this.contractNum === '') {
this.check1 = 0
} else { this.check1 = 1 }
if (this.outHelpValue === '') {
this.check2 = 0
} else { this.check2 = 1 }
if (this.partNum === '') {
this.check3 = 0
} else { this.check3 = 1 }
searchTable(this.PageCurrent, this.PageSize, this.check2, this.outHelpValue, this.check1, this.contractNum, this.check3, this.partNum).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.judge()
this.loading0 = false
})
},
// 判断进度
judge() {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].合格数量1 === null || this.tableData[i].合格数量1 === '') {
this.readonly1[i] = false
} else {
this.readonly1[i] = true
}
if (this.tableData[i].合格数量2 === null || this.tableData[i].合格数量2 === '') {
this.readonly2[i] = false
} else {
this.readonly2[i] = true
}
if (this.tableData[i].合格数量3 === null || this.tableData[i].合格数量3 === '') {
this.readonly3[i] = false
} else {
this.readonly3[i] = true
}
if (this.tableData[i].交检数量1 === null || this.tableData[i].交检数量1 === '') {
this.disabled2[i] = true
} else {
this.disabled2[i] = false
}
if (this.tableData[i].合格数量1 === null || this.tableData[i].合格数量1 === '') {
this.disabled3[i] = true
} else {
this.disabled3[i] = false
}
if (this.tableData[i].交检数量2 === null || this.tableData[i].交检数量2 === '') {
this.disabled4[i] = true
} else {
this.disabled4[i] = false
}
if (this.tableData[i].合格数量2 === null || this.tableData[i].合格数量2 === '') {
this.disabled5[i] = true
} else {
this.disabled5[i] = false
}
if (this.tableData[i].交检数量3 === null || this.tableData[i].交检数量3 === '') {
this.disabled6[i] = true
} else {
this.disabled6[i] = false
}
}
},
saveRow(row) {
if (parseInt(row.交检数量1) > row.批次数量 || parseInt(row.交检数量1) + parseInt(row.交检数量2) > row.批次数量 || parseInt(row.交检数量1) + parseInt(row.交检数量2) + parseInt(row.交检数量3) > row.批次数量) {
this.$message.error('超出零件数量范围')
} else {
if (row.交检日期1 === null) { row.交检日期1 = '' }
if (row.交检数量1 === null) { row.交检数量1 = '' }
if (row.检查日期1 === null) { row.检查日期1 = '' }
if (row.合格数量1 === null) { row.合格数量1 = '' }
if (row.交检日期2 === null) { row.交检日期2 = '' }
if (row.交检数量2 === null) { row.交检数量2 = '' }
if (row.检查日期2 === null) { row.检查日期2 = '' }
if (row.合格数量2 === null) { row.合格数量2 = '' }
if (row.交检日期3 === null) { row.交检日期3 = '' }
if (row.交检数量3 === null) { row.交检数量3 = '' }
if (row.检查日期3 === null) { row.检查日期3 = '' }
if (row.合格数量3 === null) { row.合格数量3 = '' }
saveRow(row.外协加工任务单明细流水号, row.交检日期1, row.交检数量1, row.检查日期1, row.合格数量1, row.交检日期2, row.交检数量2, row.检查日期2, row.合格数量2, row.交检日期3, row.交检数量3, row.检查日期3, row.合格数量3, row.废品数量).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
// this.PageCurrent = 1
// this.PageSize = 10
// this.searchTable()
} else { this.$message.error('保存失败') }
})
}
},
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.PageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.doing-row4{
background: #f0f9eb;
}
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:130px
}
span{
margin: 10px 0 10px 10px;
}
</style>

View File

@@ -0,0 +1,405 @@
<template>
<div class="app-container">
<el-card>
<span>合同号:</span>
<el-input v-model="contractNum" placeholder="合同号" size="small" clearable style="width:200px"/>
<span>外协厂家:</span>
<el-select v-model="outHelpValue" size="small" filterable remote clearable placeholder="外协厂家">
<el-option
v-for="item in outHelp"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件号:</span>
<el-input v-model="partNum" placeholder="零件号" size="small" clearable style="width:200px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="PageCurrent=1;PageSize=10;searchTable()">查询</el-button>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" border style="width: 100%;" height="650" stripe>
<el-table-column label="合同号" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="厂家" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.外协厂家简称 }}
</template>
</el-table-column>
<el-table-column label="零件号" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" width="140" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="数量" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="保存" width="100" align="center">
<template slot-scope="scope">
<el-button size="mini" icon="el-icon-cjn-09" type="primary" @click="saveRow(scope.row)">保存</el-button>
</template>
</el-table-column>
<el-table-column label="废品" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].废品数量" :disabled="disabled_feipin[scope.$index]" size="mini"/>
</template>
</el-table-column>
<el-table-column label="1检" align="center">
<el-table-column label="交检日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:readonly="true"
v-model="tableData[scope.$index].交检日期1"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="外协科长填选"/>
</template>
</el-table-column>
<el-table-column label="交检数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].交检数量1" :readonly="true" size="mini"/>
</template>
</el-table-column>
<el-table-column label="检查日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled2[scope.$index]"
v-model="tableData[scope.$index].检查日期1"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="检查员填选"/>
</template>
</el-table-column>
<el-table-column label="合格数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].合格数量1" :disabled="disabled2[scope.$index]" size="mini"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="2检" align="center">
<el-table-column label="交检日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled3[scope.$index]"
:readonly="true"
v-model="tableData[scope.$index].交检日期2"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="外协科长填选"/>
</template>
</el-table-column>
<el-table-column label="交检数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].交检数量2" :disabled="disabled3[scope.$index]" :readonly="true" size="mini"/>
</template>
</el-table-column>
<el-table-column label="检查日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled4[scope.$index]"
v-model="tableData[scope.$index].检查日期2"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="检查员填选"/>
</template>
</el-table-column>
<el-table-column label="合格数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].合格数量2" :disabled="disabled4[scope.$index]" size="mini"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="3检" align="center">
<el-table-column label="交检日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled5[scope.$index]"
:readonly="true"
v-model="tableData[scope.$index].交检日期3"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="外协科长填选"/>
</template>
</el-table-column>
<el-table-column label="交检数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].交检数量3" :disabled="disabled5[scope.$index]" :readonly="true" size="mini"/>
</template>
</el-table-column>
<el-table-column label="检查日期" width="160" align="center">
<template slot-scope="scope">
<el-date-picker
:disabled="disabled6[scope.$index]"
v-model="tableData[scope.$index].检查日期3"
size="mini"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
type="date"
placeholder="检查员填选"/>
</template>
</el-table-column>
<el-table-column label="合格数量" width="80" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].合格数量3" :disabled="disabled6[scope.$index]" size="mini"/>
</template>
</el-table-column>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading0"
:current-page="PageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</div>
</template>
<script>
import { initOutHelp, searchTable, saveRow } from '@/api/Outsourcing/OutsourcingInspectionEntry'
export default {
data() {
return {
loading0: false,
contractNum: '',
outHelpValue: '',
outHelp: [],
partNum: '',
tableData: [],
disabled_feipin: [],
disabled2: [],
disabled3: [],
disabled4: [],
disabled5: [],
disabled6: [],
PageCurrent: 1,
PageSize: 10,
total: 0
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.outHelp = []
initOutHelp().then(response => { // 初始化外协厂家;*这里模糊查询省一个存储过程
for (let i = 0; i < response.data.length; i++) {
this.outHelp.push({
label: response.data[i].外协厂家名称,
value: response.data[i].外协厂家流水号
})
}
})
},
searchTable() {
this.loading0 = true
this.tableData = []
if (this.contractNum === '') {
this.check1 = 0
} else { this.check1 = 1 }
if (this.outHelpValue === '') {
this.check2 = 0
} else { this.check2 = 1 }
if (this.partNum === '') {
this.check3 = 0
} else { this.check3 = 1 }
searchTable(this.PageCurrent, this.PageSize, this.check2, this.outHelpValue, this.check1, this.contractNum, this.check3, this.partNum).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading0 = false
this.judge()
})
},
// 判断进度
judge() {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].交检数量1 === null || this.tableData[i].交检数量1 === '') {
this.disabled2[i] = true
this.disabled_feipin[i] = true
} else {
this.disabled2[i] = false
this.disabled_feipin[i] = false
}
if (this.tableData[i].合格数量1 === null || this.tableData[i].合格数量1 === '') {
this.disabled3[i] = true
} else {
this.disabled3[i] = false
}
if (this.tableData[i].交检数量2 === null || this.tableData[i].交检数量2 === '') {
this.disabled4[i] = true
} else {
this.disabled4[i] = false
}
if (this.tableData[i].合格数量2 === null || this.tableData[i].合格数量2 === '') {
this.disabled5[i] = true
} else {
this.disabled5[i] = false
}
if (this.tableData[i].交检数量3 === null || this.tableData[i].交检数量3 === '') {
this.disabled6[i] = true
} else {
this.disabled6[i] = false
}
}
},
// 保存
saveRow(row) {
// if (parseInt(row.废品数量) > row.批次数量 || parseInt(row.合格数量1) + parseInt(row.废品数量) > row.批次数量 || parseInt(row.合格数量2) + parseInt(row.废品数量) > row.批次数量 || parseInt(row.合格数量3) + parseInt(row.废品数量) > row.批次数量 || parseInt(row.合格数量1) + parseInt(row.合格数量2) + parseInt(row.废品数量) > row.批次数量 || parseInt(row.合格数量3) + parseInt(row.合格数量2) + parseInt(row.合格数量1) + parseInt(row.废品数量) > row.批次数量) {
if (row.合格数量1 !== '' && row.合格数量2 === '' && row.合格数量3 === '') {
if (parseInt(row.合格数量1) + parseInt(row.废品数量) > row.交检数量1) {
this.$message.error('超出零件数量范围')
} else {
if (row.交检日期1 === null) { row.交检日期1 = '' }
if (row.交检数量1 === null) { row.交检数量1 = '' }
if (row.检查日期1 === null) { row.检查日期1 = '' }
if (row.合格数量1 === null) { row.合格数量1 = '' }
if (row.交检日期2 === null) { row.交检日期2 = '' }
if (row.交检数量2 === null) { row.交检数量2 = '' }
if (row.检查日期2 === null) { row.检查日期2 = '' }
if (row.合格数量2 === null) { row.合格数量2 = '' }
if (row.交检日期3 === null) { row.交检日期3 = '' }
if (row.交检数量3 === null) { row.交检数量3 = '' }
if (row.检查日期3 === null) { row.检查日期3 = '' }
if (row.合格数量3 === null) { row.合格数量3 = '' }
saveRow(row.外协加工任务单明细流水号, row.交检日期1, row.交检数量1, row.检查日期1, row.合格数量1, row.交检日期2, row.交检数量2, row.检查日期2, row.合格数量2, row.交检日期3, row.交检数量3, row.检查日期3, row.合格数量3, row.废品数量).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
this.PageCurrent = 1
this.PageSize = 10
this.searchTable()
} else { this.$message.error('保存失败') }
})
}
} else if (row.合格数量1 !== '' && row.合格数量2 !== '' && row.合格数量3 === '') {
if (parseInt(row.合格数量1) + parseInt(row.合格数量2) + parseInt(row.废品数量) > row.交检数量1 + row.交检数量2) {
this.$message.error('超出零件数量范围')
} else {
if (row.交检日期1 === null) { row.交检日期1 = '' }
if (row.交检数量1 === null) { row.交检数量1 = '' }
if (row.检查日期1 === null) { row.检查日期1 = '' }
if (row.合格数量1 === null) { row.合格数量1 = '' }
if (row.交检日期2 === null) { row.交检日期2 = '' }
if (row.交检数量2 === null) { row.交检数量2 = '' }
if (row.检查日期2 === null) { row.检查日期2 = '' }
if (row.合格数量2 === null) { row.合格数量2 = '' }
if (row.交检日期3 === null) { row.交检日期3 = '' }
if (row.交检数量3 === null) { row.交检数量3 = '' }
if (row.检查日期3 === null) { row.检查日期3 = '' }
if (row.合格数量3 === null) { row.合格数量3 = '' }
saveRow(row.外协加工任务单明细流水号, row.交检日期1, row.交检数量1, row.检查日期1, row.合格数量1, row.交检日期2, row.交检数量2, row.检查日期2, row.合格数量2, row.交检日期3, row.交检数量3, row.检查日期3, row.合格数量3, row.废品数量).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
this.PageCurrent = 1
this.PageSize = 10
this.searchTable()
} else { this.$message.error('保存失败') }
})
}
} else if (row.合格数量1 !== '' && row.合格数量2 !== '' && row.合格数量3 !== '') {
if (parseInt(row.合格数量1) + parseInt(row.合格数量2) + parseInt(row.合格数量3) + parseInt(row.废品数量) > row.交检数量1 + row.交检数量2 + row.交检数量3) {
this.$message.error('超出零件数量范围')
} else {
if (row.交检日期1 === null) { row.交检日期1 = '' }
if (row.交检数量1 === null) { row.交检数量1 = '' }
if (row.检查日期1 === null) { row.检查日期1 = '' }
if (row.合格数量1 === null) { row.合格数量1 = '' }
if (row.交检日期2 === null) { row.交检日期2 = '' }
if (row.交检数量2 === null) { row.交检数量2 = '' }
if (row.检查日期2 === null) { row.检查日期2 = '' }
if (row.合格数量2 === null) { row.合格数量2 = '' }
if (row.交检日期3 === null) { row.交检日期3 = '' }
if (row.交检数量3 === null) { row.交检数量3 = '' }
if (row.检查日期3 === null) { row.检查日期3 = '' }
if (row.合格数量3 === null) { row.合格数量3 = '' }
saveRow(row.外协加工任务单明细流水号, row.交检日期1, row.交检数量1, row.检查日期1, row.合格数量1, row.交检日期2, row.交检数量2, row.检查日期2, row.合格数量2, row.交检日期3, row.交检数量3, row.检查日期3, row.合格数量3, row.废品数量).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
this.PageCurrent = 1
this.PageSize = 10
this.searchTable()
} else { this.$message.error('保存失败') }
})
}
}
// if (parseInt(row.合格数量1) + parseInt(row.废品数量) > row.交检数量1 || parseInt(row.合格数量1) + parseInt(row.合格数量2) + parseInt(row.废品数量) > row.交检数量1 + row.交检数量2 || parseInt(row.合格数量1) + parseInt(row.合格数量2) + parseInt(row.合格数量3) + parseInt(row.废品数量) > row.交检数量1 + row.交检数量2 + row.交检数量3) {
// this.$message.error('超出零件数量范围')
// } else {
// if (row.交检日期1 === null) { row.交检日期1 = '' }
// if (row.交检数量1 === null) { row.交检数量1 = '' }
// if (row.检查日期1 === null) { row.检查日期1 = '' }
// if (row.合格数量1 === null) { row.合格数量1 = '' }
// if (row.交检日期2 === null) { row.交检日期2 = '' }
// if (row.交检数量2 === null) { row.交检数量2 = '' }
// if (row.检查日期2 === null) { row.检查日期2 = '' }
// if (row.合格数量2 === null) { row.合格数量2 = '' }
// if (row.交检日期3 === null) { row.交检日期3 = '' }
// if (row.交检数量3 === null) { row.交检数量3 = '' }
// if (row.检查日期3 === null) { row.检查日期3 = '' }
// if (row.合格数量3 === null) { row.合格数量3 = '' }
// saveRow(row.外协加工任务单明细流水号, row.交检日期1, row.交检数量1, row.检查日期1, row.合格数量1, row.交检日期2, row.交检数量2, row.检查日期2, row.合格数量2, row.交检日期3, row.交检数量3, row.检查日期3, row.合格数量3, row.废品数量).then(response => {
// if (response.data[0].result === '1') {
// this.$message.success('保存成功')
// this.PageCurrent = 1
// this.PageSize = 10
// this.searchTable()
// } else { this.$message.error('保存失败') }
// })
// }
},
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.PageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.doing-row4{
background: #f0f9eb;
}
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:130px
}
span{
margin: 10px 0 10px 10px;
}
</style>

View File

@@ -0,0 +1,752 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>表单号:</span>
<el-input v-model="FormNumber" placeholder="表单号" clearable size="small" style="width:190px;margin:10px;"/>
<span>任务下达时间段:</span>
<el-date-picker
v-model="date1"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<span>~</span>
<el-date-picker
v-model="date2"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
</el-row>
<el-row>
<span>厂家名:</span>
<el-select v-model="ManufacturerNameValue" placeholder="选择外协厂家" filterable clearable size="small" style="width:190px;margin:10px;">
<el-option
v-for="item in ManufacturerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>实际付款时间段:</span>
<el-date-picker
v-model="date3"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<span>~</span>
<el-date-picker
v-model="date4"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-button type="success" class="el-icon-search" size="small" @click="pageCurrent=1;pageSize=10;total=null;pageCurrent2=1;pageSize2=10;total2=null;searchTable()">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border highlight-current-row element-loading-text="拼命加载中" @row-click="getParts">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="付款状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.实际付款时间!==''" type="success" size="small">已付款</el-tag>
<el-tag v-else type="info" size="small">未付款</el-tag>
</template>
</el-table-column>
<el-table-column label="到货状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.单据状态==='3'" type="success" size="small">已到货</el-tag>
<el-tag v-else type="info" size="small">未到货</el-tag>
</template>
</el-table-column>
<el-table-column label="表单号" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="外协厂家名称" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="任务下达日期" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.任务下达日期 }}
</template>
</el-table-column>
<el-table-column label="外协员" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.外协员姓名 }}
</template>
</el-table-column>
<el-table-column label="加工价格" align="center">
<el-table-column label="预算总价" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.加工价格_预算_总价 }}
</template>
</el-table-column>
<el-table-column label="成交总价" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.加工价格_成交_总价 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="材料费" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.材料价格_价格_总价 }}
</template>
</el-table-column>
<el-table-column label="运费" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.运费 }}
</template>
</el-table-column>
<el-table-column label="其他费用" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.其他价格_总价 }}
</template>
</el-table-column>
<el-table-column label="总价" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.总价 }}
</template>
</el-table-column>
<el-table-column label="扣款" align="center">
<el-table-column label="质量" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.扣款_质量 }}
</template>
</el-table-column>
<el-table-column label="计划" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.扣款_计划 }}
</template>
</el-table-column>
<el-table-column label="其他" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.扣款_其他 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="应付金额" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.应付总额 }}
</template>
</el-table-column>
<el-table-column label="付款日期" align="center" width="240px">
<el-table-column label="入库" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.入库时间 }}
</template>
</el-table-column>
<el-table-column label="计划" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.计划付款时间 }}
</template>
</el-table-column>
<el-table-column label="实际" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.实际付款时间 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="扣款说明" align="center" width="240px">
<template slot-scope="scope">
{{ scope.row.扣款说明 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300px" fixed="right">
<template slot-scope="scope">
<el-button
:disabled="scope.row.实际付款时间!==''"
size="mini"
type="primary"
class="el-icon-check"
@click="editType1(scope.row, 'form');param = 0">到票</el-button>
<el-button
:disabled="scope.row.实际付款时间!==''"
size="mini"
type="primary"
class="el-icon-edit"
@click="Withdrawing(scope.$index, scope.row, 'form2')">扣款</el-button>
<el-button
:disabled="scope.row.实际付款时间!==''||scope.row.单据状态!=='3'"
size="mini"
type="success"
class="el-icon-check"
@click="payment(scope.$index, scope.row)">付款</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="tableData2" :summary-method="getSummaries" height="370" show-summary style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column label="发票号" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.发票号 }}
</template>
</el-table-column>
<el-table-column label="接收人" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.接收人 }}
</template>
</el-table-column>
<el-table-column label="开户行" align="center">
<template slot-scope="scope">
{{ scope.row.开户行 }}
</template>
</el-table-column>
<el-table-column label="开票金额" align="center" width="150px" prop="开票金额">
<template slot-scope="scope">
{{ scope.row.开票金额 }}
</template>
</el-table-column>
<el-table-column label="开票日期" align="center">
<template slot-scope="scope">
{{ scope.row.开票时间 }}
</template>
</el-table-column>
<el-table-column label="接收日期" align="center">
<template slot-scope="scope">
{{ scope.row.接收时间 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" fixed="right">
<template slot-scope="scope">
<el-button
:disabled="fukuanshijian!==''"
size="mini"
type="primary"
class="el-icon-edit"
@click="handleChange1(scope.$index, scope.row, 'form');param = 1">编辑</el-button>
<el-button
:disabled="fukuanshijian!==''"
size="mini"
type="danger"
class="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible2" title="扣款" center style="min-height: 300px" width="800px">
<el-form ref="form2" :model="form2" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="质量" style="margin-left: 200px">
<el-input v-model="form2.质量" placeholder="质量" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="计划" style="margin-left: 200px">
<el-input v-model="form2.计划" placeholder="计划" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="其他" style="margin-left: 200px">
<el-input v-model="form2.其他" placeholder="其他" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="扣款说明" prop="扣款说明" style="margin-left: 200px">
<el-input v-model="form2.扣款说明" placeholder="扣款说明" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff2('form2')">取消</el-button>
<el-button type="primary" @click="submit2('form2')">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="title1" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="发票号" prop="发票号" >
<el-input v-model="form.发票号" placeholder="发票号" style="width:200px" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开票金额" prop="开票金额">
<el-input v-model="form.开票金额" placeholder="开票金额" style="width:200px" clearable size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="开票时间" prop="开票时间">
<el-date-picker
v-model="form.开票时间"
style="width:200px"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="开票时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开户行" prop="开户行">
<el-input v-model="form.开户行" placeholder="开户行" style="width:200px" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="接收人" prop="接收人">
<el-input v-model="form.接收人" placeholder="接收人" style="width:200px" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="接收时间" prop="接收时间">
<el-date-picker
v-model="form.接收时间"
style="width:200px"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="接收时间"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="备注">
<el-input v-model="form.备注" :rows="2" placeholder="备注" type="textarea" style="width:527px" clearable size="small"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')" >确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initOutHelp, searchtable, payTime, WithdrawingEdit, getParts, edittype, handlechange, handledelete } from '@/api/Outsourcing/OutsourcingPaymentPlanManagement'
export default {
data() {
return {
fukuanshijian: '',
title1: '',
dialogFormVisible: false,
renwudan: '',
count1: 0,
count2: 0,
form: {
发票号: '',
开户行: '',
开票时间: '',
开票金额: '',
接收人: '',
接收时间: '',
备注: ''
},
实际付款时间: '',
loading: false,
loading2: false,
zhongjianbianliang: '',
dialogFormVisible2: false,
form2: {
质量: '',
计划: '',
其他: '',
扣款说明: ''
},
rules: {
发票号: [{ required: true, message: '请输入发票号', trigger: 'blur' }],
开票金额: [{ required: true, message: '请输入开票金额', trigger: 'blur' }],
扣款说明: [{ required: true, message: '请输入扣款说明', trigger: 'blur' }]
},
date1: '',
date2: '',
date3: '',
date4: '',
FormNumber: '',
ManufacturerNameValue: '',
ManufacturerName: [], // 厂家名称
FormNumber_check: false,
ManufacturerNameValue_check: false,
date1_check: false,
date3_check: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1, // 后台获取页
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1 // 后台获取页
}
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总金额'
return
}
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ' 元'
} else {
sums[index] = ''
}
})
return sums
},
// 初始化外协厂家
fetchData() {
this.ManufacturerName = []
initOutHelp().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.ManufacturerName.push({
label: response.data[i].外协厂家名称,
value: response.data[i].外协厂家流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
if (this.FormNumber === '' || this.FormNumber === null) {
this.FormNumber_check = false
} else {
this.FormNumber_check = true
}
if (this.ManufacturerNameValue === '' || this.ManufacturerNameValue === null) {
this.ManufacturerNameValue_check = false
} else {
this.ManufacturerNameValue_check = true
}
if (this.date1 === '' || this.date1 === null) {
this.date1_check = false
} else {
this.date1_check = true
}
if (this.date3 === '' || this.date3 === null) {
this.date3_check = false
} else {
this.date3_check = true
}
this.tableData = []
this.tableData2 = []
searchtable(this.FormNumber_check, this.FormNumber, this.ManufacturerNameValue_check, this.ManufacturerNameValue, this.date1_check, this.date1, this.date2, this.date3_check, this.date3, this.date4, this.pageCurrent, this.pageSize).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].任务下达日期 = response.data.rows[i].任务下达日期.substring(0, response.data.rows[i].任务下达日期.indexOf(' '))
response.data.rows[i].实际付款时间 = response.data.rows[i].实际付款时间.substring(0, response.data.rows[i].实际付款时间.indexOf(' '))
}
this.tableData = response.data.rows
this.total = response.data.total
}).then(() => {
this.loading = false
})
},
// 付款
payment(index, row) {
this.$confirm('请仔细核对信息,确定后不可更改, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success'
}).then(() => {
var time = new Date()
var month = time.getMonth() + 1
var day = time.getDate()
if (month >= 1 && month <= 9) {
month = '0' + month
}
if (day >= 1 && day <= 9) {
day = '0' + day
}
this.实际付款时间 = time.getFullYear() + '/' + month + '/' + day
payTime(row.外协加工任务单流水号, this.实际付款时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('付款成功')
this.searchTable()
} else {
this.$message.error('付款失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消付款'
})
})
},
// 打开扣款编辑
Withdrawing(index, row) {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.form2.质量 = row.扣款_质量
this.form2.计划 = row.扣款_计划
this.form2.其他 = row.扣款_其他
this.form2.扣款说明 = row.扣款说明
this.liushuihao = row.外协加工任务单流水号
this.dialogFormVisible2 = true
},
// 扣款编辑确定
submit2(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.WithdrawingEdit()
}
})
},
// 扣款编辑
WithdrawingEdit() {
WithdrawingEdit(this.liushuihao, this.form2.质量, this.form2.计划, this.form2.其他, this.form2.扣款说明).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改成功')
this.searchTable()
} else {
this.$message.error('修改失败')
}
this.dialogFormVisible2 = false
})
},
// 关闭扣款编辑
callOff2(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
// 获取表格2数据
getParts(row) {
this.loading2 = true
this.tableData2 = []
this.zhongjianbianliang = row.外协加工任务单流水号
this.fukuanshijian = row.实际付款时间
getParts(row.外协加工任务单流水号, this.pageCurrent2, this.pageSize2).then(response => {
if (response.data.rows.length === 0) {
this.loading2 = false
} else {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].开票时间 = response.data.rows[i].开票时间.substring(0, response.data.rows[i].开票时间.indexOf(' '))
response.data.rows[i].接收时间 = response.data.rows[i].接收时间.substring(0, response.data.rows[i].接收时间.indexOf(' '))
}
this.tableData2 = response.data.rows
this.total2 = response.data.total
}
}).then(() => {
this.loading2 = false
})
},
getParts2() {
this.loading2 = true
this.tableData2 = []
getParts(this.zhongjianbianliang, this.pageCurrent2, this.pageSize2).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].开票时间 = response.data.rows[i].开票时间.substring(0, response.data.rows[i].开票时间.indexOf(' '))
response.data.rows[i].接收时间 = response.data.rows[i].接收时间.substring(0, response.data.rows[i].接收时间.indexOf(' '))
}
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
},
// 点击增加
editType1(row, formName) {
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
this.title1 = '增加'
this.renwudan = row.外协加工任务单流水号
this.form.发票号 = ''
this.form.开户行 = ''
this.form.开票时间 = ''
this.form.开票金额 = ''
this.form.接收人 = ''
this.form.接收时间 = ''
this.form.备注 = ''
this.dialogFormVisible = true
},
// 增加确定
editType() {
edittype(this.renwudan, this.form.发票号, this.form.开户行, this.form.开票时间, this.form.开票金额, this.form.接收人, this.form.接收时间, this.form.备注).then(response => {
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息增加成功',
type: 'success'
})
this.getParts2()
} else {
this.$message.error('信息增加失败')
}
})
this.dialogFormVisible = false
},
// 编辑打开
handleChange1(index, row, formName) {
this.count2 = this.count2 + 1
if (this.count2 !== 1) {
this.$refs[formName].resetFields()
}
this.form.发票号 = row.发票号
this.form.开户行 = row.开户行
this.form.开票时间 = row.开票时间
this.form.开票金额 = row.开票金额
this.form.接收人 = row.接收人
this.form.接收时间 = row.接收时间
this.form.备注 = row.备注
this.dialogFormVisible = true
this.title1 = '编辑'
this.CoManufacturerFlowNumber1 = row.id
},
// 编辑确定
handleChange() {
handlechange(this.CoManufacturerFlowNumber1, this.form.发票号, this.form.开户行, this.form.开票时间, this.form.开票金额, this.form.接收人, this.form.接收时间, this.form.备注).then(response => {
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.getParts2()
} else {
this.$message.error('信息修改失败')
}
})
this.dialogFormVisible = false
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.param === 0) {
this.editType()
} else {
this.handleChange()
}
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
handledelete(row.id).then(response => {
if (this.tableData2 && this.tableData2.length === 1 && this.pageCurrent2 > 1) {
this.pageCurrent2--
}
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息删除成功',
type: 'success'
})
this.getParts2()
} else {
this.$message.error('信息删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.getParts2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.tableData2 = []
this.getParts2()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-table .fukuan {
background: #AEF199;
}
</style>

View File

@@ -0,0 +1,668 @@
<template>
<div class="app-container">
<el-card>
<span>外协厂家:</span>
<el-select v-model="ManufacturerNameValue" placeholder="选择外协厂家" filterable clearable size="small" style="width:190px;margin:10px;">
<el-option
v-for="item in ManufacturerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" class="el-icon-search" size="small" @click="pageCurrent=1;pageSize=10;total=null;pageCurrent2=1;pageSize2=10;total2=null;searchTable()">查询</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="400" style="width: 100%;" border highlight-current-row element-loading-text="拼命加载中" @row-click="getParts3">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="外协厂家" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="待付总额(元)" align="center">
<template slot-scope="scope">
{{ scope.row.待付金额 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300px" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-check"
@click="editType1(scope.row, 'form');param = 0">到票</el-button>
<el-button
size="mini"
type="success"
class="el-icon-check"
@click="payment(scope.row, 'form2');param2 = 0">付款</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-tabs type="border-card">
<el-tab-pane label="付款明细">
<el-table v-loading="loading3" :data="tableData3" height="370" style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column label="付款金额" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.付款金额 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="付款日期" align="center">
<template slot-scope="scope">
{{ scope.row.付款日期 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary" class="el-icon-edit" @click="handleChange3(scope.row, 'form2')">编辑</el-button>
<el-button size="mini" type="danger" class="el-icon-delete" @click="handleDelete3(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading3"
:current-page="pageCurrent3"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize3"
:total="total3"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
</el-tab-pane>
<el-tab-pane label="到票明细">
<el-table v-loading="loading2" :data="tableData2" :summary-method="getSummaries" height="370" show-summary style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column label="发票号" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.发票号 }}
</template>
</el-table-column>
<el-table-column label="接收人" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.接收人 }}
</template>
</el-table-column>
<el-table-column label="开户行" align="center">
<template slot-scope="scope">
{{ scope.row.开户行 }}
</template>
</el-table-column>
<el-table-column label="开票金额" align="center" width="150px" prop="开票金额">
<template slot-scope="scope">
{{ scope.row.开票金额 }}
</template>
</el-table-column>
<el-table-column label="开票日期" align="center">
<template slot-scope="scope">
{{ scope.row.开票时间 }}
</template>
</el-table-column>
<el-table-column label="接收日期" align="center">
<template slot-scope="scope">
{{ scope.row.接收时间 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" fixed="right">
<template slot-scope="scope">
<el-button size="mini" type="primary" class="el-icon-edit" @click="handleChange1(scope.$index, scope.row, 'form');param = 1">编辑</el-button>
<el-button size="mini" type="danger" class="el-icon-delete" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
</el-tabs>
<el-dialog :title="title1" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="发票号" prop="发票号">
<el-input v-model="form.发票号" placeholder="发票号" style="width:200px" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开票金额" prop="开票金额">
<el-input v-model="form.开票金额" placeholder="开票金额" style="width:200px" clearable size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="开票时间" prop="开票时间">
<el-date-picker
v-model="form.开票时间"
style="width:200px"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="开票时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开户行" prop="开户行">
<el-input v-model="form.开户行" placeholder="开户行" style="width:200px" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="接收人" prop="接收人">
<el-input v-model="form.接收人" placeholder="接收人" style="width:200px" clearable size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="接收时间" prop="接收时间">
<el-date-picker
v-model="form.接收时间"
style="width:200px"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="接收时间"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="备注">
<el-input v-model="form.备注" :rows="2" placeholder="备注" type="textarea" style="width:527px" clearable size="small"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')" >确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="付款" center style="min-height: 300px" width="500px">
<el-form ref="form2" :model="form2" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
<el-form-item label="付款金额" prop="付款金额" style="margin-left: 80px">
<el-input v-model="form2.付款金额" placeholder="付款金额" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="备注" prop="备注" style="margin-left: 80px">
<el-input :autosize="{ minRows: 2, maxRows: 4}" v-model="form2.备注" type="textarea" placeholder="备注" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff2('form2')">取消</el-button>
<el-button type="primary" @click="submit2('form2')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initOutHelp, searchtable, getParts, edittype, handlechange, handledelete, getParts3, outPay, edit, handledelete3 } from '@/api/Outsourcing/OutsourcingPaymentPlanManagement2'
export default {
data() {
return {
factury: '',
fukuanshijian: '',
title1: '',
dialogFormVisible: false,
renwudan: '',
count1: 0,
count2: 0,
count3: 0,
count4: 0,
form: {
发票号: '',
开户行: '',
开票时间: '',
开票金额: '',
接收人: '',
接收时间: '',
备注: ''
},
实际付款时间: '',
loading: false,
loading2: false,
loading3: false,
zhongjianbianliang1: '',
zhongjianbianliang2: '',
dialogFormVisible2: false,
form2: {
付款金额: '',
备注: ''
},
rules: {
发票号: [{ required: true, message: '请输入发票号', trigger: 'blur' }],
开票金额: [{ required: true, message: '请输入开票金额', trigger: 'blur' }],
扣款说明: [{ required: true, message: '请输入扣款说明', trigger: 'blur' }],
付款金额: [{ required: true, message: '请输入扣款说明', trigger: 'blur' }]
},
date1: '',
date2: '',
date3: '',
date4: '',
FormNumber: '',
ManufacturerNameValue: '',
ManufacturerName: [], // 厂家名称
FormNumber_check: false,
ManufacturerNameValue_check: false,
date1_check: false,
date3_check: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1, // 后台获取页
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1, // 后台获取页
tableData3: [], // 表格数据
total3: null, // 总条数
pageSize3: 10, // 每页显示条数
pageCurrent3: 1 // 后台获取页
}
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总金额'
return
}
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] += ' 元'
} else {
sums[index] = ''
}
})
return sums
},
// 初始化外协厂家
fetchData() {
this.ManufacturerName = []
initOutHelp().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.ManufacturerName.push({
label: response.data[i].外协厂家名称,
value: response.data[i].外协厂家流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
if (this.ManufacturerNameValue === '' || this.ManufacturerNameValue === null) {
this.ManufacturerNameValue_check = 0
} else {
this.ManufacturerNameValue_check = 1
}
this.tableData = []
this.tableData2 = []
this.tableData3 = []
searchtable(this.ManufacturerNameValue_check, this.ManufacturerNameValue, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
}).then(() => {
this.loading = false
})
},
getParts3(row) {
this.loading3 = true
this.tableData3 = []
this.zhongjianbianliang1 = row.外协厂家流水号
getParts3(row.外协厂家流水号, this.pageCurrent3, this.pageSize3).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].付款日期 = response.data.rows[i].付款日期.split(' ')[0]
}
this.tableData3 = response.data.rows
this.total3 = response.data.total
}).then(() => {
this.loading3 = false
})
this.loading2 = true
this.tableData2 = []
this.zhongjianbianliang2 = row.外协厂家流水号
getParts(this.zhongjianbianliang2, this.pageCurrent2, this.pageSize2).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].开票时间 = response.data.rows[i].开票时间.substring(0, response.data.rows[i].开票时间.indexOf(' '))
response.data.rows[i].接收时间 = response.data.rows[i].接收时间.substring(0, response.data.rows[i].接收时间.indexOf(' '))
}
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
},
getParts4() {
this.loading3 = true
this.tableData3 = []
getParts3(this.zhongjianbianliang1, this.pageCurrent3, this.pageSize3).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].付款日期 = response.data.rows[i].付款日期.split(' ')[0]
}
this.tableData3 = response.data.rows
this.total3 = response.data.total
}).then(() => {
this.loading3 = false
})
},
// 新增付款打开
payment(row, formName) {
this.param2 = 0
this.count3 = this.count3 + 1
if (this.count3 !== 1) {
this.$refs[formName].resetFields()
}
this.factury = row.外协厂家流水号
var time = new Date()
var month = time.getMonth() + 1
var day = time.getDate()
if (month >= 1 && month <= 9) {
month = '0' + month
}
if (day >= 1 && day <= 9) {
day = '0' + day
}
this.payDate = time.getFullYear() + '/' + month + '/' + day
this.form2.付款金额 = ''
this.form2.备注 = ''
this.dialogFormVisible2 = true
},
// 新增付款确定
outPay() {
outPay(this.factury, this.form2.付款金额, this.payDate, this.form2.备注).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息增加成功')
this.searchTable()
this.getParts4()
} else {
this.$message.error('信息增加失败')
}
})
},
// 编辑付款打开
handleChange3(row, formName) {
this.param2 = 1
this.count4 = this.count4 + 1
if (this.count4 !== 1) {
this.$refs[formName].resetFields()
}
this.factury = row.外协付款流水号
this.form2.付款金额 = row.付款金额
this.form2.备注 = row.备注
this.dialogFormVisible2 = true
},
// 编辑付款确定
edit() {
edit(this.factury, this.form2.付款金额, this.form2.备注).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息修改成功')
this.searchTable()
this.getParts4()
} else {
this.$message.error('信息修改失败')
}
})
this.dialogFormVisible = false
},
// 删除
handleDelete3(index, row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
handledelete3(row.外协付款流水号).then(response => {
if (this.tableData3 && this.tableData3.length === 1 && this.pageCurrent3 > 1) {
this.pageCurrent3--
}
if (response.data[0].result === '1') {
this.$message.success('信息删除成功')
this.searchTable()
this.getParts4()
} else {
this.$message.error('信息删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
submit2(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.param2 === 0) {
this.outPay()
this.dialogFormVisible2 = false
} else {
this.edit()
this.dialogFormVisible2 = false
}
} else {
return false
}
})
},
callOff2(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
// 获取表格2数据
getParts2() {
this.loading2 = true
this.tableData2 = []
getParts(this.zhongjianbianliang2, this.pageCurrent2, this.pageSize2).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].开票时间 = response.data.rows[i].开票时间.substring(0, response.data.rows[i].开票时间.indexOf(' '))
response.data.rows[i].接收时间 = response.data.rows[i].接收时间.substring(0, response.data.rows[i].接收时间.indexOf(' '))
}
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
},
// 增加发票
editType1(row, formName) {
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
this.title1 = '增加'
this.renwudan = row.外协厂家流水号
this.form.发票号 = ''
this.form.开户行 = ''
this.form.开票时间 = ''
this.form.开票金额 = ''
this.form.接收人 = ''
this.form.接收时间 = ''
this.form.备注 = ''
this.dialogFormVisible = true
},
// 增加确定
editType() {
edittype(this.renwudan, this.form.发票号, this.form.开户行, this.form.开票时间, this.form.开票金额, this.form.接收人, this.form.接收时间, this.form.备注).then(response => {
if (response.data[0].result === '1') {
this.$message.error('信息增加成功')
this.getParts2()
} else {
this.$message.error('信息增加失败')
}
})
this.dialogFormVisible = false
},
// 编辑发票
handleChange1(index, row, formName) {
this.count2 = this.count2 + 1
if (this.count2 !== 1) {
this.$refs[formName].resetFields()
}
this.form.发票号 = row.发票号
this.form.开户行 = row.开户行
this.form.开票时间 = row.开票时间
this.form.开票金额 = row.开票金额
this.form.接收人 = row.接收人
this.form.接收时间 = row.接收时间
this.form.备注 = row.备注
this.dialogFormVisible = true
this.title1 = '编辑'
this.CoManufacturerFlowNumber1 = row.id
},
// 编辑确定
handleChange() {
handlechange(this.CoManufacturerFlowNumber1, this.form.发票号, this.form.开户行, this.form.开票时间, this.form.开票金额, this.form.接收人, this.form.接收时间, this.form.备注).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息编辑成功')
this.getParts2()
} else {
this.$message.error('信息修改失败')
}
})
this.dialogFormVisible = false
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.param === 0) {
this.editType()
} else {
this.handleChange()
}
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
handledelete(row.id).then(response => {
if (this.tableData2 && this.tableData2.length === 1 && this.pageCurrent2 > 1) {
this.pageCurrent2--
}
if (response.data[0].result === '1') {
this.$message.success('信息删除成功')
this.getParts2()
} else {
this.$message.error('信息删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.getParts2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.tableData2 = []
this.getParts2()
},
handleSizeChange3(val) {
this.pageCurrent3 = 1
this.pageSize3 = val
this.getParts3()
},
handleCurrentChange3(val) {
this.pageCurrent3 = val
this.getParts3()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 10px;
}
.el-table .fukuan {
background: #AEF199;
}
</style>

View File

@@ -0,0 +1,351 @@
<template>
<div>
<el-card>
<el-row>
<el-radio-group v-model="radio" style="margin: 10px;" @change="radioChange">
<el-radio :label="1">未编制</el-radio>
<el-radio :label="2">已编制</el-radio>
</el-radio-group>
<span>零件图号:</span>
<el-input v-model="partName" placeholder="零件名称" size="small" clearable style="width:200px"/>
<span>开始时间:</span>
<el-date-picker
v-model="date01"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
size="small"
placeholder="选择开始日期"/>
<span>结束时间:</span>
<el-date-picker
v-model="date02"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
size="small"
placeholder="选择结束日期"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize2=10; pageCurrent2=1;searchPartNum()">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="tableData2" height="370" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="零件图号" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="220px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="种类" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.零件类型名称 }}
</template>
</el-table-column>
<el-table-column label="投产数量" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center">
<template slot-scope="scope">
{{ scope.row.原材料规格 }}
</template>
</el-table-column>
<el-table-column label="面积" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.面积 }}
</template>
</el-table-column>
<el-table-column label="重量" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.重量 }}
</template>
</el-table-column>
<el-table-column label="材料费" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.材料费 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150px" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="edit(scope.$index, scope.row, 'form')">编辑</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" :summary-method="getSummaries" border style="width: 100%;max-height: 390px;" height="340px" stripe show-summary>
<el-table-column label="序号" width="80" align="center" type="index"/>
<el-table-column label="工艺名称" width="200" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].工艺名称" size="mini" placeholder="工艺名称" readonly/>
</template>
</el-table-column>
<el-table-column label="工艺要求" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].工艺要求" size="mini" readonly type="textarea"/>
</template>
</el-table-column>
<el-table-column label="单件" width="110" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].单件定额工时_系数" size="mini" readonly/>
</template>
</el-table-column>
<el-table-column label="准结" width="110" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].准结定额工时" size="mini" readonly/>
</template>
</el-table-column>
<el-table-column label="外协预算价格" width="110" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].外协预算价格_系数" size="mini" />
</template>
</el-table-column>
</el-table>
<el-button size="small" type="primary" style="float:right;margin: 10px" @click="saveRowPrice">保存</el-button>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="编辑" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="面积" prop="面积" style="margin-left: 200px">
<el-input v-model="form.面积" placeholder="面积" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="重量" prop="重量" style="margin-left: 200px">
<el-input v-model="form.重量" placeholder="重量" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="材料费" prop="材料费" style="margin-left: 200px">
<el-input v-model="form.材料费" placeholder="材料费" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchPartNum1, searchPartNum2, searchTable, saveWeightArea, saveMaterialPrice, saveRowPrice } from '@/api/Outsourcing/OutsourcingPriceBudget'
export default {
data() {
return {
lingjianhao: '',
dialogFormVisible: false,
form: {
面积: '',
重量: '',
材料费: ''
},
rules: {
},
cailiaofei: '',
result: [],
result2: [],
radio: 1,
partName: '', // 零件名称
date01: '', // 开始时间
date02: '', // 结束时间
loading0: false,
tableData: [],
loading2: false,
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1 // 后台获取页
}
},
methods: {
radioChange() {
this.tableData2 = []
},
// 查零件号
searchPartNum() {
if (this.partName === null) {
this.partName = ''
}
if (this.date01 === '') {
this.date01 = null
}
if (this.date02 === '') {
this.date02 = null
}
this.loading2 = true
this.tableData2 = []
this.tableData = []
if (this.radio === 1) {
searchPartNum1(this.partName, this.date01, this.date02, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
} else {
searchPartNum2(this.partName, this.date01, this.date02, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
}
},
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = ['', '', '', '', '', 0]
columns.forEach((column, index) => {
if (index === 1) {
sums[1] = '统计总价:'
return
} else if (index === 5) {
for (let i = 0; i < data.length; i++) {
sums[5] += parseFloat(data[i].外协预算价格_系数)
}
sums[5] = parseInt(sums[5] * 100) / 100
}
})
return sums
},
searchTable(row) {
this.loading0 = true
this.tableData = []
searchTable(row.工艺计划流水号, 2).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].外协预算价格_系数 !== 0) {
response.data[i].外协预算价格_系数 = response.data[i].外协预算价格_系数.toFixed(2)
}
}
this.cailiaofei = row.材料费
this.tableData = response.data
this.loading0 = false
})
},
// 打开编辑
edit(index, row) {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.面积 = row.面积
this.form.重量 = row.重量
this.form.材料费 = row.材料费
this.lingjianhao = row.工艺计划流水号
this.dialogFormVisible = true
},
// 编辑确定
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.WithdrawingEdit()
this.dialogFormVisible = false
}
})
},
// 编辑
WithdrawingEdit() {
if ((this.form.重量 === '' || this.form.重量 === null) && (this.form.面积 === '' || this.form.面积 === null)) {
this.form.重量 = null
this.form.面积 = null
saveWeightArea(this.lingjianhao, this.form.重量, this.form.面积).then(() => {
this.WithdrawingEdit2()
})
} else {
saveWeightArea(this.lingjianhao, this.form.重量, this.form.面积).then(() => {
this.WithdrawingEdit2()
})
}
},
WithdrawingEdit2() {
if (this.form.材料费 === '' || this.form.材料费 === null) {
this.form.材料费 = 0
saveMaterialPrice(this.lingjianhao, this.form.材料费).then(response => {
this.$message.success('保存成功')
this.searchPartNum()
})
} else {
saveMaterialPrice(this.lingjianhao, this.form.材料费).then(response => {
this.$message.success('保存成功')
this.searchPartNum()
})
}
},
// 关闭扣款编辑
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
// 保存行价格
saveRowPrice() {
if (this.tableData.length === 0) {
this.$message.error('请选择零件')
} else {
for (let i = 0; i < this.tableData.length; i++) {
saveRowPrice(this.tableData[i].工序流水号, parseFloat(this.tableData[i].外协预算价格_系数), this.tableData[i].工艺计划流水号, this.cailiaofei).then(response => {
})
}
this.$message.success('保存成功')
this.searchPartNum()
}
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.searchPartNum()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchPartNum()
}
}
}
</script>
<style scoped>
span{
margin: 10px 0 10px 10px;
}
.el-date-editor{
width:150px
}
.el-card{
margin-bottom: 15px;
}
</style>

View File

@@ -0,0 +1,285 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="header">
<span>外协到货单号:</span>
<el-input v-model="orderNumber" clearable style="width: 200px" size="small"/>
<span>外协厂家:</span>
<el-input v-model="outsourcingSupplier" clearable style="width: 200px" size="small"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
</div>
<el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 600px;" height="400px" size="mini" @row-click="searchTable2">
<el-table-column label="序号" align="center" width="80" type="index"/>
<el-table-column label="外协到货单号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.外协到货单编号 }}
</template>
</el-table-column>
<el-table-column label="外协厂家" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="创建日期" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.操作日期 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px 0;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries" show-summary border style="width: 100%;min-height: 400px" height="400px" size="mini">
<el-table-column label="序号" align="center" width="80" type="index"/>
<el-table-column label="零件名称" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="零件图号" align="center">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件数量" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="质检人员" align="center">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="检验数量" align="center">
<template slot-scope="scope">
{{ scope.row.数量 || 0 }}
</template>
</el-table-column>
<el-table-column label="不合格数量" align="center">
<template slot-scope="scope">
{{ scope.row.不合格数量 || 0 }}
</template>
</el-table-column>
<el-table-column label="不合格原因" align="center" width="90px">
<template slot-scope="scope">
{{ scope.row.不合格原因文本 }}
</template>
</el-table-column>
<el-table-column label="处理结果" align="center">
<template slot-scope="scope">
{{ scope.row.不合格处理文本 }}
</template>
</el-table-column>
<el-table-column label="检验时间" align="center">
<template slot-scope="scope">
{{ scope.row.操作时间 || '—' }}
</template>
</el-table-column>
<el-table-column label="形位" align="center" width="100">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="类别">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="数值">
<template slot-scope="scope">
{{ scope.row.数值 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" plain size="mini" icon="el-icon-search" @click="searchTableDetail(1, scope.row.外协到货单明细流水号)">形位</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column label="尺寸" align="center" width="100">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="类别">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="数值">
<template slot-scope="scope">
{{ scope.row.数值 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" plain size="mini" icon="el-icon-search" @click="searchTableDetail(2, scope.row.外协到货单明细流水号)">尺寸</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column label="外观" align="center" width="100">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="类别">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="数值">
<template slot-scope="scope">
{{ scope.row.数值 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" plain size="mini" icon="el-icon-search" @click="searchTableDetail(3, scope.row.外协到货单明细流水号)">外观</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { searchTable1, searchTable2, searchTableDetail } from '@/api/Outsourcing/OutsourcingQCSearch'
export default {
name: 'OutsourcingQCSearch',
data() {
return {
orderNumber: '',
outsourcingSupplier: '',
tableData1: [],
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData2: [],
pageCurrent2: 1,
pageSize2: 10,
total2: 0,
gridData: []
}
},
mounted() {
this.searchTable1()
},
methods: {
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 3) {
const values = data.map(item => Number(item['批次数量']) || 0)
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number((prev + curr).toFixed(2))
} else {
return Number((prev).toFixed(2))
}
}, 0)
sums[index] += ''
} else {
sums[index] = 'N/A'
}
} else if (index === 4) {
const values = data.map(item => Number(item['数量']) || 0)
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number((prev + curr).toFixed(2))
} else {
return Number((prev).toFixed(2))
}
}, 0)
sums[index] += ''
} else {
sums[index] = 'N/A'
}
} else if (index === 5) {
const values = data.map(item => Number(item['不合格数量']) || 0)
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number((prev + curr).toFixed(2))
} else {
return Number((prev).toFixed(2))
}
}, 0)
sums[index] += ''
} else {
sums[index] = 'N/A'
}
} else if (index === 6) {
sums[index] = '检验比例:' + ((sums[4] / sums[3]) * 100).toFixed(2) + '%'
}
})
return sums
},
// 查询到货单列表
searchTable1() {
let check1, check2
this.orderNumber ? check1 = 1 : check1 = 0
this.outsourcingSupplier ? check2 = 1 : check2 = 0
searchTable1(this.pageCurrent1, this.pageSize1, check1, this.orderNumber, check2, this.outsourcingSupplier).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2(row) {
searchTable2(row.外协到货单流水号).then(response => {
this.tableData2 = response.data
})
},
searchTableDetail(type, num) {
searchTableDetail(type, num).then(response => {
this.gridData = response.data
})
}
}
}
</script>
<style scoped>
.header span{
margin: 0 0 0 20px;
}
</style>

View File

@@ -0,0 +1,127 @@
<template>
<div class="app-container">
<el-card>
<span>零件号:</span>
<el-input v-model="partNum" placeholder="零件号" size="small" clearable style="width:200px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="PageCurrent=1;PageSize=10;searchTable()">查询</el-button>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" border style="width: 100%;" height="650" stripe>
<el-table-column label="机床图号" width="180px" align="center">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" width="100px" align="center">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="零件图号" width="250px" align="center">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" width="100px" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="数量" width="100px" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<!--<el-table-column label="已入库数量" width="100px" align="center">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.入库数量 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column label="零件状态" align="center" >
<template slot-scope="scope">
<el-steps :active="active[scope.$index]" finish-status="success" simple process-status="finish">
<el-step title="未协"/>
<el-step title="已协"/>
<el-step title="交检"/>
<el-step title="入库"/>
</el-steps>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading0"
:current-page="PageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="10"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</div>
</template>
<script>
import { searchOutHelpState } from '@/api/Outsourcing/OutsourcingStatus'
export default {
data() {
return {
loading0: false,
partNum: '', // 零件图号
check: '',
tableData: [],
active: [],
PageCurrent: 1,
PageSize: 10,
total: 0
}
},
methods: {
searchTable() {
this.loading0 = true
this.total = 0
this.tableData = []
this.active = []
if (this.partNum !== '') {
this.check = 1
} else { this.check = 0 }
searchOutHelpState(this.PageCurrent, this.PageSize, this.check, this.partNum).then(response => {
if (response.data.rows.length !== 0) {
this.total = response.data.total
this.tableData = response.data.rows
for (let i = 0; i < response.data.rows.length; i++) {
this.active.push(parseInt(response.data.rows[i].外协零件状态) + 1)
}
} else {
this.loading0 = false
}
}).then(() => {
this.loading0 = false
})
},
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.PageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,835 @@
<template>
<div class="app-container">
<el-card>
<span>表单号:</span>
<el-input v-model="formNumber" size="small" placeholder="表单号" clearable style="width:200px"/>
<span>外协厂家:</span>
<el-input v-model="manufacturers" size="small" placeholder="外协厂家" style="width:200px" clearable/>
<span>下达任务日期:</span>
<el-date-picker
v-model="time"
type="date"
size="small"
placeholder="选择日期"/>
<el-button type="success" size="mini" icon="el-icon-search" style="margin-left:10px" @click="pageSize=10;pageList=1;fetchData()">查询</el-button>
<el-button type="primary" size="mini" icon="el-icon-download" style="margin-left:10px" @click="exportTable('RWD')">导出外协加工任务单</el-button>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="List" highlight-current-row height="350" border @row-click="searchProcess" >
<el-table-column label="付款状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.实际付款时间!==''" type="success" size="small" style="margin: 0px">已付款</el-tag>
<el-tag v-else type="info" size="small" style="margin: 0px">未付款</el-tag>
</template>
</el-table-column>
<el-table-column label="表单号" align="center" min-width="200px">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="外协厂家" align="center" min-width="200px">
<template slot-scope="scope">
{{ scope.row.外协厂家 }}
</template>
</el-table-column>
<el-table-column label="任务下达日期" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.任务下达日期 }}
</template>
</el-table-column>
<el-table-column label="外协计划员" align="center" >
<template slot-scope="scope">
{{ scope.row.外协计划员 }}
</template>
</el-table-column>
<el-table-column label="运费" align="center" >
<template slot-scope="scope">
{{ scope.row.运费 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-show="!loading2"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<el-table
ref="multipleTable"
:data="List3"
border
highlight-current-row
height="450"
tooltip-effect="dark"
style="width: 100%;margin-top: 20px"
@selection-change="handleSelectionChange">
<el-table-column
:selectable="selectable"
type="selection"
align="center"
width="55"/>
<el-table-column label="收货状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.到货状态===1" type="success" size="small" style="margin: 0px">已收货</el-tag>
<el-tag v-else type="info" size="small" style="margin: 0px">未收货</el-tag>
</template>
</el-table-column>
<el-table-column label="零件图号" align="center" >
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" >
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" >
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="外协工序" align="center">
<template slot-scope="scope">
{{ scope.row.外协工序 }}
</template>
</el-table-column>
</el-table>
<el-button type="info" size="mini" icon="el-icon-arrow-down" style="margin-left:10px;margin-top: 15px" @click="getSpareParts">收货</el-button>
</el-card>
<el-card>
<div id="RWD">
<table cellspacing="0px" align="center" width="100%" style="">
<tbody id="1">
<tr>
<td colspan="4" style="text-align: left;font-size: 30px;font-weight: bold">GAOJING</td>
<td colspan="24" style="text-align:center;font-size: 30px;font-weight: bold">外协加工任务单</td>
</tr>
<tr class="tbodyHead">
<td colspan="2">任务单号:</td>
<td colspan="6">{{ 任务单号 }}</td>
<td colspan="4">任务下达日期:</td>
<td colspan="4">{{ 任务下达日期 }}</td>
<td colspan="3">外协厂家:</td>
<td colspan="9">{{ 外协厂家 }}</td>
</tr>
<tr class="tbodyHead">
<td colspan="2">外协员:</td>
<td colspan="6">{{ 外协员 }}</td>
<td colspan="2">电话:</td>
<td colspan="6">{{ 外协员电话 }}</td>
<td colspan="3">联系人:</td>
<td colspan="3">{{ 联系人 }}</td>
<td colspan="2">电话:</td>
<td colspan="4">{{ 联系人电话 }}</td>
</tr>
<tr id="tableHead">
<td style="width: 2%">序号</td>
<td colspan="5">零件图号</td>
<td colspan="2" style="width: 4%">零件名称</td>
<td colspan="2" style="width: 2%">数量</td>
<td colspan="9" width="30%">内容</td>
<td colspan="1">零件类型</td>
<td>外协类别</td>
<td>加工价格</td>
<td>材料价格</td>
<td>其他价格</td>
<td colspan="2">计划开始</td>
<td colspan="2">计划结束</td>
</tr>
</tbody>
<tfoot>
<tr id="tableFoot">
<td>费用</td>
<td colspan="17" style="text-align: left;">加工费{{ 加工价格合计 }}材料费{{ 材料价格合计 }}其他费用{{ 其他价格合计 }}运费{{ 运费 }}合计{{ 总计 }}人民币大写{{ 大写金额 }}</td>
<td colspan="1">0</td>
<td colspan="1"/>
<td/>
<td>{{ 加工价格合计 }}</td>
<td>{{ 材料价格合计 }}</td>
<td>{{ 其他价格合计 }}</td>
<td colspan="2">{{ 最早时间 }}</td>
<td colspan="2">{{ 最晚时间 }}</td>
</tr>
<tr class="foot">
<td colspan="4">外协员:</td>
<td colspan="4">外协科长:</td>
<td colspan="4">采购二部长:</td>
<td colspan="4">制品部长:</td>
<td colspan="4">定额科统计员:</td>
<td colspan="4">定额科长:</td>
<td colspan="4">外协厂:</td>
</tr>
</tfoot>
</table>
</div>
</el-card>
</div>
</template>
<script>
import { handlechange, shouhuo, getTable, getprocedure, spareParts, Arrival, getParts } from '@/api/Outsourcing/OutsourcingTaskQuery'
import { getExplorer, method5, Cleanup } from '@/vendor/exportExcel'
import { convertCurrency } from '@/vendor/int2Chinese'
import { mapGetters } from 'vuex'
import elInput from 'element-ui/packages/input'
import $ from 'jquery'
export default {
components: {
elInput
},
data() {
return {
OutsouringNumber: [],
wancheng: '',
gongxulsh: [],
bianliang: [],
card: false,
费用: '',
加工价格合计: 0,
材料价格合计: 0,
其他价格合计: 0,
运费: 0,
总计: 0,
大写金额: '',
任务单号: '',
任务下达日期: '',
外协厂家: '',
外协员: '',
外协员电话: '',
联系人: '',
联系人电话: '',
最早时间: '',
最晚时间: '',
// 以上是新增的
loading: false,
loading1: false,
loading2: false,
num: null,
num1: null,
num2: null,
name1: '',
time: '',
time1: '',
time2: '',
input: '',
contrast: 3000000000000,
contrast1: 0,
param: 0,
partNumber: '',
processingPrice: null,
materialPrice: null,
formNumber: '',
coOperationProcess: [],
ManufactorNumber: null,
ManufactorNumber1: null,
manufacturers: '',
dialogFormVisible: false,
dialogFormVisible1: false,
data2: [],
List: [],
money: null,
sum: 0,
num10: [],
title: '',
result: 0,
documentStatus: null,
sign: null,
Number: null,
form: {
表单号: '',
下达任务日期: '',
外协厂家: '',
运费: null
},
rules: {
外协厂家: [{ required: true, message: '请选择外协厂家', trigger: 'change' }],
运费: [{ required: true, message: '请输入运费', trigger: 'blur' }]
},
code: 0,
code1: 0,
processNum: [],
single: null,
procedure: [],
List1: [],
List2: [],
List3: [],
Explain: '',
freight: null,
defaultProps: {
children: 'children',
label: 'label'
},
process: [[]],
returns: [],
零件图号: [],
零件名称: [],
批次数量: [],
外协预算总价格: [],
加工价格_成交: [],
外协分类: [],
材料费: [],
材料价格_价格: [],
其他价格: [],
机加工开始时间: [],
机加工结束时间: [],
外协加工任务单明细流水号: [],
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageList: 1, // 后台获取页
currentPage: 1 // 显示当前页
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id'
])
},
created() {
this.fetchData()
},
methods: {
exportTable() {
if (this.List3.length === 0) {
this.$message.warning('暂无数据')
} else {
const htmlNode = $('#RWD').html()
const body = $('body')
body.children().hide()
const printNode = $(htmlNode)
body.append(printNode)
window.print()
body.children().not('script').show()
printNode.remove()
}
},
shouhuo(row) {
this.$confirm('此操作将不可更改, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.wancheng === 1) {
for (let i = 0; i < this.gongxulsh.length; i++) {
handlechange(this.gongxulsh[i].工序流水号, '0000')
if (i === this.gongxulsh.length - 1) {
shouhuo(row.外协加工任务单流水号).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
}
})
}
}
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
})
})
},
fetchData() {
this.loading2 = true
var day3 = new Date(this.time)
var day4 = new Date(this.time)
day3.setTime(day3.getTime() - 24 * 60 * 60 * 1000)
day4.setTime(day4.getTime() + 24 * 60 * 60 * 1000)
var month1 = day3.getMonth() + 1
var month2 = day4.getMonth() + 1
var day1 = day3.getDate()
var day2 = day4.getDate()
if (month1 >= 1 && month1 <= 9) {
month1 = '0' + month1
}
if (day1 >= 1 && day1 <= 9) {
day1 = '0' + day1
}
if (month2 >= 1 && month2 <= 9) {
month2 = '0' + month2
}
if (day2 >= 1 && day2 <= 9) {
day2 = '0' + day2
}
this.time1 = day3.getFullYear() + '/' + month1 + '/' + day1
this.time2 = day4.getFullYear() + '/' + month2 + '/' + day2
if (this.formNumber !== '') {
this.num = 1
} else {
this.num = 0
}
if (this.manufacturers !== '') {
this.num1 = 1
} else {
this.num1 = 0
}
if (this.time === '' || this.time === null) {
this.num2 = 0
} else {
this.num2 = 1
}
if (this.time1 === 'NaN/NaN/NaN') {
this.time1 = ''
}
if (this.time2 === 'NaN/NaN/NaN') {
this.time2 = ''
}
this.List = []
this.List3 = []
getTable(this.num, this.formNumber, this.num1, this.manufacturers, this.num2, this.time1, this.time2, this.id, this.pageList, this.pageSize).then(response => {
this.total = parseInt(response.data.total)
for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].任务下达日期 !== null) {
response.data.rows[i].任务下达日期 = response.data.rows[i].任务下达日期.substr(0, 10)
}
}
this.List = response.data.rows
})
this.loading2 = false
},
selectable(row, index) { // 控制某行是否可选
return parseInt(row.到货状态) !== 1 // 已经到货
},
// 查询
searchProcess(row) {
this.wancheng = ''
this.gongxulsh = []
this.任务单号 = row.表单号
this.任务下达日期 = row.任务下达日期
this.外协厂家 = row.外协厂家
this.外协员 = row.外协计划员
// 以上是新增的
this.contrast = 3000000000000
this.contrast1 = 0
this.loading = true
this.List3 = []
this.bianliang = []
this.零件图号 = []
this.零件名称 = []
this.批次数量 = []
this.外协预算总价格 = []
this.加工价格_成交 = []
this.外协分类 = []
this.材料费 = []
this.材料价格_价格 = []
this.其他价格 = []
this.机加工开始时间 = []
this.机加工结束时间 = []
this.外协加工任务单明细流水号 = []
this.process = []
this.freight = row.运费
this.Number = row.外协加工任务单流水号
getParts(this.Number).then(response => {
const data = response.data
for (let i = 0; i < data.length; i++) {
data[i].差价 = data[i].外协预算总价格 * 1.15.toFixed(2) + data[i].材料费 * 1.15.toFixed(2) - data[i].加工价格_成交.toFixed(2) - data[i].材料价格_价格.toFixed(2) - data[i].其他价格.toFixed(2)
}
this.returns = data
for (let j = 0; j < data.length; j++) {
this.List3.push({
零件图号: data[j].零件图号,
零件名称: data[j].零件名称,
批次数量: data[j].批次数量,
到货状态: data[j].到货状态,
工艺计划流水号: data[j].工艺计划流水号,
外协加工任务单明细流水号: data[j].外协加工任务单明细流水号,
单件是否外协: data[j].单件是否外协,
外协工序: ''
})
}
this.getProcedure(this.List3)
this.加工价格合计 = 0
this.材料价格合计 = 0
this.其他价格合计 = 0
if (response.data.length !== 0) {
this.外协员电话 = response.data[0].联系电话
this.联系人 = response.data[0].联系人
this.联系人电话 = response.data[0].电话
this.运费 = response.data[0].运费
this.card = true
} else {
this.card = false
}
const children = document.getElementsByClassName('tableData')
const parent = document.getElementById('1')
if (children.length !== 0) {
for (let i = children.length - 1; i >= 0; i--) {
parent.removeChild(children[i])
}
}
const tr = []
for (let i = 0; i < this.returns.length; i++) {
tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = '<td></td>' + '<td colspan="5"></td>' + '<td colspan="2"></td>' + '<td colspan="2"></td>' +
'<td colspan="9" style="text-align: left;"></td>' + '<td colspan="1"></td>' + '<td></td><td></td><td></td><td></td><td colspan="2"></td><td colspan="2"></td>'
$('#tableHead').after(tr[i])
}
for (let j = 0; j < this.returns.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = response.data[j].零件图号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = response.data[j].零件名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = response.data[j].批次数量
document.getElementsByClassName('tableData')[j].children[4].innerHTML = ''
document.getElementsByClassName('tableData')[j].children[5].innerHTML = response.data[j].是否临时件1
document.getElementsByClassName('tableData')[j].children[6].innerHTML = response.data[j].外协分类
document.getElementsByClassName('tableData')[j].children[7].innerHTML = parseInt(response.data[j].加工价格_成交.toFixed(2))
document.getElementsByClassName('tableData')[j].children[8].innerHTML = parseInt(response.data[j].材料价格_价格.toFixed(2))
document.getElementsByClassName('tableData')[j].children[9].innerHTML = parseInt(response.data[j].其他价格.toFixed(2))
if (response.data[j].机加工开始时间 !== null) {
document.getElementsByClassName('tableData')[j].children[10].innerHTML = response.data[j].机加工开始时间.substr(0, 10)
}
if (response.data[j].机加工结束时间 !== null) {
document.getElementsByClassName('tableData')[j].children[11].innerHTML = response.data[j].机加工结束时间.substr(0, 10)
}
this.加工价格合计 += parseInt(document.getElementsByClassName('tableData')[j].children[7].innerHTML)
this.材料价格合计 += parseInt(document.getElementsByClassName('tableData')[j].children[8].innerHTML)
this.其他价格合计 += parseInt(document.getElementsByClassName('tableData')[j].children[9].innerHTML)
}
this.总计 = this.加工价格合计 + this.材料价格合计 + this.其他价格合计 + this.运费
this.大写金额 = convertCurrency(this.总计)
// RWD end
if (response.data.length === 0) {
this.loading = false
}
for (let i = 0; i < response.data.length; i++) { // 声明二维数组
this.零件图号.push(response.data[i].零件图号)
this.零件名称.push(response.data[i].零件名称)
this.批次数量.push(response.data[i].批次数量)
this.外协预算总价格.push(response.data[i].外协预算总价格.toFixed(2))
this.加工价格_成交.push(response.data[i].加工价格_成交.toFixed(2))
this.外协分类.push(response.data[i].外协分类)
this.材料费.push(response.data[i].材料费.toFixed(2))
this.材料价格_价格.push(response.data[i].材料价格_价格.toFixed(2))
this.其他价格.push(response.data[i].其他价格.toFixed(2))
if (response.data[i].机加工开始时间 !== null) {
this.机加工开始时间.push(response.data[i].机加工开始时间.substr(0, 10))
} else {
this.机加工开始时间.push(' ')
}
if (response.data[i].机加工结束时间 !== null) {
this.机加工结束时间.push(response.data[i].机加工结束时间.substr(0, 10))
} else {
this.机加工结束时间.push(' ')
}
this.外协加工任务单明细流水号.push(response.data[i].外协加工任务单明细流水号)
this.process[i] = []
}
for (let i = 0; i < this.returns.length; i++) {
spareParts(this.returns[i].工艺计划流水号, this.returns[i].单件是否外协).then(response => {
for (let k = 0; k < response.data.length; k++) {
this.gongxulsh.push({
工序流水号: response.data[k].工序流水号
})
this.process[i][k] = response.data[k].工艺名称简称
document.getElementsByClassName('tableData')[i].children[4].innerHTML += response.data[k].工艺名称简称 + '/'
}
}).then(() => {
this.wancheng = 1
})
}
}).then(() => {
// this.List3 = this.bianliang
this.loading = false
})
},
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
getProcedure(row) {
for (let i = 0; i < row.length; i++) {
getprocedure(row[i].工艺计划流水号, row[i].单件是否外协).then(response => {
this.procedure[i] = ''
for (let j = 0; j < response.data.length; j++) {
this.procedure[i] = this.procedure[i] + ' ' + response.data[j].工艺名称简称
}
this.List3[i].外协工序 = this.procedure[i]
})
}
},
getSummaries(param) {
const { data } = param
const sums = ['', '', '', 0, '', 0, '', 0, '', 0, '', 0, '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, '', 0, 0, 0, '', '']
sums[1] = '费用'
sums[2] = '加工费:'
sums[4] = '材料费:'
sums[6] = '其他费用:'
sums[8] = '运费:'
sums[9] = parseInt(this.freight)
sums[10] = '合计:'
for (let i = 0; i < data.length; i++) {
sums[24] += Math.round(parseFloat(data[i].外协预算总价格) * 100) / 100
}
sums[24] = Math.round(sums[24] * 100) / 100
for (let i = 0; i < data.length; i++) {
sums[25] += Math.round(parseFloat(data[i].加工价格_成交) * 100) / 100
}
sums[25] = Math.round(sums[25] * 100) / 100
for (let i = 0; i < data.length; i++) {
sums[27] += Math.round(parseFloat(data[i].材料费) * 100) / 100
}
sums[27] = Math.round(sums[27] * 100) / 100
for (let i = 0; i < data.length; i++) {
sums[28] += Math.round(parseFloat(data[i].材料价格_价格) * 100) / 100
}
sums[28] = Math.round(sums[28] * 100) / 100
for (let i = 0; i < data.length; i++) {
sums[29] += Math.round(parseFloat(data[i].其他价格) * 100) / 100
}
sums[29] = Math.round(sums[29] * 100) / 100
for (let i = 0; i < data.length; i++) {
if (data[i].机加工开始时间 !== null) {
if (Date.parse(data[i].机加工开始时间) <= this.contrast) {
this.contrast = Date.parse(data[i].机加工开始时间)
sums[30] = data[i].机加工开始时间.substr(0, 10)
this.最早时间 = data[i].机加工开始时间.substr(0, 10)
}
}
}
for (let i = 0; i < data.length; i++) {
if (data[i].机加工结束时间 !== null) {
if (Date.parse(data[i].机加工结束时间) >= this.contrast1) {
this.contrast1 = Date.parse(data[i].机加工结束时间)
sums[31] = data[i].机加工结束时间.substr(0, 10)
this.最晚时间 = data[i].机加工结束时间.substr(0, 10)
}
}
}
sums[3] = sums[25]
sums[5] = sums[28]
sums[7] = sums[29]
sums[11] = Math.round((sums[3] + sums[5] + sums[7] + sums[9]) * 100) / 100
sums[26] = '---'
return sums
},
indexMethod(index) {
return index + 1
},
handleSelectionChange(val) {
this.OutsouringNumber = []
for (let i = 0; i < val.length; i++) {
this.OutsouringNumber.push(val[i].外协加工任务单明细流水号)
}
},
getSpareParts() { // 选入零件
if (this.OutsouringNumber.length !== 0) {
Arrival(this.OutsouringNumber).then(response => {
console.log(response.data)
if (response.data[0].result === '1') {
this.$message.success('到货成功')
this.contrast = 3000000000000
this.contrast1 = 0
this.loading = true
this.List3 = []
this.零件图号 = []
this.零件名称 = []
this.批次数量 = []
this.外协预算总价格 = []
this.加工价格_成交 = []
this.外协分类 = []
this.材料费 = []
this.材料价格_价格 = []
this.其他价格 = []
this.机加工开始时间 = []
this.机加工结束时间 = []
this.外协加工任务单明细流水号 = []
this.process = []
getParts(this.Number).then(response => {
this.returns = response.data
for (let j = 0; j < response.data.length; j++) {
this.List3.push({
零件图号: response.data[j].零件图号,
零件名称: response.data[j].零件名称,
批次数量: response.data[j].批次数量,
到货状态: response.data[j].到货状态,
工艺计划流水号: response.data[j].工艺计划流水号,
外协加工任务单明细流水号: response.data[j].外协加工任务单明细流水号,
单件是否外协: response.data[j].单件是否外协,
外协工序: ''
})
}
this.getProcedure(this.List3)
this.加工价格合计 = 0
this.材料价格合计 = 0
this.其他价格合计 = 0
if (response.data.length !== 0) {
this.外协员电话 = response.data[0].联系电话
this.联系人 = response.data[0].联系人
this.联系人电话 = response.data[0].电话
this.运费 = response.data[0].运费
this.card = true
} else {
this.card = false
}
const children = document.getElementsByClassName('tableData')
const parent = document.getElementById('1')
if (children.length !== 0) {
for (let i = children.length - 1; i >= 0; i--) {
parent.removeChild(children[i])
}
}
const tr = []
for (let i = 0; i < this.returns.length; i++) {
tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = '<td></td>' + '<td colspan="5"></td>' + '<td colspan="2"></td>' + '<td colspan="2"></td>' +
'<td colspan="9" style="text-align: left;"></td>' + '<td colspan="1"></td>' + '<td></td><td></td><td></td><td></td><td colspan="2"></td><td colspan="2"></td>'
$('#tableHead').after(tr[i])
}
for (let j = 0; j < this.returns.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = response.data[j].零件图号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = response.data[j].零件名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = response.data[j].批次数量
document.getElementsByClassName('tableData')[j].children[4].innerHTML = ''
document.getElementsByClassName('tableData')[j].children[5].innerHTML = response.data[j].是否临时件1
document.getElementsByClassName('tableData')[j].children[6].innerHTML = response.data[j].外协分类
document.getElementsByClassName('tableData')[j].children[7].innerHTML = parseInt(response.data[j].加工价格_成交.toFixed(2))
document.getElementsByClassName('tableData')[j].children[8].innerHTML = parseInt(response.data[j].材料价格_价格.toFixed(2))
document.getElementsByClassName('tableData')[j].children[9].innerHTML = parseInt(response.data[j].其他价格.toFixed(2))
if (response.data[j].机加工开始时间 !== null) {
document.getElementsByClassName('tableData')[j].children[10].innerHTML = response.data[j].机加工开始时间.substr(0, 10)
}
if (response.data[j].机加工结束时间 !== null) {
document.getElementsByClassName('tableData')[j].children[11].innerHTML = response.data[j].机加工结束时间.substr(0, 10)
}
this.加工价格合计 += parseInt(document.getElementsByClassName('tableData')[j].children[7].innerHTML)
this.材料价格合计 += parseInt(document.getElementsByClassName('tableData')[j].children[8].innerHTML)
this.其他价格合计 += parseInt(document.getElementsByClassName('tableData')[j].children[9].innerHTML)
}
this.总计 = this.加工价格合计 + this.材料价格合计 + this.其他价格合计 + this.运费
this.大写金额 = convertCurrency(this.总计)
if (response.data.length === 0) {
this.loading = false
}
for (let i = 0; i < response.data.length; i++) { // 声明二维数组
this.零件图号.push(response.data[i].零件图号)
this.零件名称.push(response.data[i].零件名称)
this.批次数量.push(response.data[i].批次数量)
this.外协预算总价格.push(response.data[i].外协预算总价格.toFixed(2))
this.加工价格_成交.push(response.data[i].加工价格_成交.toFixed(2))
this.外协分类.push(response.data[i].外协分类)
this.材料费.push(response.data[i].材料费.toFixed(2))
this.材料价格_价格.push(response.data[i].材料价格_价格.toFixed(2))
this.其他价格.push(response.data[i].其他价格.toFixed(2))
if (response.data[i].机加工开始时间 !== null) {
this.机加工开始时间.push(response.data[i].机加工开始时间.substr(0, 10))
} else {
this.机加工开始时间.push(' ')
}
if (response.data[i].机加工结束时间 !== null) {
this.机加工结束时间.push(response.data[i].机加工结束时间.substr(0, 10))
} else {
this.机加工结束时间.push(' ')
}
this.外协加工任务单明细流水号.push(response.data[i].外协加工任务单明细流水号)
this.process[i] = []
spareParts(this.returns[i].工艺计划流水号, this.returns[i].单件是否外协).then(response => {
for (let k = 0; k < response.data.length; k++) { // 执行n次2
this.process[i].push(response.data[k].工艺名称简称)
document.getElementsByClassName('tableData')[i].children[4].innerHTML += response.data[k].工艺名称简称 + '/'
}
}).then(() => {
this.loading = false
})
}
})
} else {
this.$message.error('到货失败')
}
})
} else {
this.$message.warning('请选择零件')
}
},
downLoadRWD(tableid) {
if (this.List3.length === 0) {
this.$message.warning('暂无数据')
} else {
getExplorer()
method5(tableid)
Cleanup()
}
},
// 表格颜色
tableRowClassName({ row }) {
if (row.差价 < 0) {
return 'chajia'
} else {
return ''
}
},
// 分页
handleSizeChange(val) {
this.pageList = 1
this.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.pageList = val
this.fetchData()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
</style>
<style>
td{
width: 100px;
height: 30px;
text-align:center;
}
#tableHead td{
border:1px solid black;
}
.tableData td{
border:1px solid black;
}
#tableFoot td{
border:1px solid black;
}
.tbodyHead td{
text-align: left;
}
.foot td{
width: 7%;
text-align: left;
}
</style>
<style>
.el-table .chajia {
background: #EBF953;
}
.el-table .chengjiao {
background: #AEF199;
}
.el-input__inner {
height: 30px;
}
</style>

View File

@@ -0,0 +1,390 @@
<template>
<div>
<el-card>
<el-row>
<!--<span>项目名称:</span>-->
<!--<el-select v-model="entryNameValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="项目名称" @change="typeChange()">-->
<!--<el-option-->
<!--v-for="item in entryName"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<span>机床名称:</span>
<el-select v-model="toolNumValue" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="机床号" @change="typeChange1()">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<!--<el-select v-model="toolNumValue" clearable filterable size="small" placeholder="机床号" style="margin-bottom:10px" @change="typeChange1()">-->
<!--<el-option-->
<!--v-for="item in toolNum"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<span>分组:</span>
<el-select v-model="NumValue" clearable filterable size="small" style="margin-bottom:10px" placeholder="机床组号">
<el-option
v-for="item in Num"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span>
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize1=10; pageCurrent1=1;searchTable()">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading1" :data="tableData1" highlight-current-row height="350" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable2">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="零件图号" align="center" width="380px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="320px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="种类" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.零件类型名称 }}
</template>
</el-table-column>
<el-table-column label="投产数量" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading1"
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="tableData2" height="350" style="width: 100%;" border element-loading-text="拼命加载中" size="small">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="加工状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.工序状态)===3" type="success" size="small">未加工</el-tag>
<el-tag v-if="parseInt(scope.row.工序状态)===4&&parseInt(scope.row.工艺编号)!==29" size="small">已完成</el-tag>
<el-tag v-if="parseInt(scope.row.工艺编号)===29" size="small">备料</el-tag>
<el-tag v-if="parseInt(scope.row.工序状态)===5" size="small">停产</el-tag>
</template>
</el-table-column>
<el-table-column label="序间外协" width="100" align="center">
<template slot-scope="scope">
<el-checkbox :disabled="parseInt(scope.row.工序状态)!==3||parseInt(scope.row.工艺编号)===29" v-model="checkBox[scope.$index]" @change="edit(scope.$index, scope.row)">选择</el-checkbox>
</template>
</el-table-column>
<el-table-column label="是否外协" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.工序间是否外协)===2" type="success" size="small"></el-tag>
<el-tag v-else size="small"></el-tag>
</template>
</el-table-column>
<el-table-column label="工艺名称" align="center" width="220px">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column label="工艺要求" align="center" width="580px">
<template slot-scope="scope">
<el-input v-model="scope.row.工艺要求" :autosize="{ minRows: 1, maxRows: 1}" size="mini" readonly type="textarea"/>
</template>
</el-table-column>
<el-table-column label="机加工计划开始日期" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.机加工开始时间 }}
</template>
</el-table-column>
<el-table-column label="机加工计划结束日期" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.机加工结束时间 }}
</template>
</el-table-column>
<el-table-column label="工序计划" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.计划日期 }}
</template>
</el-table-column>
<el-table-column label="工序工时" align="center">
<template slot-scope="scope">
{{ scope.row.工序工时 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { machine, getToolNum, getNum, searchTable, searchTable2, edit, edit2 } from '@/api/Outsourcing/PreorderAssociation'
export default {
data() {
return {
entryNameValue: '',
entryName: [], // 项目名称
toolNumValue: '',
toolNum: [], // 机床号
NumValue: '',
Num: [], // 分组
count: 0, // 计数器 (表二是否有外协工序)
InOut: 1, // 工序间是否外协变量 1自家 2外协
num1: '',
checkBox: [],
loading1: false,
loading2: false,
check_partName: false,
partName: '', // 零件名称
tableData1: [], // 表格数据
tableData2: [],
total1: null, // 总条数
pageSize1: 10, // 每页显示条数
pageCurrent1: 1
}
},
created() {
this.typeChange()
this.searchTable()
},
methods: {
fetchData() {
this.entryNameValue = ''
this.entryName = []
machine().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.entryName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
this.NumValue = ''
this.Num = []
getToolNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
},
typeChange1() {
this.NumValue = ''
this.Num = []
getNum(this.toolNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Num.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchTable() {
this.loading1 = true
this.tableData1 = []
this.tableData2 = []
if (this.entryNameValue !== null && this.entryNameValue !== '') {
this.check_entryNameValue = 1
} else {
this.check_entryNameValue = 0
}
if (this.toolNumValue !== null && this.toolNumValue !== '') {
this.check_toolNumValue = 1
} else {
this.check_toolNumValue = 0
}
if (this.NumValue !== null && this.NumValue !== '') {
this.check_NumValue = 1
} else {
this.check_NumValue = 0
}
if (this.partName !== null && this.partName !== '') {
this.check_partName = 1
} else {
this.check_partName = 0
}
searchTable(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, this.pageCurrent1, this.pageSize1).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
}).then(() => {
this.loading1 = false
})
},
searchTable2(row) {
this.loading2 = true
this.checkBox = []
this.tableData2 = []
searchTable2(row.工艺计划流水号).then(response => {
for (let i = 0; i < response.data.length; i++) {
console.log(response.data[i].工序顺序)
}
console.log(response.data, 1111111)
this.num1 = row.工艺计划流水号
if (response.data.length === 0) {
this.loading0 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].工序间是否外协 === 1) {
this.checkBox.push(false)
} else {
this.checkBox.push(true)
}
}
for (let i = 0; i < response.data.length; i++) {
response.data[i].机加工开始时间 = response.data[i].机加工开始时间.split(' ')[0]
response.data[i].机加工结束时间 = response.data[i].机加工结束时间.split(' ')[0]
response.data[i].计划日期 = response.data[i].计划日期.split(' ')[0]
}
this.tableData2 = response.data
}
}).then(() => {
this.loading2 = false
})
},
// 修改外协状态
edit(index, row) {
this.count = 0
for (let i = 0; i < this.tableData2.length; i++) {
if (this.checkBox[i] === false) {
this.count = this.count + 1
}
}
if (this.count === this.tableData2.length) {
edit2(row.工序流水号, row.工艺计划流水号, 0)
}
if (this.checkBox[index] === true) {
this.InOut = 2
edit(row.工序流水号, this.InOut).then(response => {
edit2(row.工序流水号, row.工艺计划流水号, 1).then(response => {
this.$message.success('工序外协状态更改成功')
this.loading2 = true
this.checkBox = []
this.tableData2 = []
searchTable2(this.num1).then(response => {
for (let i = 0; i < response.data.length; i++) {
console.log(response.data[i].工序顺序)
}
console.log(response.data, 1111111)
if (response.data.length === 0) {
this.loading0 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].工序间是否外协 === 1) {
this.checkBox.push(false)
} else {
this.checkBox.push(true)
}
}
for (let i = 0; i < response.data.length; i++) {
response.data[i].机加工开始时间 = response.data[i].机加工开始时间.split(' ')[0]
response.data[i].机加工结束时间 = response.data[i].机加工结束时间.split(' ')[0]
response.data[i].计划日期 = response.data[i].计划日期.split(' ')[0]
}
this.tableData2 = response.data
}
}).then(() => {
this.loading2 = false
})
})
})
} else {
this.InOut = 1
edit(row.工序流水号, this.InOut).then(response => {
this.$message.success('工序外协状态更改成功')
this.loading2 = true
this.checkBox = []
this.tableData2 = []
searchTable2(this.num1).then(response => {
for (let i = 0; i < response.data.length; i++) {
console.log(response.data[i].工序顺序)
}
console.log(response.data, 1111111)
if (response.data.length === 0) {
this.loading0 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].工序间是否外协 === 1) {
this.checkBox.push(false)
} else {
this.checkBox.push(true)
}
}
for (let i = 0; i < response.data.length; i++) {
response.data[i].机加工开始时间 = response.data[i].机加工开始时间.split(' ')[0]
response.data[i].机加工结束时间 = response.data[i].机加工结束时间.split(' ')[0]
response.data[i].计划日期 = response.data[i].计划日期.split(' ')[0]
}
this.tableData2 = response.data
}
}).then(() => {
this.loading2 = false
})
})
}
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable()
}
}
}
</script>
<style scoped>
span{
margin: 10px 0 10px 10px;
}
.el-card{
margin-bottom: 15px;
}
</style>
<style>
.el-table .waixie {
background: #AEF199;
}
</style>

View File

@@ -0,0 +1,302 @@
<template>
<div class="app-container">
<el-card>
<span>零件号:</span>
<el-input v-model="partNum" placeholder="零件号" size="small" clearable style="width:200px"/>
<span>任务下达时间:</span>
<el-date-picker
v-model="timeSlot"
size="small"
clearable
style="width:200px"
type="month"
value-format="yyyy-MM"
placeholder="任务下达时间"/>
<span>合同号:</span>
<el-input v-model="contractNum" placeholder="合同号" size="small" clearable style="width:200px"/>
<span>外协厂家:</span>
<el-select v-model="outHelpValue" size="small" filterable remote clearable placeholder="外协厂家">
<el-option
v-for="item in outHelp"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="PageCurrent=1;PageSize=10;searchTable()">查询</el-button>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" border style="width: 100%;" height="650" stripe>
<el-table-column
label="序号"
type="index"
align="center"
width="50"/>
<el-table-column label="零件号" width="250" align="center">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" width="140" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="外协厂家" width="150" align="center">
<template slot-scope="scope">
{{ scope.row.外协厂家简称 }}
</template>
</el-table-column>
<el-table-column label="合同号" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="材料" width="140" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="项目名称" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="批次数量" width="140" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="废品数量" width="140" align="center">
<template slot-scope="scope">
{{ scope.row.废品数量 }}
</template>
</el-table-column>
<el-table-column label="不合格处理方式" width="200" align="center">
<template slot-scope="scope">
{{ scope.row.不合格处理方式 }}
</template>
</el-table-column>
<el-table-column label="操作" width="130px" align="center" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="handleEdit(scope.$index, scope.row, 'form')">扣款</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading0"
:current-page="PageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible1" title="外协价格计算系数维护" center width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" class="demo-ruleForm" label-width="100px" style="width: 90%;margin: auto">
<el-form-item label="废品数量" prop="wasteQuantity">
<el-input v-model="form.wasteQuantity" size="small" clearable placeholder="请输入废品数量"/>
</el-form-item>
<el-form-item label="处理方式" prop="processingMethod">
<el-input v-model="form.processingMethod" size="small" clearable placeholder="请输入处理方式"/>
</el-form-item>
<el-row>
<el-col :span="14"/>
<el-form-item >
<el-button size="small" @click="callOff('form')">取消</el-button>
<el-button size="small" type="primary" @click="submit('form')"> </el-button>
</el-form-item>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { initOutHelp, searchTable, editList } from '@/api/Outsourcing/UnqualifiedTreatment'
export default {
data() {
return {
num_bhg: '',
count2: 0,
form: {
wasteQuantity: '', // 废品数量
processingMethod: '' // 处理方式
},
dialogFormVisible1: false,
timeSlot: '',
years: '',
months: '',
loading0: false,
contractNum: '',
outHelpValue: '',
outHelp: [],
partNum: '',
tableData: [],
PageCurrent: 1,
PageSize: 10,
total: null,
rules: { // 表单验证规则
wasteQuantity: [{ required: true, message: '请输入废品数量', trigger: 'blur' }],
processingMethod: [{ required: true, message: '请输入处理方式', trigger: 'blur' }]
},
number: ''
}
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
fetchData() {
this.outHelp = []
initOutHelp().then(response => { // 初始化外协厂家;*这里模糊查询省一个存储过程
for (let i = 0; i < response.data.length; i++) {
this.outHelp.push({
label: response.data[i].外协厂家名称,
value: response.data[i].外协厂家流水号
})
}
})
},
searchTable() {
this.loading0 = true
this.tableData = []
if (this.contractNum === '' || this.contractNum === null) {
this.check1 = 0
} else { this.check1 = 1 }
if (this.outHelpValue === '' || this.outHelpValue === null) {
this.check2 = 0
} else { this.check2 = 1 }
if (this.partNum === '' || this.partNum === null) {
this.check3 = 0
} else { this.check3 = 1 }
if (this.timeSlot === '' || this.timeSlot === null) {
this.check4 = 0
this.check5 = 0
} else {
this.check4 = 1
this.check5 = 1
this.years = this.timeSlot.substring(0, this.timeSlot.indexOf('-'))
this.months = this.timeSlot.substring(5, 7)
}
searchTable(this.PageCurrent, this.PageSize, this.check2, this.outHelpValue, this.check1, this.contractNum, this.check3, this.partNum, this.check4, this.years, this.check5, this.months).then(response => {
if (response.data.rows === 0) {
this.loading0 = false
this.total = response.data.total
} else {
this.tableData = response.data.rows
this.total = response.data.total
this.loading0 = false
}
})
},
// 打开编辑
handleEdit(index, row, formName) {
this.count2 = this.count2 + 1
if (this.count2 !== 1) {
this.$refs[formName].resetFields()
}
this.number = row.外协加工任务单明细流水号
this.form.wasteQuantity = row.废品数量
this.num_bhg = row.批次数量
this.form.processingMethod = row.不合格处理方式
this.dialogFormVisible1 = true
},
// 提交编辑
submitEdit() {
if (this.form.wasteQuantity > this.num_bhg) {
this.$message.error('废品数量大于总数量')
} else {
editList(this.number, this.form.wasteQuantity, this.form.processingMethod).then(response => {
if (response.data[0].result === '1') {
this.dialogFormVisible1 = false
this.$message({
type: 'success',
message: '信息更新成功!'
})
this.searchTable()
} else {
this.dialogFormVisible1 = false
this.$message.error('信息更新失败')
}
})
}
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.submitEdit()
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible1 = false
this.$refs[formName].resetFields()
},
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.PageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.doing-row4{
background: #f0f9eb;
}
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:130px
}
span{
margin: 10px 0 10px 10px;
}
</style>
<style>
.mark{
position:fixed;
left:0;
top:0;
opacity:.5;
width:100%;
height:100%;
background:#000;
z-index:998;
}
.content{
position:absolute;
z-index:999;
}
</style>