|
@@ -91,6 +91,16 @@
|
|
v-hasPermi="['system:user:add']"
|
|
v-hasPermi="['system:user:add']"
|
|
>新增</el-button>
|
|
>新增</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ plain
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="handleAdds"
|
|
|
|
+ v-hasPermi="['system:user:add']"
|
|
|
|
+ >批量新增</el-button>
|
|
|
|
+ </el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
<el-button
|
|
type="success"
|
|
type="success"
|
|
@@ -307,6 +317,36 @@
|
|
<el-button @click="cancel">取 消</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+ <el-dialog title="批量新增" :visible.sync="open2" width="400px" append-to-body>
|
|
|
|
+ <el-form ref="form2" :model="form2" :rules="rules2" label-width="80px">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="账号前缀" prop="userName">
|
|
|
|
+ <el-input v-model="form2.userName" placeholder="请输入账号前缀" maxlength="30" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="归属部门" prop="deptId">
|
|
|
|
+ <treeselect v-model="form2.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24">
|
|
|
|
+ <el-form-item label="账号数量" prop="delFlag">
|
|
|
|
+ <number v-model="form2.delFlag" :min="1" :max="500" placeholder="请输入账号数量"></number>
|
|
|
|
+ <!--<el-input v-model="form.delFlag" placeholder="请输入账号数量"></el-input>-->
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button type="primary" @click="submitForm2">确 定</el-button>
|
|
|
|
+ <el-button @click="open2=false">取 消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
|
|
<!-- 用户导入对话框 -->
|
|
<!-- 用户导入对话框 -->
|
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
|
@@ -341,7 +381,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
|
|
|
|
|
|
+import { listUser, getUser, delUser, addUser,batchInsert, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
|
|
import { getToken } from "@/utils/auth";
|
|
import { getToken } from "@/utils/auth";
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
@@ -384,6 +424,8 @@ export default {
|
|
roleOptions: [],
|
|
roleOptions: [],
|
|
// 表单参数
|
|
// 表单参数
|
|
form: {},
|
|
form: {},
|
|
|
|
+ form2:{},
|
|
|
|
+ open2:false,
|
|
defaultProps: {
|
|
defaultProps: {
|
|
children: "children",
|
|
children: "children",
|
|
label: "label"
|
|
label: "label"
|
|
@@ -423,6 +465,15 @@ export default {
|
|
{ key: 6, label: `创建时间`, visible: true }
|
|
{ key: 6, label: `创建时间`, visible: true }
|
|
],
|
|
],
|
|
// 表单校验
|
|
// 表单校验
|
|
|
|
+ rules2:{
|
|
|
|
+ userName: [
|
|
|
|
+ { required: true, message: "账号前缀不能为空", trigger: "blur" },
|
|
|
|
+ { min: 2, max: 6, message: '账号前缀长度必须介于 2 和 6 之间', trigger: 'blur' }
|
|
|
|
+ ],
|
|
|
|
+ delFlag: [
|
|
|
|
+ { required: true, message: "账号数量不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
rules: {
|
|
rules: {
|
|
userName: [
|
|
userName: [
|
|
{ required: true, message: "用户名称不能为空", trigger: "blur" },
|
|
{ required: true, message: "用户名称不能为空", trigger: "blur" },
|
|
@@ -526,6 +577,15 @@ export default {
|
|
};
|
|
};
|
|
this.resetForm("form");
|
|
this.resetForm("form");
|
|
},
|
|
},
|
|
|
|
+ reset2() {
|
|
|
|
+ this.form2 = {
|
|
|
|
+ deptId: undefined,
|
|
|
|
+ userName: undefined,
|
|
|
|
+ userId: undefined,
|
|
|
|
+ delFlag: undefined,
|
|
|
|
+ };
|
|
|
|
+ this.resetForm("form2");
|
|
|
|
+ },
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.queryParams.pageNum = 1;
|
|
@@ -569,6 +629,10 @@ export default {
|
|
this.form.password = this.initPassword;
|
|
this.form.password = this.initPassword;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ handleAdds(){
|
|
|
|
+ this.reset2()
|
|
|
|
+ this.open2 = true;
|
|
|
|
+ },
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
this.reset();
|
|
@@ -603,6 +667,23 @@ export default {
|
|
const userId = row.userId;
|
|
const userId = row.userId;
|
|
this.$router.push("/system/user-auth/role/" + userId);
|
|
this.$router.push("/system/user-auth/role/" + userId);
|
|
},
|
|
},
|
|
|
|
+ submitForm2:function(){
|
|
|
|
+ this.$refs["form2"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.open2 = false;
|
|
|
|
+ // batchInsert(this.form2).then(response => {
|
|
|
|
+ //
|
|
|
|
+ // this.getList();
|
|
|
|
+ // }).catch(()=>{
|
|
|
|
+ // this.open2 = false;
|
|
|
|
+ // })
|
|
|
|
+ this.download('system/user/batchInsert', {
|
|
|
|
+ ...this.form2
|
|
|
|
+ }, `user_${new Date().getTime()}.xlsx`)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
submitForm: function() {
|
|
submitForm: function() {
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
@@ -667,4 +748,4 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-</script>
|
|
|
|
|
|
+</script>
|