<template>
|
<div :ref="'settings'" class="settings-sub-container">
|
<el-form ref="form" v-model="formData" label-width="150px">
|
<h2 class="sub-title">局域网打印机设置</h2>
|
<el-form-item label="打印服务器IP地址">
|
<el-input v-model="formData.pda_printip" class="w-300"></el-input>
|
</el-form-item>
|
<el-form-item label="打印服务器端口号">
|
<el-input v-model="formData.pda_printPort" class="w-300"></el-input> 采用默认端口8000即可
|
</el-form-item>
|
<el-form-item class="form-footer">
|
<el-button type="primary" @click="onSave">保存</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: "settings-pda",
|
|
components: {},
|
data() {
|
return {
|
type_Id: 585, // 通用参数类别ID,不可修改
|
// 编辑数据对象
|
formData: {
|
pda_printip: null,
|
pda_printPort: "8000"
|
},
|
// 接口数据
|
valueList: []
|
};
|
},
|
mounted() {
|
this.loadParam();
|
},
|
methods: {
|
handleClose(tag) {},
|
|
// 加载数据
|
loadParam() {
|
var keys = Object.keys(this.formData).join(",");
|
var url = "/api/sys/param/getConfig";
|
var params = {
|
openNodeApi: true,
|
type_Id: this.type_Id,
|
keys: keys
|
};
|
var callback = res => {
|
this.common.showMsg(res);
|
this.valueList = res.data;
|
|
// 获得参数值列表,将数字转换为对象
|
res.data.forEach(item => {
|
var value03 = item.value03;
|
if (this.common.isNumber(item.value03)) {
|
value03 = parseInt(item.value03);
|
}
|
this.$set(this.formData, item.value02, value03);
|
});
|
};
|
var target = this.$refs["settings"];
|
this.common.ajax(url, params, callback, target);
|
},
|
// 保存数据
|
onSave() {
|
Object.keys(this.formData).forEach(key => {
|
var item = this.valueList.find(item => {
|
return item.value02 === key;
|
});
|
if (item) {
|
item.value03 = this.formData[key];
|
} else {
|
this.valueList.push({
|
type_Id: this.type_Id,
|
value02: key,
|
value03: this.formData[key]
|
});
|
}
|
});
|
|
var url = "/api/sys/param/saveParams";
|
var params = {
|
openNodeApi: true,
|
type_Id: this.type_Id,
|
valueList: this.valueList
|
};
|
var target = this.$refs["settings"];
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
this.common.showMsg(res);
|
},
|
target
|
);
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.settings-sub-container {
|
/deep/ .sub-title {
|
font-size: 14px;
|
padding-bottom: 10px;
|
border-bottom: 1px solid #ebeef5;
|
padding-top: 20px;
|
margin-bottom: 10px;
|
}
|
/deep/ .el-form-item__label {
|
font-weight: normal;
|
}
|
.remark {
|
color: #888;
|
}
|
/deep/ .el-form-item {
|
margin-bottom: 20px;
|
}
|
.form-footer {
|
margin-top: 30px;
|
}
|
}
|
</style>
|