Commit 098c6731 authored by 柳 佳乐's avatar 柳 佳乐
Browse files

fix bugs

parent b04e0fd0
......@@ -155,8 +155,27 @@ export default {
//处理路由数据
generateRoutes(routes, basePath = '/') {
const res = []
console.log(routes)
if(this.$store.getters.roles[0] != 1){
//不是超管
for (let route of routes) {
if(route.id != 1 && route.id != 113){
const data = {
path: path.resolve(basePath, route.path),
title: route.meta && (route.menuExplain ? `${route.meta.title}${route.menuExplain})`: route.meta.title),
id: route.id
}
if (route.children.length>0) {
data.children = this.generateRoutes(route.children, data.path)
}
res.push(data)
}
}
}else{
//是超管
for (let route of routes) {
if(route.id != 1){
const data = {
path: path.resolve(basePath, route.path),
title: route.meta && (route.menuExplain ? `${route.meta.title}${route.menuExplain})`: route.meta.title),
......@@ -166,8 +185,11 @@ export default {
data.children = this.generateRoutes(route.children, data.path)
}
res.push(data)
}
}
return res
},
//新增角色
......
<template>
<!-- 添加支出区域 -->
<div class="container">
<el-row>
<el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24">
......@@ -74,6 +75,24 @@
</el-form-item>
</el-form>
</el-col>
<!-- 合同上传 -->
<el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24" class="contract">
<el-upload
class="upload-demo"
ref="upload1"
:action="action2"
:file-list="fileList"
:auto-upload="false"
:on-change="onChangepdf"
:on-remove="delfile1"
:limit="1"
:data="proutlist1"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/pdf文件,且不超过500kb</div>
</el-upload>
</el-col>
</el-row>
<!-- 报销单 -->
<el-drawer title="发票单列表" :visible.sync="drawer" size="100%">
......@@ -167,10 +186,13 @@
class="upload-demo"
ref="upload"
:file-list="fileList"
action="http://192.168.10.109:7080/file/uploadFile"
:action="action"
:auto-upload="false"
:data="proutlist"
style="margin-left:90px;"
:on-change="onChange"
:on-remove="delfile2"
:limit="1"
>
<el-button
slot="trigger"
......@@ -200,6 +222,8 @@ import { insert } from "@/api/expend";
export default {
data() {
return {
action2: null,
action: null,
expendFrom: {
expendBody: null,
expendInformation: null,
......@@ -252,7 +276,8 @@ export default {
number: null,
status: 0,
time: null,
type: 1
type: 1,
userId: null
},
//表单验证内容
rules: {
......@@ -309,6 +334,7 @@ export default {
invoiceListAdd: {},
//查询发票编号的数组
getinvoiveId: {
userId: null,
companyId: null,
type: 1
},
......@@ -318,10 +344,18 @@ export default {
newList: [],
//保存图片
proutlist: {
Id: 1,
Id: null,
status: 1
},
//保存合同
proutlist1: {
Id: null,
status: 1
},
fileList:[]
fileList: [],
fileType: null,
fileTypepdf: false,
backlistid: null
};
},
computed: {
......@@ -332,8 +366,14 @@ export default {
created() {
this.expendFrom.userId = this.$store.getters.urId;
this.addTO.companyId = this.$store.getters.companyId;
this.addTO.userId = this.$store.getters.urId;
this.invoiceList.companyId = this.$store.getters.companyId;
this.getinvoiveId.companyId = this.$store.getters.companyId;
this.getinvoiveId.userId = this.$store.getters.urId;
this.action = process.env.VUE_APP_BASE_API + "/file/uploadFile";
this.action2 =
process.env.VUE_APP_BASE_API + "/file/updataContractDocuments";
this.backlistid = this.$route.query.backlistid;
this.getTypeList();
this.getProject();
this.Selectinsertlsit();
......@@ -384,29 +424,20 @@ export default {
submitForm() {
this.$refs.form.validate(valid => {
if (valid) {
if (this.invoiceListAdd.length < 0) {
insert(this.expendFrom)
.then(res => {
if (res.success) {
this.$message.success(res.msg);
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({
path: "/expendList",
query: {
id: this.$route.query.id
}
});
} else {
this.$message.error(res.msg);
console.log(this.fileTypepdf);
if (this.fileTypepdf) {
//进行合同的上传
//上传合同
this.proutlist1.Id = res.data;
console.log(this.proutlist1.Id);
this.$refs.upload1.submit();
}
})
.catch(error => {
this.$message.error("新建失败");
});
} else {
insert(this.expendFrom)
.then(res => {
if (res.success) {
if (this.invoiceListAdd.length > 0) {
let list = [];
this.invoiceListAdd.forEach(item => {
list.push({
......@@ -415,24 +446,18 @@ export default {
status: 1
});
});
updatesubmit(list)
.then(res => {
//上传发票记录
updatesubmit(list).then(res => {
if (res.success) {
this.$message.success(res.msg);
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({
path: "/expendList",
query: {
id: this.$route.query.id
}
});
this.back();
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("新建失败");
});
} else {
this.back();
}
} else {
this.$message.error(res.msg);
}
......@@ -441,7 +466,6 @@ export default {
this.$message.error("新建失败");
});
}
}
});
},
//重置
......@@ -457,7 +481,7 @@ export default {
path: "/expendList",
query: {
id: this.$route.query.id,
backlistid:this.$route.query.backlistid
backlistid: this.$route.query.backlistid
}
});
},
......@@ -498,6 +522,29 @@ export default {
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.addTO.time = Y + M + D + h + m + s;
},
//合同图片
onChangepdf(file) {
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType == ".pdf") {
this.fileTypepdf = true;
} else {
this.$message.warning("合同文件只能是pdf格式文件");
this.$resf.upload1.clearFiles();
this.fileTypepdf = false;
}
console.log(this.fileTypepdf);
},
//清楚合同文件
delfile1() {
this.fileTypepdf = false;
},
//清除发片文件
delfile2() {
this.fileTypeJpg = false;
},
//////发票区域//////
//发票页面的按钮事件
drawerAdd() {
this.drawer = true;
......@@ -505,7 +552,7 @@ export default {
},
//发票的分页查询
getincomeSelectlist(pager = 1) {
this.invoiceList.pageNum = pager
this.invoiceList.pageNum = pager;
queryBypageIncomeAdd(this.invoiceList)
.then(res => {
if (res.success) {
......@@ -540,6 +587,11 @@ export default {
getlistForm() {
this.$refs.addTO.validate(valid => {
if (valid) {
if (
this.fileType === ".jpg" ||
this.fileType === ".pdf" ||
this.fileType === ".png"
) {
insertList(this.addTO)
.then(res => {
if (res.success) {
......@@ -548,7 +600,10 @@ export default {
this.$refs.upload.submit();
this.$message.success(res.msg);
this.isgetid = 0;
this.delectdd()
this.addTO.time = "";
this.$refs.addTO.resetFields();
this.getincomeSelectlist();
this.Selectinsertlsit();
this.getincomeSelectlist();
} else {
this.$message.error(res.msg);
......@@ -557,12 +612,15 @@ export default {
.catch(error => {
this.$message.error("新建失败");
});
} else {
this.$message.error("请输入jpg格式的图片或者pdf在或者png的文件");
}
}
});
},
//数据清除
delectdd() {
this.addTO ={
this.addTO = {
category: 0,
code: null,
companyId: null,
......@@ -571,7 +629,7 @@ export default {
status: 0,
time: null,
type: 1
}
};
},
//查询发票编号
Selectinsertlsit() {
......@@ -588,6 +646,12 @@ export default {
this.$message.error("获取发票编号失败");
this.back();
});
},
//给fileType赋值
onChange(file) {
const fileName = file.name;
this.fileType = fileName.substring(fileName.lastIndexOf("."));
console.log(this.fileType);
}
}
};
......@@ -597,4 +661,7 @@ export default {
.container {
padding: 10px;
}
.contract {
margin: 20px 50px;
}
</style>
\ No newline at end of file
......@@ -105,22 +105,20 @@
</div>
<div>
<!--抽屉-->
<el-drawer
title="发票详情"
:visible.sync="drawer"
:direction="direction"
size="40%"
>
<el-drawer title="发票详情" :visible.sync="drawer" :direction="direction" size="40%">
<!-- filePath-->
<el-table :data="getinvoivelist" style="width: 100%; text-align: center" border>
<el-table-column type="index" label="序号" width="40"></el-table-column>
<el-table-column prop="prop" label="发票详情">
<el-table-column prop="number" label="号码" width="160px"></el-table-column>
<el-table-column prop="mone" label="金额" width="180"></el-table-column>
<el-table-column prop="prop" label="查看PDF文件或图片">
<template slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.row.filePath"
:preview-src-list="[scope.row.filePath]"
></el-image>
<div v-if="scope.row.filePath != null">
<a class="a-style" @click="handlePreView(scope.row)">点击查看图片或文件</a>
</div>
<div v-else>
<p>无图片或文件</p>
</div>
</template>
</el-table-column>
</el-table>
......@@ -163,7 +161,7 @@ export default {
//图片数组
srcList: [],
//返回的标记
backlistid:null
backlistid: null
};
},
computed: {
......@@ -174,7 +172,7 @@ export default {
created() {
this.getinvoiveId.companyId = this.$store.getters.companyId;
this.expendQurey.projectId = this.$route.query.id;
this.backlistid=this.$route.query.backlistid
this.backlistid = this.$route.query.backlistid;
this.getexpend();
this.getTypeList();
},
......@@ -224,7 +222,7 @@ export default {
path: "/expendAdd",
query: {
id: this.$route.query.id,
backlistid:this.backlistid
backlistid: this.backlistid
}
});
},
......@@ -295,9 +293,9 @@ export default {
.then(res => {
if (res.success) {
this.getinvoivelist = res.data;
this.getinvoivelist.forEach(e => {
e.filePath = process.env.VUE_APP_BASE_API + e.filePath;
});
// this.getinvoivelist.forEach(e => {
// e.filePath = process.env.VUE_APP_BASE_API + e.filePath;
// });
console.log(this.getinvoivelist);
} else {
this.$message.error(res.msg);
......@@ -309,22 +307,22 @@ export default {
this.back();
});
},
back(){
if(this.backlistid==0){
back() {
if (this.backlistid == 0) {
this.$router.push({
path: "/projectList",
query: {
id: this.$route.query.id
}
});
}else if (this.backlistid==1) {
} else if (this.backlistid == 1) {
this.$router.push({
path: "/beresponsibleforList",
query: {
id: this.$route.query.id
}
});
}else{
} else {
this.$router.push({
path: "/participateinList",
query: {
......@@ -332,6 +330,12 @@ export default {
}
});
}
},
//点击查看发票
handlePreView(row) {
const photopath = process.env.VUE_APP_BASE_API + row.filePath;
console.log(photopath);
window.open(photopath, "_blank");
}
}
};
......
<template>
<div class="container">
<el-row>
<el-row :gutter="20">
<el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24">
<el-form ref="form" :model="incomeFrom" label-width="120px" :rules="rules">
<el-form-item label="项目名称" prop="projectName">
......@@ -37,7 +37,6 @@
<el-form-item label="收入金额" prop="incomeMoney">
<el-input v-model="incomeFrom.incomeMoney"></el-input>
</el-form-item>
<el-form-item label="收到时间" prop="incomeTime">
<el-date-picker
v-model="incomeFrom.incomeTime"
......@@ -46,19 +45,15 @@
@change="timestampToTime()"
></el-date-picker>
</el-form-item>
<el-form-item label="收入对象" prop="incomeObject">
<el-form-item label="对方户名" prop="incomeObject">
<el-input v-model="incomeFrom.incomeObject"></el-input>
</el-form-item>
<el-form-item label="收入内容" prop="incomeBody">
<el-input v-model="incomeFrom.incomeBody"></el-input>
</el-form-item>
<el-form-item label="收入备注" prop="incomeRemarks">
<el-input v-model="incomeFrom.incomeRemarks"></el-input>
</el-form-item>
<el-form-item label="收入详情" prop="incomeInformation">
<el-input
type="textarea"
......@@ -66,22 +61,46 @@
v-model="incomeFrom.incomeInformation"
></el-input>
</el-form-item>
<el-form-item>
<el-form-item></el-form-item>
</el-form>
</el-col>
<!-- 合同上传 -->
<el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24" class="contract">
<el-upload
class="upload-demo"
ref="upload1"
:action="action1"
:on-change="onChangepdf"
:file-list="fileList1"
:on-remove="delfile1"
:auto-upload="false"
:limit="1"
:data="proutlist1"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/pdf文件,且不超过500kb</div>
</el-upload>
</el-col>
<el-col :span="24">
<el-button type="success" icon="el-icon-upload2" @click="submitForm()">提交</el-button>
<el-button type="info" icon="el-icon-refresh-left" @click="resetForm()">重置信息</el-button>
<el-button type="primary" @click="drawerAdd()">添加发票单</el-button>
<el-button @click="back()">返回</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<!-- 抽屉 -->
<el-drawer title="发票单列表" :visible.sync="drawer" size="100%">
<!-- 表格区域 -->
<div class="drawer" v-show="isgetid==0" style="margin-left:5%">
<el-button type="primary" @click="Reimbursement()" style="margin:20px 0px">添加发票单</el-button>
<el-table :data="invoicegetList.list" border style="width:90%">
<el-table-column prop="invoiceId" label="序号" width="80"></el-table-column>
<el-table-column label="序号" width="80px">
<template slot-scope="scope">
{{
(invoicegetList.qurey.pageNum - 1) * invoicegetList.qurey.pageSize + scope.$index + 1
}}
</template>
</el-table-column>
<el-table-column prop="number" label="发票号码" width="width"></el-table-column>
<el-table-column prop="code" label="发票代码"></el-table-column>
<el-table-column prop="time" label="发票时间"></el-table-column>
......@@ -108,15 +127,17 @@
</template>
</el-table-column>
</el-table>
<!-- 分页部分有问题 -->
<!-- 分页 -->
<el-pagination
style="margin:0px auto"
:current-page.sync="invoicegetList.qurey.pageNum"
:page-size="invoicegetList.qurey.pageSize"
@current-change="getincomeSelectlist"
layout="total, prev, pager, next"
:total="invoicegetList.total"
></el-pagination>
</div>
<!-- 添加区域 -->
<!-- 添加发票 -->
<div class="getadd" v-show="isgetid==1" style="margin-left:5%">
<el-row>
<el-col :xl="8" :lg="10" :md="8" :sm="12" :xs="24">
......@@ -157,7 +178,6 @@
</el-form-item>
<el-form-item>
<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-button type="primary" icon="el-icon-refresh-left" @click="cancel()">取消</el-button>
</el-form-item>
</el-form>
......@@ -165,11 +185,14 @@
<el-col :xs="4" :sm="6" :md="8" :lg="10" :xl="11">
<el-upload
class="upload-demo"
ref="upload"
:file-list="fileList"
action="http://192.168.10.109:7080/file/uploadFile"
ref="upload2"
:file-list="fileList2"
:action="action2"
:auto-upload="false"
:data="proutlist"
:data="proutlist2"
:on-change="onChange"
:on-remove="delfile2"
:limit="1"
style="margin-left:90px;"
>
<el-button
......@@ -197,17 +220,11 @@ import {
} from "@/api/project";
import { selectAll } from "@/api/type";
import { insert } from "@/api/imcome";
export default {
data() {
return {
fileList: [],
proutlist: {
Id: 1,
status: 0
},
companyId: 0,
isgetid: 0,
drawer: false, //抽屉的显示与隐藏
//表单
incomeFrom: {
incomeBody: null,
incomeInformation: null,
......@@ -221,8 +238,6 @@ export default {
projectName: null,
incomebaoxioa: null //报销的字段
},
typeList: [],
projectData: {},
rules: {
projectName: [
{ required: true, message: "请选择项目", trigger: "change" }
......@@ -235,32 +250,7 @@ export default {
],
incomeTime: [
{ required: true, message: "请选择收入时间", trigger: "change" }
]
},
options: [
{
value: 0,
category: "普票"
},
{
value: 1,
category: "专票"
}
],
//添加发票的数组
addTO: {
category: 0,
code: null,
companyId: null,
mone: null,
number: null,
status: 0,
time: null,
type: 0
},
//抽屉的临时数据
//表单验证内容
rules: {
number: [
{ required: true, message: "请输入发票号码", trigger: "change" }
],
......@@ -283,45 +273,75 @@ export default {
],
mone: [{ required: true, message: "请输入发票金额", trigger: "change" }]
},
//查询发票数据
invoiceList: {
category: null,
options: [
{
value: 0,
category: "普票"
},
{
value: 1,
category: "专票"
}
],
invoiceListAdd: [], //选择的发票号
getinvoivelist: [], //查询的能选择的表单信息
typeList: [], //收入类型列表
fileTypepdf: false, //判断合同文件是否存在
fileList1: [], //合同文件
//合同文件上传携带参数
proutlist1: {
Id: null,
status: 0 //0收入 1支出
},
drawer: false, //发票视图
isgetid: 0, //发票视图切换
//发票参数
invoicegetList: {
list: [], //发票列表
//查询发票条件
qurey: {
pageNum: 1,
pageSize: 5,
companyId: null
},
total: 0
},
//添加发票的参数
addTO: {
category: 0, //0收入 1支出 2报销
code: null,
companyId: null,
invoiceId: null,
mone: null,
number: null,
orders: [
status: 0,//状态 0未报销 1已报销
time: null,
type: 0,//0 普票 1专票
userId: null //提交人
},
//发票类型
options: [
{
value: 0,
category: "普票"
},
{
asc: null,
column: null
value: 1,
category: "专票"
}
],
pageNum: 1,
pageSize: 10,
searchCount: null,
status: null,
time: null,
type: null
//判断发票文件是否存在
fileTypeJpg:false,
fileList2: [], //发票文件
proutlist2: {
Id: null,
status: 0 //0收入 1支出
},
//发票状态
status: 0,
//发票的数组
invoicegetList: [],
//发票编号数组
getinvoivelist: [],
//收集发票编号
invoiceListAdd: {},
//查询发票编号的数组
//查询发票编号的参数
getinvoiveId: {
userId: null,
companyId: null,
type: 0
},
pageNum: 10,
total: 10,
currentPage: 1,
//收集数据
newList: []
};
},
computed: {
......@@ -330,134 +350,107 @@ export default {
}
},
created() {
//用户id
this.incomeFrom.userId = this.$store.getters.urId;
this.addTO.companyId = this.$store.getters.companyId;
this.invoiceList.companyId = this.$store.getters.companyId;
this.invoicegetList.qurey.companyId = this.$store.getters.companyId;
//发票上传地址
this.action2 = process.env.VUE_APP_BASE_API + "/file/uploadFile";
//合同上传地址
this.action1 = process.env.VUE_APP_BASE_API + "/file/updataContractDocuments";
this.getinvoiveId.userId = this.$store.getters.urId;
this.getinvoiveId.companyId = this.$store.getters.companyId;
//获取收入类别
this.getTypeList();
//获取项目信息
this.getProject();
this.Selectinsertlsit();
},
methods: {
//获取收入类型
getTypeList() {
let param = {
companyId: this.$store.getters.companyId,
typeCategory: 0
};
selectAll(param)
.then(res => {
if (res.success) {
this.typeList = res.data;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取类型失败");
this.back();
});
},
//获取项目
getProject() {
let param = {
projectId: this.projectId
};
selectByProjectId(param)
.then(res => {
if (res.success) {
this.projectData = res.data;
this.incomeFrom.projectName = res.data.projectName;
this.incomeFrom.projectId = res.data.projectId;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取项目失败");
this.back();
});
//时间处理
timestampToTime1() {
var date = this.addTO.time;
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
var m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.addTO.time = Y + M + D + h + m + s;
},
//查询发票编号
Selectinsertlsit() {
selectAllBystatus(this.getinvoiveId)
.then(res => {
if (res.success) {
this.getinvoivelist = res.data;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取发票编号失败");
this.back();
});
timestampToTime() {
var date = this.incomeFrom.incomeTime;
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
var m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.incomeFrom.incomeTime = Y + M + D + h + m + s;
},
//提交
submitForm() {
this.$refs.form.validate(valid => {
if (valid) {
if (this.invoiceListAdd.length < 0) {
insert(this.incomeFrom)
.then(res => {
if (res.success) {
this.$message.success(res.msg);
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({
path: "/incomeList",
query: {
id: this.$route.query.id
}
});
} else {
this.$message.error(res.msg);
//判断是否有合同文件
if (this.fileTypepdf) {
this.proutlist1.Id = res.data;
this.$refs.upload1.submit();
}
})
.catch(error => {
this.$message.error("新建失败");
});
} else {
insert(this.incomeFrom)
.then(res => {
if (res.success) {
//判断是否有选择发票
if(this.invoiceListAdd.length > 0){
let list = [];
//提交发票与收入关系 status默认为1 表示发票已报销
this.invoiceListAdd.forEach(item => {
list.push({
invoiceId: item,
incomeId: res.data,
status: 1
status:1
});
});
updatesubmit(list)
.then(res => {
updatesubmit(list).then(res => {
if (res.success) {
this.$message.success(res.msg);
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({
path: "/incomeList",
query: {
id: this.$route.query.id
}
});
this.back()
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("新建失败");
});
}else{
this.back()
}
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("新建失败");
this.$message.error("提交失败");
});
}
}
});
},
//重置
......@@ -473,60 +466,82 @@ export default {
path: "/incomeList",
query: {
id: this.$route.query.id,
backid:this.$route.query.backid
backid: this.$route.query.backid
}
});
},
//时间处理 yyyy-MM-dd hh:mm:ss
timestampToTime1() {
var date = this.addTO.time;
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
var m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.addTO.time = Y + M + D + h + m + s;
//合同文件校验
onChangepdf(file) {
console.log("2")
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType == ".pdf") {
this.fileTypepdf = true;
} else {
this.$message.warning("合同文件只能是pdf格式文件");
this.$refs.upload1.clearFiles();
this.fileTypepdf = false;
}
},
timestampToTime() {
var date = this.incomeFrom.incomeTime;
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
var m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.incomeFrom.incomeTime = Y + M + D + h + m + s;
//获取收入类型
getTypeList() {
let param = {
companyId: this.$store.getters.companyId,
typeCategory: 0
};
selectAll(param)
.then(res => {
if (res.success) {
this.typeList = res.data;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取类型失败");
this.back();
});
},
//发票页面的按钮事件
//获取项目
getProject() {
let param = {
projectId: this.projectId
};
selectByProjectId(param)
.then(res => {
if (res.success) {
this.projectData = res.data;
this.incomeFrom.projectName = res.data.projectName;
this.incomeFrom.projectId = res.data.projectId;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取项目失败");
this.back();
});
},
//添加发票
drawerAdd() {
this.drawer = true;
this.getincomeSelectlist();
},
//发票的分页查询
//添加发票单
Reimbursement() {
this.isgetid = 1;
this.$refs.addTO.resetFields();
},
//查询发票信息
getincomeSelectlist(pager = 1) {
this.invoiceList.pageNum = pager;
queryBypageIncomeAdd(this.invoiceList)
this.invoicegetList.qurey.pageNum = pager;
queryBypageIncomeAdd(this.invoicegetList.qurey)
.then(res => {
if (res.success) {
this.invoicegetList = res.data;
this.total = res.data.total;
this.invoicegetList.list = res.data.list;
this.invoicegetList.total = res.data.total;
} else {
this.$message.errror(res.msg);
}
......@@ -535,61 +550,88 @@ export default {
this.$message.error("查询发票数据失败");
});
},
//分页
handleSizeChange(val) {
this.invoicegetList.pageSize = pageSize;
},
handleCurrentChange: function(currentPage) {
this.total = this.invoicegetList.length;
this.currentPage = currentPage;
},
//取消隐藏tatle
cancel() {
console.log(this.isgetid);
this.isgetid = 0;
this.getincomeSelectlist();
},
//显示报销单添加页面
Reimbursement() {
this.isgetid = 1;
this.$refs.addTO.resetFields();
//校验发票文件格式
onChange(file) {
console.log("1")
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType == ".pdf" || fileType == ".png" || fileType == ".jpg") {
this.fileTypeJpg = true
}else{
this.fileTypeJpg = false
this.$message.warning("发票文件只能是pdf,png,jpg格式文件");
this.$refs.upload2.clearFiles();
}
},
//发票提交页面的提交
getlistForm() {
//添加发票提交
getlistForm(){
if(this.fileTypeJpg){
this.$refs.addTO.validate(valid => {
if (valid) {
this.addTO.userId = this.$store.getters.urId
this.addTO.companyId = this.$store.getters.companyId
insertList(this.addTO)
.then(res => {
if (res.success) {
this.proutlist.Id = res.data;
//提交图片
this.$refs.upload.submit();
.then(res=>{
if(res.success){
//发票记录添加成功
//提交发票文件
this.proutlist2.Id = res.data;
this.$refs.upload2.submit();
this.$message.success(res.msg);
this.isgetid = 0;
this.addTO.time = "";
this.$refs.addTO.resetFields();
this.addTO = {
category: 0, //0收入 1支出 2报销
code: null,
companyId: null,
mone: null,
number: null,
status: 0,//状态 0未报销 1已报销
time: null,
type: 0,//0 普票 1专票
userId: null
}
this.$refs.upload2.clearFiles();
this.getincomeSelectlist();
this.Selectinsertlsit();
}else{
this.$message.errror(res.msg)
}
})
.catch(errpr=>{
this.$message.errror("发票添加失败")
})
}
})
}else{
this.$message.warning("没有发票文件,无法提交")
}
},
//查询发票编号
Selectinsertlsit() {
selectAllBystatus(this.getinvoiveId)
.then(res => {
if (res.success) {
this.getinvoivelist = res.data;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("新建失败");
});
}
this.$message.error("获取发票编号失败");
this.back();
});
},
//数据清除
delectdd() {
this.$refs.addTO.resetFields();
},
handleRemove(file, fileList) {
console.log(file, fileList);
//清楚合同文件
delfile1(file, fileList){
this.fileTypepdf = false
},
handlePreview(file) {
console.log(file);
//清除发片文件
delfile2(file, fileList){
this.fileTypeJpg = false
}
//图片上传
}
};
</script>
......
......@@ -31,7 +31,12 @@
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="qurey()">查询</el-button>
<el-button type="primary" icon="el-icon-refresh-right" @click="reset()">重置</el-button>
<el-button type="success" icon="el-icon-circle-plus-outline" @click="addincome()" v-if="state != 0">新增收入</el-button>
<el-button
type="success"
icon="el-icon-circle-plus-outline"
@click="addincome()"
v-if="state != 0"
>新增收入</el-button>
<el-button @click="back()">返回</el-button>
</el-form-item>
</el-form>
......@@ -79,6 +84,11 @@
<el-button type="primary" size="mini" @click="ReviseImage(scope.row)">点击查看</el-button>
</template>
</el-table-column>
<el-table-column prop="prop" label="项目合同">
<template slot-scope="scope">
<el-button type="success" size="mini" @click="selectImage(scope.row)">点击查看</el-button>
</template>
</el-table-column>
<el-table-column label="操作人员">
<template slot-scope="scope">
......@@ -111,18 +121,20 @@
</div>
<div>
<!--抽屉-->
<el-drawer
title="发票详情"
:visible.sync="drawer"
:direction="direction"
size="40%"
>
<el-drawer title="发票详情" :visible.sync="drawer" :direction="direction" size="40%">
<!-- filePath-->
<el-table :data="getinvoivelist" style="width: 100%; text-align: center" border>
<el-table-column type="index" label="序号" width="40"></el-table-column>
<el-table-column prop="prop" label="发票详情">
<el-table-column prop="number" label="号码" width="160px"></el-table-column>
<el-table-column prop="mone" label="金额" width="180"></el-table-column>
<el-table-column prop="prop" label="查看PDF文件或图片">
<template slot-scope="scope">
<el-image style="width: 100px; height: 100px" :src="scope.row.filePath" :preview-src-list="[scope.row.filePath]" ></el-image>
<div v-if="scope.row.filePath != null">
<a class="a-style" @click="handlePreView(scope.row)">点击查看图片或文件</a>
</div>
<div v-else>
<p>无图片或文件</p>
</div>
</template>
</el-table-column>
</el-table>
......@@ -135,6 +147,7 @@
import { selectByProjectId } from "@/api/imcome";
import { selectAll } from "@/api/type";
import { selectAllById } from "@/api/project";
import { Col } from "element-ui";
const InitialData = {
incomeBody: null,
......@@ -152,7 +165,6 @@ const InitialData = {
export default {
data() {
return {
incomeQurey: {
projectId: null,
pageNum: 1,
......@@ -180,20 +192,19 @@ export default {
//图片的数组
getinvoivelist: [],
//图片数组
srcList:[],
backid:null,
srcList: [],
backid: null
};
},
computed:{
state:function(){
return this.$route.query.state
computed: {
state: function() {
return this.$route.query.state;
}
},
created() {
this.getinvoiveId.companyId = this.$store.getters.companyId;
this.incomeQurey.projectId = this.$route.query.id;
this.backid=this.$route.query.backid
this.backid = this.$route.query.backid;
this.getIncome();
this.getTypeList();
},
......@@ -304,10 +315,24 @@ export default {
path: "/incomeAdd",
query: {
id: this.$route.query.id,
backid:this.backid
backid: this.backid
}
});
},
//查看项目合同
selectImage(row) {
if (row.contractDocuments != null) {
const photopath = process.env.VUE_APP_BASE_API + row.contractDocuments;
window.open(photopath, "_blank");
console.log(photopath);
} else {
this.$message({
showClose: true,
message: "该项目没有添加合同",
type: "warning"
});
}
},
//查看图片的方法
ReviseImage(row) {
this.drawer = true;
......@@ -321,9 +346,9 @@ export default {
.then(res => {
if (res.success) {
this.getinvoivelist = res.data;
this.getinvoivelist.forEach(e=>{
e.filePath = process.env.VUE_APP_BASE_API + e.filePath
})
// this.getinvoivelist.forEach(e => {
// e.filePath = process.env.VUE_APP_BASE_API + e.filePath;
// });
console.log(this.getinvoivelist);
} else {
this.$message.error(res.msg);
......@@ -346,22 +371,22 @@ export default {
});
},
//返回开始
back(){
if(this.backid==0){
back() {
if (this.backid == 0) {
this.$router.push({
path: "/projectList",
query: {
id: this.$route.query.id
}
});
}else if (this.backid==1) {
} else if (this.backid == 1) {
this.$router.push({
path: "/beresponsibleforList",
query: {
id: this.$route.query.id
}
});
}else{
} else {
this.$router.push({
path: "/participateinList",
query: {
......@@ -369,6 +394,12 @@ export default {
}
});
}
},
//点击查看发票
handlePreView(row) {
const photopath = process.env.VUE_APP_BASE_API + row.filePath;
console.log(photopath);
window.open(photopath, "_blank");
}
}
};
......
......@@ -3,7 +3,7 @@
<div class="header">
<el-form :inline="true" :model="memberQurey">
<el-form-item>
<el-button type="success" icon="el-icon-circle-plus-outline" @click="updataMember()">更新成员</el-button>
<el-button type="success" icon="el-icon-circle-plus-outline" @click="updataMember()">更新{{staffName}}</el-button>
<el-button @click="back()">返回</el-button>
</el-form-item>
</el-form>
......@@ -54,15 +54,27 @@ export default {
pageSize: 10
},
memberList: [],
total: 0
total: 0,
staffId:null,
staffName:null
};
},
created() {
this.memberId = this.$store.getters.memberId;
this.memberQurey.projectId = this.$route.query.id;
this.staffId=this.$route.query.staffId;
this.getMember();
this.staff();
},
methods: {
//判断staffId分析是负责人还是管理员
staff(){
if(this.staffId==0){
this.staffName='负责人'
}else{
this.staffName='成员'
}
},
//获取员工信息
getMember() {
console.log(selectByProjectId(this.memberQurey));
......@@ -102,7 +114,8 @@ export default {
this.$router.push({
path: "/memberUpdata",
query: {
id: this.$route.query.id
id: this.$route.query.id,
staffId:this.$route.query.staffId
}
});
}
......
......@@ -3,7 +3,7 @@
<el-row>
<el-col :span="22">
<el-form ref="form" :model="memberFrom" label-width="120px" :rules="rules">
<el-form-item label="普通成员" prop="ordinary">
<el-form-item :label="staffName" prop="ordinary">
<el-checkbox-group v-model="memberFrom.ordinary">
<el-checkbox v-for="city in datalist" :label="city.userId" :key="city.userId">
{{
......@@ -59,6 +59,9 @@ export default {
//过滤后的新数组
queryList: [],
memberId: null,
//判断是否是管理员
staffId: null,
staffName: null
};
},
computed: {
......@@ -69,16 +72,24 @@ export default {
created() {
this.memberQurey.projectId = this.$route.query.id;
this.memberId = this.$store.getters.memberId;
this.staffId = this.$route.query.staffId;
//查询员工
//this.getStaffList();
//查询项目的成员信息
this.getPeojectMember();
this.getselectlist();
this.staff();
},
methods: {
//判断staffId分析是负责人还是管理员
staff(){
console.log(this.staffId);
if(this.staffId==0){
this.staffName='负责人管理'
}else{
this.staffName='成员管理'
}
},
getselectlist() {
//查询员工,得到初始员工值
secletAllStaff({ companyId: this.$store.getters.companyId })
......@@ -97,7 +108,7 @@ export default {
list = queryList.filter(a => {
return a.memberPression == 0;
});
const datalistyou = list;;
const datalistyou = list;
//将项目负责人与查询员工分离整理
let datalist1 = this.staffList.filter(
a => !datalistyou.some(b => a.userId === b.userId)
......@@ -211,7 +222,8 @@ export default {
path: "/memberList",
query: {
id: this.$route.query.id,
memberId:this.memberId
memberId: this.memberId,
staffId:this.$route.query.staffId
}
});
},
......@@ -227,7 +239,7 @@ export default {
memberPression: 1
});
});
}else{
} else {
this.memberFrom.ordinary.forEach(e => {
member.push({
projectId: this.projectId,
......
......@@ -40,7 +40,7 @@
</el-table-column>
<el-table-column prop="projectName" label="项目名称" />
<el-table-column prop="projectNumber" label="项目编号" />
<el-table-column label="项目合同金额">
<!-- <el-table-column label="项目合同金额">
<template slot-scope="scope">
<p class="amounttext">{{scope.row.projectAmount}}</p>
</template>
......@@ -75,7 +75,7 @@
<template slot-scope="scope">
<p class="expendtext">{{scope.row.projectExpense}}</p>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
prop="projectStartTime"
label="项目开始时间"
......
......@@ -18,7 +18,9 @@
</div>
<div class="conter">
<el-table :data="projectList" style="width: 100%; text-align: center" border>
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand">
......@@ -32,6 +34,7 @@
</template>
</el-table-column>
<el-table-column label="序号" width="50px">
<template slot-scope="scope">
{{
......@@ -52,7 +55,7 @@
<p class="incometext">{{scope.row.projectIncome}}</p>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<el-table-column label="操作" align="center" >
<template slot-scope="scope">
<el-button size="mini" type="success" @click="showIncome(scope.row)">查看详情</el-button>
</template>
......@@ -205,18 +208,19 @@ export default {
path: "/incomeList",
query: {
id: data.projectId,
backid:0,
state:0
backid: 0,
state: 0
}
});
},
//成员管理
//负责人管理
member(data) {
this.$store.dispatch("settings/setMemberId", 0);
this.$router.push({
path: "/memberList",
query: {
id: data.projectId
id: data.projectId,
staffId:0
}
});
},
......@@ -226,8 +230,8 @@ export default {
path: "/expendList",
query: {
id: data.projectId,
backlistid:0,
state:0
backlistid: 0,
state: 0
}
});
}
......
......@@ -100,11 +100,11 @@
</el-table-column>
<el-table-column prop="userName" label="报销人" />
<el-table-column prop="projectName" label="项目" />
<el-table-column prop="typeName" label="报销类别">
<!-- <el-table-column prop="typeName" label="报销类别">
<template slot-scope="scope">
<el-tag>{{ scope.row.typeName }}</el-tag>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="applyTotalAmountSmall" label="申报总金额" />
<el-table-column label="核报总金额">
<template slot-scope="props">
......
......@@ -101,11 +101,11 @@
</el-table-column>
<el-table-column prop="userName" label="报销人" />
<el-table-column prop="projectName" label="项目" />
<el-table-column prop="typeName" label="报销类别">
<!-- <el-table-column prop="typeName" label="报销类别">
<template slot-scope="scope">
<el-tag>{{ scope.row.typeName }}</el-tag>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="applyTotalAmountSmall" label="申报总金额" />
<el-table-column label="核报总金额">
<template slot-scope="props">
......
<template>
<div class="container">
<!-- 左边 -->
<div class="box">
<el-form
ref="form"
......@@ -25,17 +26,6 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="报销类别" prop="typeId">
<el-select v-model="from.typeId" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.typeId"
:label="item.typeName"
:value="item.typeId"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="发票号码" prop="fromList">
<el-select
v-model="from.fromList"
......@@ -65,9 +55,22 @@
<el-form-item label="支付方式" prop="paymentMethod">
<el-input v-model="from.paymentMethod"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input
type="textarea"
:rows="5"
placeholder="请输入内容"
v-model="from.remarks"
>
</el-input>
</el-form-item>
<br />
<el-form-item>
<el-button type="success" icon="el-icon-upload2" @click="submitForm()"
<el-button
type="success"
icon="el-icon-upload2"
@click="submitForm()"
:disabled="subbut"
>提交</el-button
>
<el-button
......@@ -81,12 +84,41 @@
</el-form-item>
</el-form>
</div>
<!-- 右边 -->
<div>
<el-drawer
title="发票单列表"
:visible.sync="drawer"
size="100%"
<div class="spend" v-show="!subbut">
<el-form
:model="reimbursementItemData"
:inline="true"
label-width="150px"
ref="details"
>
<el-row
v-for="(item, index) in reimbursementItemData.list"
:key="index"
>
<el-col>
<el-form-item
:label="item.itemNamwe"
:prop="'list.' + index + '.money'"
:rules="{ validator: moneyrow, trigger: 'blur' }"
>
<el-input v-model="item.money"></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="item.remarks"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div v-show="subbut">
<el-empty description="暂无报销项,因此无法报销"></el-empty>
</div>
</div>
<!-- 报销单 -->
<el-drawer title="发票单列表" :visible.sync="drawer" size="100%">
<!-- 表格区域 -->
<div class="drawer" v-show="isgetid == 0" style="margin-left: 5%">
<el-button
......@@ -95,12 +127,17 @@
style="margin: 20px 0px"
>添加报销单</el-button
>
<el-table :data="invoicegetList.list" border style="width: 90%">
<el-table-column
prop="invoiceId"
label="序号"
width="80"
></el-table-column>
<el-table :data="invoicegetList" border style="width: 90%">
<el-table-column label="序号" width="50px">
<template slot-scope="scope">
{{
(invoicegetQurey.pageNum - 1) * invoicegetQurey.pageSize +
scope.$index +
1
}}
</template>
</el-table-column>
<el-table-column
prop="number"
label="发票号码"
......@@ -110,10 +147,9 @@
<el-table-column prop="time" label="发票时间"></el-table-column>
<el-table-column prop="category" label="发票类型">
<template slot-scope="scope">
<el-tag
:type="scope.row.category == '0' ? 'info' : 'primary'"
>{{ scope.row.category == "0" ? "普票" : "专票" }}</el-tag
>
<el-tag :type="scope.row.category == '0' ? 'info' : 'primary'">{{
scope.row.category == "0" ? "普票" : "专票"
}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="type" label="发票类别">
......@@ -149,9 +185,11 @@
<!-- total:总的条目数 -->
<el-pagination
style="margin: 0px auto"
:current-page.sync="invoicegetQurey.pageNum"
:page-size="invoicegetQurey.pageSize"
@current-change="getincomeSelectlist"
layout="total, prev, pager, next"
:total="invoicegetList.total"
:total="total"
></el-pagination>
</div>
<!-- 添加区域 -->
......@@ -203,12 +241,6 @@
@click="getlistForm()"
>立即创建</el-button
>
<el-button
type="info"
icon="el-icon-refresh"
@click="delectdd"
>重置信息</el-button
>
<el-button
type="primary"
icon="el-icon-refresh-left"
......@@ -223,9 +255,11 @@
class="upload-demo"
ref="upload"
:file-list="fileList"
action="http://192.168.10.109:7080/file/uploadFile"
:action="action"
:auto-upload="false"
:data="proutlist"
:on-change="onChange"
:on-remove="delfile2"
style="margin-left: 90px"
>
<el-button
......@@ -244,33 +278,6 @@
</div>
</el-drawer>
</div>
<div class="spend">
<el-form
:model="reimbursementItemData"
:inline="true"
label-width="150px"
ref="details"
>
<el-row
v-for="(item, index) in reimbursementItemData.list"
:key="index"
>
<el-col>
<el-form-item
:label="item.itemNamwe"
:prop="'list.' + index + '.money'"
:rules="{ validator: moneyrow, trigger: 'blur' }"
>
<el-input v-model="item.money"></el-input>
</el-form-item>
<el-form-item label="说明">
<el-input v-model="item.remarks"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</template>
<script>
......@@ -278,7 +285,6 @@ import { selectById } from "@/api/company";
import { selectAllCompanyId } from "@/api/reimbursementItem";
import { money } from "@/utils/myValidate";
import { selectAll as projectSelectAll } from "@/api/project";
import { selectAll as typeSelectAll } from "@/api/type";
import { insert } from "@/api/reimbursement";
import { Details } from "@/api/reimbursement";
import {
......@@ -286,15 +292,11 @@ import {
queryBypageIncomeAdd,
selectAllBystatus,
} from "@/api/project";
import { updatesubmit } from "@/api/project";
import { updatesubmit, uploadFile } from "@/api/project";
export default {
data() {
return {
company: {},
timeNow: null,
projectList: [],
typeList: [], //类型列表
invoiceList: [], //发票号码
//提交信息
from: {
companyId: null, //公司id
userName: null, //申报人
......@@ -308,42 +310,25 @@ export default {
paymentMethod: null, //支付方式
reimbursementState: 0, //状态
projectId: null, //项目id
typeId: null, //报销类别id
invoiceId: null, //发票的id
fromList: [],//发票号码
},
// invoiceId: null, //发票的id
fromList: [], //发票号码
remarks: "", //备注
},
projectList: [], //项目列表
getinvoivelist: [], //可以选择的发票号
subbut: false, //是否有报销项
//右边表单数据
reimbursementItemData: {
list: [],
},
reimbursementItemList: [],
//报销单区域
options: [
{
value: 0,
category: "普票",
},
{
value: 1,
category: "专票",
},
],
addTO: {
category: null,
code: null,
companyId: null,
mone: null,
number: null,
status: 0,
time: null,
type: 2,
},
isgetid: 0,
//表单验证内容
rules: {
typeId: [
{ required: true, message: "请选择报销类别", trigger: "change" },
],
invoiceId:[
fromList: [
{ required: true, message: "请选择发票号码", trigger: "change" },
],
projectId: [
......@@ -383,94 +368,146 @@ export default {
{ required: true, message: "请输入发票金额", trigger: "change" },
],
},
//查询发票数据
invoiceList: {
//发票列表窗口
drawer: false,
isgetid: 0,
//发票列表
invoicegetList: [],
//查询发票参数
invoicegetQurey: {
pageNum: 1,
pageSize: 10,
companyId: null,
},
total: 0,
//添加发票的参数
addTO: {
userId: null,
category: null,
code: null,
companyId: null,
invoiceId: null,
mone: null,
number: null,
orders: [
{
asc: null,
column: null,
},
],
pageNum: 1,
pageSize: 10,
searchCount: null,
status: null,
status: 0, //发票是否已报销 0未报销 1已报销
time: null,
type: null,
type: 2, // 0收入 1支出 2报销
},
drawer: false, //抽屉的显示与隐藏
//发票状态
status: 0,
//发票的数组
invoicegetList: [],
//发票编号数组
getinvoivelist: [],
//收集发票编号
invoiceListAdd: {},
//查询发票编号的数组
getinvoiveId: {
companyId: null,
type: 1,
//报销单区域
options: [
{
value: 0,
category: "普票",
},
pageNum: 10,
total: 1,
//收集数据
newList: [],
//保存图片
{
value: 1,
category: "专票",
},
],
fileList: [], //发票图片存放位置
action: null, //发票图片提交地址
//图片提交携带的额外参数
proutlist: {
Id: 1,
status: 1,
Id: null, //res.data
status: 2, // 0代表收入 1代表收入 2代表日常报销 3代表出差报销
},
fileList: [],
fileTypeJpg: false, //判断是否有发票文件且格式正确
};
},
created() {
this.from.userId = this.$store.getters.info.userId;
this.from.userName = this.$store.getters.info.userName;
this.from.userPhone = this.$store.getters.info.userPhone;
//获取公司id
this.invoiceList.companyId = this.$store.getters.companyId;
this.from.companyId = this.$store.getters.companyId;
this.addTO.companyId = this.$store.getters.companyId;
this.invoicegetQurey.companyId = this.$store.getters.companyId;
this.action = process.env.VUE_APP_BASE_API + "/file/uploadFile";
this.time();
this.getTypeList();
this.getReimbursement();
this.getProject();
this.Selectinsertlsit(); //获取发票号码
this.getReimbursement();
this.Selectinsertlsit();
},
methods: {
//解决输入框无法输入
change() {
this.$forceUpdate();
},
//获取公司报销类别
getTypeList() {
let param = {
companyId: this.$store.getters.companyId,
//typeCategory: 2,
};
typeSelectAll(param)
//提交
submitForm() {
this.$refs.form.validate((valid1) => {
if (valid1) {
this.$refs.details.validate((valid) => {
if (valid) {
insert(this.from)
.then((res) => {
if (res.success) {
this.typeList = res.data;
//上传右边的报销项了 ,上传报销项之前,需要处理数据reimbursementId代表着本次提交报销表的id
this.reimbursementItemData.list.forEach((item) => {
item.reimbursementId = res.data;
});
Details(this.reimbursementItemData.list).then((res) => {
if (res.success) {
this.$message.success("申请成功,等待审批");
this.back();
} else {
this.$message.error(res.msg);
}
});
//上传发票号
let list = [];
this.from.fromList.forEach((item) => {
list.push({
invoiceId: item,
reimbursementId: res.data,
status: 1,
});
});
updatesubmit(list).then((res) => {
if (item.success) {
this.$messages.success("发票联邦成功");
} else {
this.$messages.error("发票联邦失败");
}
});
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch((error) => {
this.$message.error("获取类型失败");
this.back();
this.$message.error("提交失败");
});
}
});
}
});
},
//重置信息
resetForm() {
this.$refs.form.resetFields();
this.time();
this.from.userId = this.$store.getters.info.userId;
this.from.userName = this.$store.getters.info.userName;
this.from.userPhone = this.$store.getters.info.userPhone;
this.from.companyId = this.$store.getters.companyId;
},
//返回
back() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/reimbursementList" });
},
//获取现在时间
time() {
let date = new Date();
var Y = date.getFullYear();
var M =
date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1;
var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var m =
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.from.fillingTime =
Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s;
},
//获取个人的项目
getProject() {
projectSelectAll({ userId: this.from.userId })
......@@ -494,10 +531,14 @@ export default {
.then((res) => {
if (res.success) {
//获取数据
this.reimbursementItemList = res.data;
let reimbursementItemList = res.data;
// console.log(this.reimbursementItemList.length)
if (reimbursementItemList.length == 0) {
this.subbut = true;
} else {
this.subbut = false;
//处理数据
this.reimbursementItemList.forEach((e) => {
reimbursementItemList.forEach((e) => {
//设置参数
let pram = {
itemNamwe: e.name,
......@@ -508,115 +549,15 @@ export default {
};
this.reimbursementItemData.list.push(pram);
});
} else {
this.$message.error(res.msg);
}
})
.catch((error) => {
this.$message.error("获取报销项失败");
});
},
//获取公司名称
getCompany() {
selectById({ companyId: this.$store.getters.companyId })
.then((res) => {
if (res.status == "success") {
this.company = res.data;
} else {
this.$message.error(res.data);
}
})
.catch((error) => {
this.$message.error("获取公司名称失败");
});
},
//提交
submitForm() {
this.$refs.form.validate((valid) => {
if (valid) {
//如果左侧校验成功,则开始校验右侧
this.$refs.details.validate((valid2) => {
if (valid2) {
insert(this.from)
.then((res) => {
if (res.success) {
this.reimbursementItemData.list.forEach((item) => {
item.reimbursementId = res.data;
});
let list = [];
this.from.fromList.forEach((item) => {
list.push({
invoiceId: item,
reimbursementId: res.data,
status: 1,
});
});
updatesubmit(list)
.then((item) => {
if (item.success) {
Details(this.reimbursementItemData.list).then(
(res) => {
if (res.success) {
this.$message.success("申请成功,等待审批");
this.back();
}
}
);
}
})
.catch((error) => {
console.log("报销失败");
});
} else {
this.$message.error(res.msg);
}
})
.catch((error) => {
this.$message.error("申请失败");
});
} else {
this.$message.error("请选择报销项");
}
});
}
this.$message.error("获取报销项失败");
});
},
//获取现在时间
time() {
let date = new Date();
var Y = date.getFullYear();
var M =
date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1;
var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var m =
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.from.fillingTime =
Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s;
this.timeNow = Y + "" + M + "" + D + "";
},
//新增消费
consumption() {
this.spend.push({});
},
//返回
back() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/reimbursementList" });
},
//重置信息
resetForm() {
this.$refs.form.resetFields();
this.time();
this.from.userId = this.$store.getters.info.userId;
this.from.userName = this.$store.getters.info.userName;
this.from.userPhone = this.$store.getters.info.userPhone;
this.from.companyId = this.$store.getters.companyId;
},
//定义金额校验
moneyrow(rule, value, callback) {
let RegExp =
......@@ -628,38 +569,20 @@ export default {
callback(new Error("金额格式错误"));
}
},
//发票单区域
timestampToTime1() {
var date = this.addTO.time;
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
var m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.addTO.time = Y + M + D + h + m + s;
},
//发票页面的按钮事件
//申请报销单
drawerAdd() {
this.drawer = true;
this.getincomeSelectlist();
},
//发票的分页查询
//查询发票
getincomeSelectlist(pager = 1) {
this.invoiceList.pageNum = pager;
queryBypageIncomeAdd(this.invoiceList)
this.invoicegetQurey.pageNum = pager;
queryBypageIncomeAdd(this.invoicegetQurey)
.then((res) => {
// console.log(res)
if (res.success) {
this.invoicegetList = res.data;
this.invoicegetList = res.data.list;
this.total = res.data.total;
} else {
this.$message.errror(res.msg);
......@@ -669,51 +592,101 @@ export default {
this.$message.error("查询发票数据失败");
});
},
//分页
handleSizeChange(val) {
this.invoicegetList.pageSize = pageSize;
},
handleCurrentChange(currentPage) {
this.invoicegetList.pageNum = currentPage;
},
//取消隐藏tatle
cancel() {
// console.log(this.isgetid);
this.isgetid = 0;
this.getincomeSelectlist();
},
//显示报销单添加页面
//添加报销单
Reimbursement() {
this.isgetid = 1;
},
//发票提交页面的提交
//发票单区域
timestampToTime1() {
var date = this.addTO.time;
var Y = date.getFullYear() + "-";
var M =
(date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1) + "-";
var D =
(date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
var h =
(date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
var m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
var s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.addTO.time = Y + M + D + h + m + s;
},
//发票提交
getlistForm() {
if (this.fileTypeJpg) {
this.$refs.addTO.validate((valid) => {
if (valid) {
this.addTO.companyId = this.$store.getters.companyId;
this.addTO.userId = this.$store.getters.info.userId;
insertList(this.addTO)
.then((res) => {
console.log(res);
console.log(this.isgetid);
if (res.success) {
//上传图片
//res.data 是上传那图片参数之一
//上传前提参数要对 status id
this.proutlist.Id = res.data;
//提交图片
//el-uploda组件的提交方法
//vue ref //代表着给标签设立一个标识 <div id=""></div> 相当于id
//this.$refs document.getElementById()
//手动上传
this.$refs.upload.submit();
this.$message.success(res.msg);
//切换到表格区域
this.isgetid = 0;
this.addTO.time = "";
this.$refs.addTO.resetFields();
//初始化表单
this.addTO = {
userId: null,
category: null,
code: null,
companyId: null,
mone: null,
number: null,
status: 0,
time: null,
type: 2,
};
this.getincomeSelectlist();
this.Selectinsertlsit();
} else {
this.$message.error(res.msg);
}
})
.catch((error) => {
console.log(error);
this.$message.error("新建失败");
});
}
});
} else {
this.$message.warning("需要发票的图片或文件");
}
},
//取消
cancel() {
this.isgetid = 0;
this.getincomeSelectlist();
},
//数据清除
delectdd() {
this.$refs.addTO.resetFields();
//校验发票图片是否合格
onChange(file) {
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType == ".pdf" || fileType == ".png" || fileType == ".jpg") {
this.fileTypeJpg = true;
} else {
this.fileTypeJpg = false;
this.$message.warning("发票文件只能是pdf,png,jpg格式文件");
this.$refs.upload.clearFiles();
}
},
//清除发片文件
delfile2(file, fileList) {
this.fileTypeJpg = false;
},
//查询发票编号
Selectinsertlsit() {
......@@ -721,10 +694,10 @@ export default {
companyId: this.$store.getters.companyId,
status: 0,
type: 2,
userId: this.$store.getters.info.userId,
};
selectAllBystatus(param)
.then((res) => {
// console.log(res)
if (res.success) {
this.getinvoivelist = res.data;
} else {
......@@ -748,7 +721,6 @@ export default {
</style>
<style scoped>
.box {
width: 800px;
float: left;
......
......@@ -99,11 +99,11 @@
</template>
</el-table-column>
<el-table-column prop="projectName" label="项目" />
<el-table-column prop="typeName" label="报销类别">
<!-- <el-table-column prop="typeName" label="报销类别">
<template slot-scope="scope">
<el-tag>{{ scope.row.typeName }}</el-tag>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="applyTotalAmountSmall" label="申报总金额" />
<el-table-column label="核报总金额">
<template slot-scope="props">
......@@ -212,23 +212,21 @@
</template>
</el-table-column>
</el-table>
<!-- 查看详情 -->
<el-drawer title="查看详情" :visible.sync="drawer" :direction="direction">
<el-form :inline="true" label-width="80px">
<el-row>
<el-col
v-for="(item, index) in reimbursementDetails.list"
:key="index"
:span="20"
>
<el-form-item :label="item.name">
<el-input v-model="item.money" disabled="disabled"></el-input>
</el-form-item>
<el-form-item label="说明">
<el-input v-model="item.remarks" disabled="disabled"></el-input>
</el-form-item>
<el-descriptions :title="item.name" border :column="1" style="margin: 10px 0;">
<el-descriptions-item label="金额">{{item.money}}</el-descriptions-item>
<el-descriptions-item label="备注" >{{item.explain}}</el-descriptions-item>
<el-descriptions-item label="说明" >{{item.remarks}}</el-descriptions-item>
</el-descriptions>
</el-col>
</el-row>
</el-form>
</el-drawer>
<el-drawer
......@@ -333,13 +331,10 @@ export default {
},
//获取申请报销列表
getReimbursement() {
// console.log(this.reimbursementQurey);
queryBypage(this.reimbursementQurey)
.then((res) => {
// console.log(res)
if (res.success) {
this.reimbursementList = res.data.list;
// console.log(this.reimbursementList);
this.total = res.data.total;
} else {
this.$message.error(res.msg);
......@@ -415,7 +410,6 @@ export default {
ReviseImage(row) {
this.invoiceShow = true;
this.getinvoiveId.reimbursementId = row.reimbursementId;
//console.log(process.env.VUE_APP_BASE_API);
this.Selectinsertlsit();
},
//查询发票图片
......@@ -427,7 +421,7 @@ export default {
this.getinvoivelist.forEach((e) => {
e.filePath = process.env.VUE_APP_BASE_API + e.filePath;
});
console.log(this.getinvoivelist);
// console.log(this.getinvoivelist);
} else {
this.$message.error(res.msg);
this.back();
......
......@@ -24,16 +24,6 @@
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="报销类别" prop="typeId">
<el-select v-model="from.typeId" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.typeId"
:label="item.typeName"
:value="item.typeId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="摘要" prop="summary">
<el-input v-model="from.summary"></el-input>
......@@ -48,6 +38,16 @@
<el-form-item label="支付方式" prop="paymentMethod">
<el-input v-model="from.paymentMethod" ></el-input>
</el-form-item>
<el-form-item label="备注">
<el-input
type="textarea"
:rows="2"
placeholder="请输入内容"
v-model="textarea"
>
</el-input>
</el-form-item>
<br />
<el-form-item>
<el-button type="success" icon="el-icon-upload2" @click="updateForm()">修改</el-button>
<el-button type="info" icon="el-icon-refresh-left" @click="resetForm()">重置信息</el-button>
......@@ -81,7 +81,7 @@
import { selectById } from "@/api/company";
import {selectById as reimbursementSelectById,update} from "@/api/reimbursement"
import {money} from "@/utils/myValidate"
import {selectAll as typeSelectAll} from "@/api/type";
// import {selectAll as typeSelectAll} from "@/api/type";
import { selectAll as projectSelectAll } from "@/api/project";
import { selectByReimbursementId } from "@/api/reimbursementDetails";
import { update as detailsUpdate } from "@/api/reimbursementDetails";
......@@ -93,6 +93,7 @@ import {
export default {
data() {
return {
textarea: "",//备注
reimbursementItemData: {
list: [],
},
......@@ -203,7 +204,7 @@ export default {
this.from.userName = this.$store.getters.info.userName;
this.from.userPhone = this.$store.getters.info.userPhone;
this.getFrom()
this.getTypeList()
// this.getTypeList()
this.getReimbursement()
this.getProject()
this.Selectinsertlsit()
......@@ -231,26 +232,6 @@ export default {
this.$message.error("获取报销项失败");
});
},
//获取公司报销类别
getTypeList() {
let param = {
companyId: this.$store.getters.companyId,
// typeCategory: 2,
};
typeSelectAll(param)
.then((res) => {
if (res.success) {
this.typeList = res.data;
} else {
this.$message.error(res.msg);
this.back()
}
})
.catch((error) => {
this.$message.error("获取类型失败");
this.back()
});
},
//获取报销信息
getFrom(){
//接收query传给我们的值
......
......@@ -80,9 +80,6 @@
}, {
value: '1',
label: '支出类别'
},{
value: "2",
label: "报销类别",
}]
};
},
......
......@@ -56,9 +56,9 @@
<el-table-column label="类别种类" >
<template slot-scope="scope">
<el-tag
:type="scope.row.typeCategory == '0' ? 'success' : scope.row.typeCategory == '1' ? 'danger':'warning' "
:type="scope.row.typeCategory == '0' ? 'success' : 'danger' "
>
{{scope.row.typeCategory == '0' ? '收入类别' : scope.row.typeCategory == '1' ? '支出类别':'报销类别'}}
{{scope.row.typeCategory == '0' ? '收入类别' : '支出类别'}}
</el-tag>
</template>
</el-table-column>
......@@ -105,10 +105,6 @@ export default {
value: "1",
label: "支出类别",
},
{
value: "2",
label: "报销类别",
}
],
total:0,
typeList:[]
......
......@@ -54,10 +54,6 @@ export default {
value: "1",
label: "支出类别",
},
{
value: "2",
label: "报销类别",
}
],
rules: {
typeName: [
......
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