parent
c00d029012
commit
f7e66c1cdf
@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div>
|
||||
<Modal width="54" v-model="isShow" title="合同拆分" @on-ok="submit">
|
||||
<div style="margin-bottom: 10px;display: flex;justify-content: space-between;">
|
||||
<span>新增拆分合同</span>
|
||||
<el-button type="primary" icon="el-icon-plus" size="small" @click="form.data.push({pid: '',name: row.name,plan_price: row.plan_price})">新增</el-button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<el-form :model="form" ref="dynamicValidateForm" label-width="100px">
|
||||
<template v-for="(item, index) in form.data">
|
||||
<div>
|
||||
<Tag color="primary" style="height: 28px;line-height: 28px;">{{ '合同'+(index+1) }}</Tag>
|
||||
<el-button size="mini" type="danger" @click.prevent="form.data.splice(index,1)">删除</el-button>
|
||||
</div>
|
||||
<el-form-item
|
||||
label="名称"
|
||||
:prop="'data['+index+'].name'"
|
||||
:rules="{required: true, message: '名称不能为空', trigger: 'blur'}"
|
||||
>
|
||||
<el-input v-model="item.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="计划金额"
|
||||
:prop="'data['+index+'].plan_price'"
|
||||
:rules="{required: true, message: '计划金额不能为空', trigger: 'blur'}"
|
||||
>
|
||||
<el-input-number :min="0" :precision="2" :controls="false" v-model="item.plan_price"></el-input-number>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-form>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { cloneChildren, detailContract } from "@/api/contract/contract";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: "",
|
||||
isShow: false,
|
||||
nums: 1,
|
||||
|
||||
form: {
|
||||
data: [
|
||||
]
|
||||
},
|
||||
row: {}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
setId(id) {
|
||||
this.id = id;
|
||||
},
|
||||
show() {
|
||||
this.isShow = true;
|
||||
},
|
||||
hide() {
|
||||
this.isShow = false;
|
||||
},
|
||||
|
||||
async getDetail() {
|
||||
this.row = await detailContract({ id: this.id })
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dynamicValidateForm'].validate(valid => {
|
||||
if(valid) {
|
||||
let subData = this.form.data.map(i => ({
|
||||
...this.row,
|
||||
...i,
|
||||
pid: this.id,
|
||||
id: "",
|
||||
is_substitute: 1
|
||||
}))
|
||||
|
||||
cloneChildren({
|
||||
data: subData
|
||||
}).then(res => {
|
||||
this.$message.success("操作成功")
|
||||
this.hide()
|
||||
this.$emit('refresh')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if (newVal) {
|
||||
this.getDetail();
|
||||
} else {
|
||||
this.form.data = []
|
||||
}
|
||||
},
|
||||
id(newVal) {
|
||||
this.getDetail()
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
Loading…
Reference in new issue