311 lines
8.8 KiB
Vue
311 lines
8.8 KiB
Vue
<template>
|
|
<div class="mod-config">
|
|
<el-button type="primary" @click="submit()" size="small">提交</el-button>
|
|
<el-form
|
|
ref="dataForm"
|
|
:model="dataForm"
|
|
:rules="rules"
|
|
size="medium"
|
|
label-width="110px"
|
|
>
|
|
<div>
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="开始加工时间" prop="startTime">
|
|
<el-date-picker
|
|
v-model="dataForm.startTime"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
:style="{ width: '100%' }"
|
|
type="datetime"
|
|
placeholder="请选择开始加工时间"
|
|
clearable
|
|
></el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="账号" prop="startUser">
|
|
<el-input
|
|
v-model="dataForm.startUser"
|
|
placeholder="请输入账号"
|
|
readonly
|
|
prefix-icon="el-icon-user-solid"
|
|
:style="{ width: '100%' }"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="配炉号" prop="stoveCode">
|
|
<el-select
|
|
v-model="dataForm.stoveCode"
|
|
:style="{ width: '100%' }"
|
|
filterable
|
|
placeholder="请选择配炉号"
|
|
>
|
|
<el-option
|
|
v-for="item in stoveCodeArr"
|
|
:key="item.id"
|
|
:label="item.code"
|
|
:value="item.code"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="车间编码" prop="workShopCode">
|
|
<el-input
|
|
v-model="dataForm.workShopCode"
|
|
placeholder="请输入车间编码"
|
|
readonly
|
|
:style="{ width: '100%' }"
|
|
>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="工艺号" prop="techCode">
|
|
<el-select
|
|
v-model="dataForm.techCode"
|
|
:style="{ width: '100%' }"
|
|
filterable
|
|
placeholder="请选择工艺号"
|
|
>
|
|
<el-option
|
|
v-for="item in techCodeArr"
|
|
:key="item.id"
|
|
:label="item.craftCode"
|
|
:value="item.craftCode"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="炉号备注" prop="stoveRemark">
|
|
<el-input
|
|
v-model="dataForm.stoveRemark"
|
|
placeholder="请输入炉号备注"
|
|
clearable
|
|
:style="{ width: '100%' }"
|
|
>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input
|
|
v-model="dataForm.remark"
|
|
placeholder="请输入备注"
|
|
clearable
|
|
:style="{ width: '100%' }"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
<el-card class="box-card">
|
|
<div slot="header" class="clearfix">
|
|
<span>生产单</span>
|
|
<el-tooltip effect="dark" content="新增" placement="top">
|
|
<el-button
|
|
style="float: right; padding: 0px;color:#409EFF;font-size:20px;border:none"
|
|
icon="el-icon-circle-plus"
|
|
@click="itemsPlus()"
|
|
></el-button>
|
|
</el-tooltip>
|
|
</div>
|
|
<div v-for="(item, index) in dataForm.items" :key="index">
|
|
<el-row :gutter="20">
|
|
<el-col :span="1">
|
|
<el-tooltip effect="dark" content="删除" placement="top">
|
|
<el-button
|
|
style="color:red"
|
|
icon="el-icon-delete"
|
|
@click="itemsDelete(index)"
|
|
></el-button>
|
|
</el-tooltip>
|
|
</el-col>
|
|
<el-col :span="7">
|
|
<el-form-item label="标识卡号" prop="itemCode">
|
|
<el-input
|
|
v-model="item.itemCode"
|
|
placeholder="请输入标识卡号"
|
|
clearable
|
|
:style="{ width: '100%' }"
|
|
>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="加工数量" prop="quantity">
|
|
<el-input-number
|
|
v-model="item.quantity"
|
|
placeholder="加工数量"
|
|
:step="1"
|
|
></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="加工重量" prop="weight">
|
|
<el-input-number
|
|
v-model="item.weight"
|
|
placeholder="加工重量"
|
|
:step="1"
|
|
></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
</el-card>
|
|
</el-form>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
components: {},
|
|
props: [],
|
|
data () {
|
|
return {
|
|
stoveCodeArr: [],
|
|
techCodeArr: [],
|
|
dataForm: {
|
|
startTime: null,
|
|
startUser: 'QJJP03',
|
|
stoveCode: undefined,
|
|
workShopCode: 'BM',
|
|
techCode: undefined,
|
|
stoveRemark: undefined,
|
|
remark: undefined,
|
|
items: [
|
|
{
|
|
itemCode: undefined,
|
|
quantity: 0,
|
|
weight: 0
|
|
}
|
|
]
|
|
},
|
|
rules: {
|
|
startTime: [
|
|
{
|
|
required: true,
|
|
message: '请选择开始加工时间',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
startUser: [
|
|
{
|
|
required: true,
|
|
message: '请输入账号',
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
stoveCode: [
|
|
{
|
|
required: true,
|
|
message: '请输入配炉号',
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
workShopCode: [
|
|
{
|
|
required: true,
|
|
message: '请输入车间编码',
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
techCode: [],
|
|
stoveRemark: [],
|
|
remark: [],
|
|
itemCode: []
|
|
}
|
|
}
|
|
},
|
|
created () {
|
|
this.init()
|
|
},
|
|
methods: {
|
|
init () {
|
|
this.$http({
|
|
url: this.$http.adornUrl('/kilnInfo/page'),
|
|
method: 'post',
|
|
data: this.$http.adornData({
|
|
current: 1,
|
|
size: 200
|
|
// paramKey: this.dataForm.paramKey
|
|
})
|
|
}).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.stoveCodeArr = data.data.records
|
|
} else {
|
|
this.stoveCodeArr = []
|
|
}
|
|
})
|
|
this.$http({
|
|
url: this.$http.adornUrl('/craftInfo/page'),
|
|
method: 'post',
|
|
data: this.$http.adornData({
|
|
current: 1,
|
|
size: 200
|
|
// paramKey: this.dataForm.paramKey
|
|
})
|
|
}).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.techCodeArr = data.data.records
|
|
} else {
|
|
this.techCodeArr = []
|
|
}
|
|
})
|
|
},
|
|
itemsPlus () {
|
|
const obj = {
|
|
itemCode: undefined,
|
|
quantity: 0,
|
|
weight: 0
|
|
}
|
|
this.dataForm.items.push(obj)
|
|
},
|
|
itemsDelete (index) {
|
|
this.dataForm.items.splice(index, 1)
|
|
},
|
|
submit () {
|
|
this.$refs['dataForm'].validate(valid => {
|
|
if (valid) {
|
|
let scheck = true
|
|
this.dataForm.items.find(item => {
|
|
if (!item.itemCode) {
|
|
scheck = false
|
|
}
|
|
})
|
|
if (scheck) {
|
|
this.$http({
|
|
url: this.$http.adornUrl('/apms/createProcessSheet'),
|
|
method: 'post',
|
|
data: this.$http.adornData(this.dataForm)
|
|
}).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.$message({
|
|
message: '操作成功',
|
|
type: 'success',
|
|
duration: 3000,
|
|
onClose: () => {
|
|
this.$refs['dataForm'].resetFields()
|
|
this.dataForm.items.splice(0, this.dataForm.items.length)
|
|
this.itemsPlus()
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.error(data.msg)
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.info('请填写完整生产单')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped></style>
|