家里的样式

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,529 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span class="demonstration">开始加工时间:</span>
<el-date-picker
v-model="startTime1"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime1"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<span class="demonstration">完成加工时间:</span>
<el-date-picker
v-model="startTime2"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime2"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
</el-row>
<el-row>
<span>操作者:</span>
<el-input v-model="workerName" placeholder="操作者" size="small" clearable style="width:200px"/>
<span>零件图号:</span>
<el-input v-model="partNumber" placeholder="零件图号" size="small" clearable style="width:200px"/>
<span>工艺名称:</span>
<el-input v-model="technologyName" placeholder="工艺名称" size="small" clearable style="width:200px"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 10px 0 0 10px" @click="pageCurrent=1;total=0;searchTable();">查询</el-button>
<el-button type="primary" class="el-icon-plus" size="small" style="margin: 10px 0 0 10px" @click="addSupplement();">新增</el-button>
</el-row>
</el-card>
<el-card>
<el-table :data="tableData" height="650" style="width: 100%;" border>
<el-table-column label="序号" type="index" align="center" width="50"/>
<el-table-column label="零件图号" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" min-width="120px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="完成数量" align="center" min-width="80px">
<template slot-scope="scope">
{{ scope.row.完成数量 }}
</template>
</el-table-column>
<el-table-column label="工艺名称" align="center" min-width="80px">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column label="操作者" align="center" min-width="80px">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="实际开始时间" align="center" min-width="160px">
<template slot-scope="scope">
{{ scope.row.加工开始时间 || '—' }}
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" min-width="160px">
<template slot-scope="scope">
{{ scope.row.加工完成时间 || '—' }}
</template>
</el-table-column>
<el-table-column label="实际工时" align="center" min-width="80px">
<template slot-scope="scope">
{{ scope.row.实际加工时间段 || '—' }}
</template>
</el-table-column>
<el-table-column label="修补数量" align="center" min-width="100px">
<template slot-scope="scope">
<template v-if="scope.row.isEditing">
<el-input v-model="scope.row.数量" class="edit-input" size="mini"/>
</template>
<span v-else>{{ scope.row.数量 }}</span>
</template>
</el-table-column>
<el-table-column label="修补工时" align="center" min-width="100px">
<template slot-scope="scope">
<template v-if="scope.row.isEditing">
<el-input v-model="scope.row.修补工时" class="edit-input" size="mini"/>
</template>
<span v-else>{{ scope.row.修补工时 }}</span>
</template>
</el-table-column>
<el-table-column label="修补操作时间" align="center" min-width="160px">
<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" width="240px" fixed="right">
<template slot-scope="scope">
<el-button v-if="scope.row.isEditing" type="mini" size="mini" icon="el-icon-circle-check-outline" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-if="scope.row.isEditing" class="cancel-btn" size="mini" type="warning" @click="cancelEdit(scope.row)">取消</el-button>
<el-button
v-else
:disabled="!(scope.row.加工开始时间 || scope.row.加工完成时间)"
size="mini"
type="primary"
class="el-icon-edit"
@click="handleEdit(scope.row)">编辑</el-button>
<el-button
:disabled="!!(scope.row.加工开始时间 || scope.row.加工完成时间)"
size="mini"
type="danger"
class="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
: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="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="650px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="80px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="项目" prop="project">
<el-select v-model="form.project" filterable size="small" @change="getMachine">
<el-option
v-for="item in projects"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机床" prop="machine">
<el-select v-model="form.machine" filterable size="small" @change="getGroup">
<el-option
v-for="item in machines"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="分组" prop="group">
<el-select v-model="form.group" filterable size="small" @change="getParts">
<el-option
v-for="item in groups"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="零件" prop="part">
<el-select v-model="form.part" filterable size="small" @change="getTechnology">
<el-option
v-for="item in parts"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工艺" prop="technology">
<el-select v-model="form.technology" size="small">
<el-option
v-for="item in technologys"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="修补工时" prop="timeNumber">
<el-input v-model="form.timeNumber" placeholder="修补工时" clearable size="small" style="width: 200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数量" prop="number">
<el-input v-model="form.number" placeholder="数量" clearable size="small" style="width: 200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作工" prop="opNum">
<el-select v-model="form.opNum" size="small" filterable>
<el-option
v-for="item in opNums"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible=false">取消</el-button>
<el-button type="primary" @click="submitAdd()" >确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchTable, editTime, initProject, getMachines, getGroups, getParts, submitAdd } from '@/api/ManufacturingCenter/ActualTimeSupplement'
import { mapGetters } from 'vuex'
import request from '@/utils/request'
export default {
name: 'ActualTimeSupplement',
data() {
return {
workerName: '',
partNumber: '',
technologyName: '',
startTime1: '',
endTime1: '',
startTime2: '',
endTime2: '',
pageCurrent: 1,
pageSize: 10,
total: 0,
tableData: [],
dialogFormVisible: false,
title: '',
form: {
project: '',
machine: '',
group: '',
part: '',
technology: '',
timeNumber: '',
number: '',
opNum: ''
},
rules: {
part: [{ required: true, message: '请选择零件' }],
technology: [{ required: true, message: '请选择工艺' }],
timeNumber: [{ required: true, message: '请填写修补工时' }],
number: [{ required: true, message: '请填写数量' }],
opNum: [{ required: true, message: '请选择操作工' }]
},
projects: [],
machines: [],
groups: [],
parts: [],
technologys: [],
opNums: []
}
},
computed: {
...mapGetters([
'id' // 人员编号
])
},
created() {
this.initData()
this.searchTable()
},
methods: {
// 新增修补工时
addSupplement() {
this.dialogFormVisible = true
},
// 提交新增
submitAdd() {
this.$refs['form'].validate((valid) => {
if (valid) {
submitAdd(this.form.technology, this.form.timeNumber, this.form.number, this.id).then(res => {
if (res.data[0].result === '1') {
this.dialogFormVisible = false
this.$message.success('操作成功')
this.searchTable()
} else {
this.$message.error('操作失败')
}
})
} else {
console.log('error submit!!')
return false
}
})
},
// 提交编辑
confirmEdit(row) {
editTime(this.id, row.完成过程流水号, row.修补工时, row.数量).then(response => {
if (response.data[0].result === '1') {
row.isEditing = false
this.$message.success('修改成功')
this.searchTable()
} else {
this.$message.error('修改失败')
}
})
},
// 取消编辑
cancelEdit(row) {
row.修补工时 = row.原修补工时
row.isEditing = false
this.$message('取消修改')
},
// 初始化数据
initData() {
this.projects = []
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projects.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
this.opNums = []
request({
url: '',
method: 'post',
data: {
type: '3',
name: `select *
from 人事档案管理_人员名单
where 考核部门编号 = 12`
}
}).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.opNums.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
},
// 查机床
getMachine() {
this.form.machine = ''
this.machines = []
this.form.group = ''
this.groups = []
this.form.part = ''
this.parts = []
this.form.technology = ''
this.technologys = []
if (this.form.project !== '') {
getMachines(this.form.project).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
}
},
// 查分组
getGroup() {
this.form.group = ''
this.groups = []
this.form.part = ''
this.parts = []
this.form.technology = ''
this.technologys = []
getGroups(this.form.machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groups.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
// 查零件
getParts() {
this.form.part = ''
this.parts = []
this.form.technology = ''
this.technologys = []
let check1, check2, check3
this.form.project ? check1 = 1 : check1 = 0
this.form.machine ? check2 = 1 : check2 = 0
this.form.group ? check3 = 1 : check3 = 0
this.parts = []
getParts(check1, this.form.project, check2, this.form.machine, check3, this.form.group).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.parts.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
})
},
// 查工艺
getTechnology() {
this.form.technology = ''
this.technologys = []
request({
url: '',
method: 'post',
data: {
type: '3',
name: `select 工艺计划流水号,车间生产管理工艺_基础表_工艺名称.工艺编号,工艺名称,工序流水号
from 车间生产管理工艺_零件工序 inner join 车间生产管理工艺_基础表_工艺名称
on 车间生产管理工艺_零件工序.工艺编号 = 车间生产管理工艺_基础表_工艺名称.工艺编号
where 工艺计划流水号 = ${this.form.part}`
}
}).then(res => {
for (let i = 0; i < res.data.length; i++) {
this.technologys.push({
label: res.data[i].工艺名称,
value: res.data[i].工序流水号
})
}
})
},
// 删除
handleDelete(row) {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(row.修补工时流水号)
request({
url: '',
method: 'post',
data: {
type: '4',
name: `delete from 车间生产管理_修补工时
where 修补工时流水号 = ${row.修补工时流水号}`
}
}).then(res => {
if (res.data[0].result === '1') {
this.searchTable()
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
})
})
},
// 编辑
handleEdit(row) {
row.isEditing = !row.isEditing
},
// 查询加工工时统计表
searchTable() {
let check1, check2, check3, check4, check5
this.technologyName ? check1 = 1 : check1 = 0
this.workerName ? check2 = 1 : check2 = 0
this.startTime1 && this.endTime1 ? check3 = 1 : check3 = 0
this.partNumber ? check4 = 1 : check4 = 0
this.startTime2 && this.endTime2 ? check5 = 1 : check5 = 0
searchTable(this.technologyName, check1, this.workerName, check2, check3, this.endTime1, this.startTime1, this.partNumber, check4, check5, this.endTime2, this.startTime2, this.pageCurrent, this.pageSize).then(res => {
this.tableData = res.data.rows
this.total = res.data.total
this.tableData.map(v => {
this.$set(v, 'isEditing', false)
v.原修补工时 = v.修补工时
return v
})
})
},
// 分页
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>

View File

@@ -0,0 +1,269 @@
<template>
<div>
<el-card>
<el-badge :value="value" class="item" style="margin-bottom: 10px; float: right">
<el-button size="small" @click="openWindow">Andon信息</el-button>
</el-badge>
<el-table
:data="tableData"
style="width: 100%;"
size="mini"
height="800"
highlight-current-row
border>
<el-table-column align="center" label="照片" width="50">
<template slot-scope="scope">
<el-popover
v-if="scope.row.文件标识 && scope.row.文件标识 !== 'null'"
placement="top-start"
width="200"
trigger="hover">
<el-button type="text" style="float:right" @click="deletePhoto(scope.row)">删除</el-button>
<el-image :src="scope.row.文件标识 && scope.row.文件标识 !== 'null' ? (readFile + scope.row.文件标识 + '.' + scope.row.文件后缀) : readFile + '123.jpg'">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"/>
</div>
</el-image>
<el-image slot="reference" :src="scope.row.文件标识 && scope.row.文件标识 !== 'null' ? (readFile + scope.row.文件标识 + '.' + scope.row.文件后缀) : readFile + '123.jpg'" style="width:30px;">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"/>
</div>
</el-image>
</el-popover>
<span v-else></span>
</template>
</el-table-column>
<el-table-column align="center" label="工位号">
<template slot-scope="scope">
<el-button type="text" @click="openNew(scope.row.工位号)">{{ scope.row.工位号 }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="登陆人">
<template slot-scope="scope">
<el-tag v-if="scope.row.姓名===''||scope.row.姓名===null" slot="reference" size="small" style="width: 80px" type="warning">未登录</el-tag>
<el-tag v-else slot="reference" type="success" size="small" style="width: 80px"> {{ scope.row.姓名 }} </el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="呼叫类型">
<template slot-scope="scope">
<div v-if="scope.row.呼叫备注===''|| scope.row.呼叫备注===null"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>正常工作</div>
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>{{ scope.row.呼叫备注 }}</div>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-button
:disabled="scope.row.文件标识 && scope.row.文件标识 !== 'null'"
size="mini"
type="primary"
icon="el-icon-picture"
@click="handlePicture(scope.row)">上传图片</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
width="60%">
<el-table
:data="tableDataMassage"
style="width: 100%;"
size="mini"
height="500"
highlight-current-row
border>
<el-table-column align="center" label="工位号">
<template slot-scope="scope">
<el-button type="text">{{ scope.row.工位号 }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="登陆人">
<template slot-scope="scope">
<el-tag v-if="scope.row.姓名===''||scope.row.姓名===null" slot="reference" size="small" style="width: 80px" type="warning">未登录</el-tag>
<el-tag v-else slot="reference" type="success" size="small" style="width: 80px"> {{ scope.row.姓名 }} </el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="呼叫类型">
<template slot-scope="scope">
<div v-if="scope.row.呼叫备注===''|| scope.row.呼叫备注===null"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>正常工作</div>
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>{{ scope.row.呼叫备注 }}</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible" title="上传图片" center style="height: 800px" width="30%">
<el-upload
id="invoiceScan"
ref="upload"
:multiple="true"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:action="upload+'?num='+ OPId"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible=false">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPerson()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { ANDON_countselect } from '@/api/ManufacturingCenter/AntonMonitoring'
import { wsuri, name1, uploadOP } from '@/utils/request'
import { readFile } from '@/utils/request'
import request from '@/utils/request'
export default {
data() {
return {
readFile: readFile,
limit: 9999,
tableData: [],
timer_ANDON: '',
andonMsg: '',
Name: '',
upload: uploadOP,
dialogFormVisible: false,
OPId: '',
massage: [],
dialogVisible: false,
tableDataMassage: [],
value: 0
}
},
mounted() {
this.ANDON_countselect()
this.timer_ANDON = setInterval(this.search(), 60 * 1000 * 5) // ANDON看板 5 分钟一刷新
},
created() {
this.initWebpack()
},
methods: {
deletePhoto(row) {
this.$confirm('此操作将永久删除该图片, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '',
method: 'post',
data: {
type: '4',
name: `delete from 设备管理_设备监控_图片 where 工位 = '${row.工位号}'`
}
}).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.ANDON_countselect()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
})
})
},
openNew(val) {
window.open(`http://192.168.1.231:8008/#/EquipmentConditionAnalysis?opname=${val}`, '_blank')
},
ANDON_countselect() {
ANDON_countselect().then(response => {
this.tableData = response.data
})
},
// 初始化websocket
initWebpack() {
this.websock = new WebSocket(wsuri)// 这里面的this都指向vue
this.websock.onopen = this.websocketopen
this.websock.onmessage = this.websocketonmessage
this.websock.onclose = this.websocketclose
this.websock.onerror = this.websocketerror
},
// 打开
websocketopen() {
console.log('WebSocket连接成功')
this.websock.send('{<' + name1 + '>}')
},
// 数据接收
websocketonmessage(msg) {
console.log(msg)
this.andonMsg = msg.data.split('|')[3]
this.Name = msg.data.split('|')[2]
if (this.andonMsg === '1') {
this.search()
}
},
// 关闭
websocketclose() {
console.log('WebSocket关闭')
},
// 失败
websocketerror() {
console.log('WebSocket连接失败')
},
uploadSuccess(res) { // 上传成功回调
if (res[0].result === '1') {
this.$message.success('增加成功')
this.dialogFormVisible = false
this.ANDON_countselect()
this.$refs.upload.clearFiles()
} else {
this.$message.error('增加失败')
}
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
return isJPG
},
warningExceed() {
this.$message.error('仅可上传五张照片')
},
handlePicture(row) {
this.dialogFormVisible = true
this.OPId = row.工位号
},
submitPerson() {
this.$refs.upload.submit()
},
search() {
this.tableDataMassage = []
ANDON_countselect().then(response => {
this.tableData = response.data
return response.data
}).then(data => {
for (let i = 0; i < data.length; i++) {
if (data[i].呼叫备注 !== null) {
this.tableDataMassage.push(data[i])
}
}
this.value = this.tableDataMassage.length
})
},
openWindow() {
this.dialogVisible = true
}
}
}
</script>
<style scoped>
.el-card{
margin-left: 2px;
margin-top: 2px;
margin-bottom: 2px;
margin-right: 2px;
}
</style>

View File

@@ -0,0 +1,507 @@
<template>
<div class="app-container">
<el-card>
<span style="margin: 5px">领料单编号</span>
<el-input v-model="pickingListNumber" clearable size="small" style="width:200px"/>
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchListinfor()">查询</el-button>
<el-button size="small" type="primary" icon="el-icon-plus" style="margin: 0 0 0 10px" @click="addListinfor()">创建</el-button>
</el-card>
<el-card>
<el-table v-loading="listLoading0" :data="tableData1" highlight-current-row border style="width: 100%;" size="mini" height="300" @row-click="chooseListinfor">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="领料单编号" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.领料单编号 }}
</template>
</el-table-column>
<el-table-column label="领料时间" align="center" min-width="200" >
<template slot-scope="scope">
{{ scope.row.领料时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="创建人" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column v-if="true" label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" type="danger" icon="el-icon-delete" @click="dropListinfor(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px 0;">
<el-pagination
:current-page="PageCurrent0"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSize0"
:total="total0"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange0"
@current-change="handleCurrentChange0"/>
</div>
<el-table :data="tableDataPicking" border style="width: 100%;" size="mini" height="300">
<el-table-column label="序号" align="center" type="index" width="50"/>
<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">
<el-tag v-if="scope.row.是否外购===1">外购</el-tag>
<el-tag v-else>自家</el-tag>
</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-column label="组号" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column v-if="true" label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" type="danger" icon="el-icon-delete" @click="dropListdetail(scope.row)">移除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<!--<span>项目名称:</span>-->
<el-select v-show="false" v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
<el-option
v-for="item in Project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床图号:</span>
<el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>组号:</span>
<el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
<el-option
v-for="item in GroupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchPartinfo()">查询</el-button>
</el-card>
<el-card>
<h4>自家备料</h4>
<el-table v-loading="listLoading1" :data="tableDataBasic" border style="width: 100%;" size="mini" height="440">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="项目名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="零件图号" align="center" min-width="80">
<template slot-scope="scope" align="center">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope" align="center">
<el-button size="mini" type="primary" icon="el-icon-edit" style="margin: 0 0 0 10px" @click="addBasicList(scope.row)">领料</el-button>
</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"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<hr>
<h4>外购备料</h4>
<el-table v-loading="listLoading2" :data="tableDataPurchase" border style="width: 100%;" size="mini" height="440">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="项目名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="物料编码" align="center" min-width="80">
<template slot-scope="scope" align="center">
{{ scope.row.物料编码 + scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope" align="center">
<el-button size="mini" type="primary" icon="el-icon-edit" @click="addPurchaseList(scope.row)">领料</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px 0;">
<el-pagination
: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>
</div>
</template>
<script>
import { initProject, searchmachine, searchTeam, searchPurchasePart, searchBasicPart,
searchList, addList, dropList, searchListDetail, dropListDetailBasic, addBasicList, addPurchaseList } from '@/api/ManufacturingCenter/CreateIntakeList'
import { mapGetters } from 'vuex'
export default {
data() {
return {
listLoading0: false, // 领料单
listLoading1: false, // 自制件
listLoading2: false, // 采购部采购件
PageCurrent0: 1,
PageSize0: 10,
total0: 0,
PageCurrent1: 1,
PageSize1: 10,
total1: 0,
PageCurrent2: 1,
PageSize2: 10,
total2: 0,
ProjectValue: '',
Project: [],
ProjectValue_check: 0,
MachineValue: '',
Machine: [],
MachineValue_check: 0,
GroupNumValue: '',
GroupNum: [],
GroupNumValue_check: 0,
tableData1: [], // 领料单
tableDataPicking: [], // 领料单明细
tableDataBasic: [], // 自制件
tableDataPurchase: [], // 采购部采购件
tableDataBacklog: [], // 滞货件
tableDataHouse: [], // 车间采购件
enableOut: '', // 可出库数量
partPiant: '', // 零件图号
material: '', // 材料
outType: '',
pickingListNumber: null, // 领料单编号
pickingListNumberx: '', // 领料单流水号
picikingPeople: '', // 领料人流水号
partProjectNumber: '', // 项目流水号
partMachineNumber: '', // 机床流水号
partGroupNumber: '', // 分组流水号
receive: '', // 收件信息ID
locatenumber: '', // 货位流水号
materialName: '',
materialNumber: '',
materialType: '',
purchaseDetailNum: '', // 采购合同明细流水号
askPurchaseNumber: '', // 请购单明细流水号
materialLocate: '',
partType: '', // 零件类型
craftplannumber: '' // 工艺计划流水号
}
},
computed: {
...mapGetters([
'id'
])
},
created() {
this.fetchData()
this.searchListinfor()
this.searchPartinfo()
this.searchMachine()
},
methods: {
// 创建领料单
addListinfor() {
this.$confirm('确认创建新的领料单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
addList(this.picikingPeople).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.searchListinfor()
} else {
this.$message.error('增加失败')
}
})
}).catch(() => {
this.$message('已取消操作')
})
},
// 查询领料单
searchListinfor() {
let check
this.pickingListNumber ? check = 1 : check = 0
this.listLoading0 = true
searchList(this.PageCurrent0, this.PageSize0, check, this.pickingListNumber).then(response => {
this.tableData1 = response.data.rows
this.total0 = response.data.total
this.listLoading0 = false
})
},
// 领料单分页
handleSizeChange0(val) {
this.PageCurrent0 = 1
this.PageSize0 = val
this.searchListinfor()
},
handleCurrentChange0(val) {
this.PageCurrent0 = val
this.searchListinfor()
},
// 选择领料单
chooseListinfor(row) {
this.pickingListNumberx = row.备料领料单流水号
// this.pickingListNumber = row.领料单编号
this.searchListDetailt()
},
// 查询领料单明细
searchListDetailt() {
searchListDetail(this.pickingListNumberx).then(response => {
this.tableDataPicking = response.data
})
},
// 移除
dropListdetail(row) {
this.$confirm('确认移除该零件?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
dropListDetailBasic(row.备料领料单明细流水号, row.是否外购, row.工艺计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchListDetailt()
this.searchPartinfo()
} else {
this.$message.error('数据占用')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 初始化项目,获取人员编号
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'Project') // 项目名称
this.picikingPeople = this.id
},
// 查询机床
searchMachine() {
this.MachineValue = ''
this.Machine = []
this.GroupNumValue = ''
this.GroupNum = []
this.ProjectValue ? this.ProjectValue_check = 1 : this.ProjectValue_check = 0
searchmachine(this.ProjectValue_check, this.ProjectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
// 查询组号
searchGroupList() {
if (this.MachineValue) {
this.GroupNumValue = ''
this.GroupNum = []
searchTeam(this.MachineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
} else {
this.GroupNumValue = ''
this.GroupNum = []
}
},
// 根据项目机床分组查零件/物料
searchPartinfo() {
this.ProjectValue ? this.ProjectValue_check = 1 : this.ProjectValue_check = 0
this.MachineValue ? this.MachineValue_check = 1 : this.MachineValue_check = 0
this.GroupNumValue ? this.GroupNumValue_check = 1 : this.GroupNumValue_check = 0
this.searchOwnPart() // 自制件
this.searchPurchasePart() // 采购部采购件
},
// 删除领料单
dropListinfor(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.tableDataPicking.length === 0) {
dropList(row.备料领料单流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchListinfor()
} else {
this.$message.error('数据占用')
}
})
} else {
this.$message.error('数据占用')
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 查询自家备料
searchOwnPart() {
this.tableDataBasic = []
this.listLoading1 = true
searchBasicPart(this.PageCurrent1, this.PageSize1, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
this.tableDataBasic = response.data.rows
this.total1 = response.data.total
this.listLoading1 = false
})
},
// 自制件分页
handleSizeChange1(val) {
this.PageCurrent1 = 1
this.PageSize1 = val
this.searchOwnPart()
},
handleCurrentChange1(val) {
this.PageCurrent1 = val
this.searchOwnPart()
},
// 查询外购备料
searchPurchasePart() {
this.tableDataPurchase = []
this.listLoading2 = true
searchPurchasePart(this.PageCurrent2, this.PageSize2, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
this.tableDataPurchase = response.data.rows
this.listLoading2 = false
this.total2 = response.data.total
})
},
// 采购部采购件分页
handleSizeChange2(val) {
this.PageCurrent2 = 1
this.PageSize2 = val
this.searchPurchasePart()
},
handleCurrentChange2(val) {
this.PageCurrent2 = val
this.searchPurchasePart()
},
// 自家备料领料
addBasicList(row) {
addBasicList(this.pickingListNumberx, row.工艺计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchListDetailt()
this.searchPartinfo()
} else {
this.$message.error('数据占用')
}
})
},
// 外购备料领料
addPurchaseList(row) {
addPurchaseList(this.pickingListNumberx, row.工艺计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchListDetailt()
this.searchPartinfo()
} else {
this.$message.error('数据占用')
}
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>

View File

@@ -0,0 +1,20 @@
// 导出Excel方法表格id不加扩展名的文件名sheet名
export function exportExcelMethod(tableId, fileName, sheetName) {
tableToExcel(tableId, fileName, sheetName)
return 1
}
const tableToExcel = (function() {
const uri = 'data:application/vnd.ms-excel;base64,'
// 设置导出表格的单元格默认高度/宽度/边框样式/字体颜色/背景颜色/居中网页显示表格宽度建议1240tr/td视情况而定
const template = `<html xmlns:x="urn:schemas-microsoft-com:office:excel"><head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><meta charset="UTF-8"><style type="text/css">table td {border: 2px solid #000000;height:40px;text-align: center;color: #000000;}</style></head><body><table>{table}</table></body></html>`
const base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
const format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p] }) }
return function(table, filename, sheetname) {
if (!table.nodeType) table = document.getElementById(table)
const ctx = { worksheet: sheetname || 'Worksheet', table: table.innerHTML }
const aTag = document.createElement('a')
aTag.href = uri + base64(format(template, ctx))
aTag.download = filename
aTag.click()
}
})()

View File

