Commit d538929a by 谢明辉

添加注释

1 parent 12e3d367
.DS_Store .DS_Store
node_modules/
/dist/ /dist/
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
<body style="height: 100%;margin: 0"> <body style="height: 100%;margin: 0">
<div id="app"></div> <div id="app"></div>
<audio src="./static/" autoplay="autoplay"></audio>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
......
...@@ -948,30 +948,44 @@ ...@@ -948,30 +948,44 @@
}; };
}, },
computed: { computed: {
// 账款状态
get_amount_state() { get_amount_state() {
var weibao_code = "";
this.contract_type_data.forEach(e => {
e.name == "维保" ? (weibao_code = e.code) : null;
});
var now_date = var now_date =
new Date().getFullYear() + new Date().getFullYear() +
"-" + "-" +
(new Date().getMonth() + 1) + (new Date().getMonth() + 1) +
"-" + "-" +
new Date().getDate(); new Date().getDate();
// 定义状态和权重 over 定义逾期,normal定义正常
var over = { var over = {
amount_state: null, amount_state: null,
weight: -1 weight: -1
}; };
var normal = { var normal = {
amount_state: null amount_state: null,
weight: -1
}; };
var amount = 0; var amount = 0;
var contract_amount = this.form.contract_amount; var contract_amount = this.form.contract_amount;
var total_reback_amount = this.total_reback_amount; var total_reback_amount = this.total_reback_amount;
/**
* 这里有个问题,就是必须得按照预付款、到货款、验收款、质保款的
* 顺序插入,不然计算会出问题。解决方案是先定义金额的对象循环一遍
* 把金额取出来,然后根据不同类型来加金额比如说预付款就只取预付款,
* 到货款就取到货款和预付款。
*/
this.payments_data.forEach(e => { this.payments_data.forEach(e => {
var _this = this; var _this = this;
amount += e.payment_propority * parseFloat(contract_amount);
switch (e.payment_type) { switch (e.payment_type) {
//预付款和维保款的判断 //预付款和维保款的判断
case "100001": case "100001":
if (_this.form.sign_date) { if (_this.form.sign_date) {
amount += e.payment_propority * parseFloat(contract_amount);
//小于说明逾期了,然后再判断钱 //小于说明逾期了,然后再判断钱
if ( if (
_this.date_diff( _this.date_diff(
...@@ -981,13 +995,14 @@ ...@@ -981,13 +995,14 @@
amount > total_reback_amount amount > total_reback_amount
) { ) {
over.weight = 8; over.weight = 8;
if (_this.form.contract_type != "40003") { if (_this.form.contract_type != weibao_code) {
over.amount_state = "50006"; //逾期预付款 over.amount_state = "50006"; //逾期预付款
} else { } else {
over.amount_state = "50012"; //逾期维保款 over.amount_state = "50012"; //逾期维保款
} }
} else { } else if (normal.weight < 1) {
if (_this.form.contract_type != "40003") { normal.weight = 1;
if (_this.form.contract_type != weibao_code) {
normal.amount_state = "50003"; //正常预付款 normal.amount_state = "50003"; //正常预付款
} else { } else {
normal.amount_state = "50002"; //正常维保款 normal.amount_state = "50002"; //正常维保款
...@@ -1002,7 +1017,6 @@ ...@@ -1002,7 +1017,6 @@
_this.delivers_data[0] && _this.delivers_data[0] &&
_this.delivers_data[0].goods_acceptanc_date _this.delivers_data[0].goods_acceptanc_date
) { ) {
amount += e.payment_propority * parseFloat(contract_amount);
if ( if (
_this.date_diff( _this.date_diff(
now_date, now_date,
...@@ -1022,9 +1036,11 @@ ...@@ -1022,9 +1036,11 @@
over.amount_state = "50009"; //逾期质保款 over.amount_state = "50009"; //逾期质保款
} }
} else { } else {
if (e.payment_type == "100002") { if (e.payment_type == "100002" && normal.weight < 2) {
normal.weight = 2;
normal.amount_state = "50004"; //正常到货款 normal.amount_state = "50004"; //正常到货款
} else { } else {
normal.weight = 4;
normal.amount_state = "50005"; //正常质保款 normal.amount_state = "50005"; //正常质保款
} }
} }
...@@ -1033,7 +1049,6 @@ ...@@ -1033,7 +1049,6 @@
case "100003": case "100003":
case "100005": case "100005":
if (_this.final_acceptancs_form.acceptanc_date) { if (_this.final_acceptancs_form.acceptanc_date) {
amount += e.payment_propority * parseFloat(contract_amount);
if ( if (
_this.date_diff( _this.date_diff(
now_date, now_date,
...@@ -1052,9 +1067,11 @@ ...@@ -1052,9 +1067,11 @@
over.amount_state = "50009"; //逾期质保款 over.amount_state = "50009"; //逾期质保款
} }
} else { } else {
if (e.payment_type == "100003") { if (e.payment_type == "100003" && normal.weight < 3) {
normal.weight = 3;
normal.amount_state = "50001"; //正常验收款 normal.amount_state = "50001"; //正常验收款
} else { } else {
normal.weight = 4;
normal.amount_state = "50005"; //正常质保款 normal.amount_state = "50005"; //正常质保款
} }
} }
...@@ -1070,6 +1087,10 @@ ...@@ -1070,6 +1087,10 @@
return normal.amount_state; return normal.amount_state;
} }
}, },
/**
* 省、市的格式为‘unid#name’,所以要分割后取出
*/
get_province_unid() { get_province_unid() {
if (this.form.province_value) { if (this.form.province_value) {
return this.form.province_value.split("#")[0]; return this.form.province_value.split("#")[0];
...@@ -1121,17 +1142,13 @@ ...@@ -1121,17 +1142,13 @@
// 合同余额 // 合同余额
contract_remaining: function() { contract_remaining: function() {
var a = var a =
this.form.contract_amount - (this.form.contract_amount ? this.form.contract_amount : 0) -
this.form.deduct_amount - (this.form.deduct_amount ? this.form.deduct_amount : 0) -
this.total_reback_amount - (this.total_reback_amount ? this.total_reback_amount : 0) -
this.form.stop_amount - (this.form.stop_amount ? this.form.stop_amount : 0) -
this.form.exemptions_amount - (this.form.exemptions_amount ? this.form.exemptions_amount : 0) -
this.form.bad_amount; (this.form.bad_amount ? this.form.bad_amount : 0);
if (isNaN(a)) { return a.toFixed(2);
return null;
} else {
return a.toFixed(2);
}
}, },
// 累计回款额 // 累计回款额
total_reback_amount: function() { total_reback_amount: function() {
...@@ -1161,17 +1178,17 @@ ...@@ -1161,17 +1178,17 @@
// 应收账款余额 // 应收账款余额
total_leave_amount: function() { total_leave_amount: function() {
var a = var a =
this.total_receive_amount - (this.total_receive_amount ? this.total_receive_amount : 0) -
this.total_reback_amount - (this.total_reback_amount ? this.total_reback_amount : 0) -
this.form.deduct_amount - (this.form.deduct_amount ? this.form.deduct_amount : 0) -
this.form.stop_amount - (this.form.stop_amount ? this.form.stop_amount : 0) -
this.form.exemptions_amount - (this.form.exemptions_amount ? this.form.exemptions_amount : 0) -
this.form.bad_amount; (this.form.bad_amount ? this.form.bad_amount : 0);
if (isNaN(a)) { // if (isNaN(a)) {
return null; // return null;
} else { // } else {
return a.toFixed(2); return a.toFixed(2);
} // }
}, },
// 逾期天数 // 逾期天数
over_days_unid: function() { over_days_unid: function() {
...@@ -1194,6 +1211,10 @@ ...@@ -1194,6 +1211,10 @@
return days; return days;
}, },
// 维保服务期开始时间 // 维保服务期开始时间
/**
* 因为维保服务期用了选时间段的控件,需要绑定一个数组,所以在这里
* 拆分,或者可以定义这两个时间点,拼成一个数组交给控件。
*/
start_guarantee_date: function() { start_guarantee_date: function() {
if (this.guarantee_date && this.guarantee_date[0]) { if (this.guarantee_date && this.guarantee_date[0]) {
return this.guarantee_date[0]; return this.guarantee_date[0];
...@@ -1205,6 +1226,9 @@ ...@@ -1205,6 +1226,9 @@
return this.guarantee_date[1]; return this.guarantee_date[1];
} }
}, },
/**
* 同一默认为一个时间点所以注释掉其他的
*/
mainten_start_date: function() { mainten_start_date: function() {
// if ( // if (
// this.form.mainten_start_point == "60001" && // this.form.mainten_start_point == "60001" &&
...@@ -1227,6 +1251,9 @@ ...@@ -1227,6 +1251,9 @@
return this.final_acceptancs_form.acceptanc_date; return this.final_acceptancs_form.acceptanc_date;
} }
}, },
/**
* 同一默认为一个时间点所以注释掉其他的
*/
mainten_end_date: function() { mainten_end_date: function() {
// if ( // if (
// this.form.mainten_start_point == "60001" && // this.form.mainten_start_point == "60001" &&
...@@ -1261,13 +1288,10 @@ ...@@ -1261,13 +1288,10 @@
} }
}, },
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// methods++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
methods: { methods: {
/**
* 合同信息中显示显示更多按钮的点击
*/
show_more() { show_more() {
this.hide_contract_info = !this.hide_contract_info; this.hide_contract_info = !this.hide_contract_info;
this.hide_contract_info == true this.hide_contract_info == true
...@@ -1277,10 +1301,16 @@ ...@@ -1277,10 +1301,16 @@
? (this.hide_icon = "icon i-arrowdown-copy") ? (this.hide_icon = "icon i-arrowdown-copy")
: (this.hide_icon = "icon i-arrowup"); : (this.hide_icon = "icon i-arrowup");
}, },
/**
*下载附件
*/
download_file(f) { download_file(f) {
window.open(f.url); window.open(f.url);
}, },
// upload+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // upload+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* 上传附件
*/
contract_upload(f) { contract_upload(f) {
let param = new FormData(); //创建form对象 let param = new FormData(); //创建form对象
param.append("appendix_files", f.file); //通过append向form对象添加数据 param.append("appendix_files", f.file); //通过append向form对象添加数据
...@@ -1313,6 +1343,9 @@ ...@@ -1313,6 +1343,9 @@
}; };
xhr.send(param); xhr.send(param);
}, },
/**
* 上传附件
*/
delivers_upload(f) { delivers_upload(f) {
let param = new FormData(); //创建form对象 let param = new FormData(); //创建form对象
param.append("appendix_files", f.file); //通过append向form对象添加数据 param.append("appendix_files", f.file); //通过append向form对象添加数据
...@@ -1345,6 +1378,9 @@ ...@@ -1345,6 +1378,9 @@
}; };
xhr.send(param); xhr.send(param);
}, },
/**
* 上传附件
*/
acceptances_upload(f) { acceptances_upload(f) {
let param = new FormData(); //创建form对象 let param = new FormData(); //创建form对象
param.append("appendix_files", f.file); //通过append向form对象添加数据 param.append("appendix_files", f.file); //通过append向form对象添加数据
...@@ -1409,10 +1445,16 @@ ...@@ -1409,10 +1445,16 @@
}; };
xhr.send(param); xhr.send(param);
}, },
/**
* 没做删除功能
*/
on_remove(file, fileList) { on_remove(file, fileList) {
this.$alert("暂时不能删除"); this.$alert("暂时不能删除");
}, },
// upload+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // upload+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/**
* 累计开票金额需要从第一条加到最后一条
*/
total_receipt_amount_cal(index) { total_receipt_amount_cal(index) {
var total_receipt_amount = 0; var total_receipt_amount = 0;
for (let i = index; i >= 0; i--) { for (let i = index; i >= 0; i--) {
...@@ -1422,6 +1464,9 @@ ...@@ -1422,6 +1464,9 @@
} }
return parseFloat(total_receipt_amount).toFixed(2); return parseFloat(total_receipt_amount).toFixed(2);
}, },
/**
* 判断是否回款
*/
is_reback_cal(index) { is_reback_cal(index) {
var total_receipt_amount = 0; var total_receipt_amount = 0;
for (let i = index; i >= 0; i--) { for (let i = index; i >= 0; i--) {
...@@ -1482,6 +1527,9 @@ ...@@ -1482,6 +1527,9 @@
// dialog_cancel~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // dialog_cancel~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// date_methods~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // date_methods~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* date1 - date2 所得天数
*/
date_diff(date1, date2) { date_diff(date1, date2) {
if (date1 && date2) { if (date1 && date2) {
var date1s = date1.split("-"); var date1s = date1.split("-");
...@@ -1497,6 +1545,9 @@ ...@@ -1497,6 +1545,9 @@
return days; return days;
} }
}, },
/**
* 一个日期加上天数
*/
date_add_days(datestr, daynum) { date_add_days(datestr, daynum) {
if (datestr && daynum != null) { if (datestr && daynum != null) {
var date_str = datestr; var date_str = datestr;
...@@ -1511,6 +1562,9 @@ ...@@ -1511,6 +1562,9 @@
return result_date; return result_date;
} }
}, },
/**
* 日期加月数
*/
date_add_month(datestr, month) { date_add_month(datestr, month) {
if (datestr && month) { if (datestr && month) {
var dates = datestr.split("-"); var dates = datestr.split("-");
...@@ -1522,8 +1576,9 @@ ...@@ -1522,8 +1576,9 @@
} }
}, },
// date_methods~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // date_methods~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
// remoteMethod~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * 获得所有的合同编号
*/
get_contract_unid() { get_contract_unid() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -1536,6 +1591,9 @@ ...@@ -1536,6 +1591,9 @@
console.log(err.message); console.log(err.message);
}); });
}, },
/**
* 得到销售人员列表
*/
get_salesperson() { get_salesperson() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -1551,8 +1609,6 @@ ...@@ -1551,8 +1609,6 @@
console.log(err.message); console.log(err.message);
}); });
}, },
// remoteMethod~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// dialog_confirm_start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // dialog_confirm_start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
payments_dialog_confirm() { payments_dialog_confirm() {
this.$refs["payments_form"].validate(valid => { this.$refs["payments_form"].validate(valid => {
...@@ -1566,14 +1622,16 @@ ...@@ -1566,14 +1622,16 @@
var type_value = this.payments_form.payment_type; var type_value = this.payments_form.payment_type;
// 总比例为1,用1减去每个已存的比例,剩下的如果小于本次比例,那么添加不成功 // 总比例为1,用1减去每个已存的比例,剩下的如果小于本次比例,那么添加不成功
var total_propority = 1; debugger;
var total_propority = 100;
for (let i = 0; i < this.payments_data.length; i++) { for (let i = 0; i < this.payments_data.length; i++) {
const e = this.payments_data[i]; const e = this.payments_data[i];
if (! this.modify_data) { if (!this.modify_data) {
total_propority -= e.payment_propority; total_propority -= e.payment_propority * 100;
}else if (i != this.modify_index) { } else if (i != this.modify_index) {
total_propority -= e.payment_propority; total_propority -= e.payment_propority * 100;
}{ }
{
} }
if ( if (
((type_value == "100004" || type_value == "100005") && ((type_value == "100004" || type_value == "100005") &&
...@@ -1589,11 +1647,10 @@ ...@@ -1589,11 +1647,10 @@
} }
} }
} }
if (total_propority < propority) { if (total_propority < propority * 100) {
this.$message.error("请检查付款比例是否正确"); this.$message.error("请检查付款比例是否正确");
return; return;
} }
var a = { var a = {
payment_unid: payment_unid, payment_unid: payment_unid,
payment_type: type_value, payment_type: type_value,
...@@ -1722,7 +1779,9 @@ ...@@ -1722,7 +1779,9 @@
}); });
}, },
// dialog_confirm_end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // dialog_confirm_end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* 删除某条数据,可以换成switch
*/
data_delete(index, data, appendUrl) { data_delete(index, data, appendUrl) {
var a; var a;
var id; var id;
...@@ -1797,7 +1856,7 @@ ...@@ -1797,7 +1856,7 @@
}); });
}, },
// modif ystart~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // modify start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
payment_data_modify(index, data) { payment_data_modify(index, data) {
this.$set(this.payments_form, "payment_unid", data[index].payment_unid); this.$set(this.payments_form, "payment_unid", data[index].payment_unid);
this.$set(this.payments_form, "payment_type", data[index].payment_type); this.$set(this.payments_form, "payment_type", data[index].payment_type);
...@@ -1872,6 +1931,9 @@ ...@@ -1872,6 +1931,9 @@
// modifyend~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // modifyend~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// getlocation start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // getlocation start~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* 根据code匹配付款类型的名字
*/
get_payment_type(index) { get_payment_type(index) {
for (let i = 0; i < this.payment_type_data.length; i++) { for (let i = 0; i < this.payment_type_data.length; i++) {
const e = this.payment_type_data[i]; const e = this.payment_type_data[i];
...@@ -1881,6 +1943,9 @@ ...@@ -1881,6 +1943,9 @@
} }
return "无"; return "无";
}, },
/**
* 获取付款类型列表
*/
get_payment_type_data() { get_payment_type_data() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -1891,6 +1956,9 @@ ...@@ -1891,6 +1956,9 @@
}) })
.catch(err => {}); .catch(err => {});
}, },
/**
* 获取产品线类型列表
*/
get_product_line_type_data() { get_product_line_type_data() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -1901,6 +1969,9 @@ ...@@ -1901,6 +1969,9 @@
}) })
.catch(err => {}); .catch(err => {});
}, },
/**
* 获取合同状态列表
*/
get_contract_state_data() { get_contract_state_data() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -1911,6 +1982,9 @@ ...@@ -1911,6 +1982,9 @@
}) })
.catch(err => {}); .catch(err => {});
}, },
/**
* 获取合同性质列表
*/
get_contract_type_data() { get_contract_type_data() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -1943,6 +2017,9 @@ ...@@ -1943,6 +2017,9 @@
console.log(err.message); console.log(err.message);
}); });
}, },
/**
* 根据省来获取市的列表
*/
get_cities() { get_cities() {
this.form.city_value = ""; this.form.city_value = "";
// this.form.county_value = ""; // this.form.county_value = "";
...@@ -1984,6 +2061,9 @@ ...@@ -1984,6 +2061,9 @@
// }); // });
// } // }
// }, // },
/**
* 根据不同的付款类型计算他们的付款日期
*/
get_pay_date(index) { get_pay_date(index) {
var date = ""; var date = "";
var type = this.payments_data[index].payment_type; var type = this.payments_data[index].payment_type;
...@@ -2010,6 +2090,9 @@ ...@@ -2010,6 +2090,9 @@
} }
return date; return date;
}, },
/**
* 根据付款比例计算应付金额
*/
get_pay_amount(index) { get_pay_amount(index) {
var amount = 0; var amount = 0;
if (this.form.contract_amount > 0) { if (this.form.contract_amount > 0) {
...@@ -2019,6 +2102,9 @@ ...@@ -2019,6 +2102,9 @@
} }
return amount; return amount;
}, },
/**
* 获取客户名称列表
*/
get_customers() { get_customers() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -2032,6 +2118,9 @@ ...@@ -2032,6 +2118,9 @@
console.log(err.message); console.log(err.message);
}); });
}, },
/**
* 获取项目名称列表
*/
get_projects() { get_projects() {
this.$Axios({ this.$Axios({
method: "get", method: "get",
...@@ -2045,6 +2134,10 @@ ...@@ -2045,6 +2134,10 @@
console.log(err.message); console.log(err.message);
}); });
}, },
/**
* 下面几个方法用于得到各自部分信息
* 在初始化和提交操作后进行调用
*/
get_project_info(id) { get_project_info(id) {
if (id != "0") { if (id != "0") {
this.$Axios({ this.$Axios({
...@@ -2477,16 +2570,12 @@ ...@@ -2477,16 +2570,12 @@
if (this.form.end_guarantee_date) { if (this.form.end_guarantee_date) {
this.$delete(this.form, "end_guarantee_date"); this.$delete(this.form, "end_guarantee_date");
} }
this.guarantee_date = []; this.guarantee_date = [,];
if (response.data.start_guarantee_date) { if (response.data.start_guarantee_date) {
this.guarantee_date.push(response.data.start_guarantee_date); this.guarantee_date[0] = response.data.start_guarantee_date;
} else {
this.guarantee_date.push("");
} }
if (response.data.end_guarantee_date) { if (response.data.end_guarantee_date) {
this.guarantee_date.push(response.data.end_guarantee_date); this.guarantee_date[1] = response.data.end_guarantee_date;
} else {
this.guarantee_date.push("");
} }
} }
}) })
...@@ -2495,6 +2584,9 @@ ...@@ -2495,6 +2584,9 @@
}); });
// } // }
}, },
/**
* 调用以上所有方法
*/
get_all(id) { get_all(id) {
this.get_contract_info(id); this.get_contract_info(id);
this.get_deliver_info(id); this.get_deliver_info(id);
...@@ -2506,6 +2598,9 @@ ...@@ -2506,6 +2598,9 @@
// getlocation end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // getlocation end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// !!!!!!~~~~~~~~~~~~~submittttttt~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // !!!!!!~~~~~~~~~~~~~submittttttt~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* 提交表单,根据表名提交
*/
form_submit(name) { form_submit(name) {
var a = this.form; var a = this.form;
Object.keys(a).forEach(key => { Object.keys(a).forEach(key => {
...@@ -2934,9 +3029,16 @@ ...@@ -2934,9 +3029,16 @@
break; break;
} }
}, },
/**
* 改变合同编号时要刷新数据
* 刷新数据是在watch中监视路由的变化进行的
*/
change_unid(id) { change_unid(id) {
this.$router.push("" + id); this.$router.push("" + id);
}, },
/**
* 用来改变dialog的背景颜色,mounted时进行调用
*/
change_dialog() { change_dialog() {
if (localStorage.getItem("style")) { if (localStorage.getItem("style")) {
var style = JSON.parse(localStorage.getItem("style")); var style = JSON.parse(localStorage.getItem("style"));
...@@ -2950,6 +3052,9 @@ ...@@ -2950,6 +3052,9 @@
} }
}, },
created() { created() {
/**
* 获取用户权限
*/
if ( if (
sessionStorage.getItem("user_roles") != "null" && sessionStorage.getItem("user_roles") != "null" &&
sessionStorage.getItem("user_roles") sessionStorage.getItem("user_roles")
...@@ -2972,6 +3077,9 @@ ...@@ -2972,6 +3077,9 @@
if (sessionStorage.getItem("manager")) { if (sessionStorage.getItem("manager")) {
this.disabled_list = [0, 0, 0, 0]; this.disabled_list = [0, 0, 0, 0];
} }
/**
* 数据初始化
*/
if (sessionStorage.getItem("provinces")) { if (sessionStorage.getItem("provinces")) {
this.provinces = JSON.parse(sessionStorage.getItem("provinces")); this.provinces = JSON.parse(sessionStorage.getItem("provinces"));
} else { } else {
...@@ -3045,6 +3153,10 @@ ...@@ -3045,6 +3153,10 @@
if (id != 0) { if (id != 0) {
this.get_all(id); this.get_all(id);
} }
/**
* 如果是修改状态,则不能改变合同编号
* 将合同编号栏设为disabled
*/
if (sessionStorage.getItem("modify")) { if (sessionStorage.getItem("modify")) {
this.contract_unid_disabled = true; this.contract_unid_disabled = true;
} else { } else {
...@@ -3066,6 +3178,7 @@ ...@@ -3066,6 +3178,7 @@
this.rebacks_data = []; this.rebacks_data = [];
this.receipts_data = []; this.receipts_data = [];
this.delivers_data = []; this.delivers_data = [];
this.guarantee_date = [,];
this.$refs["first_acceptancs_form"].resetFields(); this.$refs["first_acceptancs_form"].resetFields();
this.$refs["final_acceptancs_form"].resetFields(); this.$refs["final_acceptancs_form"].resetFields();
this.$refs["contract_form"].resetFields(); this.$refs["contract_form"].resetFields();
......
...@@ -94,6 +94,9 @@ ...@@ -94,6 +94,9 @@
JSON.stringify(res.data.roles) JSON.stringify(res.data.roles)
); );
sessionStorage.setItem("user_name", res.data.user_name); sessionStorage.setItem("user_name", res.data.user_name);
/**
* 这里应该用axios.all()
*/
this.get_provinces(); this.get_provinces();
this.get_contract_state_data(); this.get_contract_state_data();
this.get_contract_type_data(); this.get_contract_type_data();
......
...@@ -196,6 +196,11 @@ ...@@ -196,6 +196,11 @@
}, },
methods: { methods: {
//search //search
/**
* 可以在新增前四个选项是弹出提示框,
* 列出已存在的,当键入已存在合同就会出现。
* 没什么用处啊。。。
*/
search_contract_unid(queryString, cb) { search_contract_unid(queryString, cb) {
var contract_unid_data = this.contract_unid_data; var contract_unid_data = this.contract_unid_data;
var results = queryString var results = queryString
...@@ -342,6 +347,9 @@ ...@@ -342,6 +347,9 @@
}) })
.catch(() => {}); .catch(() => {});
}, },
/**
* 更新数据统一调用的方法,add_data是自定义的对象
*/
get_data(url) { get_data(url) {
this.$Axios.get(url).then(res => { this.$Axios.get(url).then(res => {
if (res.data.list_data) { if (res.data.list_data) {
......
...@@ -31,15 +31,23 @@ ...@@ -31,15 +31,23 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row style="text-align:left"> <el-row style="text-align:left">
<el-col :span="12"> <el-col :span="6">
<el-form-item label="应收账款余额" prop="leave_amount_start_point"> <el-form-item label="所属年份" prop="year">
<el-input v-model="search_form.leave_amount_start_point" placeholder="不填默认为0"></el-input> <el-select v-model="search_form.year" clearable>
<el-option v-for="n in year_list" :key="n" :label="n" :value="n">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item prop="leave_amount_end_point"> </el-col>
<el-input v-model="search_form.leave_amount_end_point" placeholder="不填则无上限"></el-input> <el-col :span="6">
<el-form-item label="所属月份" prop="month">
<el-select v-model="search_form.month" clearable>
<el-option v-for="n in month_list" :key="n" :label="n" :value="n">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="6">
<el-form-item label="销售员" v-if="sales"> <el-form-item label="销售员" v-if="sales">
<el-input style="width:217px" :readonly="true" v-model="salesperson_name"></el-input> <el-input style="width:217px" :readonly="true" v-model="salesperson_name"></el-input>
</el-form-item> </el-form-item>
...@@ -47,6 +55,24 @@ ...@@ -47,6 +55,24 @@
<el-input style="width:217px" v-model="search_form.salesperson_name__like"></el-input> <el-input style="width:217px" v-model="search_form.salesperson_name__like"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<el-form-item label="合同状态" prop="contract_state_list">
<el-select v-model="search_form.contract_state_list" multiple>
<el-option v-for="item in contract_state_data" :key="item.code" :label="item.name" :value="item.code">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row style="text-align:left">
<el-col :span="12">
<el-form-item label="应收账款余额" prop="leave_amount_start_point">
<el-input v-model="search_form.leave_amount_start_point" placeholder="不填默认为0"></el-input>
</el-form-item>
<el-form-item prop="leave_amount_end_point">
<el-input v-model="search_form.leave_amount_end_point" placeholder="不填则无上限"></el-input>
</el-form-item>
</el-col>
</el-row> </el-row>
<!-- hide --> <!-- hide -->
<el-row style="margin-bottom:10px"> <el-row style="margin-bottom:10px">
...@@ -57,36 +83,35 @@ ...@@ -57,36 +83,35 @@
<el-collapse-transition> <el-collapse-transition>
<div id="hide" v-show="!hide_search_item"> <div id="hide" v-show="!hide_search_item">
<el-row style="text-align:left"> <el-row style="text-align:left">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="合同状态" prop="contract_state_list"> <el-form-item label="合同性质" prop="contract_type">
<el-select v-model="search_form.contract_state_list" multiple> <el-select v-model="search_form.contract_type" clearable>
<el-option v-for="item in contract_state_data" :key="item.code" :label="item.name" :value="item.code"> <el-option v-for="item in contract_type_data" :key="item.code" :label="item.name" :value="item.code">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" style="text-align:left">
<el-form-item label="所属年份" prop="year"> <el-form-item label="省" prop="province">
<el-select v-model="search_form.year" clearable> <el-select style="width:217px" v-model="search_form.province" filterable clearable placeholder="省" @change="get_cities()">
<el-option v-for="n in year_list" :key="n" :label="n" :value="n"> <el-option v-for="(item,index) in provinces" :key="index" :label="item.name" :value="item.province_unid">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" style="text-align:left">
<el-form-item label="所属月份" prop="month"> <el-form-item label="市" prop="city">
<el-select v-model="search_form.month" clearable> <el-select style="width:217px" v-model="search_form.city" filterable clearable placeholder="市">
<el-option v-for="n in month_list" :key="n" :label="n" :value="n"> <el-option v-for="(item,index) in cities" :key="index" :label="item.name" :value="item.city_unid">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="合同性质" prop="contract_type"> <el-form-item label="质保周期(月)" prop="guarantee_period">
<el-select v-model="search_form.contract_type" clearable> <el-select v-model="search_form.guarantee_period" clearable>
<el-option v-for="item in contract_type_data" :key="item.code" :label="item.name" :value="item.code"> <el-option v-for="n in guarantee_period_list" :key="n" :label="n" :value="n"></el-option>
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -124,31 +149,8 @@ ...@@ -124,31 +149,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="text-align:left"> <!-- <el-row style="text-align:left">
<el-col :span="6"> </el-row> -->
<el-form-item label="质保周期(月)" prop="guarantee_period">
<el-select v-model="search_form.guarantee_period" clearable>
<el-option v-for="n in guarantee_period_list" :key="n" :label="n" :value="n"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" style="text-align:left">
<el-form-item label="省" prop="province">
<el-select style="width:217px" v-model="search_form.province" filterable clearable placeholder="省" @change="get_cities()">
<el-option v-for="(item,index) in provinces" :key="index" :label="item.name" :value="item.province_unid">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" style="text-align:left">
<el-form-item label="市" prop="city">
<el-select style="width:217px" v-model="search_form.city" filterable clearable placeholder="市">
<el-option v-for="(item,index) in cities" :key="index" :label="item.name" :value="item.city_unid">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row style="text-align:left"> <el-row style="text-align:left">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="签订日期" prop="start_date"> <el-form-item label="签订日期" prop="start_date">
...@@ -556,6 +558,9 @@ ...@@ -556,6 +558,9 @@
}; };
}, },
computed: { computed: {
/**
* 年份选择列表
*/
year_list: function() { year_list: function() {
var a = new Date().getFullYear(); var a = new Date().getFullYear();
var arr = []; var arr = [];
...@@ -564,6 +569,9 @@ ...@@ -564,6 +569,9 @@
} }
return arr; return arr;
}, },
/**
* 字面意思
*/
offset() { offset() {
return (this.current_page - 1) * this.limit; return (this.current_page - 1) * this.limit;
}, },
...@@ -628,6 +636,9 @@ ...@@ -628,6 +636,9 @@
}); });
}); });
}, },
/**
* 全选
*/
check_all_item(val) { check_all_item(val) {
if (val) { if (val) {
this.display_item_list.forEach(e => { this.display_item_list.forEach(e => {
...@@ -644,6 +655,9 @@ ...@@ -644,6 +655,9 @@
this.is_indeterminate = this.is_indeterminate =
checkedCount > 0 && checkedCount < this.display_item_list.length; checkedCount > 0 && checkedCount < this.display_item_list.length;
}, },
/**
* 自定义排序规则
*/
project_name_sort(a, b) { project_name_sort(a, b) {
if (a.project_name && b.project_name) { if (a.project_name && b.project_name) {
return a.project_name.trim().localeCompare(b.project_name.trim()); return a.project_name.trim().localeCompare(b.project_name.trim());
...@@ -712,7 +726,11 @@ ...@@ -712,7 +726,11 @@
? (this.hide_icon = "icon i-arrowdown-copy") ? (this.hide_icon = "icon i-arrowdown-copy")
: (this.hide_icon = "icon i-arrowup"); : (this.hide_icon = "icon i-arrowup");
}, },
/**
* 点击导入按钮,弹出文件选择栏,当选择文件后
* type为file的input的文件列表会改变
* 检测到这种改变后,调用import_contract方法
*/
import_click() { import_click() {
document.getElementById("import_unview").click(); document.getElementById("import_unview").click();
}, },
...@@ -852,10 +870,15 @@ ...@@ -852,10 +870,15 @@
}); });
} }
}, },
/**
* 获取检索结果
*/
get_list_data() { get_list_data() {
var a = this.search_form; var a = this.search_form;
if (a.contract_state_list.length > 0) { if (a.contract_state_list.length > 0) {
a.contract_states = a.contract_state_list.join(","); a.contract_states = a.contract_state_list.join(",");
} else {
a.contract_states = "";
} }
Object.keys(a).forEach(key => { Object.keys(a).forEach(key => {
if (a[key] && typeof a[key] == "string") { if (a[key] && typeof a[key] == "string") {
...@@ -934,6 +957,9 @@ ...@@ -934,6 +957,9 @@
} }
}); });
}, },
/**
* page控件的一些操作
*/
handle_size_change(val) { handle_size_change(val) {
this.limit = val; this.limit = val;
if (this.list_data.length != 0) { if (this.list_data.length != 0) {
...@@ -946,6 +972,9 @@ ...@@ -946,6 +972,9 @@
console.log(this.current_page); console.log(this.current_page);
this.get_list_data(); this.get_list_data();
}, },
/**
* 导出合同的excel表格
*/
export_contract() { export_contract() {
if (this.checked_item_list.length > 0) { if (this.checked_item_list.length > 0) {
this.search_form.columns = this.checked_item_list.join(","); this.search_form.columns = this.checked_item_list.join(",");
...@@ -983,10 +1012,16 @@ ...@@ -983,10 +1012,16 @@
console.log(err.message); console.log(err.message);
}); });
}, },
/**
* 点击详情后进度contract页面
*/
go_to(id) { go_to(id) {
sessionStorage.setItem("modify", "1"); sessionStorage.setItem("modify", "1");
this.$router.push("/nav/contract/" + id); this.$router.push("/nav/contract/" + id);
}, },
/**
* 改变dialog背景颜色
*/
change_dialog() { change_dialog() {
if (localStorage.getItem("style")) { if (localStorage.getItem("style")) {
var style = JSON.parse(localStorage.getItem("style")); var style = JSON.parse(localStorage.getItem("style"));
...@@ -1038,7 +1073,9 @@ ...@@ -1038,7 +1073,9 @@
} else { } else {
this.get_product_line_type_data(); this.get_product_line_type_data();
} }
/**
*Admin具有删除合同的权限
*/
if (sessionStorage.getItem("user_name") === "Admin") { if (sessionStorage.getItem("user_name") === "Admin") {
this.management = true; this.management = true;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!