2022.7.20(2)

master
271556543@qq.com 3 years ago
parent 036f2b3235
commit 8cbc4aaaec

@ -32,10 +32,10 @@ export function delContract(params){
})
}
export function editorContract(post){
export function editorContract(data){
return request({
method:'post',
url:'/api/admin/contract/save',
post
data
})
}

@ -45,12 +45,13 @@
<Page :total="total" show-elevator @on-change="pageChange"/>
</div>
<!-- 新增-->
<xy-dialog :is-show.sync="isShowAdd" type="form" :form="form" title="新增计划" :rules="rules" @submit="submit" ref="addBudget">
<template v-slot:name>
<Row>
<Col span="5"><span style="color: red;font-weight: 600;padding-right: 4px;">*</span>项目名称</Col>
<Col>
<Input placeholder="请填写项目名称" v-model="form.name" style="width: 100%;"/>
<Col style="width: 100%;">
<Input placeholder="请填写项目名称" v-model="form.name" style="width: 300px;"/>
</Col>
</Row>
</template>
@ -112,7 +113,8 @@
</template>
</xy-dialog>
<xy-dialog title="编辑" type="form" :is-show.sync="isShowEditor" :form="editorForm" :rules="rules">
<!-- 编辑-->
<xy-dialog title="编辑" type="form" :is-show.sync="isShowEditor" :form="editorForm" :rules="rules" ref="editorDialog">
<template v-slot:name>
<Row>
<Col span="5"><span style="color: red;font-weight: 600;padding-right: 4px;">*</span>项目名称</Col>
@ -125,7 +127,7 @@
<Row>
<Col span="5"><span style="color: red;font-weight: 600;padding-right: 4px;">*</span>预算类型</Col>
<Col>
<Select placeholder="请选择预算类型" v-model="editorForm.type" style="width: 300px;">
<Select placeholder="请选择预算类型" v-model="editorForm.type" style="width: 300px;" clearable>
<Option v-for="item in [{label:'部门预算',value:1},{label:'水务计划',value:2}]" v-model="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</Col>
@ -135,7 +137,7 @@
<Row>
<Col span="5"><span style="color: red;font-weight: 600;padding-right: 4px;">*</span>项目所属年份</Col>
<Col>
<DatePicker placeholder="请选择所属年份" type="year" placement="bottom" :value="editorForm.year" style="width: 300px;" @on-change="(e)=>form.year = e"></DatePicker>
<DatePicker placeholder="请选择所属年份" type="year" placement="bottom" :value="editorForm.year" style="width: 300px;" @on-change="(e)=>editorForm.year = e"></DatePicker>
</Col>
</Row>
</template>
@ -344,21 +346,28 @@ export default {
//
editorTable(){
editorBudget({
id:this.editorForm.id,
type:this.editorForm.type,
year:this.editorForm.year,
content:this.editorForm.content,
money:this.editorForm.money,
remark:this.editorForm.remark,
plan_department_id:this.editorForm.department
}).then(res=>{
this.isShowEditor = false
Message({
message:'操作成功',
type:'success'
this.$refs['editorDialog'].$refs['elForm'].validate().then(res=>{
editorBudget({
id:this.editorForm.id,
type:this.editorForm.type,
year:this.editorForm.year,
content:this.editorForm.content,
money:this.editorForm.money,
remark:this.editorForm.remark,
plan_department_id:this.editorForm.department
}).then(res=>{
this.isShowEditor = false
Message({
message:'操作成功',
type:'success'
})
this.getBudgets()
})
}).catch(err=>{
this.$message({
message:'请填写完整信息',
type:'error'
})
this.getBudgets()
})
},
showEditor(row){
@ -376,6 +385,7 @@ export default {
remark:res.remark
}
this.isShowEditor = true
console.log(this.editorForm)
})
},
},

@ -0,0 +1,323 @@
<template>
<div>
<!-- 编辑-->
<xy-dialog :is-show.sync="isShowEditor" title="合同编辑" type="form" :form="detail" :rules="rules" @submit="editor" ref="addContract">
<template v-slot:name>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>项目名称</Col>
<Col>
<Input placeholder="请填写项目名称" v-model="detail.name" style="width: 300px;"/>
</Col>
</Row>
</template>
<template v-slot:type>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>项目类型</Col>
<Col>
<Select placeholder="请选择项目类型" v-model="detail.type" style="width: 300px;">
<Option v-for="item in [{label:'服务',value:1},{label:'货品',value:2},{label:'工程',value:3}]" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</Col>
</Row>
</template>
<template v-slot:methods>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>采购类型</Col>
<Col>
<Select placeholder="请选择采购类型" v-model="detail.methods" style="width: 300px;">
<Option v-for="item in purchaseType" :value="item.id" :key="item.id">{{ item.value }}</Option>
</Select>
</Col>
</Row>
</template>
<template v-slot:modality>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>采购形式</Col>
<Col>
<Select placeholder="请选择采购形式" v-model="detail.modality" style="width: 300px;">
<Option v-for="item in purchaseWay" :value="item.id" :key="item.id">{{ item.value }}</Option>
</Select>
</Col>
</Row>
</template>
<template v-slot:price>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>合同预算价</Col>
<Col>
<Input placeholder="请填写合同预算价" v-model="detail.price" style="width: 300px;"/>
</Col>
<Col offset="1"></Col>
</Row>
</template>
<template v-slot:fundingChannels>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>资金渠道</Col>
<Col>
<Select placeholder="请选择资金渠道" v-model="detail.fundingChannels" style="width: 300px;">
<Option v-for="item in moneyWay" :value="item.id" :key="item.id">{{ item.value }}</Option>
</Select>
</Col>
</Row>
</template>
<template v-slot:isBudget>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>是否预算</Col>
<Col>
<i-switch v-model="detail.isBudget" @on-change="detail.isBudget = $event" />
</Col>
</Row>
</template>
<template v-if="detail.isBudget" v-slot:plan>
<Row>
<Col span="5"><span style="font-weight: 600;padding-right: 4px;color: red;">*</span>关联预算计划</Col>
<Col style="margin: auto 0;">
<div class="contract-add-plan" style="width: 300px;" @click="isShowPlan = true,getBudgets()">
<template v-if="detail.plan.length > 0">
<template v-for="item in detail.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>
</Col>
</Row>
</template>
</xy-dialog>
<!-- 编辑中 预算计划 -->
<xy-dialog :is-show.sync="isShowPlan" title="预算计划" :width="640">
<template v-slot:normalContent>
<Input v-model="planSearch" search enter-button=" " placeholder="搜索预算计划.." @on-search="getBudgets"/>
<xy-table :list="plans" :show-index="false" :table-item="planTable" :height="300" style="margin-top: 10px;">
<template v-slot:btns>
<el-table-column label="使用金额" header-align="center">
<template slot-scope="scope">
<Input :value="scope.row.useMoney ? scope.row.useMoney: scope.row.money" @input="(e)=>scope.row.useMoney = e"/>
</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="isShowPlan = false">确定</Button>
</template>
</xy-dialog>
</div>
</template>
<script>
import {editorContract,detailContract} from "@/api/contract/contract";
import {getBudget} from "@/api/budget/budget";
import {Message} from 'element-ui'
export default {
props:{
purchaseType:Array,
moneyWay:Array,
purchaseWay:Array
},
data() {
var planPass = (rule, value, callback) => {
if(this.detail.isBudget){
if(this.detail.plan.length === 0){
return callback(new Error('必选'))
}else{
callback()
}
}else{
callback()
}
}
return {
contrantId:'',
isShowEditor:false,
isShowPlan:false,
detail:{},
rules:{
name:[
{required:true,message:"必填"}
],
type:[
{required:true,message:"必选"}
],
methods:[
{required:true,message:"必选"}
],
modality:[
{required:true,message:"必选"}
],
price:[
{required:true,message:"必填"}
],
fundingChannels:[
{required:true,message:"必填"}
],
plan:[
{validator:planPass}
]
},
plans:[],
planSearch:'',
planTable:[
{
sortable:false,
width:36,
customFn:(row)=>{
return (
<div>
<Checkbox value={this.isInArray(row.id)} on={{['on-change']:(e)=>this.selectPlan(e,row)}}></Checkbox>
</div>
)
}
},
{
label:"分类",
prop:'type',
formatter:(cell,data,value)=>{
switch (value){
case 1:
return "部门预算"
break;
case 2:
return "水务计划"
break;
default:
return "未知"
}
}
},
{
label:"名称",
prop:'name',
align:'left'
},
{
label:"计划金额",
prop:'money',
align:'right'
}
],
planTotal:0,
}
},
methods: {
//
isInArray(id){
this.detail.plan.map(item=>{
return item.value.plan_id === id ? true : false
})
},
//
selectPlan(e,row){
if(e){
this.detail.plan.push({
label:row.name,
value:{
plan_id:row.id,
use_money:row.useMoney ?? row.money,
new_money:row.money
}
})
}else{
this.detail.plan.map((item,index)=>{
if(item.value.plan_id === row.id){
this.detail.plan.splice(index,1)
}
})
}
},
delPlan(val){
this.detail.plan.map((item,index)=>{
if(item.value.plan_id === val.value.plan_id){
this.detail.plan.splice(index,1)
}
})
},
//
async getBudgets(){
let res = await getBudget({name:this.planSearch,page_size:10,page:this.plansPageIndex})
this.plans = res.data
this.planTotal = res.total
},
planPageChange(e){
this.plansPageIndex = e
this.getBudgets()
},
async getDetail(id){
let res = await detailContract({id:id})
this.contrantId = res.id
this.detail = {
name:res.name,
type:res.type,
methods:res.purchase_type_id,
modality:res.purchase_way_id,
fundingChannels:res.money_way_id,
price:res.plan_price,
isBudget:res.is_plan === 1 ? true : false,
plan:res.plans.map(item=>{
return {
label:item.name,
value:{
plan_id:item.id,
use_money:item.useMoney ?? item.money,
new_money:item.money
}
}
})
}
},
editor(){
editorContract({
id:this.contrantId,
type:this.detail.type,
is_plan:this.detail.isBudget ? 1 : 0,
purchase_type_id:this.detail.methods,
purchase_way_id:this.detail.modality,
money_way_id:this.detail.fundingChannels,
plan_price:this.detail.price,
name:this.detail.name,
contract_plan_links:this.detail.plan.map(item=>{
return item.value
})
}).then(res=>{
this.isShowEditor = false
Message({
type:'success',
message:"操作成功"
})
this.$emit('success')
})
}
},
mounted() {
}
}
</script>
<style scoped lang="scss">
.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;
}
}
</style>

@ -82,7 +82,17 @@
</slot>
</lx-header>
<xy-table :table-item="table" :list="list" @delete="(row)=>deleteContract(row.id)"></xy-table>
<xy-table :table-item="table" :list="list" @editor="" @delete="(row)=>deleteContract(row.id)">
<template v-slot:btns>
<el-table-column label="操作" fixed="right" width="200" header-align="center">
<template slot-scope="scope">
<Button type="error" size="small" @click="()=>deleteContract(scope.row.id)" ghost>删除</Button>
<Button type="primary" size="small" style="margin-left: 6px;" @click="isShowDetail = true">查看</Button>
<Button type="primary" size="small" style="margin-left: 6px;" @click="$refs['editor'].isShowEditor = true,$refs['editor'].getDetail(scope.row.id)">编辑</Button>
</template>
</el-table-column>
</template>
</xy-table>
<div style="display: flex;justify-content: flex-end;">
<Page :total="total" show-elevator @on-change="pageChange"/>
@ -244,7 +254,7 @@
<div class="contract-add-plan" style="width: 300px;" @click="isShowPlan = true,getBudgets()">
<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>
<Tag closable color="primary" @on-close="delPlan(item,'add')">{{item.label}}</Tag>
</template>
</template>
<template v-else>
@ -261,7 +271,7 @@
<template v-slot:normalContent>
<Input v-model="planSearch" search enter-button=" " placeholder="搜索预算计划.." @on-search="getBudgets"/>
<xy-table :list="plans" :show-index="false" :table-item="planTable" :height="240" style="margin-top: 10px;">
<xy-table :list="plans" :show-index="false" :table-item="planTable" :height="300" style="margin-top: 10px;">
<template v-slot:btns>
<el-table-column label="使用金额" header-align="center">
<template slot-scope="scope">
@ -281,6 +291,8 @@
</template>
</xy-dialog>
<editor :is-show-editor.sync="isShowEditor" :purchase-type="purchaseType" :purchase-way="purchaseWay" :money-way="moneyWay" ref="editor" @success="getContracts"></editor>
<!-- 付款登记-->
<xy-dialog title="付款登记" :is-show.sync="isShowPaymentRegistration" type="form" class="payment-registration" :form="paymentRegistrationForm" :rules="paymentRegistrationRules">
<template v-slot:extraFormTop>
@ -360,17 +372,22 @@
</template>
<script>
import {getContract,addContrant,delContract,detailContract} from "@/api/contract/contract"
import {getContract,addContrant,delContract,detailContract,editorContract} from "@/api/contract/contract"
import {getparameter} from "@/api/system/dictionary"
import {listdept} from "@/api/system/department";
import {getBudget} from "@/api/budget/budget"
import {parseTime} from "@/utils"
import {Message} from "element-ui";
import editor from "./components/editorContract"
export default {
components:{
editor
},
data() {
var planPass = (rule, value, callback) => {
if(this.form.isBudget){
if(this.form.plan == ''){
if(this.form.plan.length === 0){
return callback(new Error('必选'))
}else{
callback()
@ -657,6 +674,8 @@ export default {
planSearch:'',
planTotal:0,
plansPageIndex:1,
isShowEditor:false
}
},
methods: {
@ -749,7 +768,7 @@ export default {
console.log(this.form)
addContrant({
type:this.form.type,
is_plan:this.form.isBudget,
is_plan:this.form.isBudget ? 1 : 0,
purchase_type_id:this.form.methods,
purchase_way_id:this.form.modality,
money_way_id:this.form.fundingChannels,
@ -778,7 +797,8 @@ export default {
})
this.getContracts()
})
}
},
},
mounted() {
this.getPurchaseType()

Loading…
Cancel
Save