|
|
@@ -9,129 +9,153 @@
|
|
|
width="80%"
|
|
|
@close="cancel"
|
|
|
>
|
|
|
-
|
|
|
- <headerTitle title="基本信息"></headerTitle>
|
|
|
- <el-form
|
|
|
- label-width="120px"
|
|
|
- ref="form"
|
|
|
- :model="form"
|
|
|
- :rules="rules"
|
|
|
- style="margin-top: 30px"
|
|
|
- >
|
|
|
- <el-row>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item
|
|
|
- label="选择客户"
|
|
|
- prop="contactName"
|
|
|
- >
|
|
|
- <el-input placeholder="请选择" v-model="form.contactName" @click.native="handParent" maxlength="50"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label=" 商机名称" prop="name">
|
|
|
- <el-input placeholder="请输入" v-model="form.name" maxlength="50"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="选择负责人" prop="responsibleName">
|
|
|
- <el-input placeholder="请选择" v-model="userInfo.name" disabled maxlength="50"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="商机来源" prop="sourceCode">
|
|
|
- <DictSelection dictName="商机来源" clearable v-model="form.sourceCode">
|
|
|
- </DictSelection>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="赢单率" prop="winRate">
|
|
|
- <el-input placeholder="请输入内容" v-model="form.winRate" >
|
|
|
- <template slot="append">%</template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="预算" prop="budget" >
|
|
|
- <el-input placeholder="请输入内容" v-model="form.budget" >
|
|
|
- <template slot="append">万元</template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="预计结单日期" prop="expectedClosingDate">
|
|
|
- <el-date-picker
|
|
|
- v-model="form.expectedClosingDate"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- placeholder="请选择"
|
|
|
- type="date"
|
|
|
- style="width: 200px"
|
|
|
- class="filter-item"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="商机阶段" prop="stageCode">
|
|
|
- <DictSelection dictName="商机阶段" clearable v-model="form.stageCode">
|
|
|
- </DictSelection>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="16">
|
|
|
- <el-form-item
|
|
|
- label="备注"
|
|
|
- prop="remark"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- placeholder="请输入"
|
|
|
- v-model="form.remark"
|
|
|
- type="textarea"
|
|
|
- maxlength="300"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
-
|
|
|
- <headerTitle title="竞品"></headerTitle>
|
|
|
- <businessAddTable
|
|
|
- ref="businessAddTable"
|
|
|
- @timeAll="getDetailTable"
|
|
|
- :delDetailIds="delDetailIds"
|
|
|
- ></businessAddTable>
|
|
|
-
|
|
|
- <headerTitle title="关键人信息"></headerTitle>
|
|
|
- <personnelAddTable
|
|
|
- ref="personnelAddTable"
|
|
|
- :contactId="form.contactId"
|
|
|
- @timeAll="getPersonnelAddTable"
|
|
|
- :delDetailIds="PersonnelDetailIds"
|
|
|
- ></personnelAddTable>
|
|
|
+ <headerTitle title="基本信息"></headerTitle>
|
|
|
+ <el-form
|
|
|
+ label-width="120px"
|
|
|
+ ref="form"
|
|
|
+ :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ style="margin-top: 30px"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="选择客户" prop="contactName">
|
|
|
+ <el-input
|
|
|
+ placeholder="请选择"
|
|
|
+ v-model="form.contactName"
|
|
|
+ @click.native="handParent"
|
|
|
+ maxlength="50"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label=" 商机名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="form.name"
|
|
|
+ maxlength="50"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="选择负责人" prop="responsibleName">
|
|
|
+ <el-input
|
|
|
+ placeholder="请选择"
|
|
|
+ v-model="userInfo.name"
|
|
|
+ disabled
|
|
|
+ maxlength="50"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="商机来源" prop="sourceCode">
|
|
|
+ <DictSelection
|
|
|
+ dictName="商机来源"
|
|
|
+ clearable
|
|
|
+ v-model="form.sourceCode"
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="赢单率" prop="winRate">
|
|
|
+ <el-input placeholder="请输入内容" v-model="form.winRate">
|
|
|
+ <template slot="append">%</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="预算" prop="budget">
|
|
|
+ <el-input placeholder="请输入内容" v-model="form.budget">
|
|
|
+ <template slot="append">万元</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="预计结单日期" prop="expectedClosingDate">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.expectedClosingDate"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择"
|
|
|
+ type="date"
|
|
|
+ style="width: 200px"
|
|
|
+ class="filter-item"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="商机阶段" prop="stageCode">
|
|
|
+ <DictSelection
|
|
|
+ dictName="商机阶段"
|
|
|
+ clearable
|
|
|
+ v-model="form.stageCode"
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入"
|
|
|
+ v-model="form.remark"
|
|
|
+ type="textarea"
|
|
|
+ maxlength="300"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <headerTitle title="竞品"></headerTitle>
|
|
|
+ <businessAddTable
|
|
|
+ ref="businessAddTable"
|
|
|
+ @timeAll="getDetailTable"
|
|
|
+ :delDetailIds="delDetailIds"
|
|
|
+ ></businessAddTable>
|
|
|
+
|
|
|
+ <headerTitle title="关键人信息"></headerTitle>
|
|
|
+ <personnelAddTable
|
|
|
+ ref="personnelAddTable"
|
|
|
+ :contactId="form.contactId"
|
|
|
+ @timeAll="getPersonnelAddTable"
|
|
|
+ :delDetailIds="PersonnelDetailIds"
|
|
|
+ ></personnelAddTable>
|
|
|
<div slot="footer" class="footer">
|
|
|
<el-button type="primary" @click="save">保存</el-button>
|
|
|
<el-button @click="cancel">返回</el-button>
|
|
|
</div>
|
|
|
- <head-list ref="headRef" @changeParent="changeHead"></head-list>
|
|
|
- <parentList ref="parentRef" classType="1" @changeParent="changeParent"></parentList>
|
|
|
+ <head-list ref="headRef" @changeParent="changeHead"></head-list>
|
|
|
+ <parentList
|
|
|
+ ref="parentRef"
|
|
|
+ classType="1"
|
|
|
+ @changeParent="changeParent"
|
|
|
+ ></parentList>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import store from '@/store';
|
|
|
-import {categoryData} from 'element-china-category-data';
|
|
|
-import fileUpload from '@/components/upload/fileUpload';
|
|
|
-import {cityData} from 'ele-admin/packages/utils/regions';
|
|
|
-import dictMixins from '@/mixins/dictMixins';
|
|
|
-import businessAddTable from './businessAddTable.vue'
|
|
|
-import personnelAddTable from './personnelAddTable.vue'
|
|
|
-import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
-import personSelect from '@/components/CommomSelect/person-select.vue';
|
|
|
-import {listOrganizations} from '@/api/system/organization';
|
|
|
-import parentList from '@/views/saleManage/contact/components/parentList.vue'
|
|
|
-import { getDetail, UpdateInformation, addInformation,deleteInformation,updateStatus} from '@/api/saleManage/businessOpportunity';
|
|
|
-import headList from './headList.vue'
|
|
|
-import {copyObj} from '@/utils/util';
|
|
|
-
|
|
|
+ import store from '@/store';
|
|
|
+ import { categoryData } from 'element-china-category-data';
|
|
|
+ import fileUpload from '@/components/upload/fileUpload';
|
|
|
+ import { cityData } from 'ele-admin/packages/utils/regions';
|
|
|
+ import dictMixins from '@/mixins/dictMixins';
|
|
|
+ import businessAddTable from './businessAddTable.vue';
|
|
|
+ import personnelAddTable from './personnelAddTable.vue';
|
|
|
+ import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
+ import personSelect from '@/components/CommomSelect/person-select.vue';
|
|
|
+ import { listOrganizations } from '@/api/system/organization';
|
|
|
+ import parentList from '@/views/saleManage/contact/components/parentList.vue';
|
|
|
+ import {
|
|
|
+ getDetail,
|
|
|
+ UpdateInformation,
|
|
|
+ addInformation,
|
|
|
+ deleteInformation,
|
|
|
+ updateStatus
|
|
|
+ } from '@/api/saleManage/businessOpportunity';
|
|
|
+ import headList from './headList.vue';
|
|
|
+ import { copyObj } from '@/utils/util';
|
|
|
|
|
|
-export default {
|
|
|
+ export default {
|
|
|
props: {
|
|
|
categoryTreeList: Array
|
|
|
},
|
|
|
@@ -147,31 +171,31 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
let formDef = {
|
|
|
- id:'',
|
|
|
- contactName: '',
|
|
|
- contactId: '',
|
|
|
- budget:null,
|
|
|
- expectedClosingDate:'',
|
|
|
- sourceCode:'',
|
|
|
- sourceName:'',
|
|
|
- stageCode:'',
|
|
|
- stageName:'',
|
|
|
- winRate:null,
|
|
|
- name: '',
|
|
|
- remark: '',
|
|
|
- responsibleName: '',
|
|
|
- responsibleId: '',
|
|
|
- source: '',
|
|
|
- status: 1
|
|
|
- };
|
|
|
-
|
|
|
+ id: '',
|
|
|
+ contactName: '',
|
|
|
+ contactId: '',
|
|
|
+ budget: null,
|
|
|
+ expectedClosingDate: '',
|
|
|
+ sourceCode: '',
|
|
|
+ sourceName: '',
|
|
|
+ stageCode: '',
|
|
|
+ stageName: '',
|
|
|
+ winRate: null,
|
|
|
+ name: '',
|
|
|
+ remark: '',
|
|
|
+ responsibleName: '',
|
|
|
+ responsibleId: '',
|
|
|
+ source: '',
|
|
|
+ status: 1
|
|
|
+ };
|
|
|
+
|
|
|
return {
|
|
|
delDetailIds: [],
|
|
|
- PersonnelDetailIds:[],
|
|
|
+ PersonnelDetailIds: [],
|
|
|
visible: false,
|
|
|
title: '',
|
|
|
row: {},
|
|
|
- userInfo:{},
|
|
|
+ userInfo: {},
|
|
|
activeName: 'base',
|
|
|
formDef,
|
|
|
form: copyObj(formDef),
|
|
|
@@ -179,7 +203,7 @@ export default {
|
|
|
// removeLinkList: [],
|
|
|
tableBankData: [],
|
|
|
tableLinkData: [],
|
|
|
-
|
|
|
+
|
|
|
rules: {
|
|
|
contactName: [
|
|
|
{ required: true, message: '请选择客户', trigger: 'change' }
|
|
|
@@ -187,62 +211,71 @@ export default {
|
|
|
name: [
|
|
|
{ required: true, message: '请输入商机名称', trigger: 'blur' }
|
|
|
],
|
|
|
- expectedClosingDate:[
|
|
|
+ expectedClosingDate: [
|
|
|
{ required: true, message: '请选择预计结单日期', trigger: 'blur' }
|
|
|
],
|
|
|
- sourceCode:[
|
|
|
- { required: true, message: '请选择商机来源名称', trigger: 'change' }
|
|
|
+ sourceCode: [
|
|
|
+ { required: true, message: '请选择商机来源名称', trigger: 'change' }
|
|
|
],
|
|
|
- stageCode:[
|
|
|
- { required: true, message: '请选择商机阶段名称', trigger: 'change' }
|
|
|
+ stageCode: [
|
|
|
+ { required: true, message: '请选择商机阶段名称', trigger: 'change' }
|
|
|
],
|
|
|
- winRate:[
|
|
|
- {
|
|
|
+ winRate: [
|
|
|
+ {
|
|
|
required: false,
|
|
|
trigger: 'blur',
|
|
|
validator: (_rule, value, callback) => {
|
|
|
+ console.log(_rule)
|
|
|
const reg = /^\d+(\.\d{1,2})?$/; // 限制为最多两位小数的正数
|
|
|
+ if (!value) {
|
|
|
+ callback( ); // 验证通过
|
|
|
+ return
|
|
|
+ }
|
|
|
if (reg.test(value) && parseFloat(value) <= 100) {
|
|
|
callback(); // 验证通过
|
|
|
} else {
|
|
|
- value = value.replace(/[^0-9.]/g, ''); // 只保留数字和小数点
|
|
|
- const [integerPart, decimalPart] = value.split('.');
|
|
|
- if (decimalPart && decimalPart.length > 2) {
|
|
|
- callback(new Error('小数位数不能超过两位'));
|
|
|
- }else {
|
|
|
- callback(new Error('只能输入小于100的数字'));
|
|
|
- }
|
|
|
+ value = value && value.replace(/[^0-9.]/g, ''); // 只保留数字和小数点
|
|
|
+ const [integerPart, decimalPart] = value && value.split('.');
|
|
|
+ if (decimalPart && decimalPart.length > 2) {
|
|
|
+ callback(new Error('小数位数不能超过两位'));
|
|
|
+ } else {
|
|
|
+ callback(new Error('只能输入小于100的数字'));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
- budget:[
|
|
|
- {
|
|
|
+ budget: [
|
|
|
+ {
|
|
|
required: false,
|
|
|
trigger: 'blur',
|
|
|
validator: (_rule, value, callback) => {
|
|
|
const reg = /^\d{1,13}(\.\d{1,2})?$/; // 限制为最多两位小数的13位以内的正数
|
|
|
- if (reg.test(value)) {
|
|
|
- callback(); // 验证通过
|
|
|
- } else {
|
|
|
- value = value.replace(/[^0-9.]/g, ''); // 只保留数字和小数点
|
|
|
- const [integerPart, decimalPart] = value.split('.');
|
|
|
- if (decimalPart && decimalPart.length > 2) {
|
|
|
- callback(new Error('小数位数不能超过两位'));
|
|
|
- } else if (integerPart.length > 13) {
|
|
|
- callback(new Error('整数位数不能超过13位'));
|
|
|
- }else {
|
|
|
- callback(new Error('只能输入数字'));
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!value) {
|
|
|
+ callback(); // 验证通过
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (reg.test(value)) {
|
|
|
+ callback(); // 验证通过
|
|
|
+ } else {
|
|
|
+ value = value && value.replace(/[^0-9.]/g, ''); // 只保留数字和小数点
|
|
|
+ const [integerPart, decimalPart] = value && value.split('.');
|
|
|
+ if (decimalPart && decimalPart.length > 2) {
|
|
|
+ callback(new Error('小数位数不能超过两位'));
|
|
|
+ } else if (integerPart.length > 13) {
|
|
|
+ callback(new Error('整数位数不能超过13位'));
|
|
|
+ } else {
|
|
|
+ callback(new Error('只能输入数字'));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
options: {
|
|
|
cityData,
|
|
|
- categoryData,
|
|
|
+ categoryData
|
|
|
},
|
|
|
// 提交状态
|
|
|
loading: false,
|
|
|
@@ -252,178 +285,180 @@ export default {
|
|
|
// 组织机构树形结构数据
|
|
|
groupTreeData: [],
|
|
|
// 组织机构平铺数据
|
|
|
- groupData: [],
|
|
|
+ groupData: []
|
|
|
};
|
|
|
},
|
|
|
- mounted(){
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.userInfo=store.state.user.info
|
|
|
- })
|
|
|
-
|
|
|
+ mounted() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.userInfo = store.state.user.info;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
//获取竞品
|
|
|
- getDetailTable (val) {
|
|
|
+ getDetailTable(val) {
|
|
|
this.form.competAnalysisList = val;
|
|
|
},
|
|
|
//获取关键人信息
|
|
|
- getPersonnelAddTable(val){
|
|
|
+ getPersonnelAddTable(val) {
|
|
|
this.form.partyList = val;
|
|
|
},
|
|
|
//选择客户回调
|
|
|
changeParent(obj) {
|
|
|
- this.$set( this.form, 'contactId', obj.id)
|
|
|
- this.$set( this.form, 'contactName', obj.name)
|
|
|
-
|
|
|
+ this.$set(this.form, 'contactId', obj.id);
|
|
|
+ this.$set(this.form, 'contactName', obj.name);
|
|
|
},
|
|
|
//选择负责人回调
|
|
|
changeHead(obj) {
|
|
|
- this.$set( this.form, 'responsibleId', obj.id)
|
|
|
- this.$set( this.form, 'responsibleName', obj.name)
|
|
|
+ this.$set(this.form, 'responsibleId', obj.id);
|
|
|
+ this.$set(this.form, 'responsibleName', obj.name);
|
|
|
},
|
|
|
handParent() {
|
|
|
let item = {
|
|
|
- id: this.form.contactId
|
|
|
- }
|
|
|
- this.$refs.parentRef.open(item)
|
|
|
+ id: this.form.contactId
|
|
|
+ };
|
|
|
+ this.$refs.parentRef.open(item);
|
|
|
},
|
|
|
- handHead(){
|
|
|
+ handHead() {
|
|
|
let item = {
|
|
|
- id: this.form.responsibleId
|
|
|
- }
|
|
|
- this.$refs.headRef.open(item)
|
|
|
+ id: this.form.responsibleId
|
|
|
+ };
|
|
|
+ this.$refs.headRef.open(item);
|
|
|
},
|
|
|
async open(type, row, contactCategoryId) {
|
|
|
- this.title = type==='add'?'新增':'修改';
|
|
|
+ this.title = type === 'add' ? '新增' : '修改';
|
|
|
this.row = row;
|
|
|
this.visible = true;
|
|
|
if (type == 'add') {
|
|
|
this.isUpdate = false;
|
|
|
} else {
|
|
|
this.isUpdate = true;
|
|
|
- this.getDetailData(row.id)
|
|
|
+ this.getDetailData(row.id);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//获取详情
|
|
|
- async getDetailData (id) {
|
|
|
+ async getDetailData(id) {
|
|
|
this.loading = true;
|
|
|
const data = await getDetail(id);
|
|
|
this.loading = false;
|
|
|
if (data) {
|
|
|
- this.$nextTick(()=>{
|
|
|
+ this.$nextTick(() => {
|
|
|
this.form = data;
|
|
|
- this.$refs.businessAddTable&&this.$refs.businessAddTable.putTableValue(data.competAnalysisList)
|
|
|
- this.$refs.personnelAddTable&&this.$refs.personnelAddTable.putTableValue(data.partyList)
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
+ this.$refs.businessAddTable &&
|
|
|
+ this.$refs.businessAddTable.putTableValue(
|
|
|
+ data.competAnalysisList
|
|
|
+ );
|
|
|
+ this.$refs.personnelAddTable &&
|
|
|
+ this.$refs.personnelAddTable.putTableValue(data.partyList);
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- salesmanChange(val, info){
|
|
|
+ salesmanChange(val, info) {
|
|
|
this.otherForm.salesmanName = info.name;
|
|
|
},
|
|
|
- settlementModeChange(info){
|
|
|
+ settlementModeChange(info) {
|
|
|
this.otherForm.settlementModeName = info.dictValue;
|
|
|
},
|
|
|
- ifChiefChange(value, idx){
|
|
|
- if(value === 1){
|
|
|
- this.tableLinkData.forEach(e => e.ifChief = 0);
|
|
|
+ ifChiefChange(value, idx) {
|
|
|
+ if (value === 1) {
|
|
|
+ this.tableLinkData.forEach((e) => (e.ifChief = 0));
|
|
|
this.tableLinkData[idx].ifChief = 1;
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
getValidate() {
|
|
|
return Promise.all([
|
|
|
- new Promise((resolve, reject) => {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
- if (!valid) {
|
|
|
- reject(false);
|
|
|
- } else {
|
|
|
- resolve(true);
|
|
|
- }
|
|
|
- });
|
|
|
- }),
|
|
|
- new Promise((resolve, reject) => {
|
|
|
- this.$refs.businessAddTable.validateForm((valid) => {
|
|
|
- if (!valid) {
|
|
|
- reject(false);
|
|
|
- } else {
|
|
|
- resolve(true);
|
|
|
- }
|
|
|
- });
|
|
|
- }),
|
|
|
- new Promise((resolve, reject) => {
|
|
|
- this.$refs.personnelAddTable.validateForm((valid) => {
|
|
|
- if (!valid) {
|
|
|
- reject(false);
|
|
|
- } else {
|
|
|
- resolve(true);
|
|
|
- }
|
|
|
- });
|
|
|
- }),
|
|
|
-
|
|
|
- ]);
|
|
|
- },
|
|
|
- async save() {
|
|
|
- try {
|
|
|
-
|
|
|
- await this.getValidate();
|
|
|
- // 表单验证通过,执行保存操作
|
|
|
- this.loading = true;
|
|
|
-
|
|
|
- if (!this.isUpdate) {
|
|
|
- delete this.form.id;
|
|
|
- }
|
|
|
- let _sourceName=this.getDictValue('商机来源', this.form.sourceCode),_stageName=this.getDictValue('商机阶段', this.form.stageCode)
|
|
|
- this.form=Object.assign({},this.form,{responsibleId:this.userInfo.userId,responsibleName:this.userInfo.name,sourceName:_sourceName,stageName:_stageName})
|
|
|
- const commitData={opportunity:this.form,competAnalysisList:this.$refs.businessAddTable.getTableValue(),partyList:this.$refs.personnelAddTable.getTableValue()}
|
|
|
- if (this.isUpdate) {
|
|
|
- UpdateInformation(commitData)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success("修改成功");
|
|
|
- this.cancel();
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- //this.loading = false;
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
});
|
|
|
- } else {
|
|
|
- addInformation(commitData)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success("新增成功");
|
|
|
- this.cancel();
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- //this.loading = false;
|
|
|
+ }),
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ this.$refs.businessAddTable.validateForm((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }),
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ this.$refs.personnelAddTable.validateForm((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
});
|
|
|
+ }),
|
|
|
+ ]);
|
|
|
+ },
|
|
|
+ async save() {
|
|
|
+
|
|
|
+ try {
|
|
|
+ await this.getValidate();
|
|
|
+ // 表单验证通过,执行保存操作
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ if (!this.isUpdate) {
|
|
|
+ delete this.form.id;
|
|
|
+ }
|
|
|
+ let _sourceName = this.getDictValue('商机来源', this.form.sourceCode),
|
|
|
+ _stageName = this.getDictValue('商机阶段', this.form.stageCode);
|
|
|
+ this.form = Object.assign({}, this.form, {
|
|
|
+ responsibleId: this.userInfo.userId,
|
|
|
+ responsibleName: this.userInfo.name,
|
|
|
+ sourceName: _sourceName,
|
|
|
+ stageName: _stageName
|
|
|
+ });
|
|
|
+ const commitData = {
|
|
|
+ opportunity: this.form,
|
|
|
+ competAnalysisList: this.$refs.businessAddTable.getTableValue(),
|
|
|
+ partyList: this.$refs.personnelAddTable.getTableValue()
|
|
|
+ };
|
|
|
+ if (this.isUpdate) {
|
|
|
+ UpdateInformation(commitData)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success('修改成功');
|
|
|
+ this.cancel();
|
|
|
+ this.$emit('done');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ //this.loading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addInformation(commitData)
|
|
|
+ .then((res) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success('新增成功');
|
|
|
+ this.cancel();
|
|
|
+ this.$emit('done');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ //this.loading = false;
|
|
|
+ });
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log(error)
|
|
|
+ console.log(error);
|
|
|
// 表单验证未通过,不执行保存操作
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
cancel() {
|
|
|
this.$nextTick(() => {
|
|
|
this.activeName = 'base';
|
|
|
// 关闭后,销毁所有的表单数据
|
|
|
- this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
|
|
|
- this.$refs['formRef'] && this.$refs['formRef'].resetFields();
|
|
|
- this.form = copyObj(this.formDef)
|
|
|
+ this.$refs['otherForm'] && this.$refs['otherForm'].resetFields();
|
|
|
+ this.$refs['formRef'] && this.$refs['formRef'].resetFields();
|
|
|
+ this.form = copyObj(this.formDef);
|
|
|
this.visible = false;
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
</script>
|