<template>
|
<div class="advance">
|
<el-dialog
|
:title="'推进'"
|
append-to-body
|
:visible.sync="commonConfig.visible"
|
:width="dialogWidth"
|
:before-close="handleClose"
|
custom-class="advance-dialog"
|
>
|
<div class="content">
|
<el-radio-group v-model="radio">
|
<div class="one">
|
<el-radio :label="1">
|
<span>推进到下一阶段</span>
|
<el-select v-model="value1" size="mini" disabled>
|
<el-option v-for="(item, index) in options" :key="index" :label="item.name" :value="item.id">
|
</el-option>
|
</el-select>
|
</el-radio>
|
</div>
|
<div class="two">
|
<el-radio :label="2">
|
<span>推进到指定阶段</span>
|
<el-select v-model="value" size="mini" @change="designatedStageClick">
|
<el-option v-for="(item, index) in options" :key="index" :label="item.name" :value="item.id">
|
</el-option>
|
</el-select>
|
</el-radio>
|
</div>
|
</el-radio-group>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" size="small" @click="saveClick()">推进</el-button>
|
<el-button size="small" @click="commonConfig.visible = false">取消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { pushSaleChance } from "@/api/sales/salesOpportunity"
|
export default {
|
name: "DetailAdvanceDialog",
|
props: {
|
advanceConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
active: "需求分析",
|
allOptions: [],
|
options: [],
|
id: 0
|
}
|
}
|
}
|
},
|
components: {},
|
computed: {},
|
data() {
|
return {
|
allOptions: this.advanceConfig.allOptions,
|
dialogWidth: "25%",
|
radio: 1,
|
commonConfig: this.advanceConfig,
|
value1: "",
|
value: "",
|
options: this.advanceConfig.options
|
}
|
},
|
watch: {},
|
created() {
|
this.setData()
|
},
|
methods: {
|
setData() {
|
this.allOptions.map((item, index) => {
|
if (item.id === this.commonConfig.active) {
|
if (index + 1 === this.allOptions.length) {
|
this.value = this.allOptions[0].id
|
this.value1 = this.allOptions[0].id
|
} else {
|
this.value = this.allOptions[index + 1].id
|
this.value1 = this.allOptions[index + 1].id
|
}
|
|
this.options.splice(index, 1)
|
}
|
})
|
},
|
handleClose() {
|
this.commonConfig.visible = false
|
},
|
designatedStageClick() {
|
this.radio = 2
|
},
|
async saveClick() {
|
let stepId = 0
|
if (this.radio === 2) {
|
stepId = this.value
|
} else {
|
stepId = this.value1
|
}
|
await pushSaleChance({
|
id: this.commonConfig.id,
|
step: stepId
|
}).then((res) => {
|
if (res.code === 200) {
|
this.handleClose()
|
this.$emit('pushed',{
|
id: this.commonConfig.id,
|
step: stepId
|
})
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
::v-deep {
|
.advance-dialog .el-dialog__body {
|
padding: 10px 20px;
|
.content {
|
.el-select {
|
margin-left: 10px;
|
}
|
.two {
|
margin-top: 15px;
|
}
|
}
|
.dialog-footer {
|
background-color: #f5f5f5;
|
height: 55px;
|
line-height: 55px;
|
}
|
}
|
}
|
</style>
|