|
|
|
@ -283,6 +283,83 @@ |
|
|
|
|
</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 2031校验规则--> |
|
|
|
|
<el-dialog |
|
|
|
|
class="edit2017" |
|
|
|
|
title="编辑" |
|
|
|
|
width="80%" |
|
|
|
|
:center="true" |
|
|
|
|
ref="addTitle" |
|
|
|
|
:width="addDialogWidth" |
|
|
|
|
:visible.sync="addWin2031" |
|
|
|
|
@close="resetForm2031('resetForm2031')" |
|
|
|
|
:before-close="beforeCloseModel" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
:close-on-press-escape="false"> |
|
|
|
|
<div class="fakeLine"></div> |
|
|
|
|
<el-form ref="resetForm2031" style="padding: 20px" label-width="100px"> |
|
|
|
|
<!-- 规则编号2031 --> |
|
|
|
|
<el-table |
|
|
|
|
border |
|
|
|
|
stripe |
|
|
|
|
class="personalStyle" |
|
|
|
|
max-height="350" |
|
|
|
|
:data="personalHeadList2031" |
|
|
|
|
style="width: 100%; min-height: 200px;"> |
|
|
|
|
<el-table-column type="index" label="序号" align="center" width="60" show-overflow-tooltip></el-table-column> |
|
|
|
|
<el-table-column prop="invoiceType" label="发票类型" align="center" min-width="280"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-select |
|
|
|
|
multiple |
|
|
|
|
style="width: 100%" |
|
|
|
|
collapse-tags |
|
|
|
|
v-model="scope.row.invoiceTypeCode"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="(item,index) in typeList" |
|
|
|
|
:key="index" |
|
|
|
|
:label="item.invoiceTypeName" |
|
|
|
|
:value="item.invoiceTypeCode"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="ssfljc" label="税收分类简称" align="center" min-width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input placeholder="请输入税收分类简称" v-model="scope.row.ssfljc" clearable></el-input> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="sl" label="税率" align="center" min-width="180"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input placeholder="请输入税率" v-model="scope.row.sl" clearable></el-input> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="timeDate" label="适用时间" align="center" min-width="280"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="scope.row.timeDate" |
|
|
|
|
type="daterange" |
|
|
|
|
range-separator="至" |
|
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="" align="center" width="80" :render-header="renderHeader2031" class="iEdit"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<i @click.prevent="deleteRow2031(scope.$index, scope.row)" class="el-icon-delete"></i> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
</el-form> |
|
|
|
|
<div slot="footer"> |
|
|
|
|
<el-button size="medium" @click="closeWin2031">取消</el-button> |
|
|
|
|
<el-button size="medium" type="primary" ref="sysPersonalHeadSave" |
|
|
|
|
@click="sysPersonalHeadSave2031('addForm')">保存 |
|
|
|
|
</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 2031校验规则--> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
@ -304,6 +381,9 @@ export default { |
|
|
|
|
}, 100) |
|
|
|
|
}; |
|
|
|
|
return { |
|
|
|
|
//定制化 |
|
|
|
|
addWin2031:false, |
|
|
|
|
//定制化 |
|
|
|
|
token: '', |
|
|
|
|
formInline: { |
|
|
|
|
remark: '', |
|
|
|
@ -365,6 +445,8 @@ export default { |
|
|
|
|
total: 0, |
|
|
|
|
addDialogWidth: '40%', |
|
|
|
|
personalHeadList: [], // 2018规则列表 |
|
|
|
|
personalHeadList2031: [], |
|
|
|
|
personalHeadListOld2031: [], |
|
|
|
|
personalHeadListOld: [], // 2018规则列表-用于对比 |
|
|
|
|
typeListZZS: [], // 2018规则-发票类型列表 |
|
|
|
|
// 2018规则-抬头列表 |
|
|
|
@ -564,9 +646,11 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleEdit(data) { |
|
|
|
|
|
|
|
|
|
console.log("编辑的内容=", data); |
|
|
|
|
this.addDialogWidth = data.functionCode == '2018' ? '80%' : '40%'; |
|
|
|
|
this.addWin = true; |
|
|
|
|
this.addDialogWidth = data.functionCode == '2018' || data.functionCode == '2031' ? '80%' : '40%'; |
|
|
|
|
|
|
|
|
|
data.functionCode == '2031' ? this.addWin2031 = true : this.addWin = true |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
if (data.ruleInvoiceTypeCodes) { |
|
|
|
|
this.typeList = this.typeListAll.filter(item => { |
|
|
|
@ -580,21 +664,81 @@ export default { |
|
|
|
|
if (data.functionCode == '2018') { |
|
|
|
|
this.sysPersonalHeadSelect(); |
|
|
|
|
} |
|
|
|
|
if (data.functionCode == '2031') { |
|
|
|
|
this.get2031List(data.code); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(data.functionCode == '2031'){ |
|
|
|
|
this.addForm = { |
|
|
|
|
id: data.id, |
|
|
|
|
invoiceTypeName: data.invoiceTypeName ? data.invoiceTypeName.split(',') : [], |
|
|
|
|
code: data.code, |
|
|
|
|
functionCode: data.functionCode, |
|
|
|
|
invoiceType: data.invoiceTypeList.split(",").length == this.typeList.length - 1 ? [] : data.invoiceTypeList.split(','), |
|
|
|
|
remark: data.remark, |
|
|
|
|
avoidString: '', |
|
|
|
|
dateArr: [null, null], |
|
|
|
|
invoiceStatus: data.invoiceStatusList ? data.invoiceStatusList.split(',') : [], // 2019-发票状态 |
|
|
|
|
curreentTime: data.curreentTime, // 服务器年份 |
|
|
|
|
}; |
|
|
|
|
}else { |
|
|
|
|
this.addForm = { |
|
|
|
|
id: data.id, |
|
|
|
|
invoiceTypeName: data.invoiceTypeName ? data.invoiceTypeName.split(',') : [], |
|
|
|
|
code: data.code, |
|
|
|
|
functionCode: data.functionCode, |
|
|
|
|
invoiceType: data.invoiceTypeList.split(",").length == this.typeList.length - 1 ? [] : data.invoiceTypeList.split(','), |
|
|
|
|
remark: data.remark, |
|
|
|
|
avoidString: data.avoidString, |
|
|
|
|
dateArr: data.avoidString.indexOf(",") !== -1 ? data.avoidString.split(',') : [null, null], |
|
|
|
|
invoiceStatus: data.invoiceStatusList ? data.invoiceStatusList.split(',') : [], // 2019-发票状态 |
|
|
|
|
curreentTime: data.curreentTime, // 服务器年份 |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.addForm = { |
|
|
|
|
id: data.id, |
|
|
|
|
invoiceTypeName: data.invoiceTypeName ? data.invoiceTypeName.split(',') : [], |
|
|
|
|
code: data.code, |
|
|
|
|
functionCode: data.functionCode, |
|
|
|
|
invoiceType: data.invoiceTypeList.split(",").length == this.typeList.length - 1 ? [] : data.invoiceTypeList.split(','), |
|
|
|
|
remark: data.remark, |
|
|
|
|
avoidString: data.avoidString, |
|
|
|
|
dateArr: data.avoidString.indexOf(",") !== -1 ? data.avoidString.split(',') : [null, null], |
|
|
|
|
invoiceStatus: data.invoiceStatusList ? data.invoiceStatusList.split(',') : [], // 2019-发票状态 |
|
|
|
|
curreentTime: data.curreentTime, // 服务器年份 |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
get2031List(val){ |
|
|
|
|
const header = { |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'application/json', |
|
|
|
|
'token': this.token || localStorage.getItem("bx_token") |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
let params = { |
|
|
|
|
code: val |
|
|
|
|
} |
|
|
|
|
api.query2031ByRuleCodeAoi(params, header).then(r => { |
|
|
|
|
console.log(r) |
|
|
|
|
if (r.status) { |
|
|
|
|
r.data.map(item => { |
|
|
|
|
// 发票类型 |
|
|
|
|
item.invoiceTypeCode = item.invoiceTypeCode ? item.invoiceTypeCode.split(',') : ['']; |
|
|
|
|
item.timeDate = [this.formatDate(item.syDate), this.formatDate(item.syEndDate)] |
|
|
|
|
}); |
|
|
|
|
this.personalHeadList2031 = r.data; |
|
|
|
|
this.personalHeadList2031.forEach((item, index) => { |
|
|
|
|
// this.personalHeadListOld2031[index].invoiceTypeCode = item.invoiceTypeCode.length == this.typeList.length - 1 ? [''] : item.invoiceTypeCode |
|
|
|
|
item.invoiceTypeCode = item.invoiceTypeCode.length == this.typeList.length - 1 ? [''] : item.invoiceTypeCode |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.$toast.show(r.data.message); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
formatDate(dateStr) { |
|
|
|
|
console.log(dateStr) |
|
|
|
|
// 创建 Date 对象 |
|
|
|
|
const date = new Date(dateStr); |
|
|
|
|
|
|
|
|
|
// 获取年、月、日 |
|
|
|
|
const year = date.getFullYear(); |
|
|
|
|
const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 月份从 0 开始,所以加 1,并确保两位数 |
|
|
|
|
const day = date.getDate().toString().padStart(2, '0'); // 确保两位数 |
|
|
|
|
// 返回格式化的日期字符串 |
|
|
|
|
return `${year}-${month}-${day}`; |
|
|
|
|
}, |
|
|
|
|
beforeCloseModel(done) { |
|
|
|
|
if (this.addForm.code == '2018') { |
|
|
|
|
if (this.dataIfChange()) { |
|
|
|
@ -658,7 +802,6 @@ export default { |
|
|
|
|
return editFlag; |
|
|
|
|
}, |
|
|
|
|
handleSelectChange(val) { |
|
|
|
|
console.log(val, 'val……') |
|
|
|
|
let list = []; |
|
|
|
|
val.map((arr, index) => { |
|
|
|
|
let obj = this.typeList.find((item) => { |
|
|
|
@ -687,8 +830,11 @@ export default { |
|
|
|
|
console.log(form) |
|
|
|
|
this.$refs[form].resetFields() |
|
|
|
|
}, |
|
|
|
|
resetForm2031(form) { |
|
|
|
|
console.log(form) |
|
|
|
|
this.$refs[form].resetFields() |
|
|
|
|
}, |
|
|
|
|
closeWin() { |
|
|
|
|
if (this.addForm.code == '2018') { |
|
|
|
|
if (this.dataIfChange()) { |
|
|
|
|
this.$confirm('存在未保存数据,是否退出?', '提示', { |
|
|
|
|
type: 'warning', |
|
|
|
@ -700,9 +846,10 @@ export default { |
|
|
|
|
} else { |
|
|
|
|
this.addWin = false; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.addWin = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
closeWin2031() { |
|
|
|
|
this.addWin2031 = false; |
|
|
|
|
}, |
|
|
|
|
// 编辑规则确认按钮 |
|
|
|
|
saveCommodity(form) { |
|
|
|
@ -784,6 +931,10 @@ export default { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
deleteRow2031(index, rows){ |
|
|
|
|
this.personalHeadList2031.splice(index, 1); |
|
|
|
|
this.$toast.show('删除成功'); |
|
|
|
|
}, |
|
|
|
|
// 2017-删除行 |
|
|
|
|
deleteRow(index, rows) { |
|
|
|
|
this.$confirm('删除后将不可恢复,确认删除?', '提示', { |
|
|
|
@ -825,6 +976,16 @@ export default { |
|
|
|
|
}); |
|
|
|
|
console.log(this.personalHeadList) |
|
|
|
|
}, |
|
|
|
|
// 2031-新增行 |
|
|
|
|
addNewRule2031(ref) { |
|
|
|
|
this.personalHeadList2031.push({ |
|
|
|
|
invoiceType: [''], |
|
|
|
|
ssfljc: '', |
|
|
|
|
sl: '', |
|
|
|
|
timeDate: [], |
|
|
|
|
isdisabled: false, // 是否禁止编辑 |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleChangeZZS(row) { |
|
|
|
|
let invoiceType = row.invoiceType; |
|
|
|
|
console.log(invoiceType[invoiceType.length - 1], 'handleChangeZZS') |
|
|
|
@ -973,6 +1134,67 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
sysPersonalHeadSave2031(){ |
|
|
|
|
|
|
|
|
|
let params = []; |
|
|
|
|
let ck = false |
|
|
|
|
this.personalHeadList2031.map((item, index) => { |
|
|
|
|
if(item.invoiceTypeCode.length == 0){ |
|
|
|
|
this.$toast.show(`第${index+1}行,发票类型为空`); |
|
|
|
|
ck = true |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if(!item.ssfljc){ |
|
|
|
|
this.$toast.show(`第${index+1}行,税收分类简称为空`); |
|
|
|
|
ck = true |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if(!item.sl){ |
|
|
|
|
this.$toast.show(`第${index+1}行,税率为空`); |
|
|
|
|
ck = true |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if(item.timeDate.length == 0){ |
|
|
|
|
this.$toast.show(`第${index+1}行,适用时间为空`); |
|
|
|
|
ck = true |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
params.push({ |
|
|
|
|
ruleCode:this.addForm.code, |
|
|
|
|
invoiceTypeCode:item.invoiceTypeCode.join(','), |
|
|
|
|
ssfljc:item.ssfljc, |
|
|
|
|
sl:item.sl, |
|
|
|
|
syDate:item.timeDate[0] + ' ' +'00:00:00', |
|
|
|
|
syEndDate:item.timeDate[1] + ' ' + '23:59:59', |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
if(!ck){ |
|
|
|
|
const loading = this.$loading({ |
|
|
|
|
lock: true, |
|
|
|
|
text: 'Loading', |
|
|
|
|
spinner: 'el-icon-loading', |
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)' |
|
|
|
|
}); |
|
|
|
|
const header = { |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'application/json', |
|
|
|
|
'token': this.token || localStorage.getItem("bx_token") |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
api.ruleupdateSsjcApi(params, header).then((res) => { |
|
|
|
|
if (res.data.code == '0000') { |
|
|
|
|
this.$toast.show('保存成功'); |
|
|
|
|
this.addWin2031 = false; |
|
|
|
|
this.findAll(this.currentPage); |
|
|
|
|
} else { |
|
|
|
|
this.$toast.show(res.data.message); |
|
|
|
|
} |
|
|
|
|
}).finally(()=>{ |
|
|
|
|
loading.close(); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// render 事件 |
|
|
|
|
renderHeader(h, {column}) { // h即为cerateElement的简写,具体可看vue官方文档 |
|
|
|
|
const _this = this; |
|
|
|
@ -990,6 +1212,22 @@ export default { |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
renderHeader2031(h, {column}) { // h即为cerateElement的简写,具体可看vue官方文档 |
|
|
|
|
const _this = this; |
|
|
|
|
return h( |
|
|
|
|
'div', |
|
|
|
|
[ |
|
|
|
|
h('span', column.label), |
|
|
|
|
h('i', { |
|
|
|
|
class: 'el-icon-circle-plus', |
|
|
|
|
style: 'color: #409eff; font-size: 24px; cursor: pointer;', |
|
|
|
|
on: { |
|
|
|
|
click: _this.addNewRule2031 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
// 判断平年闰年 |
|
|
|
|
isRun(years) { |
|
|
|
|
let year = years ? years : (new Date()).getFullYear(); |
|
|
|
|