Files
JY1.0/src/views/MarketingCenter/SafetyMargin/index.vue
liushuai aef7132f40 更新
2019-09-19 19:52:46 +08:00

934 lines
39 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<!--顶栏结构-->
<el-card>
<span>项目名称</span>
<el-select v-model="entryNameValue" clearable filterable placeholder="项目名称:" size="small" style="margin:3px;">
<el-option
v-for="item in entryName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span style="margin-left: 10px">开始日期</span>
<el-date-picker
v-model="startTime"
style="width: 200px;"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="请选择开始日期"/>
<span style="margin-left: 10px">结束日期</span>
<el-date-picker
v-model="endTime"
style="width: 200px;"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="请选择结束日期"/>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="PageSizeProject = 30;PageCurrentProject = 1;searchTableDataProject()">查询</el-button>
</el-card>
<el-card>
<el-table
v-loading="listLoadingProject"
:data="projectTableData"
style="width: 100%;margin-top: 3px;"
height="650"
border
stripe
size="mini"
highlight-current-row
@row-click="fetchTableData1">
<el-table-column align="center" label="合同编号" width="150">
<template slot-scope="scope">
<el-tag size="mini" type="primary">{{ scope.row.合同编号 }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="项目名称" width="160" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="已完成进度" width="100">
<template slot-scope="scope">
{{ scope.row.执行进度名 }}
</template>
</el-table-column>
<el-table-column align="center" label="合同签订日期" width="130">
<template slot-scope="scope">
{{ scope.row.合同签订日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="销售经理" width="100">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column align="center" label="客户名称" width="250" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.客户名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="联系人" width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.联系人 }}
</template>
</el-table-column>
<el-table-column align="center" label="联系电话" width="150" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.电话 }}
</template>
</el-table-column>
<el-table-column align="center" label="合同信息备注" >
<template slot-scope="scope">
{{ scope.row.合同信息备注 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150px">
<template slot-scope="scope">
<el-button
:disabled="scope.row.是否禁用增加安全保证金"
size="mini"
type="text"
icon="el-icon-circle-plus-outline"
@click.stop="addSafetyMargin(scope.row);flag1 = 1">安全保证金
</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 3px;">
<el-pagination
:current-page="PageCurrentProject"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSizeProject"
:total="totalProject"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChangeProject"
@current-change="handleCurrentChangeProject"/>
</div>
</el-card>
<!--安全保证金表格-->
<el-card>
<el-table
v-loading="tableData1Loading"
:data="tableData1"
style="width: 100%"
highlight-current-row
border
stripe
size="mini"
@row-click="fetchTableData2">
<!--<el-table-column align="center" label="项目名称" width="300">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.项目名称 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="保证金金额" width="100">
<template slot-scope="scope">
<el-tag type="primary" size="mini">{{ scope.row.保证金金额 }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="交付日期" width="120">
<template slot-scope="scope">
{{ scope.row.交付日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="收回条件" width="100">
<template slot-scope="scope">
{{ scope.row.执行进度名 }}
</template>
</el-table-column>
<el-table-column align="center" label="截止时间(天)" width="120">
<template slot-scope="scope">
{{ scope.row.提前x天提醒 }}天内收回
</template>
</el-table-column>
<el-table-column align="center" label="扣款金额" width="100">
<template slot-scope="scope">
{{ scope.row.扣款金额 }}
</template>
</el-table-column>
<el-table-column :label="AmountReceivable" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.应收回金额 }}
</template>
</el-table-column>
<el-table-column label="实际收回金额" align="center" width="120">
<template slot-scope="scope">
{{ scope.row.实际收回日期 === '' || scope.row.实际收回日期 === null ? '0' : scope.row.应收回金额 }}
</template>
</el-table-column>
<!--<el-table-column align="center" label="计划收回日期" width="150">-->
<!--<template slot-scope="scope">-->
<!--{{ scope.row.预计收回日期 }}-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="是否收回" width="100">
<template slot-scope="scope">
<el-tag v-if="parseInt(scope.row.是否收回) === 2" slot="reference" size="mini" type="success" style="width: 66px">已收回</el-tag>
<el-tag v-else-if="parseInt(scope.row.是否收回) === 1" slot="reference" type="danger" size="mini" style="width: 66px">未收回</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="实际收回日期" width="130">
<template slot-scope="scope">
{{ scope.row.实际收回日期 === '' || scope.row.实际收回日期 === null ? '未收回' : scope.row.实际收回日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="状态" width="100">
<template slot-scope="scope">
<el-popover
placement="top-start"
title="收回计划"
width="200"
trigger="hover">
<div v-show="(scope.row.预计收回日期 === '' || scope.row.预计收回日期 === null) && parseInt(scope.row.是否收回)!== 2 " style="text-align: center">
<h4>{{ scope.row.执行进度名 }} 未完成</h4>
</div>
<div v-show="scope.row.预计收回日期 !== '' && scope.row.预计收回日期 !== null && parseInt(scope.row.是否收回)!== 2">
<h4>{{ scope.row.执行进度名 }}{{ scope.row.节点日期 }}完成计划于{{ scope.row.预计收回日期 }}进行收款距离计划截止还剩{{ parseInt(scope.row.剩余天数) > 0 ? scope.row.剩余天数 : 0 }}</h4>
</div>
<div v-show="parseInt(scope.row.是否收回)=== 2 " style="text-align: center">
<h4>已于{{ scope.row.实际收回日期 }}收回</h4>
</div>
<el-tag v-if="scope.row.预计收回日期!==''&& scope.row.预计收回日期!==null && parseInt(scope.row.是否收回) === 1 && parseInt(scope.row.状态) === 1" slot="reference" size="mini" type="warning" style="width: 66px">即将拖期</el-tag>
<el-tag v-else-if="scope.row.预计收回日期!==''&& scope.row.预计收回日期!==null &&parseInt(scope.row.是否收回) === 1 && parseInt(scope.row.状态) === 2" slot="reference" type="danger" size="mini" style="width: 66px">已经拖期</el-tag>
<el-tag v-else-if="scope.row.预计收回日期!==''&& scope.row.预计收回日期!==null &&parseInt(scope.row.是否收回) === 1 && parseInt(scope.row.状态) === 0" slot="reference" type="primer" size="mini" style="width: 66px">无计划</el-tag>
<el-tag v-else-if="scope.row.预计收回日期!==''&& scope.row.预计收回日期!==null &&parseInt(scope.row.是否收回) === 2" slot="reference" type="success" size="mini" style="width: 66px">已完成</el-tag>
<el-tag v-else-if="scope.row.预计收回日期===''||scope.row.预计收回日期===null" slot="reference" size="small" style="width: 66px">进度未完</el-tag>
<div v-show="false">{{ scope.row.预计收回日期===''||scope.row.预计收回日期===null || parseInt(scope.row.是否收回) === 2 ? scope.row.是否禁用收回 = true : scope.row.是否禁用收回 = false }}</div>
<div v-show="false">{{ parseInt(scope.row.是否收回) === 2 ? scope.row.是否禁用扣款 = true : scope.row.是否禁用扣款 = false }}</div>
<div v-show="false">{{ parseInt(scope.row.是否收回) === 2 ? scope.row.是否禁用编辑 = true : scope.row.是否禁用编辑 = false }}</div>
<div v-show="false">{{ parseInt(scope.row.是否收回) === 2 ? scope.row.是否禁用删除 = true : scope.row.是否禁用删除 = false }}</div>
</el-popover>
</template>
</el-table-column>
<el-table-column align="center" label="备注">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="收回" placement="top">
<div style="display: inline-block">
<el-button
:disabled="scope.row.是否禁用收回"
size="mini"
type="text"
icon="el-icon-money"
@click.stop="TakeBack(scope.row);flag1 = 5"/>
</div>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="扣款" placement="top">
<div style="display: inline-block">
<el-button
:disabled="scope.row.是否禁用扣款"
size="mini"
type="text"
style="margin-left: 20px"
icon="el-icon-coin"
@click.stop="Withdrawing(scope.row);flag1 = 3"/>
</div>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="编辑" placement="top">
<div style="display: inline-block">
<el-button
:disabled="scope.row.是否禁用编辑"
size="mini"
type="text"
style="margin-left: 20px"
icon="el-icon-edit-outline"
@click.stop="editSafetyMargin(scope.row);flag1 = 2"/>
</div>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="删除" placement="top">
<div style="display: inline-block">
<el-button
:disabled="scope.row.是否禁用删除"
size="mini"
type="text"
style="margin-left: 20px"
icon="el-icon-delete"
@click.stop="delSafetyMargin(scope.row)"/>
</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div v-show="false" class="block" style="margin-top: 10px;">
<el-pagination
:current-page="PageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<!--新增编辑保证金信息对话框-->
<el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible1" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules1" label-position="left" label-width="120px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="保证金金额" prop="保证金金额">
<el-input-number v-model="form.保证金金额" :precision="2" :step="1" style="width: 200px" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="缴纳日期" prop="交付日期">
<el-date-picker
v-model="form.交付日期"
:picker-options="pickerOptions"
style="width: 200px;"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="请选择交付日期"/>
</el-form-item>
</el-col>
</el-row>
<!--<el-col :span="12">-->
<!--<el-form-item label="计划收回日期" prop="预计收回日期">-->
<!--<el-date-picker-->
<!--v-model="form.预计收回日期"-->
<!--style="width: 200px;"-->
<!--value-format="yyyy-MM-dd"-->
<!--size="small"-->
<!--type="date"-->
<!--placeholder="请选择计划收回日期"/>-->
<!--</el-form-item>-->
<!--</el-col>-->
<el-row>
<el-col :span="12">
<el-form-item label="收回条件" prop="收回条件">
<el-select v-model="form.收回条件" filterable placeholder="请选择收回条件" style="width: 200px" size="small">
<el-option
v-for="item in plannedTime"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="截止时间(天)" prop="提前X天提醒我">
<el-input-number v-model="form.提前X天提醒我" placeholder="请输入截止时间" style="width: 200px" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="备注" prop="备注">
<el-input v-model="form.备注" type="textarea" autosize size="small" placeholder="请输入备注" style="width:575px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit1('form')"> </el-button>
</div>
</el-dialog>
<!--扣款记录增加-->
<el-dialog v-el-drag-dialog :title="title2" :visible.sync="dialogFormVisible2" center style="min-height: 300px" width="800px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="120px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="项目名称" prop="项目名称">
<el-input v-model="projectName" size="small" placeholder="请输入项目名称" style="width:200px" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="被扣款人" prop="被扣款人">
<el-input v-model="form2.被扣款人" size="small" placeholder="请输入被扣款人" style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="剩余金额" prop="剩余金额">
<el-input v-model="SurplusAmount" size="small" placeholder="请输入剩余金额" style="width:200px" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="扣款金额" prop="扣款金额">
<el-input-number v-model="form2.扣款金额" :min="0" :max="maxMoney" :precision="2" :step="1" size="small" style="width: 200px" placeholder="请输入本次付款金额"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="扣款日期" prop="扣款日期">
<el-date-picker
v-model="form2.扣款日期"
:picker-options="pickerOptions1"
style="width: 200px;"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="扣款日期"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="扣款原因" prop="扣款原因">
<el-input v-model="form2.扣款原因" size="small" placeholder="扣款原因" style="width: 200px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form2')">取消</el-button>
<el-button type="primary" @click="submit1('form2')"> </el-button>
</div>
</el-dialog>
<!--扣款记录编辑-->
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible3" title="编辑" center style="min-height: 300px" width="800px">
<el-form ref="form3" :model="form3" :rules="rules3" label-position="left" label-width="120px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="项目名称" prop="项目名称">
<el-input v-model="projectName" size="small" placeholder="请输入项目名称" style="width:200px" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="被扣款人" prop="被扣款人">
<el-input v-model="form3.被扣款人" size="small" placeholder="请输入被扣款人" style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="扣款日期" prop="扣款日期">
<el-date-picker
v-model="form3.扣款日期"
:picker-options="pickerOptions1"
style="width: 200px;"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="扣款日期"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="扣款金额" prop="扣款金额">
<el-input-number v-model="form3.扣款金额" :min="0" :max="maxMoney1" :precision="2" :step="1" size="small" style="width: 200px" placeholder="请输入本次付款金额"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="23">
<el-form-item label="扣款原因" prop="扣款原因">
<el-input v-model="form3.扣款原因" size="small" placeholder="扣款原因" style="width: 580px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form3')">取消</el-button>
<el-button type="primary" @click="submit1('form3')"> </el-button>
</div>
</el-dialog>
<!--收回安全保证金-->
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible4" title="收回" center style="min-height: 300px" width="40%">
<el-form ref="form4" :model="form4" :rules="rules4" label-position="left" label-width="120px" class="demo-ruleForm">
<el-form-item label="项目名称" prop="项目名称">
<el-input v-model="projectName" size="small" placeholder="请输入项目名称" style="width:200px" disabled/>
</el-form-item>
<el-form-item label="剩余金额" prop="剩余金额">
<el-input v-model="form4.剩余金额" size="small" placeholder="请输入项目名称" style="width:200px" disabled/>
</el-form-item>
<el-form-item label="收回日期" prop="收回日期">
<el-date-picker
v-model="form4.收回日期"
:picker-options="pickerOptions2"
style="width: 200px;"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="收回日期"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form4')">取消</el-button>
<el-button type="primary" @click="submit1('form4')"> </el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible5" title="扣款" center style="min-height: 300px" width="800px">
<!--扣款记录表格-->
<el-card>
<el-table
v-loading="tableData2Loading"
:data="tableData2"
style="width: 100%;"
height="230"
highlight-current-row
border
stripe
size="mini">
<el-table-column align="center" label="扣款金额">
<template slot-scope="scope">
{{ scope.row.扣款金额 }}
</template>
</el-table-column>
<el-table-column align="center" label="被扣款人">
<template slot-scope="scope">
{{ scope.row.被扣款人 }}
</template>
</el-table-column>
<el-table-column align="center" label="扣款原因">
<template slot-scope="scope">
{{ scope.row.扣款原因 }}
</template>
</el-table-column>
<el-table-column align="center" label="扣款日期">
<template slot-scope="scope">
{{ scope.row.扣款日期 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-button
:disabled="disabled"
size="mini"
type="text"
icon="el-icon-edit-outline"
@click.stop="editWithdrawing(scope.row);flag1 = 4">编辑</el-button>
<el-button
:disabled="disabled"
size="mini"
type="text"
icon="el-icon-delete"
@click.stop="delWithdrawing(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 3px;">
<el-pagination
:current-page="PageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
</el-dialog>
</div>
</template>
<script>
import elInput from 'element-ui/packages/input'
import { initProject, searchTable1, searchTable2, addSafetyMargin, editSafetyMargin, delSafetyMargin, Withdrawing, delWithdrawing, edtWithdrawing, TakeBack, searchTableDataProject, executionProgressID } from '@/api/MarketingCenter/SafetyMargin'
export default {
components: {
elInput
},
data() {
const validateValue = (rule, value, callback) => {
if (value === 0) {
callback(new Error('金额不能为0'))
} else {
callback()
}
}
return {
pickerOptions: {},
pickerOptions1: {},
pickerOptions2: {},
timetime: '',
timetime1: '',
timetime2: '',
listLoadingProject: false, // 项目信息加载动画
projectTableData: [], // 项目信息表格
startTime: '', // 开始时间
endTime: '', // 结束时间
PageCurrentProject: 1, // 项目信息表格翻页
PageSizeProject: 30, // 项目信息表格每页显示条数
totalProject: null, // 总条数
plannedTime: [], // 执行情况
entryNameValue_check: '',
startTime_check: '',
endTime_check: '',
disabled: false,
AmountReceivable: '应收回金额',
WithdrawingCode: '',
SurplusAmount: '',
maxMoney: null,
maxMoney1: null,
code: '', // 安全保证金流水号
projectCode: '',
projectName: '',
flag1: null,
entryName: [], // 项目名称
entryNameValue: '', // 项目名称数组
tableData1: [], // 安全保证金信息表数组
tableData2: [], // 安全保证金信息表数组
tableData1Loading: false, // 安全保证金信息表加载动画
tableData2Loading: false, // 安全保证金信息表加载动画
PageCurrent: 1,
PageSize: 30,
total: null,
PageCurrent2: 1,
PageSize2: 30,
total2: null,
radio: '1',
title: '',
title2: '',
entryName1: [],
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
dialogFormVisible5: false,
form: {
备注: '',
项目名称: '',
保证金金额: '',
交付日期: '',
预计收回日期: '',
提前X天提醒我: 15,
收回条件: 1
},
form2: {
扣款金额: '',
被扣款人: '',
扣款日期: '',
扣款原因: ''
},
form3: {
扣款金额: '',
被扣款人: '',
扣款日期: '',
扣款原因: ''
},
form4: {
收回日期: '',
剩余金额: ''
},
rules1: { // 表单验证规则
项目名称: [{ required: true, message: '请选择项目', trigger: 'change' }],
保证金金额: [{ required: true, message: '请输入保证金金额', trigger: 'blur' },
{ required: true, trigger: 'blur', validator: validateValue }],
交付日期: [{ required: true, message: '请选择交付日期', trigger: 'change' }],
预计收回日期: [{ required: true, message: '请选择预计收回日期', trigger: 'change' }],
收回条件: [{ required: true, message: '请选择收回条件', trigger: 'change' }],
提前X天提醒我: [{ required: true, message: '提前X天提醒我', trigger: 'blur' }]
},
rules2: { // 表单验证规则
扣款金额: [
{ required: true, message: '请输入本次付款金额', trigger: 'blur' },
{ required: true, trigger: 'blur', validator: validateValue }],
被扣款人: [{ required: true, message: '请输入被扣款人', trigger: 'blur' }],
扣款日期: [{ required: true, message: '请选择扣款日期', trigger: 'change' }]
},
rules3: { // 表单验证规则
扣款金额: [
{ required: true, message: '请输入本次付款金额', trigger: 'blur' },
{ required: true, trigger: 'blur', validator: validateValue }],
被扣款人: [{ required: true, message: '请输入被扣款人', trigger: 'blur' }],
扣款日期: [{ required: true, message: '请选择扣款日期', trigger: 'change' }]
},
rules4: { // 表单验证规则
收回日期: [{ required: true, message: '请选择收回日期', trigger: 'change' }]
}
}
},
created() {
this.init()
this.searchTableDataProject()
},
methods: {
changeTime() {
this.pickerOptions = Object.assign({}, this.pickerOptions, {
disabledDate: (time) => {
console.log(this.timetime)
return time.getTime() < Date.parse(this.timetime)
}
})
},
changeTime1() {
this.pickerOptions1 = Object.assign({}, this.pickerOptions1, {
disabledDate: (time) => {
console.log(this.timetime1)
return time.getTime() < Date.parse(this.timetime1)
}
})
},
changeTime2() {
this.pickerOptions2 = Object.assign({}, this.pickerOptions2, {
disabledDate: (time) => {
console.log(this.timetime2)
return time.getTime() < Date.parse(this.timetime2)
}
})
},
init() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'entryName')
this.getSelect(initProject, ['项目名称', '项目流水号'], 'entryName1')
this.getSelect(executionProgressID, ['执行进度名', '执行进度ID'], 'plannedTime')
},
// 查询合同(项目)信息
searchTableDataProject() {
if (this.entryNameValue === '' || this.entryNameValue === null) {
this.entryNameValue_check = 0
} else {
this.entryNameValue_check = 1
}
if (this.startTime === '' || this.startTime === null) {
this.startTime_check = 0
} else {
this.startTime_check = 1
}
if (this.endTime === '' || this.endTime === null) {
this.endTime_check = 0
} else {
this.endTime_check = 1
}
this.listLoadingProject = true
searchTableDataProject(this.PageCurrentProject, this.PageSizeProject, this.entryNameValue, this.entryNameValue_check, this.startTime_check, this.endTime_check, this.startTime, this.endTime).then(response => {
this.tableData1 = []
this.tableData2 = []
this.listLoadingProject = false
const data = response.data
for (let i = 0; i < data.rows.length; i++) {
data.rows[i].合同签订日期 = data.rows[i].合同签订日期.substring(0, data.rows[i].合同签订日期.length - 8)
parseInt(data.rows[i].安全保证金类型) === 1 ? data.rows[i].是否禁用增加安全保证金 = true : data.rows[i].是否禁用增加安全保证金 = false
}
this.projectTableData = data.rows
this.totalProject = data.total
})
},
// 项目信息表格改变每页显示条数
handleSizeChangeProject(val) {
this.PageCurrentProject = 1
this.PageSizeProject = val
this.searchTableDataProject()
},
// 项目信息表格翻页
handleCurrentChangeProject(val) {
this.PageCurrentProject = val
this.searchTableDataProject()
},
fetchTableData1(row) {
this.projectCode = row.项目流水号
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.tableData1 = []
this.tableData2 = []
},
fetchTableData2(row) {
this.code = row.安全保证金流水号
this.SurplusAmount = row.应收回金额
this.projectName = row.项目名称
this.getTable(searchTable2, [this.PageCurrent2, this.PageSize2, this.code], ['tableData2', 'total2', 'tableData2Loading'])
this.dialogFormVisible5 = true
},
handleSizeChange(val) {
this.PageCurrent = 1
this.PageSize = val
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.tableData1 = []
this.tableData2 = []
},
handleCurrentChange(val) {
this.PageCurrent = val
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.tableData1 = []
this.tableData2 = []
},
handleSizeChange2(val) {
this.PageCurrent2 = 1
this.PageSize2 = val
this.fetchTableData2()
},
handleCurrentChange2(val) {
this.PageCurrent2 = val
this.fetchTableData2()
},
addSafetyMargin(row) {
this.title = '新增安全保证金'
this.timetime = row.合同签订日期
this.changeTime()
this.dialogFormVisible1 = true
this.projectCode = row.项目流水号
this.addForm('form')
},
editSafetyMargin(row) {
this.editForm(row, 'form')
this.title = '编辑安全保证金'
this.dialogFormVisible1 = true
this.form.保证金金额 = row.保证金金额
this.form.交付日期 = row.交付日期
this.form.收回条件 = parseInt(row.执行进度流水号)
this.form.提前X天提醒我 = row.提前x天提醒
this.form.备注 = row.备注
this.code = row.安全保证金流水号
this.projectCode = row.项目流水号
},
addTableData1() {
addSafetyMargin(this.projectCode, this.form.保证金金额, this.form.交付日期, this.form.提前X天提醒我, this.form.收回条件, this.form.备注).then(response => {
this.dialogFormVisible1 = false
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.title = ''
this.searchTableDataProject()
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.tableData2 = []
} else {
this.$message.error('添加失败')
}
})
},
editTableData1() {
editSafetyMargin(this.projectCode, this.form.保证金金额, this.form.交付日期, this.form.提前X天提醒我, this.form.收回条件, this.form.备注, this.code).then(response => {
this.dialogFormVisible1 = false
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
this.searchTableDataProject()
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.tableData2 = []
} else {
this.$message.error('信息更新失败')
}
})
},
// 提交保证金信息添加或者修改
submit1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.flag1 === 1) {
this.addTableData1()
this.flag1 = null
} else if (this.flag1 === 2) {
this.editTableData1()
this.flag1 = null
} else if (this.flag1 === 3) {
this.addTableData2()
this.flag1 = null
} else if (this.flag1 === 4) {
this.edtTableData2()
this.flag1 = null
} else if (this.flag1 === 5) {
this.submitTakeBack()
this.flag1 = null
}
}
})
},
callOff() {
this.dialogFormVisible1 = false
this.dialogFormVisible2 = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
},
delSafetyMargin(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delSafetyMargin(row.安全保证金流水号, this.projectCode).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTableDataProject()
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.tableData2 = []
} else {
this.$message.error('数据占用')
}
})
})
},
delWithdrawing(row) {
function a() {
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.getTable(searchTable2, [this.PageCurrent2, this.PageSize2, this.code], ['tableData2', 'total2', 'tableData2Loading'])
this.dialogFormVisible2 = false
}
this.deleteRow(delWithdrawing, row.扣款流水号, a)
},
Withdrawing(row) {
this.title2 = '扣款'
this.timetime1 = row.交付日期
console.log(row)
this.changeTime1()
this.dialogFormVisible2 = true
this.code = row.安全保证金流水号
this.projectName = row.项目名称
this.maxMoney = parseFloat(row.应收回金额)
this.SurplusAmount = row.应收回金额
this.addForm('form2')
},
addTableData2() {
Withdrawing(this.code, this.form2.扣款金额, this.form2.被扣款人, this.form2.扣款原因, this.form2.扣款日期).then(response => {
this.dialogFormVisible2 = false
if (response.data[0].result === '1') {
this.$message.success('扣款成功')
this.title = ''
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.getTable(searchTable2, [this.PageCurrent2, this.PageSize2, this.code], ['tableData2', 'total2', 'tableData2Loading'])
} else {
this.$message.error('扣款失败')
}
})
},
editWithdrawing(row) {
this.editForm(row, 'form3')
this.dialogFormVisible3 = true
this.maxMoney1 = parseFloat(this.SurplusAmount) + parseFloat(row.扣款金额)
this.form3.扣款金额 = row.扣款金额
this.form3.被扣款人 = row.被扣款人
this.form3.扣款原因 = row.扣款原因
this.form3.扣款日期 = row.扣款日期
this.WithdrawingCode = row.扣款流水号
},
edtTableData2() {
edtWithdrawing(this.WithdrawingCode, this.form3.扣款金额, this.form3.被扣款人, this.form3.扣款原因, this.form3.扣款日期).then(response => {
this.dialogFormVisible3 = false
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
this.getTable(searchTable2, [this.PageCurrent2, this.PageSize2, this.code], ['tableData2', 'total2', 'tableData2Loading'])
} else {
this.$message.error('信息更新失败')
}
})
},
TakeBack(row) {
this.code = row.安全保证金流水号
this.projectName = row.项目名称
this.timetime2 = row.交付日期
this.changeTime2()
this.form4.剩余金额 = parseFloat(row.应收回金额)
this.dialogFormVisible4 = true
},
submitTakeBack() {
TakeBack(this.code, this.form4.收回日期).then(response => {
this.dialogFormVisible4 = false
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.projectCode], ['tableData1', 'total', 'tableData1Loading'])
} else {
this.$message.error('信息更新失败')
}
})
}
}
}
</script>
<style scoped>
.el-date-picker{
width:50px
}
</style>