|
|
<template>
|
|
|
<div>
|
|
|
<!-- 查询区域 -->
|
|
|
<el-row :gutter="10" class="toolbar">
|
|
|
<el-col :span="7">
|
|
|
<el-input v-model="queryInfo.unCode" prefix-icon="el-icon-search" size="small"
|
|
|
placeholder="联合国危险品代码" clearable></el-input>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-button type="primary" icon="el-icon-search" size="small" @click="search">查询</el-button>
|
|
|
<el-button type="success" icon="el-icon-plus" size="small" @click="applyAdd()">新增</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
<!-- 表格区域 -->
|
|
|
<el-table :data="tableData" border stripe style="width: 100%" size="small"
|
|
|
:header-cell-style="{background:'#6F8294',color:'#FFFFFF'}">
|
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
|
<el-table-column prop="id" label="主键ID" width="100"></el-table-column>
|
|
|
<el-table-column prop="unCode" label="联合国危险品代码"></el-table-column>
|
|
|
<el-table-column prop="cnDes" label="危险品中文描述"></el-table-column>
|
|
|
<el-table-column prop="enDes" label="危险品英文描述"></el-table-column>
|
|
|
<el-table-column prop="classType" label="危险品项别/类别"></el-table-column>
|
|
|
<el-table-column prop="secondaryRisk" label="次要危险性"></el-table-column>
|
|
|
<el-table-column prop="packingLevel" label="包装等级"></el-table-column>
|
|
|
<el-table-column fixed="right" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="primary" size="mini" @click="applyEdit(scope.row)">编辑</el-button>
|
|
|
<el-button type="danger" size="mini" @click="applyDelete(scope.row.id)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 分页区域 -->
|
|
|
<el-pagination
|
|
|
background
|
|
|
layout="prev, pager, next"
|
|
|
:total="total"
|
|
|
:current-page="queryInfo.pageNum"
|
|
|
:page-size="queryInfo.pageSize"
|
|
|
@current-change="handlePageChange">
|
|
|
</el-pagination>
|
|
|
|
|
|
<!-- 对话框 -->
|
|
|
<el-dialog :title="dialogStateMap[dialogType]" :visible.sync="showDialog" width="80%">
|
|
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="联合国危险品代码" prop="unCode">
|
|
|
<el-input v-model="formData.unCode"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="危险品中文描述" prop="cnDes">
|
|
|
<el-input v-model="formData.cnDes"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="危险品英文描述" prop="enDes">
|
|
|
<el-input v-model="formData.enDes"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="危险品项别/类别" prop="classType">
|
|
|
<el-input v-model="formData.classType"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="次要危险性" prop="secondaryRisk">
|
|
|
<el-input v-model="formData.secondaryRisk"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="包装等级" prop="packingLevel">
|
|
|
<el-input v-model="formData.packingLevel"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="showDialog = false">取消</el-button>
|
|
|
<el-button type="primary" @click="submitForm(dialogType)">确定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { insertUnCodeInfo, updateUnCodeInfo, deleteUnCodeById, getAllUnCodesByPage } from '@/api/wms/uncodeAPI';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
queryInfo: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
unCode: ''
|
|
|
},
|
|
|
tableData: [],
|
|
|
total: 0,
|
|
|
showDialog: false,
|
|
|
dialogType: 'add',
|
|
|
dialogStateMap: {
|
|
|
view: '查看',
|
|
|
edit: '编辑',
|
|
|
add: '新增'
|
|
|
},
|
|
|
formData: {},
|
|
|
rules: {
|
|
|
unCode: [
|
|
|
{ required: true, message: '请输入联合国危险品代码', trigger: 'blur' }
|
|
|
],
|
|
|
cnDes: [
|
|
|
{ required: true, message: '请输入危险品中文描述', trigger: 'blur' }
|
|
|
]
|
|
|
// 其他字段的规则类似
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
search() {
|
|
|
getAllUnCodesByPage({unCode:this.queryInfo.unCode},{pageNum:this.queryInfo.pageNum, pageSize:this.queryInfo.pageSize}).then(response => {
|
|
|
const data = response.data;
|
|
|
if (data.code === "200") {
|
|
|
this.tableData = data.data.list || [];
|
|
|
this.total = data.data.total || 0;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
applyAdd() {
|
|
|
this.dialogType = 'add';
|
|
|
this.showDialog = true;
|
|
|
this.formData = {};
|
|
|
},
|
|
|
applyEdit(row) {
|
|
|
this.dialogType = 'edit';
|
|
|
this.showDialog = true;
|
|
|
this.formData = { ...row };
|
|
|
},
|
|
|
applyDelete(id) {
|
|
|
deleteUnCodeById(id).then(response => {
|
|
|
if (response.data.code === "200") {
|
|
|
this.search();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
submitForm(type) {
|
|
|
let method;
|
|
|
switch (type) {
|
|
|
case 'add':
|
|
|
method = insertUnCodeInfo;
|
|
|
break;
|
|
|
case 'edit':
|
|
|
method = updateUnCodeInfo;
|
|
|
break;
|
|
|
default:
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.$refs['formRef'].validate(valid => {
|
|
|
if (valid) {
|
|
|
method(this.formData).then(response => {
|
|
|
if (response.data.code === "200") {
|
|
|
this.showDialog = false;
|
|
|
this.search();
|
|
|
}
|
|
|
}).catch(e =>{
|
|
|
this.$message.error(e)
|
|
|
});
|
|
|
} else {
|
|
|
console.log('验证失败');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
handlePageChange(page) {
|
|
|
this.queryInfo.pageNum = page;
|
|
|
this.search();
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
</script> |
...
|
...
|
|