作者 朱兆平

角色管理优化新增mqcode录入处理

@@ -39,6 +39,8 @@ @@ -39,6 +39,8 @@
39 </el-table-column> 39 </el-table-column>
40 <el-table-column prop="customsRegCode" label="海关备案代码" min-width="150" > 40 <el-table-column prop="customsRegCode" label="海关备案代码" min-width="150" >
41 </el-table-column> 41 </el-table-column>
  42 + <el-table-column prop="mqcode" label="海关通道编号" min-width="150" >
  43 + </el-table-column>
42 <el-table-column label="操作" min-width="260"> 44 <el-table-column label="操作" min-width="260">
43 <template slot-scope="scope"> 45 <template slot-scope="scope">
44 <el-button type="primary" size="small" @click="handleAdd(scope.$index, scope.row)">新增下级</el-button> 46 <el-button type="primary" size="small" @click="handleAdd(scope.$index, scope.row)">新增下级</el-button>
@@ -56,36 +58,36 @@ @@ -56,36 +58,36 @@
56 </el-col> 58 </el-col>
57 59
58 <!--编辑界面--> 60 <!--编辑界面-->
59 - <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false">  
60 - <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm">  
61 - <el-form-item label="ID">  
62 - <span>{{editForm.roleId}}</span>  
63 - </el-form-item>  
64 - <el-form-item label="岗位名称">  
65 - <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input>  
66 - </el-form-item>  
67 - <el-form-item label="岗位描述">  
68 - <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input>  
69 - </el-form-item>  
70 - <el-form-item label="部门名称">  
71 - <el-select v-model="editForm.departmentId" placeholder="请选择">  
72 - <el-option  
73 - v-for="item in departmentNameList"  
74 - :key="item.departmentId"  
75 - :label="item.departmentName"  
76 - :value="item.departmentId">  
77 - </el-option>  
78 - </el-select>  
79 - </el-form-item>  
80 - </el-form>  
81 - <div slot="footer" class="dialog-footer">  
82 - <el-button @click.native="editFormVisible = false">取消</el-button>  
83 - <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>  
84 - </div>  
85 - </el-dialog> 61 +<!-- <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false">-->
  62 +<!-- <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm">-->
  63 +<!-- <el-form-item label="ID">-->
  64 +<!-- <span>{{editForm.roleId}}</span>-->
  65 +<!-- </el-form-item>-->
  66 +<!-- <el-form-item label="组织机构名称">-->
  67 +<!-- <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input>-->
  68 +<!-- </el-form-item>-->
  69 +<!-- <el-form-item label="组织机构描述">-->
  70 +<!-- <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input>-->
  71 +<!-- </el-form-item>-->
  72 +<!-- <el-form-item label="组织机构类型">-->
  73 +<!-- <el-select v-model="editForm.departmentId" placeholder="请选择">-->
  74 +<!-- <el-option-->
  75 +<!-- v-for="item in departmentNameList"-->
  76 +<!-- :key="item.departmentId"-->
  77 +<!-- :label="item.departmentName"-->
  78 +<!-- :value="item.departmentId">-->
  79 +<!-- </el-option>-->
  80 +<!-- </el-select>-->
  81 +<!-- </el-form-item>-->
  82 +<!-- </el-form>-->
  83 +<!-- <div slot="footer" class="dialog-footer">-->
  84 +<!-- <el-button @click.native="editFormVisible = false">取消</el-button>-->
  85 +<!-- <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>-->
  86 +<!-- </div>-->
  87 +<!-- </el-dialog>-->
86 88
87 <!--新增界面--> 89 <!--新增界面-->
88 - <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> 90 + <el-dialog :title="dialogMap[dialogStatus]" :visible.sync="addFormVisible" :close-on-click-modal="false">
89 <el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm"> 91 <el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
90 <el-form-item label="上级组织机构"> 92 <el-form-item label="上级组织机构">
91 <span>{{addForm.parentName}}</span> 93 <span>{{addForm.parentName}}</span>
@@ -96,7 +98,7 @@ @@ -96,7 +98,7 @@
96 <el-form-item label="组织机构描述" prop="description"> 98 <el-form-item label="组织机构描述" prop="description">
97 <el-input v-model="addForm.description" auto-complete="off" placeholder="组织机构描述:例如:组织机构简介"></el-input> 99 <el-input v-model="addForm.description" auto-complete="off" placeholder="组织机构描述:例如:组织机构简介"></el-input>
98 </el-form-item> 100 </el-form-item>
99 - <el-form-item label="组织机构类型" prop="description"> 101 + <el-form-item label="组织机构类型" prop="type">
100 <el-select 102 <el-select
101 v-model="addForm.type" 103 v-model="addForm.type"
102 filterable 104 filterable
@@ -111,16 +113,19 @@ @@ -111,16 +113,19 @@
111 </el-option> 113 </el-option>
112 </el-select> 114 </el-select>
113 </el-form-item> 115 </el-form-item>
114 - <el-form-item label="工商企业代码" prop="description"> 116 + <el-form-item label="工商企业代码" prop="businessLicense">
115 <el-input v-model="addForm.businessLicense" auto-complete="off" placeholder="社会信用代码或者组织机构代码"></el-input> 117 <el-input v-model="addForm.businessLicense" auto-complete="off" placeholder="社会信用代码或者组织机构代码"></el-input>
116 </el-form-item> 118 </el-form-item>
117 - <el-form-item label="海关备案代码" prop="description"> 119 + <el-form-item label="海关备案代码" prop="customsRegCode">
118 <el-input v-model="addForm.customsRegCode" auto-complete="off" placeholder="海关备案后返回的备案代码"></el-input> 120 <el-input v-model="addForm.customsRegCode" auto-complete="off" placeholder="海关备案后返回的备案代码"></el-input>
119 </el-form-item> 121 </el-form-item>
  122 + <el-form-item label="海关通道编号" prop="mqcode">
  123 + <el-input v-model="addForm.mqcode" auto-complete="off" placeholder="海关通道编号"></el-input>
  124 + </el-form-item>
