You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

343 lines
11 KiB

<template>
<div class="customer-css">
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="380px" style="height: 380px;" class="customer-dialog">
<el-form :inline="true" label-position="top" label-width="80px">
<!-- 标签自定义信息 -->
<el-row>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.labelType>
<el-select v-model="pageData.labelType" disabled style="width: 150px;" >
<el-option label="外箱标签" value="外箱标签"></el-option>
<el-option label="卷标签" value="卷标签"></el-option>
</el-select >
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.labelNo>
<el-input v-model="pageData.labelNo" :readonly="labelNoReadOnly" @blur="checkLabelNoMethod()" style="width: 120px;" ></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.labelClass>
<el-select v-model="pageData.labelClass" disabled style="width: 150px;" >
<el-option label="打印软件" value="打印软件"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.labelName>
<el-input v-model="pageData.labelName" disabled style="width: 120px;" ></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item class="customer-item" style="margin-top: -8px;">
<span>{{labels.subLabelFlag}}</span>
<el-checkbox v-model="pageData.subLabelFlag" @change="changeParentLabelNo()" true-label="Y" false-label="N"
style="margin-top: 28px; margin-left: 10px;"></el-checkbox>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.parentLabelNo>
<el-input v-model="pageData.parentLabelNo" style="width: 120px;" ></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item class="customer-item" :label=labels.remark>
<el-input v-model="pageData.remark" style="width: 310px;" ></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveLabelSetting()">{{ buttons.saveButton }}</el-button>
<el-button type="primary" @click="closeDialog">{{buttons.closeButton}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
insertLabelSetting,
updateLabelSetting,
checkLabelNo,
} from '@/api/labelSetting/com_add_update_default_label.js';
import {
searchSysLanguagePackList,
searchSysLanguageParam,
searchFunctionButtonList,
saveButtonList,
searchSysLanguage,
searchLanguageListByLanguageCode,
saveSysLanguageOne,
searchPageLanguageData,
removerLanguage,
saveSysLanguageList
} from "@/api/sysLanguage.js";
var functionId = 'C10000043';
export default {
data() {
return {
titleCon: '默认标签定义维护',
showDefault: false,
visible: false,
pageData: {
site: this.$store.state.user.site,
username: this.$store.state.user.name,
labelNo: '',
labelType: '',
labelName: '',
labelClass: '',
subLabelFlag: 'N',
parentLabelNo: '*',
remark: '',
addFlag: false,
checkFlag: 'Y',
},
labelNoReadOnly: false,
dataListLoading: false,
buttons: {
saveButton: '保存',
closeButton: '关闭',
},
queryButton: {
functionId: functionId,
table_id: '*',
languageCode: this.$i18n.locale,
objectType: 'button'
},
labels: {
titleCon: '默认标签定义维护',
labelNo: '标签编号:',
labelType: '标签类型:',
labelName: '报表文件名:',
labelClass: '标签种类:',
subLabelFlag: '子报表:',
parentLabelNo: '上机标签编号:',
remark: '备注:',
confirmLabel: '确认',
cancelLabel: '取消',
},
queryLabel: {
functionId: functionId,
table_id: '*',
languageCode: this.$i18n.locale,
objectType: 'label'
},
}
},
methods: {
//初始化组件的参数
init(currentRow) {
//初始化参数
this.pageData = JSON.parse(JSON.stringify(currentRow));
//打开页面
this.visible = true;
//判断是否是新增
if(this.pageData.addFlag == 'Y'){
this.labelNoReadOnly = false;
}else{
this.labelNoReadOnly = true;
}
//重置是否需要检验
this.pageData.checkFlag = 'Y';
//判断是否启用多语言
//this.getMultiLanguageList(); //刷新多语言的信息
//重置标题
this.titleCon = this.labels.titleCon;
},
/*检验标签的编码*/
checkLabelNoMethod(){
checkLabelNo(this.pageData).then(({data}) => {
//判断是否查询到了
if(data && data.code == 200){
//设置参数
let labelSetting = data.resultRow;
this.pageData.labelType = labelSetting.labelType;
this.pageData.labelClass = labelSetting.labelClass;
this.pageData.labelName = labelSetting.labelName;
}else{
this.pageData.labelName = '';
this.pageData.labelNo = '';
this.pageData.labelType = '外箱标签';
this.pageData.labelClass = '打印软件';
this.$message.error(data.msg);
}
})
},
/*子报表事件触发*/
changeParentLabelNo(){
//首选判断是否是选中状态
if(this.pageData.subLabelFlag === 'Y'){
this.pageData.parentLabelNo = '';
}else{
this.pageData.parentLabelNo = '*';
}
},
/*保存标签自定义的信息*/
saveLabelSetting(){
//判断标签内容是否为空
let labelNo = this.pageData.labelNo.trim();
let labelType = this.pageData.labelType.trim();
let labelName = this.pageData.labelName.trim();
if(labelNo == null || labelNo === ''){
this.$message.success("标签编号不能为空!");
return false;
}
if(labelType == null || labelType === ''){
this.$message.success("标签类型不能为空!");
return false;
}
if(labelName == null || labelName === ''){
this.$message.success("报表文件名不能为空!");
return false;
}
//判断是否是新增标签自定义
if(this.pageData.addFlag === 'Y'){
this.insertLabelSettingData();
}else{
this.updateLabelSettingData();
}
},
/*数量失去焦点的事件*/
insertLabelSettingData(){
insertLabelSetting(this.pageData).then(({data}) => {
if(data.code == 200){
this.$message.success(data.msg);
setTimeout(this.closeDialog(), 2000);
}else if(data.code == 201){
this.$confirm(data.msg, '提示', {
confirmButtonText: this.labels.confirmLabel,
cancelButtonText: this.labels.cancelLabel,
type: "warning"
}).then(() => {
//调用存储过程实现
this.pageData.checkFlag = 'N';
//重新调用当前的方法
this.insertLabelSettingData();
}).catch(() => {
//this.pageData.checkFlag = 'Y';
});
//重置标签
this.pageData.checkFlag = 'Y';
}else{
this.$message.error(data.msg);
}
})
},
/*验证时长的参数*/
updateLabelSettingData(){
updateLabelSetting(this.pageData).then(({data}) => {
if(data.code == 200){
this.$message.success(data.msg);
setTimeout(this.closeDialog(), 2000);
}else{
this.$message.error(data.msg);
}
})
},
/*关闭modal*/
closeDialog(){
//刷新报工的页面
this.$emit('refreshPageTables');
//关闭当前的页面
this.visible = false;
},
/*检查新的工具实例信息*/
checkConnectToolInstanceIdBun(){
/*验证工具的实例*/
if(this.pageData.toolInstanceId == null || this.pageData.toolInstanceId == ''){
this.$message.error(this.labels.pleaseScanToolInstanceId);
return false;
}
/*调用检查的方法检验下*/
checkConnectToolInstanceId(this.pageData).then(({data}) => {
//判断是否存在异常
if(data.code == 500){
this.$message.error(data.msg);
}else if (data.resultMap.resultCode == 201){
let msg = data.resultMap.resultMsg;
this.$confirm(msg, '提示', {
confirmButtonText: this.labels.confirmLabel,
cancelButtonText: this.labels.cancelLabel,
type: "warning"
}).then(() => {
this.pageData.checkFlag = true;
}).catch(() => {
this.pageData.checkFlag = false;
});
}else{
this.pageData.checkFlag = true;
}
});
},
// 保存 默认配置 列
async saveMultiLanguage() {
// 保存页面 button label title 属性
let buttons = this.buttonList;
let labels = this.labelsList;
await saveButtonList(buttons)
await saveButtonList(labels)
},
getMultiLanguageList() {
//首先查询当前按钮的多语言
searchFunctionButtonList(this.queryButton).then(({data}) => {
if (data && data.code == 0 ) {
this.buttons = data.data
} else {
// saveButtonList(this.buttonList).then(({data}) => {
// })
}
});
//其次查询当前标签的多语言
searchFunctionButtonList(this.queryLabel).then(({data}) => {
if (data && data.code == 0 ) {
this.labels = data.data
} else {
// saveButtonList(this.buttonList).then(({data}) => {
// })
}
});
},
},
watch: {
pageData: {
deep: true,
handler: function (newV, oldV) {
this.pageData.labelNo = this.pageData.labelNo.toUpperCase();
this.pageData.parentLabelNo = this.pageData.parentLabelNo.toUpperCase();
}
},
},
created() {
// this.factoryList()
// this.getLanguageList()
}
}
</script>
<style scoped lang="scss">
</style>