添加营销系统模块

This commit is contained in:
hedekun
2018-11-08 08:39:42 +08:00
commit f7eb22e5bb
181 changed files with 35426 additions and 0 deletions

View File

@@ -0,0 +1,280 @@
<template>
<div>
<el-card>
<el-row>
<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" :row-class-name="tableRowClassName" height="350" style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="序间外协" width="100" align="center">
<template slot-scope="scope">
<el-checkbox v-model="checkBox[scope.$index]" @change="edit(scope.$index, scope.row)">选择</el-checkbox>
</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 { searchTable, searchTable2, edit, edit2 } from '@/api/Outsourcing/PreorderAssociation'
export default {
data() {
return {
count: 0, // 计数器 (表二是否有外协工序)
InOut: 1, // 工序间是否外协变量 1自家 2外协
num1: '',
checkBox: [],
loading1: false,
loading2: false,
check_partName: false,
partName: '', // 零件名称
tableData1: [], // 表格数据
tableData2: [],
total1: null, // 总条数
pageSize1: 10, // 每页显示条数
pageCurrent1: 1
}
},
methods: {
searchTable() {
this.loading1 = true
this.tableData1 = []
this.tableData2 = []
if (this.partName !== null && this.partName !== '') {
this.check_partName = true
} else {
this.check_partName = false
}
searchTable(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 => {
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) {
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).then(response => {
})
}
if (this.checkBox[index] === true) {
this.InOut = 2
edit(row.工序流水号, this.InOut).then(response => {
edit2(row.工序流水号, row.工艺计划流水号, 1).then(response => {
this.$message.success('工序外协状态更改成功')
})
}).then(() => {
this.loading2 = true
this.checkBox = []
this.tableData2 = []
searchTable2(this.num1).then(response => {
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('工序外协状态更改成功')
}).then(() => {
this.loading2 = true
this.checkBox = []
this.tableData2 = []
searchTable2(this.num1).then(response => {
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()
},
// 表格颜色
tableRowClassName({ row }) {
if (row.工序间是否外协 === 2) {
return 'waixie'
} else {
return ''
}
}
}
}
</script>
<style scoped>
span{
margin: 10px 0 10px 10px;
}
.el-card{
margin-bottom: 15px;
}
</style>
<style>
.el-table .waixie {
background: #AEF199;
}
</style>