Commit 64383881 by 谢明辉

a

1 parent 2c4365cf
This diff could not be displayed because it is too large.
<template>
<div id="login_box" @click.ctrl.meta.alt="manager">
<el-row type="flex" justify="center" align="middle" style="height:80%">
<el-card class="box-card" shadow="hover" style="width:25%">
<el-card class="box-card" shadow="hover" style="min-width:25%">
<div slot="header" style="text-align:center" class="clearfix">
<span style="font-size:24px">合同管理系统</span>
</div>
......@@ -23,7 +23,7 @@
<el-form-item>
<el-button-group>
<el-button type="primary" @click="submitForm('login_form')">提交</el-button>
<el-button @click="resetForm('login_form')">重置</el-button>
<el-button @click="resetForm('login_form')">重置</el-button>
</el-button-group>
</el-form-item>
</el-form>
......@@ -33,325 +33,328 @@
</template>
<script>
export default {
name: "login",
data() {
return {
password_type: "password",
view_password: "icon i-password-not-view",
contract_base_url: disparch_data.contract_base_url,
code_base_url: disparch_data.code_base_url,
auth_base_url: disparch_data.auth_base_url,
net_error: false,
form: {
username: "",
password: ""
},
rules: {
username: [{ required: true, message: "请输入用户名", trigger: "blur" }]
// password: [
// { required: true, message: "请输入登录密码", trigger: "blur" }
// ]
}
};
},
methods: {
show_password() {
if (this.password_type == "password") {
(this.password_type = "text"),
(this.view_password = "icon i-password-view");
} else {
(this.password_type = "password"),
(this.view_password = "icon i-password-not-view");
}
export default {
name: "login",
data() {
return {
password_type: "password",
view_password: "icon i-password-not-view",
contract_base_url: this.$disparch_data.contract_base_url,
code_base_url: this.$disparch_data.code_base_url,
auth_base_url: this.$disparch_data.auth_base_url,
net_error: false,
form: {
username: "",
password: ""
},
rules: {
username: [{ required: true, message: "请输入用户名", trigger: "blur" }]
// password: [
// { required: true, message: "请输入登录密码", trigger: "blur" }
// ]
}
};
},
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users/login",
headers: { "Content-Type": "application/json" },
data: {
user_type: "user",
username: this.form.username,
password: this.form.password
}
})
.then(res => {
if (res.data.ecode) {
methods: {
show_password() {
if (this.password_type == "password") {
(this.password_type = "text"),
(this.view_password = "icon i-password-view");
} else {
(this.password_type = "password"),
(this.view_password = "icon i-password-not-view");
}
},
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users/login",
headers: { "Content-Type": "application/json" },
data: {
user_type: "user",
username: this.form.username,
password: this.form.password
}
})
.then(res => {
if (res.data.ecode) {
this.$message({
message: res.data.enote,
type: "error"
});
} else {
window.localStorage.setItem("username", this.form.username);
sessionStorage.setItem("login_check", true);
sessionStorage.setItem("user_unid", res.data.user_unid);
sessionStorage.setItem("rtoken", res.data.rtoken);
sessionStorage.setItem(
"user_roles",
JSON.stringify(res.data.roles)
);
sessionStorage.setItem("user_name", res.data.user_name);
this.get_provinces();
this.get_contract_state_data();
this.get_contract_type_data();
this.get_amount_state_unid_data();
this.get_mainten_start_point_data();
this.get_product_line_type_data();
this.get_payment_type_data();
this.$router.push({ path: "/nav/main" });
}
})
.catch(err => {
this.$message({
message: res.data.enote,
message: "登录错误",
type: "error"
});
} else {
window.localStorage.setItem("username", this.form.username);
sessionStorage.setItem("login_check",true)
sessionStorage.setItem("user_unid",res.data.user_unid)
sessionStorage.setItem("rtoken",res.data.rtoken)
sessionStorage.setItem("user_roles",JSON.stringify(res.data.roles));
sessionStorage.setItem("user_name",res.data.user_name)
this.get_provinces();
this.get_contract_state_data();
this.get_contract_type_data();
this.get_amount_state_unid_data();
this.get_mainten_start_point_data();
this.get_product_line_type_data();
this.get_payment_type_data();
this.$router.push({ path: "/nav/main" });
}
})
.catch(err => {
this.$message({
message: "登录错误",
type: "error"
});
});
}
});
},
resetForm(form) {
this.$refs[form].resetFields();
},
is_login() {},
get_provinces() {
this.$Axios({
method: "get",
url: this.code_base_url + "countries/0E229CD043/provinces"
})
.then(response => {
sessionStorage.setItem(
"provinces",
JSON.stringify(response.data.list_data)
);
}
});
},
resetForm(form) {
this.$refs[form].resetFields();
},
is_login() {},
get_provinces() {
this.$Axios({
method: "get",
url: this.code_base_url + "countries/0E229CD043/provinces"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(response => {
sessionStorage.setItem(
"provinces",
JSON.stringify(response.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_contract_state_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/13BEFACBCF/codes"
})
.then(res => {
sessionStorage.setItem(
"contract_state_data",
JSON.stringify(res.data.list_data)
);
},
get_contract_state_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/13BEFACBCF/codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(res => {
sessionStorage.setItem(
"contract_state_data",
JSON.stringify(res.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_contract_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/8EC31D08A0/codes"
})
.then(res => {
sessionStorage.setItem(
"contract_type_data",
JSON.stringify(res.data.list_data)
);
},
get_contract_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/8EC31D08A0/codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(res => {
sessionStorage.setItem(
"contract_type_data",
JSON.stringify(res.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_amount_state_unid_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/42407C5EF2/codes"
})
.then(res => {
sessionStorage.setItem(
"amount_state_unid_data",
JSON.stringify(res.data.list_data)
);
},
get_amount_state_unid_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/42407C5EF2/codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(res => {
sessionStorage.setItem(
"amount_state_unid_data",
JSON.stringify(res.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_mainten_start_point_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/55B997D596/codes"
})
.then(res => {
sessionStorage.setItem(
"mainten_start_point_data",
JSON.stringify(res.data.list_data)
);
},
get_mainten_start_point_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/55B997D596/codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(res => {
sessionStorage.setItem(
"mainten_start_point_data",
JSON.stringify(res.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_product_line_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/4FC51AD3C9/codes"
})
.then(res => {
sessionStorage.setItem(
"product_line_type_data",
JSON.stringify(res.data.list_data)
);
},
get_product_line_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/4FC51AD3C9/codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(res => {
sessionStorage.setItem(
"product_line_type_data",
JSON.stringify(res.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_payment_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/215649FB93/codes"
})
.then(res => {
sessionStorage.setItem(
"payment_type_data",
JSON.stringify(res.data.list_data)
);
},
get_payment_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/215649FB93/codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(res => {
sessionStorage.setItem(
"payment_type_data",
JSON.stringify(res.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_salesperson() {
this.$Axios({
method: "get",
url: this.auth_base_url + "users",
params: {
norm_type: "employee"
}
})
.then(response => {
sessionStorage.setItem(
"salesperson_unid_selected_data",
JSON.stringify(response.data.list_data)
);
},
get_salesperson() {
this.$Axios({
method: "get",
url: this.auth_base_url + "users",
params: {
norm_type: "employee"
}
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(response => {
sessionStorage.setItem(
"salesperson_unid_selected_data",
JSON.stringify(response.data.list_data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_contract_unid() {
this.$Axios({
method: "get",
url: this.contract_base_url + "codes"
})
.then(response => {
sessionStorage.setItem(
"contract_unid_selected_data",
JSON.stringify(response.data)
);
},
get_contract_unid() {
this.$Axios({
method: "get",
url: this.contract_base_url + "codes"
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(response => {
sessionStorage.setItem(
"contract_unid_selected_data",
JSON.stringify(response.data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
get_projects() {
this.$Axios({
method: "get",
url: this.contract_base_url + "projects",
headers: { "Content-Type": "application/json" }
})
.then(response => {
sessionStorage.setItem(
"project_unid_selected_data",
JSON.stringify(response.data)
);
},
get_projects() {
this.$Axios({
method: "get",
url: this.contract_base_url + "projects",
headers: { "Content-Type": "application/json" }
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(response => {
sessionStorage.setItem(
"project_unid_selected_data",
JSON.stringify(response.data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
},
manager() {
sessionStorage.setItem('manager','1')
sessionStorage.setItem('login_check','1')
this.get_provinces();
this.get_contract_state_data();
this.get_contract_type_data();
this.get_amount_state_unid_data();
this.get_mainten_start_point_data();
this.get_product_line_type_data();
this.get_payment_type_data();
this.$router.push({ path: "/nav/main" });
},
get_customers() {
this.$Axios({
method: "get",
url: this.contract_base_url + "customers",
headers: { "Content-Type": "application/json" }
})
.then(response => {
sessionStorage.setItem(
"customer_unid_selected_data",
JSON.stringify(response.data)
);
},
manager() {
sessionStorage.setItem("manager", "1");
sessionStorage.setItem("login_check", "1");
this.get_provinces();
this.get_contract_state_data();
this.get_contract_type_data();
this.get_amount_state_unid_data();
this.get_mainten_start_point_data();
this.get_product_line_type_data();
this.get_payment_type_data();
this.$router.push({ path: "/nav/main" });
},
get_customers() {
this.$Axios({
method: "get",
url: this.contract_base_url + "customers",
headers: { "Content-Type": "application/json" }
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
.then(response => {
sessionStorage.setItem(
"customer_unid_selected_data",
JSON.stringify(response.data)
);
})
.catch(err => {
this.$router.push({ path: "/" });
this.$message({
message: "网络错误",
type: "error"
});
});
});
}
},
mounted() {
this.form.username = localStorage.getItem("username");
}
},
mounted() {
this.form.username = localStorage.getItem("username");
}
};
};
</script>
<style scoped>
#login_box {
height: 100%;
}
#fankui{
#fankui {
text-align: center;
margin-top: 0;
}
......
......@@ -22,12 +22,25 @@
<el-button type="primary" @click="project_name_add">添加</el-button>
</el-col>
</el-row>
<el-row style="border-bottom:1px solid rgb(235, 238, 245);padding-bottom:18px">
<el-col :span="6">
<el-button class="add_button" type="primary" @click="add_login_user">添加登录用户</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-button class="add_button" type="primary" @click="login_user_dialog_show = true">添加登录用户</el-button>
<el-button class="add_button" type="primary" @click="product_line_type">产品线类型</el-button>
</el-col>
<el-col :span="6">
<el-button class="add_button" type="primary" @click="contract_statu">合同状态</el-button>
</el-col>
<el-col :span="6">
<el-button class="add_button" type="primary" @click="contract_type">合同性质</el-button>
</el-col>
<el-col :span="6">
<el-button class="add_button" type="primary" @click="amount_statu">账款状态</el-button>
</el-col>
</el-row>
<el-dialog id="login_user_dialog" title="添加登录户" :visible.sync="login_user_dialog_show" width="30%" :show-close="false">
<el-form :model="login_user_form" label-width="100px" label-position="left" :rules="login_user_form_rules" ref="login_user_form">
<el-form-item label="用户类型" prop="role_unid">
......@@ -43,224 +56,236 @@
<el-input v-model="login_user_form.name" placeholder="姓名" style="width:100%"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="login_user_dialog_cancel()">取 消</el-button>
<el-button type="primary" @click="login_user_dialog_confirm()">确 定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="add_dialog_show" width="30%" :show-close="false" style="max-height:800px">
<el-input v-model="add_data.text"></el-input>
<el-button type="primary" style="width:100%;margin-bottom:20px;margin-top:5px" @click="add_to_database">添加</el-button>
<el-table :data="add_data.data" highlight-current-row border>
<el-table-column label="名称" prop="name" min-width="30%" align="center">
</el-table-column>
<el-table-column label="码" prop="code" min-width="30%" align="center">
</el-table-column>
<el-table-column label="操作" min-width="20%" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="text" @click="delete_code(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
</el-card>
</template>
<script>
export default {
name: "manage",
data() {
return {
login_user_dialog_show: false,
code_base_url: disparch_data.code_base_url,
contract_base_url: disparch_data.contract_base_url,
auth_base_url: disparch_data.auth_base_url,
contract_unid: null,
customer_name: null,
salesperson: null,
project_name: null,
export default {
name: "manage",
data() {
return {
add_dialog_show: false,
login_user_dialog_show: false,
code_base_url: this.$disparch_data.code_base_url,
contract_base_url: this.$disparch_data.contract_base_url,
auth_base_url: this.$disparch_data.auth_base_url,
contract_unid: null,
customer_name: null,
salesperson: null,
project_name: null,
roles: [],
login_user_form: {
role_unid: "",
username: "",
name: "",
password: "0000",
norm_type: "login"
},
login_user_form_rules: {
username: {
required: true,
pattern: /^[a-zA-Z]{2,8}$/,
message: "请输入2至8位英文",
trigger: "blur"
add_data: {
text: null,
data: [],
url: null
},
name: {
required: true,
message: "请输入用户姓名",
trigger: "blur"
roles: [],
login_user_form: {
role_unid: "",
username: "",
name: "",
password: "0000",
norm_type: "login"
},
role_unid: {
required: true,
message: "请选择用户类型",
trigger: "blur"
login_user_form_rules: {
username: {
required: true,
pattern: /^[a-zA-Z]{2,8}$/,
message: "请输入2至8位英文",
trigger: "blur"
},
name: {
required: true,
message: "请输入用户姓名",
trigger: "blur"
},
role_unid: {
required: true,
message: "请选择用户类型",
trigger: "blur"
}
}
}
};
},
methods: {
contract_unid_add() {
if (this.contract_unid) {
this.$Axios({
method: "post",
data: { contract_unid: this.contract_unid },
url: this.contract_base_url,
headers: { "Content-Type": "application/json" }
})
.then(response => {
if (response.data.ecode == "200") {
this.contract_unid = null;
this.show_message("添加成功", "success");
} else if (response.data.ecode == "600") {
this.show_message("重复的合同编号", "error");
} else {
this.show_message("添加失败", "error");
}
})
.catch(err => {
console.log(err);
this.show_message("添加失败", "error");
});
} else {
this.show_message("请填写信息", "info");
}
};
},
customer_name_add() {
if (this.customer_name) {
methods: {
// -----------------------
product_line_type() {
this.add_data.url = this.code_base_url + "custom/cates/4FC51AD3C9/codes";
this.get_data(this.add_data.url);
},
contract_statu() {
this.add_data.url = this.code_base_url + "custom/cates/13BEFACBCF/codes";
this.get_data(this.add_data.url);
},
contract_type() {
this.add_data.url = this.code_base_url + "custom/cates/8EC31D08A0/codes";
this.get_data(this.add_data.url);
},
amount_statu() {
this.add_data.url = this.code_base_url + "custom/cates/42407C5EF2/codes";
this.get_data(this.add_data.url);
},
delete_code(data) {
this.$Axios({
method: "post",
url: this.contract_base_url + "customers",
data: { customer_name: this.customer_name },
headers: { "Content-Type": "application/json" }
method:'delete',
url:this.add_data.url + '/' + data.unid
}).then(res=>{
this.show_message('删除成功','success')
this.get_data(this.add_data.url)
})
.then(response => {
if (response.data.ecode == "200") {
this.customer_name = null;
this.show_message("添加成功", "success");
} else if (response.data.ecode == "600") {
this.show_message("重复的客户名称", "error");
} else {
this.show_message("添加失败", "error");
}
})
.catch(err => {
console.log(err);
this.show_message("添加失败", "error");
});
} else {
this.show_message("请填写信息", "info");
}
},
salesperson_add(type) {
if (this.salesperson) {
},
get_data(url) {
this.$Axios.get(url).then(res => {
if (res.data.list_data) {
this.add_data.data = res.data.list_data;
this.add_dialog_show = true;
}
});
},
add_to_database() {
var code = 0;
this.add_data.data.forEach(e => {
if (e.code > code) {
code = e.code;
}
});
code++;
this.$Axios({
method: "post",
url: this.auth_base_url + "users",
url: this.add_data.url,
data: {
norm_type: type,
username: this.salesperson,
name: this.salesperson,
password: "0000"
},
headers: { "Content-Type": "application/json" }
})
.then(response => {
if (response.data.name) {
this.salesperson = null;
this.show_message("添加成功", "success");
}
name: this.add_data.text,
note: this.add_data.text,
code: code
}
}).then(res => {
if (res.data.code == code) {
this.show_message("添加成功", "success");
this.add_data.text = null;
this.get_data(this.add_data.url);
}
});
},
// -----------------------
contract_unid_add() {
if (this.contract_unid) {
this.$Axios({
method: "post",
data: { contract_unid: this.contract_unid },
url: this.contract_base_url,
headers: { "Content-Type": "application/json" }
})
.catch(err => {
this.show_message("添加失败", "error");
console.log(err.message);
});
} else {
this.show_message("请填写信息", "info");
}
},
project_name_add() {
if (this.project_name) {
this.$Axios({
method: "post",
url: this.contract_base_url + "projects",
data: { project_name: this.project_name },
headers: { "Content-Type": "application/json" }
})
.then(response => {
this.project_name = null;
if (response.data.ecode == "200") {
this.show_message("添加成功", "success");
} else if (response.data.ecode == "600") {
this.show_message("重复的项目名称", "error");
} else {
.then(response => {
if (response.data.ecode == "200") {
this.contract_unid = null;
this.show_message("添加成功", "success");
} else if (response.data.ecode == "600") {
this.show_message("重复的合同编号", "error");
} else {
this.show_message("添加失败", "error");
}
})
.catch(err => {
console.log(err);
this.show_message("添加失败", "error");
}
});
} else {
this.show_message("请填写信息", "info");
}
},
customer_name_add() {
if (this.customer_name) {
this.$Axios({
method: "post",
url: this.contract_base_url + "customers",
data: { customer_name: this.customer_name },
headers: { "Content-Type": "application/json" }
})
.catch(err => {
console.log(err);
this.show_message("添加失败", "error");
});
} else {
this.show_message("请填写信息", "info");
}
},
show_message(message, type) {
this.$message({
message: message,
type: type,
center: true,
showClose: true,
duration: 3000
});
},
get_roles() {
this.$Axios({
method: "get",
url: this.auth_base_url + "roles"
})
.then(response => {
if (response.data.list_data) {
this.roles = response.data.list_data;
}
})
.catch(err => {
console.log(err.message);
});
},
login_user_dialog_cancel() {
this.$refs["login_user_form"].resetFields();
this.login_user_dialog_show = false;
},
login_user_dialog_confirm() {
this.$refs["login_user_form"].validate(valid => {
if (valid) {
.then(response => {
if (response.data.ecode == "200") {
this.customer_name = null;
this.show_message("添加成功", "success");
} else if (response.data.ecode == "600") {
this.show_message("重复的客户名称", "error");
} else {
this.show_message("添加失败", "error");
}
})
.catch(err => {
console.log(err);
this.show_message("添加失败", "error");
});
} else {
this.show_message("请填写信息", "info");
}
},
salesperson_add(type) {
if (this.salesperson) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users",
headers: { "Content-Type": "application/json" },
data: this.login_user_form
data: {
norm_type: type,
username: this.salesperson,
name: this.salesperson,
password: "0000"
},
headers: { "Content-Type": "application/json" }
})
.then(res => {
if (res.data.user_unid) {
this.$Axios({
method: "post",
url:
this.auth_base_url +
"users/" +
res.data.user_unid +
"/roles",
headers: { "Content-Type": "application/json" },
data: {
role_unid: this.login_user_form.role_unid
}
})
.then(res => {
this.show_message("添加成功,默认密码: 0000", "success");
this.$refs["login_user_form"].resetFields();
this.login_user_dialog_show = false;
})
.catch(err => {
this.login_user_dialog_show = false;
this.show_message("添加失败", "error");
});
.then(response => {
if (response.data.name) {
this.salesperson = null;
this.show_message("添加成功", "success");
}
})
.catch(err => {
this.show_message("添加失败", "error");
console.log(err.message);
});
} else {
this.show_message("请填写信息", "info");
}
},
project_name_add() {
if (this.project_name) {
this.$Axios({
method: "post",
url: this.contract_base_url + "projects",
data: { project_name: this.project_name },
headers: { "Content-Type": "application/json" }
})
.then(response => {
this.project_name = null;
if (response.data.ecode == "200") {
this.show_message("添加成功", "success");
} else if (response.data.ecode == "600") {
this.show_message("重复的项目名称", "error");
} else {
this.show_message("添加失败", "error");
}
......@@ -269,14 +294,87 @@ export default {
console.log(err);
this.show_message("添加失败", "error");
});
} else {
this.show_message("请填写信息", "info");
}
});
}
},
created() {
this.get_roles();
}
};
},
show_message(message, type) {
this.$message({
message: message,
type: type,
center: true,
showClose: true,
duration: 3000
});
},
add_login_user() {
this.$Axios({
method: "get",
url: this.auth_base_url + "roles"
})
.then(response => {
if (response.data.list_data) {
this.roles = response.data.list_data;
this.login_user_dialog_show = true;
} else {
this.show_message("失败", "error");
}
})
.catch(err => {
this.show_message("失败", "error");
console.log(err.message);
});
},
login_user_dialog_cancel() {
this.$refs["login_user_form"].resetFields();
this.login_user_dialog_show = false;
},
login_user_dialog_confirm() {
this.$refs["login_user_form"].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users",
headers: { "Content-Type": "application/json" },
data: this.login_user_form
})
.then(res => {
if (res.data.user_unid) {
this.$Axios({
method: "post",
url:
this.auth_base_url +
"users/" +
res.data.user_unid +
"/roles",
headers: { "Content-Type": "application/json" },
data: {
role_unid: this.login_user_form.role_unid
}
})
.then(res => {
this.show_message("添加成功,默认密码: 0000", "success");
this.$refs["login_user_form"].resetFields();
this.login_user_dialog_show = false;
})
.catch(err => {
this.login_user_dialog_show = false;
this.show_message("添加失败", "error");
});
} else {
this.show_message("添加失败", "error");
}
})
.catch(err => {
console.log(err);
this.show_message("添加失败", "error");
});
}
});
}
},
created() {}
};
</script>
<style scoped>
......@@ -289,7 +387,8 @@ export default {
.add_button {
display: inline-block;
font-size: 18px;
width: 80%;
width: 75%;
min-width: 200px;
margin-top: 20px;
}
......
......@@ -14,14 +14,14 @@
<i class="icon i-file"></i>
<span slot="title">合同信息</span>
</el-menu-item>
<el-menu-item index="/nav/manage" v-show="management">
<i class="icon i-setting"></i>
<span slot="title">后台管理</span>
</el-menu-item>
<el-menu-item index="/nav/user">
<i class="icon i-user"></i>
<span slot="title">个人管理</span>
</el-menu-item>
<el-menu-item index="/nav/manage" v-show="management">
<i class="icon i-setting"></i>
<span slot="title">后台管理</span>
</el-menu-item>
<el-menu-item index="" @click="exit">
<i class="icon i-login"></i>
<span slot="title">退出</span>
......@@ -39,65 +39,71 @@
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
management: false,
username: "",
department: "",
collapse: true,
contract_show: true,
};
},
export default {
name: "HelloWorld",
data() {
return {
management: false,
username: "",
department: "",
collapse: true,
contract_show: true
};
},
methods: {
contract() {
if (sessionStorage.getItem("modify")) {
sessionStorage.removeItem("modify");
methods: {
contract() {
if (sessionStorage.getItem("modify")) {
sessionStorage.removeItem("modify");
}
},
exit() {
this.$confirm("确认退出?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
sessionStorage.clear();
this.$router.push({ path: "/" });
})
.catch(() => {});
}
},
exit() {
this.$confirm("确认退出?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
sessionStorage.clear();
this.$router.push({ path: "/" });
})
.catch(() => {});
}
},
beforeCreate() {
if (!sessionStorage.getItem("login_check")) {
alert("请登录");
this.$router.push({ path: "/" });
}
},
created() {
if (sessionStorage.getItem("user_roles") != "null" && sessionStorage.getItem("user_roles")) {
var roles = JSON.parse(sessionStorage.getItem("user_roles"));
for (let i = 0; i < roles.length; i++) {
const e = roles[i];
if (e.role_unid == "91d5185d47e3bad099e17570b0dd0ed2") {
this.management = true;
beforeCreate() {
if (!sessionStorage.getItem("login_check")) {
alert("请登录");
this.$router.push({ path: "/" });
}
},
created() {
if (
sessionStorage.getItem("user_roles") != "null" &&
sessionStorage.getItem("user_roles")
) {
var roles = JSON.parse(sessionStorage.getItem("user_roles"));
for (let i = 0; i < roles.length; i++) {
const e = roles[i];
if (e.role_unid == "91d5185d47e3bad099e17570b0dd0ed2") {
}
}
} else {
this.contract_show = false;
}
if (sessionStorage.getItem("user_name") === "Admin") {
this.management = true;
}
if (sessionStorage.getItem("manager")) {
this.management = true;
this.contract_show = true;
}
}else{
this.contract_show = false;
}
if (sessionStorage.getItem("manager")) {
this.management = true;
this.contract_show = true;
}
}
};
};
</script>
<style>
.el-container > .el-main {
min-width: 1120px;
text-align: center;
padding-top: 0;
padding-left: 0;
......@@ -106,10 +112,10 @@ export default {
}
.el-container,
.el-aside {
min-width: 167px;
height: 100%;
}
.el-aside > .el-menu {
height: 100%;
}
</style>
......@@ -316,418 +316,428 @@
</template>
<script>
const twodecimalrule = {
pattern: /((^[1-9]\d*)|^0)(\.\d{2})$/,
message: "请输入数字并保留两位小数",
trigger: "blur"
};
export default {
name: "search",
data() {
return {
sales: false,
salesperson_name: null,
provinces: [],
cities: [],
counties: [],
code_base_url: disparch_data.code_base_url,
contract_base_url: disparch_data.contract_base_url,
month_list: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12"
],
contract_state_data: [],
contract_type_data: [],
product_line_type_data: [],
amount_state_unid_data: [],
search_form: {
contract_unid: null,
salesperson_unid: null,
salesperson_name__like: null,
project_name__like: null,
customer_name__like: null,
guarantee_period: null,
year: null,
month: null,
contract_state: null,
contract_type: null,
product_line_type: null,
acceptance_type: null,
is_archive: null,
amount_state_unid: null,
confirm_income_amount: null,
province: null,
city: null,
// county: null,
start_data: null,
end_date: null,
overdays_start_point: null,
overdays_end_point: null,
amount_start_point: null,
amount_end_point: null,
leave_amount_start_point: null,
leave_amount_end_point: null
},
const twodecimalrule = {
pattern: /((^[1-9]\d*)|^0)(\.\d{2})$/,
message: "请输入数字并保留两位小数",
trigger: "blur"
};
export default {
name: "search",
data() {
return {
sales: false,
salesperson_name: null,
provinces: [],
cities: [],
counties: [],
code_base_url: this.$disparch_data.code_base_url,
contract_base_url: this.$disparch_data.contract_base_url,
month_list: [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12"
],
contract_state_data: [],
contract_type_data: [],
product_line_type_data: [],
amount_state_unid_data: [],
search_form: {
contract_unid: null,
salesperson_unid: null,
salesperson_name__like: null,
project_name__like: null,
customer_name__like: null,
guarantee_period: null,
year: null,
month: null,
contract_state: null,
contract_type: null,
product_line_type: null,
acceptance_type: null,
is_archive: null,
amount_state_unid: null,
confirm_income_amount: null,
province: null,
city: null,
// county: null,
start_data: null,
end_date: null,
overdays_start_point: null,
overdays_end_point: null,
amount_start_point: null,
amount_end_point: null,
leave_amount_start_point: null,
leave_amount_end_point: null
},
list_data: [],
limit: 10,
total_data: 0,
current_page: 1,
list_data: [],
limit: 10,
total_data: 0,
current_page: 1,
search_form_rules: {
confirm_income_amount: twodecimalrule,
amount_start_point: twodecimalrule,
amount_end_point: twodecimalrule,
leave_amount_start_point: twodecimalrule,
leave_amount_end_point: twodecimalrule,
overdays_start_point: {
pattern: /((^[1-9]\d*)|^0)$/,
message: "请输入正确天数",
trigger: "blur"
},
overdays_end_point: {
pattern: /((^[1-9]\d*)|^0)$/,
message: "请输入正确天数",
trigger: "blur"
search_form_rules: {
confirm_income_amount: twodecimalrule,
amount_start_point: twodecimalrule,
amount_end_point: twodecimalrule,
leave_amount_start_point: twodecimalrule,
leave_amount_end_point: twodecimalrule,
overdays_start_point: {
pattern: /((^[1-9]\d*)|^0)$/,
message: "请输入正确天数",
trigger: "blur"
},
overdays_end_point: {
pattern: /((^[1-9]\d*)|^0)$/,
message: "请输入正确天数",
trigger: "blur"
}
}
}
};
},
computed: {
year_list: function() {
var arr = [];
for (let i = 2000; i < 2041; i++) {
arr.push(i);
}
return arr;
};
},
offset() {
return (this.current_page - 1) * this.limit;
},
guarantee_period_list() {
var arr = [];
var a = 6;
for (let i = 0; i < 10; i++) {
const element = (10)[i];
arr.push(a);
a += 6;
computed: {
year_list: function() {
var a = new Date().getFullYear();
var arr = [];
for (let i = a; i >= 2000; i--) {
arr.push(i);
}
return arr;
},
offset() {
return (this.current_page - 1) * this.limit;
},
guarantee_period_list() {
var arr = [];
var a = 6;
for (let i = 0; i < 10; i++) {
const element = (10)[i];
arr.push(a);
a += 6;
}
return arr;
}
return arr;
}
},
methods: {
import_click() {
document.getElementById("import_unview").click();
},
import_contract() {
if (!document.getElementById("import_unview").files[0]) {
return;
}
var form = new FormData();
form.append("file", document.getElementById("import_unview").files[0]);
this.$Axios({
method: "post",
url: this.contract_base_url + "import",
data: form
})
.then(res => {
if (res.data.ecode == "500") {
this.$message.error(res.data.enote);
} else if (res.data.ecode == "200") {
this.$message({
type: "success",
message: "导入成功"
});
} else if (res.data != [] && res.data[0].contract_unid) {
var message = [];
const h = this.$createElement;
res.data.forEach(e => {
message.push(h("p", null, e.contract_unid));
});
this.$message({
type: "warning",
message: "部分导入信息数据校验未通过,请检查后重新导入",
duration: 5000
});
this.$notify({
title: "校验未通过的合同的编号为:",
duration: 0,
message: h("p", null, message),
type: "error"
});
} else {
if (res.data.length > 0) {
methods: {
import_click() {
document.getElementById("import_unview").click();
},
import_contract() {
if (!document.getElementById("import_unview").files[0]) {
return;
}
var form = new FormData();
form.append("file", document.getElementById("import_unview").files[0]);
this.$Axios({
method: "post",
url: this.contract_base_url + "import",
data: form
})
.then(res => {
if (res.data.ecode == "500") {
this.$message.error(res.data.enote);
} else if (res.data.ecode == "200") {
this.$message({
type: "success",
message: "导入成功"
});
} else if (res.data != [] && res.data[0].contract_unid) {
var message = [];
const h = this.$createElement;
res.data.forEach(e => {
message.push(h("p", null, e));
message.push(h("p", null, e.contract_unid));
});
this.$message({
type: "warning",
message: "部分导入信息已存在,请检查后重新导入",
message: "部分导入信息数据校验未通过,请检查后重新导入",
duration: 5000
});
this.$notify({
title: "重复的数据编号",
title: "校验未通过的合同的编号为:",
duration: 0,
message: h("p", null, message),
type: "error"
});
} else {
if (res.data.length > 0) {
var message = [];
const h = this.$createElement;
res.data.forEach(e => {
message.push(h("p", null, e));
});
this.$message({
type: "warning",
message: "部分导入信息已存在,请检查后重新导入",
duration: 5000
});
this.$notify({
title: "重复的数据编号",
duration: 0,
message: h("p", null, message),
type: "error"
});
}
}
}
var node = document.getElementById("import_unview");
node.value = "";
})
.catch(err => {
console.log(err.message);
});
},
// get start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get_amount_state_unid_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/42407C5EF2/codes"
})
.then(res => {
this.amount_state_unid_data = res.data.list_data;
})
.catch(err => {});
},
get_contract_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/8EC31D08A0/codes"
})
.then(res => {
this.contract_type_data = res.data.list_data;
var node = document.getElementById("import_unview");
node.value = "";
})
.catch(err => {
console.log(err.message);
});
},
// get start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
get_amount_state_unid_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/42407C5EF2/codes"
})
.catch(err => {});
},
get_contract_state_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/13BEFACBCF/codes"
})
.then(res => {
this.contract_state_data = res.data.list_data;
.then(res => {
this.amount_state_unid_data = res.data.list_data;
})
.catch(err => {});
},
get_contract_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/8EC31D08A0/codes"
})
.catch(err => {});
},
get_product_line_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/4FC51AD3C9/codes"
})
.then(res => {
this.product_line_type_data = res.data.list_data;
.then(res => {
this.contract_type_data = res.data.list_data;
})
.catch(err => {});
},
get_contract_state_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/13BEFACBCF/codes"
})
.catch(err => {});
},
get_provinces() {
this.$Axios({
method: "get",
url: this.code_base_url + "countries/0E229CD043/provinces"
})
.then(response => {
this.provinces = response.data.list_data;
.then(res => {
this.contract_state_data = res.data.list_data;
})
.catch(err => {});
},
get_product_line_type_data() {
this.$Axios({
method: "get",
url: this.code_base_url + "custom/cates/4FC51AD3C9/codes"
})
.catch(err => {
console.log(err.message);
});
},
get_cities() {
this.search_form.city = "";
// this.search_form.county = "";
if (this.search_form.province) {
.then(res => {
this.product_line_type_data = res.data.list_data;
})
.catch(err => {});
},
get_provinces() {
this.$Axios({
method: "get",
url:
this.code_base_url +
"countries/0E229CD043/provinces/" +
this.search_form.province +
"/cities"
url: this.code_base_url + "countries/0E229CD043/provinces"
})
.then(response => {
this.cities = response.data.list_data;
this.provinces = response.data.list_data;
})
.catch(err => {
console.log(err.message);
});
}
},
get_counties() {
// this.search_form.county = "";
if (this.search_form.province && this.search_form.city) {
},
get_cities() {
this.search_form.city = "";
// this.search_form.county = "";
if (this.search_form.province) {
this.$Axios({
method: "get",
url:
this.code_base_url +
"countries/0E229CD043/provinces/" +
this.search_form.province +
"/cities"
})
.then(response => {
this.cities = response.data.list_data;
})
.catch(err => {
console.log(err.message);
});
}
},
// get_counties() {
// // this.search_form.county = "";
// if (this.search_form.province && this.search_form.city) {
// this.$Axios({
// method: "get",
// url:
// this.code_base_url +
// "countries/0E229CD043/provinces/" +
// this.search_form.province +
// "/cities/" +
// this.search_form.city +
// "/counties"
// })
// .then(response => {
// this.counties = response.data.list_data;
// })
// .catch(err => {
// console.log(err.message);
// });
// }
// },
get_list_data() {
var a = this.search_form;
a.offset = this.offset;
a.limit = this.limit;
this.$Axios({
method: "get",
url:
this.code_base_url +
"countries/0E229CD043/provinces/" +
this.search_form.province +
"/cities/" +
this.search_form.city +
"/counties"
methods: "get",
url: this.contract_base_url,
params: a,
headers: { "Content-Type": "application/json" }
})
.then(response => {
this.counties = response.data.list_data;
if (response.data.ecode == "500") {
this.$message.error("筛选异常");
return;
}
this.total_data = response.data.total_number;
this.list_data = response.data.list_data;
for (let i = 0; i < this.list_data.length; i++) {
const e = this.list_data[i];
for (let j = 0; j < this.contract_state_data.length; j++) {
const a = this.contract_state_data[j];
if (e.contract_state == a.code) {
this.list_data[i].contract_state_name = a.name;
}
}
for (let k = 0; k < this.product_line_type_data.length; k++) {
const b = this.product_line_type_data[k];
if (e.product_line_type == b.code) {
this.list_data[i].product_line_type_name = b.name;
}
}
if (!e.over_days) {
e.over_days = 0;
}
}
})
.catch(err => {
console.log(err.message);
});
}
},
get_list_data() {
var a = this.search_form;
a.offset = this.offset;
a.limit = this.limit;
this.$Axios({
methods: "get",
url: this.contract_base_url,
params: a,
headers: { "Content-Type": "application/json" }
})
.then(response => {
if (response.data.ecode == "500") {
this.$message.error("筛选异常");
return;
}
this.total_data = response.data.total_number;
this.list_data = response.data.list_data;
for (let i = 0; i < this.list_data.length; i++) {
const e = this.list_data[i];
for (let j = 0; j < this.contract_state_data.length; j++) {
const a = this.contract_state_data[j];
if (e.contract_state == a.code) {
this.list_data[i].contract_state_name = a.name;
}
}
for (let k = 0; k < this.product_line_type_data.length; k++) {
const b = this.product_line_type_data[k];
if (e.product_line_type == b.code) {
this.list_data[i].product_line_type_name = b.name;
}
}
if (!e.over_days) {
e.over_days = 0;
}
},
get_year(date) {
if (date) {
return date.slice(0, 4);
}
},
get_month(date) {
if (date) {
return date.slice(5, 7);
}
},
// get end---------------------------------------------------------------------------------------------
reset() {
this.$refs["search_form"].resetFields();
},
commit() {
this.$refs["search_form"].validate(valid => {
if (valid) {
this.current_page = 1;
sessionStorage.setItem(
"search_condition",
JSON.stringify(this.search_form)
);
this.get_list_data();
}else {
this.$message({
type:'warning',
message:'请检查数据格式是否正确'
})
}
})
.catch(err => {
console.log(err.message);
});
},
get_year(date) {
if (date) {
return date.slice(0, 4);
},
page_change(val) {
this.search_form = JSON.parse(sessionStorage.getItem("search_condition"));
this.current_page = val;
console.log(this.current_page);
this.get_list_data();
},
export_contract() {
this.$Axios({
method: "get",
url: this.contract_base_url + "export",
params: this.search_form,
responseType: "blob"
})
.then(res => {
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel;charset=UTF-8"
});
// let ourl = URL.createObjectURL(blob);
// window.location.href = ourl;
var downloadElement = document.createElement("a");
var href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = "合同.xlsx"; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
})
.catch(err => {
console.log(err.message);
});
},
go_to(id) {
sessionStorage.setItem("modify", "1");
this.$router.push("/nav/contract/" + id);
}
},
get_month(date) {
if (date) {
return date.slice(5, 7);
created() {
if (sessionStorage.getItem("user_roles") == "null") {
this.salesperson_name = sessionStorage.getItem("user_name");
this.sales = true;
this.search_form.salesperson_unid = sessionStorage.getItem("user_unid");
}
if (sessionStorage.getItem("provinces")) {
this.provinces = JSON.parse(sessionStorage.getItem("provinces"));
} else {
this.get_provinces();
}
if (sessionStorage.getItem("amount_state_unid_data")) {
this.amount_state_unid_data = JSON.parse(
sessionStorage.getItem("amount_state_unid_data")
);
} else {
this.get_amount_state_unid_data();
}
if (sessionStorage.getItem("contract_type_data")) {
this.contract_type_data = JSON.parse(
sessionStorage.getItem("contract_type_data")
);
} else {
this.get_contract_type_data();
}
if (sessionStorage.getItem("contract_state_data")) {
this.contract_state_data = JSON.parse(
sessionStorage.getItem("contract_state_data")
);
} else {
this.get_contract_state_data();
}
if (sessionStorage.getItem("product_line_type_data")) {
this.product_line_type_data = JSON.parse(
sessionStorage.getItem("product_line_type_data")
);
} else {
this.get_product_line_type_data();
}
},
// get end---------------------------------------------------------------------------------------------
reset() {
this.$refs["search_form"].resetFields();
},
commit() {
this.current_page = 1;
sessionStorage.setItem(
"search_condition",
JSON.stringify(this.search_form)
);
this.get_list_data();
},
page_change(val) {
this.search_form = JSON.parse(sessionStorage.getItem("search_condition"));
this.current_page = val;
console.log(this.current_page);
this.get_list_data();
},
export_contract() {
this.$Axios({
method: "get",
url: this.contract_base_url + "export",
params: this.search_form,
responseType: "blob"
})
.then(res => {
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel;charset=UTF-8"
});
// let ourl = URL.createObjectURL(blob);
// window.location.href = ourl;
var downloadElement = document.createElement("a");
var href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = "合同.xlsx"; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
})
.catch(err => {
console.log(err.message);
});
},
go_to(id) {
sessionStorage.setItem("modify", "1");
this.$router.push("/nav/contract/" + id);
}
},
created() {
if (sessionStorage.getItem("user_roles") == "null") {
this.salesperson_name = sessionStorage.getItem("user_name");
this.sales = true;
this.search_form.salesperson_unid = sessionStorage.getItem("user_unid");
}
if (sessionStorage.getItem("provinces")) {
this.provinces = JSON.parse(sessionStorage.getItem("provinces"));
} else {
this.get_provinces();
}
if (sessionStorage.getItem("amount_state_unid_data")) {
this.amount_state_unid_data = JSON.parse(
sessionStorage.getItem("amount_state_unid_data")
);
} else {
this.get_amount_state_unid_data();
}
if (sessionStorage.getItem("contract_type_data")) {
this.contract_type_data = JSON.parse(
sessionStorage.getItem("contract_type_data")
);
} else {
this.get_contract_type_data();
}
if (sessionStorage.getItem("contract_state_data")) {
this.contract_state_data = JSON.parse(
sessionStorage.getItem("contract_state_data")
);
} else {
this.get_contract_state_data();
}
if (sessionStorage.getItem("product_line_type_data")) {
this.product_line_type_data = JSON.parse(
sessionStorage.getItem("product_line_type_data")
);
} else {
this.get_product_line_type_data();
}
}
};
};
</script>
<style scoped>
......
......@@ -24,139 +24,141 @@
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('password_form')">提交</el-button>
<el-button @click="resetForm('password_form')">重置</el-button>
<el-button-group>
<el-button type="primary" @click="submitForm('password_form')">提交</el-button>
<el-button type="warning" @click="resetForm('password_form')">重置</el-button>
</el-button-group>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
export default {
name: "user",
data() {
return {
new_password_type: "password",
odd_password_type: "password",
new_password_view: "icon i-password-not-view",
odd_password_view: "icon i-password-not-view",
rtoken: "",
user_unid: "",
auth_base_url: disparch_data.auth_base_url,
password_form: {
odd_password: "",
new_password: "",
check_password: ""
},
password_form_rules: {
odd_password: {
required: true,
message: "请填写旧密码",
trigger: "blur"
export default {
name: "user",
data() {
return {
new_password_type: "password",
odd_password_type: "password",
new_password_view: "icon i-password-not-view",
odd_password_view: "icon i-password-not-view",
rtoken: "",
user_unid: "",
auth_base_url: this.$disparch_data.auth_base_url,
password_form: {
odd_password: "",
new_password: "",
check_password: ""
},
new_password: [
{
pattern: /^[A-Za-z\d]{6,}$/,
message: "密码至少6位",
trigger: "blur"
},
{
password_form_rules: {
odd_password: {
required: true,
message: "必须填写新密码",
message: "请填写旧密码",
trigger: "blur"
},
{
validator: (rule, value, callback) => {
if (value == this.password_form.odd_password) {
callback(new Error("新密码不能和旧密码相同"));
} else callback();
new_password: [
{
pattern: /^[A-Za-z0-9\x20-\x7f]{6,16}$/,
message: "密码至少6位,至多16位",
trigger: "blur"
},
trigger: "blur"
}
],
check_password: [
{
pattern: /^[A-Za-z\d]{6,}$/,
message: "密码至少6位",
trigger: "blur"
},
{
required: true,
message: "必须填写新密码",
trigger: "blur"
},
{
validator: (rule, value, callback) => {
if (value != this.password_form.new_password) {
callback(new Error("两次输入不一致"));
} else callback();
{
required: true,
message: "必须填写新密码",
trigger: "blur"
},
trigger: "blur"
{
validator: (rule, value, callback) => {
if (value == this.password_form.odd_password) {
callback(new Error("新密码不能和旧密码相同"));
} else callback();
},
trigger: "blur"
}
],
check_password: [
{
pattern: /^[A-Za-z0-9\x20-\x7f]{6,16}$/,
message: "密码至少6位,至多16位",
trigger: "blur"
},
{
required: true,
message: "必须填写新密码",
trigger: "blur"
},
{
validator: (rule, value, callback) => {
if (value != this.password_form.new_password) {
callback(new Error("两次输入不一致"));
} else callback();
},
trigger: "blur"
}
]
}
};
},
methods: {
show_odd_password() {
if (this.odd_password_type == "password") {
this.odd_password_type = "text";
this.odd_password_view = "icon i-password-view";
} else {
this.odd_password_type = "password";
this.odd_password_view = "icon i-password-not-view";
}
},
show_new_password() {
if (this.new_password_type == "password") {
this.new_password_type = "text";
this.new_password_view = "icon i-password-view";
} else {
this.new_password_type = "password";
this.new_password_view = "icon i-password-not-view";
}
},
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users/" + this.user_unid + "/password",
headers: { authorization: this.rtoken },
data: {
old_pwd: this.password_form.odd_password,
new_pwd: this.password_form.new_password
}
})
.then(response => {
if (response.data.user_unid) {
this.$message({
type: "success",
message: "修改成功"
});
this.resetForm("password_form");
}
})
.catch(err => {
this.$message.error("修改失败");
this.resetForm("password_form");
});
}
]
}
};
},
methods: {
show_odd_password() {
if (this.odd_password_type == "password") {
this.odd_password_type = "text";
this.odd_password_view = "icon i-password-view";
} else {
this.odd_password_type = "password";
this.odd_password_view = "icon i-password-not-view";
});
},
resetForm(form) {
this.$refs[form].resetFields();
}
},
show_new_password() {
if (this.new_password_type == "password") {
this.new_password_type = "text";
this.new_password_view = "icon i-password-view";
created() {
if (!sessionStorage.getItem("user_unid")) {
this.$router.push("/");
} else {
this.new_password_type = "password";
this.new_password_view = "icon i-password-not-view";
this.rtoken = sessionStorage.getItem("rtoken");
this.user_unid = sessionStorage.getItem("user_unid");
}
},
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users/" + this.user_unid + "/password",
headers: { authorization: this.rtoken },
data: {
old_pwd: this.password_form.odd_password,
new_pwd: this.password_form.new_password
}
})
.then(response => {
if (response.data.user_unid) {
this.$message({
type: "success",
message: "修改成功"
});
this.resetForm("password_form");
}
})
.catch(err => {
this.$message.error("修改失败");
this.resetForm("password_form");
});
}
});
},
resetForm(form) {
this.$refs[form].resetFields();
}
},
created() {
if (!sessionStorage.getItem("user_unid")) {
this.$router.push("/");
} else {
this.rtoken = sessionStorage.getItem("rtoken");
this.user_unid = sessionStorage.getItem("user_unid");
}
}
};
};
</script>
......
......@@ -9,7 +9,6 @@ import CollapseTransition from 'element-ui/lib/transitions/collapse-transition';
import 'element-ui/lib/theme-chalk/index.css'
import '../static/city-data'
// import "./mock"
import '../static/disparch'
import './assets/icons/iconfont.css'
import 'babel-polyfill'
......@@ -76,6 +75,23 @@ Axios.interceptors.response.use((response) => {
return Promise.reject(err);
});
{
if (window.location.host == 'localhost:8089') {
Vue.prototype.$disparch_data = {
code_base_url: "http://192.168.9.162:20080/api/v1/codes/",
contract_base_url: "http://192.168.9.162:20080/api/v1/financial/contracts/",
auth_base_url: "http://192.168.9.162:20080/api/v1/auth/"
}
} else {
var url = window.location.host;
Vue.prototype.$disparch_data = {
code_base_url: "http://" + url + "/api/v1/codes/",
contract_base_url: "http://" + url + "/api/v1/financial/contracts/",
auth_base_url: "http://" + url + "/api/v1/auth/"
}
}
}
new Vue({
......
disparch_data = {
code_base_url: "http://192.168.9.162:20080/api/v1/codes/",
contract_base_url: "http://192.168.9.162:20080/api/v1/financial/contracts/",
auth_base_url: "http://192.168.9.162:20080/api/v1/auth/"
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!