作者 朱兆平

add:

1. 增加危险品代码管理界面.
2. 出入库管理增加危险品代码录入
  1 +import http from "../http";
  2 +
  3 +let baseServiceURL = 'wms-server-warehouse/common';
  4 +
  5 +// 新增联合国危险品编码信息
  6 +export const insertUnCodeInfo = (data) => {
  7 + return http.post(`${baseServiceURL}/unCode/insert`, data);
  8 +};
  9 +
  10 +// 更新联合国危险品编码信息
  11 +export const updateUnCodeInfo = (data) => {
  12 + return http.post(`${baseServiceURL}/unCode/update`, data);
  13 +};
  14 +
  15 +// 删除单个联合国危险品编码信息
  16 +export const deleteUnCodeById = (params) => {
  17 + return http.get(`${baseServiceURL}/unCode/delete`, { params: params });
  18 +};
  19 +
  20 +// 查询单个联合国危险品编码信息
  21 +export const selectUnCodeById = (params) => {
  22 + return http.get(`${baseServiceURL}/unCode/getById`, { params: params });
  23 +};
  24 +
  25 +// 根据危险品编码进行查询
  26 +export const selectByUnCode = (params) => {
  27 + return http.get(`${baseServiceURL}/unCode/getByUnCode`, params);
  28 +};
  29 +
  30 +// 分页查询所有UN代码信息
  31 +export const getAllUnCodesByPage = (data,params) => {
  32 + return http.post(`${baseServiceURL}/unCode/getAllByPage`, data,params);
  33 +};
@@ -126,6 +126,7 @@ import area from './views/deploy/area.vue' @@ -126,6 +126,7 @@ import area from './views/deploy/area.vue'
126 import seller from './views/deploy/seller.vue' 126 import seller from './views/deploy/seller.vue'
127 import classification from './views/deploy/classification.vue' 127 import classification from './views/deploy/classification.vue'
128 import subscribe from './views/deploy/subscribe.vue' 128 import subscribe from './views/deploy/subscribe.vue'
  129 +import UNcode from './views/wms/UNcode.vue'