@@ -0,0 +1,243 @@
<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="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
<el-checkbox v-model="all" size="mini">查询全部</el-checkbox>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="exportTable('BL')">导出备料单</el-button>
<el-button type="primary" size="small" icon="el-icon-success" style="margin-left:10px" @click="edit()">自家备料</el-button>
<el-button type="primary" size="small" icon="el-icon-success" style="margin-left:10px" @click="edit2()">外购备料</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border element-loading-text="拼命加载中" @selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55"
align="center"/>
<el-table-column label="打印状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.备料打印!=='0'" type="success" size="small">已导出</el-tag>
<el-tag v-else type="warning" 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="240px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="重量" align="center" 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>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<div v-show="false" id="BL">
<table border cellspacing="0px" style="table-layout: fixed; width: 600px;">
<colgroup>
<col style="width: 120px">
<col style="width: 180px">
<col style="width: 110px">
<col style="width: 110px">
<col style="width: 110px">
<col style="width: 450px">
</colgroup>
<tr>
<th colspan="2" height="60px">GAOJING</th>
<th colspan="4" height="60px"><span style="font-weight:bold">备料单</span></th>
</tr>
<tr>
<td align="center">零件名称</td>
<td align="center">零件图号</td>
<td align="center">材料</td>
<td align="center">原材料规格</td>
<td align="center">批次数量</td>
<td align="center">备料</td>
</tr>
<tr v-for="(list, index) in tableData2" :key="index">
<td align="center">{{ list.零件名称 }}</td>
<td align="center">{{ list.零件图号 }}</td>
<td align="center">{{ list.材料 }}</td>
<td align="center">{{ list.原材料规格 }}</td>
<td align="center">{{ list.批次数量 }}</td>
<td>{{ list.工艺要求 }}</td>
</tr>
</table>
</div>
</div>
</template>
<script>
import { searchtable, searchtable2, edit, edit2 } from '@/api/ManufacturingCenter/CreatePreparationBill'
import { exportExcelMethod } from './exportExcel'
import $ from 'jquery'
export default {
data() {
return {
a: 0,
tableData2: [],
partName: '',
all: false,
loading: false,
Data: [],
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1 // 后台获取页
}
},
created() {
this.searchTable()
},
methods: {
exportTable() {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
const htmlNode = $('#BL').html()
const body = $('body')
body.children().hide()
const printNode = $(htmlNode)
body.append(printNode)
window.print()
body.children().not('script').show()
printNode.remove()
}
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.Data = []
if (this.partName !== '' && this.partName !== null) {
this.partNamecheck = true
} else {
this.partNamecheck = false
}
searchtable(this.partNamecheck, this.partName, !this.all, 0, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
// this.tableData.push({
// 重量: response.data.rows[0].重量
// })
this.Data = response.data.rows
this.total = response.data.total
}
}).then(() => {
for (let i = 0; i < this.Data.length; i++) {
searchtable2(this.Data[i].工艺计划流水号).then(response => {
this.tableData.push({
工艺计划流水号: this.Data[i].工艺计划流水号,
零件名称: this.Data[i].零件名称,
零件图号: this.Data[i].零件图号,
备料打印: this.Data[i].备料打印,
工艺要求: response.data[0].工艺要求,
材料: this.Data[i].材料,
重量: this.Data[i].重量,
批次数量: this.Data[i].批次数量
})
})
this.loading = false
}
})
},
handleSelectionChange(val) {
this.tableData2 = []
this.tableData2 = val
},
edit() {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
this.a = 0
for (let i = 0; i < this.tableData2.length; i++) {
edit(this.tableData2[i].工艺计划流水号).then(response => {
this.a += parseInt(response.data[0].result)
if (this.a === this.tableData2.length) {
this.pageSize = 10
this.pageCurrent = 1
this.searchTable()
}
})
}
}
},
edit2() {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
this.a = 0
for (let i = 0; i < this.tableData2.length; i++) {
edit2(this.tableData2[i].工艺计划流水号).then(response => {
this.a += parseInt(response.data[0].result)
if (this.a === this.tableData2.length) {
this.pageSize = 10
this.pageCurrent = 1
this.searchTable()
}
})
}
}
},
downLoad(tableid) {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
exportExcelMethod(tableid, '123', 'asd')
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,401 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>项目名称:</span>
<el-select
v-model="entryNameValue"
:remote-method="remoteMethod"
placeholder="项目名称"
style="margin-right: 10px"
size="small"
clearable
filterable
remote
@change="projectChange"
@focus="projectInit">
<el-option
v-for="item in entryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床图号:</span>
<el-select v-model="machineNameValue" placeholder="机床号" style="margin-right: 10px" size="small" clearable @change="machineChange">
<el-option
v-for="item in machineName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 15px" @click="total1=0;pageSize1 = 10;pageCurrent1 = 1;searchData1()">查询</el-button>
</el-row>
</el-card>
<el-card style="margin-top: 15px">
<el-table
v-loading="listLoading2"
:data="tableData2"
style="width: 100%;max-height: 400px;"
size="mini"
height="300"
highlight-current-row
border
@row-click="searchSpareParts">
<el-table-column align="center" label="机床流水号">
<template slot-scope="scope">
{{ scope.row.机床流水号 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床图号">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="停产零件种类">
<template slot-scope="scope">
{{ scope.row.停产零件种类 }}
</template>
</el-table-column>
<el-table-column align="center" label="停产零件数量">
<template slot-scope="scope">
{{ scope.row.停产零件数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="已加工工时">
<template slot-scope="scope">
{{ scope.row.已加工工时 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px">
<el-pagination
: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 style="margin-top: 15px">
<el-row>
<span>组号:</span>
<el-select v-model="GroupNumValue" placeholder="组号" style="margin-right: 10px" size="small" clearable>
<el-option
v-for="item in GroupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span>
<el-input v-model="PartDrawingNumber" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 15px" @click="total=0;pageSize = 10;pageCurrent = 1;searchData()">查询</el-button>
</el-row>
</el-card>
<el-card style="margin-top: 15px">
<el-table
v-loading="listLoading"
:data="tableData"
style="width: 100%;max-height: 400px;"
size="mini"
height="300"
highlight-current-row
border
@row-click="searchProcedure">
<el-table-column align="center" label="组号">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件图号">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件名称">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.投产数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="停产时间">
<template slot-scope="scope">
{{ scope.row.停产时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="停产原因">
<template slot-scope="scope">
{{ scope.row.停产原因 }}
</template>
</el-table-column>
<el-table-column align="center" label="加工工时">
<template slot-scope="scope">
{{ scope.row.加工工时 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px">
<el-pagination
: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 style="margin-top: 15px">
<el-table
v-loading="listLoading1"
:data="tableData1"
style="width: 100%;max-height: 400px;"
size="mini"
height="300"
highlight-current-row
border>
<el-table-column align="center" label="工序顺序" width="100">
<template slot-scope="scope">
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺名称" width="150">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺要求">
<template slot-scope="scope">
{{ scope.row.工艺要求 }}
</template>
</el-table-column>
<el-table-column align="center" label="单件定额工时" width="150">
<template slot-scope="scope">
{{ scope.row.单件定额工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="准结定额工时" width="130">
<template slot-scope="scope">
{{ scope.row.准结定额工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺是否完成" width="130">
<template slot-scope="scope">
{{ scope.row.工序状态 }}
</template>
</el-table-column>
<el-table-column align="center" label="工时" width="80">
<template slot-scope="scope">
{{ scope.row.工序工时 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { initProject, searchMachine, searchGroupNum, searchTable, searchTable1, searchTable2 } from '@/api/ManufacturingCenter/DiscardedPartsInquiry'
export default {
data() {
return {
pageCurrent: 1,
pageSize: 10,
total: 0,
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
list: [],
check3: '',
PartDrawingNumber: '',
remoteLoading: false,
listLoading: false,
listLoading1: false,
listLoading2: false,
entryName: [],
check: '',
entryNameValue: '', // 项目名称
entryValue: '', // 项目流水号
machineName: [],
check1: '',
machineNameValue: '', // 机床图号
machineValue: '', // 机床图号
GroupNum: [],
check2: '',
GroupNumValue: '', // 组号
tableData: [],
tableData1: [],
tableData2: []
}
},
created() {
this.projectInit()
},
mounted() {
this.getList()
},
methods: {
getList() {
this.list = []
initProject().then(response => { // 初始化项目名称
for (let i = 0; i < response.data.length; i++) {
this.list.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
remoteMethod(query) {
if (query !== '') {
setTimeout(() => {
this.entryName = this.list.filter(item => {
return item.label.toLowerCase()
.indexOf(query.toLowerCase()) > -1
})
}, 1000)
} else {
this.entryName = []
}
},
projectInit() { // 初始化项目
this.entryName = []
initProject().then(response => { // 初始化项目名称
for (let i = 0; i < response.data.length; i++) {
this.entryName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
projectChange() {
this.machineName = []
this.machineNameValue = ''
this.GroupNum = []
this.GroupNumValue = ''
searchMachine(this.entryNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineName.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.GroupNum = []
this.GroupNumValue = ''
searchGroupNum(this.machineNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchData1() {
if (this.entryNameValue !== '' && this.entryNameValue !== null) {
this.listLoading2 = true
if (this.entryNameValue !== '' && this.entryNameValue !== null) {
this.check = 1
} else {
this.check = 0
}
if (this.machineNameValue !== '' && this.machineNameValue !== null) {
this.check1 = 1
} else {
this.check1 = 0
}
searchTable2(this.check, this.entryNameValue, this.check1, this.machineNameValue, this.pageCurrent1, this.pageSize1).then(response => {
console.log(response)
this.tableData2 = response.data.rows
this.total1 = response.data.total
this.listLoading2 = false
})
} else {
this.$message.warning('请选择项目')
}
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchData1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchData1()
},
searchSpareParts(row) {
this.tableData1 = []
this.machineValue = row.机床流水号
this.initGroup()
},
initGroup() {
this.GroupNum = []
this.GroupNumValue = ''
searchGroupNum(this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
this.searchData()
},
searchData() {
this.listLoading = true
this.tableData1 = []
if (this.GroupNumValue !== '' && this.GroupNumValue !== null) {
this.check2 = 1
} else {
this.check2 = 0
}
if (this.PartDrawingNumber !== '' && this.PartDrawingNumber !== null) {
this.check3 = 1
} else {
this.check3 = 0
}
searchTable(this.entryNameValue, this.machineValue, this.check2, this.GroupNumValue, this.check3, this.PartDrawingNumber, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.listLoading = false
})
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.searchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchData()
},
searchProcedure(row) {
this.listLoading1 = true
searchTable1(row.工艺计划流水号).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].工序状态 === 4) {
response.data[i].工序状态 = '完成'
} else {
response.data[i].工序状态 = '未完成'
}
}
this.tableData1 = response.data
this.listLoading1 = false
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,529 @@
<template>
<div class="app-container">
<el-card>
<span>工位号:</span>
<el-select v-model="MachineValue" filterable size="small" style="width:160px;margin-bottom:10px" placeholder="工位号">
<el-option
v-for="item in Machine"
: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>
<span>日期:</span>
<el-date-picker
v-model="Time"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="pageSize=10; pageCurrent= 1;searchData()">查询</el-button>
</el-card>
<el-card>
<el-table
:data="tableDataA"
border
style="width: 100%;max-height: 450px;margin-top: 10px"
height="450px"
highlight-current-row
size="small">
<el-table-column
type="index"
label="序号"
align="center"
width="50"/>
<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.结束时间 }}
</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.日期.split(' ')[0] }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
: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 style="width: 49.8%; float: left;margin-right: 5px">
<div id="myChart1" style="width: 1000px; height: 570px; margin: auto"/>
</el-card>
<el-card style="width: 49.8%">
<div id="myChart2" style="width: 1000px; height: 570px; margin: auto"/>
</el-card>
<el-card>
<span>工位号:</span>
<el-select v-model="MachineValue1" filterable size="small" style="width:160px;margin-bottom:10px" placeholder="工位号">
<el-option
v-for="item in Machine"
: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>
<span style="margin-left: 10px">时间段:</span>
<el-date-picker
v-model="date1"
style="width:160px;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:160px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchData1()">查询</el-button>
</el-card>
<el-card>
<div id="myChart" style="width: 1000px; height: 570px; margin: auto"/>
</el-card>
<el-card>
<div id="myChart3" style="width: 100%; height: 520px; margin: auto"/>
</el-card>
</div>
</template>
<script>import { getData, getData1, getData2, getData3, getMachine, searchState } from '@/api/ManufacturingCenter/EquipmentConditionAnalysis'
export default {
data() {
return {
tableDataA: [],
MachineValue: '',
MachineValue1: '',
Machine: [],
yAxisValue: [],
colors: [],
state: [],
Time: '',
date1: '',
date2: '',
time1: '',
time2: '',
time3: '',
time4: '',
time11: '',
time22: '',
time33: '',
time44: '',
pageCurrent: 1,
pageSize: 10,
total: 0,
table: []
}
},
mounted() {
this.drawLine()
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.MachineValue = ''
this.Machine = []
getMachine().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].终端编号,
value: response.data[i].终端编号,
value2: response.data[i].姓名
})
}
})
},
searchData() {
getData(this.MachineValue, this.Time, this.pageCurrent, this.pageSize).then(response => {
this.tableDataA = response.data.rows
this.total = response.data.total
this.time1 = response.data.rows[0].运行持续时间
this.time2 = response.data.rows[0].等待持续时间
this.time3 = response.data.rows[0].停机持续时间
this.time4 = response.data.rows[0].报警持续时间
}).then(() => {
this.drawLine1()
})
getData1(this.Time).then(response => {
this.time11 = response.data[0].运行持续时间
this.time22 = response.data[0].等待持续时间
this.time33 = response.data[0].停机持续时间
this.time44 = response.data[0].报警持续时间
}).then(() => {
this.drawLine2()
})
},
searchData1() {
getData2(this.MachineValue1, this.date1, this.date2).then(response => {
this.table = response.data
console.log(this.table, 222)
}).then(() => {
this.drawLine()
})
if (this.date1 === null || this.date2 === null) {
this.$message.warning('请选择开始时间或结束时间')
} else {
const endYear = parseInt(this.date2.split('-')[0])
const startYear = parseInt(this.date1.split('-')[0])
const endMonth = parseInt(this.date2.split('-')[1])
const startMonth = parseInt(this.date1.split('-')[1])
const endDate = parseInt(this.date2.split('-')[2])
const startDate = parseInt(this.date1.split('-')[2])
let diff
if ((endMonth - startMonth) === 0) {
diff = endDate - startDate
}
if ((endMonth - startMonth) === 1) {
diff = endDate - startDate + 10
}
if ((endMonth - startMonth) > 1 || (endYear - startYear) !== 0) {
diff = 999
}
if (diff > 6) {
this.$message.warning('选择时间区间不得超过6天')
} else {
searchState().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.colors.push(response.data[i].颜色)
this.state.push(response.data[i].状态)
}
})
getData3(this.MachineValue1, this.date1, this.date2).then(response => {
this.table1 = response.data
console.log(this.table1)
}).then(() => {
this.drawLine3()
})
}
}
},
// 绘制图形
drawLine() {
const myChart = this.$echarts.init(document.getElementById('myChart'))
const xData = []
const lineData = []
for (let i = 0; i < this.table.length; i++) {
console.log(this.table[i].日期, 1111)
xData.push(this.table[i].日期.split(' ')[0])
lineData.push(this.table[i].利用率.toFixed(2))
}
myChart.clear()
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data: ['利用率']
},
xAxis: [
{
type: 'category',
name: '日期',
data: xData,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '利用率'
}
],
series: [
{
name: '利用率',
type: 'line',
label: {
normal: {
show: true,
position: 'top'
}
},
data: lineData
}
]
})
},
drawLine1() {
const myChart = this.$echarts.init(document.getElementById('myChart1'))
const xData = ['运行', '等待', '停机', '报警']
const lineData = [{ name: '运行', value: this.time1 }, { name: '等待', value: this.time2 }, { name: '停机', value: this.time3 }, { name: '报警', value: this.time4 }]
myChart.clear()
myChart.setOption({
title: {
text: '单台设备状态',
x: 350
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
type: 'scroll',
orient: 'vertical',
left: 10,
top: 20,
bottom: 20,
data: xData
},
series: [
{
name: '状态',
type: 'pie',
radius: '55%',
center: ['40%', '50%'],
data: lineData,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
})
},
drawLine2() {
const myChart = this.$echarts.init(document.getElementById('myChart2'))
const xData = ['运行', '等待', '停机', '报警']
const lineData = [{ name: '运行', value: this.time11 }, { name: '等待', value: this.time22 }, { name: '停机', value: this.time33 }, { name: '报警', value: this.time44 }]
myChart.clear()
myChart.setOption({
title: {
text: '全员设备状态',
x: 350
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
type: 'scroll',
orient: 'vertical',
left: 10,
top: 20,
bottom: 20,
data: xData
},
series: [
{
name: '状态',
type: 'pie',
radius: '55%',
center: ['40%', '50%'],
data: lineData,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
})
},
drawLine3() {
const _this = this
_this.data = []
_this.index = 0
_this.yAxisValue = []
for (let i = 0; i < _this.table1.length; i++) { // 取开始结束时间HH-mm取状态日期yyyy-MM-dd持续时间
_this.fixDate = _this.table1[0].日期.substr(0, 10)
_this.table1[i].开始时间 = _this.fixDate + ' ' + _this.table1[i].开始时间.substr(11, 5)
_this.table1[i].结束时间 = _this.fixDate + ' ' + _this.table1[i].结束时间.substr(11, 5)
_this.table1[i].日期 = _this.table1[i].日期.substr(0, 10)
}
if (_this.table1.length === 1) {
_this.data.push({
itemStyle: { normal: { color: _this.table1[0].颜色 }}, // 条形颜色
name: _this.table1[0].状态,
value: [0, _this.table1[0].开始时间, _this.table1[0].结束时间]
})
} else {
for (let i = 0; i < _this.table1.length; i++) {
if (i < _this.table1.length) {
if (i === 0) {
_this.index = 0
_this.yAxisValue.push(_this.table1[i].日期)
} else if (_this.table1[i].日期 !== _this.table1[i - 1].日期) {
_this.index++ // y轴索引
_this.yAxisValue.push(_this.table1[i].日期)
}
}
_this.data.push({
itemStyle: { normal: { color: _this.table1[i].颜色 }}, // 条形颜色
name: _this.table1[i].状态,
value: [parseInt(_this.index), _this.table1[i].开始时间, _this.table1[i].结束时间]
})
}
}
const myChart = _this.$echarts.init(document.getElementById('myChart3'))
myChart.clear()
myChart.setOption({
title: {
left: 'center',
text: '设备状态分布图'
},
color: _this.colors,
tooltip: { // 提示框
formatter(params) {
return params.value[1].substr(11, 5) + '~' + params.value[2].substr(11, 5)
} // 数据的值
},
legend: { // 图例
left: 'left'
// selectedMode: false, // 图例可点击
},
dataZoom: [{
type: 'inside',
start: 0,
end: 100
}, { // X轴可调
xAxisIndex: 0,
start: 0,
end: 100,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
}
}],
grid: { // 绘图网格
left: '3%',
right: '3%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'time',
interval: 1000 * 60 * 60 * 2,
axisLabel: {
formatter(value) {
var date = new Date(value)
return getzf(date.getHours()) + ':' + getzf(date.getMinutes())
function getzf(num) {
if (parseInt(num) < 10) {
num = '0' + num
}
return num
}
}
}
},
yAxis: {
data: _this.yAxisValue
},
series: [
// 用空bar来显示几个图例
{ name: _this.state[0], type: 'bar', data: [] },
{ name: _this.state[1], type: 'bar', data: [] },
{ name: _this.state[2], type: 'bar', data: [] },
{ name: _this.state[3], type: 'bar', data: [] },
{
type: 'custom', renderItem(params, api) { // 开发者自定义的图形元素渲染逻辑,是通过书写 renderItem 函数实现的
var categoryIndex = api.value(0) // 这里使用 api.value(0) 取出当前 dataItem 中第一个维度的数值。
var start = api.coord([api.value(1), categoryIndex]) // 这里使用 api.coord(...) 将数值在当前坐标系中转换成为屏幕上的点的像素值。
var end = api.coord([api.value(2), categoryIndex])
var height = 24 // 柱体宽度
return {
type: 'rect', // 表示这个图形元素是矩形。还可以是 'circle', 'sector', 'polygon' 等等。
shape: _this.$echarts.graphic.clipRectByRect({ // 矩形的位置和大小。
x: start[0],
y: start[1] - height / 1,
width: end[0] - start[0],
height: height * 2
}, { // 当前坐标系的包围盒。
x: params.coordSys.x,
y: params.coordSys.y,
width: params.coordSys.width,
height: params.coordSys.height
}),
style: api.style()
}
},
encode: {
x: [1, 2], // data 中『维度1』和『维度2』对应到 X 轴
y: 0 // data 中『维度0』对应到 Y 轴
},
data: _this.data
}
]
})
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchData()
}
}
}
</script>
<style scoped>
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,660 @@
<template>
<div class="app-container">
<el-card>
<span>工位号:</span>
<el-select v-model="MachineValue" filterable size="small" style="width:220px;margin-bottom:10px" placeholder="工位号" @change="searchTable();searchParts()">
<el-option
v-for="item in Machine"
: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-button type="success" class="el-icon-refresh" size="small" style="margin: 10px 0 0 10px" @click="Refresh">刷新工位</el-button>
<span v-if="lengths !== 0" style="color: #53A3F7;font-size: 14px"> 加工零件 {{ Parts }};加工工序 {{ gongxu }}</span>
<span v-if="lengths === 0" style="color: #53A3F7;font-size: 14px"> 无正在加工零件</span>
<el-badge :value="num" :max="99" class="item">
<el-button size="small" type="text" @click="dialogFormVisible=true;Jurisdiction()">跳序权限</el-button>
</el-badge>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" :row-key="getRowKeys" :expand-row-keys="expands" height="650" style="width: 100%;" border @expand-change="searchTable2">
<el-table-column type="expand">
<template slot-scope="scope">
<el-table :data="tableData2" border style="text-align: center" size="mini">
<el-table-column label="零件加工计划进度(工艺名称,计划完成时间,实际完成时间,员工名称)" >
<el-table-column label="[1]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[0]">
<h4>{{ process[0] }}</h4><h4>{{ planDate[0] }} </h4><h4> {{ realDate[0] }}</h4><h4> {{ worker[0] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[2]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[1]">
<h4>{{ process[1] }}</h4><h4>{{ planDate[1] }} </h4><h4> {{ realDate[1] }}</h4><h4> {{ worker[1] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[3]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[2]">
<h4>{{ process[2] }}</h4><h4>{{ planDate[2] }} </h4><h4> {{ realDate[2] }}</h4><h4> {{ worker[2] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[4]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[3]">
<h4>{{ process[3] }}</h4><h4>{{ planDate[3] }} </h4><h4> {{ realDate[3] }}</h4><h4> {{ worker[3] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[5]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[4]">
<h4>{{ process[4] }}</h4><h4>{{ planDate[4] }} </h4><h4> {{ realDate[4] }}</h4><h4> {{ worker[4] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[6]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[5]">
<h4>{{ process[5] }}</h4><h4>{{ planDate[5] }} </h4><h4> {{ realDate[5] }}</h4><h4> {{ worker[5] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[7]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[6]">
<h4>{{ process[6] }}</h4><h4>{{ planDate[6] }} </h4><h4> {{ realDate[6] }}</h4><h4> {{ worker[6] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[8]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[7]">
<h4>{{ process[7] }}</h4><h4>{{ planDate[7] }} </h4><h4> {{ realDate[7] }}</h4><h4> {{ worker[7] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[9]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[8]">
<h4>{{ process[8] }}</h4><h4>{{ planDate[8] }} </h4><h4> {{ realDate[8] }}</h4><h4> {{ worker[8] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[10]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[9]">
<h4>{{ process[9] }}</h4><h4>{{ planDate[9] }} </h4><h4> {{ realDate[9] }}</h4><h4> {{ worker[9] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[11]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[10]">
<h4>{{ process[10] }}</h4><h4>{{ planDate[10] }} </h4><h4> {{ realDate[10] }}</h4><h4> {{ worker[10] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[12]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[11]">
<h4>{{ process[11] }}</h4><h4>{{ planDate[11] }} </h4><h4> {{ realDate[11] }}</h4><h4> {{ worker[11] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[13]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[12]">
<h4>{{ process[12] }}</h4><h4>{{ planDate[12] }} </h4><h4> {{ realDate[12] }}</h4><h4> {{ worker[12] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[14]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[13]">
<h4>{{ process[13] }}</h4><h4>{{ planDate[13] }} </h4><h4> {{ realDate[13] }}</h4><h4> {{ worker[13] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[15]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[14]">
<h4>{{ process[14] }}</h4><h4>{{ planDate[14] }} </h4><h4> {{ realDate[14] }}</h4><h4> {{ worker[14] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[16]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[15]">
<h4>{{ process[15] }}</h4><h4>{{ planDate[15] }} </h4><h4> {{ realDate[15] }}</h4><h4> {{ worker[15] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[17]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[16]">
<h4>{{ process[16] }}</h4><h4>{{ planDate[16] }} </h4><h4> {{ realDate[16] }}</h4><h4> {{ worker[16] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[18]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[17]">
<h4>{{ process[17] }}</h4><h4>{{ planDate[17] }} </h4><h4> {{ realDate[17] }}</h4><h4> {{ worker[17] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[19]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[18]">
<h4>{{ process[18] }}</h4><h4>{{ planDate[18] }} </h4><h4> {{ realDate[18] }}</h4><h4> {{ worker[18] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[20]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[19]">
<h4>{{ process[19] }}</h4><h4>{{ planDate[19] }} </h4><h4> {{ realDate[19] }}</h4><h4> {{ worker[19] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[21]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[20]">
<h4>{{ process[20] }}</h4><h4>{{ planDate[20] }} </h4><h4> {{ realDate[20] }}</h4><h4> {{ worker[20] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[22]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[21]">
<h4>{{ process[21] }}</h4><h4>{{ planDate[21] }} </h4><h4> {{ realDate[21] }}</h4><h4> {{ worker[21] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[23]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[22]">
<h4>{{ process[22] }}</h4><h4>{{ planDate[22] }} </h4><h4> {{ realDate[22] }}</h4><h4> {{ worker[22] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[24]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[23]">
<h4>{{ process[23] }}</h4><h4>{{ planDate[23] }} </h4><h4> {{ realDate[23] }}</h4><h4> {{ worker[23] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[25]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[24]">
<h4>{{ process[24] }}</h4><h4>{{ planDate[24] }} </h4><h4> {{ realDate[24] }}</h4><h4> {{ worker[24] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[26]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[25]">
<h4>{{ process[25] }}</h4><h4>{{ planDate[25] }} </h4><h4> {{ realDate[25] }}</h4><h4> {{ worker[25] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[27]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[26]">
<h4>{{ process[26] }}</h4><h4>{{ planDate[26] }} </h4><h4> {{ realDate[26] }}</h4><h4> {{ worker[26] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[28]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[27]">
<h4>{{ process[27] }}</h4><h4>{{ planDate[27] }} </h4><h4> {{ realDate[27] }}</h4><h4> {{ worker[27] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[29]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[28]">
<h4>{{ process[28] }}</h4><h4>{{ planDate[28] }} </h4><h4> {{ realDate[28] }}</h4><h4> {{ worker[28] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[30]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[29]">
<h4>{{ process[29] }}</h4><h4>{{ planDate[29] }} </h4><h4> {{ realDate[29] }}</h4><h4> {{ worker[29] }}</h4>
</div>
</template>
</el-table-column>
</el-table-column>
</el-table>
</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="270px">
<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="300" align="center">
<template slot-scope="scope">
<div>
<el-button size="mini" icon="el-icon-arrow-up" type="primary" @click="upOne(scope.row)"/>
<el-button size="mini" icon="el-icon-arrow-down" type="primary" @click="downOne(scope.row)"/>
<el-button size="mini" icon="el-icon-upload2" type="primary" @click="TOP(scope.row)"/>
<el-button size="mini" icon="el-icon-download" type="primary" @click="Down(scope.row)"/>
<el-button size="mini" icon="el-icon-delete" type="danger" @click="outParts(scope.row)"/>
</div>
</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 :visible.sync="dialogFormVisible" width="60%">
<el-table :data="gridData" height="500" size="mini" border>
<el-table-column property="date" label="工位号" width="300" align="center">
<template slot-scope="scope">
{{ scope.row.MES终端号 }}
</template>
</el-table-column>
<el-table-column property="name" label="调序权限" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.调序权限==='1'" type="success" size="small">已开放</el-tag>
<el-tag v-else type="info" size="small">未开放</el-tag>
</template>
</el-table-column>
<el-table-column property="date" label="操作" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.调序权限==='0'" size="mini" type="success" @click="JurisdictionControl1(scope.row)">开启</el-button>
<el-button v-if="scope.row.调序权限==='1'" size="mini" type="danger" @click="JurisdictionControl2(scope.row)">关闭</el-button>
</template>
</el-table-column>
<el-table-column property="name" label="跳序权限" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.跳序权限===1" type="success" size="small">已开放</el-tag>
<el-tag v-else type="info" size="small">未开放</el-tag>
</template>
</el-table-column>
<el-table-column property="date" label="操作" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.跳序权限===0" size="mini" type="success" @click="JurisdictionControl3(scope.row)">开启</el-button>
<el-button v-if="scope.row.跳序权限===1" size="mini" type="danger" @click="JurisdictionControl4(scope.row)">关闭</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { searchParts, getMachine, getMachine2, searchtable, getTable3, Order, JurisdictionControl, JurisdictionContro2, outParts } from '@/api/ManufacturingCenter/MachiningSequenceAdjustment'
import { wsuri, name } from '@/utils/request'
export default {
data() {
return {
Parts: '',
gongxu: '',
lengths: '',
a: 1,
b: 1,
expands: [],
opname: '', // 用来通知工位刷新数据
msg: '',
num: 0,
count: 0,
dialogFormVisible: false,
gridData: [],
Machine: [],
MachineValue: '',
loading0: false,
tableData2: [], // 工艺数据
process: [],
planDate: [],
worker: [],
colorCode: [],
realDate: [],
result: [],
零件图号: [],
tableData: [], // 表格数据
pageSize: 10,
pageCurrent: 1,
total: 0
}
},
watch: {
MachineValue(val) {
this.searchTable()
this.searchParts()
}
},
created() {
this.Jurisdiction()
this.fetchData()
this.initWebsocket()
},
methods: {
searchParts() {
this.Parts = ''
this.gongxu = ''
this.lengths = ''
searchParts(this.MachineValue).then(response => {
this.lengths = response.data.length
if (response.data.length !== 0) {
this.Parts = response.data[0].零件图号_零件工艺计划
this.gongxu = response.data[0].工艺名称
}
})
},
getRowKeys(row) {
return row.工艺计划流水号
},
selectMachine(row) {
this.process = []
this.planDate = []
this.worker = []
this.colorCode = []
this.realDate = []
this.tableData2 = []
getTable3(row.工艺计划流水号).then(response => {
for (let k = 0; k < response.data.length; k++) {
this.process[k] = response.data[k].工艺名称简称
this.planDate[k] = response.data[k].计划日期_短
this.realDate[k] = response.data[k].完成日期_短
if (response.data[k].工艺编号 === 29) {
response.data[k].员工姓名 = '备料'
}
if (response.data[k].工序间是否外协 === 2) {
response.data[k].员工姓名 = '外协'
}
if (response.data[k].员工姓名 === '超级管理员') {
response.data[k].员工姓名 = '无'
}
this.worker[k] = response.data[k].员工姓名
if (response.data[k].工序状态 === 5) { // 灰色是已经完成 未入库
this.colorCode[k] = 'grey'
} else {
this.colorCode[k] = response.data[k].进度颜色
}
if (response.data[k].工序间是否外协 === 2) {
this.colorCode[k] = 'lightblue'
}
}
this.tableData2.push(response.data[0])
})
},
initWebsocket() { // 初始化websocket
this.websock = new WebSocket(wsuri)// 这里面的this都指向vue
this.websock.onopen = this.websocketopen
this.websock.onmessage = this.websocketonmessage
this.websock.onclose = this.websocketclose
this.websock.onerror = this.websocketerror
},
websocketopen() { // 打开
console.log('WebSocket连接成功')
this.websock.send('LIN,' + name)
},
websocketonmessage(msg) { // 数据接收
console.log(msg)
this.msg = msg
},
websocketclose() { // 关闭
console.log('WebSocket关闭')
},
websocketerror() { // 失败
console.log('WebSocket连接失败')
},
Refresh() {
this.websock.send('TOBS?MES?' + this.MachineValue + '?MES|SequenceAdjustment|' + this.MachineValue + '|1')
},
// 初始化获取工位
fetchData() {
this.MachineValue = ''
this.Machine = []
getMachine().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].终端编号,
value: response.data[i].终端编号,
value2: response.data[i].姓名
})
}
}).then(() => {
this.MachineValue = this.Machine[0].value
})
},
searchTable() {
if (this.MachineValue !== '' && this.MachineValue !== null) {
this.loading0 = true
searchtable(this.MachineValue, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading0 = false
})
} else {
this.$message.error('请选择工位')
}
},
searchTable2(row) {
if (this.a === 1) {
this.expands.push(row.工艺计划流水号)
this.b = row.工艺计划流水号
this.a = 0
} else {
if (this.b === row.工艺计划流水号) {
this.expands = []
this.a = 1
} else {
this.expands = []
this.expands.push(row.工艺计划流水号)
this.a = 0
this.b = row.工艺计划流水号
}
}
this.process = []
this.planDate = []
this.worker = []
this.colorCode = []
this.realDate = []
this.tableData2 = []
getTable3(row.工艺计划流水号).then(response => {
for (let k = 0; k < response.data.length; k++) {
this.process[k] = response.data[k].工艺名称简称
this.planDate[k] = response.data[k].计划日期_短
this.realDate[k] = response.data[k].完成日期_短
if (response.data[k].工艺编号 === 29) {
response.data[k].员工姓名 = '备料'
}
if (response.data[k].工序间是否外协 === 2) {
response.data[k].员工姓名 = '外协'
}
if (response.data[k].员工姓名 === '超级管理员') {
response.data[k].员工姓名 = '无'
}
this.worker[k] = response.data[k].员工姓名
if (response.data[k].工序状态 === 5) { // 灰色是已经完成 未入库
this.colorCode[k] = 'grey'
} else {
this.colorCode[k] = response.data[k].进度颜色
}
if (response.data[k].工序间是否外协 === 2) {
this.colorCode[k] = 'lightblue'
}
}
this.tableData2.push(response.data[0])
})
},
Jurisdiction() {
this.count = 0
getMachine2().then(response => {
this.gridData = response.data
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].跳序权限 === 1) { this.count = this.count + 1 }
}
this.num = this.count
})
},
JurisdictionControl1(row) {
this.opname = row.MES终端号
JurisdictionControl(row.MES终端号, 1).then(response => {
this.Jurisdiction()
return this.opname
}).then(data => {
this.websock.send('TOBS?MES?' + data + '?MES|PartsSequentialAuthority|' + data + '|1')
})
},
JurisdictionControl2(row) {
this.opname = row.MES终端号
JurisdictionControl(row.MES终端号, 2).then(response => {
this.Jurisdiction()
return this.opname
}).then(data => {
this.websock.send('TOBS?MES?' + data + '?MES|PartsSequentialAuthority|' + data + '|0')
})
},
JurisdictionControl3(row) {
this.opname = row.MES终端号
JurisdictionContro2(row.MES终端号, 1).then(response => {
this.Jurisdiction()
return this.opname
}).then(data => {
this.websock.send('TOBS?MES?' + data + '?MES|SkipPermission|' + data + '|1')
})
},
JurisdictionControl4(row) {
this.opname = row.MES终端号
JurisdictionContro2(row.MES终端号, 2).then(response => {
this.Jurisdiction()
return this.opname
}).then(data => {
this.websock.send('TOBS?MES?' + data + '?MES|SkipPermission|' + data + '|0')
})
},
// 上移
upOne(row) {
Order(this.MachineValue, row.工序流水号, '上移').then(response => {
this.searchTable()
})
},
// 下移
downOne(row) {
Order(this.MachineValue, row.工序流水号, '下移').then(response => {
this.searchTable()
})
},
// 置顶
TOP(row) {
Order(this.MachineValue, row.工序流水号, '置顶').then(response => {
this.searchTable()
})
},
// 置底
Down(row) {
Order(this.MachineValue, row.工序流水号, '置底').then(response => {
this.searchTable()
})
},
outParts(row) {
outParts(row.工艺计划流水号).then(response => {
this.searchTable()
}).then(data => {
this.websock.send('TOBS?MES?' + data + '?MES|PartsSequentialAuthority|' + data + '|0')
})
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.item {
float: right;
margin-top: 10px;
margin-right: 40px;
}
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
.white{
background-color: ghostwhite;
border: 1px solid #1f2d3d;
}
.grey{
background-color: grey;
border: 1px solid #1f2d3d;
}
.red{
background-color: orangered;
border: 1px solid #1f2d3d;
}
.lightblue{
background-color: deepskyblue;
border: 1px solid #1f2d3d;
}
.yellow{
background-color: yellow;
border: 1px solid #1f2d3d;
}
.blank{
background-color: transparent;
border: 0px solid white;
}
.lightgreen{
background-color: lightgreen;
border: 1px solid #1f2d3d;
}
</style>

View File

@@ -0,0 +1,303 @@
<template>
<div>
<el-card>
<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="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
<el-button size="small" icon="el-icon-success" type="primary" style="margin-left: 10px" @click="edit2()">自家备料确认</el-button>
<el-button size="small" icon="el-icon-success" type="primary" style="margin-left: 10px" @click="back()">打回</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border element-loading-text="拼命加载中" @selection-change="handleSelectionChange2">
<el-table-column type="selection" width="55" align="center"/>
<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="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="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<span>零件图号:</span>
<el-input v-model="partName2" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="total2=0;pageSize2=10; pageCurrent2=1;searchTable2()">查询</el-button>
<el-button size="small" icon="el-icon-success" type="primary" style="margin-left: 10px" @click="edit()">外购备料确认</el-button>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="tableData2" height="580" style="width: 100%;" border element-loading-text="拼命加载中" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<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="240px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="重量" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.重量1 }}
</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">
<template slot-scope="scope">
{{ scope.row.备注1 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
</div>
</template>
<script>
import { searchtable, searchtable2, searchtable3, change2, change3, edit } from '@/api/ManufacturingCenter/MaterialArrivalManagement'
import { mapGetters } from 'vuex'
export default {
data() {
return {
arrest2: [],
editTime: '',
bianliang1: [],
bianliang2: [],
bianliang3: [],
num: 0,
arrest: [],
all: false,
partName: '',
loading: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1, // 后台获取页
loading2: false,
partName2: '',
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1 // 后台获取页
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id',
'userId'
])
},
created() {
this.searchTable()
this.searchTable2()
},
methods: {
handleSelectionChange2(val) {
this.arrest2 = val
},
edit2() {
this.bianliang1 = []
this.bianliang2 = []
if (this.arrest2.length === 0) {
this.$message.warning('请选择零件')
} else {
for (let i = 0; i < this.arrest2.length; i++) {
this.bianliang1.push(this.arrest2[i].工艺计划流水号)
this.bianliang2.push(this.arrest2[i].工序流水号)
}
change3(this.bianliang2, this.userId, this.bianliang1).then(response => {
this.searchTable()
})
}
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.Data = []
if (this.partName !== '' && this.partName !== null) {
this.partNamecheck = true
} else {
this.partNamecheck = false
}
searchtable(this.partNamecheck, this.partName, 0, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
this.Data = response.data.rows
this.total = response.data.total
}
}).then(() => {
for (let i = 0; i < this.Data.length; i++) {
searchtable2(this.Data[i].工艺计划流水号).then(response => {
this.tableData.push({
工艺计划流水号: this.Data[i].工艺计划流水号,
零件名称: this.Data[i].零件名称,
零件图号: this.Data[i].零件图号,
备料到货: this.Data[i].备料到货,
工艺要求: response.data[0].工艺要求,
工序流水号: response.data[0].工序流水号,
重量: response.data[0].重量,
单价: 0
})
})
this.loading = false
}
})
},
back() {
if (this.arrest2.length === 0) {
this.$message.warning('请选择零件')
} else {
this.a = 0
for (let i = 0; i < this.arrest2.length; i++) {
edit(this.arrest2[i].工艺计划流水号).then(response => {
this.a += parseInt(response.data[0].result)
if (this.a === this.arrest2.length) {
this.$message.success('打回成功')
this.searchTable()
} else {
this.$message.error('打回失败')
}
})
}
}
},
zeroFill(i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
},
// // 自家备料确认
// handleChange1(row) {
// var date = new Date()
// var month = this.zeroFill(date.getMonth() + 1)
// var day = this.zeroFill(date.getDate())
// this.editTime = date.getFullYear() + '-' + month + '-' + day
// change(row.工艺计划流水号, row.重量, row.单价).then(() => {
// handlechange(row.工序流水号, this.userId).then(response => {
// handlechange2(row.工序流水号, this.editTime).then(response => {
// this.searchTable()
// })
// })
// })
// },
handleSelectionChange(val) {
this.arrest = val
},
searchTable2() {
this.loading2 = true
this.tableData2 = []
this.Data2 = []
if (this.partName2 !== '' && this.partName2 !== null) {
this.partNamecheck2 = 1
} else {
this.partNamecheck2 = 0
}
searchtable3(this.partNamecheck2, this.partName2, this.pageCurrent2, this.pageSize2).then(response => {
if (response.data.total === 0) {
this.loading2 = false
} else {
this.Data2 = response.data.rows
this.total2 = response.data.total
}
}).then(() => {
for (let i = 0; i < this.Data2.length; i++) {
searchtable2(this.Data2[i].工艺计划流水号).then(response => {
this.tableData2.push({
工艺计划流水号: this.Data2[i].工艺计划流水号,
零件名称: this.Data2[i].零件名称,
零件图号: this.Data2[i].零件图号,
重量1: this.Data2[i].重量1,
单价: this.Data2[i].单价,
备注1: this.Data2[i].备注1,
工序流水号: response.data[0].工序流水号
})
})
this.loading2 = false
}
})
},
edit() {
this.bianliang1 = []
this.bianliang2 = []
if (this.arrest.length === 0) {
this.$message.warning('请选择零件')
} else {
for (let i = 0; i < this.arrest.length; i++) {
this.bianliang1.push(this.arrest[i].工艺计划流水号)
this.bianliang2.push(this.arrest[i].工序流水号)
}
change2(this.bianliang2, this.userId, this.bianliang1).then(response => {
this.searchTable2()
})
}
},
// 分页
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.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,204 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>项目名称:</span>
<el-select v-model="projectValue" size="small" filterable clearable placeholder="项目名称">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>开始日期:</span>
<el-date-picker
v-model="date1"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<span>结束日期:</span>
<el-date-picker
v-model="date2"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-radio-group v-model="radio" size="small" style="margin: 10px;">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
<el-radio :label="3"></el-radio>
</el-radio-group>
<el-button type="success" icon="el-icon-search" style="margin: 10px;" size="small" @click="search">查询</el-button>
</el-row>
</el-card>
<el-card v-loading="loading">
<div id="myChart" :style="{width: '100%', height: '470px', margin: 'auto'}"/>
</el-card>
</div>
</template>
<script>
import { initProject, searchData } from '@/api/ManufacturingCenter/OwnTimeStatistics'
import echarts from 'echarts'
export default {
data() {
return {
loading: false,
projectValue: '',
project: [],
date1: '',
date2: '',
radio: 1,
check1: 0,
dataX: [],
series: [],
delayOkTime: [],
planOkTime: [],
preOkTime: [],
noOkTime: [],
totalTime: [],
totalAblity: []
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.project = []
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.project.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
search() {
this.loading = true
var myChart = echarts.init(document.getElementById('myChart'))
myChart.clear()
if (this.projectValue === '' || this.projectValue === null) {
this.check1 = 0
} else {
this.check1 = 1
}
if (this.date1 === '' || this.date1 === null || this.date2 === '' || this.date2 === null) {
this.check2 = 0
this.date1 = ''
this.date2 = ''
} else {
this.check2 = 1
}
searchData(this.check1, this.projectValue, this.check2, this.date1, this.date2, this.radio).then(response => {
console.log(response.data)
if (response.data.length !== 0 && !response.data[0].hasOwnProperty('result')) {
this.drawLine(response.data)
} else {
this.$message.warning('没有数据或数据量太大,请重新选择查询条件')
this.loading = false
}
})
},
drawLine(data) {
this.dataX = []
this.delayOkTime = []
this.planOkTime = []
this.preOkTime = []
this.noOkTime = []
this.totalTime = []
this.totalAblity = []
this.series = []
for (let i = 0; i < data.length; i++) {
this.dataX.push(data[i].计划日期)
this.delayOkTime.push(data[i].拖延完成工时)
this.planOkTime.push(data[i].按计划完成工时)
this.preOkTime.push(data[i].提前完成工时)
this.noOkTime.push(data[i].未完成工时)
this.totalTime.push(data[i].计划总工时)
this.totalAblity.push(data[i].设备总能力)
}
var myChart = echarts.init(document.getElementById('myChart'))
myChart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ['提前完成工时', '按计划完成工时', '未完成工时', '拖延完成工时', '设备总能力']
},
dataZoom: { // 实现缩放功能
show: true,
realtime: true,
start: 0,
end: 100
},
xAxis: {
type: 'category',
name: '计划日期',
data: this.dataX,
axisLabel: {
interval: 0,
rotate: 0,
margin: 10
}
},
yAxis: {
type: 'value',
name: '工时',
min: 0,
scale: 'true'
},
series: [
{
name: '提前完成工时',
type: 'bar',
// stack: '工时',
data: this.preOkTime
},
{
name: '按计划完成工时',
type: 'bar',
data: this.planOkTime
},
{
name: '未完成工时',
type: 'bar',
data: this.noOkTime
},
{
name: '拖延完成工时',
type: 'bar',
data: this.delayOkTime
},
{
name: '设备总能力',
type: 'bar',
data: this.totalAblity
}
]
})
this.loading = false
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,322 @@
<template>
<div class="app-container">
<el-card>
<div>
<span style="margin-left: 0">机床号</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" style="margin-top: 3px" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
: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.name }}</div>
</el-option>
</el-select>
<span style="margin-left: 10px">组号</span>
<el-select v-model="groupNumberValue" placeholder="组号" size="small" clearable>
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 10px">零件号</span>
<el-input v-model="PrNum" size="small" placeholder="零件号" clearable style="width: 200px"/>
<span style="margin-left: 10px">工艺员</span>
<el-select v-model="personValue" placeholder="工艺员" size="small" clearable >
<el-option
v-for="item in person"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" style="margin-left: 10px" icon="el-icon-search" @click="pageCurrent=1;pageSize=20;total=0;searchData()">查询</el-button>
</div>
<el-table
v-loading="loading"
:data="tableData"
size="mini"
height="730"
border
stripe
highlight-current-row
@selection-change="handleSelectionChange"
@row-click="click">
<el-table-column
type="selection"
align="center"
width="55"/>
<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.批次数量 }}
</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
:current-page="pageCurrent"
:page-sizes="[5, 10, 20]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<div>
<el-tooltip effect="dark" content="将在制零件打回,重新编制工艺定额" placement="top">
<div style="display: inline-block">
<el-button v-show="true" type="danger" plain style="margin-left: 0px;margin-top: 3px" icon="el-icon-edit" size="small" @click="returnEdit">在制零件工艺调整</el-button>
</div>
</el-tooltip>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisiblePeople" title="工艺流程单" center>
<div v-if="tableData2.length">
<table class="tg">
<tr>
<td class="tg-x61c" colspan="4" rowspan="2">江苏高精</td>
<td class="tg-c3ow" colspan="2" rowspan="2">零件条码</td>
<td class="tg-c3ow" colspan="3">零件图号</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].零件图号 : '' }}</td>
<td class="tg-c3ow">数量</td>
</tr>
<tr>
<td class="tg-c3ow" colspan="3">零件名称</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].零件名称 : '' }}</td>
<td class="tg-c3ow" rowspan="3">{{ tableData2[0] ? tableData2[0].投产数量 : '' }}</td>
</tr>
<tr>
<td class="tg-c3ow" colspan="2">项目名称</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].项目名称 : '' }}</td>
<td class="tg-c3ow" colspan="2" rowspan="2">{{ tableData2[0] ? 'P' + tableData2[0].工艺计划流水号 : '' }}</td>
<td class="tg-c3ow" colspan="3">机床</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].机床图号 : '' }}</td>
</tr>
<tr>
<td class="tg-c3ow">材质</td>
<td class="tg-c3ow">{{ tableData2[0] ? tableData2[0].材料 : '' }}</td>
<td class="tg-c3ow">规格</td>
<td class="tg-c3ow">{{ tableData2[0] ? tableData2[0].原材料规格 : '' }}</td>
<td class="tg-c3ow" colspan="3">组号</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].组号 : '' }}</td>
</tr>
<tr>
<td class="tg-c3ow">序次</td>
<td class="tg-c3ow">工艺名称</td>
<td class="tg-c3ow" colspan="3">工艺要求</td>
<td class="tg-c3ow">难度系数</td>
<td class="tg-c3ow">工作者</td>
<td class="tg-c3ow">单件</td>
<td class="tg-c3ow">准结</td>
<td class="tg-c3ow">检查结果</td>
<td class="tg-c3ow">计划完成日期</td>
<td class="tg-c3ow">工序条码</td>
</tr>
<tr v-for="(value,key) in tableData2" :id="key" :key="key">
<td class="tg-c3ow">{{ key + 1 }}</td>
<td class="tg-c3ow">{{ value.工艺名称 }}</td>
<td class="tg-c3ow" colspan="3">{{ value.工艺要求 }}</td>
<td class="tg-c3ow">{{ value.工艺难度等级 }}</td>
<td class="tg-c3ow"/>
<td class="tg-c3ow">{{ value.单件定额工时 }}</td>
<td class="tg-c3ow">{{ value.准结定额工时 }}</td>
<td class="tg-c3ow"/>
<td class="tg-c3ow">{{ value.计划日期 }}</td>
<td class="tg-c3ow">{{ value.工序流水号 }}</td>
</tr>
<tr>
<td class="tg-c3ow">工艺员</td>
<td class="tg-c3ow">{{ tableData2[0] ? tableData2[0].工艺员 : '' }}</td>
<td class="tg-c3ow">定额员</td>
<td class="tg-c3ow">{{ tableData2[0] ? tableData2[0].定额员 : '' }}</td>
<td class="tg-c3ow">工艺完成</td>
<td class="tg-c3ow">{{ tableData2[0].工艺实际完成时间 ? tableData2[0].工艺实际完成时间.split(' ')[0] : '' }}</td>
<td class="tg-c3ow">加工开始</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].机加工开始时间 : '' }}</td>
<td class="tg-c3ow">加工结束</td>
<td class="tg-c3ow" colspan="2">{{ tableData2[0] ? tableData2[0].机加工结束时间 : '' }}</td>
</tr>
</table>
</div>
</el-dialog>
</div>
</template>
<script>
import { initMachineProject, searchgroup, initPerson, search, searchtable1,
returnEdit } from '@/api/ManufacturingCenter/PartWorkCraftSelect_rdlc'
export default {
data() {
return {
partNumValue: [],
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNumber: [],
personValue: '',
person: [],
pageCurrent: 1,
pageSize: 20,
total: 0,
tableData: [],
loading: false,
PrNum: '',
tableData2: [],
tableData3: [],
dialogFormVisiblePeople: false,
机床号: '',
组号: '',
零件图号: '',
零件名称: '',
投产数量: '',
材料: '',
原材料规格: '',
工艺员: '',
定额员: '',
日期: ''
}
},
created() {
this.fetchData()
this.searchData()
},
methods: {
returnEdit() { // 在制零件工艺修改
if (this.partNumValue.length === 0) {
this.$message.error('请选择零件')
} else {
this.$confirm(`此操作会将零件打回至未编制状态, 是否继续?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
returnEdit(this.partNumValue).then(response => {
if (response.data[0].result === '1') {
this.$message.success('打回成功')
this.partNumValue = []
this.searchData()
this.tableData2 = []
} else {
this.$message.error('打回失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}
},
fetchData() {
initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
initPerson().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.person.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchData() {
this.loading = true
let check1, check2, check3, check4
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.PrNum ? check3 = 1 : check3 = 0
this.personValue ? check4 = 1 : check4 = 0
search(this.pageCurrent, this.pageSize, check1, this.machineNumberValue, check2, this.groupNumberValue, check3, this.PrNum, check4, this.personValue).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
})
},
click(row) {
this.零件图号 = row.零件图号
searchtable1(row.工艺计划流水号).then(response => {
this.tableData2 = response.data
this.dialogFormVisiblePeople = true
})
},
handleSelectionChange(val) {
this.partNumValue = []
for (let i = 0; i < val.length; i++) {
this.partNumValue.push(val[i].工艺计划流水号)
}
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchData()
}
}
}
</script>
<style>
td{
width: 100px;
height: 30px;
text-align:center;
}
.tg {border-collapse:collapse;border-spacing:0;margin: 0 auto}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}
.tg .tg-x61c{font-weight:bold;font-size:28px;border-color:inherit;text-align:center;vertical-align:top}
</style>
<style scoped>
</style>

View File

@@ -0,0 +1,271 @@
<template>
<div class="app-container">
<el-card>
<span>工艺员:</span>
<el-select v-model="craftmenValue" placeholder="工艺员" size="small" style="margin: 3px;" @change="searchParts()">
<el-option
v-for="item in craftmen"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 10px">零件图号:</span>
<el-select v-model="partNumValue" filterable placeholder="零件图号" size="small" @change="tableData1=[];tableData2=[];returnDate = '';searchData();">
<el-option
v-for="item in partNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 10px">打回时间:</span>
<el-date-picker v-model="returnDate" :clearable="false" type="datetime" placeholder="打回时间" size="small" readonly/>
</el-card>
<el-row>
<el-col :span="12">
<el-card >
<div style="display: inline-block;margin: 3px">改前零件工艺</div>
<el-table id="div1" ref="div1" :data="tableData1" :row-class-name="tableRowClassName1" size="mini" border highlight-current-row stripe style="height:350px;overflow-y: auto;" @mouseenter.native="changeScrollBefore">
<el-table-column align="center" label="工序顺序" width="70px">
<template slot-scope="scope">
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺名称" width="120px">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="难度等级" width="70px">
<template slot-scope="scope">
{{ scope.row.工艺难度等级 }}
</template>
</el-table-column>
<el-table-column header-align="center" label="工艺要求">
<template slot-scope="scope">
{{ scope.row.工艺要求 }}
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<div style="display: inline-block;margin:3px">改后零件工艺</div>
<el-table id="div2" ref="div2" :data="tableData2" :row-class-name="tableRowClassName2" size="mini" border highlight-current-row stripe style="height:350px;overflow-y: scroll;" @mouseenter.native="changeScrollAfter">
<el-table-column align="center" label="工序顺序" width="70px">
<template slot-scope="scope">
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺名称" width="120px">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="难度等级" width="70px">
<template slot-scope="scope">
{{ scope.row.工艺难度等级 }}
</template>
</el-table-column>
<el-table-column header-align="center" label="工艺要求">
<template slot-scope="scope">
{{ scope.row.工艺要求 }}
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-card>
<div id="myChart" :style="{width: '100%', height: '400px', margin: 'auto'}"/>
</el-card>
</div>
</template>
<script>
import echarts from 'echarts'
import { initCraftmen, searchPart, searchProcessOld, searchProcessNew, searchChart } from '@/api/ManufacturingCenter/ProcessAdjustQuery'
export default {
data() {
return {
returnDate: '',
craftmenValue: '',
craftmen: [],
partNumValue: '', // 工艺计划流水号
partNum: [],
partStatus: '',
tableData1: [],
tableData2: [],
dataX: [],
partsNum: []
}
},
created() {
this.fetchData()
this.searchChart()
},
methods: {
changeScrollBefore() {
const div1 = document.getElementById('div1')
const div2 = document.getElementById('div2')
div2.removeAttribute('onscroll')
div1.setAttribute('onscroll', 'document.getElementById(\'div2\').scrollTop = scrollTop')
},
changeScrollAfter() {
const div1 = document.getElementById('div1')
const div2 = document.getElementById('div2')
div1.removeAttribute('onscroll')
div2.setAttribute('onscroll', 'document.getElementById(\'div1\').scrollTop = scrollTop')
},
searchChart() {
searchChart().then(response => {
console.log(response, 11)
for (let i = 0; i < response.data.length; i++) {
this.dataX.push(response.data[i].姓名)
this.partsNum.push(response.data[i].零件数量)
}
this.drawLine()
})
},
drawLine() {
const myChart = echarts.init(document.getElementById('myChart'))
myChart.clear()
myChart.setOption({
title: {
text: '在制零件工艺调整统计',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: {
type: 'category',
name: '工艺员',
data: this.dataX,
axisLabel: {
interval: 0,
rotate: 0,
margin: 10
}
},
yAxis: {
type: 'value',
name: '工艺被调整零件数',
min: 0,
minInterval: 1
},
series: [
{
name: '工艺调整零件数',
type: 'bar',
data: this.partsNum,
markLine: {
data: [
{ type: 'average', name: '平均值' }
]
}
}
]
})
},
fetchData() {
this.craftmen = []
initCraftmen().then(response => { // 初始化工艺员
for (let i = 0; i < response.data.length; i++) {
this.craftmen.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
},
searchParts() {
this.tableData1 = []
this.tableData2 = []
this.partNum = []
this.partNumValue = ''
this.returnDate = ''
searchPart(this.craftmenValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partNum.push({
label: response.data[i].零件图号_零件工艺计划,
value: response.data[i].工艺计划流水号
})
}
})
},
searchData() {
this.tableData1 = []
this.tableData2 = []
if (this.partNumValue !== '' && this.partNumValue !== null) {
searchProcessOld(this.partNumValue).then(response => {
this.tableData1 = response.data
this.returnDate = response.data[0].操作时间
})
searchProcessNew(this.partNumValue).then(response => {
this.tableData2 = response.data
})
} else {
this.$message.error('请先选择零件')
}
},
tableRowClassName2({ row }) {
for (let i = 0; i < this.tableData1.length; i++) {
row.工艺编号 === null ? row.工艺编号 = 0 : row.工艺编号
if (this.tableData1[i].工序顺序 === row.工序顺序) {
if (this.tableData1[i].工艺编号 !== row.工艺编号 || this.tableData1[i].工艺要求 !== row.工艺要求 || this.tableData1[i].工艺难度等级 !== row.工艺难度等级) {
return 'change'
} else {
return ''
}
}
}
},
tableRowClassName1({ row }) {
for (let i = 0; i < this.tableData2.length; i++) {
row.工艺编号 === null ? row.工艺编号 = 0 : row.工艺编号
if (this.tableData2[i].工序顺序 === row.工序顺序) {
if (this.tableData2[i].工艺编号 !== row.工艺编号 || this.tableData2[i].工艺要求 !== row.工艺要求 || this.tableData2[i].工艺难度等级 !== row.工艺难度等级) {
return 'change'
} else {
return ''
}
}
}
}
}
}
</script>
<style>
.el-table .change {
background: oldlace;
}
</style>
<style scoped>
.el-card{
/*margin-bottom: 15px;*/
}
.el-date-editor{
width:200px
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
/*margin: 10px 0 10px 10px;*/
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,372 @@
<template>
<div class="app-container">
<el-card>
<el-radio-group v-show="false" v-model="radio" size="small" 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="graphNumValue" filterable size="small" style="margin:3px;width: 220px" placeholder="机床图号" @change="getGroupNum()">
<el-option
v-for="item in graphNum"
: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>
<span style="margin-left: 10px">组号:</span>
<el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 220px" @change="total=0;PageCurrent=1;PageSize=20;getTable()">
<el-option
v-for="item in GroupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="primary" size="small" icon="el-icon-bangzhu" style="margin-left: 10px" @click="selectAll(tableData)">全选</el-button>
<el-button type="primary" size="small" icon="el-icon-upload" style="margin-left: 10px" @click="save">保存</el-button>
</el-card>
<el-card>
<el-table
ref="multipleTable"
:data="tableData"
style="width: 100%;"
size="mini"
height="770"
highlight-current-row
border
stripe
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection"/>
<el-table-column align="center" label="零件号">
<template slot-scope="scope">
{{ scope.row.零件号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件名称">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺开始时间" width="160">
<template slot-scope="scope">
{{ scope.row.工艺开始时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺结束时间" width="160">
<template slot-scope="scope">
{{ scope.row.工艺结束时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺员" width="230px">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].工艺员" size="mini" style="width:150px" placeholder="工艺员" @click.native="selectPerson(scope.$index)"/>
</template>
</el-table-column>
<el-table-column align="center" label="数量" width="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="投产时间" width="160">
<template slot-scope="scope">
{{ scope.row.投产时间 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-show="!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="dialogFormVisible" title="选择工艺定额人员" center>
<el-table
:data="tableData2"
style="width: 100%;max-height: 200px"
size="mini"
border
stripe
height="200px"
highlight-current-row
@row-click="confirmPerson">
<el-table-column align="center" label="考勤编号">
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="姓名">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column align="center" label="性别">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column align="center" label="工作岗位">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="tijiao()">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getProject0, getProject, getGraphNum, getGroupNum, getTable0, getGraphNum0, getGroupNum0, getTable00, save, initPerson } from '@/api/ManufacturingCenter/ProcessTaskAssignment'
export default {
data() {
return {
num1: '', // 工艺员中间变量
num2: '', // 工艺员流水号中间变量
loading: false,
loading0: false,
projectNameValue: '',
projectName: [],
// machineToolNum: '',
radio: 2,
graphNumValue: '',
graphNum: [],
GroupNumValue: '',
GroupNum: [],
tableData: [],
dialogFormVisible: false,
tableData2: [],
dialogPerson: '',
index: '',
multipleSelection: [],
result: 0,
PageCurrent: 1,
PageSize: 20,
total: 0
}
},
created() {
this.getGraphNum()
this.initPerson()
},
methods: {
fetchData() {
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
initPerson() { // 初始化工艺员
initPerson().then(response => {
this.tableData2 = response.data
})
},
radioChange() { // radio改变
this.loading = true
this.projectName = []
this.projectNameValue = ''
this.graphNumValue = ''
this.GroupNumValue = ''
this.GroupNum = []
this.tableData = []
this.total = 0
if (this.radio === 1) {
getProject0().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
this.loading = false
})
} else {
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
this.loading = false
})
}
},
getGraphNum() { // 获取下拉图号
this.tableData = []
this.total = 0
this.GroupNumValue = ''
this.GroupNum = []
if (this.radio === 2) { // 全部
getGraphNum().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.graphNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
} else { // 当天
getGraphNum0(this.projectNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.graphNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
}
},
getGroupNum() { // 获取下拉组号
this.tableData = []
this.total = 0
this.GroupNum = []
this.GroupNumValue = ''
if (this.radio === 2) { // 全部
getGroupNum(this.graphNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
} else { // 当天
getGroupNum0(this.graphNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
}
},
getTable() { // 获取主表
this.loading0 = true
this.tableData = []
if (this.radio === 2) { // 全部
getTable0(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => {
this.total = response.data.total
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].工艺计划开始时间 = response.data.rows[i].工艺计划开始时间.split(' ')[0]
response.data.rows[i].工艺计划结束时间 = response.data.rows[i].工艺计划结束时间.split(' ')[0]
response.data.rows[i].操作时间 = response.data.rows[i].操作时间.split(' ')[0]
}
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData.push({
零件号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
工艺开始时间: response.data.rows[i].工艺计划开始时间,
工艺结束时间: response.data.rows[i].工艺计划结束时间,
数量: response.data.rows[i].批次数量,
投产时间: response.data.rows[i].操作时间,
工艺员: '',
人员编号: '',
工艺计划流水号: response.data.rows[i].工艺计划流水号
})
}
this.loading0 = false
})
} else { // 当天
getTable00(this.PageCurrent, this.PageSize, this.GroupNumValue).then(response => {
this.total = response.data.total
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData.push({
零件号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
工艺开始时间: response.data.rows[i].工艺计划开始时间,
工艺结束时间: response.data.rows[i].工艺计划结束时间,
数量: response.data.rows[i].批次数量,
投产时间: response.data.rows[i].操作时间,
工艺员: '',
人员编号: '',
工艺计划流水号: response.data.rows[i].工艺计划流水号
})
}
this.loading0 = false
})
}
},
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.getTable()
},
handleCurrentChange(val) {
this.PageCurrent = val
this.getTable()
},
selectPerson(index) { // 点击查询按钮
this.index = index
this.dialogFormVisible = true
},
confirmPerson(row) { // 选择一行
this.num1 = row.姓名
this.num2 = row.人员编号
},
tijiao() {
this.tableData[this.index].工艺员 = this.num1
this.tableData[this.index].人员编号 = this.num2
this.dialogFormVisible = false
},
selectAll(rows) {
if (this.tableData[0].工艺员 !== '') {
for (let i = 0; i < rows.length; i++) {
rows[i].工艺员 = this.tableData[0].工艺员
rows[i].人员编号 = this.tableData[0].人员编号
}
this.$refs.multipleTable.clearSelection()
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row)
})
} else { this.$message.error('请在第一行中填写工艺员姓名') }
},
handleSelectionChange(val) {
this.multipleSelection = val
},
save() {
for (let i = 0; i < this.multipleSelection.length; i++) {
if (this.multipleSelection[i].人员编号 === '') {
this.$message.error('请选择工艺员')
} else {
this.result = 0
save(this.multipleSelection[i].工艺计划流水号, this.multipleSelection[i].人员编号, this.multipleSelection[i].零件号).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.multipleSelection.length) {
this.$message.success('保存成功')
this.PageCurrent = 1
this.getTable()
} else if (i === this.multipleSelection.length - 1 && this.result !== this.multipleSelection.length) {
this.$message.error('存在保存失败项')
}
})
}
}
}
}
}
</script>
<style scoped>
span{
margin-right: 10px;
}
</style>

View File

@@ -0,0 +1,608 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>机床号:</span>
<el-select v-model="Machine" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="机床号" @change="getGroup()">
<el-option
v-for="item in Machines"
: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>
<span>组号:</span>
<el-select v-model="Group" size="small" clearable placeholder="组号" style="margin-top:10px;width: 180px;">
<el-option
v-for="item in Groups"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span>
<el-input v-model="number" placeholder="零件号" clearable size="small" style="width: 180px;"/>
<span>进度颜色</span>
<span style="background-color: red">拖期</span>
<span style="background-color: yellow">即将拖期</span>
<span style="background-color: lawngreen">如期</span>
<span style="background-color: deepskyblue">工序外协</span>
<span style="background-color: grey">报废</span>
</el-row>
<el-row style="margin-top:10px;">
<span class="demonstration">计划下达时间:</span>
<el-date-picker
v-model="startTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 10px 0 0 10px" @click="getTableData();pageCurrent=1;pageSize=10;total = 0">查询</el-button>
<el-button type="warning" class="el-icon-download" size="small" style="margin: 10px 0 0 10px" @click="exportExcel">导出</el-button>
</el-row>
</el-card>
<el-card>
<el-table
v-loading="listLoading1"
:data="tableData1"
class="table"
border
height="650">
<el-table-column
label="序号"
align="center"
width="50"
type="index"/>
<el-table-column
align="center"
label="零件图号"
width="200px">
<template slot-scope="scope">{{ 零件图号[scope.$index] }}</template>
</el-table-column>
<el-table-column
align="center"
label="零件名称"
width="120px">
<template slot-scope="scope"> {{ 零件名称[scope.$index] }}</template>
</el-table-column>
<el-table-column
align="center"
prop="address"
label="数量">
<template slot-scope="scope">{{ 投产数量[scope.$index] }}</template>
</el-table-column>
<el-table-column label="零件加工计划进度(工艺名称,计划完成时间,实际完成时间,员工名称)" >
<el-table-column label="[1]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][0]">
<h4>{{ process[scope.$index][0] }}</h4><h4>{{ planDate[scope.$index][0] }} </h4><h4> {{ realDate[scope.$index][0] }}</h4><h4> {{ worker[scope.$index][0] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[2]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][1]">
<h4>{{ process[scope.$index][1] }}</h4><h4>{{ planDate[scope.$index][1] }} </h4><h4> {{ realDate[scope.$index][1] }}</h4><h4> {{ worker[scope.$index][1] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[3]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][2]">
<h4>{{ process[scope.$index][2] }}</h4><h4>{{ planDate[scope.$index][2] }} </h4><h4> {{ realDate[scope.$index][2] }}</h4><h4> {{ worker[scope.$index][2] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[4]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][3]">
<h4>{{ process[scope.$index][3] }}</h4><h4>{{ planDate[scope.$index][3] }} </h4><h4> {{ realDate[scope.$index][3] }}</h4><h4> {{ worker[scope.$index][3] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[5]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][4]">
<h4>{{ process[scope.$index][4] }}</h4><h4>{{ planDate[scope.$index][4] }} </h4><h4> {{ realDate[scope.$index][4] }}</h4><h4> {{ worker[scope.$index][4] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[6]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][5]">
<h4>{{ process[scope.$index][5] }}</h4><h4>{{ planDate[scope.$index][5] }} </h4><h4> {{ realDate[scope.$index][5] }}</h4><h4> {{ worker[scope.$index][5] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[7]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][6]">
<h4>{{ process[scope.$index][6] }}</h4><h4>{{ planDate[scope.$index][6] }} </h4><h4> {{ realDate[scope.$index][6] }}</h4><h4> {{ worker[scope.$index][6] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[8]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][7]">
<h4>{{ process[scope.$index][7] }}</h4><h4>{{ planDate[scope.$index][7] }} </h4><h4> {{ realDate[scope.$index][7] }}</h4><h4> {{ worker[scope.$index][7] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[9]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][8]">
<h4>{{ process[scope.$index][8] }}</h4><h4>{{ planDate[scope.$index][8] }} </h4><h4> {{ realDate[scope.$index][8] }}</h4><h4> {{ worker[scope.$index][8] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[10]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][9]">
<h4>{{ process[scope.$index][9] }}</h4><h4>{{ planDate[scope.$index][9] }} </h4><h4> {{ realDate[scope.$index][9] }}</h4><h4> {{ worker[scope.$index][9] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[11]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][10]">
<h4>{{ process[scope.$index][10] }}</h4><h4>{{ planDate[scope.$index][10] }} </h4><h4> {{ realDate[scope.$index][10] }}</h4><h4> {{ worker[scope.$index][10] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[12]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][11]">
<h4>{{ process[scope.$index][11] }}</h4><h4>{{ planDate[scope.$index][11] }} </h4><h4> {{ realDate[scope.$index][11] }}</h4><h4> {{ worker[scope.$index][11] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[13]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][12]">
<h4>{{ process[scope.$index][12] }}</h4><h4>{{ planDate[scope.$index][12] }} </h4><h4> {{ realDate[scope.$index][12] }}</h4><h4> {{ worker[scope.$index][12] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[14]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][13]">
<h4>{{ process[scope.$index][13] }}</h4><h4>{{ planDate[scope.$index][13] }} </h4><h4> {{ realDate[scope.$index][13] }}</h4><h4> {{ worker[scope.$index][13] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[15]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][14]">
<h4>{{ process[scope.$index][14] }}</h4><h4>{{ planDate[scope.$index][14] }} </h4><h4> {{ realDate[scope.$index][14] }}</h4><h4> {{ worker[scope.$index][14] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[16]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][15]">
<h4>{{ process[scope.$index][15] }}</h4><h4>{{ planDate[scope.$index][15] }} </h4><h4> {{ realDate[scope.$index][15] }}</h4><h4> {{ worker[scope.$index][15] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[17]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][16]">
<h4>{{ process[scope.$index][16] }}</h4><h4>{{ planDate[scope.$index][16] }} </h4><h4> {{ realDate[scope.$index][16] }}</h4><h4> {{ worker[scope.$index][16] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[18]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][17]">
<h4>{{ process[scope.$index][17] }}</h4><h4>{{ planDate[scope.$index][17] }} </h4><h4> {{ realDate[scope.$index][17] }}</h4><h4> {{ worker[scope.$index][17] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[19]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][18]">
<h4>{{ process[scope.$index][18] }}</h4><h4>{{ planDate[scope.$index][18] }} </h4><h4> {{ realDate[scope.$index][18] }}</h4><h4> {{ worker[scope.$index][18] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[20]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][19]">
<h4>{{ process[scope.$index][19] }}</h4><h4>{{ planDate[scope.$index][19] }} </h4><h4> {{ realDate[scope.$index][19] }}</h4><h4> {{ worker[scope.$index][19] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[21]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][20]">
<h4>{{ process[scope.$index][20] }}</h4><h4>{{ planDate[scope.$index][20] }} </h4><h4> {{ realDate[scope.$index][20] }}</h4><h4> {{ worker[scope.$index][20] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[22]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][21]">
<h4>{{ process[scope.$index][21] }}</h4><h4>{{ planDate[scope.$index][21] }} </h4><h4> {{ realDate[scope.$index][21] }}</h4><h4> {{ worker[scope.$index][21] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[23]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][22]">
<h4>{{ process[scope.$index][22] }}</h4><h4>{{ planDate[scope.$index][22] }} </h4><h4> {{ realDate[scope.$index][22] }}</h4><h4> {{ worker[scope.$index][22] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[24]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][23]">
<h4>{{ process[scope.$index][23] }}</h4><h4>{{ planDate[scope.$index][23] }} </h4><h4> {{ realDate[scope.$index][23] }}</h4><h4> {{ worker[scope.$index][23] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[25]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][24]">
<h4>{{ process[scope.$index][24] }}</h4><h4>{{ planDate[scope.$index][24] }} </h4><h4> {{ realDate[scope.$index][24] }}</h4><h4> {{ worker[scope.$index][24] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[26]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][25]">
<h4>{{ process[scope.$index][25] }}</h4><h4>{{ planDate[scope.$index][25] }} </h4><h4> {{ realDate[scope.$index][25] }}</h4><h4> {{ worker[scope.$index][25] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[27]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][26]">
<h4>{{ process[scope.$index][26] }}</h4><h4>{{ planDate[scope.$index][26] }} </h4><h4> {{ realDate[scope.$index][26] }}</h4><h4> {{ worker[scope.$index][26] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[28]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][27]">
<h4>{{ process[scope.$index][27] }}</h4><h4>{{ planDate[scope.$index][27] }} </h4><h4> {{ realDate[scope.$index][27] }}</h4><h4> {{ worker[scope.$index][27] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[29]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][28]">
<h4>{{ process[scope.$index][28] }}</h4><h4>{{ planDate[scope.$index][28] }} </h4><h4> {{ realDate[scope.$index][28] }}</h4><h4> {{ worker[scope.$index][28] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[30]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][29]">
<h4>{{ process[scope.$index][29] }}</h4><h4>{{ planDate[scope.$index][29] }} </h4><h4> {{ realDate[scope.$index][29] }}</h4><h4> {{ worker[scope.$index][29] }}</h4>
</div>
</template>
</el-table-column>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
: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 { getNames, getMachines, getGroups, getTable, getTable2, getExport } from '@/api/ManufacturingCenter/ProcessingStatus'
export default {
data() {
return {
startTime: '',
endTime: '',
startTime_check: 0,
endTime_check: 0,
liushuihao: '',
// value2: null,
radioList: '0',
length: 0,
listLoading1: false,
tableData1: [],
project: '',
projects: [],
Machine: '',
Machines: [],
Group: '',
Groups: [],
part: '',
parts: [{
value: 0,
label: '全部零件'
}, {
value: 1,
label: '自家生产'
}, {
value: 2,
label: '外协生产'
}],
Speed: '',
Speeds: [{
value: 5,
label: '全部'
}, {
value: 1,
label: '拖期'
}, {
value: 2,
label: '即将拖期'
}, {
value: 3,
label: '如期'
}, {
value: 4,
label: '工序外协'
}],
number: '',
checkbox_project: false,
checkbox_Machine: false,
checkbox_Group: false,
checkbox_part: false,
checkbox_number: false,
零件图号: [],
零件名称: [],
投产数量: [],
result: [],
process: [[]],
planDate: [[]],
worker: [[]],
colorCode: [[]],
realDate: [[]],
// waixie: [[]],
total: 0, // 总条数
pageSize: 10,
pageCurrent: 1
}
},
created() {
this.getMachine()
this.getTableData()
},
methods: {
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
return v[j]
}))
},
exportExcel() {
if (!this.Machine) {
this.$message.warning('请选择机床')
return
}
getExport(this.Machine).then(res => {
console.log(res.data)
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['机床', '组号', '图号及规格', '制品名称', '计划数', '材料', '当前工序名']
const filterVal = ['机床图号', '组号', '零件图号_零件工艺计划', '零件名称', '批次数量', '材料', '工艺名称']
const list = res.data
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '加工进度表',
autoWidth: true,
bookType: 'xlsx'
})
})
})
},
// 查询供应商名称
fetchData() {
this.projects = []
getNames().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projects.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
this.part = 1
},
getMachine() {
this.Machine = ''
this.Machines = []
this.Group = ''
this.Groups = []
getMachines().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
},
getGroup() {
this.Group = ''
this.Groups = []
getGroups(this.Machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Groups.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
// 按条件查询
getTableData() {
this.listLoading1 = true
this.checkbox_project = false
if (this.Machine === '') {
this.checkbox_Machine = false
} else {
this.checkbox_Machine = true
}
if (this.Group === '') {
this.checkbox_Group = false
} else {
this.checkbox_Group = true
}
if (this.part === '') {
this.checkbox_part = false
} else {
this.checkbox_part = true
}
if (this.number === '') {
this.checkbox_number = false
} else {
this.checkbox_number = true
}
if (this.startTime === '' || this.startTime === null) {
this.startTime_check = 0
} else {
this.startTime_check = 1
}
if (this.endTime === '' || this.endTime === null) {
this.endTime_check = 0
} else {
this.endTime_check = 1
}
this.num111 = []
this.tableData1 = []
this.零件图号 = []
this.零件名称 = []
this.投产数量 = []
this.result = []
this.process = [[]]
this.planDate = [[]]
this.worker = [[]]
this.colorCode = [[]]
this.realDate = [[]]
this.length = 0
getTable(this.checkbox_project, this.project, this.checkbox_Machine, this.Machine, this.checkbox_Group, this.Group, this.checkbox_number, this.number, 1, this.startTime_check, this.startTime, this.endTime_check, this.endTime, this.pageCurrent, this.pageSize).then(response => {
this.length = parseInt(response.data.total)
for (let i = 0; i < response.data.rows.length; i++) { // 声明二维数组
this.num111.push(response.data.rows[i].工艺计划流水号)
this.零件图号.push(response.data.rows[i].零件图号)
this.零件名称.push(response.data.rows[i].零件名称)
this.投产数量.push(response.data.rows[i].投产数量)
this.process[i] = []
this.planDate[i] = []
this.worker[i] = []
this.colorCode[i] = []
this.realDate[i] = []
this.result.push(response.data.rows[i])
}
if (this.零件图号.length !== 0) {
for (let i = 0; i < this.零件图号.length; i++) {
getTable2(this.num111[i]).then(response => {
for (let k = 0; k < response.data.length; k++) {
this.process[i][k] = response.data[k].工艺名称简称
this.planDate[i][k] = response.data[k].计划日期_短
this.realDate[i][k] = response.data[k].完成日期_短
if (response.data[k].工序间是否外协 === 2) {
response.data[k].员工姓名 = '外协'
}
if (response.data[k].员工姓名 === '超级管理员') {
response.data[k].员工姓名 = '无'
}
this.worker[i][k] = response.data[k].员工姓名
if (response.data[k].工序状态 === 5) { // 灰色是已经完成 未入库
this.colorCode[i][k] = 'grey'
} else {
this.colorCode[i][k] = response.data[k].进度颜色
}
if (response.data[k].工序间是否外协 === 2) {
this.colorCode[i][k] = 'lightblue'
}
}
}).then(() => {
this.tableData1.push(this.result[i])
this.listLoading1 = false
this.total = this.length
})
}
} else {
this.tableData1 = []
this.listLoading1 = false
this.total = 0
}
})
},
handleSizeChange(val) {
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getTableData()
}
}
}
</script>
<style scoped>
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
.table h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
.white{
background-color: ghostwhite;
border: 1px solid #1f2d3d;
}
.grey{
background-color: grey;
border: 1px solid #1f2d3d;
}
.red{
background-color: orangered;
border: 1px solid #1f2d3d;
}
.lightblue{
background-color: deepskyblue;
border: 1px solid #1f2d3d;
}
.yellow{
background-color: yellow;
border: 1px solid #1f2d3d;
}
.blank{
background-color: transparent;
border: 0px solid white;
}
.lightgreen{
background-color: lightgreen;
border: 1px solid #1f2d3d;
}
</style>

View File

@@ -0,0 +1,775 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>机床号:</span>
<el-select v-model="Machine" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="机床号" @change="getGroup()">
<el-option
v-for="item in Machines"
: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>
<span>组号:</span>
<el-select v-model="Group" size="small" clearable placeholder="组号">
<el-option
v-for="item in Groups"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件号:</span>
<el-input v-model="number" placeholder="零件号" clearable size="small" style="width: 200px;"/>
<span class="demonstration">计划下达时间:</span>
<el-date-picker
v-model="startTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 10px 0 0 10px" @click="pageCurrent=1;pageSize=10;total = 0;getTableData();">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table
v-loading="listLoading1"
:data="tableData1"
class="table"
border
height="650">
<el-table-column
label="序号"
align="center"
width="50"
type="index"/>
<el-table-column
align="center"
label="零件图号"
width="200px">
<template slot-scope="scope">{{ 零件图号[scope.$index] }}</template>
</el-table-column>
<el-table-column
align="center"
label="零件名称"
width="120px">
<template slot-scope="scope"> {{ 零件名称[scope.$index] }}</template>
</el-table-column>
<el-table-column
align="center"
prop="address"
label="数量">
<template slot-scope="scope">{{ 投产数量[scope.$index] }}</template>
</el-table-column>
<el-table-column label="零件加工计划进度(工艺名称,计划完成时间,实际完成时间,员工名称)" >
<el-table-column label="[1]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][0]" @click="handleChange1(scope.$index, scope.row, 'form', 0)">
<h4>{{ process[scope.$index][0] }}</h4><h4>{{ planDate[scope.$index][0] }} </h4><h4> {{ realDate[scope.$index][0] }}</h4><h4> {{ worker[scope.$index][0] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[2]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][1]" @click="handleChange1(scope.$index, scope.row, 'form', 1)">
<h4>{{ process[scope.$index][1] }}</h4><h4>{{ planDate[scope.$index][1] }} </h4><h4> {{ realDate[scope.$index][1] }}</h4><h4> {{ worker[scope.$index][1] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[3]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][2]" @click="handleChange1(scope.$index, scope.row, 'form', 2)">
<h4>{{ process[scope.$index][2] }}</h4><h4>{{ planDate[scope.$index][2] }} </h4><h4> {{ realDate[scope.$index][2] }}</h4><h4> {{ worker[scope.$index][2] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[4]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][3]" @click="handleChange1(scope.$index, scope.row, 'form', 3)">
<h4>{{ process[scope.$index][3] }}</h4><h4>{{ planDate[scope.$index][3] }} </h4><h4> {{ realDate[scope.$index][3] }}</h4><h4> {{ worker[scope.$index][3] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[5]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][4]" @click="handleChange1(scope.$index, scope.row, 'form', 4)">
<h4>{{ process[scope.$index][4] }}</h4><h4>{{ planDate[scope.$index][4] }} </h4><h4> {{ realDate[scope.$index][4] }}</h4><h4> {{ worker[scope.$index][4] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[6]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][5]" @click="handleChange1(scope.$index, scope.row, 'form', 5)">
<h4>{{ process[scope.$index][5] }}</h4><h4>{{ planDate[scope.$index][5] }} </h4><h4> {{ realDate[scope.$index][5] }}</h4><h4> {{ worker[scope.$index][5] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[7]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][6]" @click="handleChange1(scope.$index, scope.row, 'form', 6)">
<h4>{{ process[scope.$index][6] }}</h4><h4>{{ planDate[scope.$index][6] }} </h4><h4> {{ realDate[scope.$index][6] }}</h4><h4> {{ worker[scope.$index][6] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[8]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][7]" @click="handleChange1(scope.$index, scope.row, 'form', 7)">
<h4>{{ process[scope.$index][7] }}</h4><h4>{{ planDate[scope.$index][7] }} </h4><h4> {{ realDate[scope.$index][7] }}</h4><h4> {{ worker[scope.$index][7] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[9]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][8]" @click="handleChange1(scope.$index, scope.row, 'form', 8)">
<h4>{{ process[scope.$index][8] }}</h4><h4>{{ planDate[scope.$index][8] }} </h4><h4> {{ realDate[scope.$index][8] }}</h4><h4> {{ worker[scope.$index][8] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[10]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][9]" @click="handleChange1(scope.$index, scope.row, 'form', 9)">
<h4>{{ process[scope.$index][9] }}</h4><h4>{{ planDate[scope.$index][9] }} </h4><h4> {{ realDate[scope.$index][9] }}</h4><h4> {{ worker[scope.$index][9] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[11]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][10]" @click="handleChange1(scope.$index, scope.row, 'form', 10)">
<h4>{{ process[scope.$index][10] }}</h4><h4>{{ planDate[scope.$index][10] }} </h4><h4> {{ realDate[scope.$index][10] }}</h4><h4> {{ worker[scope.$index][10] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[12]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][11]" @click="handleChange1(scope.$index, scope.row, 'form', 11)">
<h4>{{ process[scope.$index][11] }}</h4><h4>{{ planDate[scope.$index][11] }} </h4><h4> {{ realDate[scope.$index][11] }}</h4><h4> {{ worker[scope.$index][11] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[13]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][12]" @click="handleChange1(scope.$index, scope.row, 'form', 12)">
<h4>{{ process[scope.$index][12] }}</h4><h4>{{ planDate[scope.$index][12] }} </h4><h4> {{ realDate[scope.$index][12] }}</h4><h4> {{ worker[scope.$index][12] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[14]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][13]" @click="handleChange1(scope.$index, scope.row, 'form', 13)">
<h4>{{ process[scope.$index][13] }}</h4><h4>{{ planDate[scope.$index][13] }} </h4><h4> {{ realDate[scope.$index][13] }}</h4><h4> {{ worker[scope.$index][13] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[15]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][14]" @click="handleChange1(scope.$index, scope.row, 'form', 14)">
<h4>{{ process[scope.$index][14] }}</h4><h4>{{ planDate[scope.$index][14] }} </h4><h4> {{ realDate[scope.$index][14] }}</h4><h4> {{ worker[scope.$index][14] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[16]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][15]" @click="handleChange1(scope.$index, scope.row, 'form', 15)">
<h4>{{ process[scope.$index][15] }}</h4><h4>{{ planDate[scope.$index][15] }} </h4><h4> {{ realDate[scope.$index][15] }}</h4><h4> {{ worker[scope.$index][15] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[17]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][16]" @click="handleChange1(scope.$index, scope.row, 'form', 16)">
<h4>{{ process[scope.$index][16] }}</h4><h4>{{ planDate[scope.$index][16] }} </h4><h4> {{ realDate[scope.$index][16] }}</h4><h4> {{ worker[scope.$index][16] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[18]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][17]" @click="handleChange1(scope.$index, scope.row, 'form', 17)">
<h4>{{ process[scope.$index][17] }}</h4><h4>{{ planDate[scope.$index][17] }} </h4><h4> {{ realDate[scope.$index][17] }}</h4><h4> {{ worker[scope.$index][17] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[19]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][18]" @click="handleChange1(scope.$index, scope.row, 'form', 18)">
<h4>{{ process[scope.$index][18] }}</h4><h4>{{ planDate[scope.$index][18] }} </h4><h4> {{ realDate[scope.$index][18] }}</h4><h4> {{ worker[scope.$index][18] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[20]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][19]" @click="handleChange1(scope.$index, scope.row, 'form', 19)">
<h4>{{ process[scope.$index][19] }}</h4><h4>{{ planDate[scope.$index][19] }} </h4><h4> {{ realDate[scope.$index][19] }}</h4><h4> {{ worker[scope.$index][19] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[21]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][20]" @click="handleChange1(scope.$index, scope.row, 'form', 20)">
<h4>{{ process[scope.$index][20] }}</h4><h4>{{ planDate[scope.$index][20] }} </h4><h4> {{ realDate[scope.$index][20] }}</h4><h4> {{ worker[scope.$index][20] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[22]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][21]" @click="handleChange1(scope.$index, scope.row, 'form', 21)">
<h4>{{ process[scope.$index][21] }}</h4><h4>{{ planDate[scope.$index][21] }} </h4><h4> {{ realDate[scope.$index][21] }}</h4><h4> {{ worker[scope.$index][21] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[23]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][22]" @click="handleChange1(scope.$index, scope.row, 'form', 22)">
<h4>{{ process[scope.$index][22] }}</h4><h4>{{ planDate[scope.$index][22] }} </h4><h4> {{ realDate[scope.$index][22] }}</h4><h4> {{ worker[scope.$index][22] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[24]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][23]" @click="handleChange1(scope.$index, scope.row, 'form', 23)">
<h4>{{ process[scope.$index][23] }}</h4><h4>{{ planDate[scope.$index][23] }} </h4><h4> {{ realDate[scope.$index][23] }}</h4><h4> {{ worker[scope.$index][23] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[25]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][24]" @click="handleChange1(scope.$index, scope.row, 'form', 24)">
<h4>{{ process[scope.$index][24] }}</h4><h4>{{ planDate[scope.$index][24] }} </h4><h4> {{ realDate[scope.$index][24] }}</h4><h4> {{ worker[scope.$index][24] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[26]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][25]" @click="handleChange1(scope.$index, scope.row, 'form', 25)">
<h4>{{ process[scope.$index][25] }}</h4><h4>{{ planDate[scope.$index][25] }} </h4><h4> {{ realDate[scope.$index][25] }}</h4><h4> {{ worker[scope.$index][25] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[27]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][26]" @click="handleChange1(scope.$index, scope.row, 'form', 26)">
<h4>{{ process[scope.$index][26] }}</h4><h4>{{ planDate[scope.$index][26] }} </h4><h4> {{ realDate[scope.$index][26] }}</h4><h4> {{ worker[scope.$index][26] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[28]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][27]" @click="handleChange1(scope.$index, scope.row, 'form', 27)">
<h4>{{ process[scope.$index][27] }}</h4><h4>{{ planDate[scope.$index][27] }} </h4><h4> {{ realDate[scope.$index][27] }}</h4><h4> {{ worker[scope.$index][27] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[29]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][28]" @click="handleChange1(scope.$index, scope.row, 'form', 28)">
<h4>{{ process[scope.$index][28] }}</h4><h4>{{ planDate[scope.$index][28] }} </h4><h4> {{ realDate[scope.$index][28] }}</h4><h4> {{ worker[scope.$index][28] }}</h4>
</div>
</template>
</el-table-column>
<el-table-column label="[30]" align="center" width="120px">
<template slot-scope="scope">
<div :class="colorCode[scope.$index][29]" @click="handleChange1(scope.$index, scope.row, 'form', 29)">
<h4>{{ process[scope.$index][29] }}</h4><h4>{{ planDate[scope.$index][29] }} </h4><h4> {{ realDate[scope.$index][29] }}</h4><h4> {{ worker[scope.$index][29] }}</h4>
</div>
</template>
</el-table-column>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
: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="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
<el-row width="200px">
<el-form-item label="操作员" prop="人员" >
<el-input v-model="form.人员" placeholder="操作员" readonly size="small" style="width: 80%" @focus="dialogTableVisible" />
</el-form-item>
<el-form-item label="考勤编号" prop="考勤编号" >
<el-input v-model="form.考勤编号" placeholder="考勤编号" disabled size="small" style="width: 80%" />
</el-form-item>
<el-form-item label="完成日期" prop="完成时间">
<el-date-picker
v-model="form.完成时间"
style="width: 80%"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
</el-form-item>
</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="dialogFormVisible1" title="人员信息" center width="750px">
<div style="height: 500px">
<div style="float: left;margin-top: 10px;margin-left: 20px;overflow-y: scroll;height: 400px">
<el-tree
:data="data2"
node-key="id"
style="width: 150px;float: left"
height="400"
accordion
@node-click="handleNodeClick"/>
</div>
<el-table :data="List1" highlight-current-row height="400" style="width: 400px;float: left;margin-left: 30px" @row-click="handleCurrentChange2">
<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>
</div>
<el-button style="margin-left: 260px" @click="dialogFormVisible1 = false">取消</el-button>
<el-button type="primary" style="margin-top: 20px" @click="getName">确认</el-button>
</el-dialog>
</div>
</template>
<script>
import { isMachining, handlechange3, getTable8, getTree, fn, dialogtablevisible, getNames, getMachines, getGroups, getTable, getTable2, handlechange, handlechange2 } from '@/api/ManufacturingCenter/ProcessingStatusEdit'
export default {
data() {
return {
num111: [], // 零件图号去掉P后修改
Num2: '',
gongyijihualiushuihao: [[]],
midd: 0,
ssks: '',
cjscgy: '',
List1: [],
data2: [],
dialogFormVisible1: false,
Name: '',
person: '',
title: '',
Num: '',
startTime: '',
endTime: '',
startTime_check: 0,
endTime_check: 0,
form: {
人员: '',
考勤编号: '',
完成时间: ''
},
rules: {
人员: [{ required: true, message: '请选择操作员', trigger: 'change' }],
考勤编号: [{ required: true, message: '考勤编号', trigger: 'change' }],
完成时间: [{ required: true, message: '请选择实际完成时间', trigger: 'change' }]
},
Number1: '',
dialogFormVisible: false,
count1: 0,
liushuihao: '',
radioList: '0',
length: 0,
listLoading1: false,
tableData1: [],
project: '',
projects: [],
Machine: '',
Machines: [],
Group: '',
Groups: [],
Speed: '',
Speeds: [{
value: 5,
label: '全部'
}, {
value: 1,
label: '拖期'
}, {
value: 2,
label: '即将拖期'
}, {
value: 3,
label: '如期'
}, {
value: 4,
label: '工序外协'
}],
number: '',
checkbox_project: false,
checkbox_Machine: false,
checkbox_Group: false,
checkbox_number: false,
零件图号: [],
零件名称: [],
投产数量: [],
result: [],
kaoqinbianhao: [[]],
gongxuliushuihao: [[]],
process: [[]],
planDate: [[]],
worker: [[]],
colorCode: [[]],
realDate: [[]],
total: 0, // 总条数
pageSize: 10,
pageCurrent: 1
}
},
created() {
this.getMachine()
this.fetchData3()
this.getTableData()
},
methods: {
handleCurrentChange2(row) { // 获取当前行人员信息
this.ssks = row.节点名称
this.Number1 = row.考勤编号
this.Name = row.姓名
},
getName() { // 提交人员
this.dialogFormVisible1 = false
this.form.人员 = this.Name
this.form.考勤编号 = this.Number1
},
handleNodeClick(data) { // 树节点点击
this.ssks = data.label
getTable8(data.id).then(response => {
this.List1 = response.data
})
},
fetchData3() {
getTree().then(response => { // 获取人员信息树
const data = response.data
this.data2 = fn(data, 0)
})
},
dialogTableVisible() {
this.dialogFormVisible1 = true
dialogtablevisible()
},
// 查询供应商名称
fetchData() {
this.projects = []
getNames().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projects.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
getMachine() {
this.Machine = ''
this.Machines = []
this.Group = ''
this.Groups = []
getMachines().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
},
getGroup() {
this.Group = ''
this.Groups = []
getGroups(this.Machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Groups.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
// 按条件查询
// CASE WHEN datediff(day , 计划日期 , 完成日期) <= 2 THEN 'lightgreen'
// WHEN datediff(day , 计划日期 , 完成日期) > 2 THEN 'red'
// WHEN datediff(day , 计划日期 , isnull(完成日期 , getdate())) > 1 THEN 'yellow' END
getTableData() {
this.listLoading1 = true
if (this.project === '') {
this.checkbox_project = false
} else {
this.checkbox_project = true
}
if (this.Machine === '') {
this.checkbox_Machine = false
} else {
this.checkbox_Machine = true
}
if (this.Group === '') {
this.checkbox_Group = false
} else {
this.checkbox_Group = true
}
if (this.number === '') {
this.checkbox_number = false
} else {
this.checkbox_number = true
}
if (this.startTime === '' || this.startTime === null) {
this.startTime_check = 0
} else {
this.startTime_check = 1
}
if (this.endTime === '' || this.endTime === null) {
this.endTime_check = 0
} else {
this.endTime_check = 1
}
this.num111 = []
this.tableData1 = []
this.零件图号 = []
this.零件名称 = []
this.投产数量 = []
this.result = []
this.kaoqinbianhao = [[]]
this.gongxuliushuihao = [[]]
this.gongyijihualiushuihao = [[]]
this.process = [[]]
this.planDate = [[]]
this.worker = [[]]
this.colorCode = [[]]
this.realDate = [[]]
this.length = 0
getTable(this.checkbox_project, this.project, this.checkbox_Machine, this.Machine, this.checkbox_Group, this.Group, this.checkbox_number, this.number, this.startTime_check, this.startTime, this.endTime_check, this.endTime, this.pageCurrent, this.pageSize).then(response => {
if (response.data.rows.length === 0) {
this.listLoading1 = false
} else {
this.length = parseInt(response.data.total)
for (let i = 0; i < response.data.rows.length; i++) { // 声明二维数组
this.num111.push(response.data.rows[i].工艺计划流水号)
this.零件图号.push(response.data.rows[i].零件图号)
this.零件名称.push(response.data.rows[i].零件名称)
this.投产数量.push(response.data.rows[i].投产数量)
this.kaoqinbianhao[i] = []
this.gongxuliushuihao[i] = []
this.gongyijihualiushuihao[i] = []
this.process[i] = []
this.planDate[i] = []
this.worker[i] = []
this.colorCode[i] = []
this.realDate[i] = []
this.result.push(response.data.rows[i])
}
if (this.零件图号.length !== 0) {
for (let i = 0; i < this.零件图号.length; i++) {
getTable2(this.num111[i]).then(response => {
for (let k = 0; k < response.data.length; k++) {
this.kaoqinbianhao[i][k] = response.data[k].工作者考勤编号
this.gongxuliushuihao[i][k] = response.data[k].工序流水号
this.gongyijihualiushuihao[i][k] = response.data[k].工艺计划流水号
this.process[i][k] = response.data[k].工艺名称简称
this.planDate[i][k] = response.data[k].计划日期_短
this.worker[i][k] = response.data[k].员工姓名
this.realDate[i][k] = response.data[k].完成日期_短
if (response.data[k].工序状态 === 5) { // 灰色:停产,不允许修改,重新投产
this.colorCode[i][k] = 'grey'
} else {
this.colorCode[i][k] = response.data[k].进度颜色
}
if (response.data[k].工序间是否外协 === 2) {
this.colorCode[i][k] = 'lightblue'
}
}
}).then(() => {
this.tableData1.push(this.result[i])
this.listLoading1 = false
this.total = this.length
})
}
} else {
this.tableData1 = []
this.listLoading1 = false
this.total = 0
}
}
})
},
// 编辑打开
handleChange1(index, row, formName, a) {
if (this.process[index][a] !== '' && this.process[index][a] !== null && this.process[index][a] !== undefined && this.colorCode[index][a] !== 'grey') {
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
this.midd = 0
this.form.完成时间 = ''
this.form.人员 = ''
this.form.考勤编号 = ''
if (this.worker[index][a] !== '超级管理员') {
this.midd = 1
this.form.人员 = this.worker[index][a]
}
if (this.kaoqinbianhao[index][a] !== 0) {
this.form.考勤编号 = this.kaoqinbianhao[index][a]
}
this.title = this.process[index][a]
this.Num = this.gongxuliushuihao[index][a]
this.Num2 = this.gongyijihualiushuihao[index][a]
this.dialogFormVisible = true
}
},
// 编辑确定
handleChange() {
if (this.midd === 0) {
isMachining(this.Num2).then(res => {
if (res.data.output[0].结果 === '0') {
this.$message.error('该零件正在加工,不能手动完成')
} else {
handlechange2(this.Num, this.form.考勤编号).then(response => {
if (response.data[0].result === '1') {
handlechange(this.Num, this.form.完成时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息编辑成功')
} else {
this.$message.error('信息编辑失败')
}
}).then(() => {
this.getTableData()
})
} else {
this.$message.error('信息编辑失败')
}
})
}
})
} else {
isMachining(this.Num2).then(res => {
if (res.data.output[0].结果 === '0') {
this.$message.error('该零件正在加工,不能手动完成')
} else {
handlechange3(this.Num, this.form.考勤编号).then(response => {
if (response.data[0].result === '1') {
handlechange(this.Num, this.form.完成时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息编辑成功')
} else {
this.$message.error('信息编辑失败')
}
}).then(() => {
this.getTableData()
})
} else {
this.$message.error('信息编辑失败')
}
})
}
})
}
this.dialogFormVisible = false
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.handleChange()
} else {
return false
}
})
},
// 重置表单
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
handleSizeChange(val) {
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getTableData()
}
}
}
</script>
<style scoped>
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
.table h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
.white{
background-color: ghostwhite;
border: 1px solid #1f2d3d;
}
.grey{
background-color: grey;
border: 1px solid #1f2d3d;
}
.red{
background-color: orangered;
border: 1px solid #1f2d3d;
}
.lightblue{
background-color: deepskyblue;
border: 1px solid #1f2d3d;
}
.yellow{
background-color: yellow;
border: 1px solid #1f2d3d;
}
.blank{
background-color: transparent;
border: 0px solid white;
}
.lightgreen{
background-color: lightgreen;
border: 1px solid #1f2d3d;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,795 @@
<template>
<div class="app-container bold-font">
<el-card>
<el-row>
<h3 style="display: inline-block;margin: 0">项目名称:</h3>
<el-select v-model="projectValue" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="项目名称" @change="typeChange()">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<h3 style="display: inline-block;margin: 0 0 0 20px">机床名称:</h3>
<el-select v-model="toolNumValue" clearable filterable size="small" style="margin-bottom:10px;width: 220px" placeholder="机床名称">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<h3 style="display: inline-block;margin: 0 0 0 20px">客户名称:</h3>
<el-input v-model="CustomerNameValue" placeholder="客户名称" size="small" clearable style="width:200px"/>
</el-row>
<el-row>
<h3 style="display: inline-block;margin: 0">签订日期:</h3>
<el-date-picker v-model="time_SignStart" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/> ~
<el-date-picker v-model="time_SignFinish" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/>
<h3 style="display: inline-block;margin: 0 0 0 20px">交货期:</h3>
<el-date-picker v-model="time_deliveryStart" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/> ~
<el-date-picker v-model="time_deliveryFinish" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
</el-row>
</el-card>
<el-card>
<h2 style="display: inline-block;margin: 0 0 10px 0">总计划:</h2>
<el-table v-loading="loading" :data="tableData" height="750" highlight-current-row style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column label="项目编号" align="center" width="140px" fixed="left">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.项目编号" size="mini"/>
</template>
<template v-else>
{{ scope.row.项目编号 }}
</template>
</template>
</el-table-column>
<el-table-column label="项目名称" align="center" width="120px" fixed="left">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" width="140px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center" width="280px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center" width="100px">
<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="120px">
<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" width="90px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.机床设计者" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.机床设计者 }}
</template>
</template>
</el-table-column>
<el-table-column label="审图(计划开始)" align="center" width="170px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.审图计划开始时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.审图计划开始时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="审图(计划完成)" align="center" width="170px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.审图计划完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.审图计划完成时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="审图(实际完成)" align="center" width="170px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.审图实际完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.审图实际完成时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="发图(计划)" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.机床设计完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
<el-button class="bold-font" type="text" @click="code = 1;openDialog(scope.row)">{{ scope.row.机床设计完成时间 }}</el-button>
</template>
</template>
</el-table-column>
<el-table-column label="发图(实际)" align="center" width="150px">
<template slot-scope="scope">
<div class="bold-font">{{ scope.row.机床设计实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="采购(计划)" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.采购完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
<el-button class="bold-font" type="text" @click="code = 2;openDialog(scope.row)">{{ scope.row.采购完成时间 }}</el-button>
</template>
</template>
</el-table-column>
<el-table-column label="采购(实际)" align="center" width="150px">
<template slot-scope="scope">
<div class="bold-font">{{ scope.row.采购实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="备料(计划)" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.备料完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
<el-button class="bold-font" type="text" @click="code = 3;openDialog(scope.row)">{{ scope.row.备料完成时间 }}</el-button>
</template>
</template>
</el-table-column>
<el-table-column label="备料(实际)" align="center" width="150px">
<template slot-scope="scope">
<div class="bold-font">{{ scope.row.备料实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="制造(计划)" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.机床生产完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
<el-button class="bold-font" type="text" @click="code = 4;openDialog(scope.row)">{{ scope.row.机床生产完成时间 }}</el-button>
</template>
</template>
</el-table-column>
<el-table-column label="制造(实际)" align="center" width="150px">
<template slot-scope="scope">
<div class="bold-font">{{ scope.row.机床生产实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="装配(计划)" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.机床装配完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
<el-button class="bold-font" type="text" @click="code = 5;openDialog(scope.row)">{{ scope.row.机床装配完成时间 }}</el-button>
</template>
</template>
</el-table-column>
<el-table-column label="装配(实际)" align="center" width="150px">
<template slot-scope="scope">
<div class="bold-font">{{ scope.row.机床装配实际完成时间 }}</div>
</template>
</el-table-column>
<!--<el-table-column label="顺序" align="center" width="100px">-->
<!--<template slot-scope="scope">-->
<!--<template v-if="scope.row.edit">-->
<!--<el-input v-model="scope.row.完成顺序" size="mini"/>-->
<!--</template>-->
<!--<template v-else>-->
<!--{{ scope.row.完成顺序 }}-->
<!--</template>-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column label="更新" align="center" width="90px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.更新" size="mini"/>
</template>
<template v-else>
{{ scope.row.更新 }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-else type="primary" size="small" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 15px;">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<h2 v-if="code===1" style="width: 400px;float:left;display: inline-block;margin: 0 0 10px 0">子计划{{ machineNum }} 发图</h2>
<h2 v-if="code===2" style="width: 400px;float:left;display: inline-block;margin: 0 0 10px 0">子计划{{ machineNum }} 采购</h2>
<h2 v-if="code===3" style="width: 400px;float:left;display: inline-block;margin: 0 0 10px 0">子计划{{ machineNum }} 备料</h2>
<h2 v-if="code===4" style="width: 400px;float:left;display: inline-block;margin: 0 0 10px 0">子计划{{ machineNum }} 制造</h2>
<h2 v-if="code===5" style="width: 400px;float:left;display: inline-block;margin: 0 0 10px 0">子计划{{ machineNum }} 装配</h2>
<el-button size="small" icon="el-icon-circle-plus" type="primary" style="float:left;margin: 7px 0 0 0" @click="addTable()">增加</el-button>
<el-table v-loading="loading2" :data="tableData2" style="margin-top: 10px;width: 100%;" stripe border element-loading-text="拼命加载中">
<el-table-column min-width="100px" label="组号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-select v-model="scope.row.组件流水号" filterable clearable size="small" style="width: 100px" @change="groupChange(scope.row, scope.$index)">
<el-option
v-for="item in groupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.组号 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="200px" label="任务名称" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.任务名称" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务名称 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="100px" label="负责人" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.负责人" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.负责人 }}
</template>
</template>
</el-table-column>
<el-table-column label="接收任务时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.接收任务时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.接收任务时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="任务开始时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.任务开始时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务开始时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.计划完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.计划完成时间 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="100px" label="货期" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.货期" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.货期 }}
</template>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit && !scope.row.组件流水号">
<el-date-picker v-model="scope.row.实际完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.实际完成时间 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="300px" label="备注" align="center" width="240px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.备注" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.备注 }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="180px" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" @click="confirmEdit2(scope.row)">确定</el-button>
<el-button v-else type="primary" size="small" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
<el-button v-else type="danger" size="small" @click="Delete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { getProject, getCustomerName, getToolNum, searchtable, editTable, searchTable2, editTable2, Delete, addTable, searchgroup, searchgroupName } from '@/api/ManufacturingCenter/ProjectPlanningManagement'
export default {
data() {
return {
machineNum: '',
jichuang: '',
title: '',
tableData2: [],
loading2: false,
code: '',
time_SignStart: '', // 签订开始
time_SignFinish: '', // 签订结束
time_deliveryStart: '', // 交货开始
time_deliveryFinish: '', // 交货结束
projectValue: '',
project: [], // 项目名称
CustomerNameValue: '',
CustomerName: [], // 客户名称
toolNumValue: '',
toolNum: [], // 机床
groupNum: [],
loading: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1 // 后台获取页
}
},
created() {
this.fetchData()
this.getCustomerName()
this.searchTable()
},
methods: {
fetchData() {
this.projectValue = ''
this.project = []
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.project.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
getToolNum(1, this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
searchgroupName(row.组件流水号).then(response => {
console.log(response.data)
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
},
getCustomerName() {
this.CustomerNameValue = ''
this.CustomerName = []
getCustomerName().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.CustomerName.push({
label: response.data[i].客户名称,
value: response.data[i].客户流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.tableData2 = []
this.jichuang = ''
this.code = ''
if (this.projectValue !== '' && this.projectValue !== null) { this.projectValuecheck = 1 } else { this.projectValuecheck = 0 }
if (this.CustomerNameValue !== '' && this.CustomerNameValue !== null) { this.CustomerNameValuecheck = 1 } else { this.CustomerNameValuecheck = 0 }
if (this.toolNumValue !== '' && this.toolNumValue !== null) { this.toolNumValuecheck = 1 } else { this.toolNumValuecheck = 0 }
if (this.time_SignStart !== '' && this.time_SignStart !== null && this.time_SignFinish !== '' && this.time_SignFinish) { this.time_Signcheck = 1 } else { this.time_Signcheck = 0 }
if (this.time_deliveryStart !== '' && this.time_deliveryStart !== null && this.time_deliveryFinish !== '' && this.time_deliveryFinish) { this.time_deliverycheck = 1 } else { this.time_deliverycheck = 0 }
searchtable(this.projectValuecheck, this.projectValue, this.toolNumValuecheck, this.toolNumValue, this.CustomerNameValuecheck, this.CustomerNameValue, this.time_Signcheck, this.time_SignStart, this.time_SignFinish, this.time_deliverycheck, this.time_deliveryStart, this.time_deliveryFinish, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].合同签订日期 !== '' && response.data.rows[i].合同签订日期 !== null) {
response.data.rows[i].合同签订日期 = response.data.rows[i].合同签订日期.split(' ')[0]
}
if (response.data.rows[i].发货节点 !== '' && response.data.rows[i].发货节点 !== null) {
response.data.rows[i].发货节点 = response.data.rows[i].发货节点.split(' ')[0]
}
if (response.data.rows[i].设备预验收节点 !== '' && response.data.rows[i].设备预验收节点 !== null) {
response.data.rows[i].设备预验收节点 = response.data.rows[i].设备预验收节点.split(' ')[0]
}
if (response.data.rows[i].安装调试节点 !== '' && response.data.rows[i].安装调试节点 !== null) {
response.data.rows[i].安装调试节点 = response.data.rows[i].安装调试节点.split(' ')[0]
}
if (response.data.rows[i].机床设计完成时间 !== '' && response.data.rows[i].机床设计完成时间 !== null) {
response.data.rows[i].机床设计完成时间 = response.data.rows[i].机床设计完成时间.split(' ')[0]
}
if (response.data.rows[i].采购完成时间 !== '' && response.data.rows[i].采购完成时间 !== null) {
response.data.rows[i].采购完成时间 = response.data.rows[i].采购完成时间.split(' ')[0]
}
if (response.data.rows[i].备料完成时间 !== '' && response.data.rows[i].备料完成时间 !== null) {
response.data.rows[i].备料完成时间 = response.data.rows[i].备料完成时间.split(' ')[0]
}
if (response.data.rows[i].机床生产完成时间 !== '' && response.data.rows[i].机床生产完成时间 !== null) {
response.data.rows[i].机床生产完成时间 = response.data.rows[i].机床生产完成时间.split(' ')[0]
}
if (response.data.rows[i].机床装配完成时间 !== '' && response.data.rows[i].机床装配完成时间 !== null) {
response.data.rows[i].机床装配完成时间 = response.data.rows[i].机床装配完成时间.split(' ')[0]
}
if (response.data.rows[i].机床设计实际完成时间 !== '' && response.data.rows[i].机床设计实际完成时间 !== null) {
response.data.rows[i].机床设计实际完成时间 = response.data.rows[i].机床设计实际完成时间.split(' ')[0]
}
if (response.data.rows[i].采购实际完成时间 !== '' && response.data.rows[i].采购实际完成时间 !== null) {
response.data.rows[i].采购实际完成时间 = response.data.rows[i].采购实际完成时间.split(' ')[0]
}
if (response.data.rows[i].备料实际完成时间 !== '' && response.data.rows[i].备料实际完成时间 !== null) {
response.data.rows[i].备料实际完成时间 = response.data.rows[i].备料实际完成时间.split(' ')[0]
}
if (response.data.rows[i].机床生产实际完成时间 !== '' && response.data.rows[i].机床生产实际完成时间 !== null) {
response.data.rows[i].机床生产实际完成时间 = response.data.rows[i].机床生产实际完成时间.split(' ')[0]
}
if (response.data.rows[i].机床装配实际完成时间 !== '' && response.data.rows[i].机床装配实际完成时间 !== null) {
response.data.rows[i].机床装配实际完成时间 = response.data.rows[i].机床装配实际完成时间.split(' ')[0]
}
if (response.data.rows[i].审图计划开始时间 !== '' && response.data.rows[i].审图计划开始时间 !== null) {
response.data.rows[i].审图计划开始时间 = response.data.rows[i].审图计划开始时间.split(' ')[0]
}
if (response.data.rows[i].审图计划完成时间 !== '' && response.data.rows[i].审图计划完成时间 !== null) {
response.data.rows[i].审图计划完成时间 = response.data.rows[i].审图计划完成时间.split(' ')[0]
}
if (response.data.rows[i].审图实际完成时间 !== '' && response.data.rows[i].审图实际完成时间 !== null) {
response.data.rows[i].审图实际完成时间 = response.data.rows[i].审图实际完成时间.split(' ')[0]
}
this.tableData.push({
edit: false,
项目编号: response.data.rows[i].项目编号,
项目名称: response.data.rows[i].项目名称,
机床图号: response.data.rows[i].机床图号,
机床名称: response.data.rows[i].机床名称,
机床数量: response.data.rows[i].机床数量,
合同签订日期: response.data.rows[i].合同签订日期,
发货节点: response.data.rows[i].发货节点,
设备预验收节点: response.data.rows[i].设备预验收节点,
安装调试节点: response.data.rows[i].安装调试节点,
客户名称: response.data.rows[i].客户名称,
机床设计者: response.data.rows[i].机床设计者,
机床设计完成时间: response.data.rows[i].机床设计完成时间,
采购完成时间: response.data.rows[i].采购完成时间,
备料完成时间: response.data.rows[i].备料完成时间,
机床生产完成时间: response.data.rows[i].机床生产完成时间,
机床装配完成时间: response.data.rows[i].机床装配完成时间,
机床设计实际完成时间: response.data.rows[i].机床设计实际完成时间,
采购实际完成时间: response.data.rows[i].采购实际完成时间,
备料实际完成时间: response.data.rows[i].备料实际完成时间,
机床生产实际完成时间: response.data.rows[i].机床生产实际完成时间,
机床装配实际完成时间: response.data.rows[i].机床装配实际完成时间,
审图计划开始时间: response.data.rows[i].审图计划开始时间,
审图计划完成时间: response.data.rows[i].审图计划完成时间,
审图实际完成时间: response.data.rows[i].审图实际完成时间,
完成顺序: response.data.rows[i].完成顺序,
更新: response.data.rows[i].更新,
项目流水号: response.data.rows[i].项目流水号,
机床流水号: response.data.rows[i].机床流水号
})
}
this.total = response.data.total
}
}).then(() => {
this.loading = false
})
},
// 表格1保存
confirmEdit(row) {
editTable(row.项目流水号, row.机床流水号, row.项目编号, row.机床设计者, row.审图计划开始时间, row.审图计划完成时间, row.审图实际完成时间, row.机床设计完成时间, row.采购完成时间, row.备料完成时间, row.机床生产完成时间, row.机床装配完成时间, row.完成顺序, row.更新).then(response => {
if (response.data[0].result === '1') {
row.edit = false
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.searchTable()
} else {
this.$message.error('信息修改失败')
}
})
},
// 查询表格2数据
openDialog(row) {
this.machineNum = row.机床图号
this.loading2 = true
this.tableData2 = []
if (this.code === 1) {
this.title = '发图'
} else if (this.code === 2) {
this.title = '采购'
} else if (this.code === 3) {
this.title = '备料'
} else if (this.code === 4) {
this.title = '制造'
} else if (this.code === 5) {
this.title = '装配'
}
this.groupNum = []
searchgroup(row.机床流水号).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
searchTable2(row.机床流水号, this.code).then(response => {
this.jichuang = row.机床流水号
if (response.data.length === 0) {
this.loading2 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
this.tableData2.push({
edit: false,
组件计划流水号: response.data[i].组件计划流水号,
机床流水号: response.data[i].机床流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
负责人: response.data[i].负责人,
接收任务时间: response.data[i].接收任务时间,
任务开始时间: response.data[i].任务开始时间,
计划完成时间: response.data[i].计划完成时间,
货期: response.data[i].货期,
实际完成时间: response.data[i].实际完成时间,
备注: response.data[i].备注
})
}
}
}).then(() => {
this.loading2 = false
})
},
searchTable2() {
this.loading2 = true
this.tableData2 = []
if (this.code === 1) {
this.title = '发图'
} else if (this.code === 2) {
this.title = '采购'
} else if (this.code === 3) {
this.title = '备料'
} else if (this.code === 4) {
this.title = '制造'
} else if (this.code === 5) {
this.title = '装配'
}
searchTable2(this.jichuang, this.code).then(response => {
if (response.data.length === 0) {
this.loading2 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
this.tableData2.push({
edit: false,
组件计划流水号: response.data[i].组件计划流水号,
机床流水号: response.data[i].机床流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
负责人: response.data[i].负责人,
接收任务时间: response.data[i].接收任务时间,
任务开始时间: response.data[i].任务开始时间,
计划完成时间: response.data[i].计划完成时间,
货期: response.data[i].货期,
实际完成时间: response.data[i].实际完成时间,
备注: response.data[i].备注
})
}
}
}).then(() => {
this.loading2 = false
})
},
// 表格2保存
confirmEdit2(row) {
editTable2(row.组件计划流水号, row.组件流水号, row.任务名称, row.负责人, row.接收任务时间, row.任务开始时间, row.计划完成时间, row.货期, row.实际完成时间, row.备注).then(response => {
if (response.data[0].result === '1') {
row.edit = false
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.searchTable2()
} else {
this.$message.error('信息修改失败')
}
})
},
// 表格2删除
Delete(row) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
Delete(row.组件计划流水号).then(response => {
if (response.data[0].result === '1') {
row.edit = false
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.searchTable2()
} else {
this.$message.error('信息修改失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 表格2增加
addTable() {
if (this.jichuang === '') {
this.$message.error('请先选择一个类别')
} else {
addTable(this.jichuang, this.code).then(response => {
if (response.data[0].result === '1') {
this.$message({
type: 'success',
message: '添加成功!'
})
this.searchTable2()
} else {
this.$message.error('添加失败')
}
})
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.el-card {
border-color: rgb(0, 12, 57);
color: white;
margin-bottom: 5px;
background-color: rgb(0, 12, 57);
}
span{
margin: 10px 0 10px 10px;
}
.el-pagination{
background-color: white;
}
</style>
<style>
.bold-font .el-table{
font: bold 18px arial!important;
margin: 0 0 10px 0;
color: white;
}
.bold-font .el-table td{
background-color: rgb(0, 12, 57)!important;
}
.bold-font .el-table th{
color: white;
background-color: rgb(0, 12, 57)!important;
}
.bold-font .el-table div{
color: white;
background-color: rgb(0, 12, 57)!important;
}
.bold-font{
color: ghostwhite;
font: bold 22px arial!important;
padding: 5px;
}
</style>

View File

@@ -0,0 +1,980 @@
<template>
<div class="app-container bold-font">
<el-card>
<div slot="header">
<el-row>
<h3 style="display: inline-block;margin: 0">项目名称:</h3>
<el-select v-model="projectValue" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="项目名称" @change="typeChange()">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<h3 style="display: inline-block;margin: 0 0 0 20px">机床名称:</h3>
<el-select v-model="machineValue" clearable filterable size="small" style="margin-bottom:10px;width: 220px" placeholder="机床名称">
<el-option
v-for="item in machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<h3 style="display: inline-block;margin: 0 0 0 20px">客户名称:</h3>
<el-input v-model="CustomerNameValue" placeholder="客户名称" size="small" clearable style="width:200px"/>
</el-row>
<el-row>
<h3 style="display: inline-block;margin: 0">签订日期:</h3>
<el-date-picker v-model="time_SignStart" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/> ~
<el-date-picker v-model="time_SignFinish" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/>
<h3 style="display: inline-block;margin: 0 0 0 20px">交货期:</h3>
<el-date-picker v-model="time_deliveryStart" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/> ~
<el-date-picker v-model="time_deliveryFinish" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/>
<span>提前</span>
<el-input-number v-model="warningValue" :min="1" controls-position="right" size="small" style="width: 90px"/>
<span>天预警</span>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize=10; pageCurrent=1;searchTable1()">查询</el-button>
</el-row>
</div>
<h1 class="word" style="margin: 0">总计划:</h1>
<el-table v-loading="loading" :data="tableData10" height="550" highlight-current-row style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable">
<el-table-column label="项目编号" align="center" width="140px" fixed="left">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.项目编号" size="mini"/>
</template>
<template v-else>
{{ scope.row.项目编号 }}
</template>
</template>
</el-table-column>
<el-table-column label="项目名称" align="center" width="120px" fixed="left">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" width="140px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center" width="280px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center" width="100px">
<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="120px">
<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" width="90px">
<template slot-scope="scope">
<div>{{ scope.row.机床设计者 }}</div>
</template>
</el-table-column>
<el-table-column label="审图(计划开始)" align="center" width="170px">
<template slot-scope="scope">
<div>{{ scope.row.审图计划开始时间 }}</div>
</template>
</el-table-column>
<el-table-column label="审图(计划完成)" align="center" width="170px">
<template slot-scope="scope">
<div>{{ scope.row.审图计划完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="审图(实际完成)" align="center" width="170px">
<template slot-scope="scope">
<div>{{ scope.row.审图实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="发图(计划)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.机床设计完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="发图(实际)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.机床设计实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="采购(计划)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.采购完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="采购(实际)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.采购实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="备料(计划)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.备料完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="备料(实际)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.备料实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="制造(计划)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.机床生产完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="制造(实际)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.机床生产实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="装配(计划)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.机床装配完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="装配(实际)" align="center" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.机床装配实际完成时间 }}</div>
</template>
</el-table-column>
<el-table-column label="更新" align="center" width="90px">
<template slot-scope="scope">
<div>{{ scope.row.更新 }}</div>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
<sticky :z-index="10" style="height: 180px">
<div>
<h1 class="word" style="margin: 0">当前总计划</h1>
<el-table v-loading="loading" :data="tableData" height="120px" border element-loading-text="拼命加载中">
<el-table-column label="项目名称" align="center" min-width="120px" fixed="left">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床型号" align="center" min-width="120px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center" min-width="220px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="开始时间" align="center" min-width="130px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.合同签订日期)">{{ scope.row.合同签订日期 === '1900-01-01' ? '' : scope.row.合同签订日期 }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" min-width="130px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.发货节点)">{{ scope.row.发货节点 === '1900-01-01' ? '' : scope.row.发货节点 }}</span>
</template>
</el-table-column>
<el-table-column label="设备预验节点" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.设备预验收节点 === '1900-01-01 00:00:00' ? '' : (scope.row.设备预验收节点 ? scope.row.设备预验收节点.split(' ')[0] : '') }}
</template>
</el-table-column>
<el-table-column label="安装调试节点" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.安装调试节点 === '1900-01-01 00:00:00' ? '' : (scope.row.安装调试节点 ? scope.row.安装调试节点.split(' ')[0] : '') }}
</template>
</el-table-column>
<el-table-column label="审图(计划开始)" align="center" min-width="170px">
<template slot-scope="scope">
{{ scope.row.审图计划开始时间 === '1900-01-01' ? '' : scope.row.审图计划开始时间 }}
</template>
</el-table-column>
<el-table-column label="审图(计划完成)" align="center" min-width="170px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.审图计划完成时间, scope.row.审图实际完成时间)">{{ scope.row.审图计划完成时间 === '1900-01-01' ? '' : scope.row.审图计划完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="审图(实际完成)" align="center" min-width="170px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.审图计划完成时间, scope.row.审图实际完成时间)">{{ scope.row.审图实际完成时间 === '1900-01-01' ? '' : scope.row.审图实际完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="发图" align="center" min-width="140px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.机床设计完成时间, scope.row.机床设计实际完成时间)">{{ scope.row.机床设计完成时间 === '1900-01-01 00:00:00' ? '' : (scope.row.机床设计完成时间 ? scope.row.机床设计完成时间.split(' ')[0] : '') }}</span>
</template>
</el-table-column>
<el-table-column label="发图(实际)" align="center" width="140px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.机床设计完成时间, scope.row.机床设计实际完成时间)">{{ scope.row.机床设计实际完成时间 === '1900-01-01' ? '' : scope.row.机床设计实际完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="采购" align="center" min-width="140px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.采购完成时间, scope.row.采购实际完成时间)">{{ scope.row.采购完成时间 === '1900-01-01 00:00:00' ? '' : (scope.row.采购完成时间 ? scope.row.采购完成时间.split(' ')[0] : '') }}</span>
</template>
</el-table-column>
<el-table-column label="采购(实际)" align="center" width="140px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.采购完成时间, scope.row.采购实际完成时间)">{{ scope.row.采购实际完成时间 === '1900-01-01' ? '' : scope.row.采购实际完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="备料" align="center" min-width="140px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.备料完成时间, scope.row.备料实际完成时间)">{{ scope.row.备料完成时间 === '1900-01-01 00:00:00' ? '' : (scope.row.备料完成时间 ? scope.row.备料完成时间.split(' ')[0] : '') }}</span>
</template>
</el-table-column>
<el-table-column label="备料(实际)" align="center" width="140px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.备料完成时间, scope.row.备料实际完成时间)">{{ scope.row.备料实际完成时间 === '1900-01-01' ? '' : scope.row.备料实际完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="制造" align="center" min-width="140px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.机床生产完成时间, scope.row.机床生产实际完成时间)">{{ scope.row.机床生产完成时间 === '1900-01-01 00:00:00' ? '' : (scope.row.机床生产完成时间 ? scope.row.机床生产完成时间.split(' ')[0] : '') }}</span>
</template>
</el-table-column>
<el-table-column label="制造(实际)" align="center" width="140px">
<template slot-scope="scope">
<span :class=" colorActual(scope.row.机床生产完成时间, scope.row.机床生产实际完成时间)">{{ scope.row.机床生产实际完成时间 === '1900-01-01' ? '' : scope.row.机床生产实际完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="装配" align="center" min-width="140px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.机床装配完成时间, scope.row.机床装配实际完成时间)">{{ scope.row.机床装配完成时间 === '1900-01-01 00:00:00' ? '' : (scope.row.机床装配完成时间 ? scope.row.机床装配完成时间.split(' ')[0] : '') }}</span>
</template>
</el-table-column>
<el-table-column label="装配(实际)" align="center" width="140px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.机床装配完成时间, scope.row.机床装配实际完成时间)">{{ scope.row.机床装配实际完成时间 === '1900-01-01' ? '' : scope.row.机床装配实际完成时间 }}</span>
</template>
</el-table-column>
</el-table>
</div>
</sticky>
<sticky :z-index="10" :sticky-top="180">
<h1 class="word">设计</h1>
</sticky>
<el-table v-loading="loading1" :data="tableData1" highlight-current-row style="width: 100%;" stripe border element-loading-text="拼命加载中">
<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" min-width="150px">
<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" min-width="100px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.计划完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.实际完成时间 }}</span>
</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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
<sticky :z-index="11" :sticky-top="180">
<h1 class="word">采购</h1>
</sticky>
<el-table v-loading="loading1" :data="tableData2" highlight-current-row style="width: 100%;" stripe border element-loading-text="拼命加载中">
<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" min-width="150px">
<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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.实际开始时间 }}
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.计划完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.实际完成时间 }}</span>
</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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
<sticky :z-index="12" :sticky-top="180">
<h1 class="word">备料</h1>
</sticky>
<el-table v-loading="loading1" :data="tableData3" highlight-current-row style="width: 100%;" stripe border element-loading-text="拼命加载中">
<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" min-width="150px">
<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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.实际开始时间 }}
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.计划完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.实际完成时间 }}</span>
</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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
<sticky :z-index="13" :sticky-top="180">
<h1 class="word">制造</h1>
</sticky>
<el-table v-loading="loading1" :data="tableData4" highlight-current-row style="width: 100%;" stripe border element-loading-text="拼命加载中">
<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" min-width="150px">
<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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.实际开始时间 }}
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.计划完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.实际完成时间 }}</span>
</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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
<sticky :z-index="14" :sticky-top="180">
<h1 class="word">装配调试</h1>
</sticky>
<el-table v-loading="loading1" :data="tableData5" highlight-current-row style="width: 100%;" stripe border element-loading-text="拼命加载中">
<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" min-width="150px">
<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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.下阶段开始时间 }}
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorJudge(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.计划完成时间 }}</span>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" min-width="100px">
<template slot-scope="scope">
<span :class="colorActual(scope.row.计划完成时间, scope.row.实际完成时间)">{{ scope.row.实际完成时间 }}</span>
</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" min-width="100px">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { initProject, initMachine, searchtable, searchtable2, searchtable5 } from '@/api/ManufacturingCenter/ProjectPlanningQuery'
import Sticky from '@/components/Sticky'
export default {
components: { Sticky },
data() {
return {
projectValue: '',
projectValue1: '',
project: [],
machineValue: '',
machineValue1: '',
machine: [],
time_SignStart: '', // 签订开始
time_SignFinish: '', // 签订结束
time_deliveryStart: '', // 交货开始
time_deliveryFinish: '', // 交货结束
CustomerNameValue: '',
CustomerName: [], // 客户名称
loading: false,
loading1: false,
pageSize: 10,
pageCurrent: 1,
now: '',
arrival: [],
judge: [],
arrival1: [],
judge1: [],
arrival2: [],
judge2: [],
arrival3: [],
judge3: [],
arrival4: [],
judge4: [],
warningValue: '',
tableData10: [], // 表格数据
tableData: [], // 表格数据
tableData1: [], // 表格数据
tableData2: [], // 表格数据
tableData3: [], // 表格数据
tableData4: [], // 表格数据
tableData5: [] // 表格数据
}
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
colorJudge(time1, time2) {
if (time2 === null) {
if ((new Date(time1) - this.now) > 0 && (new Date(time1) - this.now) < (86400000 * this.warningValue)) {
return 'orange'
} else if ((new Date(time1) - this.now) < 0) {
return 'red'
} else {
return 'black'
}
} else {
return ''
}
},
colorActual(time1, time2) {
if ((new Date(time1) - new Date(time2)) > 0) {
return 'green'
} else if ((new Date(time1) - this.now) < 0) {
return 'red'
} else {
return 'black'
}
},
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
typeChange() {
this.machineValue = ''
this.machine = []
initMachine(this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machine.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
// 查询表格数据
searchTable1() {
this.loading = true
this.tableData10 = []
if (this.projectValue !== '' && this.projectValue !== null) { this.projectValuecheck = 1 } else { this.projectValuecheck = 0 }
if (this.CustomerNameValue !== '' && this.CustomerNameValue !== null) { this.CustomerNameValuecheck = 1 } else { this.CustomerNameValuecheck = 0 }
if (this.machineValue !== '' && this.machineValue !== null) { this.machineValuecheck = 1 } else { this.machineValuecheck = 0 }
if (this.time_SignStart !== '' && this.time_SignStart !== null && this.time_SignFinish !== '' && this.time_SignFinish) { this.time_Signcheck = 1 } else { this.time_Signcheck = 0 }
if (this.time_deliveryStart !== '' && this.time_deliveryStart !== null && this.time_deliveryFinish !== '' && this.time_deliveryFinish) { this.time_deliverycheck = 1 } else { this.time_deliverycheck = 0 }
searchtable5(this.projectValuecheck, this.projectValue, this.machineValuecheck, this.machineValue, this.CustomerNameValuecheck, this.CustomerNameValue, this.time_Signcheck, this.time_SignStart, this.time_SignFinish, this.time_deliverycheck, this.time_deliveryStart, this.time_deliveryFinish, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].合同签订日期 !== '' && response.data.rows[i].合同签订日期 !== null) {
response.data.rows[i].合同签订日期 = response.data.rows[i].合同签订日期.split(' ')[0]
}
if (response.data.rows[i].发货节点 !== '' && response.data.rows[i].发货节点 !== null) {
response.data.rows[i].发货节点 = response.data.rows[i].发货节点.split(' ')[0]
}
if (response.data.rows[i].设备预验收节点 !== '' && response.data.rows[i].设备预验收节点 !== null) {
response.data.rows[i].设备预验收节点 = response.data.rows[i].设备预验收节点.split(' ')[0]
}
if (response.data.rows[i].安装调试节点 !== '' && response.data.rows[i].安装调试节点 !== null) {
response.data.rows[i].安装调试节点 = response.data.rows[i].安装调试节点.split(' ')[0]
}
if (response.data.rows[i].机床设计完成时间 !== '' && response.data.rows[i].机床设计完成时间 !== null) {
response.data.rows[i].机床设计完成时间 = response.data.rows[i].机床设计完成时间.split(' ')[0]
}
if (response.data.rows[i].采购完成时间 !== '' && response.data.rows[i].采购完成时间 !== null) {
response.data.rows[i].采购完成时间 = response.data.rows[i].采购完成时间.split(' ')[0]
}
if (response.data.rows[i].备料完成时间 !== '' && response.data.rows[i].备料完成时间 !== null) {
response.data.rows[i].备料完成时间 = response.data.rows[i].备料完成时间.split(' ')[0]
}
if (response.data.rows[i].机床生产完成时间 !== '' && response.data.rows[i].机床生产完成时间 !== null) {
response.data.rows[i].机床生产完成时间 = response.data.rows[i].机床生产完成时间.split(' ')[0]
}
if (response.data.rows[i].机床装配完成时间 !== '' && response.data.rows[i].机床装配完成时间 !== null) {
response.data.rows[i].机床装配完成时间 = response.data.rows[i].机床装配完成时间.split(' ')[0]
}
if (response.data.rows[i].机床设计实际完成时间 !== '' && response.data.rows[i].机床设计实际完成时间 !== null) {
response.data.rows[i].机床设计实际完成时间 = response.data.rows[i].机床设计实际完成时间.split(' ')[0]
}
if (response.data.rows[i].采购实际完成时间 !== '' && response.data.rows[i].采购实际完成时间 !== null) {
response.data.rows[i].采购实际完成时间 = response.data.rows[i].采购实际完成时间.split(' ')[0]
}
if (response.data.rows[i].备料实际完成时间 !== '' && response.data.rows[i].备料实际完成时间 !== null) {
response.data.rows[i].备料实际完成时间 = response.data.rows[i].备料实际完成时间.split(' ')[0]
}
if (response.data.rows[i].机床生产实际完成时间 !== '' && response.data.rows[i].机床生产实际完成时间 !== null) {
response.data.rows[i].机床生产实际完成时间 = response.data.rows[i].机床生产实际完成时间.split(' ')[0]
}
if (response.data.rows[i].机床装配实际完成时间 !== '' && response.data.rows[i].机床装配实际完成时间 !== null) {
response.data.rows[i].机床装配实际完成时间 = response.data.rows[i].机床装配实际完成时间.split(' ')[0]
}
if (response.data.rows[i].审图计划开始时间 !== '' && response.data.rows[i].审图计划开始时间 !== null) {
response.data.rows[i].审图计划开始时间 = response.data.rows[i].审图计划开始时间.split(' ')[0]
}
if (response.data.rows[i].审图计划完成时间 !== '' && response.data.rows[i].审图计划完成时间 !== null) {
response.data.rows[i].审图计划完成时间 = response.data.rows[i].审图计划完成时间.split(' ')[0]
}
if (response.data.rows[i].审图实际完成时间 !== '' && response.data.rows[i].审图实际完成时间 !== null) {
response.data.rows[i].审图实际完成时间 = response.data.rows[i].审图实际完成时间.split(' ')[0]
}
this.tableData10.push({
项目编号: response.data.rows[i].项目编号,
项目名称: response.data.rows[i].项目名称,
机床图号: response.data.rows[i].机床图号,
机床名称: response.data.rows[i].机床名称,
机床数量: response.data.rows[i].机床数量,
合同签订日期: response.data.rows[i].合同签订日期,
发货节点: response.data.rows[i].发货节点,
设备预验收节点: response.data.rows[i].设备预验收节点,
安装调试节点: response.data.rows[i].安装调试节点,
客户名称: response.data.rows[i].客户名称,
机床设计者: response.data.rows[i].机床设计者,
机床设计完成时间: response.data.rows[i].机床设计完成时间,
采购完成时间: response.data.rows[i].采购完成时间,
备料完成时间: response.data.rows[i].备料完成时间,
机床生产完成时间: response.data.rows[i].机床生产完成时间,
机床装配完成时间: response.data.rows[i].机床装配完成时间,
机床设计实际完成时间: response.data.rows[i].机床设计实际完成时间,
采购实际完成时间: response.data.rows[i].采购实际完成时间,
备料实际完成时间: response.data.rows[i].备料实际完成时间,
机床生产实际完成时间: response.data.rows[i].机床生产实际完成时间,
机床装配实际完成时间: response.data.rows[i].机床装配实际完成时间,
审图计划开始时间: response.data.rows[i].审图计划开始时间,
审图计划完成时间: response.data.rows[i].审图计划完成时间,
审图实际完成时间: response.data.rows[i].审图实际完成时间,
完成顺序: response.data.rows[i].完成顺序,
更新: response.data.rows[i].更新,
项目流水号: response.data.rows[i].项目流水号,
机床流水号: response.data.rows[i].机床流水号
})
}
this.total = response.data.total
}
}).then(() => {
this.loading = false
})
},
// 查询表格数据
searchTable(row) {
this.projectValue1 = row.项目流水号
this.machineValue1 = row.机床流水号
if (this.projectValue1 !== '') {
if (this.machineValue1 !== '') {
this.loading = true
this.tableData = []
this.tableData1 = []
this.tableData2 = []
this.tableData3 = []
this.tableData4 = []
this.tableData5 = []
this.now = new Date()
searchtable(this.projectValue1, this.machineValue1).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].合同签订日期 !== '' && response.data[i].合同签订日期 !== null) {
response.data[i].合同签订日期 = response.data[i].合同签订日期.split(' ')[0]
}
if (response.data[i].发货节点 !== '' && response.data[i].发货节点 !== null) {
response.data[i].发货节点 = response.data[i].发货节点.split(' ')[0]
}
console.log(response.data[i].设备预验收节点, 11111)
// if (response.data[i].设备预验收节点 !== '' && response.data[i].设备预验收节点 !== null) {
// response.data[i].设备预验收节点 = response.data[i].设备预验收节点.split(' ')[0]
// }
// if (response.data[i].安装调试节点 !== '' && response.data[i].安装调试节点 !== null) {
// response.data[i].安装调试节点 = response.data[i].安装调试节点.split(' ')[0]
// }
if (response.data[i].审图计划开始时间 !== '' && response.data[i].审图计划开始时间 !== null) {
response.data[i].审图计划开始时间 = response.data[i].审图计划开始时间.split(' ')[0]
}
if (response.data[i].审图计划完成时间 !== '' && response.data[i].审图计划完成时间 !== null) {
response.data[i].审图计划完成时间 = response.data[i].审图计划完成时间.split(' ')[0]
}
if (response.data[i].审图实际完成时间 !== '' && response.data[i].审图实际完成时间 !== null) {
response.data[i].审图实际完成时间 = response.data[i].审图实际完成时间.split(' ')[0]
}
// if (response.data[i].机床设计完成时间 !== '' && response.data[i].机床设计完成时间 !== null) {
// response.data[i].机床设计完成时间 = response.data[i].机床设计完成时间.split(' ')[0]
// }
if (response.data[i].机床设计实际完成时间 !== '' && response.data[i].机床设计实际完成时间 !== null) {
response.data[i].机床设计实际完成时间 = response.data[i].机床设计实际完成时间.split(' ')[0]
}
// if (response.data[i].采购完成时间 !== '' && response.data[i].采购完成时间 !== null) {
// response.data[i].采购完成时间 = response.data[i].采购完成时间.split(' ')[0]
// }
if (response.data[i].采购实际完成时间 !== '' && response.data[i].采购实际完成时间 !== null) {
response.data[i].采购实际完成时间 = response.data[i].采购实际完成时间.split(' ')[0]
}
// if (response.data[i].备料完成时间 !== '' && response.data[i].备料完成时间 !== null) {
// response.data[i].备料完成时间 = response.data[i].备料完成时间.split(' ')[0]
// }
if (response.data[i].备料实际完成时间 !== '' && response.data[i].备料实际完成时间 !== null) {
response.data[i].备料实际完成时间 = response.data[i].备料实际完成时间.split(' ')[0]
}
// if (response.data[i].机床生产完成时间 !== '' && response.data[i].机床生产完成时间 !== null) {
// response.data[i].机床生产完成时间 = response.data[i].机床生产完成时间.split(' ')[0]
// }
if (response.data[i].机床生产实际完成时间 !== '' && response.data[i].机床生产实际完成时间 !== null) {
response.data[i].机床生产实际完成时间 = response.data[i].机床生产实际完成时间.split(' ')[0]
}
// if (response.data[i].机床装配完成时间 !== '' && response.data[i].机床装配完成时间 !== null) {
// response.data[i].机床装配完成时间 = response.data[i].机床装配完成时间.split(' ')[0]
// }
if (response.data[i].机床装配实际完成时间 !== '' && response.data[i].机床装配实际完成时间 !== null) {
response.data[i].机床装配实际完成时间 = response.data[i].机床装配实际完成时间.split(' ')[0]
}
}
this.loading = false
console.log(response.data, 222222)
this.tableData = response.data
}).then(() => {
searchtable2(this.machineValue1, 1).then(response => {
for (let i = 0; i < response.data.length; i++) {
// this.arrival.push(new Date(response.data[i].计划完成时间))
// if ((this.arrival[i] - this.now) > 0 && (this.arrival[i] - this.now) < (86400000 * this.warningValue)) {
// this.judge[i] = 1 // 即将拖期
// } else if ((this.arrival[i] - this.now) < 0) {
// this.judge[i] = 2 // 已拖期
// } else if ((this.arrival[i] - this.now) > (86400000 * this.warningValue)) {
// this.judge[i] = 3 // 进度正常
// }
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
}
this.loading1 = false
console.log(response.data, 2)
this.tableData1 = response.data
})
searchtable2(this.machineValue1, 2).then(response => {
for (let i = 0; i < response.data.length; i++) {
// this.arrival1.push(new Date(response.data[i].计划完成时间))
// if ((this.arrival1[i] - this.now) > 0 && (this.arrival1[i] - this.now) < (86400000 * this.warningValue)) {
// this.judge1[i] = 1 // 即将拖期
// } else if ((this.arrival1[i] - this.now) < 0) {
// this.judge1[i] = 2 // 已拖期
// } else if ((this.arrival1[i] - this.now) > (86400000 * this.warningValue)) {
// this.judge1[i] = 3 // 进度正常
// }
if (response.data[i].实际开始时间 !== '' && response.data[i].实际开始时间 !== null) {
response.data[i].实际开始时间 = response.data[i].实际开始时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
}
this.loading1 = false
console.log(response.data, 3)
this.tableData2 = response.data
console.log(response.data, 2222)
})
searchtable2(this.machineValue1, 3).then(response => {
for (let i = 0; i < response.data.length; i++) {
// this.arrival2.push(new Date(response.data[i].计划完成时间))
// if ((this.arrival2[i] - this.now) > 0 && (this.arrival2[i] - this.now) < (86400000 * this.warningValue)) {
// this.judge2[i] = 1 // 即将拖期
// } else if ((this.arrival2[i] - this.now) < 0) {
// this.judge2[i] = 2 // 已拖期
// } else if ((this.arrival[i] - this.now) > (86400000 * this.warningValue)) {
// this.judge2[i] = 3 // 进度正常
// }
if (response.data[i].实际开始时间 !== '' && response.data[i].实际开始时间 !== null) {
response.data[i].实际开始时间 = response.data[i].实际开始时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
}
this.loading1 = false
console.log(response.data, 4)
this.tableData3 = response.data
})
searchtable2(this.machineValue1, 4).then(response => {
for (let i = 0; i < response.data.length; i++) {
// this.arrival3.push(new Date(response.data[i].计划完成时间))
// if ((this.arrival3[i] - this.now) > 0 && (this.arrival3[i] - this.now) < (86400000 * this.warningValue)) {
// this.judge3[i] = 1 // 即将拖期
// } else if ((this.arrival3[i] - this.now) < 0) {
// this.judge3[i] = 2 // 已拖期
// } else if ((this.arrival3[i] - this.now) > (86400000 * this.warningValue)) {
// this.judge3[i] = 3 // 进度正常
// }
if (response.data[i].实际开始时间 !== '' && response.data[i].实际开始时间 !== null) {
response.data[i].实际开始时间 = response.data[i].实际开始时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
}
this.loading1 = false
console.log(response.data, 5)
this.tableData4 = response.data
})
searchtable2(this.machineValue1, 5).then(response => {
console.log(response.data)
for (let i = 0; i < response.data.length; i++) {
// this.arrival4.push(new Date(response.data[i].计划完成时间))
// if ((this.arrival4[i] - this.now) > 0 && (this.arrival4[i] - this.now) < (86400000 * this.warningValue)) {
// this.judge4[i] = 1 // 即将拖期
// } else if ((this.arrival3[i] - this.now) < 0) {
// this.judge4[i] = 2 // 已拖期
// } else if ((this.arrival3[i] - this.now) > (86400000 * this.warningValue)) {
// this.judge4[i] = 3 // 进度正常
// }
if (response.data[i].下阶段开始时间 !== '' && response.data[i].下阶段开始时间 !== null) {
response.data[i].下阶段开始时间 = response.data[i].下阶段开始时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
}
this.loading1 = false
console.log(response.data, 6)
this.tableData5 = response.data
})
})
} else {
this.$message.warning('请选择机床')
}
} else {
this.$message.warning('请选择项目')
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable1()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable1()
}
}
}
</script>
<style scoped>
.el-pagination{
background-color: white;
}
.el-card {
border-color: rgb(0, 12, 57);
color: white;
margin-bottom: 5px;
background-color: rgb(0, 12, 57);
}
.word{
border: 1px solid #ebeef5;
margin-top: 0;
line-height: 60px;
/*height: 50px;*/
background-color: rgb(0, 12, 57);
}
span{
margin: 10px 0 10px 10px;
}
.orange{
color: orange;
}
.red{
color: red;
}
.black{
color: white;
}
.green{
color: #63a35c;
}
</style>
<style>
.bold-font .el-table{
font: bold 18px arial!important;
margin: 0 0 10px 0;
color: white;
}
.bold-font .el-table td{
background-color: rgb(0, 12, 57)!important;
}
.bold-font .el-table th{
color: white;
background-color: rgb(0, 12, 57)!important;
}
.bold-font .el-table div{
color: white;
background-color: rgb(0, 12, 57)!important;
}
.bold-font{
color: ghostwhite;
font: bold 22px arial!important;
padding: 5px;
}
</style>

View File

@@ -0,0 +1,352 @@
<template>
<div class="app-container">
<el-card>
<div style="margin-top: -10px;">
<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 style="margin: 10px">定额员:</span>
<el-select v-model="personValue" size="small" placeholder="定额员" @change="personChange">
<el-option
v-for="item in person"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin: 10px">零件号:</span>
<el-select v-model="partNumValue" size="small" filterable placeholder="零件号" style="margin: 10px" @change="typeChange()">
<el-option
v-for="item in partNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<!--<el-button type="success" size="small" icon="el-icon-search" style="margin: 10px" @click="typeChange()">查询</el-button>-->
<span v-if="radio === 1" style="color: #53A3F7;font-size: 14px"> 未编制的数量{{ partNum.length }}</span>
<span v-if="radio === 2" style="color: #53A3F7;font-size: 14px"> {{ shuliang }}</span>
</div>
<div>
<span>种类:</span>
<el-input v-model="typeValue" size="small" placeholder="种类" readonly style="margin: 10px;width:180px"/>
<span>零件名称:</span>
<el-input v-model="partName" size="small" placeholder="零件名称" readonly style="margin: 10px;width:180px"/>
<span>投产总数量:</span>
<el-input v-model="batchNum" size="small" placeholder="投产总数量" readonly style="margin: 10px;width:180px"/>
<span>材质:</span>
<el-input v-model="material" size="small" placeholder="材质" readonly style="margin: 10px;width:180px"/>
<el-button v-if="radio === 2" type="primary" icon="el-icon-cjn-09" size="small" @click="ADD">保存</el-button>
<el-button v-if="radio === 1" type="primary" icon="el-icon-cjn-09" size="small" @click="ADD1">保存</el-button>
</div>
</el-card>
<el-card>
<div>
<el-table v-loading="listLoading" :data="tableData" border style="width: 100%;" height="550px" size="small">
<el-table-column type="index" label="序号" width="50" align="center"/>
<el-table-column prop="name" label="工艺名称" width="180" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].name" style="width:150px" size="small" placeholder="工艺名称" readonly/>
</template>
</el-table-column>
<el-table-column prop="request" label="工艺要求" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].request" :rows="1" size="small" placeholder="工艺要求" type="textarea" readonly/>
</template>
</el-table-column>
<el-table-column prop="singleton" label="单件" width="180" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].singleton" :readonly="tableData[scope.$index].name===''" style="width:150px" size="small" placeholder="单件"/>
</template>
</el-table-column>
<el-table-column prop="Settlement" label="准结" width="180" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].Settlement" :readonly="tableData[scope.$index].name===''" style="width:150px" size="small" placeholder="准结"/>
</template>
</el-table-column>
<el-table-column v-if="isShow" prop="budget" label="外协预算" width="180" align="center">
<template slot-scope="scope">
<el-input v-model="tableData[scope.$index].budget" style="width:150px" placeholder="外协预算" readonly/>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>
<script>
import { getPerson, mainTable, getPartnames1, getPartnames2, detailInfo, mainTable1, TableAddLi, TableAddLi1 } from '@/api/ManufacturingCenter/QuotaFormulation'
import { mapGetters } from 'vuex'
export default {
data() {
return {
listLoading: false,
shuliang: '',
q: 0,
result: 0,
budget1: [],
personValue: '',
person: [],
radio: 1, // 第一组
radio1: 1, // 第二组
partNumValue: '', // 零件号值
partNum: [], // 零件号
typeValue: '', // 种类
CraftsmenValue: '', // 工艺员值
Craftsmen: [], // 工艺员
CraftmanValue: '', // 完艺表单工艺员值
Craftman: [], // 完艺表单工艺员
partName: '', // 零件名称
batchNum: '', // 投产总数量
material: '', // 材质
// materialClass: [], // 材质类
typicalClassValue: '', // 典型工艺零件分类值
typicalClass: [], // 典型工艺零件分类
partNameValue1: '', // 典型工艺零件名称值
partName1: [], // 典型工艺零件名称
partNameValue1check: false, // 典型工艺零件名称check
processNumValue: '', // 典型工艺号值
processNum: [], // 典型工艺号
processNumValuecheck: false, // 典型工艺号check
remark: '', // 备注
remark1: '', // 完艺零件名称
numVal: '', // 输入数值
tolerance: '', // 公差
tableData: [],
tableData3: null, // 工艺定额人员
tableData4: null, // 完艺表格
processSelect: [], // 工艺分类流水号
processNameClass: [], // 工艺名称分类
processNameClassValue: '',
processName: [], // 工艺名称
processNameValue: '',
processRequest: [], // 工艺要求
processRequestValue: '',
processN1: [], // 工艺编号
str: '', // 拼接字符串用的
value: '', // 第一个select的
input1: '', // 种类
checked: false, // 是否核准
checked1: false, // 修改
input: '', // 规格
isShow: false, // 2的可见性
date0: ['', ''], // 完艺时间段
PN: '0000', // 零件号0000
num: '', // 工艺计划流水号
num0: '', // 主表工艺计划流水号
perNum: [],
tuhao: [],
tuhaoValue: '',
check1: '',
check2: '',
check3: '',
check4: '',
input2: '',
list: null,
value7: '',
restaurants: [],
state4: '',
timeout: null
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id'
])
},
created() {
this.fetchData()
},
methods: {
fetchData() { // 初始化未编制零件号
getPerson().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.person.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
getPartnames1().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partNum.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
})
},
personChange() {
if (this.radio === 2) {
this.shuliang = '加载中...'
this.partNumValue = ''
this.partNum = []
this.typeValue = ''
this.Craftsmen = ''
this.batchNum = ''
this.material = ''
this.partName = ''
this.tableData = [] // 清主表
getPartnames2(this.personValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partNum.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
this.shuliang = '已编制的数量' + this.partNum.length
})
}
},
radioChange() { // radio改变 编制情况 获取不同零件号
if (this.radio === 2) { // 已编制
this.isShow = true
this.partNumValue = ''
this.partNum = []
this.typeValue = ''
this.Craftsmen = ''
this.partName = ''
this.batchNum = ''
this.material = ''
this.tableData = [] // 清主表
this.personChange()
} else { // 未编制
this.shuliang = ''
this.isShow = false
this.partNumValue = ''
this.partNum = []
this.typeValue = ''
this.Craftsmen = ''
this.partName = ''
this.batchNum = ''
this.material = ''
this.tableData = [] // 清主表
getPartnames1().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partNum.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
})
}
},
typeChange() { // 当零件号改变时,改变种类、工艺员、零件名称、投产总数量、材质,并且显示主表信息
this.listLoading = true
this.tableData = []
this.num0 = ''
if (this.radio === 1) { // 未编制
detailInfo(this.partNumValue).then(response => {
if (response.data.length !== 0) {
this.typeValue = response.data[0].零件类型名称
this.partName = response.data[0].零件名称
this.batchNum = response.data[0].批次数量
this.num0 = response.data[0].工艺计划流水号
this.material = response.data[0].材料
}
}).then(() => {
mainTable(this.num0).then(response => {
if (response.data.length === 0) {
this.listLoading = false
} else {
for (let i = 0; i < response.data.length; i++) {
this.tableData.push({
name: response.data[i].工艺名称,
request: response.data[i].工艺要求,
num1: response.data[i].工序流水号,
Settlement: response.data[i].准结定额工时,
singleton: response.data[i].单件定额工时,
lingjian: response.data[i].零件图号,
numm: response.data[i].工艺计划流水号
})
}
this.listLoading = false
}
})
})
} else {
detailInfo(this.partNumValue).then(response => {
if (response.data.length !== 0) {
this.typeValue = response.data[0].零件类型名称
this.partName = response.data[0].零件名称
this.batchNum = response.data[0].批次数量
this.num0 = response.data[0].工艺计划流水号
this.material = response.data[0].材料
}
}).then(() => {
mainTable1(this.partNumValue).then(response => {
if (response.data.length === 0) {
this.listLoading = false
} else {
for (let i = 0; i < response.data.length; i++) {
this.tableData.push({
name: response.data[i].工艺名称,
request: response.data[i].工艺要求,
num1: response.data[i].工序流水号,
Settlement: response.data[i].准结定额工时,
singleton: response.data[i].单件定额工时,
budget: response.data[i].外协预算价格1,
lingjian: response.data[i].零件图号,
numm: response.data[i].工艺计划流水号
})
}
this.listLoading = false
}
})
})
}
},
ADD() {
this.result = 0
for (let i = 0; i < this.tableData.length; i++) {
TableAddLi(this.tableData[i].singleton, this.tableData[i].Settlement, this.tableData[i].lingjian, this.tableData[i].num1, this.tableData[i].numm).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.tableData.length) {
this.$message.success('保存成功')
this.typeChange()
} else if (response.data[0].result === '0') {
this.$message.error('第' + (i + 1) + '行保存失败')
}
})
}
},
ADD1() {
this.result = 0
if (this.personValue === '') {
this.$message.error('请选择人员')
} else {
for (let i = 0; i < this.tableData.length; i++) {
TableAddLi(this.tableData[i].singleton, this.tableData[i].Settlement, this.tableData[i].lingjian, this.tableData[i].num1, this.tableData[i].numm).then(response => {
this.result += parseInt(response.data[0].result)
if (this.result === this.tableData.length) {
TableAddLi1(this.partNumValue, this.personValue).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
this.radioChange()
} else {
this.$message.error('保存失败')
}
})
} else if (response.data[0].result === '0') {
this.$message.error('保存失败')
}
})
}
}
}
}
}
</script>
<style scoped>
.doing-row4{
background: #f0f9eb;
}
.el-card{
margin-bottom: 15px;
}
</style>

View File

@@ -0,0 +1,169 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<el-col style="width: 330px">
<span style="margin-left: 10px">原材料名称:</span>
<el-input v-model="RawMaterialName" placeholder="原材料名称" size="small" clearable/>
</el-col>
<el-col style="width: 200px">
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="pageCurrent=1;searchTableData()">查询</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="handleAdd()">增加</el-button>
</el-col>
</el-row>
</el-card>
<el-card style="margin-top: 15px">
<el-table :data="tableData" style="width: 100%;min-height: 500px" height="500" size="mini" highlight-current-row border>
<el-table-column align="center" label="原材料名称">
<template slot-scope="scope">
{{ scope.row.原材料名称 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-button size="mini" type="primary" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-form-item label="原材料名称" prop="RawMaterialName">
<el-input v-model="form.RawMaterialName" placeholder="原材料名称" size="small" clearable/>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form')">取消</el-button>
<el-button v-show="title==='增加'" type="primary" @click="submitAdd('form')">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchTableData, addData, editData, deleteCategory } from '@/api/ManufacturingCenter/RawMaterialsMaintenance'
export default {
data() {
return {
RawMaterialNumber: '',
RawMaterialName: '',
param: 0,
tableData: [],
pageCurrent: 1,
pageSize: 10,
total: null,
dialogFormVisible: false,
title: '',
form: {
RawMaterialName: ''
},
rules: {
RawMaterialName: [{ required: true, message: '请输入物料名称', trigger: 'blur' }]
}
}
},
created() {
this.searchTableData()
},
methods: {
// 获取原材料
searchTableData() {
searchTableData(this.RawMaterialName, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = parseInt(response.data.total)
})
},
// 增加
handleAdd() {
this.addForm('form', [this.dialogFormVisible = true, this.title = '增加'])
},
// 提交增加
submitAdd() {
this.addTable(addData, [this.form.RawMaterialName], 'form', function() {
this.dialogFormVisible = false
this.pageCurrent = 1
this.searchTableData()
})
},
// 编辑
handleEdit(row) {
this.editForm(row, 'form', [this.title = '编辑', this.dialogFormVisible = true])
this.form.RawMaterialName = row.原材料名称
this.RawMaterialNumber = row.原材料流水号
},
// 提交编辑
submitEdit() {
this.editTable(editData, [this.RawMaterialNumber, this.form.RawMaterialName], 'form', function() {
this.searchTableData()
this.dialogFormVisible = false
})
},
// 取消
cancel() {
this.dialogFormVisible = false
},
handleDelete(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCategory(row.原材料流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
if (this.tableData && this.tableData.length === 1 && this.pageCurrent > 1) { // 判断删除的是否是最后一页最后一行,如果是且不是第一页,页数减一
this.pageCurrent--
}
this.searchTableData()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTableData()
}
}
}
</script>
<style scoped>
span {
margin: 10px 0px 10px 10px;
}
.el-select{
width:190px
}
.el-input{
width:190px
}
</style>

View File

@@ -0,0 +1,560 @@
<template>
<div class="app-container">
<el-card>
<span>人员名称:</span>
<el-input v-model="personnelNumber" placeholder="请选择人员名称" class="input-with-select" readonly clearable size="small" style="width:200px;margin:3px;" @dblclick.native="dialogTableVisible"/>
<el-button type="success" class="el-icon-search" size="small" style="margin-left: 10px" @click="pageCurrent=1;pageSize=20;searchTable()">查询</el-button>
<el-button type="primary" class="el-icon-circle-plus-outline" size="small" style="margin-left: 10px" @click="editType1('form');param = 0">新增</el-button>
</el-card>
<el-card>
<el-table v-loading="loading0" :data="tableData" height="770" highlight-current-row size="mini" style="width: 100%;margin-top:3px" border stripe>
<el-table-column
label="序号"
type="index"
align="center"
width="50"/>
<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.姓名 }}
</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-tooltip effect="dark" content="编辑" placement="top">
<div style="display: inline-block">
<el-button
size="mini"
type="text"
class="el-icon-edit-outline"
@click="handleChange1(scope.$index, scope.row, 'form');param = 1"/>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<div style="display: inline-block">
<el-button
size="mini"
type="text"
class="el-icon-delete"
style="margin-left: 20px"
@click="handleDelete(scope.$index, scope.row)"/>
</div>
</el-tooltip>
</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="project">
<el-select v-model="form.project" filterable size="small" @change="getMachine">
<el-option
v-for="item in projects"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机床" prop="Machine">
<el-select v-model="form.Machine" filterable size="small" @change="getGroup">
<el-option
v-for="item in Machines"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="分组" prop="Group">
<el-select v-model="form.Group" filterable size="small" @change="getParts">
<el-option
v-for="item in Groups"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="零件" prop="零件">
<el-select v-model="form.零件" filterable size="small">
<el-option
v-for="item in Parts"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="年" prop="yearNumberValue">
<el-select v-model="form.yearNumberValue" size="small">
<el-option
v-for="item in yearNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="月" prop="monthNumberValue">
<el-select v-model="form.monthNumberValue" size="small">
<el-option
v-for="item in monthNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="修补工时" prop="timeNumber">
<el-input v-model="form.timeNumber" placeholder="修补工时" clearable size="small" style="width: 200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="修补工艺" prop="修补工艺">
<el-input v-model="form.修补工艺" placeholder="修补工艺" clearable size="small" style="width: 200px"/>
</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="dialogFormVisible1" title="人员信息" center width="750px">
<div style="height: 500px">
<div style="float: left;margin-top: 10px;margin-left: 20px;overflow-y: scroll;height: 400px">
<el-tree
:data="data2"
node-key="id"
style="width: 150px;float: left"
height="400"
accordion
@node-click="handleNodeClick"
/>
</div>
<el-table :data="List1" highlight-current-row height="400" stripe border size="mini" style="width: 400px;float: left;margin-left: 30px" @row-click="handleCurrentChange2">
<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" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
</el-table>
</div>
<el-button style="margin-left: 260px" @click="dialogFormVisible1 = false">取消</el-button>
<el-button type="primary" style="margin-top: 20px" @click="getName">确认</el-button>
</el-dialog>
</div>
</template>
<script>
import { delList, getTable8, getNames, getMachines, getGroups, getParts, getTree, fn, dialogtablevisible, searchTechnology, searchperson, searchtable, edittype, handlechange } from '@/api/ManufacturingCenter/RepairTimeEntry'
import elInput from 'element-ui/packages/input'
export default {
components: {
elInput
},
data() {
return {
codes2: '',
Number2: '',
codes: '',
Number1: '',
Name: '',
ssks: '',
List1: [],
data2: [],
dialogFormVisible1: false,
a: '', // 初始化赋值中间变量
liushuihao: '', // 编辑流水号
renyuanbianhao: '', // 编辑人员编号
personnelNumber: '', // 人员编号
projects: [],
Machines: [],
Groups: [],
Parts: [],
form: {
零件: '',
project: '',
Machine: '',
Group: '',
TechnologyValue: '',
yearNumberValue: '',
monthNumberValue: '',
timeNumber: '',
修补工艺: ''
},
Technology: [], // 工艺
yearNumber: [], // 年
monthNumber: [], // 月
loading0: false,
count1: 0, // 清表单验证计数器
count2: 0, // 清表单验证计数器
tableData: [], // 表格数据
pageSize: 20,
pageCurrent: 1,
total: 0,
dialogFormVisible: false,
title1: '',
rules: {
零件: [{ required: true, message: '请选择零件', trigger: 'change' }],
timeNumber: [{ required: true, message: '请输入修补工时', trigger: 'blur' }],
yearNumberValue: [{ required: true, message: '请选择年份', trigger: 'blur' }],
monthNumberValue: [{ required: true, message: '请选择月份', trigger: 'blur' }],
修补工艺: [{ required: true, message: '请输入修补工艺', trigger: 'blur' }]
}
}
},
created() {
this.fetchData()
this.fetchData3()
this.searchTable()
this.fetchData2()
this.getParts()
},
methods: {
fetchData2() {
this.projects = []
getNames().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.projects.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
getMachine() {
this.form.Machine = ''
this.Machines = []
this.form.Group = ''
this.Groups = []
if (this.form.project !== '') {
getMachines(this.form.project).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
}
},
getGroup() {
this.form.Group = ''
this.Groups = []
getGroups(this.form.Machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Groups.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
getParts() {
if (this.project === '') {
this.checkbox_project = false
} else {
this.checkbox_project = true
}
if (this.Machine === '') {
this.checkbox_Machine = false
} else {
this.checkbox_Machine = true
}
if (this.Group === '') {
this.checkbox_Group = false
} else {
this.checkbox_Group = true
}
if (this.number === '') {
this.checkbox_number = false
} else {
this.checkbox_number = true
}
this.form.零件 = ''
this.Parts = []
getParts(this.checkbox_project, this.form.project, this.checkbox_Machine, this.form.Machine, this.checkbox_Group, this.form.Group).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Parts.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
})
},
handleCurrentChange2(row) { // 获取当前行人员信息
this.ssks = row.节点名称
this.Number1 = row.人员编号
this.codes = row.序号
this.Name = row.姓名
},
getName() { // 提交人员
this.dialogFormVisible1 = false
this.personnelNumber = this.Name
this.codes2 = this.codes
this.Number2 = this.Number1
},
handleNodeClick(data) { // 树节点点击
this.ssks = data.label
getTable8(data.id).then(response => {
this.List1 = response.data
})
},
fetchData3() {
getTree().then(response => { // 获取人员信息树
const data = response.data
this.data2 = fn(data, 0)
})
},
dialogTableVisible() {
this.dialogFormVisible1 = true
dialogtablevisible()
},
// 初始化工艺
fetchData() {
var time = new Date()
this.form.TechnologyValue = ''
this.Technology = []
searchTechnology().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Technology.push({
label: response.data[i].工艺名称,
value: response.data[i].工艺编号
})
}
})
for (let i = time.getFullYear() - 2; i <= time.getFullYear() + 2; i++) {
if (i === time.getFullYear()) {
this.a = i
}
this.yearNumber.push({
label: i,
value: i
})
}
for (let i = 0; i < 12; i++) {
this.monthNumber.push({
label: i + 1,
value: i + 1
})
}
this.form.yearNumberValue = this.a
this.form.monthNumberValue = 1
},
// 查询
searchTable() {
this.tableData = []
this.loading0 = true
if (this.personnelNumber !== '' && this.personnelNumber !== null) {
searchtable(1, this.Number2, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading0 = false
})
} else {
searchtable(0, this.Number2, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading0 = false
})
}
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delList(row.员工月修补工时流水号).then(response => {
if (response.data[0].result === '1') {
this.searchTable()
this.$message({
message: '已被成功删除',
type: 'success'
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 增加打开
editType1(formName) {
if (this.personnelNumber === '' || this.personnelNumber === null) {
this.$message.error('请输入人员编号')
} else {
this.form.TechnologyValue = ''
this.form.timeNumber = ''
this.form.零件 = ''
this.form.修补工艺 = ''
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
this.title1 = '新增修补工时'
this.dialogFormVisible = true
}
},
// 增加确定
editType() {
searchperson(this.codes2).then(response => {
if (response.data.length !== 0) {
edittype(this.form.零件, response.data[0].人员编号, this.form.yearNumberValue, this.form.monthNumberValue, this.form.timeNumber, this.form.修补工艺).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.pageCurrent = 1
this.pageSize = 20
this.searchTable()
this.dialogFormVisible = false
} else {
this.$message.error('增加失败')
this.dialogFormVisible = false
}
})
} 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.renyuanbianhao = row.人员编号
this.liushuihao = row.员工月修补工时流水号
this.form.零件 = parseInt(row.工艺计划流水号)
this.form.yearNumberValue = row.
this.form.monthNumberValue = row.
this.form.timeNumber = row.修补工时
this.form.修补工艺 = row.修补工艺
this.dialogFormVisible = true
this.title1 = '编辑修补工时'
},
// 编辑确定
handleChange() {
handlechange(this.liushuihao, this.form.零件, this.renyuanbianhao, this.form.yearNumberValue, this.form.monthNumberValue, this.form.timeNumber, this.form.修补工艺).then(response => {
if (response.data[0].result === '1') {
this.$message.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()
},
// 分页
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;*/
/*}*/
</style>

View File

@@ -0,0 +1,538 @@
<!--零件报废补投-->
<template>
<div class="app-container">
<el-card>
<div>
<span>项目名称:</span>
<el-select v-model="ProjectNameValue" placeholder="请选择项目名称" style="width:200px" clearable size="small" @change="fetchMachineDrawingData" @clear="MachineDrawingValue = '';MachineDrawing = [];Team = [];TeamValue = ''">
<el-option
v-for="item in ProjectName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 15px">机床号:</span>
<el-select v-model="MachineDrawingValue" placeholder="请选择机床图号" style="width:200px" clearable size="small" @change="fetchTeamDrawingData" @clear="Team = [];TeamValue = ''">
<el-option
v-for="item in MachineDrawing"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 15px">组号:</span>
<el-select v-model="TeamValue" placeholder="请选择组号" style="width:200px" clearable size="small">
<el-option
v-for="item in Team"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 15px">零件图号:</span>
<el-input v-model="PartDrawing" placeholder="请输入零件图号" size="small" style="width: 200px" clearable/>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 20px" @click="currentPage1=1; fetchTableData()">查询</el-button>
</div>
</el-card>
<el-card>
<el-table
v-loading="loading"
:data="tableData"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(226,223,223,1)"
height="250"
highlight-current-row
border
stripe
style="width: 100%; text-align: center"
@current-change="fetchTableData2">
<el-table-column
align="center"
prop="province1"
label="零件号"
>
<template slot-scope="scope">{{ scope.row.零件图号 }}</template>
</el-table-column>
<el-table-column
align="center"
prop="province2"
label="零件名称"
>
<template slot-scope="scope">{{ scope.row.零件名称 }}</template>
</el-table-column>
<el-table-column
align="center"
prop="province4"
label="批次数量"
>
<template slot-scope="scope">{{ scope.row.批次数量 }}</template>
</el-table-column>
<el-table-column
align="center"
prop="province5"
label="开始时间"
>
<template slot-scope="scope">{{ scope.row.机加工开始时间 }}</template>
</el-table-column>
<el-table-column
align="center"
prop="province6"
label="结束时间"
>
<template slot-scope="scope">{{ scope.row.机加工结束时间 }}</template>
</el-table-column>
<el-table-column
align="center"
prop="province7"
label="零件状态"
>
<template slot-scope="scope">
<el-tag v-if="scope.row.批次零件状态 === '2'" type="info" size="small">停产</el-tag>
<el-tag v-else type="success" size="small">生产</el-tag>
</template>
</el-table-column>
<el-table-column
align="center"
fixed="right"
label="操作"
width="100px"
>
<template slot-scope="scope" >
<el-button :disabled="scope.row.批次零件状态 === '2'" type="primary" size="small" @click="handleEdit(scope.row)">停产</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="currentPage1"
: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"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(226,223,223,1)"
height="250"
border
stripe
style="width: 100%">
<el-table-column
width="80px"
prop="province1"
label="工序顺序"
>
<template slot-scope="scope">{{ scope.row.工序顺序 }}</template>
</el-table-column>
<el-table-column
width="200px"
prop="province2"
label="工艺名称"
>
<template slot-scope="scope">{{ scope.row.工艺名称 }}</template>
</el-table-column>
<el-table-column
prop="province4"
label="工艺要求"
>
<template slot-scope="scope">{{ scope.row.工艺要求 }}</template>
</el-table-column>
<el-table-column
width="80px"
prop="province5"
label="单件定额工时"
>
<template slot-scope="scope">{{ scope.row.单件定额工时 }}</template>
</el-table-column>
<el-table-column
width="80px"
prop="province6"
label="准结定额工时"
>
<template slot-scope="scope">{{ scope.row.准结定额工时 }}</template>
</el-table-column>
<el-table-column
width="100px"
prop="province7"
label="工艺是否完成"
>
<template slot-scope="scope">
<div v-if="scope.row.工序状态 === '4'"><div style="width: 12px;height: 12px;border-radius: 50%;background-color: rgb(103, 194, 58);display: inline-block;margin:0px 5px 0 0"/>完成</div>
<div v-else ><div style="width: 12px;height: 12px;border-radius: 50%;background-color: red;display: inline-block;margin:0px 5px 0 0"/>未完成</div>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="currentPage2"
: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>
<div>停产后,将重新补投两种零件一种是接着加工(执行原来的加工计划)另一种是从第一序重新加工(重新制定零件的加工计划)补投的零件号后加B</div>
<div style="margin-top: 20px; display: block">
<span>补投接着加工零件数量</span>
<el-input v-model="inputA" auto-complete="off" style="width: 200px" size="small"/>
<span>开始工序</span>
<el-input v-model="inputB" :disabled="true" auto-complete="off" style="width: 200px" size="small"/>
<el-button type="success" size="small" @click="editA">补投接着生产零件</el-button>
</div>
<!--<div style="margin-left: 800px; display: block">>>>><el-button type="success" size="small" style="margin-left: 40px" @click="goToCapacityBalance()">制定计划</el-button></div>-->
<div style="margin-top: 20px; display: block">
<span>补投重新加工零件数量</span>
<el-input v-model="inputC" auto-complete="off" style="width: 200px" size="small" />
<span>开始工序</span>
<el-input v-model="inputD" :disabled="true" auto-complete="off" style="width: 200px" size="small"/>
<el-button type="success" size="small" @click="editB">补投重新生产零件</el-button>
</div>
</el-card>
<el-card v-show="false">
<el-table
:data="tableData4"
height="250"
highlight-current-row
border
stripe
style="width: 100%">
<el-table-column
prop="province1"
label="零件号"
>
<template slot-scope="scope">{{ scope.row.零件图号 }}</template>
</el-table-column>
<el-table-column
prop="province2"
label="零件名称"
>
<template slot-scope="scope">{{ scope.row.零件名称 }}</template>
</el-table-column>
<el-table-column
prop="province4"
label="重投数量"
>
<template slot-scope="scope">{{ scope.row.批次数量 }}</template>
</el-table-column>
<el-table-column
prop="province5"
label="开始工序"
>
<template slot-scope="scope">{{ scope.row.开始工序 }}</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog :visible.sync="dialogeditVisible" :title="title" width="400px" center >
<el-form ref="form" :model="form" label-position="left">
<el-form-item label="零件号" label-width="100px" style="width: 299px ; display: inline-block; text-align: left" size="small">
<el-input v-model="form.input1" :disabled="true" auto-complete="off" style="margin-left: 20px"/>
</el-form-item>
<el-form-item label="停产原因" label-width="100px" prop="reason" style="width: 299px ; display: inline-block; text-align: left" size="small">
<el-input v-model="form2.reason" auto-complete="off" style="margin-left: 20px"/>
</el-form-item>
<el-form-item label="停产时间" label-width="120px" prop="time" style="width: 299px ; display: inline-block; text-align: left" size="small">
<el-date-picker
v-model="form2.time"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="选择日期"/>
</el-form-item>
<el-form-item v-show="false" label="零件状态" label-width="123px" style="margin-bottom: 18px; display: inline-block" prop="input2">
<el-radio-group v-model="radio" fill="#B2DFEE" boolean @change="remark()">
<el-radio-button label="正常生产"/>
<el-radio-button label="停止生产"/>
</el-radio-group>
</el-form-item>
<el-form-item v-show="false" label="开始时间" label-width="120px" style="margin-bottom: 18px; display: inline-block">
<el-date-picker
v-model="input3"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="选择日期"/>
</el-form-item>
<el-form-item v-show="false" label="结束时间" label-width="120px" style="margin-bottom: 18px; display: inline-block">
<el-date-picker
v-model="input4"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="选择日期"/>
</el-form-item>
</el-form>
<div style="margin-right: 60px;margin-top: 10px">
<el-button style="margin-left: 35%" @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogeditVisible1" title="停产记录" width="400px" center>
<el-form ref="form2" :model="form2" label-position="left">
<el-form-item label="停产原因" label-width="100px" style="width: 299px ; display: inline-block; text-align: left" size="small">
<el-input v-model="form2.reason" auto-complete="off"/>
</el-form-item>
<el-form-item label="停产时间" label-width="100px" style="width: 299px ; display: inline-block; text-align: left" size="small">
<el-date-picker
v-model="form2.time"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="选择日期"/>
</el-form-item>
</el-form>
<div style="margin-left: 140px;margin-top: 10px">
<el-button type="primary" @click="submitRemark()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { ProjectNameSelect, MachineDrawingSelect, TeamSelect, TableDataSelect, editTime, editStop, TableDta2Select, editA, editchar } from '@/api/ManufacturingCenter/SparePartsForScrap'
export default {
data() {
return {
remark1: '',
remark2: '',
disabledB: false,
tableData4: [],
judge: '',
ProjectNameValue: '', // 项目名称
ProjectName: [], // 项目名称下拉框
MachineDrawingValue: '', // 机床号
MachineDrawing: [], // 机床图号下拉框
TeamValue: '', // 组号
Team: [], // 组号下拉框
title: '',
currentPage1: 1,
pageSize1: 10,
total1: null,
currentPage2: 1,
pageSize2: 10,
total2: null,
tableData: [], // 主表格数据
tableData2: [], // 次表格数据
loading: '', // 主表格加载
loading2: '', // 次表格加载
ProjectCode_check: '', // 项目流水号_check
MachineCode_check: '', // 机床流水号_check
TeamCode_check: '', // 组件流水号_check
ComponentPartsBasicCattleTaxNumber_check: 0, // 组件零件基本件流水号_check
ComponentPartsBasicCattleTaxNumber: '', // 组件零件基本件流水号
CutCode_check: 0, // 工艺计划流水号_check
CutCode: '', // 工艺计划流水号
CutCodeBefore_check: 0, // 工艺计划流水号_补投前_check
CutCodeBefore: '', // 工艺计划流水号_补投前
Assess_check: 1, // 考核状态_check
Assess: 6, // 考核状态
PartDrawing_check: '', // 零件图号_check
PartDrawing: '', // 零件图号
dialogeditVisible: false, // 编辑对话框可见性
dialogeditVisible1: false, // 编辑对话框可见性
code: '', // 工艺计划流水号
temp: '', // 是否停产中间值
disabled: false,
form: {
input1: '',
input2: ''
},
form2: {
reason: '',
time: ''
},
radio: '',
input3: '', // 开始时间
input4: '', // 结束时间
inputA: 1,
inputB: '',
inputC: 1,
inputD: 1
}
},
created() {
this.fetchProjectNameData()
this.fetchTableData()
},
methods: {
// 项目名称查询
fetchProjectNameData() {
this.getSelect(ProjectNameSelect, ['项目名称', '项目流水号'], 'ProjectName', this.Assess)
},
// 机床图号查询
fetchMachineDrawingData() {
this.Team = []
this.TeamValue = ''
this.getSelect(MachineDrawingSelect, ['机床图号', '机床流水号'], 'MachineDrawing', this.ProjectNameValue)
},
// 组号查询
fetchTeamDrawingData() {
this.getSelect(TeamSelect, ['组号', '组件流水号'], 'Team', this.MachineDrawingValue)
},
fetchTableData() {
this.loading = true
this.ProjectNameValue ? this.ProjectCode_check = 1 : this.ProjectCode_check = 0
this.MachineDrawingValue ? this.MachineCode_check = 1 : this.MachineCode_check = 0
this.TeamValue ? this.TeamCode_check = 1 : this.TeamCode_check = 0
this.PartDrawing ? this.PartDrawing_check = 1 : this.PartDrawing_check = 0
this.tableData2 = []
this.getTable(TableDataSelect, [this.ProjectCode_check, this.ProjectNameValue, this.MachineCode_check, this.MachineDrawingValue, this.TeamCode_check, this.TeamValue, this.ComponentPartsBasicCattleTaxNumber_check, this.ComponentPartsBasicCattleTaxNumber, this.CutCode_check, this.CutCode, this.CutCodeBefore_check, this.CutCodeBefore, this.Assess_check, this.Assess, this.PartDrawing_check, this.PartDrawing, this.currentPage1, this.pageSize1], ['tableData', 'total1', 'loading'])
},
fetchTableData2(row) {
if (row) {
this.disabled = false
this.judge = row.批次零件状态
this.CutCodeBefore = row.工艺计划流水号
TableDta2Select(row.工艺计划流水号, this.currentPage2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
for (let i = 0; i < response.data.rows.length; i++) {
if (response.data.rows[i].工序状态 === '4') {
this.inputB = this.inputB + 1
}
if (response.data.rows[i].工序状态 !== '4') {
this.inputB = response.data.rows[i].工序顺序
break
}
}
})
}
},
handleSizeChange1(val) {
this.currentPage1 = 1
this.pageSize1 = val
this.fetchTableData()
},
handleCurrentChange1(val) {
this.currentPage1 = val
this.fetchTableData()
},
handleSizeChange2(val) {
this.pageSize2 = val
TableDta2Select(this.CutCodeBefore, this.currentPage2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
this.currentPage2 = 1
this.pageSize2 = 10
},
handleCurrentChange2(val) {
this.currentPage2 = val
TableDta2Select(this.CutCodeBefore, this.currentPage2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
this.currentPage2 = 1
this.pageSize2 = 10
},
handleEdit(row) {
this.remark1 = ''
this.remark2 = ''
this.form2.reason = ''
this.title = row.零件名称
this.form2.time = new Date()
this.dialogeditVisible = true
this.form.input1 = row.零件图号
if (row.批次零件状态 === '2') {
this.radio = '停止生产'
} else if (row.批次零件状态 === '1') {
this.radio = '正常生产'
}
this.input3 = row.机加工开始时间
this.input4 = row.机加工结束时间
this.code = row.工艺计划流水号
},
async chaEdit() {
this.radio === '正常生产' ? this.temp = '1' : this.temp = '2'
const Time = await editTime(this.code, this.input3, this.input4)
const Char = await editchar(this.remark1, this.remark2, this.code)
const Stop = await editStop(this.code, 2)
if (Time.data[0].result === '1' && Char.data[0].result === '1' && Stop.data[0].result === '1') {
this.dialogeditVisible = false
this.$message.success('信息更新成功')
this.fetchTableData()
} else {
this.$message.error('信息更新失败')
}
},
// 提交添加或者修改
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.chaEdit()
}
})
},
// 重置表单
callOff(formName) {
this.form = {}
this.dialogeditVisible = false
this.$refs[formName].resetFields()
},
editA() {
if (this.judge === '2') {
editA(this.CutCodeBefore, this.inputA, this.inputB).then(response => {
if (response.data[0].result === '1') {
this.$message.success('补投成功')
this.fetchTableData()
} else {
this.$message.error('补投失败')
}
})
} else { this.$message.warning('请选择停产零件') }
},
editB() {
if (this.judge === '2') {
editA(this.CutCodeBefore, this.inputC, this.inputD).then(response => {
if (response.data[0].result === '1') {
this.$message.success('补投成功')
this.fetchTableData()
} else {
this.$message.error('补投失败')
}
})
} else { alert('请选择停产零件') }
},
goToCapacityBalance() {
this.$router.push({ path: '/ProductionCapacityBalance/index' })
},
remark() {
if (this.radio === '停止生产') {
this.form2.reason = ''
this.form2.time = ''
this.dialogeditVisible1 = true
}
},
submitRemark() {
this.remark1 = this.form2.reason
this.remark2 = this.form2.time
this.dialogeditVisible1 = false
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px;
}
</style>

View File

@@ -0,0 +1,291 @@
<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="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border element-loading-text="拼命加载中">
<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="240px">
<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="重量(kg)" align="center" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.重量" size="mini"/>
</template>
</el-table-column>
<el-table-column label="单价(元)" align="center" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.单价" size="mini"/>
</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.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, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<span>零件图号:</span>
<el-input v-model="partName2" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="total2=0;pageSize2=10; pageCurrent2=1;searchTable2()">查询</el-button>
<el-button size="small" icon="el-icon-success" type="primary" style="margin-left: 10px" @click="edit()">外购备料出库</el-button>
</el-card>
<el-card>
<el-table v-loading="loading2" :data="tableData2" height="580" style="width: 100%;" border element-loading-text="拼命加载中" @selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55"
align="center"/>
<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="240px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="重量" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.重量1 }}
</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">
<template slot-scope="scope">
{{ scope.row.备注1 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
</div>
</template>
<script>
import { searchtable, searchtable2, change, handlechange, searchtable3, change2, handlechange2 } from '@/api/ManufacturingCenter/SparePartsOut'
import { mapGetters } from 'vuex'
export default {
data() {
return {
editTime: '',
bianliang1: [],
bianliang2: [],
num: 0,
arrest: [],
all: false,
partName: '',
loading: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1, // 后台获取页
loading2: false,
partName2: '',
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1 // 后台获取页
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id'
])
},
created() {
this.searchTable()
this.searchTable2()
},
methods: {
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.Data = []
if (this.partName !== '' && this.partName !== null) {
this.partNamecheck = true
} else {
this.partNamecheck = false
}
searchtable(this.partNamecheck, this.partName, !this.all, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
this.Data = response.data.rows
this.total = response.data.total
}
}).then(() => {
for (let i = 0; i < this.Data.length; i++) {
searchtable2(this.Data[i].工艺计划流水号).then(response => {
this.tableData.push({
工艺计划流水号: this.Data[i].工艺计划流水号,
零件名称: this.Data[i].零件名称,
零件图号: this.Data[i].零件图号,
备料到货: this.Data[i].备料到货,
工艺要求: response.data[0].工艺要求,
工序流水号: response.data[0].工序流水号,
重量: response.data[0].重量,
单价: 0
})
})
this.loading = false
}
})
},
zeroFill(i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
},
// 自家备料确认
handleChange1(row) {
if (row.重量 === '' || row.重量 === null) {
this.$message.error('请输入重量')
} else if (row.单价 === '' || row.单价 === null) {
this.$message.error('请输入单价')
} else {
var date = new Date()
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
this.editTime = date.getFullYear() + '-' + month + '-' + day
change(row.工艺计划流水号, row.重量, row.单价).then(() => {
handlechange(row.工序流水号, '0000').then(response => {
handlechange2(row.工序流水号, this.form.完成时间)
})
}).then(response => {
this.searchTable()
})
}
},
handleSelectionChange(val) {
this.arrest = val
},
searchTable2() {
this.loading2 = true
this.tableData2 = []
this.Data2 = []
if (this.partName2 !== '' && this.partName2 !== null) {
this.partNamecheck2 = 1
} else {
this.partNamecheck2 = 0
}
searchtable3(this.partNamecheck2, this.partName2, this.pageCurrent2, this.pageSize2).then(response => {
if (response.data.total === 0) {
this.loading2 = false
} else {
this.Data2 = response.data.rows
this.total2 = response.data.total
}
}).then(() => {
for (let i = 0; i < this.Data2.length; i++) {
searchtable2(this.Data2[i].工艺计划流水号).then(response => {
this.tableData2.push({
工艺计划流水号: this.Data2[i].工艺计划流水号,
零件名称: this.Data2[i].零件名称,
零件图号: this.Data2[i].零件图号,
重量1: this.Data2[i].重量1,
单价: this.Data2[i].单价,
备注1: this.Data2[i].备注1,
工序流水号: response.data[0].工序流水号
})
})
this.loading2 = false
}
})
},
edit() {
this.bianliang1 = []
this.bianliang2 = []
if (this.arrest.length === 0) {
this.$message.warning('请选择零件')
} else {
for (let i = 0; i < this.arrest.length; i++) {
this.bianliang1.push(this.arrest[i].工艺计划流水号)
this.bianliang2.push(this.arrest[i].工序流水号)
}
change2(this.bianliang2, '0000', this.bianliang1).then(response => {
this.searchTable2()
})
}
},
// 分页
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.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,130 @@
<template>
<div class="app-container">
<el-card style="margin-top: 5px">
<el-row>
<el-col :span="7">
<span>原材料名称:</span>
<el-input v-model="RawMaterialName" placeholder="原材料名称" size="mini" clearable style="width: 120px"/>
<el-button type="success" icon="el-icon-search" size="mini" style="margin-left: 10px" @click="pageCurrent=1;searchTableData()">查询</el-button>
<el-table :data="tableData" style="margin-top: 15px;width: 100%" height="500" size="mini" border @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"/>
<el-table-column align="center" label="原材料名称">
<template slot-scope="scope">
{{ scope.row.原材料名称 }}
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="16" style="margin-left: 20px">
<span>原材料名称:</span>
<el-input v-model="RawMaterialName" placeholder="原材料名称" size="mini" clearable style="width: 120px"/>
<el-button type="success" icon="el-icon-search" size="mini" style="margin-left: 10px" @click="pageCurrent=1;searchTableData()">查询</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="handleAdd()">增加</el-button>
<el-table :data="tableData" style="margin-top: 15px;width: 100%" height="500" size="mini" highlight-current-row border>
<el-table-column align="center" label="原材料名称">
<template slot-scope="scope">
{{ scope.row.原材料名称 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-col>
</el-row>
<el-row style="margin-top: 10px">
<el-table :data="tableData" style="width: 100%" height="500" size="mini" highlight-current-row border>
<el-table-column align="center" label="原材料名称">
<template slot-scope="scope">
{{ scope.row.原材料名称 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-row>
</el-card>
</div>
</template>
<script>
import { searchTableData } from '@/api/ManufacturingCenter/SparePartsPurchase'
export default {
data() {
return {
RawMaterialNumber: '',
RawMaterialName: '',
param: 0,
tableData: [],
pageCurrent: 1,
pageSize: 10,
total: null,
dialogFormVisible: false,
title: '',
form: {
RawMaterialName: ''
},
rules: {
RawMaterialName: [{ required: true, message: '请输入物料名称', trigger: 'blur' }]
}
}
},
created() {
this.searchTableData()
},
methods: {
// 获取原材料
searchTableData() {
searchTableData(this.RawMaterialName, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = parseInt(response.data.total)
})
},
// tabledata分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTableData()
},
// 多选
handleSelectionChange(val) {
this.materielGroup = []
for (let i = 0; i < val.length; i++) {
this.materielGroup.push(val[i].物料流水号)
}
}
}
}
</script>
<style scoped>
span {
margin: 10px 0px 10px 10px;
}
.el-select{
width:190px
}
.el-input{
width:190px
}
</style>

View File

@@ -0,0 +1,493 @@
<template>
<div class="app-container">
<el-card>
<span>项目名称:</span>
<el-select
v-model="entryNameValue"
placeholder="项目名称"
style="width:200px"
size="small"
clearable
filterable
@change="empty">
<el-option
v-for="item in entryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床号:</span>
<el-input v-model="machineToolNumber" placeholder="机床号" size="small" readonly clearable style="width:200px" @change="empty1">
<el-button slot="append" icon="el-icon-search" @click="SearchMachine" />
</el-input>
<span>组号:</span>
<el-input v-model="groupNumber" placeholder="组号" size="small" readonly clearable style="width:200px">
<el-button slot="append" icon="el-icon-search" @click="searchGroupList" />
</el-input>
<span>零件号:</span>
<el-input v-model="partNumber" placeholder="零件号" size="small" clearable style="width:200px"/>
<span>零件状态:</span>
<el-select v-model="partStateValue" placeholder="零件状态" size="small" clearable style="width:200px">
<el-option
v-for="item in partState"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<!--<span>零件类型:</span>-->
<!--<el-select v-model="partTypeValue" placeholder="零件类型" size="small" clearable style="margin-top: 15px;width: 200px">-->
<!--<el-option-->
<!--v-for="item in partType"-->
<!--:key="item.value"-->
<!--:label="item.label"-->
<!--:value="item.value"/>-->
<!--</el-select>-->
<el-button type="success" icon="el-icon-search" size="small" style="margin: 15px 0 0 10px" @click="pageCurrent=1;pageSize=10;total=0;searchData()">查询</el-button>
</el-card>
<el-card>
<el-table
v-loading="loading0"
:data="tableData"
style="width: 100%;max-height: 600px"
height="600"
size="mini"
highlight-current-row
border>
<el-table-column align="center" label="序号" type="index" width="60px"/>
<el-table-column align="center" label="机床图号" width="170px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="140px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件图号" width="200px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件名称" width="180px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="数量" width="60px">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="投产时间" width="130px">
<template slot-scope="scope">
{{ scope.row.传递时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件状态" width="750px">
<template slot-scope="scope">
<el-steps :active="scope.row.考核状态" finish-status="success" simple>
<el-step title="投产" />
<el-step title="工艺" />
<el-step title="定额" />
<el-step title="平衡" />
<el-step title="完成" />
<el-step title="入库" />
<el-step title="出库" />
</el-steps>
</template>
</el-table-column>
<!--<el-table-column label="操作" fixed="right" align="center" width="120px">-->
<!--<template slot-scope="scope">-->
<!--<el-button-->
<!--size="mini"-->
<!--type="primary"-->
<!--icon="el-icon-edit"-->
<!--@click="handleEdit(scope.row)">编辑</el-button>-->
<!--</template>-->
<!--</el-table-column>-->
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible4" center style="min-height: 300px" width="400px">
<el-form label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="零件状态">
<el-select v-model="partStateValue1" placeholder="零件状态" size="small">
<el-option
v-for="item in partState"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel()">取消</el-button>
<el-button type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="选择机床" center style="min-height: 300px">
<el-table
:data="tableData6"
style="width:100%;max-height: 300px;display: inline-block"
height="300"
highlight-current-row
border
@row-click="selectMachine">
<el-table-column align="center" label="机床图号">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床名称">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床开始时间">
<template slot-scope="scope">
{{ scope.row.机床开始时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床结束时间">
<template slot-scope="scope">
{{ scope.row.机床结束时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="工位属性">
<template slot-scope="scope">
{{ scope.row.工位属性 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床主管">
<template slot-scope="scope">
{{ scope.row.机床主管 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize1"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitName">提交</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" title="选择组号" center style="min-height: 300px">
<el-table
:data="tableData7"
style="width:100%;max-height: 300px;display: inline-block"
height="300"
highlight-current-row
border
@row-click="selectGroup">
<el-table-column align="center" label="机床图号">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床名称">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组件名称">
<template slot-scope="scope">
{{ scope.row.组件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="组件介绍">
<template slot-scope="scope">
{{ scope.row.组件介绍 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitGroup">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initProject, intPartState, searchTable, searchmachine, searchgroup, editData } from '@/api/ManufacturingCenter/StatusQuery'
import elInput from 'element-ui/packages/input'
export default {
components: {
elInput
},
data() {
return {
loading0: false,
entryNameValue: '', // 项目流水号
entryName: [], // 项目数组
machineToolNumber: '', // 机床图号
machineNumber: '',
machine: null, // 机床流水号
groupNumber: '', // 组号
groupNumber1: '',
groupNum: null, // 组件流水号
partNumber: '', // 零件号
partStateValue: null, // 零件状态
partStateValue1: null,
partState: [], // 零件状态数组
partTypeValue: null, // 零件类型
num: null,
pageCurrent: 1,
pageSize: 10,
pageCurrent1: 1,
pageSize1: 10,
pageCurrent2: 1,
pageSize2: 10,
tableData7: [],
tableData6: [],
tableData: [],
state: null,
total: null,
total1: null,
total2: null,
title: '',
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
List: [],
check: null,
check1: null,
check2: null,
check3: null,
check4: null,
check5: null,
partType: [{
value: 1,
label: '自家生产'
}, {
value: 2,
label: '外协生产'
}]
}
},
created() {
this.fetchData()
this.getList()
},
methods: {
fetchData() {
intPartState().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partState.push({
label: response.data[i].考核状态名称,
value: response.data[i].考核状态
})
}
})
},
searchData() {
if (this.entryNameValue !== null && this.entryNameValue !== '') {
this.check = 1
} else {
this.check = 0
}
if (this.machineToolNumber !== '') {
this.check1 = 1
} else {
this.check1 = 0
}
if (this.groupNumber !== '') {
this.check2 = 1
} else {
this.check2 = 0
}
if (this.partNumber !== '') {
this.check3 = 1
} else {
this.check3 = 0
}
if (this.partStateValue !== null && this.partStateValue !== '') {
this.check4 = 1
} else {
this.check4 = 0
}
if (this.partTypeValue !== null && this.partTypeValue !== '') {
this.check5 = 1
} else {
this.check5 = 0
}
this.loading0 = true
searchTable(this.check, this.entryNameValue, this.check1, this.machine, this.check2, this.groupNum, this.check3, this.partNumber, this.check4, this.partStateValue, this.check5, this.partTypeValue, this.pageSize, this.pageCurrent).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].考核状态 = parseInt(response.data.rows[i].考核状态) - 2
if (response.data.rows[i].传递时间 !== undefined || response.data.rows[i].hasOwnProperty('传递时间')) {
response.data.rows[i].传递时间 = response.data.rows[i].传递时间.split(' ', 2)[0]
}
}
this.loading0 = false
this.tableData = response.data.rows
this.total = parseInt(response.data.total)
})
},
getList() { // 初始化项目名称
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.entryName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
empty() {
this.machineToolNumber = ''
this.groupNumber = ''
},
SearchMachine() { // 查询机床
if (this.entryNameValue !== null && this.entryNameValue !== '') {
this.dialogFormVisible2 = true
this.check6 = 1
searchmachine(this.entryNameValue, this.check6, this.pageCurrent1, this.pageSize1).then(response => {
for (let i = 0; i < response.data.total; i++) {
if (response.data.rows[i].机床开始时间 !== '') {
response.data.rows[i].机床开始时间 = response.data.rows[i].机床开始时间.substr(0, 10)
}
if (response.data.rows[i].机床结束时间 !== '') {
response.data.rows[i].机床结束时间 = response.data.rows[i].机床结束时间.substr(0, 10)
}
if (response.data.rows[i].工位属性 === '请选择') {
response.data.rows[i].工位属性 = ''
}
if (response.data.rows[i].机床主管 === '请选择') {
response.data.rows[i].机床主管 = ''
}
}
this.tableData6 = response.data.rows
this.total1 = parseInt(response.data.total)
})
} else {
this.$message.warning('请先选择项目')
}
},
selectMachine(row) { // 选择机床号
this.machine = row.机床流水号
this.machineNumber = row.机床图号
},
submitName() { // 提交机床号
this.machineToolNumber = this.machineNumber
this.dialogFormVisible2 = false
},
empty1() {
this.groupNumber = ''
},
searchGroupList() { // 查询组号
if (this.machineToolNumber !== '') {
this.tableData7 = []
this.dialogFormVisible3 = true
searchgroup(this.machine, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData7 = response.data.rows
this.total2 = parseInt(response.data.total)
})
} else {
this.$message.warning('请先选择机床')
}
},
selectGroup(row) { // 选择组号
this.groupNumber1 = row.组号
this.groupNum = row.组件流水号
},
submitGroup() { // 提交组号
this.groupNumber = this.groupNumber1
this.dialogFormVisible3 = false
},
handleEdit(row) {
this.title = '编辑'
this.partStateValue1 = parseInt(row.考核状态) + 2
this.dialogFormVisible4 = true
this.num = row.工艺计划流水号
},
submitEdit() { // 提交编辑
editData(this.num, this.partStateValue1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible4 = false
this.pageCurrent = 1
this.searchData()
} else { this.$message.error('编辑失败') }
})
},
cancel() { // 取消
this.dialogFormVisible4 = false
},
handleSizeChange(val) {
this.pageSize = val
this.searchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchData()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.SearchMachine()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.SearchMachine()
},
handleSizeChange3(val) {
this.pageSize2 = val
this.searchGroupList()
},
handleCurrentChange3(val) {
this.pageCurrent2 = val
this.searchGroupList()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:150px
}
span{
margin: 10px 0 10px 10px;
}
</style>

View File

@@ -0,0 +1,533 @@
<template>
<div>
<el-card>
<!--<el-radio-group v-model="radio" @change="changeType">-->
<!--<el-radio :label="1">自制件</el-radio>-->
<!--<el-radio :label="2">采购部采购</el-radio>-->
<!--<el-radio :label="3">制造部采购</el-radio>-->
<!--</el-radio-group>-->
<span style="display:inline-block;margin-left: 10px">零件图号</span>
<el-autocomplete
v-model="searchPick"
:fetch-suggestions="querySearch"
clearable
style="width: 200px;margin-left: 10px;"
size="small"
class="inline-input"
placeholder="请输入零件图号"
@select="handleSelect"
@clear="clearSelect"
/>
<!--<el-button type="text" @click="show1 = !show1" style="margin-left: 10px">高级查询</el-button>-->
<!--<div v-show="show1" style="margin-top: 20px" class="transition-box">-->
<!--<span style="display:inline-block;margin-left: 10px">项目名称</span>-->
<!--<el-autocomplete-->
<!--v-model="searchCriteria"-->
<!--:fetch-suggestions="querySearch"-->
<!--clearable-->
<!--style="width: 200px;margin-left: 10px;"-->
<!--size="small"-->
<!--class="inline-input"-->
<!--placeholder="请输入零件或物料"-->
<!--@clear="clearSelect"-->
<!--@select="handleSelect"-->
<!--/>-->
<!--<span style="display:inline-block;margin-left: 10px">机床图号</span>-->
<!--<el-input-->
<!--v-model="input_Mobile"-->
<!--:trigger-on-focus="false"-->
<!--clearable-->
<!--size="small"-->
<!--style="width: 200px;margin-right: 10px"-->
<!--placeholder="请输入内容"/>-->
<!--<span style="display:inline-block;margin-left: 10px">组号</span>-->
<!--<el-input-->
<!--v-model="input_Mobile"-->
<!--:trigger-on-focus="false"-->
<!--clearable-->
<!--size="small"-->
<!--style="width: 200px;margin-right: 10px"-->
<!--placeholder="请输入内容"/>-->
<!--<span style="display:inline-block;margin-left: 10px">零件图号</span>-->
<!--<el-input-->
<!--v-model="input_Mobile"-->
<!--:trigger-on-focus="false"-->
<!--clearable-->
<!--size="small"-->
<!--style="width: 200px;margin-right: 10px"-->
<!--placeholder="请输入内容"/>-->
<!--</div>-->
<div>
<el-divider content-position="right">零件档案</el-divider>
<div class="text">
<span style="display:inline-block;margin-left: 10px">零件图号<el-tag size="small">{{ form.零件图号 }}</el-tag></span>
<el-divider direction="vertical"/>
<span style="display:inline-block;margin-left: 10px">零件名称<el-tag size="small">{{ form.零件名称 }}</el-tag></span>
<el-divider direction="vertical"/>
<span style="display:inline-block;margin-left: 10px">投产数量<el-tag size="small">{{ form.投产数量 }}</el-tag></span>
<el-divider direction="vertical"/>
<span style="display:inline-block;margin-left: 10px">所属机床<el-tag size="small">{{ form.所属机床 }}</el-tag></span>
<el-divider direction="vertical"/>
<span style="display:inline-block;margin-left: 10px">所属组件<el-tag size="small">{{ form.所属组件 }}</el-tag></span>
</div>
<el-divider content-position="right">生命周期</el-divider>
<div class="text item">
<el-row>
<el-col :span="3">
<el-timeline style="margin-top: 40px">
<el-timeline-item
v-for="(activity, index) in activities"
:key="index"
:icon="activity.icon"
:type="activity.type"
:color="activity.color"
:size="activity.size"
:timestamp="activity.timestamp">
{{ activity.content }}
</el-timeline-item>
</el-timeline>
</el-col>
<el-col :span="1">
<div style="width:1px;border:0.1px solid #DCDFE6;float:left;height:450px;"/>
</el-col>
<el-col :span="20" style="margin-top: 30px">
<div class="main">
<div v-show="show" style="line-height: 130px;text-align: center">
<div>
请查询
</div>
</div>
<div class="sudoku_row" >
<div v-for="(sudoku,index) in sudokus" :class="curSelect==sudoku.id?'opacity':''" :key="index" class="sudoku_item " @touchstart="touchstart(index)" @touchend="touchend">
<div class="text">
{{ sudoku.id }}
</div>
<div :style="{width: '100px',height: '100px',border: '1px solid grey','text-align': 'center', 'background-color': sudoku.color}" class="text">
<el-row style="margin-top: 10px">
<div style="height: 20px">
{{ sudoku.procedure }}
</div>
</el-row>
<el-row style="margin-top: 2px">
<div style="height: 20px">
{{ sudoku.planningTime }}
</div>
</el-row>
<el-row style="margin-top: 2px">
<div style="height: 20px">
{{ sudoku.actualTime }}
</div>
</el-row>
<el-row style="margin-top: 2px">
<div style="height: 20px">
{{ sudoku.name }}
</div>
</el-row>
</div>
</div>
</div>
</div>
<el-row :gutter="20" style="margin-top: 50px">
<el-col :span="11">
<div style="width: 100%;height: 200px;border: 1px solid #DCDFE6">
<el-row style="margin-top: 15px;margin-right: 15px">
<span style="float: right">备料信息</span>
</el-row>
<el-row style="margin-top: 30px;margin-left: 10px">
<span style="width:80px;margin-left: 10px">备料单<el-tag size="small" type="success">{{ isMaterials }}</el-tag></span>
<span style="width:80px;margin-left: 20px">备料类型<el-tag size="small" type="success">{{ materialsType }}</el-tag></span>
<span style="width:80px;margin-left: 20px">下料员<el-tag size="small" type="success">{{ Cutter }}</el-tag></span>
<span style="width:80px;margin-left: 20px">确认日期<el-tag size="small" type="success">{{ confirmationTime }}</el-tag></span>
</el-row>
<el-row style="margin-top: 30px;margin-left: 30px">
<el-steps :space="200" :active="active" finish-status="success">
<el-step title="创建备料"/>
<el-step title="备料确认"/>
</el-steps>
</el-row>
</div>
</el-col>
<el-col :span="11">
<div style="width: 100%;height: 200px;border: 1px solid #DCDFE6">
<el-row style="margin-top: 15px;margin-right: 15px">
<span style="float: right">外协信息</span>
</el-row>
<el-row style="margin-top: 30px;margin-left: 10px">
<span style="width:80px;margin-left: 10px">是否序间外协<el-tag size="small" type="success">{{ isOut }}</el-tag></span>
<span style="width:80px;margin-left: 20px">外协工序<el-tag size="small" type="success">{{ outName }}</el-tag></span>
<span style="width:80px;margin-left: 20px">检验日期<el-tag size="small" type="success">{{ outTime }}</el-tag></span>
</el-row>
<el-row style="margin-top: 30px;margin-left: 30px;margin-right: 30px">
<el-steps :active="active1" finish-status="success">
<el-step title="序间外协"/>
<el-step title="价格预算"/>
<el-step title="任务执行"/>
<el-step title="到货质检"/>
</el-steps>
</el-row>
</div>
</el-col>
</el-row>
</el-col>
</el-row>
<el-divider content-position="right">跳转链接</el-divider>
<el-row style="margin-left: 20px">
<router-link to="/StatusQuery/index" style="color:dodgerblue">零件状态查询</router-link>
<el-divider direction="vertical"/>
<router-link to="/StatusQuery/index" style="color:dodgerblue">加工进度查询</router-link>
</el-row>
</div>
</div>
</el-card>
</div>
</template>
<script>
import { SelectPart, SelectProcessingProgress, SelectPreparation, SelectOut } from '@/api/ManufacturingCenter/TraceabilityOfParts'
export default {
data() {
return {
isOut: '请查询',
outName: '请查询',
outTime: '请查询',
active: '',
active1: '',
confirmationTime: '请查询',
Cutter: '请查询',
isMaterials: '请查询',
searchPick: '',
materialsType: '请查询',
restaurantsPick: [],
show: true,
show1: false,
// typeA: true,
// typeB: false,
// typeC: false,
radio: 1,
form: {
零件图号: '请查询',
投产数量: '请查询',
所属机床: '请查询',
所属组件: '请查询',
零件名称: '请查询'
},
activities: [{
id: 3,
content: '生产计划下达',
timestamp: '制造部:计划员',
type: '',
size: 'large'
}, {
id: 4,
content: '工艺制定',
timestamp: '工艺部:工艺员',
type: '',
size: 'large'
}, {
id: 5,
content: '定额制定',
timestamp: '工艺部:工艺员',
type: '',
size: 'large'
}, {
id: 6,
content: '生产能力平衡',
timestamp: '制造部:计划员',
type: '',
size: 'large'
}, {
id: 7,
content: '加工',
timestamp: '金工车间:操作工',
type: '',
size: 'large'
}, {
id: 8,
content: '入库',
timestamp: '金工车间:库管员',
type: '',
size: 'large'
}, {
id: 9,
content: '出库',
timestamp: '金工车间:库管员',
type: '',
size: 'large'
}],
sudokus: [],
curSelect: null
}
},
methods: {
// changeType() {
// if(this.radio === 1) {
// this.typeA = true
// this.typeB = false
// this.typeC = false
// } else if(this.radio === 2) {
// this.typeA = false
// this.typeB = true
// this.typeC = false
// } else if(this.radio === 3) {
// this.typeA = false
// this.typeB = false
// this.typeC = true
// }
// },
touchstart: function(e) {
var that = this
var list = that.sudokus
for (var i = 0, len = list.length; i < len; ++i) {
if (list[i].id === e) {
that.curSelect = i
}
}
}, touchend: function() {
var that = this
that.curSelect = null
},
querySearch(queryString, cb) {
this.restaurantsPick = []
if (this.searchPick !== '' && this.searchPick !== null) {
SelectPart(0, '', 0, '', 0, '', 1, this.searchPick, 0, '', 0, '', 0, '', '', '', '').then(response => {
const res = response.data
res.forEach(item => {
this.restaurantsPick.push({
value: item.零件图号,
name: item.工艺计划流水号
})
})
return this.restaurantsPick
}).then(data => {
var restaurants = data
var results = queryString ? restaurants.filter(this.createFilterPick(queryString)) : restaurants
return results
}).then(data => {
cb(data)
})
}
},
createFilterPick(queryString) {
return (restaurant) => {
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) !== -1)
}
},
clearSelect() {
this.active = ''
this.active1 = ''
this.sudokus = []
this.isOut = '请查询'
this.outName = '请查询'
this.outTime = '请查询'
this.confirmationTime = '请查询'
this.Cutter = '请查询'
this.isMaterials = '请查询'
this.materialsType = '请查询'
this.form.零件图号 = '请查询'
this.form.投产数量 = '请查询'
this.form.所属机床 = '请查询'
this.form.所属组件 = '请查询'
this.form.零件名称 = '请查询'
for (let i = 0; i < this.activities.length; i++) {
this.activities[i].type = ''
}
this.show = true
},
handleSelect(item) {
this.sudokus = []
this.show = false
this.active = ''
this.active1 = ''
this.confirmationTime = '请查询'
this.Cutter = '请查询'
this.isMaterials = '请查询'
this.materialsType = '请查询'
this.isOut = '请查询'
this.outName = '请查询'
this.outTime = '请查询'
for (let i = 0; i < this.activities.length; i++) {
this.activities[i].type = ''
}
SelectPart(0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', '', '', item.name).then(response => {
this.form.零件图号 = response.data[0].零件图号
this.form.投产数量 = response.data[0].批次数量
this.form.所属机床 = response.data[0].机床图号
this.form.所属组件 = response.data[0].组号
this.form.零件名称 = response.data[0].零件名称
})
SelectProcessingProgress(item.name).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.sudokus.push({
id: response.data[i].工序顺序,
procedure: response.data[i].工艺名称,
planningTime: response.data[i].计划日期_短,
actualTime: response.data[i].完成日期_短 === null || response.data[i].完成日期_短 === '' ? '未完成' : response.data[i].完成日期_短,
name: response.data[i].完成日期_短 === null || response.data[i].完成日期_短 === '' ? '未完成' : response.data[i].员工姓名,
color: response.data[i].进度颜色
})
}
})
SelectPreparation(item.name).then(response => {
if (response.data.length !== 0) {
if (response.data[0].类型.toString() === '0') {
this.isMaterials = '未创建'
this.materialsType = '未创建'
this.Cutter = '未创建'
this.confirmationTime = '未创建'
this.active = '0'
} else if (response.data[0].类型.toString() === '1') {
this.isMaterials = '已创建'
this.materialsType = '自家备料'
this.Cutter = '未确认'
this.confirmationTime = '未确认'
this.active = '1'
} else if (response.data[0].类型.toString() === '2') {
this.isMaterials = '已创建'
this.materialsType = '外购备料'
this.Cutter = '未确认'
this.confirmationTime = '未确认'
this.active = '1'
} else if (response.data[0].类型.toString() === '3') {
this.isMaterials = '已创建'
this.materialsType = '自家备料'
this.active = '2'
response.data[0].下料员 !== null && response.data[0].下料员 !== '' ? this.Cutter = response.data[0].下料员 : this.Cutter = '未确认'
response.data[0].确认时间 !== null && response.data[0].确认时间 !== '' ? this.confirmationTime = response.data[0].确认时间.substring(0, 10) : this.confirmationTime = '未确认'
} else if (response.data[0].类型.toString() === '4') {
this.isMaterials = '已创建'
this.materialsType = '外购备料'
this.active = '2'
response.data[0].下料员 !== null && response.data[0].下料员 !== '' ? this.Cutter = response.data[0].下料员 : this.Cutter = '未确认'
response.data[0].确认时间 !== null && response.data[0].确认时间 !== '' ? this.confirmationTime = response.data[0].确认时间.substring(0, 10) : this.confirmationTime = '未确认'
}
}
})
SelectPart(0, '', 0, '', 0, '', 1, this.searchPick, 0, '', 0, '', 0, '', '', '', '').then(response => {
console.log(response, 8)
for (let i = 0; i < this.activities.length; i++) {
if (response.data[0].考核状态.toString() === this.activities[i].id.toString()) {
for (let j = 0; j <= i; j++) {
this.activities[j].type = 'success'
}
this.activities[i + 1].type = 'warning'
}
}
})
SelectOut(item.name).then(response => {
console.log(response, 87633)
if (response.data[0].状态编号.toString() === '1') {
this.isOut = '是'
this.active1 = '1'
this.outName = ''
this.outTime = '未到货检验'
for (let i = 0; i < response.data.length; i++) {
if (i === 0) {
this.outName = response.data[i].外协工序
} else {
this.outName = this.outName + '、' + response.data[i].外协工序
}
}
} else if (response.data[0].状态编号.toString() === '2') {
this.isOut = '是'
this.active1 = '2'
this.outName = ''
this.outTime = '未到货检验'
for (let i = 0; i < response.data.length; i++) {
if (i === 0) {
this.outName = response.data[i].外协工序
} else {
this.outName = this.outName + '、' + response.data[i].外协工序
}
}
} else if (response.data[0].状态编号.toString() === '3') {
this.isOut = '是'
this.active1 = '3'
this.outName = ''
this.outTime = '未到货检验'
for (let i = 0; i < response.data.length; i++) {
if (i === 0) {
this.outName = response.data[i].外协工序
} else {
this.outName = this.outName + '、' + response.data[i].外协工序
}
}
} else if (response.data[0].状态编号.toString() === '4') {
this.isOut = '是'
this.active1 = '4'
this.outName = ''
this.outTime = response.data[0].检验日期
for (let i = 0; i < response.data.length; i++) {
if (i === 0) {
this.outName = response.data[i].外协工序
} else {
this.outName = this.outName + '、' + response.data[i].外协工序
}
}
}
})
}
}
}
</script>
<style scoped>
.el-textarea__inner, .el-radio__inner, .el-input__inner{
border: 1px solid #C0C4CC !important
}
.text{
font-size: 14px;
}
.sudoku_row{
height: 120px;
padding: 5px;
/*overflow-x: scroll;*/
display: flex;
align-items: center;
/*flex-wrap: wrap;*/
}
.sudoku_item{
margin-right: 10px;
display: flex;
height: 110px;
justify-content: center;
align-items: center;
flex-direction: column;
/*padding-top: 10px;*/
/*padding-bottom: 10px;*/
}
.opacity{
opacity: 0.4;
background: #e5e5e5;
}
.sudoku_item img{
margin-bottom: 3px;
display: block;
}
.main{
border: 1px solid #DCDFE6;
width:91.5%;
overflow-y: hidden;
overflow-x: auto;
color: #000;
font-size: 16px;
height: 130px;
}
.main p{height:300px;}
/*-------滚动条整体样式----*/
.main::-webkit-scrollbar {
width:8px;
height:8px;
}
/*滚动条里面小方块样式*/
.main::-webkit-scrollbar-thumb {
border-radius:100px;
-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.2);
background:#DCDFE6;
}
/*滚动条里面轨道样式*/
.main::-webkit-scrollbar-track {
-webkit-box-shadow:inset 0 0 5px rgba(0,0,0,0.2);
border-radius:0;
background:white;
}
</style>

View File

@@ -0,0 +1,333 @@
<!--典型工艺维护-->
<template>
<div class="app-container">
<el-card>
<span>零件分类:</span>
<el-select v-model="partsCategoriesValue" size="small" filterable clearable placeholder="零件分类" @change="getPartsName">
<el-option
v-for="item in partsCategories"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件名称:</span>
<el-select v-model="partsNameValue" size="small" filterable clearable placeholder="零件名称" @change="getTableData" >
<el-option
v-for="item in partsName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>典型工艺号:</span>
<el-input v-model="typicalNumValue" auto-complete="off" style="width: 100px" size="small" readonly/>
<el-button size="small" type="success" icon="el-icon-search" style="margin-left: 10px" @click="total=0;pageCurrent=1;pageSize=20;getTableData()">查询</el-button>
<el-button size="small" type="primary" icon="el-icon-circle-plus-outline" style="margin-left: 10px" @click="addTableData">增加</el-button>
<el-button size="small" type="warning" icon="el-icon-menu" style="margin-left: 10px" @click="editConfirm">保存</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" border style="width: 100%;max-height: 550px;" size="mini" height="550px">
<el-table-column prop="num" label="序号" width="50" align="center" type="index">
<template slot-scope="scope">
{{ scope.row.工艺序号 }}
</template>
</el-table-column>
<el-table-column prop="name" label="工艺名称" width="230" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.工艺名称"
size="mini"
style="width:200px"
placeholder="工艺名称"
@dblclick.native="tableSearch(scope.$index)"/>
</template>
</el-table-column>
<el-table-column prop="hard" label="难度等级" width="110" align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.工艺难度等级" size="mini" placeholder="请选择" @change="difficultyLevel(scope.row)">
<el-option v-for="item in hard" :key="item.value" :label="item.label" :value="item.value">
<span style="color: #8492a6; font-size: 13px">{{ item.value }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="request" label="工艺要求" align="center" min-width="350">
<template slot-scope="scope">
<el-input
v-model="scope.row.工艺要求"
:rows="1"
size="mini"
placeholder="工艺要求"
type="textarea"
@dblclick.native="tableSearch(scope.$index)"/>
</template>
</el-table-column>
<el-table-column prop="name" label="单件" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.单件定额工时" size="mini" style="width:90px" placeholder="单件定额"/>
</template>
</el-table-column>
<el-table-column prop="name" label="准结" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.准结定额工时" size="mini" style="width:90px" placeholder="准结定额"/>
</template>
</el-table-column>
<el-table-column label="操作" width="300" align="center" fixed="right">
<template slot-scope="scope">
<div>
<el-button
size="mini"
icon="el-icon-arrow-up"
type="primary"
@click="upMove(scope.row)"/>
<el-button
size="mini"
icon="el-icon-arrow-down"
type="primary"
@click="downMove(scope.row)"/>
<el-button
size="mini"
icon="el-icon-circle-plus-outline"
type="primary"
@click="insertRow(scope.row)"/>
<el-button
size="mini"
icon="el-icon-delete"
type="danger"
@click="delRow(scope.row)"/>
</div>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[20, 30, 40, 50]"
: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="dialogFormVisible" title="工艺名称、工艺要求选择" center width="400px">
<el-form ref="form" :model="form" label-position="left" label-width="125px" class="demo-ruleForm">
<el-form-item label="工艺名称分类">
<el-select v-model="form.processNameClassValue" placeholder="分类" size="small" @change="classificationChange()">
<el-option
v-for="item in processNameClass"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="工艺名称">
<el-select v-model="form.processNameValue" placeholder="名称" size="small" @change="nameChange()">
<el-option
v-for="item in processName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="工艺要求">
<el-select v-model="form.processRequestValue" placeholder="要求" size="small">
<el-option
v-for="item in processRequest"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="confirmSelect()">确定选择</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { getPartsCategories, getPartsName, getTableData, upMove, downMove, deleRow, editConfirm, processNameSelect, processRequestSelect, processNameClick, insertRow, difficultyLevel, isAddOrEdit, addProcess } from '@/api/ManufacturingCenter/TypicalProcessMaintenance'
export default {
data() {
return {
pageCurrent: 1,
pageSize: 20,
total: 0,
partsCategories: [],
partsCategoriesCheck: null,
partsCategoriesValue: '',
partsName: [],
partsNameCheck: null,
partsNameValue: '',
typicalNumValue: '',
tableData: [],
loading: false,
hard: [{ value: 'A' }, { value: 'B' }, { value: 'C' }],
dialogFormVisible: false,
form: {
processNameClassValue: '',
processNameValue: '',
processRequestValue: ''
},
processNameClass: [],
processName: [],
processRequest: [],
index: null
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.getSelect(getPartsCategories, ['典型工艺名称分类', '典型工艺名称分类流水号'], 'partsCategories')
},
getPartsName() {
this.typicalNumValue = ''
this.partsName = []
this.partsNameValue = ''
getPartsName(this.partsCategoriesValue).then(res => {
const data = res.data
data.length > 0 ? this.partsNameValue = data[0].典型工艺流水号 : this.partsNameValue = ''
this.typicalNumValue = data.length > 0 ? data[0].典型工艺号 : ''
data.map(item => {
this.partsName.push({
label: item.典型工艺名称,
value: item.典型工艺流水号
})
})
})
},
getTableData() {
this.partsCategoriesValue ? this.partsCategoriesCheck = 1 : this.partsCategoriesCheck = 0
this.partsNameValue ? this.partsNameCheck = 1 : this.partsNameCheck = 0
if (this.partsCategoriesCheck === 0 && this.partsNameCheck === 0) {
this.$message.error('请选择查询条件')
} else {
this.loading = true
getTableData(this.pageCurrent, this.pageSize, this.partsCategoriesCheck, this.partsCategoriesValue, this.partsNameCheck, this.partsNameValue).then(res => {
this.loading = false
this.tableData = res.data.rows
this.total = res.data.total
})
}
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getTableData()
},
upMove(row) {
upMove(row.典型工艺流水号, row.典型工艺工序流水号).then(res => {
if (res.data[0].result === '1') {
this.getTableData()
}
})
},
downMove(row) {
downMove(row.典型工艺流水号, row.典型工艺工序流水号).then(res => {
if (res.data[0].result === '1') {
this.getTableData()
}
})
},
insertRow(row) {
insertRow(row.典型工艺流水号, row.典型工艺工序流水号).then(res => {
if (res.data[0].result === '1') {
this.getTableData()
}
})
},
delRow(row) {
deleRow(row.典型工艺流水号, row.典型工艺工序流水号).then(res => {
if (res.data[0].result === '1') {
this.getTableData()
}
})
},
editConfirm() {
let index = 0
this.tableData.map(row => {
editConfirm(row.典型工艺流水号, row.典型工艺工序流水号, row.工艺序号, row.工艺编号, row.工艺要求, row.单件定额工时, row.准结定额工时, row.备注).then(res => {
if (res.data[0].result === '1') {
index++
} else {
this.$message.error('零件工艺保存失败')
}
if (index === this.tableData.length) {
this.$message.success('保存修改成功')
this.getTableData()
}
})
})
},
tableSearch(index) {
this.index = index
this.dialogFormVisible = true
this.processNameClass = []
this.processName = []
this.form.processNameClassValue = ''
this.form.processNameValue = ''
this.form.processRequestValue = ''
this.getSelect(processNameClick, ['工艺分类名称', '工艺分类流水号'], 'processNameClass')
},
classificationChange() {
this.processName = []
this.processRequest = []
this.form.processNameValue = ''
this.form.processRequestValue = ''
this.getSelect(processNameSelect, ['工艺名称', '工艺编号'], 'processName', this.form.processNameClassValue)
},
nameChange() {
this.form.processRequestValue = ''
this.processRequest = []
this.getSelect(processRequestSelect, ['工艺要求'], 'processRequest', this.form.processNameValue)
},
confirmSelect() {
this.dialogFormVisible = false
for (let i = 0, len = this.processName.length; i < len; i++) {
if (this.processName[i].value === this.form.processNameValue) {
this.tableData[this.index].工艺名称 = this.processName[i].label
break
}
}
this.tableData[this.index].工艺编号 = this.form.processNameValue
this.tableData[this.index].工艺要求 = this.form.processRequestValue
},
difficultyLevel(row) {
difficultyLevel(row.工艺难度等级, row.典型工艺工序流水号)
},
async addTableData() {
if (this.partsNameValue) {
const result = await isAddOrEdit(this.partsNameValue)
if (result.data.length === 0) {
for (let i = 1; i < 21; i++) {
await addProcess(this.partsNameValue, i, 0)
}
this.getTableData()
} else {
this.$message.warning(`改工艺已存在!请修改工艺`)
}
} else {
this.$message.warning('请选择零件名称')
}
}
}
}
</script>
<style scoped>
span{
margin: 20px;
}
.el-card{
margin-bottom: 15px;
}
</style>

View File

@@ -0,0 +1,400 @@
<template>
<div class="app-container">
<el-card>
<span>设备名称:</span>
<el-input v-model="equipmentName" placeholder="设备名称" size="small" clearable style="width:200px;margin-left: 10px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left:30px" @click="pageCurrent = 1;fetchData()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-circle-plus-outline" style="margin-left:10px" @click="handleAdd()">增加</el-button>
</el-card>
<el-card>
<el-table :data="List" border size="small" height="500px">
<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.设备加工能力工时 }}
</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-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 type="primary" size="mini" icon="el-icon-edit" style="margin-left:10px" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
: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>
<span>有效时间</span>
<el-date-picker
v-model="time"
type="date"
size="small"
value-format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-tooltip effect="dark" content="设定设备参数有效时间" placement="top">
<el-button type="primary" size="small" icon="el-icon-setting" style="margin-left:10px" @click="setUp">设定</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="生成有效时间内设备加工能力" placement="top">
<el-button type="success" size="small" icon="el-icon-edit-outline" style="margin-left:10px" @click="generate">生成设备加工能力</el-button>
</el-tooltip>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="120px" class="demo-ruleForm">
<el-row>
<el-col :span = "12">
<el-form-item label="设备名称" prop="设备名称" >
<el-input v-model="form.设备名称" placeholder="设备名称" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="设备编号" prop="设备编号" >
<el-input v-model="form.设备编号" placeholder="设备编号" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span = "12">
<el-form-item label="设备型号" prop="设备型号" >
<el-input v-model="form.设备型号" placeholder="设备型号" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="设备加工工艺" prop="设备加工工艺" >
<el-select v-model="form.设备加工工艺" placeholder="设备加工工艺" filterable size="small" style="width:200px" clearable >
<el-option
v-for="item in processingName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-show="title!=='增加'">
<el-col :span = "12">
<el-form-item label="设备加工能力" prop="设备加工能力" >
<el-input v-model="form.设备加工能力" placeholder="设备加工能力" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="设备性能指标" prop="设备性能指标" >
<el-input v-model="form.设备性能指标" placeholder="设备性能指标" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row v-show="title!=='增加'">
<el-col :span = "12">
<el-form-item label="班次类型" prop="班次类型" >
<el-select v-model="form.班次类型" placeholder="班次类型" size="small" style="width:200px" clearable >
<el-option
v-for="item in typeOfShift"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="设备工时系数" prop="设备工时系数" >
<el-input v-model="form.设备工时系数" placeholder="设备工时系数" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row v-show="title!=='增加'">
<el-col :span = "12">
<el-form-item label="整改工时系数" prop="整改工时系数" >
<el-input v-model="form.整改工时系数" placeholder="整改工时系数" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
<el-col :span = "12">
<el-form-item label="预留工时系数" prop="预留工时系数" >
<el-input v-model="form.预留工时系数" placeholder="预留工时系数" size="small" style="width:200px" clearable />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getData, initProcessing, addTable, editTable, deleteTable, setUp, generate } from '@/api/ManufacturingCenter/WorkshopEquipmentManagement'
export default {
data() {
return {
equipmentName: '', // 设备名称
List: [],
check: 0,
time: '',
pageCurrent: 1,
pageSize: 10,
total: null,
title: '',
dialogFormVisible: false,
processingName: [],
processing1: '', // 工艺名称简称
equipmentSerialNumber: '', // 设备流水号
typeOfShift: [
{ value: '0', label: 0 },
{ value: '1', label: 1 },
{ value: '2', label: 2 },
{ value: '3', label: 3 },
{ value: '4', label: 4 }],
form: {
设备名称: '',
设备编号: '',
设备型号: '',
设备性能指标: '',
设备加工能力: '',
设备加工工艺: '',
班次类型: '',
设备工时系数: '',
整改工时系数: '',
预留工时系数: ''
},
rules: {
设备名称: [{ required: true, message: '请选择设备名称', change: 'blur' }],
设备编号: [{ required: true, message: '请选择设备编号', change: 'blur' }],
设备型号: [{ required: true, message: '请选择设备型号', change: 'blur' }],
设备加工工艺: [{ required: true, message: '请选择设备加工工艺', trigger: 'blur' }]
// 设备加工能力: [{ required: true, message: '请选择设备加工能力', change: 'blur' }],
// 班次类型: [{ required: true, message: '请选择班次类型', trigger: 'blur' }],
// 设备工时系数: [{ required: true, message: '请选择设备工时系数', change: 'blur' }],
// 整改工时系数: [{ required: true, message: '请选择整改工时系数', change: 'blur' }],
// 预留工时系数: [{ required: true, message: '请选择预留工时系数', change: 'blur' }]
}
}
},
created() {
this.initialization()
this.fetchData()
},
methods: {
fetchData() {
this.List = []
if (this.equipmentName !== '') {
this.check = 1
} else {
this.check = 0
}
getData(this.check, this.equipmentName, this.pageCurrent, this.pageSize).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
},
initialization() {
initProcessing().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.processingName.push({
label: response.data[i].工艺名称,
value: response.data[i].工艺编号,
processing: response.data[i].工艺名称简称
})
}
})
},
handleAdd() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.title = '新增车间设备'
this.form = {
设备名称: '',
设备编号: '',
设备型号: '',
设备加工工艺: ''
}
this.form.设备性能指标 = 1
this.form.设备加工能力 = 1
this.form.班次类型 = 1
this.form.设备工时系数 = 1
this.form.整改工时系数 = 0
this.form.预留工时系数 = 0
this.dialogFormVisible = true
},
handleEdit(row) {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.title = row.设备名称
this.dialogFormVisible = true
this.form.设备名称 = row.设备名称
this.form.设备编号 = row.设备编号
this.form.设备型号 = row.设备型号
this.form.设备性能指标 = row.设备性能指标
this.form.设备加工能力 = row.设备加工能力工时
this.form.设备加工工艺 = parseInt(row.工艺属性代码)
this.form.班次类型 = row.班次类型
this.form.设备工时系数 = row.设备工时系数
this.form.整改工时系数 = row.整改工时比例
this.form.预留工时系数 = row.设备预留工时系数
this.equipmentSerialNumber = row.设备流水号
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.title === '增加') {
this.submitAdd()
} else if (this.title === '编辑') {
this.submitEdit()
}
}
})
},
submitAdd() {
for (let i = 0; i < this.processingName.length; i++) {
if (this.form.设备加工工艺 === this.processingName[i].value) {
this.processing1 = this.processingName[i].processing
}
}
addTable(this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备加工能力, this.form.设备工时系数, this.processing1, 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.dialogFormVisible = false
this.fetchData()
} else {
this.$message.error('信息添加失败')
}
})
},
submitEdit() {
editTable(this.equipmentSerialNumber, this.form.设备名称, this.form.设备型号, this.form.设备性能指标, 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.dialogFormVisible = false
this.title = ''
this.fetchData()
} else {
this.$message.error('信息编辑失败')
}
})
},
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
handleDelete(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.List && this.List.length === 1 && this.pageCurrent > 1) {
this.pageCurrent--
}
deleteTable(row.设备流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.fetchData()
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
setUp() {
if (this.time !== '') {
setUp(this.time).then(response => {
if (response.data[0].result === '1') {
this.$message.success('设定成功')
} else { this.$message.error('设定失败') }
})
} else {
this.$message.warning('请选择有效时间')
}
},
generate() {
generate().then(response => {
if (response.data[0].result === '1') {
this.$message.success('生成成功')
} else { this.$message.error('生成失败') }
})
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.fetchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.fetchData()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
</style>

View File

@@ -0,0 +1,224 @@
/* eslint-disable */
require('script-loader!file-saver');
// import XLSX from 'xlsx'
import XLSX from 'xlsx-style'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
headerGroup,
dataGroup,
sheetGroup,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
var wb = new Workbook()
for (let i = 0; i < dataGroup.length; i++) {
/* original data */
let data = dataGroup[i]
filename = filename || 'excel-list'
data = [...data]
data.unshift(headerGroup[i]);
var ws_name = sheetGroup[i];
var ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
let R = 0;
data.map(item => {
let C = 0;
item.map(itm => {
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
var cell = {v: itm }
cell.s= {
alignment: {
horizontal: "center"
}
}
ws[cell_ref] = cell;
C++;
})
R++;
})
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -0,0 +1,24 @@
// 导出Excel方法表格id不加扩展名的文件名sheet名
export function exportExcelMethod(tableId, fileName, sheetName) {
tableToExcel(tableId, fileName, sheetName)
}
const tableToExcel = (function() {
const uri = 'data:application/vnd.ms-excel;base64,'
// 设置导出表格的单元格默认高度/宽度/边框样式/字体颜色/背景颜色/居中网页显示表格宽度建议1240tr/td视情况而定
const template = `<html xmlns:x="urn:schemas-microsoft-com:office:excel"><head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><meta charset="UTF-8"><style type="text/css">table td {border: 1px solid #000000;height:40px;text-align: center;color: #000000;}</style></head><body><table>{table}</table></body></html>`
const base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
const format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p] }) }
return function(table, filename, sheetname) {
if (!table.nodeType) table = document.getElementById(table)
const ctx = { worksheet: sheetname || 'Worksheet', table: table.innerHTML }
const blob = new Blob([format(template, ctx)])
if ('msSaveOrOpenBlob' in navigator) {
window.navigator.msSaveOrOpenBlob(blob, filename + '.xls')
return
}
const aTag = document.createElement('a')
aTag.href = uri + base64(format(template, ctx))
aTag.download = filename
aTag.click()
}
})()

View File

@@ -0,0 +1,489 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>操作者:</span>
<el-input v-model="workerName" placeholder="操作者" size="small" clearable style="width:200px"/>
<span class="demonstration">完成加工时间:</span>
<el-date-picker
v-model="startTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 160px"
type="date"
placeholder="选择日期"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 10px 0 0 10px" @click="pageCurrent=1;total = 0;searchTable();">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="exportUninquirySheet1()">导出</el-button>
</el-row>
</el-card>
<el-card>
<el-col :span="6">
<el-table v-loading="loading" :data="tableData" highlight-current-row height="500" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable2">
<el-table-column label="操作者" align="center" width="110px">
<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 style="margin: 10px">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-size="pageSize"
:total="total"
layout="total, prev, pager, next"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-col>
<el-col :span="17" style="margin-left: 30px;">
<el-table v-loading="loading2" :data="tableData2" height="500" style="width: 100%;" border element-loading-text="拼命加载中">
<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="130px">
<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="100px">
<template slot-scope="scope">
{{ scope.row.完成数量 }}
</template>
</el-table-column>
<el-table-column label="理论工时" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.理论加工时间段 }}
</template>
</el-table-column>
<el-table-column label="实际工时" align="center" 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>
<div style="margin: 10px">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-size="pageSize2"
:total="total2"
layout="total, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-col>
</el-card>
<el-card>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="searchTable4();searchTable6()">
<el-option
v-for="item in machineNumber"
: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.name }}</div>
</el-option>
</el-select>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="exportUninquirySheet2()">机床导出</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="exportUninquirySheet3()">组件导出</el-button>
</el-card>
<el-card>
<el-col :span="6">
<el-table v-loading="loading3" :data="tableData3" highlight-current-row height="580" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable5">
<el-table-column label="机床编号" align="center" width="110px">
<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 style="margin: 10px">
<el-pagination
v-if="!loading3"
:current-page="pageCurrent3"
:page-size="pageSize3"
:total="total3"
layout="total, prev, pager, next"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
</el-col>
<el-col :span="17" style="margin-left: 30px;">
<el-table v-loading="loading4" :data="tableData4" height="580" style="width: 100%;" border element-loading-text="拼命加载中">
<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="120px">
<template slot-scope="scope">
{{ scope.row.实际加工时间段 }}
</template>
</el-table-column>
</el-table>
<div style="margin: 10px">
<el-pagination
v-if="!loading4"
:current-page="pageCurrent4"
:page-size="pageSize4"
:total="total4"
layout="total, prev, pager, next, jumper"
@size-change="handleSizeChange4"
@current-change="handleCurrentChange4"/>
</div>
</el-col>
</el-card>
</div>
</template>
<script>
import { searchtable, searchtable2, searchtable4, searchtable5, initProject, searchtable55, searchtable11, searchtable44 } from '@/api/ManufacturingCenter/machiningHoursStatistics'
export default {
data() {
return {
workerName: '',
startTime: '',
endTime: '',
loading: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1, // 后台获取页
gongzuozhebianhao: '',
machinenumber: '',
personname: '',
machineNumberValue: '',
machineNumber: [],
loading2: false,
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1, // 后台获取页
loading3: false,
tableData3: [], // 表格数据
total3: null, // 总条数
pageSize3: 10, // 每页显示条数
pageCurrent3: 1, // 后台获取页
loading4: false,
tableData4: [], // 表格数据
total4: null, // 总条数
pageSize4: 10, // 每页显示条数
pageCurrent4: 1 // 后台获取页
}
},
created() {
this.initProject()
this.searchTable()
this.searchTable4()
},
methods: {
// 导出
exportUninquirySheet3() {
if (this.machineNumberValue === null) {
this.machineNumberValue = ''
}
searchtable55(this.machineNumberValue).then(res1 => {
console.log(res1.data)
if (res1.data.length === 0) {
this.$message.error('请选择机床')
return
}
import('./Export2Excel').then(excel => {
const filterVal1 = ['机床图号', '组号', '理论加工时间段', '实际加工时间段'] // tableData1里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
const dataGroup = []
dataGroup.push(data1)
const headerGroup = [['机床编号', '组号', '理论工时', '实际工时']]
const sheetGroup = ['工时明细表']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: res1.data[0]['机床图号'] + '_工时明细表',
autoWidth: true,
bookType: 'xlsx'
})
})
})
},
// 导出
exportUninquirySheet2() {
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check1 = 1 } else { this.check1 = 0 }
searchtable44(0, this.machineNumberValue).then(res1 => {
if (res1.data.length === 0) {
this.$message.error('请选择机床')
return
}
import('./Export2Excel').then(excel => {
const filterVal1 = ['机床图号', '理论加工时间段', '实际加工时间段'] // tableData1里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
const dataGroup = []
dataGroup.push(data1)
const headerGroup = [['机床编号', '理论工时', '实际工时']]
const sheetGroup = ['工时明细表']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '机床工时明细表',
autoWidth: true,
bookType: 'xlsx'
})
})
})
},
// 导出
exportUninquirySheet1() {
if (this.startTime !== '' && this.startTime !== null && this.endTime !== null && this.endTime !== null) {
this.timeCheck = 1
} else {
this.startTime = ''
this.endTime = ''
this.timeCheck = 0
}
if (this.workerName !== '' && this.workerName !== null) {
this.workerName_ckeck = 1
} else {
this.workerName_ckeck = 0
}
searchtable11(this.workerName_ckeck, this.workerName, this.timeCheck, this.startTime, this.endTime).then(res1 => {
if (res1.data.length === 0) {
this.$message.error('请选择人员')
return
}
import('./Export2Excel').then(excel => {
const filterVal1 = ['姓名', '理论加工时间段', '实际加工时间段'] // tableData1里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
const dataGroup = []
dataGroup.push(data1)
const headerGroup = [['操作者', '理论工时', '实际工时']]
const sheetGroup = ['人员工时明细表']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '工时明细表',
autoWidth: true,
bookType: 'xlsx'
})
})
})
},
initProject() {
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.tableData2 = []
this.total2 = 0
if (this.startTime !== '' && this.startTime !== null && this.endTime !== null && this.endTime !== null) {
this.timeCheck = 1
} else {
this.startTime = ''
this.endTime = ''
this.timeCheck = 0
}
if (this.workerName !== '' && this.workerName !== null) {
this.workerName_ckeck = 1
} else {
this.workerName_ckeck = 0
}
searchtable(this.workerName_ckeck, this.workerName, this.timeCheck, this.startTime, this.endTime, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
this.total = response.data.total
this.tableData = response.data.rows
}
}).then(() => {
this.loading = false
})
},
searchTable2(row) {
this.loading2 = true
this.tableData2 = []
this.pageCurrent2 = 1
this.gongzuozhebianhao = row.人员编号
this.personname = row.姓名
searchtable2(row.人员编号, this.timeCheck, this.startTime, this.endTime, this.pageCurrent2, this.pageSize2).then(response => {
if (response.data.total === 0) {
this.loading2 = false
} else {
this.total2 = response.data.total
this.tableData2 = response.data.rows
}
}).then(() => {
this.loading2 = false
})
},
searchTable3(row) {
this.loading2 = true
this.tableData2 = []
searchtable2(this.gongzuozhebianhao, this.timeCheck, this.startTime, this.endTime, this.pageCurrent2, this.pageSize2).then(response => {
if (response.data.total === 0) {
this.loading2 = false
} else {
this.total2 = response.data.total
this.tableData2 = response.data.rows
}
}).then(() => {
this.loading2 = false
})
},
// 查询表格数据
searchTable4() {
this.loading3 = true
this.tableData3 = []
this.tableData4 = []
this.total3 = 0
if (this.machineNumberValue !== '' && this.machineNumberValue !== null) { this.check1 = 1 } else { this.check1 = 0 }
searchtable4(this.check1, this.machineNumberValue, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading3 = false
} else {
this.total3 = response.data.total
this.tableData3 = response.data.rows
}
}).then(() => {
this.loading3 = false
})
},
searchTable5(row) {
this.loading4 = true
this.tableData4 = []
this.pageCurrent4 = 1
this.machineNumberValue = parseInt(row.机床流水号)
searchtable5(this.machineNumberValue, this.pageCurrent4, this.pageSize4).then(response => {
if (response.data.total === 0) {
this.loading4 = false
} else {
this.total4 = response.data.total
this.tableData4 = response.data.rows
}
}).then(() => {
this.loading4 = false
})
},
searchTable6(row) {
this.loading4 = true
this.tableData4 = []
searchtable5(this.machineNumberValue, this.pageCurrent4, this.pageSize4).then(response => {
if (response.data.total === 0) {
this.loading4 = false
} else {
this.total4 = response.data.total
this.tableData4 = response.data.rows
}
}).then(() => {
this.loading4 = false
})
},
// 分页
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.searchTable3()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable3()
},
// 分页
handleSizeChange3(val) {
this.pageCurrent3 = 1
this.pageSize3 = val
this.searchTable4()
},
handleCurrentChange3(val) {
this.pageCurrent3 = val
this.searchTable4()
},
handleSizeChange4(val) {
this.pageCurrent4 = 1
this.pageSize4 = val
this.searchTable6()
},
handleCurrentChange4(val) {
this.pageCurrent4 = val
this.searchTable6()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 10px;
}
</style>