Commit 30beefa9 authored by 柳 佳乐's avatar 柳 佳乐
Browse files

20221118

parent a4be0e3c
...@@ -172,7 +172,7 @@ export function number_valid(rule, value, callback) { ...@@ -172,7 +172,7 @@ export function number_valid(rule, value, callback) {
} }
//发票号码 //发票号码
export function Invoice_No(rule, value, callback) { export function Invoice_No(rule, value, callback) {
let reg = /^\d{8,}$/ let reg = /^\d{8}$/
if (value === null || value === undefined || value === '') { if (value === null || value === undefined || value === '') {
return callback(new Error('不能为空')) return callback(new Error('不能为空'))
} else if (reg.test(value)) { } else if (reg.test(value)) {
...@@ -183,7 +183,7 @@ export function Invoice_No(rule, value, callback) { ...@@ -183,7 +183,7 @@ export function Invoice_No(rule, value, callback) {
} }
//发票代码 //发票代码
export function Invoice_code(rule, value, callback) { export function Invoice_code(rule, value, callback) {
let reg = /^\d{12,}$/ let reg = /^\d{12}$/
if (value === null || value === undefined || value === '') { if (value === null || value === undefined || value === '') {
return callback(new Error('不能为空')) return callback(new Error('不能为空'))
} else if (reg.test(value)) { } else if (reg.test(value)) {
......
...@@ -774,7 +774,6 @@ export default { ...@@ -774,7 +774,6 @@ export default {
fromList: [], //发票号码 fromList: [], //发票号码
}, },
formtripid: null, formtripid: null,
form: [],
srcList: [], srcList: [],
parm: { parm: {
tripId: null, tripId: null,
...@@ -868,6 +867,7 @@ export default { ...@@ -868,6 +867,7 @@ export default {
}, },
//查询出要添加的发票编号 //查询出要添加的发票编号
Selectinvoicelsit() { Selectinvoicelsit() {
this.invoicelistform.fromList = [];
this.insertvioiceFrom = true; this.insertvioiceFrom = true;
let param = { let param = {
companyId: this.$store.getters.companyId, companyId: this.$store.getters.companyId,
...@@ -889,25 +889,35 @@ export default { ...@@ -889,25 +889,35 @@ export default {
this.back(); this.back();
}); });
}, },
/**
* 第一次 选择两条 this.form.length = 2
* 第二次 不选择 this.form.length = 2
* 第三次 选择两条 this.form.length = 4
*
*/
// 添加发票号码 // 添加发票号码
insertInvoice() { insertInvoice() {
// 第三个方法 添加发票 // 第三个方法 添加发票
let param = []
this.invoicelistform.fromList.forEach((e) => { this.invoicelistform.fromList.forEach((e) => {
let obj = {}; let obj = {};
obj.companyId = this.$store.getters.companyId; obj.companyId = this.$store.getters.companyId;
obj.status = 1; obj.status = 1;
obj.tripId = this.formtripid; obj.tripId = this.formtripid;
obj.invoiceId = e; obj.invoiceId = e;
this.form.push(obj); param.push(obj);
}); });
if (this.form.length == 0) { if (param.length == 0) {
this.insertvioiceFrom = false; this.insertvioiceFrom = false;
} else { } else {
Addinvoice(this.form) Addinvoice(param)
.then((resu) => { .then((resu) => {
if (resu.success) { if (resu.success) {
this.$message.success("添加成功!"); this.$message.success("添加成功!");
this.insertvioiceFrom = false; this.insertvioiceFrom = false;
this.table = false
} else { } else {
this.$message.error(resu.msg); this.$message.error(resu.msg);
} }
...@@ -941,6 +951,7 @@ export default { ...@@ -941,6 +951,7 @@ export default {
type: "success", type: "success",
message: "删除成功!", message: "删除成功!",
}); });
this.table = false
// 关闭窗口 // 关闭窗口
} else { } else {
this.$message.error(result.msg); this.$message.error(result.msg);
......
...@@ -173,8 +173,10 @@ export default { ...@@ -173,8 +173,10 @@ export default {
//返回 //返回
back() { back() {
if (this.attrId == 0) { if (this.attrId == 0) {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push("/assetslist"); this.$router.push("/assetslist");
} else { } else {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push("/administrationlsit"); this.$router.push("/administrationlsit");
} }
}, },
......
<template> <template>
<div v-loading="loading" element-loading-text="图片上传中。。。"> <div>
<!-- 头部 --> <!-- 头部 -->
<div class="QueryInvoice" style="margin: 10px 15px"> <div class="QueryInvoice" style="margin: 10px 15px">
<el-row :gutter="30"> <el-row :gutter="30">
<el-col :span="30"> <el-col :span="30">
<el-form :inline="true" :model="invoiceQruey"> <el-form :inline="true" :model="invoiceQruey">
<el-form-item label="发票号码" style="margin-left"> <el-form-item label="发票号码" style="margin-left">
<el-input v-model="invoiceQruey.number" placeholder="发票号码"></el-input> <el-input
v-model="invoiceQruey.number"
placeholder="发票号码"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="发票代码"> <el-form-item label="发票代码">
<el-input v-model="invoiceQruey.code" placeholder="发票代码"></el-input> <el-input
v-model="invoiceQruey.code"
placeholder="发票代码"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="发票类型"> <el-form-item label="发票类型">
<el-select v-model="invoiceQruey.category" placeholder="请选择"> <el-select v-model="invoiceQruey.category" placeholder="请选择">
...@@ -49,15 +55,24 @@ ...@@ -49,15 +55,24 @@
icon="el-icon-search" icon="el-icon-search"
style="margin: 1px 5px" style="margin: 1px 5px"
@click="selectexpend()" @click="selectexpend()"
>查询</el-button> >查询</el-button
<el-button type="info" icon="el-icon-refresh-right" @click="upddlist()">重置</el-button> >
<el-button
type="info"
icon="el-icon-refresh-right"
@click="upddlist()"
>重置</el-button
>
<el-button <el-button
type="success" type="success"
icon="el-icon-download" icon="el-icon-download"
v-if="isgetid" v-if="isgetid"
@click="Reimbursement()" @click="Reimbursement()"
>添加发票单</el-button> >添加发票单</el-button
<el-button type="warning" v-if="!isgetid" @click="Reimbursement()">返回</el-button> >
<el-button type="warning" v-if="!isgetid" @click="Reimbursement()"
>返回</el-button
>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
...@@ -73,21 +88,27 @@ ...@@ -73,21 +88,27 @@
<el-table-column label="序号" width="50" style> <el-table-column label="序号" width="50" style>
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
(invoiceQruey.pageNum - 1) * invoiceQruey.pageSize + (invoiceQruey.pageNum - 1) * invoiceQruey.pageSize +
scope.$index + scope.$index +
1 1
}} }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="code" label="发票代码"></el-table-column> <el-table-column prop="code" label="发票代码"></el-table-column>
<el-table-column prop="number" label="发票号码" width="width"></el-table-column> <el-table-column
<el-table-column prop="time" label="发票时间" :formatter="getFroms"></el-table-column> prop="number"
label="发票号码"
width="width"
></el-table-column>
<el-table-column
prop="time"
label="发票时间"
:formatter="getFroms"
></el-table-column>
<el-table-column prop="category" label="发票类型"> <el-table-column prop="category" label="发票类型">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="scope.row.category == '0' ? 'info' : 'primary'"> <el-tag :type="scope.row.category == '0' ? 'info' : 'primary'">
{{ {{ scope.row.category == "0" ? "普票" : "专票" }}
scope.row.category == "0" ? "普票" : "专票"
}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -103,11 +124,11 @@ ...@@ -103,11 +124,11 @@
" "
> >
{{ {{
scope.row.type == "0" scope.row.type == "0"
? "收入" ? "收入"
: scope.row.type == "1" : scope.row.type == "1"
? "支出" ? "支出"
: "报销" : "报销"
}} }}
</el-tag> </el-tag>
</template> </template>
...@@ -123,16 +144,16 @@ ...@@ -123,16 +144,16 @@
></el-image> ></el-image>
</div> </div>
<div v-else> <div v-else>
<a class="a-style" @click="handlePreView(scope.row)">点击查看文件</a> <a class="a-style" @click="handlePreView(scope.row)"
>点击查看文件</a
>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="发票状态" width="90px"> <el-table-column prop="status" label="发票状态" width="90px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="scope.row.status == '0' ? 'info' : 'warning'"> <el-tag :type="scope.row.status == '0' ? 'info' : 'warning'">
{{ {{ scope.row.status == 0 ? "未报销" : "已报销" }}
scope.row.status == 0 ? "未报销" : "已报销"
}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
...@@ -141,8 +162,15 @@ ...@@ -141,8 +162,15 @@
<el-popover placement="top" width="160" v-model="scope.row.visible"> <el-popover placement="top" width="160" v-model="scope.row.visible">
<p>确定要删除当前发票吗</p> <p>确定要删除当前发票吗</p>
<div style="text-align: right; margin: 0"> <div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button> <el-button
<el-button type="primary" size="mini" @click="YesGet(scope.row)">确定</el-button> size="mini"
type="text"
@click="scope.row.visible = false"
>取消</el-button
>
<el-button type="primary" size="mini" @click="YesGet(scope.row)"
>确定</el-button
>
</div> </div>
<el-button <el-button
type="danger" type="danger"
...@@ -172,7 +200,7 @@ ...@@ -172,7 +200,7 @@
</div> </div>
<!-- 添加区域 --> <!-- 添加区域 -->
<div class="getadd" v-show="!isgetid" style="margin-left: 5%"> <div class="getadd" v-show="!isgetid" style="margin-left: 5%">
<el-row > <el-row>
<el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24"> <el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24">
<el-form <el-form
style="width: 100%; margin: 30px 0px" style="width: 100%; margin: 30px 0px"
...@@ -185,17 +213,13 @@ ...@@ -185,17 +213,13 @@
<el-form-item label="发票代码" prop="code"> <el-form-item label="发票代码" prop="code">
<el-input <el-input
v-model="addTO.code" v-model="addTO.code"
maxlength="12" maxlength="12"
minlength="12"
onkeyup="this.value=this.value.replace(/\D|^/g,'')"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="发票号码" prop="number"> <el-form-item label="发票号码" prop="number">
<el-input <el-input
v-model="addTO.number" v-model="addTO.number"
maxlength="8" maxlength="8"
minlength="8"
onkeyup="this.value=this.value.replace(/\D|^/g,'')"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="发票时间" required prop="time"> <el-form-item label="发票时间" required prop="time">
...@@ -230,8 +254,15 @@ ...@@ -230,8 +254,15 @@
<el-input v-model="addTO.mone"></el-input> <el-input v-model="addTO.mone"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="success" icon="el-icon-folder-checked" @click="getlistForm()">立即创建</el-button> <el-button
<el-button type="info" icon="el-icon-refresh" @click="delectdd">重置信息</el-button> type="success"
icon="el-icon-folder-checked"
@click="getlistForm()"
>立即创建</el-button
>
<el-button type="info" icon="el-icon-refresh" @click="delectdd"
>重置信息</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
...@@ -255,8 +286,11 @@ ...@@ -255,8 +286,11 @@
size="small" size="small"
type="primary" type="primary"
style="margin-left: 20px; margin-top: 40px" style="margin-left: 20px; margin-top: 40px"
>选取文件</el-button> >选取文件</el-button
<div slot="tip" class="el-upload__tip">只能上传jpg/png/pdf文件,且不超过500kb</div> >
<div slot="tip" class="el-upload__tip">
只能上传jpg/png/pdf文件,且不超过500kb
</div>
</el-upload> </el-upload>
</el-col> </el-col>
</el-row> </el-row>
...@@ -281,41 +315,41 @@ export default { ...@@ -281,41 +315,41 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
companyId: null, companyId: null,
userId: null userId: null,
}, },
categoryOptions: [ categoryOptions: [
{ {
value: 0, value: 0,
category: "普票" category: "普票",
}, },
{ {
value: 1, value: 1,
category: "专票" category: "专票",
} },
], ],
typeOptions: [ typeOptions: [
{ {
value: 0, value: 0,
type: "收入" type: "收入",
}, },
{ {
value: 1, value: 1,
type: "支出" type: "支出",
}, },
{ {
value: 2, value: 2,
type: "报销" type: "报销",
} },
], ],
statusOptions: [ statusOptions: [
{ {
value: 0, value: 0,
status: "未报销" status: "未报销",
}, },
{ {
value: 1, value: 1,
status: "已报销" status: "已报销",
} },
], ],
total: 0, total: 0,
invoicegetList: [], invoicegetList: [],
...@@ -330,50 +364,49 @@ export default { ...@@ -330,50 +364,49 @@ export default {
number: null, number: null,
status: 0, status: 0,
time: null, time: null,
type: null type: null,
}, },
rules: { rules: {
time: [ time: [
{ required: true, message: "请输入发票时间", trigger: "change" } { required: true, message: "请输入发票时间", trigger: "blur" },
], ],
number: [ number: [
{ {
required: true, required: true,
validator: Invoice_No, validator: Invoice_No,
trigger: "change" trigger: "blur",
} },
], ],
code: [{ required: true, validator: Invoice_code, trigger: "change" }], code: [{ required: true, validator: Invoice_code, trigger: "blur" }],
category: [ category: [
{ {
required: true, required: true,
message: "请至少选择一个发票类型", message: "请至少选择一个发票类型",
trigger: "change" trigger: "blur",
} },
], ],
type: [ type: [
{ {
required: true, required: true,
message: "请至少选择一个发票类别", message: "请至少选择一个发票类别",
trigger: "change" trigger: "blur",
} },
], ],
mone: [ mone: [
{ {
required: true, required: true,
validator: money, validator: money,
trigger: "change" trigger: "blur",
} },
] ],
}, },
fileList: [], fileList: [],
action: null, action: null,
proutlist: { proutlist: {
Id: 1, Id: 1,
status: 0, status: 0,
companyId: null companyId: null,
}, },
loading: false
}; };
}, },
created() { created() {
...@@ -403,20 +436,20 @@ export default { ...@@ -403,20 +436,20 @@ export default {
Reimbursement() { Reimbursement() {
this.isgetid = !this.isgetid; this.isgetid = !this.isgetid;
this.$refs.addTO.resetFields(); this.$refs.addTO.resetFields();
this.fileList = this.fileList.filter(item => item.uid !== file.uid); this.fileList = this.fileList.filter((item) => item.uid !== file.uid);
}, },
//发票的分页查询 //发票的分页查询
getincomeSelectlist() { getincomeSelectlist() {
queryBypageIncomeAdd(this.invoiceQruey) queryBypageIncomeAdd(this.invoiceQruey)
.then(res => { .then((res) => {
if (res.success) { if (res.success) {
this.total = res.data.total; this.total = res.data.total;
res.data.list.forEach(e => { res.data.list.forEach((e) => {
let fileNamepdf = e.filePath; let fileNamepdf = e.filePath;
let fileType = fileNamepdf.substring( let fileType = fileNamepdf.substring(
fileNamepdf.lastIndexOf(".") fileNamepdf.lastIndexOf(".")
); );
getFileUrl(e.filePath).then(res => { getFileUrl(e.filePath).then((res) => {
if (res.success) { if (res.success) {
let url = res.data; let url = res.data;
e.fileUrl = url; e.fileUrl = url;
...@@ -432,7 +465,7 @@ export default { ...@@ -432,7 +465,7 @@ export default {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}) })
.catch(error => { .catch((error) => {
console.log(error); console.log(error);
this.$message.error("查询发票数据失败"); this.$message.error("查询发票数据失败");
}); });
...@@ -491,14 +524,14 @@ export default { ...@@ -491,14 +524,14 @@ export default {
}, },
//发票提交页面的提交 //发票提交页面的提交
getlistForm() { getlistForm() {
if (this.fileTypeJpg == true) { if (this.fileTypeJpg == true) {
this.$refs.addTO.validate(valid => { this.$refs.addTO.validate((valid) => {
if (valid) { if (valid) {
this.loading = true;
this.addTO.userId = this.$store.getters.urId; this.addTO.userId = this.$store.getters.urId;
this.addTO.companyId = this.$store.getters.companyId; this.addTO.companyId = this.$store.getters.companyId;
insertList(this.addTO) insertList(this.addTO)
.then(res => { .then((res) => {
if (res.success) { if (res.success) {
//发票记录添加成功 //发票记录添加成功
//提交发票文件 //提交发票文件
...@@ -506,12 +539,10 @@ export default { ...@@ -506,12 +539,10 @@ export default {
this.$refs.upload.submit(); this.$refs.upload.submit();
this.$message.success(res.msg); this.$message.success(res.msg);
} else { } else {
this.loading = false;
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}) })
.catch(e => { .catch((e) => {
this.loading = false;
this.$message.error("发票添加失败,检测是否重复"); this.$message.error("发票添加失败,检测是否重复");
}); });
} }
...@@ -523,6 +554,7 @@ export default { ...@@ -523,6 +554,7 @@ export default {
//数据清除 //数据清除
delectdd() { delectdd() {
this.$refs.addTO.resetFields(); this.$refs.addTO.resetFields();
this.fileList = this.fileList.filter((item) => item.uid !== file.uid);
}, },
//校验发票文件格式 //校验发票文件格式
onChange(file) { onChange(file) {
...@@ -542,19 +574,18 @@ export default { ...@@ -542,19 +574,18 @@ export default {
}, },
//文件上传成功 //文件上传成功
fileSuccess(res) { fileSuccess(res) {
this.loading = false;
this.isgetid = true; this.isgetid = true;
this.getincomeSelectlist(); this.getincomeSelectlist();
}, },
//发票的删除操作 //发票的删除操作
YesGet(row) { YesGet(row) {
deleteexpen(row) deleteexpen(row)
.then(res => { .then((res) => {
if (res.success) { if (res.success) {
this.visible = false; this.visible = false;
this.$message({ this.$message({
message: "发票删除成功", message: "发票删除成功",
type: "success" type: "success",
}); });
this.getincomeSelectlist(); this.getincomeSelectlist();
...@@ -562,16 +593,36 @@ export default { ...@@ -562,16 +593,36 @@ export default {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}) })
.catch(e => { .catch((e) => {
console.log(e.msg); console.log(e.msg);
this.$message.error(e.msg); this.$message.error(e.msg);
}); });
}, },
geterror() { geterror() {
this.loading = true; let param = {
} invoiceId: this.proutlist.Id,
} };
deleteexpen(param)
.then((res) => {
if (res.success) {
this.visible = false;
this.$message({
message: "发票删除成功",
type: "success",
});
this.getincomeSelectlist();
} else {
this.$message.error(res.msg);
}
})
.catch((e) => {
console.log(e.msg);
this.$message.error(e.msg);
});
},
},
}; };
</script> </script>
<style scoped> <style scoped>
......
...@@ -229,15 +229,6 @@ ...@@ -229,15 +229,6 @@
> >
撤回</el-button 撤回</el-button
> >
<!-- <el-popconfirm title="这是一段内容确定删除吗?">
<el-button slot="reference"
style="margin: 5px"
size="mini"
type="info"
@click="withdraw(scope.row)"
v-if="scope.row.reimbursementState == 0"
>删除</el-button>
</el-popconfirm> -->
<el-button <el-button
style="margin: 5px" style="margin: 5px"
size="mini" size="mini"
...@@ -736,7 +727,7 @@ export default { ...@@ -736,7 +727,7 @@ export default {
this.getinvoive({ this.getinvoive({
reimbursementId: this.invoiceQurey.reimbursementId, reimbursementId: this.invoiceQurey.reimbursementId,
}); });
this.$refs.form.resetFields(); this.this.$refs.form.resetFields();
this.$message.success(res.msg); this.$message.success(res.msg);
} else { } else {
this.$message.error("发票上传失败!"); this.$message.error("发票上传失败!");
...@@ -792,10 +783,16 @@ export default { ...@@ -792,10 +783,16 @@ export default {
}, },
//删除关系 //删除关系
delinvoice(data) { delinvoice(data) {
deletBystatus(data).then((res) => { this.$confirm("是否同意删除?", "提示", {
if (res.success) { confirmButtonText: "确定",
this.getinvoive(data); cancelButtonText: "取消",
} type: "warning",
}).then(() => {
deletBystatus(data).then((res) => {
if (res.success) {
this.getinvoive(data);
}
});
}); });
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment