|
|
|
@ -172,7 +172,10 @@ |
|
|
|
</el-form> |
|
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;"> |
|
|
|
<el-form-item prop="customerNo" v-if="!modalPartDisableFlag" :rules="rules.customerNo" > |
|
|
|
<span slot="label" style="" @click="getBaseList(509)"><a herf="#">客户编码</a></span> |
|
|
|
<span slot="label" style=""> |
|
|
|
<a herf="#" @click="getBaseList(509)">客户编码</a> |
|
|
|
<a herf="#" @click="newCustomer">(新客户)</a> |
|
|
|
</span> |
|
|
|
<el-input v-model="modalData.customerNo" disabled style="width: 110px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="客户编码" v-if="modalPartDisableFlag" prop="customerNo" :rules="rules.customerNo"> |
|
|
|
@ -276,6 +279,19 @@ |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!--新客户客户名称输入弹框--> |
|
|
|
<el-dialog title="新客户" :close-on-click-modal="false" @close="closeNewCustomer" v-drag :visible.sync="newCustomerFlag" width="348px"> |
|
|
|
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;"> |
|
|
|
<el-form-item label="客户名称" prop="customerDesc" :rules="rules.customerDesc"> |
|
|
|
<el-input v-model="modalData.customerDesc" style="width: 313px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-footer style="height:40px;margin-top: 10px;text-align:center"> |
|
|
|
<el-button type="primary" @click="saveNewCustomer()">保存</el-button> |
|
|
|
<el-button @click="newCustomerFlag = false">关闭</el-button> |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!--项目经理选择弹框--> |
|
|
|
<el-dialog title="PM/Sales" @close="closeProjectManagerInfoDialog" @open="openProjectManagerInfoDialog" :visible.sync="projectManagerFlag" width="559px" v-drag> |
|
|
|
<el-form inline="inline" label-position="top" :model="searchBusinessData" style="margin-left: 7px;margin-top: -5px;"> |
|
|
|
@ -711,7 +727,7 @@ import { |
|
|
|
eamProjectPartInfoDelete, |
|
|
|
eamProjectPartInfoEdit, |
|
|
|
eamProjectPartInfoSave, |
|
|
|
eamProjectPartSearch |
|
|
|
eamProjectPartSearch, getCustomerNo, saveNewCustomer |
|
|
|
} from "../../../api/eam/eamProject"; |
|
|
|
import row from "element-ui/packages/row"; |
|
|
|
import 'moment/locale/zh-cn'; |
|
|
|
@ -797,6 +813,7 @@ import {EventBus} from "../../../main"; |
|
|
|
IPQCFlag:false, |
|
|
|
FQCFlag:false, |
|
|
|
MFGlag:false, |
|
|
|
newCustomerFlag:false, |
|
|
|
modalData:{ |
|
|
|
flag:'', |
|
|
|
bu: '', |
|
|
|
@ -2075,6 +2092,81 @@ import {EventBus} from "../../../main"; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
newCustomer () { |
|
|
|
this.modalData.customerNo = '' |
|
|
|
this.modalData.customerDesc = '' |
|
|
|
this.newCustomerFlag = true |
|
|
|
}, |
|
|
|
|
|
|
|
saveNewCustomer () { |
|
|
|
this.generateNextCustomerNo().then((customerNo) => { |
|
|
|
if (customerNo !== false) { |
|
|
|
this.modalData.customerNo = customerNo |
|
|
|
let tempData = { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
customerNo: customerNo, |
|
|
|
customerDesc: this.modalData.customerDesc, |
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
} |
|
|
|
saveNewCustomer(tempData).then(({data}) => { |
|
|
|
if (data.code === 0) { |
|
|
|
this.modalData.customerNo = '' |
|
|
|
this.modalData.customerDesc = '' |
|
|
|
this.$message.success(data.msg) |
|
|
|
this.newCustomerFlag = false |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
this.$alert('该客户已存在,请重新输入客户名称!', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
generateNextCustomerNo() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
getCustomerNo(this.modalData).then(({ data }) => { |
|
|
|
if (data.code === 0){ |
|
|
|
if (data.data === null || data.data === undefined || data.data === '' || data.data === '0') { |
|
|
|
resolve('C0001'); |
|
|
|
} else { |
|
|
|
const stringData = String(data.data.customerNo); // 显式转换为字符串 |
|
|
|
const lastCustomerNo = parseInt(stringData.substring(1)); |
|
|
|
const nextCustomerNo = lastCustomerNo + 1; |
|
|
|
let customerNo; |
|
|
|
|
|
|
|
if (nextCustomerNo < 10) { |
|
|
|
customerNo = 'C000' + nextCustomerNo; |
|
|
|
} else if (nextCustomerNo < 100) { |
|
|
|
customerNo = 'C00' + nextCustomerNo; |
|
|
|
} else if (nextCustomerNo < 1000) { |
|
|
|
customerNo = 'C0' + nextCustomerNo; |
|
|
|
} else { |
|
|
|
customerNo = 'C' + nextCustomerNo; |
|
|
|
} |
|
|
|
resolve(customerNo); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
resolve(false); |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
reject('Failed to fetch customerNo: ' + error); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
closeNewCustomer () { |
|
|
|
this.modalData.customerNo = '' |
|
|
|
this.modalData.customerDesc = '' |
|
|
|
this.newCustomerFlag = false |
|
|
|
}, |
|
|
|
|
|
|
|
// 校验用户是否收藏 |
|
|
|
favoriteIsOk () { |
|
|
|
let userFavorite = { |
|
|
|
|