Commit 20a8cb5e authored by 柳 佳乐's avatar 柳 佳乐
Browse files

合并

parent 098c6731
......@@ -4,4 +4,5 @@ ENV = 'development'
# base api 后端url
#VUE_APP_BASE_API = 'http://192.168.10.107:7080'
VUE_APP_BASE_API = 'http://192.168.10.109:11523'
#VUE_APP_BASE_API = 'http://www.aishuhong.com:11549/prod-api/·'
#VUE_APP_BASE_API = 'http://192.168.31.100:7081'
......@@ -92,4 +92,36 @@ export function selectAllById(data){
method:'post',
data
})
}
//删除关系
export function deletBystatus(data) {
return request({
url: '/invoice/deletBystatus',
method: 'post',
data
})
}
///enclosure/selectById附件查询
export function selectByIdF(data) {
return request({
url: '/enclosure/selectById',
method: 'post',
data
})
}
//删除附件/enclosure/deleteById
export function deleteById(data) {
return request({
url: '/enclosure/deleteById',
method: 'post',
data
})
}
///invoice/delete删除发票,彻底删除
export function deleteexpen(data) {
return request({
url: '/invoice/delete',
method: 'post',
data
})
}
\ No newline at end of file
......@@ -45,7 +45,7 @@ export const componentMap = {
'project_expend_updata':()=>import('@/views/project/expend/expendUpdata').then(m=>m.default),
//报销单
//'expense_list': () => import('@/views/expense/expenseList.vue').then(m => m.default),
'expense_list': () => import('@/views/expense/expenseList.vue').then(m => m.default),
//负责项目列表
'beresponsiblefor_List':()=>import('@/views/project/beresponsiblefor/beresponsibleforList').then(m => m.default),
//参与项目列表
......
......@@ -115,7 +115,7 @@ export function pathValid (rule, value, callback) {
}
//定义金额校验
export function money(rule, value, callback) {
let RegExp = /^(([1-9][0-9]{0,14})|([0]{1})|(([0]\\.\\d{1,2}|[1-9][0-9]{0,14}\\.\\d{1,2})))$/;
let RegExp = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/;
if (RegExp.test(value)) {
callback();
} else {
......
<template>
<div>我是报销单</div>
<div>
<!-- 发票模块 -->
<div class="QueryInvoice" style="margin:10px 15px">
<el-row :gutter="30">
<el-col :span="30">
<el-form :inline="true" :model="invoiceList">
<el-form-item label="发票号码" style="margin-left">
<el-input v-model="invoiceList.number" placeholder="发票号码"></el-input>
</el-form-item>
<el-form-item label="发票代码">
<el-input v-model="invoiceList.code" placeholder="发票代码"></el-input>
</el-form-item>
<el-form-item label="发票类型">
<el-select v-model="invoiceList.category" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.category"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发票类别">
<el-select v-model="invoiceList.type" placeholder="请选择">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.type"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发票状态">
<el-select v-model="invoiceList.status" placeholder="请选择">
<el-option
v-for="item in options2"
:key="item.value"
:label="item.status"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
</el-col>
<el-col :span="12" style="margin:20px 5px;">
<el-button
type="primary"
icon="el-icon-search"
style="margin:1px 5px;"
@click="selectexpend()"
>查询</el-button>
<el-button type="info" icon="el-icon-refresh" @click="upddlist()">重置</el-button>
<el-button type="success" icon="el-icon-download" @click="Reimbursement()">添加发票单</el-button>
</el-col>
</el-row>
</div>
<!-- 表格区域 -->
<div class="drawer" v-show="isgetid==0" style="margin-left:15px">
<el-table :data="invoicegetList.list" border style="width:99%">
<el-table-column label="序号" width="50" style>
<template slot-scope="scope">
{{
(invoiceList.pageNum - 1) * invoiceList.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>
<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>
</template>
</el-table-column>
<el-table-column prop="type" label="发票类别">
<template slot-scope="scope">
<el-tag
:type="scope.row.type== '0' ? 'success' : scope.row.type == '1' ? 'danger':'warning' "
>{{scope.row.type == '0' ? '收入' : scope.row.type == '1' ? '支出':'报销'}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="mone" label="发票金额"></el-table-column>
<el-table-column prop="status" label="发票状态" width="90px">
<template slot-scope="scope">
<el-tag
:type="scope.row.status == '0' ? 'info':'warning' "
>{{ scope.row.status==0 ? '未报销': "已报销"}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="prop" label="操作">
<template slot-scope="scope">
<el-popover placement="top" width="160" v-model="scope.row.visible">
<p>确定要删除当前发票吗</p>
<div style="text-align: right; margin: 0">
<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>
<el-button
type="danger"
icon="el-icon-delete"
slot="reference"
size="mini"
:disabled="scope.row.status==0?false:true"
></el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-row :gutter="20">
<el-col :span="4" style=" margin: 15px 70%;">
<!-- 分页 -->
<div class="foot_yi">
<el-pagination
@current-change="getincomeSelectlist"
layout="total, prev, pager, next"
:total="invoicegetList.total"
:current-page="invoiceList.pages"
background
></el-pagination>
</div>
</el-col>
</el-row>
</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">
<el-form
style="width:100%;margin:30px 0px"
:model="addTO"
:rules="rules"
ref="addTO"
label-width="80px"
class="demo-ruleForm"
>
<el-form-item label="发票号码" prop="number">
<el-input v-model="addTO.number" oninput="value=value.replace(/^\.+|[^\d.]/g,'')"></el-input>
</el-form-item>
<el-form-item label="发票代码" prop="code">
<el-input v-model="addTO.code"></el-input>
</el-form-item>
<el-form-item label="发票时间" required prop="time">
<el-date-picker
v-model="addTO.time"
type="datetime"
placeholder="选择日期时间"
@change="timestampToTime1()"
></el-date-picker>
</el-form-item>
<el-form-item label="发票类型" prop="category">
<el-select v-model="addTO.category" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.category"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发票类别" prop="type">
<el-select v-model="addTO.type" placeholder="请选择">
<el-option
v-for="item in options1"
:key="item.value"
:label="item.type"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发票金额" prop="mone">
<el-input v-model="addTO.mone"></el-input>
</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 @click="cancel()">取消</el-button>
</el-form-item>
</el-form>
</el-col>
<el-col :xs="4" :sm="6" :md="8" :lg="10" :xl="11">
<el-upload
class="upload-demo"
ref="upload"
:file-list="fileList"
:action="action"
:auto-upload="false"
:data="proutlist"
:on-change="onChange"
:on-remove="delfile"
:limit="1"
style="margin-left:90px;"
>
<el-button
slot="trigger"
size="small"
type="primary"
style="margin-left:20px;margin-top:40px;"
>选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png/pdf文件</div>
</el-upload>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import {
insertList,
queryBypageIncomeAdd,
deleteexpen
} from "@/api/project";
export default {
}
data() {
return {
//查询发票单的数据集合
QueryInvoiceList: [],
//发票参数
invoicegetList: {
list: [], //发票列表
//查询发票条件
qurey: {
pageNum: 1,
pageSize: 5,
companyId: null
},
total: 0
},
fileList: [],
proutlist: {
Id: 1,
status: 0
},
companyId: 0,
isgetid: 0,
typeList: [],
projectData: {},
options: [
{
value: 0,
category: "普票"
},
{
value: 1,
category: "专票"
}
],
options1: [
{
value: 0,
type: "收入"
},
{
value: 1,
type: "支出"
},
{
value: 2,
type: "报销"
}
],
options2: [
{
value: 0,
status: "未报销"
},
{
value: 1,
status: "已报销"
}
],
//添加发票的数组
addTO: {
category: null,
code: null,
companyId: null,
mone: null,
number: null,
status: 0,
time: null,
type: null
},
//抽屉的临时数据
//表单验证内容
rules: {
time: [
{ required: true, message: "请输入发票时间", trigger: "change" }
],
number: [
{ required: true, message: "请输入发票号码", trigger: "change" }
],
code: [
{ required: true, message: "请输入发票代码", trigger: "change" }
],
category: [
{
required: true,
message: "请至少选择一个发票类型",
trigger: "change"
}
],
type: [
{
required: true,
message: "请至少选择一个发票类别",
trigger: "change"
}
],
mone: [{ required: true, message: "请输入发票金额", trigger: "change" }]
},
//查询发票数据
invoiceList: {
category: null,
code: null,
companyId: null,
invoiceId: null,
mone: null,
number: null,
pageNum: 1,
pageSize: 10,
pages: 1,
searchCount: null,
status: null,
time: null,
type: null
},
//发票状态
status: 0,
//发票的数组
invoicegetList: [],
//发票编号数组
getinvoivelist: [],
//收集发票编号
invoiceListAdd: {},
//查询发票编号的数组
getinvoiveId: {
companyId: null,
type: 0
},
pageNum: 10,
total: 10,
//收集数据
newList: [],
visible: false //确认删除
};
},
computed: {
// projectId() {
// return this.$route.query.id;
// }
},
created() {
this.addTO.companyId = this.$store.getters.companyId;
this.invoiceList.companyId = this.$store.getters.companyId;
this.getinvoiveId.companyId = this.$store.getters.companyId;
//发票上传地址
this.action = process.env.VUE_APP_BASE_API + "/file/uploadFile";
this.getincomeSelectlist();
},
methods: {
//返回
back() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({
path: "/incomeList",
query: {
id: this.$route.query.id,
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;
},
//抽屉的关闭
handleClose(done) {
this.$confirm("确认关闭?")
.then(_ => {
this.isgetid = 0;
done();
})
.catch(_ => {});
},
//发票页面的按钮事件
drawerAdd() {
this.drawer = true;
this.getincomeSelectlist();
},
//查询
selectexpend() {
this.getincomeSelectlist();
},
selectggb() {
let list = [];
this.invoicegetList.forEach(item => {
list.push({
status: item.status
});
});
},
//发票的分页查询
getincomeSelectlist(pager = 1) {
this.invoiceList.pageNum = pager;
queryBypageIncomeAdd(this.invoiceList)
.then(res => {
if (res.success) {
this.invoicegetList = res.data;
this.total = res.data.total;
let list = [];
res.data.list.forEach((item, index) => {
list.push({
status: item.status
});
});
} else {
this.$message.errror(res.msg);
}
})
.catch(error => {
this.$message.error("查询发票数据失败");
});
},
//分页
handleSizeChange(val) {
this.invoicegetList.pageSize = val;
},
handleCurrentChange: function(currentPage) {
this.total = this.invoicegetList.length;
this.currentPage = currentPage;
},
//取消隐藏tatle
cancel() {
this.fileList = this.fileList.filter(item => item.uid !== file.uid);
this.isgetid = 0;
this.getincomeSelectlist();
},
//显示报销单添加页面
Reimbursement() {
this.isgetid = 1;
this.$refs.addTO.resetFields();
this.fileList = this.fileList.filter(item => item.uid !== file.uid);
},
//发票提交页面的提交
getlistForm() {
if (this.fileTypeJpg == true) {
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();
this.$message.success(res.msg);
this.isgetid = 0;
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,
pages: 1
};
//this.$refs.upload.clearFiles();
this.getincomeSelectlist();
//this.Selectinsertlsit();
} else {
this.$message.error(res.msg);
}
})
.catch(e => {
this.$message.error("发票添加失败,检测是否重复");
});
}
});
} else {
this.$message.warning("没有发票文件,无法提交");
}
},
//校验发票文件格式
onChange(file) {
const fileNamepdf = file.name;
console.log(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();
}
},
//清除发片文件
delfile() {
this.fileTypeJpg = false;
},
//数据清除
delectdd() {
this.$refs.addTO.resetFields();
},
//刷新
upddlist() {
(this.invoiceList = {
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,
time: null,
type: null
}),
(this.invoiceList.companyId = this.$store.getters.companyId);
this.invoiceList.pageNum = 1;
this.getincomeSelectlist();
},
//发票的删除操作
YesGet(row) {
deleteexpen(row)
.then(res => {
if (res.success) {
this.visible = false;
this.$message({
message: "发票删除成功",
type: "success"
});
this.getincomeSelectlist(
this.invoicegetList.list.length > 1
? this.invoiceList.pageNum
: this.invoiceList.pageNum - 1
);
} else {
this.$message.error(res.msg);
}
})
.catch(e => {
this.$message.error(e.msg);
});
}
}
};
</script>
<style>
<style scoped>
.container {
padding: 10px;
}
.QueryInvoice .el-form-item {
margin: 10px 15px;
}
.drawer .foot_yi {
margin: 10px 10px;
}
</style>
\ No newline at end of file
<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="expendFrom" label-width="120px" :rules="rules">
<el-form-item label="项目名称" prop="projectName">
......@@ -67,163 +67,77 @@
v-model="expendFrom.expendInformation"
></el-input>
</el-form-item>
<el-form-item>
<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-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%">
<!-- 表格区域 -->
<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 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>
<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>
</template>
</el-table-column>
<el-table-column prop="type" label="发票类别">
<template slot-scope="scope">
<el-tag
:type="scope.row.type== '0' ? 'success' : scope.row.type == '1' ? 'danger':'warning' "
>{{scope.row.type == '0' ? '收入' : scope.row.type == '1' ? '支出':'报销'}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="mone" label="发票金额"></el-table-column>
<el-table-column prop="status" label="发票状态">
<template slot-scope="scope">
<el-tag
:type="scope.row.status == '0' ? 'info':'warning' "
>{{ scope.row.status==0 ? '未报销': "已报销"}}</el-tag>
</template>
</el-table-column>
</el-table>
<!-- 分页-->
<el-pagination
style="margin:0px auto"
@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">
<el-form
style="width:100%;margin:30px 0px"
:model="addTO"
:rules="rules"
ref="addTO"
label-width="80px"
class="demo-ruleForm"
>
<el-form-item label="发票号码" prop="number">
<el-input v-model="addTO.number" oninput="value=value.replace(/^\.+|[^\d.]/g,'')"></el-input>
</el-form-item>
<el-form-item label="发票代码" prop="code">
<el-input v-model="addTO.code"></el-input>
</el-form-item>
<el-form-item label="发票时间" required>
<el-date-picker
v-model="addTO.time"
type="datetime"
placeholder="选择日期时间"
@change="timestampToTime1()"
></el-date-picker>
</el-form-item>
<el-form-item label="发票类型" prop="category">
<el-select v-model="addTO.category" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.category"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发票金额" prop="mone">
<el-input v-model="addTO.mone"></el-input>
</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>
</el-col>
<el-col :xs="4" :sm="6" :md="8" :lg="10" :xl="11">
<el-button type="primary" @click="dialogFormVisible = true">上传附件</el-button>
<el-dialog title="附件" :visible.sync="dialogFormVisible" width="55%">
<div style="width:60%;margin-left:30px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入附件详情"
v-model="proutlist1.enclosureDescribe"
style="margin:20px 0px;"
></el-input>
<el-upload
class="upload-demo"
ref="upload"
:file-list="fileList"
:action="action"
ref="upload1"
drag
:action="action2"
:file-list="fileList1"
:on-remove="delfile1"
:auto-upload="false"
:data="proutlist"
style="margin-left:90px;"
:on-change="onChange"
:on-remove="delfile2"
:limit="1"
:on-change="onChangepdf"
:data="proutlist1"
multiple
style="margin:20px 0px;"
>
<el-button
slot="trigger"
size="small"
type="primary"
style="margin-left:20px;margin-top:40px;"
>选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传附件</em>
</div>
<div class="el-upload__tip" slot="tip">只能上传jpd文件,且不超过500kb</div>
</el-upload>
</el-col>
</el-row>
</div>
</el-drawer>
</div>
<div style="margin-left:75%;">
<el-button @click="remove()">取 消</el-button>
<el-button
type="primary"
@click="dialogFormVisible = false"
style="margin-top:20px;"
>确 定</el-button>
</div>
</el-dialog>
</el-col>
<!-- 按钮区域 -->
<el-col :span="24" style="margin-left:120px;">
<!-- <el-form-item> -->
<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 @click="back()">返回</el-button>
<!-- </el-form-item> -->
</el-col>
</el-row>
</div>
</template>
<script>
import {
selectByProjectId,
insertList,
queryBypageIncomeAdd,
selectAllBystatus,
updatesubmit
} from "@/api/project";
import { selectAll } from "@/api/type";
import { insert } from "@/api/expend";
import { money } from "@/utils/myValidate";
export default {
data() {
return {
action2: null,
action: null,
fileList1: [],
expendFrom: {
expendBody: null,
expendInformation: null,
......@@ -253,81 +167,35 @@ export default {
]
},
companyId: 0,
isgetid: 0,
drawer: false, //抽屉的显示与隐藏
typeList: [],
projectData: {},
options: [
{
value: 0,
category: "普票"
},
{
value: 1,
category: "专票"
}
],
//添加发票的数组
addTO: {
category: 0,
code: null,
companyId: null,
mone: null,
number: null,
status: 0,
time: null,
type: 1,
userId: null
},
//表单验证内容
rules: {
number: [
{ required: true, message: "请输入发票号码", trigger: "change" }
expendType: [
{ required: true, message: "请输入支出类别", trigger: "change" }
],
code: [
{ required: true, message: "请输入发票代码", trigger: "change" }
expendMoney: [
{ required: true, validator: money, trigger: "blur" }
],
category: [
{
required: true,
message: "请至少选择一个发票类型",
trigger: "change"
}
expendObject: [
{ required: true, message: "请输入支出对象", trigger: "change" }
],
type: [
{
required: true,
message: "请至少选择一个发票类别",
trigger: "change"
}
expendBody: [
{ required: true, message: "请输入支出内容", trigger: "change" }
],
mone: [{ required: true, message: "请输入发票金额", trigger: "change" }]
},
//查询发票数据
invoiceList: {
category: null,
code: null,
companyId: null,
invoiceId: null,
mone: null,
number: null,
orders: [
{
asc: null,
column: null
}
expendRemarks: [
{ required: true, message: "请输入支出备注", trigger: "change" }
],
expendInformation: [
{ required: true, message: "请输入支出详情", trigger: "change" }
],
number: [
{ required: true, message: "请输入发票号码", trigger: "change" }
],
pageNum: 1,
pageSize: 10,
searchCount: null,
status: null,
time: null,
type: null
code: [{ required: true, message: "请输入发票代码", trigger: "change" }]
},
//发票状态
status: 0,
//发票的数组
invoicegetList: [],
//发票编号数组
getinvoivelist: [],
//收集发票编号
......@@ -350,12 +218,17 @@ export default {
//保存合同
proutlist1: {
Id: null,
status: 1
enclosureDescribe: "",
status: 1, //0收入 1支出
companyId: null,
userId: null
},
fileList: [],
fileType: null,
fileTypepdf: false,
backlistid: null
backlistid: null,
fileTypeJpg: null,
//附件
dialogFormVisible: false
};
},
computed: {
......@@ -365,14 +238,12 @@ 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.action2 = process.env.VUE_APP_BASE_API + "/file/updataEnclosures";
this.proutlist1.userId = this.$store.getters.urId;
this.proutlist1.companyId = this.$store.getters.companyId;
this.backlistid = this.$route.query.backlistid;
this.getTypeList();
this.getProject();
......@@ -504,32 +375,14 @@ export default {
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
this.expendFrom.expendTime = Y + M + D + h + m + s;
},
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) {
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType == ".pdf") {
if (fileType != "") {
this.fileTypepdf = true;
} else {
this.$message.warning("合同文件只能是pdf格式文件");
this.$message.warning("附件文件只能上传文件");
this.$resf.upload1.clearFiles();
this.fileTypepdf = false;
}
......@@ -538,99 +391,9 @@ export default {
//清楚合同文件
delfile1() {
this.fileTypepdf = false;
},
//清除发片文件
delfile2() {
this.fileTypeJpg = false;
this.fileList1 = this.fileList1.filter(item => item.uid !== file.uid);
},
//////发票区域//////
//发票页面的按钮事件
drawerAdd() {
this.drawer = true;
this.getincomeSelectlist();
},
//发票的分页查询
getincomeSelectlist(pager = 1) {
this.invoiceList.pageNum = pager;
queryBypageIncomeAdd(this.invoiceList)
.then(res => {
if (res.success) {
this.invoicegetList = res.data;
this.total = res.data.total;
} else {
this.$message.errror(res.msg);
}
})
.catch(error => {
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;
},
//发票提交页面的提交
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) {
this.proutlist.Id = res.data;
//提交图片
this.$refs.upload.submit();
this.$message.success(res.msg);
this.isgetid = 0;
this.addTO.time = "";
this.$refs.addTO.resetFields();
this.getincomeSelectlist();
this.Selectinsertlsit();
this.getincomeSelectlist();
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("新建失败");
});
} else {
this.$message.error("请输入jpg格式的图片或者pdf在或者png的文件");
}
}
});
},
//数据清除
delectdd() {
this.addTO = {
category: 0,
code: null,
companyId: null,
mone: null,
number: null,
status: 0,
time: null,
type: 1
};
},
//查询发票编号
Selectinsertlsit() {
selectAllBystatus(this.getinvoiveId)
......@@ -647,11 +410,11 @@ export default {
this.back();
});
},
//给fileType赋值
onChange(file) {
const fileName = file.name;
this.fileType = fileName.substring(fileName.lastIndexOf("."));
console.log(this.fileType);
//取消
remove() {
this.proutlist1.enclosureDescribe = null;
this.fileList1 = this.fileList1.filter(item => item.uid !== file.uid);
this.dialogFormVisible = false;
}
}
};
......@@ -662,6 +425,6 @@ export default {
padding: 10px;
}
.contract {
margin: 20px 50px;
margin: 0px 30px;
}
</style>
\ No newline at end of file
......@@ -75,6 +75,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">
<el-tag effect="plain">{{ scope.row.userName }}</el-tag>
......@@ -103,11 +108,110 @@
:total="total"
></el-pagination>
</div>
<!-- 附件抽屉 -->
<div>
<el-drawer title="附件操作" :visible.sync="drawer2" :direction="direction" size="50%">
<el-button
type="primary"
style=" margin-left:5%;margin-top:40px "
:disabled="disabled"
@click="updatecard"
>添加附件</el-button>
<el-card
class="box-card"
style="width:90%; margin-left:5%; margin-top:20px"
v-show="getshow==1"
>
<el-row class="row-bg">
<div v-for="index in queryDTOList" :key="index.enclosureId" class="lsitall">
<el-col :span="10">
<div style=" margin-top: 6px;margin-left:40px">附件{{index.enclosureId}}</div>
</el-col>
<el-col :span="12" style="margin-left:-50px">
<el-button
type="primary"
icon="el-icon-folder-checked"
class="a-style"
size="mini"
style=" font-size: 13px"
@click="delProject(index)"
>下载</el-button>
<el-popover placement="top" width="160" v-model="index.visible">
<p>确定要删除此条附件吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteProject(index)">确定</el-button>
</div>
<el-button
type="danger"
icon="el-icon-delete"
class="a-style"
size="mini "
style="font-size: 13px"
slot="reference"
>删除</el-button>
</el-popover>
</el-col>
</div>
</el-row>
</el-card>
<!-- 附件上传 -->
<el-card
class="box-card"
style="width:90%; margin-left:5%; margin-top:20px"
v-show="getshow==0"
>
<div style="width:60%;margin-left:30px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入附件详情"
v-model="proutlist1.enclosureDescribe"
style="margin:20px 0px;"
></el-input>
<el-upload
class="upload-demo"
ref="upload1"
drag
:action="action1"
:file-list="fileList1"
:on-remove="delfile1"
:auto-upload="false"
:on-change="onChangepdf"
:on-success="Refresh"
:data="proutlist1"
multiple
style="margin:20px 0px;"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传附件</em>
</div>
<div class="el-upload__tip" slot="tip">只能上传文件,且不超过500kb</div>
</el-upload>
</div>
<div style="margin-left:75%;">
<el-button @click="remove()">取 消</el-button>
<el-button type="primary" @click="determine()" style="margin-top:20px;">确 定</el-button>
</div>
</el-card>
<div class="box-card" v-show="getshow==3"></div>
</el-drawer>
</div>
<div>
<!--抽屉-->
<el-drawer title="发票详情" :visible.sync="drawer" :direction="direction" size="40%">
<el-drawer title="发票详情" :visible.sync="drawer" :direction="direction" size="60%">
<!-- filePath-->
<el-table :data="getinvoivelist" style="width: 100%; text-align: center" border>
<el-button type="primary" style="margin:10px 3%" @click="selectGet()">添加收入发票</el-button>
<el-table
:data="getinvoivelist"
style="width: 94%; margin:10px 3%; text-align: center"
border
>
<el-table-column type="index" label="序号" width="40"></el-table-column>
<el-table-column prop="number" label="号码" width="160px"></el-table-column>
<el-table-column prop="mone" label="金额" width="180"></el-table-column>
......@@ -121,19 +225,68 @@
</div>
</template>
</el-table-column>
<el-table-column prop="prop" label="操作">
<template slot-scope="scope">
<el-popover placement="top" width="60" v-model="scope.row.visible">
<p>确定要删除该发票吗</p>
<div style="text-align: right; margin:0">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="DeleteFrom(scope.row)">确定</el-button>
</div>
<el-button type="danger" icon="el-icon-delete" size="mini" slot="reference"></el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
</el-drawer>
</div>
<!-- 添加发票对话框 -->
<div>
<el-dialog title="添加发票" :visible.sync="dialogFormVisible" width="40%">
<div class="dialog-footer">
<div class="selectList">
<el-select
v-model="getListincom"
multiple
filterable
allow-create
default-first-option
style="width:100%;"
placeholder="请选择要添加的发票编号"
>
<el-option
v-for="item in invoiceListAdd"
:key="item.invoiceId"
:label="item.number"
:value="item.invoiceId"
></el-option>
</el-select>
</div>
<div slot="footer">
<el-button @click="Buttonback1()">取 消</el-button>
<el-button type="primary" @click="Buttonback2()">确 定</el-button>
</div>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import { selectAll } from "@/api/type";
import { selectByProjectId } from "@/api/expend";
import { selectAllById } from "@/api/project";
import {
selectAllById,
selectByIdF,
selectAllBystatus,
updatesubmit,
deletBystatus,
deleteById
} from "@/api/project";
export default {
data() {
return {
visible: false,
expendQurey: {
projectId: null,
pageNum: 1,
......@@ -161,7 +314,39 @@ export default {
//图片数组
srcList: [],
//返回的标记
backlistid: null
backlistid: null,
// //查询附件
queryDTO: {
companyId: null,
expendId: null
},
//附件抽屉
drawer2: false,
//发票对话框
dialogFormVisible: false,
//展示抽屉的数组
queryDTOList: [],
//查询的能选择的表单信息
getFormslist: {
userId: null,
companyId: null,
type: 1
},
incomeIdgrt: null, //收集incomeId数据
invoiceListAdd: [], //查询发票的集合
getListincom: [], //收集选择的数组
getshow: 1, //判断show的显示与隐藏,
//合同文件上传携带参数
proutlist1: {
Id: null,
enclosureDescribe: "",
status: 1, //0收入 1支出
companyId: null,
userId: null
},
fileTypepdf: false, //判断合同文件是否存在
fileList1: [], //合同文件
disabled: false //隐藏
};
},
computed: {
......@@ -173,6 +358,11 @@ export default {
this.getinvoiveId.companyId = this.$store.getters.companyId;
this.expendQurey.projectId = this.$route.query.id;
this.backlistid = this.$route.query.backlistid;
this.queryDTO.companyId = this.$store.getters.companyId;
this.getFormslist.companyId = this.$store.getters.companyId;
this.action1 = process.env.VUE_APP_BASE_API + "/file/updataEnclosures";
this.proutlist1.userId = this.$store.getters.urId;
this.proutlist1.companyId = this.$store.getters.companyId;
this.getexpend();
this.getTypeList();
},
......@@ -264,6 +454,17 @@ export default {
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
return Y + M + D + h + m + s;
},
//下载附件
delProject(row) {
var a = document.createElement("a"); //创建一个<a></a>标
a.href = process.env.VUE_APP_BASE_API + row.enclosureFile; // 给a标签的href属性值加上地址,注意,这里是绝对路径,不用加 点.
//a.download = row.enclosureFile; //设置下载文件文件名,这里加上.xlsx指定文件类型,pdf文件就指定.fpd即可
a.target = "_blank"
a.style.display = "none"; // 障眼法藏起来a标签
document.body.appendChild(a); // 将a标签追加到文档对象中
a.click(); // 模拟点击了a标签,会触发a标签的href的读取,浏览器就会自动下载了
a.remove(); // 一次性的,用完就删除a标签
},
//查询
qurey() {
this.expendQurey.pageNum = 1;
......@@ -283,6 +484,7 @@ export default {
ReviseImage(row) {
this.drawer = true;
this.getinvoiveId.expendId = row.expendId;
this.incomeIdgrt = row.expendId;
//console.log(process.env.VUE_APP_BASE_API);
this.Selectinsertlsit();
},
......@@ -336,6 +538,211 @@ export default {
const photopath = process.env.VUE_APP_BASE_API + row.filePath;
console.log(photopath);
window.open(photopath, "_blank");
},
//查看项目附件.....
selectImage(row) {
console.log(row);
this.queryDTO.expendId = row.expendId;
this.proutlist1.Id = row.expendId;
selectByIdF(this.queryDTO)
.then(res => {
if (res.success) {
this.queryDTOList = res.data;
if (this.queryDTOList.length > 0) {
this.drawer2 = true;
this.getshow = 1;
this.disabled = false;
} else {
this.drawer2 = true;
this.disabled = false;
this.getshow = 3;
}
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("获取附件文件失败");
});
},
//查询未报销发票
selectGet() {
this.dialogFormVisible = true;
this.getFormslist.userId = this.$store.getters.urId;
selectAllBystatus(this.getFormslist)
.then(res => {
if (res.success) {
this.invoiceListAdd = res.data;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取发票编号失败");
this.back();
});
},
//确定与取消
Buttonback1() {
this.getListincom = [];
this.dialogFormVisible = false;
},
Buttonback2() {
console.log(this.getListincom);
let list = [];
//提交发票与收入关系 status默认为1 表示发票已报销
this.getListincom.forEach(item => {
list.push({
invoiceId: item,
expendId: this.incomeIdgrt,
status: 1
});
});
console.log(list);
updatesubmit(list).then(res => {
if (res.success) {
this.$message.success(res.msg);
this.dialogFormVisible = false;
this.$message({
showClose: true,
message: "添加发票成功",
type: "success"
});
this.Selectinsertlsit();
this.getListincom = [];
} else {
this.$message.error(res.msg);
}
});
},
//删除发票
DeleteFrom(row) {
console.log(row);
//收集被删除发票的数据
let BillList = {
invoiceId: row.invoiceId,
expendId: row.expendId
};
console.log(BillList);
deletBystatus(BillList)
.then(res => {
if (res.success) {
this.visible = false;
this.$message({
message: "删除成功",
type: "success"
});
this.Selectinsertlsit();
console.log(res.msg);
}
})
.catch(errror => {
this.$message.error(res.msg);
});
},
// 附件-------0-----------
//显示添加附件
updatecard() {
this.getshow = 0;
this.disabled = true;
this.delfile1();
},
//删除附件
deleteProject(row) {
deleteById(row)
.then(res => {
if (res.success) {
this.selectImage(row);
this.$message({
message: "删除成功",
type: "success"
});
this.visible = false;
console.log(res.msg);
}
})
.catch(errror => {
this.$message.error(res.msg);
});
},
//清除附件文件
delfile1() {
this.fileList1 = this.fileList1.filter(item => item.uid !== file.uid);
this.fileTypepdf = false;
},
//确定提交附件
determine() {
//判断是否有附件文件
if (this.fileTypepdf) {
this.$refs.upload1.submit();
this.getshow = 1;
this.disabled = false;
this.$message({
showClose: true,
message: "上传附件成功",
type: "success"
});
this.Refresh();
} else {
this.$message.error("请添加附件,在进行提交");
}
},
//刷新附件
Refresh() {
this.queryDTO.expendId = this.proutlist1.Id;
console.log(this.proutlist1.Id);
selectByIdF(this.queryDTO)
.then(res => {
if (res.success) {
this.queryDTOList = res.data;
this.proutlist1.enclosureDescribe=""//初始化数据
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("获取附件文件失败");
});
},
//初始化数据
backii() {
this.proutlist1 = {
Id: null,
enclosureDescribe: "",
status: 0, //0收入 1支出
companyId: null,
userId: null
};
},
//附件取消
remove() {
if (this.queryDTOList.length > 0) {
this.getshow = 1;
this.disabled = false;
this.backii();
this.delfile1();
} else {
this.getshow = 3;
this.disabled = false;
this.backii();
this.delfile1();
}
},
//附件文件校验
onChangepdf(file) {
console.log(this.proutlist1);
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType != "") {
this.fileTypepdf = true;
} else {
this.$message.warning("附件只能只能上传文件");
this.$refs.upload1.clearFiles();
this.fileTypepdf = false;
}
}
}
};
......@@ -351,4 +758,23 @@ export default {
.footer {
text-align: right;
}
.conter {
margin-bottom: 10px;
}
.lsitall .el-col {
margin: 20px 10px;
}
.lsitall .el-button {
margin-left: 16px;
}
.row-bg {
margin-left: 15%;
}
.dialog-footer {
width: 90%;
margin: 20px 5%;
}
.selectList {
margin-bottom: 60px;
}
</style>
\ No newline at end of file
......@@ -48,10 +48,10 @@
<el-form-item label="对方户名" prop="incomeObject">
<el-input v-model="incomeFrom.incomeObject"></el-input>
</el-form-item>
<el-form-item label="收入内容" prop="incomeBody">
<el-form-item label="收入用途" prop="incomeBody">
<el-input v-model="incomeFrom.incomeBody"></el-input>
</el-form-item>
<el-form-item label="收入备注" prop="incomeRemarks">
<el-form-item label="收入附言" prop="incomeRemarks">
<el-input v-model="incomeFrom.incomeRemarks"></el-input>
</el-form-item>
<el-form-item label="收入详情" prop="incomeInformation">
......@@ -64,163 +64,68 @@
<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-button type="primary" @click="dialogFormVisible = true">上传附件</el-button>
<el-dialog title="附件" :visible.sync="dialogFormVisible" width="55%">
<div style="width:60%;margin-left:30px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入附件详情"
v-model="proutlist1.enclosureDescribe"
style="margin:20px 0px;"
></el-input>
<el-upload
class="upload-demo"
ref="upload1"
drag
:action="action1"
:file-list="fileList1"
:on-remove="delfile1"
:auto-upload="false"
:on-change="onChangepdf"
:data="proutlist1"
multiple
style="margin:20px 0px;"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传附件</em>
</div>
<div class="el-upload__tip" slot="tip">只能上传文件,且不超过500kb</div>
</el-upload>
</div>
<div style="margin-left:75%;">
<el-button @click="remove()">取 消</el-button>
<el-button
type="primary"
@click="dialogFormVisible = false"
style="margin-top:20px;"
>确 定</el-button>
</div>
</el-dialog>
</el-col>
<el-col :span="24">
<!-- 按钮 -->
<el-col :span="24" style="margin-left:120px;">
<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-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 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>
<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>
</template>
</el-table-column>
<el-table-column prop="type" label="发票类别">
<template slot-scope="scope">
<el-tag
:type="scope.row.type== '0' ? 'success' : scope.row.type == '1' ? 'danger':'warning' "
>{{scope.row.type == '0' ? '收入' : scope.row.type == '1' ? '支出':'报销'}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="mone" label="发票金额"></el-table-column>
<el-table-column prop="status" label="发票状态">
<template slot-scope="scope">
<el-tag
:type="scope.row.status == '0' ? 'info':'warning' "
>{{ scope.row.status==0 ? '未报销': "已报销"}}</el-tag>
</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">
<el-form
style="width:100%;margin:30px 0px"
:model="addTO"
:rules="rules"
ref="addTO"
label-width="80px"
class="demo-ruleForm"
>
<el-form-item label="发票号码" prop="number">
<el-input v-model="addTO.number" oninput="value=value.replace(/^\.+|[^\d.]/g,'')"></el-input>
</el-form-item>
<el-form-item label="发票代码" prop="code">
<el-input v-model="addTO.code"></el-input>
</el-form-item>
<el-form-item label="发票时间" required>
<el-date-picker
v-model="addTO.time"
type="datetime"
placeholder="选择日期时间"
@change="timestampToTime1()"
></el-date-picker>
</el-form-item>
<el-form-item label="发票类型" prop="category">
<el-select v-model="addTO.category" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.category"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="发票金额" prop="mone">
<el-input v-model="addTO.mone"></el-input>
</el-form-item>
<el-form-item>
<el-button type="success" icon="el-icon-folder-checked" @click="getlistForm()">立即创建</el-button>
<el-button type="primary" icon="el-icon-refresh-left" @click="cancel()">取消</el-button>
</el-form-item>
</el-form>
</el-col>
<el-col :xs="4" :sm="6" :md="8" :lg="10" :xl="11">
<el-upload
class="upload-demo"
ref="upload2"
:file-list="fileList2"
:action="action2"
:auto-upload="false"
:data="proutlist2"
:on-change="onChange"
:on-remove="delfile2"
:limit="1"
style="margin-left:90px;"
>
<el-button
slot="trigger"
size="small"
type="primary"
style="margin-left:20px;margin-top:40px;"
>选取文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
</el-upload>
</el-col>
</el-row>
</div>
</el-drawer>
</div>
</template>
<script>
import {
selectByProjectId,
insertList,
queryBypageIncomeAdd,
selectAllBystatus,
updatesubmit
} from "@/api/project";
import { selectAll } from "@/api/type";
import { insert } from "@/api/imcome";
import { money } from "@/utils/myValidate";
export default {
data() {
return {
......@@ -245,13 +150,28 @@ export default {
incomeType: [
{ required: true, message: "请选择收入类型", trigger: "change" }
],
incomeObject: [
{ required: true, message: "没有输入对方户名", trigger: "change" }
],
incomeBody: [
{ required: true, message: "没有输入对收入内容", trigger: "change" }
],
incomeRemarks: [
{ required: true, message: "没有输入收入备注", trigger: "change" }
],
incomeInformation: [
{ required: true, message: "没有输入收入详情", trigger: "change" }
],
incomeMoney: [
{ required: true, message: "请输入收入金额", trigger: "blur" }
{ required: true, validator: money, trigger: "blur" }
],
incomeTime: [
{ required: true, message: "请选择收入时间", trigger: "change" }
{ required: true, message: "请选择收到时间", trigger: "change" }
],
time: [
{ required: true, message: "请选择发票时间", trigger: "change" }
],
number: [
number: [
{ required: true, message: "请输入发票号码", trigger: "change" }
],
code: [
......@@ -291,50 +211,10 @@ export default {
//合同文件上传携带参数
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,
enclosureDescribe: "",
status: 0, //0收入 1支出
companyId: null,
mone: null,
number: null,
status: 0,//状态 0未报销 1已报销
time: null,
type: 0,//0 普票 1专票
userId: null //提交人
},
//发票类型
options: [
{
value: 0,
category: "普票"
},
{
value: 1,
category: "专票"
}
],
//判断发票文件是否存在
fileTypeJpg:false,
fileList2: [], //发票文件
proutlist2: {
Id: null,
status: 0 //0收入 1支出
userId: null
},
//查询发票编号的参数
getinvoiveId: {
......@@ -342,6 +222,8 @@ export default {
companyId: null,
type: 0
},
//附件
dialogFormVisible: false
};
},
computed: {
......@@ -352,18 +234,13 @@ export default {
created() {
//用户id
this.incomeFrom.userId = this.$store.getters.urId;
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.action1 = process.env.VUE_APP_BASE_API + "/file/updataEnclosures";
this.getinvoiveId.userId = this.$store.getters.urId;
this.getinvoiveId.companyId = this.$store.getters.companyId;
this.proutlist1.userId = this.$store.getters.urId;
this.proutlist1.companyId = this.$store.getters.companyId;
//获取收入类别
this.getTypeList();
//获取项目信息
......@@ -372,24 +249,6 @@ export default {
},
methods: {
//时间处理
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;
},
timestampToTime() {
var date = this.incomeFrom.incomeTime;
var Y = date.getFullYear() + "-";
......@@ -415,34 +274,33 @@ export default {
insert(this.incomeFrom)
.then(res => {
if (res.success) {
//判断是否有合同文件
//判断是否有附件文件
if (this.fileTypepdf) {
this.proutlist1.Id = res.data;
this.$refs.upload1.submit();
}
//判断是否有选择发票
if(this.invoiceListAdd.length > 0){
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 => {
if (res.success) {
this.$message.success(res.msg);
this.back()
this.back();
} else {
this.$message.error(res.msg);
}
});
}else{
this.back()
} else {
this.back();
}
} else {
this.$message.error(res.msg);
}
......@@ -472,13 +330,13 @@ export default {
},
//合同文件校验
onChangepdf(file) {
console.log("2")
console.log(this.proutlist1);
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType == ".pdf") {
if (fileType != "") {
this.fileTypepdf = true;
} else {
this.$message.warning("合同文件只能是pdf格式文件");
this.$message.warning("附件只能只能上传文件");
this.$refs.upload1.clearFiles();
this.fileTypepdf = false;
}
......@@ -524,90 +382,6 @@ export default {
this.back();
});
},
//添加发票
drawerAdd() {
this.drawer = true;
this.getincomeSelectlist();
},
//添加发票单
Reimbursement() {
this.isgetid = 1;
this.$refs.addTO.resetFields();
},
//查询发票信息
getincomeSelectlist(pager = 1) {
this.invoicegetList.qurey.pageNum = pager;
queryBypageIncomeAdd(this.invoicegetList.qurey)
.then(res => {
if (res.success) {
this.invoicegetList.list = res.data.list;
this.invoicegetList.total = res.data.total;
} else {
this.$message.errror(res.msg);
}
})
.catch(error => {
this.$message.error("查询发票数据失败");
});
},
//校验发票文件格式
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(){
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.proutlist2.Id = res.data;
this.$refs.upload2.submit();
this.$message.success(res.msg);
this.isgetid = 0;
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)
......@@ -625,12 +399,15 @@ export default {
});
},
//清楚合同文件
delfile1(file, fileList){
this.fileTypepdf = false
delfile1() {
this.fileTypepdf = false;
this.fileList1 = this.fileList1.filter(item => item.uid !== file.uid);
},
//清除发片文件
delfile2(file, fileList){
this.fileTypeJpg = false
//取消
remove() {
this.proutlist1.enclosureDescribe = null;
this.delfile1();
this.dialogFormVisible = false;
}
}
};
......
......@@ -84,7 +84,7 @@
<el-button type="primary" size="mini" @click="ReviseImage(scope.row)">点击查看</el-button>
</template>
</el-table-column>
<el-table-column prop="prop" label="项目合同">
<el-table-column prop="prop" label="附件下载">
<template slot-scope="scope">
<el-button type="success" size="mini" @click="selectImage(scope.row)">点击查看</el-button>
</template>
......@@ -110,6 +110,7 @@
</el-table>
</div>
<!-- 分页查询 -->
<div class="footer">
<el-pagination
@current-change="handleCurrentChange"
......@@ -119,14 +120,20 @@
:total="total"
></el-pagination>
</div>
<!--发票抽屉-->
<div>
<!--抽屉-->
<el-drawer title="发票详情" :visible.sync="drawer" :direction="direction" size="40%">
<el-drawer title="发票详情" :visible.sync="drawer" :direction="direction" size="60%">
<!-- filePath-->
<el-table :data="getinvoivelist" style="width: 100%; text-align: center" border>
<el-table-column type="index" label="序号" width="40"></el-table-column>
<el-button type="primary" style="margin:10px 3%" @click="selectGet()">添加收入发票</el-button>
<el-table
:data="getinvoivelist"
style="width: 94%; margin:10px 3%; text-align: center"
border
>
<el-table-column type="index" label="序号" width="40px"></el-table-column>
<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="mone" label="金额" width="180px"></el-table-column>
<el-table-column prop="prop" label="查看PDF文件或图片">
<template slot-scope="scope">
<div v-if="scope.row.filePath != null">
......@@ -137,17 +144,160 @@
</div>
</template>
</el-table-column>
<el-table-column prop="prop" label="操作">
<template slot-scope="scope">
<el-popover placement="top" width="60" v-model="scope.row.visible">
<p>确定要删除该发票吗</p>
<div style="text-align: right; margin:0">
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="DeleteFrom(scope.row)">确定</el-button>
</div>
<el-button type="danger" icon="el-icon-delete" size="mini" slot="reference"></el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
</el-drawer>
</div>
<!-- 添加发票对话框 -->
<div>
<el-dialog title="添加发票" :visible.sync="dialogFormVisible" width="40%">
<div class="dialog-footer">
<div class="selectList">
<el-select
v-model="getListincom"
multiple
filterable
allow-create
default-first-option
style="width:100%;"
placeholder="请选择要添加的发票编号"
>
<el-option
v-for="item in invoiceListAdd"
:key="item.invoiceId"
:label="item.number"
:value="item.invoiceId"
></el-option>
</el-select>
</div>
<div slot="footer">
<el-button @click="Buttonback1()">取 消</el-button>
<el-button type="primary" @click="Buttonback2()">确 定</el-button>
</div>
</div>
</el-dialog>
</div>
<!-- 附件抽屉 -->
<div>
<el-drawer title="附件操作" :visible.sync="drawer2" :direction="direction" size="50%">
<el-button
type="primary"
style=" margin-left:5%;margin-top:40px "
:disabled="disabled"
@click="updatecard"
>添加附件</el-button>
<el-card
class="box-card"
style="width:90%; margin-left:5%; margin-top:20px"
v-show="getshow==1"
>
<el-row class="row-bg">
<div v-for="index in queryDTOList" :key="index.enclosureId" class="lsitall">
<el-col :span="10">
<div style=" margin-top: 6px;margin-left:40px">附件{{index.enclosureId}}</div>
</el-col>
<el-col :span="12" style="margin-left:-50px">
<el-button
type="primary"
icon="el-icon-folder-checked"
class="a-style"
size="mini"
style=" font-size: 13px"
@click="delProject(index)"
>下载</el-button>
<el-popover placement="top" width="160" v-model="index.visible">
<p>确定要删除此条附件吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="index.visible= false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteProject(index)">确定</el-button>
</div>
<el-button
type="danger"
icon="el-icon-delete"
class="a-style"
size="mini "
style="font-size: 13px"
slot="reference"
>删除</el-button>
</el-popover>
</el-col>
</div>
</el-row>
</el-card>
<!-- 附件上传 -->
<el-card
class="box-card"
style="width:90%; margin-left:5%; margin-top:20px"
v-show="getshow==0"
>
<div style="width:60%;margin-left:30px">
<el-input
type="textarea"
:rows="2"
placeholder="请输入附件详情"
v-model="proutlist1.enclosureDescribe"
style="margin:20px 0px;"
></el-input>
<el-upload
class="upload-demo"
ref="upload1"
drag
:action="action1"
:file-list="fileList1"
:on-remove="delfile1"
:auto-upload="false"
:on-change="onChangepdf"
:on-success="Refresh"
:data="proutlist1"
multiple
style="margin:20px 0px;"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传附件</em>
</div>
<div class="el-upload__tip" slot="tip">只能上传文件,且不超过500kb</div>
</el-upload>
</div>
<div style="margin-left:75%;">
<el-button @click="remove()">取 消</el-button>
<el-button type="primary" @click="determine()" style="margin-top:20px;">确 定</el-button>
</div>
</el-card>
<div class="box-card" v-show="getshow==3"></div>
</el-drawer>
</div>
</div>
</template>
<script>
import { selectByProjectId } from "@/api/imcome";
import { selectAll } from "@/api/type";
import { selectAllById } from "@/api/project";
import { Col } from "element-ui";
import {
selectAllById,
selectByIdF,
selectAllBystatus,
updatesubmit,
deletBystatus,
deleteById
} from "@/api/project";
import { componentMap } from "../../../router";
const InitialData = {
incomeBody: null,
......@@ -165,6 +315,7 @@ const InitialData = {
export default {
data() {
return {
visible: false,
incomeQurey: {
projectId: null,
pageNum: 1,
......@@ -193,7 +344,37 @@ export default {
getinvoivelist: [],
//图片数组
srcList: [],
backid: null
backid: null,
//查询附件
queryDTO: {
companyId: null,
incomeId: null
},
queryDTOList: [], //收集附件的数据
//附件抽屉
drawer2: false,
//发票对话框
dialogFormVisible: false,
invoiceListAdd: [], //查询发票的集合
getFormslist: {
userId: null,
companyId: null,
type: 0
}, //查询的能选择的表单信息
getListincom: [], //收集选择的数组
incomeIdgrt: null, //收集incomeId数据
getshow: 1, //判断show的显示与隐藏,
//合同文件上传携带参数
proutlist1: {
Id: null,
enclosureDescribe: "",
status: 0, //0收入 1支出
companyId: null,
userId: null
},
fileTypepdf: false, //判断合同文件是否存在
fileList1: [], //合同文件
disabled: false //隐藏
};
},
computed: {
......@@ -205,6 +386,9 @@ export default {
this.getinvoiveId.companyId = this.$store.getters.companyId;
this.incomeQurey.projectId = this.$route.query.id;
this.backid = this.$route.query.backid;
this.queryDTO.companyId = this.$store.getters.companyId;
this.getFormslist.companyId = this.$store.getters.companyId;
this.action1 = process.env.VUE_APP_BASE_API + "/file/updataEnclosures";
this.getIncome();
this.getTypeList();
},
......@@ -319,24 +503,36 @@ export default {
}
});
},
//查看项目合同
//查看项目附件.....
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"
this.queryDTO.incomeId = row.incomeId;
this.proutlist1.Id = row.incomeId;
selectByIdF(this.queryDTO)
.then(res => {
if (res.success) {
this.queryDTOList = res.data;
if (this.queryDTOList.length > 0) {
this.drawer2 = true;
this.getshow = 1;
this.disabled = false;
} else {
this.drawer2 = true;
this.disabled = false;
this.getshow = 3;
}
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("获取附件文件失败");
});
}
},
//查看图片的方法
ReviseImage(row) {
this.drawer = true;
this.getinvoiveId.incomeId = row.incomeId;
this.incomeIdgrt = row.incomeId;
//console.log(process.env.VUE_APP_BASE_API);
this.Selectinsertlsit();
},
......@@ -346,9 +542,6 @@ 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;
// });
console.log(this.getinvoivelist);
} else {
this.$message.error(res.msg);
......@@ -400,6 +593,193 @@ export default {
const photopath = process.env.VUE_APP_BASE_API + row.filePath;
console.log(photopath);
window.open(photopath, "_blank");
},
//下载附件
delProject(row) {
var a = document.createElement("a"); //创建一个<a></a>标
a.href = process.env.VUE_APP_BASE_API + row.enclosureFile; // 给a标签的href属性值加上地址,注意,这里是绝对路径,不用加 点.
//a.download = row.enclosureFile; //设置下载文件文件名,这里加上.xlsx指定文件类型,pdf文件就指定.fpd即可
a.target = "_blank"
a.style.display = "none"; // 障眼法藏起来a标签
document.body.appendChild(a); // 将a标签追加到文档对象中
a.click(); // 模拟点击了a标签,会触发a标签的href的读取,浏览器就会自动下载了
a.remove(); // 一次性的,用完就删除a标签
},
//查询未报销发票
selectGet() {
this.dialogFormVisible = true;
this.getFormslist.userId = this.$store.getters.urId;
selectAllBystatus(this.getFormslist)
.then(res => {
if (res.success) {
this.invoiceListAdd = res.data;
} else {
this.$message.error(res.msg);
this.back();
}
})
.catch(error => {
this.$message.error("获取发票编号失败");
this.back();
});
},
//确定与取消
Buttonback1() {
this.selectGet();
this.dialogFormVisible = false;
this.getListincom = [];
console.log();
},
Buttonback2() {
console.log(this.getListincom);
let list = [];
//提交发票与收入关系 status默认为1 表示发票已报销
this.getListincom.forEach(item => {
list.push({
invoiceId: item,
incomeId: this.incomeIdgrt,
status: 1
});
});
console.log(list);
updatesubmit(list).then(res => {
if (res.success) {
this.$message.success(res.msg);
this.dialogFormVisible = false;
this.$message({
showClose: true,
message: "添加发票成功",
type: "success"
});
this.Selectinsertlsit();
this.getListincom = [];
} else {
this.$message.error(res.msg);
}
});
},
//删除发票
DeleteFrom(row) {
console.log(row);
//收集被删除发票的数据
let BillList = {
invoiceId: row.invoiceId,
incomeId: row.incomeId
};
console.log(BillList);
deletBystatus(BillList)
.then(res => {
if (res.success) {
this.visible = false;
this.$message({
message: "删除成功",
type: "success"
});
this.Selectinsertlsit();
console.log(res.msg);
}
})
.catch(errror => {
this.$message.error(res.msg);
});
},
// 附件-------0-----------
//显示添加附件
updatecard() {
this.getshow = 0;
this.disabled = true;
this.delfile1();
},
//删除附件
deleteProject(row) {
deleteById(row)
.then(res => {
if (res.success) {
this.selectImage(row);
this.$message({
message: "删除成功",
type: "success"
});
this.visible = false;
console.log(res.msg);
}
})
.catch(errror => {
this.$message.error(res.msg);
});
},
//清除附件文件
delfile1(file) {
this.fileList1 = this.fileList1.filter(item => item.uid !== file.uid);
this.fileTypepdf = false;
},
//确定提交附件
determine() {
//判断是否有附件文件
if (this.fileTypepdf) {
this.proutlist1.userId = this.$store.getters.urId;
this.proutlist1.companyId = this.$store.getters.companyId;
this.$refs.upload1.submit();
this.getshow = 1; //隐藏与显示
this.disabled = false;
//this.backii();
this.$message({
showClose: true,
message: "上传附件成功",
type: "success"
});
this.Refresh();
} else {
this.$message.error("请添加附件,在进行提交");
}
},
//刷新附件
Refresh() {
console.log(this.proutlist1.Id);
this.queryDTO.incomeId = this.proutlist1.Id;
console.log(this.proutlist1.Id);
selectByIdF(this.queryDTO)
.then(res => {
if (res.success) {
this.queryDTOList = res.data;
this.proutlist1.enclosureDescribe=""//初始化数据
} else {
this.$message.error(res.msg);
}
})
.catch(error => {
this.$message.error("获取附件文件失败");
});
},
//附件取消
remove() {
if (this.queryDTOList.length > 0) {
this.getshow = 1;
this.disabled = false;
this.backii();
this.delfile1();
} else {
this.getshow = 3;
this.disabled = false;
this.backii();
this.delfile1();
}
},
//附件文件校验
onChangepdf(file) {
console.log(this.proutlist1);
const fileNamepdf = file.name;
let fileType = fileNamepdf.substring(fileNamepdf.lastIndexOf("."));
if (fileType != "") {
this.fileTypepdf = true;
} else {
this.$message.warning("附件只能只能上传文件");
this.$refs.upload1.clearFiles();
this.fileTypepdf = false;
}
}
}
};
......@@ -415,4 +795,20 @@ export default {
.footer {
text-align: right;
}
.lsitall .el-col {
margin: 20px 10px;
}
.lsitall .el-button {
margin-left: 16px;
}
.row-bg {
margin-left: 15%;
}
.dialog-footer {
width: 90%;
margin: 20px 5%;
}
.selectList {
margin-bottom: 60px;
}
</style>
\ No newline at end of file
......@@ -56,8 +56,8 @@
<div>
负责人:
<el-tag
:key="projectLeader"
v-for="(projectLeader,index) in projectLeaderList"
:key="index"
v-for="(projectLeader,index) in userIdAdd"
closable
:disable-transitions="false"
@close="delectTag(index)"
......@@ -76,16 +76,15 @@
:value="item.rlId"
></el-option>
</el-select>
<!--<el-button type="primary" @click="selsetperson()" :disabled="isgetrules">搜索</el-button>-->
<!-- <el-button type="primary" @click="ggb()" :disabled="isgetrules">搜索</el-button> -->
<div class="personList">
<el-checkbox-group v-model="projectLeaderList">
<el-checkbox
:label="ch.userName"
:label="ch.userId"
v-for="ch in checkList"
:key="ch.userId"
:value="ch.userId"
@change="AddSelect(ch.userId)"
></el-checkbox>
@change="AddSelect(ch)"
>{{ch.userName}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
......@@ -200,21 +199,17 @@ export default {
delectTag(index) {
this.projectLeaderList.splice(index, 1);
this.userIdAdd.splice(index, 1);
console.log(this.userIdAdd);
},
//projectId:0,
//userId:this.checkList.userId,
//memberId: 0
AddSelect(row) {
//定义一个对象
let attr = {};
this.projectLeaderList.forEach((item, index) => {
attr.userId = row;
attr.projectId = 0;
attr.memberPression = 0;
});
this.userIdAdd.push(attr);
if (this.projectLeaderList.indexOf(row.userId) > -1) {
this.userIdAdd.push(row.userName);
}else{
let index = this.userIdAdd.indexOf(row.userName);
this.userIdAdd.splice(index, 1);
}
console.log(this.userIdAdd);
},
//时间处理
time(val) {
if (val == null) {
......@@ -242,16 +237,16 @@ export default {
.then(res => {
if (res.success) {
let dateadd = [];
this.userIdAdd.forEach(item => {
this.projectLeaderList.forEach(item => {
dateadd.push({
userId: item.userId,
projectId:res.data,
userId: item,
projectId: res.data,
memberPression: 0
});
});
console.log(dateadd);
let restle = insertBatch(dateadd);
if (restle.success = true) {
if ((restle.success = true)) {
console.log("保存成功");
this.$message.success("新建成功");
this.back();
......
......@@ -18,9 +18,7 @@
</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">
......@@ -33,7 +31,6 @@
</el-form>
</template>
</el-table-column>
<el-table-column label="序号" width="50px">
<template slot-scope="scope">
......
......@@ -281,7 +281,6 @@
</template>
<script>
import { selectById } from "@/api/company";
import { selectAllCompanyId } from "@/api/reimbursementItem";
import { money } from "@/utils/myValidate";
import { selectAll as projectSelectAll } from "@/api/project";
......
<template>
<div class="container">
<el-row>
<el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="24">
<el-form :model="typefrom" ref="from" label-width="60px" class="demo-dynamic" >
<el-row v-for="(item, index) in typefrom.typeList" :key="item.key">
<el-col :xl="6" :lg="8" :md="8" :sm="10" :xs="24">
<el-form-item
:label="'种类' + (index+1)"
:prop="'typeList.' + index + '.typeCategory'"
:rules="{
required: true, message: '种类不能为空', trigger: 'blur'
}"
>
<el-select v-model="item.typeCategory" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="24">
<el-form-item
:label="'名称' + (index+1)"
:prop="'typeList.' + index + '.typeName'"
:rules="{
required: true, message: '类名不能为空', trigger: 'blur'
}"
>
<div>
<el-row :gutter="10">
<el-col :span="18">
<el-input v-model="item.typeName"></el-input>
</el-col>
<el-col :span="4">
<el-button @click.prevent="removeDomain(item)">删除</el-button>
</el-col>
</el-row>
</div>
</el-form-item>
</el-col>
</el-row>
<el-form-item>
<el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="addDomain">新增类型</el-button>
<el-button @click="resetForm()">重置</el-button>
<el-button @click="back()">返回</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<div>
<el-form :inline="true" :model="typeQurey">
<el-form-item label="类别名称">
<el-input
v-model="typeQurey.typeName"
placeholder="类别名称"
></el-input>
</el-form-item>
<el-form-item label="列别">
<el-select v-model="typeQurey.typeCategory" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<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="addtype()"
>添加类型</el-button
>
</el-form-item>
</el-form>
</div>
<div class="conter">
<el-table
:data="typeList"
style="width: 100%; text-align: center"
border
>
<el-table-column label="序号" width="50px">
<template slot-scope="scope">
{{
(typeQurey.pageNum - 1) * typeQurey.pageSize + scope.$index + 1
}}
</template>
</el-table-column>
<el-table-column prop="typeName" label="类别名称" />
<el-table-column label="类别种类" >
<template slot-scope="scope">
<el-tag
:type="scope.row.typeCategory == '0' ? 'success' : 'danger' "
>
{{scope.row.typeCategory == '0' ? '收入类别' : '支出类别'}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button style="margin:5px" size="mini" icon="el-icon-edit" type="info" @click="updataType(scope.row)">修改信息</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="footer">
<el-pagination
@current-change="handleCurrentChange"
:current-page.sync="typeQurey.pageNum"
:page-size="typeQurey.pageSize"
layout="total, prev, pager, next"
:total="total"
>
</el-pagination>
</div>
</div>
</template>
<script>
import { select } from "@/api/type";
import { insert } from "@/api/type"
export default {
data() {
return {
typefrom: {
typeList:[
{
key:Date.now(),
typeCategory:'1',
typeName:'',
companyId:this.$store.getters.companyId,
}
]
},
options: [{
value: '0',
label: '收入类别'
}, {
value: '1',
label: '支出类别'
}]
};
},
methods: {
//提交
submitForm() {
this.$refs.from.validate((valid) => {
if (valid) {
console.log(this.typefrom)
insert(this.typefrom.typeList).then((res)=>{
if(res.success){
this.$message.success("添加成功")
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push("/typeList")
}else{
this.$message.error(res.msg)
}
}).catch((error)=>{
console.log(error)
this.$message.error("添加失败")
})
} else {
console.log('error submit!!');
return false;
}
});
export default {
data() {
return {
typeQurey: {
typeName: null,
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
},
//重置
resetForm() {
this.$refs.from.resetFields();
},
removeDomain(item) {
var index = this.typefrom.typeList.indexOf(item)
if (index !== -1) {
this.typefrom.typeList.splice(index, 1)
options: [
{
value: "0",
label: "收入类别",
},
{
value: "1",
label: "支出类别",
},
],
total:0,
typeList:[]
};
},
created() {
this.typeQurey.companyId = this.$store.getters.companyId
this.getTypeList()
},
methods: {
//获取种类
getTypeList(){
select(this.typeQurey).then((res)=>{
if(res.success){
this.typeList = res.data.list
this.total = res.data.total
}else{
this.$message.error(res.msg)
}
},
addDomain() {
this.typefrom.typeList.push(
{
key:Date.now(),
typeName:'',
typeCategory:'1',
companyId:this.$store.getters.companyId,
}
);
},
//返回
back(){
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push("/typeList")
}).catch((error)=>{
this.$message.error("查询失败")
})
},
//重置
reset() {
this.typeQurey = {
typeName: null,
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
}
this.typeQurey.companyId = this.$store.getters.companyId
this.getTypeList()
},
//添加类型
addtype() {
this.$router.push('/typeAdd')
},
//修改类型
updataType(data){
this.$router.push({
path: '/typeUpdata',
query:{
id:data.typeId,
}
})
},
//搜索
qurey(){
this.typeQurey.pageNum = 1
this.getTypeList()
},
//换页
handleCurrentChange(val){
this.typeQurey.pageNum = val
this.getTypeList()
}
}
},
};
</script>
<style scoped>
.container {
padding: 10px;
}
</style>
\ No newline at end of file
.container {
padding: 10px;
}
.conter {
margin-bottom: 10px;
}
.footer {
text-align: right;
}
</style>
\ No newline at end of file
<template>
<div class="container">
<div>
<el-form :inline="true" :model="typeQurey">
<el-form-item label="类别名称">
<el-input
v-model="typeQurey.typeName"
placeholder="类别名称"
></el-input>
</el-form-item>
<el-form-item label="列别">
<el-select v-model="typeQurey.typeCategory" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<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="addtype()"
>添加类型</el-button
>
</el-form-item>
</el-form>
</div>
<div class="conter">
<el-table
:data="typeList"
style="width: 100%; text-align: center"
border
>
<el-table-column label="序号" width="50px">
<template slot-scope="scope">
{{
(typeQurey.pageNum - 1) * typeQurey.pageSize + scope.$index + 1
}}
</template>
</el-table-column>
<el-table-column prop="typeName" label="类别名称" />
<el-table-column label="类别种类" >
<template slot-scope="scope">
<el-tag
:type="scope.row.typeCategory == '0' ? 'success' : 'danger' "
>
{{scope.row.typeCategory == '0' ? '收入类别' : '支出类别'}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button style="margin:5px" size="mini" icon="el-icon-edit" type="info" @click="updataType(scope.row)">修改信息</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="footer">
<el-pagination
@current-change="handleCurrentChange"
:current-page.sync="typeQurey.pageNum"
:page-size="typeQurey.pageSize"
layout="total, prev, pager, next"
:total="total"
>
</el-pagination>
</div>
<div>
<el-upload
class="upload-demo"
action="http://192.168.10.109:11523/uploadFile"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="3"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
</el-upload>
</div>
</template>
<script>
import { select } from "@/api/type";
export default {
data() {
return {
typeQurey: {
typeName: null,
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
},
options: [
{
value: "0",
label: "收入类别",
},
{
value: "1",
label: "支出类别",
},
],
total:0,
typeList:[]
};
},
created() {
this.typeQurey.companyId = this.$store.getters.companyId
this.getTypeList()
},
methods: {
//获取种类
getTypeList(){
select(this.typeQurey).then((res)=>{
if(res.success){
this.typeList = res.data.list
this.total = res.data.total
}else{
this.$message.error(res.msg)
}
}).catch((error)=>{
this.$message.error("查询失败")
})
return {
fileList: []
};
},
//重置
reset() {
this.typeQurey = {
typeName: null,
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
methods: {
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
}
this.typeQurey.companyId = this.$store.getters.companyId
this.getTypeList()
},
//添加类型
addtype() {
this.$router.push('/typeAdd')
},
//修改类型
updataType(data){
this.$router.push({
path: '/typeUpdata',
query:{
id:data.typeId,
}
})
},
//搜索
qurey(){
this.typeQurey.pageNum = 1
this.getTypeList()
},
//换页
handleCurrentChange(val){
this.typeQurey.pageNum = val
this.getTypeList()
}
},
};
}
</script>
<style>
<style scoped>
.container {
padding: 10px;
}
.conter {
margin-bottom: 10px;
}
.footer {
text-align: right;
}
</style>
\ No newline at end of file
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