You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2921 lines
86 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div ref="contractList" style="padding: 0 20px">
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="合同列表"
>
<div slot="content"></div>
<slot>
<div class="selects">
<div>
<span style="padding: 0 6px; word-break: keep-all">关键字</span>
<span>
<Input
v-model="select.keyword"
clearable
placeholder="关键字搜索"
style="width: 200px"
/>
</span>
</div>
<div v-if="/contractAll/g.test($route.path)">
<span style="padding: 0 6px; word-break: keep-all">是否为直接支付</span>
<i-switch v-model="select.is_simple" :true-value="1" :false-value="0" @on-change="getContracts">
<span slot="open">是</span>
</i-switch>
</div>
<xy-selectors style="margin-left: 10px;" @search="getContracts" @reset="reset">
<div class="select-content">
<div>
<span style="padding: 0 6px; word-break: keep-all"
>服务商/供应商</span
>
<span>
<Input
v-model="select.supply"
clearable
placeholder="请输入服务商/供应商"
style="width: 200px"
/>
</span>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">预算计划</span>
<span>
<Input
v-model="select.plan_name"
clearable
placeholder="请选择预算计划"
@on-focus="showPlanForSearch"
style="width: 200px"
@on-clear="clearSelectForSearch"
/>
</span>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">签订年份</span>
<span>
<DatePicker
:value="select.year"
placeholder="选择年份"
placement="bottom"
style="width: 90px"
type="year"
@on-change="(e) => (select.year = e)"
></DatePicker>
</span>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">创建日期</span>
<span>
<DatePicker
v-model="select.showDatePicker"
clearable
placeholder="请选择日期"
placement="bottom-start"
style="width: 200px"
type="daterange"
@on-change="datePick"
></DatePicker>
</span>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">是否为直接支付</span>
<i-switch v-model="select.is_simple" :true-value="1" :false-value="0" />
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all"> 项目类型 </span>
<Select
v-model="select.type"
clearable
placeholder="请选择项目类型"
style="width: 140px"
>
<Option
v-for="item in type"
:key="item.value"
:value="item.value"
>{{ item.label }}</Option
>
</Select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all"> 业务科室 </span>
<el-select
v-model="select.department_id"
clearable
placeholder="业务科室选择"
size="small"
style="width: 120px"
>
<el-option
v-for="item in departments"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all"> 采购形式 </span>
<Select
v-model="select.purchase_type_id"
clearable
placeholder="请选择采购形式"
style="width: 140px"
>
<Option
v-for="item in purchaseType"
:key="item.id"
:value="item.id"
>{{ item.value }}</Option
>
</Select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all"> 采购方式 </span>
<Select
v-model="select.purchase_way_id"
clearable
placeholder="请选择采购方式"
style="width: 200px"
>
<Option
v-for="item in purchaseWay"
:key="item.id"
:value="item.id"
>{{ item.value }}</Option
>
</Select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all"> 预算金额 </span>
<el-input-number
size="small"
:controls="false"
v-model="select.start_plan_price"
:min="0"
placeholder="最小金额"
style="width: 100px"
/>
<span style="padding: 0 5px">-</span>
<el-input-number
size="small"
:controls="false"
v-model="select.end_plan_price"
:min="0"
placeholder="最大金额"
style="width: 100px"
/>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all"> 合同状态 </span>
<Select
v-model="select.status"
clearable
placeholder="请选择"
style="width: 100px"
>
<Option
v-for="item in [
{ label: '待签订', value: 1 },
{ label: '已签订', value: 2 },
]"
:key="item.value"
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">
招标流程状态
</span>
<Select
v-model="select.invite_status"
clearable
placeholder="请选择"
style="width: 100px"
>
<Option
v-for="item in options"
:key="item.value"
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">
采购流程状态
</span>
<Select
v-model="select.purchase_status"
clearable
placeholder="请选择"
style="width: 100px"
>
<Option
v-for="item in options"
:key="item.value"
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</div>
<div>
<span style="padding: 0 6px; word-break: keep-all">
合同审批状态
</span>
<Select
v-model="select.join_status"
clearable
placeholder="请选择"
style="width: 100px"
>
<Option
v-for="item in options"
:key="item.value"
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</div>
</div>
</xy-selectors>
<Button
style="margin-left: 10px"
type="primary"
@click="(new RegExp(/contractLedger/g).test($route.path) || select.is_myself) ? ($refs['addContractLedger'].setType('add'),$refs['addContractLedger'].show()) : $router.push('/contract/contractEdit')"
>新增</Button
>
<Button style="margin-left: 10px" type="primary" @click="getContracts"
>查询</Button
>
<Button type="primary" @click="toExport()" style="margin-left: 10px"
>导出</Button
>
<!-- <Button type="primary" style="margin-left: 10px">导出</Button>-->
</div>
</slot>
</lx-header>
<xy-table
ref="xyTable"
:list="list"
:show-summary="true"
:summary-method="summary"
:table-item="/contractLedger/g.test($route.path) ? ledgerTable : table"
@cellClick="showPaymentPlan"
@delete="(row) => deleteContract(row.id)"
@editor=""
>
<template v-slot:btns>
<el-table-column
fixed="right"
header-align="center"
label="操作"
width="200"
>
<template slot-scope="scope">
<div class="slot-btns">
<template v-if="scope.row.FLOWSTATUS['zhifu'].isEnabled()">
<template v-if="scope.row.is_assurance === 1">
<!-- 如果是 履约文件-->
<template v-if="scope.row.assurance_status === 1">
<!-- 那么必须财务审核通过-->
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
$refs['paymentRegistration'].getContract(scope.row),
($refs[
'paymentRegistration'
].isShowPaymentRegistration = true)
"
>
付款登记
</Button>
</template>
</template>
<template v-else>
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
$refs['paymentRegistration'].getContract(scope.row),
($refs[
'paymentRegistration'
].isShowPaymentRegistration = true)
"
>付款登记
</Button>
</template>
</template>
<template v-if="scope.row.FLOWSTATUS['qianding'].isEnabled()">
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
($refs['contractSign'].isShow = true),
($refs['contractSign'].contractId = scope.row.id)
"
>
签订合同
</Button>
</template>
<template v-if="scope.row.FLOWSTATUS['zhaobiao'].isEnabled()">
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
$refs['biddingUpload'].setId(scope.row.id),
$refs['biddingUpload'].show()
"
>招标审查</Button
>
</template>
<template v-if="scope.row.FLOWSTATUS['shenpi'].isEnabled()">
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="signProcess(scope.row)"
>合同审批
</Button>
</template>
<template v-if="scope.row.FLOWSTATUS['caigou'].isEnabled()">
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="buyProcess(scope.row)"
>采购流程
</Button>
</template>
<!-- <template v-if="((scope.row.status === 2) ||-->
<!-- (!scope.row.is_contract && (scope.row.is_simple)) ||-->
<!-- ((scope.row.purchase_way && scope.row.purchase_way.value === '网上商城')-->
<!-- && scope.row.purchase_status === 3) ) && scope.row.is_end === 0">-->
<!-- <template v-if="scope.row.is_assurance == 1">-->
<!-- &lt;!&ndash; 如果是 履约文件&ndash;&gt;-->
<!-- <template v-if="scope.row.assurance_status == 1">-->
<!-- &lt;!&ndash; 那么必须财务审核通过&ndash;&gt;-->
<!-- <Button-->
<!-- class="slot-btns-item"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="-->
<!-- $refs['paymentRegistration'].getContract(scope.row),-->
<!-- ($refs[-->
<!-- 'paymentRegistration'-->
<!-- ].isShowPaymentRegistration = true)-->
<!-- "-->
<!-- >-->
<!-- &lt;!&ndash; paying(scope.row) @click="$refs['paymentRegistration'].getContract(scope.row),$refs['paymentRegistration'].isShowPaymentRegistration = true"&ndash;&gt;-->
<!-- 付款登记-->
<!-- </Button>-->
<!-- </template>-->
<!-- </template>-->
<!-- <template v-else>-->
<!-- <Button-->
<!-- class="slot-btns-item"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="-->
<!-- $refs['paymentRegistration'].getContract(scope.row),-->
<!-- ($refs[-->
<!-- 'paymentRegistration'-->
<!-- ].isShowPaymentRegistration = true)-->
<!-- "-->
<!-- >-->
<!-- &lt;!&ndash; @click="$refs['paymentRegistration'].getContract(scope.row),$refs['paymentRegistration'].isShowPaymentRegistration = true"&ndash;&gt;-->
<!-- 付款登记-->
<!-- </Button>-->
<!-- </template>-->
<!-- </template>-->
<!-- <template-->
<!-- v-if="-->
<!-- (scope.row.status === 1 && scope.row.join_status === 3 && !/contractLedger/g.test($route.path)) &&-->
<!-- (scope.row.is_contract && scope.row.purchase_way && scope.row.purchase_way.value !== '网上商城')"-->
<!-- >-->
<!-- <Button-->
<!-- class="slot-btns-item"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="-->
<!-- ($refs['contractSign'].isShow = true),-->
<!-- ($refs['contractSign'].contractId = scope.row.id)-->
<!-- "-->
<!-- >-->
<!-- 签订合同-->
<!-- </Button>-->
<!-- </template>-->
<!-- &lt;!&ndash; 采购完成 &ndash;&gt;-->
<!-- <template-->
<!-- v-if="-->
<!-- (scope.row.invite_status === 1 &&-->
<!-- scope.row.purchase_status === 3 &&-->
<!-- (scope.row.purchase_way-->
<!-- ? scope.row.purchase_way.remark === 'true'-->
<!-- : false) &&-->
<!-- !scope.row.is_substitute) &&-->
<!-- (scope.row.is_contract && scope.row.purchase_way-->
<!-- && scope.row.purchase_way.value !== '网上商城')-->
<!-- "-->
<!-- >-->
<!-- <Button-->
<!-- class="slot-btns-item"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="-->
<!-- $refs['biddingUpload'].setId(scope.row.id),-->
<!-- $refs['biddingUpload'].show()-->
<!-- "-->
<!-- >招标审查</Button-->
<!-- >-->
<!-- </template>-->
<!-- &lt;!&ndash;不需要走采购流程那么直接就是会签,如果采购方式不需要招标的也是直接会签&ndash;&gt;-->
<!-- <template-->
<!-- v-if="-->
<!-- scope.row.is_contract &&-->
<!-- ((scope.row.join_status === 1 &&-->
<!-- (scope.row.invite_status === 3 ||-->
<!-- ((scope.row.purchase_way-->
<!-- ? scope.row.purchase_way.remark === 'false'-->
<!-- : false) &&-->
<!-- scope.row.purchase_status === 3))) ||-->
<!-- (scope.row.is_substitute && scope.row.join_status === 1))-->
<!-- && (scope.row.purchase_way && scope.row.purchase_way.value !== '网上商城')-->
<!-- "-->
<!-- >-->
<!-- <Button-->
<!-- class="slot-btns-item"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="signProcess(scope.row)"-->
<!-- >合同审批-->
<!-- </Button>-->
<!-- </template>-->
<!-- <template-->
<!-- v-if="-->
<!-- scope.row.is_simple !== 1 &&-->
<!-- scope.row.purchase_status === 1 &&-->
<!-- ((scope.row.req_status === 3 && scope.row.is_plan === 0) ||-->
<!-- scope.row.is_plan === 1) &&-->
<!-- !scope.row.is_substitute-->
<!-- "-->
<!-- >-->
<!-- <Button-->
<!-- class="slot-btns-item"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- @click="buyProcess(scope.row)"-->
<!-- >采购流程-->
<!-- </Button>-->
<!-- </template>-->
<Poptip trigger="hover" placement="bottom" transfer>
<Button ghost size="small" type="primary">更多</Button>
<div slot="content">
<template
v-if="
!(
scope.row.req_status != 1 ||
scope.row.join_status != 1 ||
scope.row.invite_status != 1 ||
scope.row.purchase_status != 1 ||
scope.row.status === 2
)
"
>
<Poptip
:transfer="true"
confirm
placement="bottom"
title="确认要删除吗"
@on-ok="() => deleteContract(scope.row.id)"
>
<i-button
class="slot-btns-item"
ghost
size="small"
type="error"
>删除
</i-button>
</Poptip>
</template>
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
$refs['oaFiles'].setId(scope.row.id),
($refs['oaFiles'].show())
"
>
流程附件
</Button>
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
$refs['detailContract'].getDetail(scope.row.id),
($refs['detailContract'].isShowDetail = true)
"
>
查看
</Button>
<template v-if="scope.row.status != 2 || hasEdit">
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
(new RegExp(/contractLedger/g).test($route.path)) ?
($refs['addContractLedger'].setId(scope.row.id),$refs['addContractLedger'].setType('editor'),$refs['addContractLedger'].show()) :
($refs['editor'].isShowEditor = true,
$refs['editor'].getDetail(scope.row.id))
"
>编辑
</Button>
</template>
<template v-if="hasEdit && scope.row.status === 2">
<Button
class="slot-btns-item"
size="small"
type="primary"
@click="
($refs['contractSign'].contractId = scope.row.id),
($refs['contractSign'].isShow = true)
"
>
签订修改
</Button>
</template>
</div>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<div style="display: flex; justify-content: flex-end">
<Page
:total="total"
show-elevator
@on-change="pageChange"
show-sizer
@on-page-size-change="pageSizeChange"
/>
</div>
<!-- 新增合同 -->
<xy-dialog
ref="addContract"
:form="form"
:is-show.sync="isShowAdd"
:rules="rules"
title="新增采购事项"
type="form"
@submit="submit"
>
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>项目名称
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.name"
@change="checkName"
placeholder="请填写项目名称"
style="width: 300px"
/>
</div>
</div>
</template>
<template v-slot:is_contract>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>是否需要签订合同
</div>
<div class="xy-table-item-content">
<div style="display: flex; width: 300px; align-items: center">
<el-switch
v-model="form.is_contract"
active-text="是"
inactive-text="否"
:active-value="1"
:inactive-value="0"
/>
</div>
</div>
</div>
</template>
<template v-slot:is_simple>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*是否为简易流程</span
>
</div>
<div class="xy-table-item-content">
<div style="display: flex; width: 300px; align-items: center">
<el-switch
v-model="form.is_simple"
active-text="是"
inactive-text="否"
:active-value="1"
:inactive-value="0"
/>
<div style="flex: 1; text-align: right">
(水电煤等费用付款)
</div>
</div>
</div>
</div>
</template>
<template v-slot:supply v-if="form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span
style="
color: red;
font-weight: 600;
padding-right: 4px;
font-size: 11px;
"
>*</span
>承包商/供货商
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.supply"
placeholder="请填写承包商/供货商"
style="width: 300px"
/>
</div>
</div>
</template>
<template v-slot:money v-if="form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span
style="
color: red;
font-weight: 600;
padding-right: 4px;
font-size: 11px;
"
>*</span
>合同金额
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.money"
placeholder="请填写合同金额"
style="width: 300px"
/>
</div>
</div>
</template>
<template v-slot:type v-if="!form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>项目类型
</div>
<div class="xy-table-item-content">
<el-select
v-model="form.type"
placeholder="请选择项目类型"
style="width: 300px"
>
<el-option
v-for="item in type"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:methods v-if="!form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>采购形式
</div>
<div class="xy-table-item-content">
<el-select
ref="methodInput"
v-model="form.methods"
placeholder="请选择采购形式"
style="width: 300px"
@change="showIsFramework"
>
<el-option
v-for="item in purchaseType"
:label="item.value"
:value="item.id"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:modality v-if="!form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>采购类型
</div>
<div class="xy-table-item-content">
<el-select
v-model="form.modality"
placeholder="请选择采购类型"
style="width: 300px"
>
<el-option
v-for="item in purchaseWayFormat()"
:label="item.value"
:value="item.id"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:price v-if="!form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>采购预算价
</div>
<div class="xy-table-item-content xy-table-item-price">
<el-input
v-model="form.price"
placeholder="请填写采购预算价"
style="width: 300px"
/>
</div>
</div>
</template>
<template v-slot:fundingChannels>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>资金渠道
</div>
<div class="xy-table-item-content">
<el-select
v-model="form.fundingChannels"
multiple
placeholder="请选择资金渠道"
style="width: 300px"
>
<el-option
v-for="item in moneyWay"
:label="item.value"
:value="item.id"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:is_substitute v-if="!form.is_simple">
<div class="xy-table-item">
<div class="xy-table-item-label" style="width: 200px">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>是否为代建项目
</div>
<div class="xy-table-item-content">
<el-switch
v-model="form.is_substitute"
active-text="是"
inactive-text="否"
:active-value="1"
:inactive-value="0"
/>
</div>
</div>
</template>
<template v-slot:is_framework v-if="isShowIsFramework">
<div class="xy-table-item">
<div class="xy-table-item-label" style="width: 200px">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>是否新生成框架协议
</div>
<div class="xy-table-item-content">
<el-switch
v-model="form.is_framework"
active-text="是"
inactive-text="否"
:active-value="1"
:inactive-value="0"
/>
</div>
</div>
</template>
<template v-slot:use_framework_buy>
<div class="xy-table-item">
<div class="xy-table-item-label" style="width: 200px">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>是否使用框架协议采购内容
</div>
<div class="xy-table-item-content">
<el-switch
v-model="form.use_framework_buy"
active-text="是"
inactive-text="否"
:active-value="1"
:inactive-value="0"
@change="showIsFramework"
/>
</div>
</div>
</template>
<template v-slot:contract_to_contracts v-if="form.use_framework_buy">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>关联的框架协议合同
</div>
<div class="xy-table-item-content">
<div
class="contract-add-plan"
style="width: 300px"
@click="isShowContractToContracts = true"
>
<template v-if="selections.length > 0">
<template v-for="item in selections">
<Tag
closable
color="primary"
@on-close="delSelections(item)"
>{{ item.name }}</Tag
>
</template>
</template>
<template v-else>
<div class="contract-add-plan-no-plan">
请选择关联的框架协议合同
</div>
</template>
</div>
</div>
</div>
</template>
<template v-slot:plan>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>关联预算计划
</div>
<div class="xy-table-item-content">
<div
class="contract-add-plan"
style="width: 300px"
@click="showPlan"
>
<template v-if="form.plan.length > 0">
<template v-for="item in form.plan">
<Tag closable color="primary" @on-close="delPlan(item)">{{
item.label
}}</Tag>
</template>
</template>
<template v-else>
<div class="contract-add-plan-no-plan">请选择关联计划</div>
</template>
</div>
</div>
</div>
</template>
</xy-dialog>
<!-- 搜索使用 预算计划 -->
<xy-dialog
:is-show.sync="isShowPlanForSearch"
title="预算计划"
:width="720"
@on-ok="planSelectForSearch"
>
<template>
<Input
v-model="planSearch.name"
search
enter-button="搜 索"
placeholder="搜索预算计划.."
@on-search="searchBudgets"
/>
<div
style="
margin: 10px 0;
display: flex;
justify-content: space-between;
align-items: center;
"
>
<div>
已选择:<span style="margin-right: 10px">{{
select.plan_name
}}</span>
</div>
<el-link type="success" @click="clearSelectForSearch"
>清空选择</el-link
>
</div>
<xy-table
:list="plans"
@rowClick="selectPlanForSearch"
:show-index="false"
:table-item="planTableSearch"
:height="310"
style="margin-top: 10px"
:tree-props="{ children: 'notChildren', hasChildren: 'hasChildren' }"
ref="singlePlanTable"
>
<template v-slot:btns> </template>
</xy-table>
<div style="display: flex; justify-content: flex-end">
<Page :total="planTotal" show-elevator @on-change="planPageChange" />
</div>
<el-tag type="warning">点击行进行选择</el-tag>
</template>
<template v-slot:footerContent>
<Button type="primary" @click="confirmPlanForSearch">确定</Button>
</template>
</xy-dialog>
<!-- 新增表 预算计划 -->
<xy-dialog
:is-show.sync="isShowPlan"
:width="840"
title="预算计划"
@on-ok="planSelect"
>
<template>
<div style="display: flex;width: 100%;">
<el-date-picker
v-model="planSearch.year"
type="year"
placeholder="年份"
value-format="yyyy"
style="width: 90px"
size="small"></el-date-picker>
<el-select
placeholder="科室选择"
clearable
size="small"
v-model="planSearch.plan_department_id"
style="width: 160px"
>
<el-option
v-for="item in departments"
:label="item.name"
:value="item.id"
:key="item.id"
>
</el-option>
</el-select>
<Input
style="flex: 1;"
v-model="planSearch.name"
enter-button="搜 索"
placeholder="搜索预算计划.."
search
@on-search="searchBudgets"
/>
</div>
<xy-table
ref="planTable"
:height="300"
:list="plans"
:show-index="false"
:table-item="planTable"
style="margin-top: 10px"
row-key="id"
border
default-expand-all
:tree-props="{ children: 'notChildren', hasChildren: 'hasChildren' }"
@select="selectPlan"
>
<template v-slot:btns>
<el-table-column
header-align="center"
label="使用金额(元)"
fixed="right"
width="140"
>
<template slot-scope="scope">
<Input v-if="scope.row.pid === 0"
:value="scope.row.useMoney"
@input="planInput($event, scope.row)"
/>
</template>
</el-table-column>
</template>
</xy-table>
<div style="display: flex; justify-content: flex-end">
<Page :total="planTotal" show-elevator @on-change="planPageChange" />
</div>
</template>
<template v-slot:footerContent>
<Button type="primary" @click="planSelect">确定</Button>
</template>
</xy-dialog>
<!-- 新增表 框架合同-->
<Modal
title="框架协议"
v-model="isShowContractToContracts"
width="54%"
>
<Table
:data="contractList"
:columns="contractTable"
:loading="loading"
border
size="small"
@on-selection-change="selectionChange"
></Table>
<div style="display: flex; justify-content: center; margin: 10px 0">
<Page
:total="contractTotal"
size="small"
show-elevator
show-total
@on-change="
(e) => {
contractSelect.page = e;
getContractToContracts();
}
"
/>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="isShowContractToContracts = false">取 消</el-button>
<el-button type="primary" @click="isShowContractToContracts = false"
>确 定</el-button
>
</span>
</Modal>
<!-- 编辑-->
<editor
ref="editor"
:is-show-editor.sync="isShowEditor"
:money-way="moneyWay"
:purchase-type="purchaseType"
:purchase-way="purchaseWay"
@success="getContracts"
></editor>
<!-- 查看-->
<detail ref="detailContract"></detail>
<!--付款登记-->
<paymentRegistration
ref="paymentRegistration"
@paid="paying"
></paymentRegistration>
<!-- 合同签订-->
<contractSign ref="contractSign" @signSuccess="getContracts"></contractSign>
<!-- 查看付款计划-->
<contractPaymentRegistration
ref="contractPaymentRegistration"
></contractPaymentRegistration>
<biddingUpload ref="biddingUpload" @refresh="getContracts"></biddingUpload>
<oaFiles ref="oaFiles"></oaFiles>
<addContractLedger ref="addContractLedger" @refresh="getContracts"></addContractLedger>
</div>
</template>
<script>
import {
getContract,
addContrant,
delContract,
checkContractName,
updateStatus,
} from "@/api/contract/contract";
import { getparameter } from "@/api/system/dictionary";
import { listdeptNoAuth } from "@/api/system/department";
import { getBudget } from "@/api/budget/budget";
import { getOatoken } from "@/api/oatoken";
import { deepCopy, parseTime, resetSelect,moneyFormatter } from '@/utils'
import { Message } from "element-ui";
import { getInfo } from "@/api/user.js";
import { getToken } from "@/utils/auth";
import { getOutDetail, httpCurl, updateFlow } from "@/api/out";
import editor from "./components/editorContract";
import detail from "./components/detailContract";
import paymentRegistration from "./components/paymentRegistration";
import contractSign from "@/views/contract/components/contractSign";
import contractPaymentRegistration from "@/views/contract/components/contractPaymentRegistration";
import biddingUpload from "./components/biddingUpload.vue";
import oaFiles from './components/oaFiles.vue';
import addContractLedger from '@/views/contract/components/addContractLedger.vue'
let iframe;
export default {
components: {
addContractLedger,
editor,
detail,
paymentRegistration,
contractSign,
contractPaymentRegistration,
biddingUpload,
oaFiles
},
data() {
var planPass = (rule, value, callback) => {
if (this.form.isBudget) {
if (this.form.plan.length === 0) {
callback(new Error("必选"));
} else {
callback();
}
} else {
callback();
}
};
var supplyPass = (rule, value, callback) => {
if (this.form.is_simple) {
if (value === "") {
callback(new Error("必填"));
} else {
callback();
}
} else {
callback();
}
};
var moneyPass = (rule, value, callback) => {
if (this.form.is_simple) {
if (value === "") {
callback(new Error("必填"));
} else {
if (/^\d+(\.\d+)?$/.test(value)) {
callback();
} else {
callback(new Error("必须为数字"));
}
}
} else {
callback();
}
};
var typePass = (rule, value, callback) => {
if (!this.form.is_simple) {
if (value === "") {
callback(new Error("必填"));
} else {
callback();
}
} else {
callback();
}
};
var methodsPass = (rule, value, callback) => {
if (!this.form.is_simple) {
if (value === "") {
callback(new Error("必填"));
} else {
callback();
}
} else {
callback();
}
};
var modalityPass = (rule, value, callback) => {
if (!this.form.is_simple) {
if (value === "") {
callback(new Error("必填"));
} else {
callback();
}
} else {
callback();
}
};
var pricePass = (rule, value, callback) => {
if (!this.form.is_simple) {
if (value === "") {
callback(new Error("必填"));
} else {
if (/^\d+(\.\d+)?$/.test(value)) {
callback();
} else {
callback(new Error("必须为数字"));
}
}
} else {
callback();
}
};
return {
isShowIsFramework: true,
userList: ["ma_sm", "admin", "yu_l","wang_yx","li_f","chen_y"],
nowContract: {},
window: {
width: 0,
height: 0,
top: 0,
left: 0,
},
hasEdit: false,
isShowPlanForSearch: false,
options: [
{
value: "",
label: "全部",
},
{
value: 1,
label: "待申请",
},
{
value: 2,
label: "流转中",
},
{
value: 3,
label: "已办结",
},
],
//搜索
select: {
keyword: "",
showDatePicker: "",
page: 1,
page_size: 10,
startDate: "",
endDate: "",
type: "",
department_id: "",
status: "",
year: "",
plan_id: "",
outcome_type: 1,
plan_name: "请选择预算计划",
start_plan_price: undefined,
end_plan_price: undefined,
is_myself: 0,
is_simple: 0
},
selectCopy: {
keyword: "",
showDatePicker: "",
page: 1,
page_size: 10,
startDate: "",
endDate: "",
type: "",
department_id: "",
status: "",
year: "",
plan_id: "",
outcome_type: 1,
plan_name: "请选择预算计划",
start_plan_price: undefined,
end_plan_price: undefined,
is_myself: 0,
is_simple: 0
},
type: [
{
label: "服务",
value: 1,
},
{
label: "货物",
value: 2,
},
{
label: "工程",
value: 3,
},
],
purchaseType: [], //购买形式
purchaseWay: [], //购买方式
moneyWay: [], //资金渠道
departments: [], //部门科室
list: [], //数据
total: 0,
//表格
ledgerTable: [
{
label: "项目名称",
width: 380,
prop: "name",
fixed: "left",
align: "left",
},
{
label: "合同编号",
width: 200,
prop: 'number',
align: 'center'
},
{
label: "合同类型",
prop: "contract_type",
width: 140,
formatter:(cell, data, value) => {
let map = new Map([
[1,'收入类'],
[2,'支出类'],
[3,'技术协议']
])
return map.get(value)
}
},
{
label: "合同签订价(元)",
width: 140,
prop: "money",
align: "right",
formatter: (cell, data, value) => {
return Number(value)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
},
},
{
label: "支付占比",
width: 140,
customFn: (row) => {
let per =
((row.fund_log_total / row.money || 0) * 100)?.toFixed(2) || 0;
return (
<div
style={{
color: per > 110 ? "red" : "green",
}}
>
{" "}
{per} %
</div>
);
},
},
{
label: "付款计划",
prop: "sign_plan_count",
width: 120,
formatter: (cell, data, value) => {
if (value == 0) return "暂无";
return value + "期";
},
customFn:row => {
let text = "暂无";
if (row.sign_plan_count && row.sign_plan_count != 0) text = row.sign_plan_count + '期';
return (<a style="text-decoration: underline;">{text}</a>)
}
},
{
label: "供应商/服务商",
width: 220,
prop: "supply",
align: "left",
},
{
label: "业务科室",
width: 140,
prop: "department.name",
},
{
label: "经办人",
width: 140,
prop: "admin.name",
},
{
label: "合同服务日期",
width: 200,
customFn: (row) => {
if (row.start_date && row.end_date) {
return (
<div>
<span>
{row.start_date} ~ {row.end_date}
</span>
</div>
);
} else {
return <span></span>;
}
},
},
{
label: '费用年占比',
width: 160,
customFn: row => {
const { start_date, end_date, money } = row
if (!start_date || !end_date) {
return (<span>/</span>)
}
const startYear = new Date(start_date).getFullYear()
const endYear = new Date(end_date).getFullYear()
if (startYear === endYear) {
return (<p><span style="font-weight: 600;">[{startYear}]</span><span>{moneyFormatter(money)}</span></p>)
} else {
const startMonths = 12 - new Date(start_date).getMonth()
const endMonths = new Date(end_date).getMonth() + 1
return(
<div>
<p>
<span style="font-weight: 600;">[{startYear}]</span><span>{moneyFormatter(money*startMonths/(startMonths+endMonths))}</span>
</p>
<p>
<span style="font-weight: 600;">[{endYear}]</span><span>{moneyFormatter(money*endMonths/(startMonths+endMonths))}</span>
</p>
</div>
)
}
}
},
{
label: "签订日期",
width: 160,
prop: "date",
formatter: (cell, data, value) => {
if (value) return parseTime(new Date(value), "{y}-{m}-{d}");
},
},
{
label: "创建日期",
width: 160,
prop: "created_at",
formatter: (cell, data, value) => {
return parseTime(new Date(value), "{y}-{m}-{d}");
},
},
{
label: "附件",
width: 200,
prop: "files",
customFn: row => {
return (
<div>
{
row.files_detail.map(i => (<a style="color: red;" href={i.url} download={i.original_name} target="_blank">{i.original_name}</a>))
}
</div>
)
}
}
],
flowStatus: new Map([
[0, "-"],
[1, "待申请"],
[2, "流转中"],
[3, "已办结"]
]),
flowStatusColor: new Map([
[0, "rgb(140, 140, 140)"],
[1, "rgb(96, 109, 241)"],
[2, "rgb(219, 122, 122)"],
[3, "rgb(147, 201, 134)"]
]),
table: [
{
label: "项目名称",
width: 380,
prop: "name",
fixed: "left",
align: "left",
customFn:row => {
if (row.type === 1 && row.end_date && (this.$moment().valueOf() - this.$moment(row.end_date).valueOf()) > 0) {
return (<span style="color: red;"><span>【已到期】</span><span>{row.name}</span></span>)
} else {
return (
<span>{row.name}</span>
)
}
}
},
{
label: "采购形式",
width: 120,
prop: "purchase_type.value",
formatter: (cell, data, value) => {
return value ? value : "无";
},
},
{
label: "项目类型",
width: 120,
prop: "type",
formatter: (cell, data, value) => {
switch (value) {
case 1:
return "服务";
case 2:
return "货物";
case 3:
return "工程";
default:
return "无";
}
}
},
{
label: "采购流程",
multiHd: [
{
label: "采购业务审批流程",
width: 158,
prop: "purchase_status",
customFn:row => {
if (!row.FLOWSTATUS.caigou.getStatus()) {
return (<span style="color: rgb(140, 140, 140)">无</span>);
}
return (
<div>
<span style={{ 'color': this.flowStatusColor.get(row.FLOWSTATUS.caigou.getStatus()) }}>{ this.flowStatus.get(row.FLOWSTATUS.caigou.getStatus()) }</span>
<br/>
{
(row.FLOWSTATUS.caigou.getStatus() > 1) ? <a style="color: #333" on={{['click']:()=>this.toOaDetail('caigou',row)}}>查看</a> : ''
}
</div>
)
}
},
{
label: "招标审核流程",
width: 145,
prop: "invite_status",
customFn:row => {
if (!row.FLOWSTATUS.zhaobiao.getStatus()) {
return (<span style="color: rgb(140, 140, 140)">无</span>);
}
return (
<div>
<span style={{ 'color': this.flowStatusColor.get(row.FLOWSTATUS.zhaobiao.getStatus()) }}>{ this.flowStatus.get(row.FLOWSTATUS.zhaobiao.getStatus()) }</span>
<br/>
{
(row.FLOWSTATUS.zhaobiao.getStatus() > 1) ? <a style="color: #333" on={{['click']:()=>{
this.$refs['biddingUpload'].setId(row.id)
this.$refs['biddingUpload'].show()
}}}>查看</a> : ''
}
</div>
)
}
},
{
label: "合同审批流程",
width: 145,
prop: "join_status",
customFn:row => {
if (!row.FLOWSTATUS.shenpi.getStatus()) {
return (<span style="color: rgb(140, 140, 140)"></span>);
}
return (
<div>
<span style={{ 'color': this.flowStatusColor.get(row.FLOWSTATUS.shenpi.getStatus()) }}>{ this.flowStatus.get(row.FLOWSTATUS.shenpi.getStatus()) }</span>
<br/>
{
(row.FLOWSTATUS.shenpi.getStatus() > 1) ? <a style="color: #333" on={{['click']:()=>this.toOaDetail('hetong',row)}}>查看</a> : ''
}
</div>
)
}
},
],
},
{
label: "采购方式",
width: 120,
prop: "purchase_way.value",
formatter: (cell, data, value) => {
return value ? value : "无";
},
},
{
label: "资金来源",
width: 120,
customFn: (row) => {
{
return row.money_way_detail.map((item) => {
return <div> {item.value} </div>;
});
}
},
},
{
label: "预算计划",
width: 330,
align: "left",
customFn: (row) => {
{
return row.plans.map((item) => {
return (
<div>
{" "}
[{item.year}] {item.pid_info ? item.pid_info.name : ''} - {item.name}{" "}
</div>
);
});
}
},
},
{
label: "合同预算价(元)",
width: 140,
prop: "plan_price",
align: "right",
formatter: (v1, v2, value) => {
return Number(value)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
},
},
{
label: "合同签订价(元)",
width: 140,
prop: "money",
align: "right",
formatter: (cell, data, value) => {
return Number(value)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
},
},
{
label: "已申请金额(元)",
prop: "apply_money_total",
width: 140,
align: "right",
formatter: (cell, data, value) => {
return Number(value)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
},
},
{
label: "已付金额(元)",
prop: "fund_log_total",
width: 140,
align: "right",
formatter: (cell, data, value) => {
return Number(value)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
},
},
{
label: "支付占比",
width: 140,
customFn: (row) => {
let per =
((row.fund_log_total / row.money || 0) * 100)?.toFixed(2) || 0;
return (
<div
style={{
color: per > 110 ? "red" : "green",
}}
>
{" "}
{per} %
</div>
);
},
},
{
label: "合同状态",
width: 120,
prop: "status",
formatter: (cell, data, value) => {
switch (value) {
case 1:
return "待签订";
break;
case 2:
return "已签订";
break;
default:
return "未知";
}
},
},
{
label: "结算状态",
width: 120,
prop: "is_end",
formatter: (cell, data, value) => {
return value === 0 ? "未结清" : "已结清";
},
},
{
label: "付款计划",
prop: "sign_plan_count",
width: 120,
formatter: (cell, data, value) => {
if (value == 0) return "暂无";
return value + "期";
},
},
{
label: "供应商/服务商",
width: 220,
prop: "supply",
align: "left",
},
{
label: "业务科室",
width: 140,
prop: "department.name",
},
{
label: "经办人",
width: 140,
prop: "admin.name",
},
{
label: "合同服务日期",
width: 200,
customFn: (row) => {
if (row.start_date && row.end_date) {
return (
<div>
<span>
{row.start_date} ~ {row.end_date}
</span>
</div>
);
} else {
return <span></span>;
}
},
},
{
label: "签订日期",
width: 160,
prop: "date",
formatter: (cell, data, value) => {
if (value) return parseTime(new Date(value), "{y}-{m}-{d}");
},
},
{
label: "创建日期",
width: 160,
prop: "created_at",
formatter: (cell, data, value) => {
return parseTime(new Date(value), "{y}-{m}-{d}");
},
},
],
//总计
tableTotal: {
fundLogTotal: 0,
moneyTotal: 0,
planPriceTotal: 0,
},
planTypes: [],
planTableSearch: [
{
label: "分类",
prop: "type_detail.value",
},
{
label: "年份",
prop: "year",
align: "center",
},
{
label: "名称",
prop: "name",
align: "left",
},
{
label: "计划金额",
prop: "money",
align: "right",
width: 120,
customFn: (row) => {
let m1 = row.money;
let m2 = row.update_money;
return m2 == 0 ? m1 : m2;
},
},
],
planTable: [
{
width: 44,
sortable: false,
type: "selection",
fixed: "left",
selectable: (row, index) => {
return row.pid === 0
}
},
{
label: "分类",
prop: "type_detail.value",
width: 100,
fixed: "left",
},
{
label: "科室",
prop: "plan_department.name",
width: 100,
align: "center",
},
{
label: "年份",
prop: "year",
width: 80,
align: "center",
},
{
label: "名称",
prop: "name",
width: 320,
align: "left",
},
{
label: "计划金额",
prop: "money",
align: "right",
width: 120,
customFn: (row) => {
let m1 = row.money;
let m2 = row.update_money;
return m2 == 0 ? m1 : m2;
},
},
{
label: "实付金额",
prop: "use_money_total",
width: 120,
align: "right",
},
{
label: "已用金额",
prop: "has_money_total",
width: 120,
align: "right",
},
],
//新增
isShowAdd: false,
form: {
name: "",
is_contract: 1,
content: "",
is_simple: 0,
supply: "",
money: 0,
type: "",
methods: "",
modality: "",
price: 0,
fundingChannels: [],
isBudget: true,
plan: [],
//is_substitute: 0,//改为无采购流程,直接签订合同后执行(合同界面新增)
is_framework: 0,
use_framework_buy: 0,
contract_to_contracts: [],
},
plan: [],
rules: {
name: [
{
required: true,
message: "必填",
},
],
supply: [
{
validator: supplyPass,
trigger: "change",
},
],
money: [
{
validator: moneyPass,
trigger: "change",
},
],
type: [
{
validator: typePass,
trigger: "change",
},
],
methods: [
{
validator: methodsPass,
trigger: "change",
},
],
modality: [
{
validator: modalityPass,
trigger: "change",
},
],
price: [
{
validator: pricePass,
trigger: "change",
},
],
fundingChannels: [
{
required: true,
message: "必填",
},
],
plan: [
{
validator: planPass,
trigger: "change",
},
],
},
isShowPlan: false, //新增中预算计划
plans: [], //预算数据
planSearch: {
name: "",
plan_department_id: "",
year: ""
},
planTotal: 0,
plansPageIndex: 1,
//新增中框架合同
isShowContract: false,
isShowContractToContracts: false,
contractSelect: {
page: 1,
page_size: 10,
is_framework: 1,
},
contractTotal: 0,
contractList: [],
loading: false,
contractTable: [
{
type: "selection",
width: 56,
align: "center",
},
{
title: "项目名称",
key: "name",
minWidth: 180,
align: "left",
},
{
title: "采购形势",
width: 120,
render: (h, { row }) => {
return h("span", {}, row.purchase_type?.value || "无");
},
},
{
title: "项目类型",
width: 120,
render: (h, { row }) => {
let map = new Map([
[1, "服务"],
[2, "货物"],
[3, "工程"],
]);
return h("span", {}, map.get(row.type));
},
},
{
title: "采购方式",
width: 120,
render: (h, { row }) => {
return h("span", {}, row.purchase_way?.value || "无");
},
},
],
selections: [], //已选择的框架合同
isShowEditor: false,
};
},
methods: {
showIsFramework () {
this.$nextTick(() => {
if (this.$refs['methodInput'].selected.label === '直接发包' && this.form.use_framework_buy) {
this.isShowIsFramework = false;
this.form.is_framework = true
} else {
this.isShowIsFramework = true;
}
})
},
async toOaDetail (tbname,row) {
let res;
switch (tbname) {
case 'hetong':
res = await httpCurl({
tbname,
out_contract_id: row.id
})
break;
case 'caigou':
res = await httpCurl({
tbname,
out_caigou_id: row.id
})
break;
case 'pay':
res = await httpCurl({
tbname,
out_pay_id: row.id
})
break;
}
console.log(res)
if (res && res.flow?.id) {
window.open(
`${process.env.VUE_APP_OUT_OLD}/index.php?s=/flow/edit/id/${res.flow.id}&auth_token=${this.$store.getters.oa_token}`,
"bidding",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
)
} else {
this.$message({
type: 'warning',
message: '未查找到该流程'
})
}
},
reset () {
this.select = deepCopy(this.selectCopy)
},
toExport() {
this.select.is_export = 1;
this.getContracts(true);
},
clearSelectForSearch() {
this.select.plan_id = "";
this.select.plan_name = "请选择预算计划";
},
async getPlanTypes() {
const res = await getparameter({
number: "money_way",
});
this.planTypes = res.detail;
console.log(this.planTypes);
},
//预算计划金额输入
planInput(e, row) {
if (!/^[0-9]+.?[0-9]*$/.test(e) && e) {
Message({
type: "warning",
message: "金额格式错误",
});
row.useMoney = 0;
return;
}
let money =
Number(row.update_money) == 0
? Number(row.money)
: Number(row.update_money);
console.log(e, money, row.use_money_total);
console.log(e <= money - Number(row.use_money_total));
if (e <= money - Number(row.use_money_total)) {
row.useMoney = e;
this.plan.forEach((item) => {
if (item.value.plan_id == row.id) {
item.value.use_money = e;
}
});
return;
}
Message({
type: "warning",
message: "使用金额大于剩余预算",
});
row.useMoney = 0;
},
//合计
summary(param) {
this.$nextTick(() => {
this.$refs["xyTable"].$children[0].doLayout();
});
const { columns, data } = param;
const sums = [];
columns.map((column, index) => {
if (index === 0) {
sums[index] = "总计";
return;
}
if (column.property === "fund_log_total") {
sums[index] = this.tableTotal.fundLogTotal;
return;
}
if (column.property === "plan_price") {
sums[index] = this.tableTotal.planPriceTotal;
return;
}
if (column.property === "money") {
sums[index] = this.tableTotal.moneyTotal;
return;
}
// const values = data.map(item => Number(item[column.property]));
// if (!values.every(value => isNaN(value)) && (column.property === 'money' || column.property === 'plan_price'|| column.property === 'fund_log_total')) {
//
// sums[index] = sums[index].toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,')
// } else {
// sums[index] = '';
// }
});
return sums;
},
//y验证合同的名称是否存在重复
checkName(e) {
checkContractName({ name: e }).then((res) => {
console.log(res);
});
},
confirmPlanForSearch() {
this.isShowPlanForSearch = false;
this.getContracts();
},
//
setNowContract(contract, tbname) {
this.nowContract = {
tbname,
...contract,
};
},
//点击付款计划查看
showPaymentPlan(row, column, cell) {
if (column.property === "sign_plan_count") {
this.$refs["contractPaymentRegistration"].getSignPlan(row.id);
row.status === 2
? (this.$refs["contractPaymentRegistration"].isSign = true)
: (this.$refs["contractPaymentRegistration"].isSign = false);
this.$refs["contractPaymentRegistration"].isShow = true;
}
if (column.property === "fund_log_total") {
this.$router.push(
`/contract/paymentRegistrationList?contractId=${row.id}`
);
}
},
//招标文件审查
async bidding(row) {
this.setNowContract(row, "zhaobiao");
let baseInfo = {
title: row?.name,
out_zhaobiao_id: row.id,
};
//let res = await getOatoken()
let url = `${process.env.VUE_APP_OUT_OLD}?s=/flow/add/modid/30&auth_token=${this.$store.getters.oa_token}&out_zhaobiao_id=${
row.id
}&contract_json=${JSON.stringify(baseInfo)}`;
let bidding = window.open(
url,
"bidding",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
//采购流程
async buyProcess(row) {
this.setNowContract(row, "caigou");
let baseInfo = {
title: row?.name,
//"采购形式": row?.purchase_type?.value,
iszhengfucaigou:
(row.purchase_type?.value === "政府采购") ? "政府采购" : "否",
out_caigou_id: row.id,
type: this.type.find((item) => {
return item.value === row.type;
})?.label,
yusuan: row?.plan_price?.toString(),
zijinlaiyuan: row.money_way_detail?.reduce((prev, cur, index) => {
if (index === 0) {
return cur?.value;
} else {
}
}, ""),
zijinlaiyuanjuti: row?.plans.reduce((pre,cur,index)=>(index === 0 ? (`${cur?.year}${cur?.name}`) : (pre+`,【${cur?.year}${cur?.name}`)),"")
};
console.log(baseInfo.zijinlaiyuanjuti)
// let res = await getOatoken()
let url = `${process.env.VUE_APP_OUT_OLD}?s=/flow/add/modid/8&auth_token=${this.$store.getters.oa_token}&out_caigou_id=${
row.id
}&contract_json=${JSON.stringify(baseInfo)}`;
let buyProcess = window.open(
url,
"buyProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
//会签流程
async signProcess(row) {
this.setNowContract(row, "hetong");
let baseInfo = {
title: row?.name,
执行部门: row?.carry_department,
total: row?.money || row?.plan_price,
out_contract_id: row.id,
contract_content: row.content,
yifang: row.supply
//"承包商\\供应商":row.supply
};
// let res = await getOatoken()
let url = `${process.env.VUE_APP_OUT_OLD}?s=/flow/add/modid/9&auth_token=${this.$store.getters.oa_token}&out_contract_id=${
row.id
}&contract_json=${JSON.stringify(baseInfo)}`;
let signProcess = window.open(
url,
"signProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
//付款流程
async paying(row) {
let typeMap = new Map([
['货物','货物采购'],
['服务','服务采购'],
['其他','其他项目']
])
// this.setNowContract(row,'pay')
let baseInfo = {
title: row?.name,
xiangmuleibie: typeMap.get(this.type.find((item) => {
return item.value === row.type;
})?.label),
things: row?.name,
hetongbianhao: row?.number,
out_pay_id: row?.out_pay_id,
reason: row?.reason,
yizhifucishu: row?.yizhifucishu,
yizhifujine: row?.yizhifujine,
zongjia: row?.zongjia,
zhifucishu: row?.zhifucishu,
total: row?.total
//"承包商\\供应商":row.supply
};
let url = `${process.env.VUE_APP_OUT_OLD}?s=/flow/add/modid/24&auth_token=${this.$store.getters.oa_token}&out_pay_id=${
row?.out_pay_id
}&contract_json=${JSON.stringify(baseInfo)}`;
let signProcess = window.open(
url,
"signProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
this.$router.push('/contract/contract/paymentRegistrationList_1')
},
//请示流程
async askProcess(row) {
let res = await getOatoken();
let url = `${process.env.VUE_APP_OUT_URL}/admin/flow/create/17?oatoken=${res.oatoken}&out_contract_id=${row.id}`;
let askProcess = window.open(
url,
"askProcess",
`top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
);
},
//翻页
pageChange(e) {
this.select.page = e;
this.getContracts();
},
planPageChange(e) {
this.plansPageIndex = e;
this.getBudgets();
},
//日期选择
datePick(e) {
this.select.start_created_at = e[0];
this.select.end_created_at = e[1];
},
//获取预算计划
async getBudgets() {
let res = await getBudget({
name: this.planSearch.name,
page_size: 10,
page: this.plansPageIndex,
plan_department_id: this.planSearch.plan_department_id,
top_pid: '',
is_tree: 1,
year: this.planSearch.year
});
this.plans = res.list;
this.planTotal = res.list.total || 0;
this.toggleSelection(
this.plan.map((item) => {
return item.value.plan_id;
}),
1
);
},
//获取资金渠道
async getMoneyWay() {
this.moneyWay = (
await getparameter({
number: "money_way",
})
).detail;
},
//获取购买方式
async getPurchaseWay() {
this.purchaseWay = (
await getparameter({
number: "purchase_way",
})
).detail;
}, //计划搜索
searchBudgets() {
this.plansPageIndex = 1;
this.getBudgets();
},
//获取科室
async getDepartment() {
this.departments = await listdeptNoAuth();
},
//获取购买形式列表
async getPurchaseType() {
this.purchaseType = (
await getparameter({
number: "purchase_type",
})
).detail;
},
pageSizeChange(e) {
this.select.page_size = e;
this.select.page = 1;
this.getContracts();
},
//获取合同列表
async getContracts(is_export,noloading=false,isopenOa=false) {
let tokens = getToken();
if (is_export && this.select.is_export == 1) {
var url = "/api/admin/contract/index?is_auth=1&token=" + tokens;
Object.keys(this.select).forEach((key, item) => {
if (key === 'page') {
url += '&page=1';
} else if (key === 'page_size') {
url += '&page_size=9999';
} else {
if (this.select[key]) {
url += "&" + key + "=" + this.select[key];
}
}
});
url = location.host + url;
console.log(url);
window.open("http://" + url, "_blank");
this.select.is_export = 0;
return;
}
const res = await getContract({
...this.select,
is_auth: 1,
},noloading);
res.list.data.forEach(i => this.handleContractFlow(i))
this.list = res.list.data;
this.total = res.list.total;
this.tableTotal.fundLogTotal = res.fund_log_total;
this.tableTotal.moneyTotal = Number(res.money_total)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
this.tableTotal.planPriceTotal = Number(res.plan_price_total)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
console.log(this.list)
//新增时打开oa采购录入
if (isopenOa) {
if (res.list.data[0]) {
if (
res.list.data[0].is_simple !== 1 &&
res.list.data[0].purchase_status === 1 &&
((res.list.data[0].req_status === 3 && res.list.data[0].is_plan === 0) ||
res.list.data[0].is_plan === 1) &&
!res.list.data[0].is_substitute
) {
await this.buyProcess(res.list.data[0])
}
}
}
},
//新建合同
//显示
async showPlan() {
this.isShowPlan = true;
await this.getBudgets();
},
async showPlanForSearch() {
this.isShowPlanForSearch = true;
await this.getBudgets();
},
//选择计划 搜索
selectPlanForSearch(sel) {
console.log(sel);
if (sel) {
this.select.plan_id = sel.id;
this.select.plan_name = sel.name;
} else {
this.select.plan_id = "";
this.select.plan_name = "";
}
},
//选择计划
selectPlan(sel, row) {
console.log(sel);
if (sel) {
let select = sel.map((item) => {
return {
label: item.name,
value: {
plan_id: item.id,
use_money: item.useMoney,
new_money: item.money,
},
};
});
//说明被删除了
if (
sel.filter((plan) => {
return plan.id == row.id;
}).length == 0
) {
this.delPlan({
value: {
plan_id: row.id,
},
});
}
let _plan = JSON.parse(JSON.stringify(this.plan));
var _select = [];
select.map((item) => {
if (
_plan.filter((plan) => {
return plan.value.plan_id == item.value.plan_id;
}).length == 0
) {
_select.push(item);
}
});
this.plan = [..._plan, ..._select];
} else {
this.plan = [];
}
},
//确认计划选择
planSelect() {
if (this.plan.length === 0) {
Message({
type: "warning",
message: "选择计划不能为空",
});
return;
}
for (let item of this.plan) {
console.log(item);
if (!item.value.use_money) {
Message({
type: "warning",
message: "金额不能为空",
});
return;
}
}
this.form.plan = this.plan;
this.isShowPlan = false;
},
delPlan(val) {
this.form.plan.map((item, index) => {
if (item.value.plan_id === val.value.plan_id) {
this.form.plan.splice(index, 1);
}
});
this.plan.map((item, index) => {
if (item.value.plan_id === val.value.plan_id) {
this.plan.splice(index, 1);
}
});
},
delSelections(val) {
this.selections.map((item, index) => {
if (item.id === val.id) {
this.selections.splice(index, 1);
}
});
},
//确认计划选择搜索
planSelectForSearch() {
if (this.select.plan_id == "") {
Message({
type: "warning",
message: "选择计划不能为空",
});
return;
}
this.isShowPlanForSearch = false;
},
//默认选择计划
toggleSelection(plans, type) {
if (plans) {
this.plans
.filter((plan) => {
if (plans.includes(plan.id)) {
plan.useMoney = this.plan[plans.indexOf(plan.id)].value.use_money;
return true;
}
})
.map((row) => {
this.$refs.planTable.toggleRowSelection(row);
});
} else {
this.$refs.planTable.clearSelection();
}
},
//提交新建
submit() {
addContrant({
type: this.form.type,
is_plan: this.form.isBudget ? 1 : 0,
purchase_type_id: this.form.methods,
is_contract: this.form.is_contract,
purchase_way_id: this.form.modality,
money_way_id: `${this.form.fundingChannels.toString()}`,
plan_price: this.form.price,
name: this.form.name,
contract_plan_links: this.form.plan.map((item) => {
return item.value;
}),
is_substitute: this.form.is_substitute,
is_simple: this.form.is_simple,
supply: this.form.supply,
money: this.form?.money,
status: this.form?.is_simple ? 2 : 1,
is_framework: this.form?.is_framework,
use_framework_buy: this.form.use_framework_buy,
content: this.form.content,
contract_to_contracts: this.selections.map((i) => {
return {
to_contract_id: i.id,
use_money: i.money,
};
}),
}).then((res) => {
this.isShowAdd = false;
Message({
type: "success",
message: "操作成功",
});
this.selections = [];
this.$refs["addContract"].reset();
this.$refs["planTable"].clearSelection();
this.getContracts(false,false,true);
});
},
//删除合同
deleteContract(id) {
delContract({
id,
}).then((res) => {
Message({
type: "success",
message: "操作成功",
});
this.getContracts();
});
},
//框架合同
async getContractToContracts() {
const res = await getContract(this.contractSelect);
let selectedIds = this.selections.map((i) => i.id);
this.contractList = res.list.data.map((item) => {
return {
...item,
_checked: !!selectedIds.find((i) => i === item.id),
};
});
this.contractTotal = res.list.total;
},
selectionChange(selection) {
this.selections = Array.from(new Set(selection));
},
//数据流程状态处理
handleContractFlow (item) {
class Flow {
status = 0
executable = false
constructor(status=0, executable=false) {
this.status = status
this.executable = executable
}
setStatus (status) {
this.status = status
}
setExecutable (executable) {
if (typeof executable === 'boolean') {
this.executable = executable
}
}
getStatus () {
return this.status
}
isEnabled () {
return this.executable && this.status === 1
}
}
//0无该流程1未开始2进行中3已完成合同签订1待签订2已签订
let flowStatus = {
"caigou": new Flow(),
"zhaobiao": new Flow(),
"shenpi": new Flow(),
"qianding": new Flow(),
"zhifu": new Flow()
}
if (item.is_simple !== 1 && !item.is_substitute) {
//不为简易 采购未开始
flowStatus["caigou"].setStatus(item.purchase_status)
if (item.purchase_status === 1) {
//采购未开始
if (item.is_plan === 1 || (item.is_plan === 0 && item.req_status === 3)) {
//不为预算时,请示流程完成
flowStatus["caigou"].setExecutable(true)
}
}
}
if (item.purchase_way?.value !== '网上商城' && item.is_contract && item.purchase_way?.remark === 'true' && !item.is_substitute) {
//不为网上商场 是合同\
flowStatus["zhaobiao"].setStatus(item.invite_status)
if (item.invite_status === 1 && item.purchase_status === 3) {
//采购完成,招标未开始
flowStatus["zhaobiao"].setExecutable(true)
}
}
if (item.is_contract && item.purchase_way?.value !== "网上商城") {
//为合同 不为网上商城
flowStatus["shenpi"].setStatus(item.join_status)
if (item.join_status === 1 && (item.invite_status === 3 ||
(item.purchase_way?.remark === 'false' && item.purchase_status === 3))) {
//审批未开始 走招标招标完成或不走招标采购完成
flowStatus["shenpi"].setExecutable(true)
}
}
if (item.is_contract && item.purchase_way?.value !== "网上商城" && !item.is_substitute) {
flowStatus["qianding"].setStatus(item.status)
if (item.join_status === 3 && item.status === 1) {
flowStatus["qianding"].setExecutable(true)
}
}
if (item.is_end === 0) {
flowStatus["zhifu"].setStatus(1)
//最后一笔没付完
if ((!item.is_contract && !item.is_substitute && item.purchase_status === 3) || (item.purchase_way?.value === "网上商城" && item.purchase_status === 3) ||
item.status === 2 ||
(!item.is_contract && item.is_simple) || (item.is_contract && item.is_substitute && item.join_status === 3)) {
//网上商场的话采购完成 合同签订完成 不为合同并且为简易
flowStatus["zhifu"].setExecutable(true)
}
}
item.FLOWSTATUS = flowStatus
}
},
computed: {
purchaseWayFormat() {
return function () {
if (!this.form.methods) {
return this.purchaseWay;
} else {
let temp = this.purchaseType.find((i) => i.id === this.form.methods);
let arr = temp?.remark?.split(",")?.map((i) => Number(i));
return this.purchaseWay.filter((i) => arr.indexOf(i.id) !== -1);
}
};
},
},
watch: {
isShowContractToContracts(val) {
if (val) {
this.getContractToContracts();
} else {
this.contractSelect = {
page: 1,
page_size: 10,
is_framework: 1,
}
this.contractList = [];
this.contractTotal = 0;
}
},
},
mounted() {
this.window.width = screen.availWidth * 0.95;
this.window.height = screen.availHeight * 0.95;
this.window.top = (window.screen.height - 30 - this.window.height) / 2;
this.window.left = (window.screen.width - 10 - this.window.width) / 2;
let that = this;
getInfo()
.then((response) => {
console.log(response);
this.user = response;
if (that.userList.indexOf(response.username) != -1) {
that.hasEdit = true;
}
})
.catch((error) => {});
this.getPurchaseType();
this.getDepartment();
this.getPurchaseWay();
this.getMoneyWay();
this.getContracts();
//页面激活后刷新合同列表
window.onfocus = async () => {
await this.getContracts(false,true)
};
},
created() {
this.getBudgets();
this.selecit.keyword = this.$route.query.keyword || "";
this.select.is_myself = this.$route.path.split('_')[1] ? Number(this.$route.path.split('_')[1]) : 0;
if (/contractLedger/g.test(this.$route.path)) {
this.select.is_contract = 1;
this.select.purchase_status = 3;
this.select.invite_status = 3;
}
if (/contractAll/g.test(this.$route.path)) {
this.select.is_simple = "";
}
},
destroyed() {
window.onfocus = null;
},
};
</script>
<style lang="scss" scoped>
.selects {
display: flex;
flex-wrap: wrap;
align-items: center;
& > div {
margin-bottom: 6px;
}
}
.selectTop {
margin-top: 10px;
}
.contract-add-plan {
min-height: 30px;
border: 1px solid #dcdee2;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
padding: 0 8px;
&-no-plan {
height: 30px;
line-height: 30px;
color: #cdd0d5;
}
}
.slot-btns {
display: flex;
flex-wrap: wrap;
align-content: center;
justify-content: flex-start;
&-item {
margin: 0 6px 4px 0;
}
}
.xy-table-item-label {
width: 200px;
}
.xy-table-item-price {
position: relative;
&::after {
position: absolute;
right: 0;
top: 0;
content: "(元)";
}
}
.select-content {
display: flex;
flex-wrap: wrap;
& > div {
flex-basis: 45%;
margin: 5px;
& > span:nth-child(1) {
display: inline-block;
width: 140px;
}
}
}
a:hover {
transition: all .2s;
text-decoration: underline;
}
</style>