129 130
130 131
131 132
@@ -588,6 +589,7 @@ let routes = [ @@ -588,6 +589,7 @@ let routes = [
588 {path:'/seller',component:seller,name:'商品管理'}, 589 {path:'/seller',component:seller,name:'商品管理'},
589 {path:'/classification',component:classification,name:'分类监管申请'}, 590 {path:'/classification',component:classification,name:'分类监管申请'},
590 {path:'/subscribe',component:subscribe,name:'分类监管查询'}, 591 {path:'/subscribe',component:subscribe,name:'分类监管查询'},
  592 + {path:'/unCode',component:UNcode,name:'国际危险品代码管理'},
591 ] 593 ]
592 }, 594 },
593 { 595 {
@@ -166,20 +166,61 @@ @@ -166,20 +166,61 @@
166 </el-form-item> 166 </el-form-item>
167 </el-col> 167 </el-col>
168 <el-col :span="6"> 168 <el-col :span="6">
169 - <el-form-item prop="remark1">  
170 - <div class="my-text-area">  
171 - <div class="el-input-group__prepend prepand">备&emsp;&emsp;注</div>  
172 - <el-input v-model="addForm.remark1"  
173 - type="textarea"  
174 - autosize  
175 - placeholder="备注信息"  
176 - style="float: left;width:calc(100% - 110px)"  
177 - >  
178 - </el-input>  
179 - </div>  
180 - </el-form-item> 169 + <el-form-item prop="remark5">
  170 + <el-input v-model="addForm.remark5" autocomplete="off" suffix-icon="el-icon-edit">
  171 + <template slot="prepend"><i v-if="rules.hasOwnProperty('remark5')" style="color:red;">*</i> 货物品名</template>
  172 + </el-input>
  173 + </el-form-item>
181 </el-col> 174 </el-col>
182 </el-row> 175 </el-row>
  176 + <el-row>
  177 + <el-col :span="6">
  178 + <el-form-item prop="uncode">
  179 + <el-autocomplete
  180 + v-model="addForm.uncode"
  181 + :fetch-suggestions="unCodeQuerySearch"
  182 + placeholder="联合国危险品编号如:0004"
  183 + :trigger-on-focus="false"
  184 + value-key = "unCode"
  185 + clearable
  186 + highlight-first-item
  187 + style="width: 100%"
  188 + suffix-icon="el-icon-edit"
  189 + @select="unCodeHandleSelect"
  190 + >
  191 + <template slot="prepend"><i v-if="rules.hasOwnProperty('uncode')" style="color:red;">*</i> UN编号</template>
  192 + <template slot-scope="{ item }">
  193 + <ul style="padding: 0">
  194 + <li style="padding: 0"><el-tag>{{ item.unCode }}</el-tag>: {{ item.cnDes }}</li>
  195 + <li style="padding: 0">EN: {{ item.enDes }}</li>
  196 + <li style="padding: 0">类/项: {{ item.classType }}</li>
  197 + </ul>
  198 + </template>
  199 + </el-autocomplete>
  200 + </el-form-item>
  201 + </el-col>
  202 + <el-col :span="6">
  203 + <el-form-item prop="unclass">
  204 + <el-input v-model="addForm.unclass" autocomplete="off" suffix-icon="el-icon-edit" placeholder="危险品类别/项别">
  205 + <template slot="prepend"><i v-if="rules.hasOwnProperty('unclass')" style="color:red;">*</i> 类别/项别</template>
  206 + </el-input>
  207 + </el-form-item>
  208 + </el-col>
  209 + <el-col :span="6">
  210 + <el-form-item prop="remark1">
  211 + <div class="my-text-area">
  212 + <div class="el-input-group__prepend prepand">备&emsp;&emsp;注</div>
  213 + <el-input v-model="addForm.remark1"
  214 + type="textarea"
  215 + autosize
  216 + placeholder="备注信息"
  217 + style="float: left;width:calc(100% - 110px)"
  218 + >
  219 + </el-input>
  220 + </div>
  221 + </el-form-item>
  222 + </el-col>
  223 + </el-row>
183 <el-divider content-position="left"><i class="el-icon-house"></i> 入库相关</el-divider> 224 <el-divider content-position="left"><i class="el-icon-house"></i> 入库相关</el-divider>
184 <el-row> 225 <el-row>
185 <!-- <el-col :span="6">--> 226 <!-- <el-col :span="6">-->
@@ -213,6 +254,7 @@ @@ -213,6 +254,7 @@
213 clearable 254 clearable
214 highlight-first-item 255 highlight-first-item
215 style="width: 100%" 256 style="width: 100%"
  257 + suffix-icon="el-icon-location-information"
216 > 258 >
217 <template slot="prepend"><i v-if="rules.hasOwnProperty('location')" style="color:red;">*</i> 库&emsp;&emsp;位</template> 259 <template slot="prepend"><i v-if="rules.hasOwnProperty('location')" style="color:red;">*</i> 库&emsp;&emsp;位</template>
218 <template slot-scope="{ item }"> 260 <template slot-scope="{ item }">
@@ -240,6 +282,7 @@ @@ -240,6 +282,7 @@
240 clearable 282 clearable
241 highlight-first-item 283 highlight-first-item
242 style="width: 100%" 284 style="width: 100%"
  285 + suffix-icon="el-icon-user"
243 > 286 >
244 <template slot="prepend">货主名称</template> 287 <template slot="prepend">货主名称</template>
245 <template slot-scope="{ item }"> 288 <template slot-scope="{ item }">
@@ -708,10 +751,11 @@ @@ -708,10 +751,11 @@
708 import unusualOP from '@/api/wms/unusualOptions' 751 import unusualOP from '@/api/wms/unusualOptions'
709 import damageOP from '@/api/wms/damageOptions' 752 import damageOP from '@/api/wms/damageOptions'
710 import Print from '@/components/Print' 753 import Print from '@/components/Print'
  754 + import { selectByUnCode } from '@/api/wms/uncodeAPI';
711 755
712 756
713 export default { 757 export default {
714 - name: "inventroyrecord", 758 + name: "inventroy-record",
715 components:{Print}, 759 components:{Print},
716 data() { 760 data() {
717 var checkInputArea = (rule, value, callback) => { 761 var checkInputArea = (rule, value, callback) => {
@@ -827,7 +871,9 @@ @@ -827,7 +871,9 @@
827 remark3:'', 871 remark3:'',
828 remark4:'', 872 remark4:'',
829 remark5:'', 873 remark5:'',
830 - annex:'' 874 + annex:'',
  875 + uncode: '',
  876 + unclass: ''
831 }, 877 },
832 packgeOptions:packge, 878 packgeOptions:packge,
833 options: [{ 879 options: [{
@@ -1121,6 +1167,40 @@ @@ -1121,6 +1167,40 @@
1121 return (restaurant.locationno.toLowerCase().indexOf(queryString.toLowerCase()) === 0); 1167 return (restaurant.locationno.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
1122 }; 1168 };
1123 }, 1169 },
  1170 + unCodeHandleSelect(item){
  1171 + console.log(item)
  1172 + this.addForm.unclass = item.classType;
  1173 + },
  1174 + unCodeFilter(queryString) {
  1175 + return (restaurant) => {
  1176 + return (restaurant.unCode.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  1177 + };
  1178 + },
  1179 + unCodeQuerySearch(queryString,cb) {
  1180 + if (queryString && queryString.length > 0) {
  1181 + let _this=this
  1182 + let ld = this.$loading({
  1183 + text:"数据加载中..."
  1184 + })
  1185 + selectByUnCode({unCode:queryString}).then(response => {
  1186 + if (response.data.code === "200") {
  1187 + const data = response.data;
  1188 + if (data.code === "200") {
  1189 + _this.$message.success('加载记录成功!')
  1190 +
  1191 + const restaurants = data.data || [];
  1192 + const results = queryString ? restaurants.filter(this.unCodeFilter(queryString)) : restaurants;
  1193 + // 调用 callback 返回建议列表的数据
  1194 + cb(results);
  1195 + }
  1196 + }
  1197 + }).catch(e =>{
  1198 + this.$message.error(e.toString())
  1199 + }).finally(()=>{
  1200 + ld.close()
  1201 + });
  1202 + }
  1203 + },
1124 getRoles() { 1204 getRoles() {
1125 let _this= this; 1205 let _this= this;
1126 let ld = this.$loading({ 1206 let ld = this.$loading({
@@ -1335,6 +1415,50 @@ @@ -1335,6 +1415,50 @@
1335 }, 1415 },
1336 nextBill(){ 1416 nextBill(){
1337 this.$refs.addForm.resetFields() 1417 this.$refs.addForm.resetFields()
  1418 + this.addForm = {
  1419 + area: '',
  1420 + feeweight: 0,
  1421 + custel: '',
  1422 + customer: '',
  1423 + custcode: '',
  1424 + goodstype: '运单',
  1425 + house:'',
  1426 + ietype:'I',
  1427 + location:'',
  1428 + opter:'',
  1429 + opttime: '',
  1430 + pcs: 0,
  1431 + totalpcs:0,
  1432 + serialnumber: '',
  1433 + station: '',
  1434 + status: '',
  1435 + licenseplate: '',
  1436 + transtype:'销售入库',
  1437 + goodssize:'',
  1438 + goodsvol:0,
  1439 + waybill:'',
  1440 + billfhl:'',
  1441 + //随货文件
  1442 + hasFiles:false,
  1443 + hasUnusual:false,
  1444 + unusuals:[],
  1445 + files:[],
  1446 + damages:[],
  1447 + sphCodes:[],
  1448 + billweight:0,
  1449 + totalweight:0,
  1450 + packingid:'',
  1451 + remark:'',
  1452 + remark1:'',
  1453 + remark2:'',
  1454 + remark3:'',
  1455 + remark4:'',
  1456 + remark5:'',
  1457 + annex:'',
  1458 + uncode: '',
  1459 + unclass: ''
  1460 + }
  1461 +
1338 this.initUserInfo() 1462 this.initUserInfo()
1339 this.tableData = [] 1463 this.tableData = []
1340 1464
  1 +<template>
  2 + <div>
  3 + <!-- 查询区域 -->
  4 + <el-row :gutter="10" class="toolbar">
  5 + <el-col :span="7">
  6 + <el-input v-model="queryInfo.unCode" prefix-icon="el-icon-search" size="small"
  7 + placeholder="联合国危险品代码" clearable></el-input>
  8 + </el-col>
  9 + <el-col :span="6">
  10 + <el-button type="primary" icon="el-icon-search" size="small" @click="search">查询</el-button>
  11 + <el-button type="success" icon="el-icon-plus" size="small" @click="applyAdd()">新增</el-button>
  12 + </el-col>
  13 + </el-row>
  14 +
  15 + <!-- 表格区域 -->
  16 + <el-table :data="tableData" border stripe style="width: 100%" size="small"
  17 + :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}">
  18 + <el-table-column type="index" width="50"></el-table-column>
  19 + <el-table-column prop="id" label="主键ID" width="100"></el-table-column>
  20 + <el-table-column prop="unCode" label="联合国危险品代码"></el-table-column>
  21 + <el-table-column prop="cnDes" label="危险品中文描述"></el-table-column>
  22 + <el-table-column prop="enDes" label="危险品英文描述"></el-table-column>
  23 + <el-table-column prop="classType" label="危险品项别/类别"></el-table-column>
  24 + <el-table-column prop="secondaryRisk" label="次要危险性"></el-table-column>
  25 + <el-table-column prop="packingLevel" label="包装等级"></el-table-column>
  26 + <el-table-column fixed="right" label="操作">
  27 + <template slot-scope="scope">
  28 + <el-button type="primary" size="mini" @click="applyEdit(scope.row)">编辑</el-button>
  29 + <el-button type="danger" size="mini" @click="applyDelete(scope.row.id)">删除</el-button>
  30 + </template>
  31 + </el-table-column>
  32 + </el-table>
  33 +
  34 + <!-- 分页区域 -->
  35 + <el-pagination
  36 + background
  37 + layout="prev, pager, next"
  38 + :total="total"
  39 + :current-page="queryInfo.pageNum"
  40 + :page-size="queryInfo.pageSize"
  41 + @current-change="handlePageChange">
  42 + </el-pagination>
  43 +
  44 + <!-- 对话框 -->
  45 + <el-dialog :title="dialogStateMap[dialogType]" :visible.sync="showDialog" width="80%">
  46 + <el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
  47 + <el-row>
  48 + <el-col :span="12">
  49 + <el-form-item label="联合国危险品代码" prop="unCode">
  50 + <el-input v-model="formData.unCode"></el-input>
  51 + </el-form-item>
  52 + </el-col>
  53 + <el-col :span="12">
  54 + <el-form-item label="危险品中文描述" prop="cnDes">
  55 + <el-input v-model="formData.cnDes"></el-input>
  56 + </el-form-item>
  57 + </el-col>
  58 + <el-col :span="12">
  59 + <el-form-item label="危险品英文描述" prop="enDes">
  60 + <el-input v-model="formData.enDes"></el-input>
  61 + </el-form-item>
  62 + </el-col>
  63 + <el-col :span="12">
  64 + <el-form-item label="危险品项别/类别" prop="classType">
  65 + <el-input v-model="formData.classType"></el-input>
  66 + </el-form-item>
  67 + </el-col>
  68 + <el-col :span="12">
  69 + <el-form-item label="次要危险性" prop="secondaryRisk">
  70 + <el-input v-model="formData.secondaryRisk"></el-input>
  71 + </el-form-item>
  72 + </el-col>
  73 + <el-col :span="12">
  74 + <el-form-item label="包装等级" prop="packingLevel">
  75 + <el-input v-model="formData.packingLevel"></el-input>
  76 + </el-form-item>
  77 + </el-col>
  78 +
  79 + </el-row>
  80 + </el-form>
  81 + <span slot="footer" class="dialog-footer">
  82 + <el-button @click="showDialog = false">取消</el-button>
  83 + <el-button type="primary" @click="submitForm(dialogType)">确定</el-button>
  84 + </span>
  85 + </el-dialog>
  86 + </div>
  87 +</template>
  88 +
  89 +<script>
  90 +import { insertUnCodeInfo, updateUnCodeInfo, deleteUnCodeById, getAllUnCodesByPage } from '@/api/wms/uncodeAPI';
  91 +
  92 +export default {
  93 + data() {
  94 + return {
  95 + queryInfo: {
  96 + pageNum: 1,
  97 + pageSize: 10,
  98 + unCode: ''
  99 + },
  100 + tableData: [],
  101 + total: 0,
  102 + showDialog: false,
  103 + dialogType: 'add',
  104 + dialogStateMap: {
  105 + view: '查看',
  106 + edit: '编辑',
  107 + add: '新增'
  108 + },
  109 + formData: {},
  110 + rules: {
  111 + unCode: [
  112 + { required: true, message: '请输入联合国危险品代码', trigger: 'blur' }
  113 + ],
  114 + cnDes: [
  115 + { required: true, message: '请输入危险品中文描述', trigger: 'blur' }
  116 + ]
  117 + // 其他字段的规则类似
  118 + },
  119 + };
  120 + },
  121 + methods: {
  122 + search() {
  123 + getAllUnCodesByPage({unCode:this.queryInfo.unCode},{pageNum:this.queryInfo.pageNum, pageSize:this.queryInfo.pageSize}).then(response => {
  124 + const data = response.data;
  125 + if (data.code === "200") {
  126 + this.tableData = data.data.list || [];
  127 + this.total = data.data.total || 0;
  128 + }
  129 + });
  130 + },
  131 + applyAdd() {
  132 + this.dialogType = 'add';
  133 + this.showDialog = true;
  134 + this.formData = {};
  135 + },
  136 + applyEdit(row) {
  137 + this.dialogType = 'edit';
  138 + this.showDialog = true;
  139 + this.formData = { ...row };
  140 + },
  141 + applyDelete(id) {
  142 + deleteUnCodeById(id).then(response => {
  143 + if (response.data.code === "200") {
  144 + this.search();
  145 + }
  146 + });
  147 + },
  148 + submitForm(type) {
  149 + let method;
  150 + switch (type) {
  151 + case 'add':
  152 + method = insertUnCodeInfo;
  153 + break;
  154 + case 'edit':
  155 + method = updateUnCodeInfo;
  156 + break;
  157 + default:
  158 + return;
  159 + }
  160 +
  161 + this.$refs['formRef'].validate(valid => {
  162 + if (valid) {
  163 + method(this.formData).then(response => {
  164 + if (response.data.code === "200") {
  165 + this.showDialog = false;
  166 + this.search();
  167 + }
  168 + }).catch(e =>{
  169 + this.$message.error(e)
  170 + });
  171 + } else {
  172 + console.log('验证失败');
  173 + return false;
  174 + }
  175 + });
  176 + },
  177 + handlePageChange(page) {
  178 + this.queryInfo.pageNum = page;
  179 + this.search();
  180 + }
  181 + },
  182 +};
  183 +</script>