120 </el-form> 125 </el-form>
121 <div slot="footer" class="dialog-footer"> 126 <div slot="footer" class="dialog-footer">
122 <el-button @click.native="addFormVisible = false">取消</el-button> 127 <el-button @click.native="addFormVisible = false">取消</el-button>
123 - <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> 128 + <el-button type="primary" @click="dialogStatus==='create'?addSubmit():editSubmit()" :loading="addLoading" >提交</el-button>
124 </div> 129 </div>
125 </el-dialog> 130 </el-dialog>
126 131
@@ -193,7 +198,11 @@ @@ -193,7 +198,11 @@
193 roleSign: 1, 198 roleSign: 1,
194 departmentId:'' 199 departmentId:''
195 }, 200 },
196 - 201 + dialogMap: {
  202 + update: '编辑',
  203 + create: '新增',
  204 + },
  205 + dialogStatus: 'create',
197 //新增界面是否显示 206 //新增界面是否显示
198 addFormVisible: false, 207 addFormVisible: false,
199 //设置权限界面是否显示 208 //设置权限界面是否显示
@@ -216,7 +225,8 @@ @@ -216,7 +225,8 @@
216 type: '', 225 type: '',
217 businessLicense: '', 226 businessLicense: '',
218 customsRegCode: '', 227 customsRegCode: '',
219 - parentName: '' 228 + parentName: '',
  229 + mqcode: ''
220 230
221 }, 231 },
222 permForm: { 232 permForm: {
@@ -348,9 +358,10 @@ @@ -348,9 +358,10 @@
348 * @param row 为这行的数据对象 358 * @param row 为这行的数据对象
349 */ 359 */
350 handleEdit: function (index, row) { 360 handleEdit: function (index, row) {
351 - this.editFormVisible = true;  
352 - this.editForm = Object.assign({}, row);  
353 - this.getdepartmentNames(); 361 + this.addFormVisible = true;
  362 + this.dialogStatus= 'update',
  363 + this.addForm = Object.assign({}, row);
  364 + // this.getdepartmentNames();
354 }, 365 },
355 setPerm: function (index, row) { 366 setPerm: function (index, row) {
356 this.PermFormVisible = true; 367 this.PermFormVisible = true;
@@ -376,6 +387,7 @@ @@ -376,6 +387,7 @@
376 //显示新增界面,每次点开初始化数据 387 //显示新增界面,每次点开初始化数据
377 handleAdd: function (index,row) { 388 handleAdd: function (index,row) {
378 this.addFormVisible = true; 389 this.addFormVisible = true;
  390 + this.dialogStatus= 'create';
379 this.addForm = { 391 this.addForm = {
380 description: '', 392 description: '',
381 roleName: '', 393 roleName: '',
@@ -384,6 +396,7 @@ @@ -384,6 +396,7 @@
384 type: '', 396 type: '',
385 businessLicense: '', 397 businessLicense: '',
386 customsRegCode: '', 398 customsRegCode: '',
  399 + mqcode: '',
387 parentid: 0 400 parentid: 0
388 401
389 }; 402 };
@@ -399,12 +412,12 @@ @@ -399,12 +412,12 @@
399 }, 412 },
400 //编辑 413 //编辑
401 editSubmit: function () { 414 editSubmit: function () {
402 - this.$refs.editForm.validate((valid) => { 415 + this.$refs.addForm.validate((valid) => {
403 if (valid) { 416 if (valid) {
404 this.$confirm('确认提交吗?', '提示', {}).then(() => { 417 this.$confirm('确认提交吗?', '提示', {}).then(() => {
405 - this.editLoading = true; 418 + this.addLoading = true;
406 //NProgress.start(); 419 //NProgress.start();
407 - let para = Object.assign({}, this.editForm); 420 + let para = Object.assign({}, this.addForm);
408 //不需要提交的 去掉,后端不好接收 421 //不需要提交的 去掉,后端不好接收
409 para.authorities = null; 422 para.authorities = null;
410 para.permissions = null; 423 para.permissions = null;
@@ -417,8 +430,8 @@ @@ -417,8 +430,8 @@
417 式; 430 式;
418 */ 431 */
419 /*moment 安装 npm install moment --save*/ 432 /*moment 安装 npm install moment --save*/
420 - para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss');  
421 - this.editLoading = false; 433 + // para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss');
  434 + this.addLoading = false;
422 edit(para).then((res) => { 435 edit(para).then((res) => {
423 436
424 //NProgress.done(); 437 //NProgress.done();
@@ -426,8 +439,8 @@ @@ -426,8 +439,8 @@
426 message: '提交成功', 439 message: '提交成功',
427 type: 'success' 440 type: 'success'
428 }); 441 });
429 - this.$refs['editForm'].resetFields();  
430 - this.editFormVisible = false; 442 + this.$refs['addForm'].resetFields();
  443 + this.addFormVisible = false;
431 this.getRoles(); 444 this.getRoles();
432 }).catch(error => alert(error)); 445 }).catch(error => alert(error));
433 }); 446 });