作者 王勇

Merge remote-tracking branch 'origin/master'

... ... @@ -39,6 +39,8 @@
</el-table-column>
<el-table-column prop="customsRegCode" label="海关备案代码" min-width="150" >
</el-table-column>
<el-table-column prop="mqcode" label="海关通道编号" min-width="150" >
</el-table-column>
<el-table-column label="操作" min-width="260">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="handleAdd(scope.$index, scope.row)">新增下级</el-button>
... ... @@ -55,37 +57,8 @@
</el-pagination>
</el-col>
<!--编辑界面-->
<el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false">
<el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm">
<el-form-item label="ID">
<span>{{editForm.roleId}}</span>
</el-form-item>
<el-form-item label="岗位名称">
<el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input>
</el-form-item>
<el-form-item label="岗位描述">
<el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input>
</el-form-item>
<el-form-item label="部门名称">
<el-select v-model="editForm.departmentId" placeholder="请选择">
<el-option
v-for="item in departmentNameList"
:key="item.departmentId"
:label="item.departmentName"
:value="item.departmentId">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="editFormVisible = false">取消</el-button>
<el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
</div>
</el-dialog>
<!--新增界面-->
<el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false">
<el-dialog :title="dialogMap[dialogStatus]" :visible.sync="addFormVisible" :close-on-click-modal="false">
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
<el-form-item label="上级组织机构">
<span>{{addForm.parentName}}</span>
... ... @@ -96,7 +69,7 @@
<el-form-item label="组织机构描述" prop="description">
<el-input v-model="addForm.description" auto-complete="off" placeholder="组织机构描述:例如:组织机构简介"></el-input>
</el-form-item>
<el-form-item label="组织机构类型" prop="description">
<el-form-item label="组织机构类型" prop="type">
<el-select
v-model="addForm.type"
filterable
... ... @@ -111,16 +84,19 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="工商企业代码" prop="description">
<el-form-item label="工商企业代码" prop="businessLicense">
<el-input v-model="addForm.businessLicense" auto-complete="off" placeholder="社会信用代码或者组织机构代码"></el-input>
</el-form-item>
<el-form-item label="海关备案代码" prop="description">
<el-form-item label="海关备案代码" prop="customsRegCode">
<el-input v-model="addForm.customsRegCode" auto-complete="off" placeholder="海关备案后返回的备案代码"></el-input>
</el-form-item>
<el-form-item label="海关通道编号" prop="mqcode">
<el-input v-model="addForm.mqcode" auto-complete="off" placeholder="海关通道编号"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="addFormVisible = false">取消</el-button>
<el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
<el-button type="primary" @click="dialogStatus==='create'?addSubmit():editSubmit()" :loading="addLoading" >提交</el-button>
</div>
</el-dialog>
... ... @@ -177,23 +153,11 @@
pageSize: 5,
listLoading: false,
sels: [],//列表选中列
//编辑界面是否显示
editFormVisible: false,
editLoading: false,
editFormRules: {
roleName: [
{ required: true, message: '请输入岗位/角色名称', trigger: 'blur' }
]
},
//编辑界面数据
editForm: {
roleId: 1,
description: '',
roleName: '',
roleSign: 1,
departmentId:''
dialogMap: {
update: '编辑',
create: '新增',
},
dialogStatus: 'create',
//新增界面是否显示
addFormVisible: false,
//设置权限界面是否显示
... ... @@ -216,7 +180,8 @@
type: '',
businessLicense: '',
customsRegCode: '',
parentName: ''
parentName: '',
mqcode: ''
},
permForm: {
... ... @@ -348,9 +313,10 @@
* @param row 为这行的数据对象
*/
handleEdit: function (index, row) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
this.getdepartmentNames();
this.addFormVisible = true;
this.dialogStatus= 'update',
this.addForm = Object.assign({}, row);
// this.getdepartmentNames();
},
setPerm: function (index, row) {
this.PermFormVisible = true;
... ... @@ -376,6 +342,7 @@
//显示新增界面,每次点开初始化数据
handleAdd: function (index,row) {
this.addFormVisible = true;
this.dialogStatus= 'create';
this.addForm = {
description: '',
roleName: '',
... ... @@ -384,6 +351,7 @@
type: '',
businessLicense: '',
customsRegCode: '',
mqcode: '',
parentid: 0
};
... ... @@ -399,12 +367,12 @@
},
//编辑
editSubmit: function () {
this.$refs.editForm.validate((valid) => {
this.$refs.addForm.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.editLoading = true;
this.addLoading = true;
//NProgress.start();
let para = Object.assign({}, this.editForm);
let para = Object.assign({}, this.addForm);
//不需要提交的 去掉,后端不好接收
para.authorities = null;
para.permissions = null;
... ... @@ -417,8 +385,8 @@
式;
*/
/*moment 安装 npm install moment --save*/
para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss');
this.editLoading = false;
// para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss');
this.addLoading = false;
edit(para).then((res) => {
//NProgress.done();
... ... @@ -426,8 +394,8 @@
message: '提交成功',
type: 'success'
});
this.$refs['editForm'].resetFields();
this.editFormVisible = false;
this.$refs['addForm'].resetFields();
this.addFormVisible = false;
this.getRoles();
}).catch(error => alert(error));
});
... ...