|
|
@ -0,0 +1,185 @@ |
|
|
|
<template> |
|
|
|
<el-dialog :title="title" model-value width="900px" :close-on-click-modal="false" :before-close="cancel"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="160px"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PlantNr')" prop="Printer-PlantNr"> |
|
|
|
<el-select v-model="form['Printer-PlantNr']" placeholder="请选择车间" :disabled="item"> |
|
|
|
<el-option |
|
|
|
v-for="item in options" |
|
|
|
:key="item['Plant-PlantNr']" |
|
|
|
:label="item['Plant-Name1']" |
|
|
|
:value="item['Plant-PlantNr']" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PrinterId')" prop="Printer-PrinterId"> |
|
|
|
<el-input v-model="form['Printer-PrinterId']" placeholder="请输入" :disabled="item" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-Active')"> |
|
|
|
<el-radio-group v-model="form['Printer-Active']"> |
|
|
|
<el-radio |
|
|
|
v-for="dict in statusOptions" |
|
|
|
:key="dict.dictValue" |
|
|
|
:label="dict.dictValue" |
|
|
|
>{{ dict.dictLabel }}</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-Descr')"> |
|
|
|
<el-input v-model="form['Printer-Descr']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PrinterType')" prop="Printer-PrinterType"> |
|
|
|
<el-select v-model="form['Printer-PrinterType']" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
v-for="item in typeArray" |
|
|
|
:key="item['Stdef-StdefTyp']" |
|
|
|
:label="item['Stdef-Bez']" |
|
|
|
:value="item['Stdef-StdefTyp']" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PrinterName')"> |
|
|
|
<el-input v-model="form['Printer-PrinterName']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-IpAddress')"> |
|
|
|
<el-input v-model="form['Printer-IpAddress']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-Port')"> |
|
|
|
<el-input v-model.number="form['Printer-Port']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PrintInterval')"> |
|
|
|
<el-input v-model="form['Printer-PrintInterval']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PageSize')"> |
|
|
|
<el-input v-model="form['Printer-PageSize']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('Printer-PrinterSpec')"> |
|
|
|
<el-input v-model="form['Printer-PrinterSpec']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<template #footer> |
|
|
|
<span class="dialog-footer"> |
|
|
|
<el-button type="primary" class="dialog-submit-button" @click="submitForm">确 定</el-button> |
|
|
|
<el-button class="dialog-cancel-button" @click="cancel">取 消</el-button> |
|
|
|
</span> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { get, post, put } from "@/server/api.js"; |
|
|
|
import { getWorkshopList } from '@/common/workshop' |
|
|
|
export default { |
|
|
|
name: 'editField', |
|
|
|
props: { |
|
|
|
item: { |
|
|
|
default: null, |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
if (this.item) { |
|
|
|
this.handleUpdate(this.item) |
|
|
|
} else { |
|
|
|
this.handleAdd() |
|
|
|
} |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
options: [], // 车间 |
|
|
|
typeArray: [], |
|
|
|
title: '添加', // 弹框标题 |
|
|
|
statusOptions: [ // 状态数据字典 |
|
|
|
{ dictLabel: '启用', dictValue: 1 }, |
|
|
|
{ dictLabel: '停用', dictValue: 0 } |
|
|
|
], |
|
|
|
form: { |
|
|
|
'Printer-Active': 1 |
|
|
|
}, // 表单参数 |
|
|
|
rules: { |
|
|
|
'Printer-PlantNr': [ |
|
|
|
{ required: true, type: 'integer', message: '此项不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
|
'Printer-PrinterId': [ |
|
|
|
{ required: true, message: '此项不能为空', trigger: 'blur' } |
|
|
|
] |
|
|
|
}, |
|
|
|
url: { |
|
|
|
updateUrl: "/admin/base/printer/updateone", // 修改 |
|
|
|
addUrl: "/admin/base/printer/insertone", // 新增 |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.options = getWorkshopList() |
|
|
|
this.getStanderOne({ statid: 'Printer-PrinterType' }).then(res => { |
|
|
|
this.typeArray = res.data.records || [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
cancel() { // 取消按钮 |
|
|
|
this.$emit('update:isShowDialog','') |
|
|
|
}, |
|
|
|
handleAdd() { // 新增按钮操作 |
|
|
|
this.title = '添加' |
|
|
|
}, |
|
|
|
handleUpdate(row) { // 修改按钮操作 |
|
|
|
get(`/admin/base/printer/selectone/${row['Printer-PrinterId']}`).then(res => { |
|
|
|
this.form = res.data |
|
|
|
this.title = '修改' |
|
|
|
}) |
|
|
|
}, |
|
|
|
submitForm() { // 提交按钮 |
|
|
|
this.$refs['form'].validate(valid => { |
|
|
|
if (valid) { |
|
|
|
if (this.form['Printer-Port']) { |
|
|
|
this.form['Printer-Port'] = parseInt(this.form['Printer-Port']) |
|
|
|
} |
|
|
|
if (this.form['Printer-PrintInterval']) { |
|
|
|
this.form['Printer-PrintInterval'] = parseInt(this.form['Printer-PrintInterval']) |
|
|
|
} |
|
|
|
if (this.item) { |
|
|
|
put(this.url.updateUrl, this.form).then(res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.msgSuccess('修改成功') |
|
|
|
this.$emit('editCallBack') |
|
|
|
} else { |
|
|
|
this.msgError(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
post(this.url.addUrl, this.form).then(res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.msgSuccess('新增成功') |
|
|
|
this.$emit('editCallBack') |
|
|
|
} else { |
|
|
|
this.msgError(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |