更新
This commit is contained in:
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-row>
|
||||
<el-date-picker
|
||||
v-model="time"
|
||||
size="small"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="加工日期"
|
||||
style="width: 140px;margin-top: 10px"
|
||||
clearable
|
||||
@change="change"/>
|
||||
<el-select v-model="Person" style="width:100px" placeholder="操作工" size="small" filterable clearable>
|
||||
<el-option
|
||||
v-for="item in Persons"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<el-input v-model="partNumber" size="small" placeholder="零件图号" style="width: 150px" clearable/>
|
||||
<el-input v-model="partName" size="small" placeholder="零件名称" style="width: 140px" clearable/>
|
||||
<el-input v-model="procedureName" size="small" placeholder="工序名称" style="width: 100px" clearable/>
|
||||
<span>数量</span>
|
||||
<el-input-number v-model="number" :min="0" :step="1" size="small" placeholder="数量" style="width: 120px" clearable/>
|
||||
<span>单件工时</span>
|
||||
<el-input-number v-model="workTime" :min="0" :step="1" size="small" placeholder="单件工时" style="width: 120px" clearable/>
|
||||
<el-select v-model="PersonLiable" style="width:100px" placeholder="责任人" size="small" filterable clearable>
|
||||
<el-option
|
||||
v-for="item in Persons"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<el-select v-model="ConfirmingPerson" style="width:100px" placeholder="确认人" size="small" filterable clearable>
|
||||
<el-option
|
||||
v-for="item in Persons"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-button type="primary" size="small" icon="el-icon-plus" style="margin-left: 10px" @click="saveDate">保存</el-button>
|
||||
<el-button type="success" size="small" icon="el-icon-edit" style="margin-left: 10px" @click="editDate">编辑</el-button>
|
||||
<el-button type="danger" size="small" icon="el-icon-delete" style="margin-left: 10px" @click="deleteDate">删除</el-button>
|
||||
<el-date-picker
|
||||
v-model="monthValue"
|
||||
type="month"
|
||||
size="small"
|
||||
value-format="yyyy-MM"
|
||||
style="margin-left: 400px; width: 140px"
|
||||
placeholder="选择月"/>
|
||||
<el-button type="success" size="small" icon="el-icon-search" style="margin-top: 10px;margin-bottom: 10px" @click="fetchDate">查询</el-button>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-table v-loading="" :data="tableData" border stripe style="width: 100%" height="730px" size="mini" highlight-current-row @row-click="searchTable">
|
||||
<el-table-column label="加工日期" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.加工日期 ? scope.row.加工日期.split(' ')[0] : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作工" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.操作工姓名 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零件图号" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件图号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零件名称" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序名称" align="center" width="100">
|
||||
<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" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.单件工时 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="责任人" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.责任人姓名 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="确认人" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.确认人姓名 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="录入人" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.录入人姓名 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchPerson, fetchDate, saveDate, editDate, deleteDate } from '@/api/ManufacturingCenter/Enter0therData.js'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
time: '',
|
||||
Person: '',
|
||||
Persons: [],
|
||||
partNumber: '',
|
||||
partName: '',
|
||||
procedureName: '',
|
||||
number: '',
|
||||
workTime: '',
|
||||
PersonLiable: '',
|
||||
ConfirmingPerson: '',
|
||||
tableData: [],
|
||||
monthValue: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'sidebar',
|
||||
'avatar',
|
||||
'name',
|
||||
'userId',
|
||||
'id' // 人员编号
|
||||
])
|
||||
},
|
||||
created() {
|
||||
this.searchPerson()
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
console.log(this.time.slice(0, 7))
|
||||
},
|
||||
searchPerson() {
|
||||
searchPerson().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.Persons.push({
|
||||
label: response.data[i].姓名,
|
||||
value: response.data[i].人员编号
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
fetchDate() {
|
||||
if (this.monthValue) {
|
||||
fetchDate(this.monthValue).then(response => {
|
||||
this.tableData = response.data
|
||||
})
|
||||
} else {
|
||||
this.$message.warning('请选择月份进行查询')
|
||||
}
|
||||
},
|
||||
saveDate() {
|
||||
if (this.time && this.Person && this.partNumber && this.partName && this.procedureName && this.number && this.workTime) {
|
||||
saveDate(this.time, this.Person, this.partNumber, this.partName, this.procedureName, this.PersonLiable, this.ConfirmingPerson, this.id, this.number, this.workTime).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('增加成功')
|
||||
this.monthValue = this.time.slice(0, 7)
|
||||
this.RemoveDate()
|
||||
this.fetchDate()
|
||||
} else {
|
||||
this.$message.success('增加失败')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.warning('请完善信息')
|
||||
}
|
||||
},
|
||||
editDate() {
|
||||
if (this.time && this.Person && this.partNumber && this.partName && this.procedureName && this.number && this.workTime) {
|
||||
editDate(this.ID, this.time, this.Person, this.partNumber, this.partName, this.procedureName, this.PersonLiable, this.ConfirmingPerson, this.id, this.number, this.workTime).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('编辑成功')
|
||||
this.monthValue = this.time.slice(0, 7)
|
||||
this.RemoveDate()
|
||||
this.fetchDate()
|
||||
} else {
|
||||
this.$message.success('编辑失败')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.warning('请完善信息')
|
||||
}
|
||||
},
|
||||
deleteDate() {
|
||||
this.$confirm('确定删除该数据?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteDate(this.ID).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('删除成功')
|
||||
this.RemoveDate()
|
||||
this.fetchDate()
|
||||
} else { this.$message.error('删除失败') }
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
RemoveDate() {
|
||||
this.time = ''
|
||||
this.Person = ''
|
||||
this.partNumber = ''
|
||||
this.partName = ''
|
||||
this.number = 0
|
||||
this.workTime = 0
|
||||
this.procedureName = ''
|
||||
this.PersonLiable = ''
|
||||
this.ConfirmingPerson = ''
|
||||
},
|
||||
searchTable(row) {
|
||||
this.time = row.加工日期
|
||||
this.Person = row.操作工流水号
|
||||
this.partNumber = row.零件图号
|
||||
this.partName = row.名称
|
||||
this.procedureName = row.工序
|
||||
this.number = row.数量
|
||||
this.workTime = row.单件工时
|
||||
this.PersonLiable = row.责任人流水号
|
||||
this.ConfirmingPerson = row.确认人流水号
|
||||
this.ID = row.ID
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user