From 72f6f5abb7d6a90c9edfb69db63907ef3e17ef03 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 22 十一月 2023 11:31:27 +0800
Subject: [PATCH] 销售明细单添加确认订单前确认是否选择项目
---
src/views/client/client/AddClientManageDialog.vue | 351 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 239 insertions(+), 112 deletions(-)
diff --git a/src/views/client/client/AddClientManageDialog.vue b/src/views/client/client/AddClientManageDialog.vue
index f8bf2da..daa8ad8 100644
--- a/src/views/client/client/AddClientManageDialog.vue
+++ b/src/views/client/client/AddClientManageDialog.vue
@@ -5,13 +5,15 @@
:visible.sync="editConfig.visible"
:width="dialogWidth"
:before-close="handleClose"
+ append-to-body
+ custom-class="iframe-dialog"
>
<el-form
ref="form"
:model="editConfig.infomation"
:rules="rules"
label-position="right"
- label-width="308px"
+ label-width="130px"
size="mini"
style="height: 60vh; overflow-x: hidden"
>
@@ -22,17 +24,47 @@
<div class="basic-info-view">
<el-row>
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О" prop="name">
- <div class="client-name">
- <el-input v-model="editConfig.infomation.name"></el-input>
- <div class="common-select-btn"><i class="el-icon-house" title="宸ュ晢鏌ヨ"></i></div>
- <div class="common-select-btn"><i class="el-icon-search" title="鏌ラ噸"></i></div>
- </div>
+ <el-form-item label="瀹㈡埛缂栧彿" prop="number">
+ <el-input
+ v-if="
+ editConfig.title == '缂栬緫' ||
+ (editConfig.title == '鏂板缓' &&
+ codenumer &&
+ (explain != '' || isIdDisabled))
+ "
+ :disabled="editConfig.title == '缂栬緫'"
+ v-model="editConfig.infomation.number"
+ placeholder="璇疯緭鍏ョ紪鐮�"
+ >
+ </el-input>
+ <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c"
+ >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
+ >
+ <!-- <WordInput
+ v-if="codenumer && (explain != '' || isIdDisabled)&&method == 0"
+ :codenumer="codenumer"
+ :sum="sum"
+ :disabled="this.editConfig.title !== '鏂板缓'|| isIdDisabled"
+ :inputValue="inputValue"
+ @codeList="codeList"
+ />
+ <span v-else-if="method == 0" style="color: #f56c6c"
+ >璇蜂紭鍏堥厤缃紪鐮佽鑼�
+ <el-button type="text" @click="numberClick">
+ 閰嶇疆瑙勮寖
+ </el-button
+ ></span
+ >
+ <span v-else>鑷姩鐢熸垚</span> -->
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="瀹㈡埛缂栧彿" prop="number">
- <el-input v-model="editConfig.infomation.number"></el-input>
+ <el-form-item label="瀹㈡埛鍚嶇О" prop="name">
+ <div class="custom-name">
+ <el-input v-model="editConfig.infomation.name"></el-input>
+ <!-- <div class="common-select-btn"><i class="el-icon-house" title="宸ュ晢鏌ヨ"></i></div> -->
+ <!-- <div class="common-select-btn"><i class="el-icon-search" title="鏌ラ噸"></i></div> -->
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -47,7 +79,7 @@
<el-option v-for="item in clientStatusOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -57,7 +89,7 @@
v-model="editConfig.infomation.member_id"
placeholder="璇烽�夋嫨"
size="mini"
- style="width: 63%"
+ style="width: 100%"
>
<el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
</el-option>
@@ -76,7 +108,7 @@
<el-option v-for="item in clientTypeOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -92,9 +124,9 @@
<el-option v-for="item in clientSourceOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn" @click="editDropdownBox">
+ <!-- <div class="common-select-btn" @click="editDropdownBox">
<i class="el-icon-setting"></i>
- </div>
+ </div> -->
</div>
</el-form-item>
</el-col>
@@ -104,7 +136,7 @@
v-model="editConfig.infomation.client_level_id"
placeholder="璇烽�夋嫨"
size="mini"
- style="width: 63%"
+ style="width: 100%"
>
<el-option v-for="item in importantLevelOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
@@ -128,8 +160,10 @@
<el-form-item label="涓嬫鍥炶鏃ユ湡" prop="next_visit_time">
<el-date-picker
v-model="editConfig.infomation.next_visit_time"
- type="datetime"
+ value-format="yyyy-MM-dd"
+ type="date"
placeholder="閫夋嫨鏃ユ湡"
+ style="width: 100%"
>
</el-date-picker>
</el-form-item>
@@ -138,8 +172,10 @@
<el-form-item label="鏈�鏅氭湇鍔″埌鏈熸棩" prop="latest_service_time">
<el-date-picker
v-model="editConfig.infomation.latest_service_time"
- type="datetime"
+ value-format="yyyy-MM-dd"
+ type="date"
placeholder="閫夋嫨鏃ユ湡"
+ style="width: 100%"
>
</el-date-picker>
</el-form-item>
@@ -157,7 +193,12 @@
</el-col>
<el-col :span="12">
<el-form-item label="鑱旂郴浜烘墜鏈�" prop="contact_phone">
- <el-input v-model="editConfig.infomation.contact_phone"></el-input>
+ <el-input
+ v-model="editConfig.infomation.contact_phone"
+ maxlength="11"
+ show-word-limit
+ oninput="value=value.replace(/[^\d]/g,'')"
+ ></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -193,7 +234,7 @@
<el-option v-for="item in industryOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -206,8 +247,10 @@
<el-form-item label="娉ㄥ唽鏃堕棿" prop="registration_time">
<el-date-picker
v-model="editConfig.infomation.registration_time"
+ value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+ style="width: 100%"
>
</el-date-picker>
</el-form-item>
@@ -229,7 +272,7 @@
>
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -250,7 +293,7 @@
>
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -271,7 +314,7 @@
>
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -309,11 +352,12 @@
placeholder="璇烽�夋嫨"
class="common-select-sel"
size="mini"
+ disabled
>
<el-option v-for="item in countryOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -325,11 +369,12 @@
placeholder="璇烽�夋嫨"
class="common-select-sel"
size="mini"
+ @change="selProvinceChange"
>
<el-option v-for="item in provinceOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
@@ -341,15 +386,16 @@
placeholder="璇烽�夋嫨"
class="common-select-sel"
size="mini"
+ :disabled="cityOptions.length <= 0 ? true : false"
>
<el-option v-for="item in cityOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
- <div class="common-select-btn"><i class="el-icon-setting"></i></div>
+ <!-- <div class="common-select-btn"><i class="el-icon-setting"></i></div> -->
</div>
</el-form-item>
</el-col>
- <el-col :span="12">
+ <!-- <el-col :span="12">
<el-form-item label="鍖哄煙" prop="region_id">
<div class="common-select">
<el-select
@@ -364,7 +410,7 @@
<div class="common-select-btn"><i class="el-icon-setting"></i></div>
</div>
</el-form-item>
- </el-col>
+ </el-col> -->
<el-col :span="24">
<el-form-item label="璇︾粏鍦板潃" prop="detail_address">
<el-input
@@ -470,16 +516,19 @@
<div slot="footer" class="dialog-footer">
<!-- <el-button type="primary" size="small" @click="editConfig.visible = false">淇濆苟鎻愪氦瀹℃壒</el-button> -->
<el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button>
- <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
+ <el-button size="small" @click="handleClose">鍙栨秷</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
-import { getAllData, getAddClient, getUpdateClient } from "@/api/client/client"
+import { getAllData, getAddClient, getUpdateClient, checkNameClient } from "@/api/client/client"
+import { getCityList } from "@/api/common/address"
+import codeMixin from "@/components/makepager/mixin/codeMixin"
export default {
name: "AddClientManageDialog",
+ mixins: [codeMixin],
props: {
editClientManageConfig: {
type: Object,
@@ -487,6 +536,7 @@
return {
visible: false,
title: "鏂板缓",
+ isSalesOpportunity: false,
infomation: {}
}
}
@@ -500,13 +550,38 @@
},
data() {
return {
- dialogWidth: "80%",
+ dialogWidth: "50%",
editConfig: this.editClientManageConfig,
rules: {
- name: [{ required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: "blur" }],
- client_status_id: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鐘舵��", trigger: "change" }],
- member_id: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }],
- approvalOpinion: [{ required: true, message: "璇疯緭鍏ュ鎵规剰瑙�", trigger: "blur" }]
+ number: [{ required: true, validator: this.validateCheckCode, trigger: ["change",'blur' ]}],
+ name: [
+ { required: true, message: "璇疯緭鍏ュ鎴峰悕绉�", trigger: ["change",'blur' ] },
+ {
+ validator: this.checkNameClient,
+ trigger: ["change",'blur' ]
+ }
+ ],
+ client_status_id: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鐘舵��", trigger: ["change",'blur' ] }],
+ member_id: [{ required: false, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: ["change",'blur' ] }],
+ approvalOpinion: [{ required: true, message: "璇疯緭鍏ュ鎵规剰瑙�", trigger: ["change",'blur' ] }],
+ contact_name: [{ required: true, message: "璇疯緭鍏ヨ仈绯讳汉濮撳悕", trigger: ["change",'blur' ] }],
+ contact_phone: [
+ { required: true, message: "璇疯緭鍏ヨ仈绯讳汉鎵嬫満", trigger:["change",'blur' ] },
+ { len: 11, message: "闀垮害鍦�11涓瓧绗�", trigger: ["change",'blur' ] },
+ {
+ pattern: /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
+ message: "璇疯緭鍏ユ纭殑鎵嬫満鍙�",
+ trigger: ["change",'blur' ]
+ }
+ ],
+ contact_email: [
+ { required: false, message: "", trigger: ["change",'blur' ] },
+ {
+ pattern: /^[a-zA-Z0-9_\\.]+@[a-zA-Z0-9-]+[\\.a-zA-Z]+$/,
+ message: "璇疯緭鍏ユ纭殑閭鏍煎紡",
+ trigger: ["change",'blur' ]
+ }
+ ]
},
memberOptions: [],
clientStatusOptions: [], // 瀹㈡埛鐘舵��
@@ -518,22 +593,47 @@
registerCapitalOptions: [], // 娉ㄥ唽璧勯噾
enterpriseNatureOptions: [], // 鍏徃鎬ц川
enterpriseScaleOptions: [], // 瀹㈡埛瑙勬ā
- countryOptions: [], // 鍥藉
+ countryOptions: [{ id: 1, name: "涓浗" }], // 鍥藉
provinceOptions: [], // 鐪佷唤
cityOptions: [], // 鍩庡競
regionOptions: [], // 鍖哄煙
- approvalWorkflowOptions: [] // 瀹℃壒娴佺▼
+ approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
+ clientName: this.editClientManageConfig.infomation.name
}
},
created() {
+ if (this.editConfig.title !== "鏂板缓" && this.editConfig.infomation.province_id !== 0) {
+ this.getCityList(this.editConfig.infomation.province_id, "edit")
+ }
this.getCommonData()
+ this.formInfo();
+ },
+ watch:{
+ 'editClientManageConfig.visible'(val){
+ if(val){
+ this.formInfo()
+ }
+ },
},
methods: {
+ formInfo(){
+ this.objCode.type='瀹㈡埛缂栫爜'
+ this.objCode.codeStandID = ''
+ if(this.editConfig.infomation.codeStandID){
+ this.objCode.codeStandID = this.editConfig.infomation.codeStandID;
+ }
+ this.getRCodeStandardList();
+ },
getCommonData() {
+ this.editConfig.infomation.country_id = 1
+ this.editConfig.infomation.province_id =
+ this.editConfig.infomation.province_id === 0 ? "" : this.editConfig.infomation.province_id
+ this.editConfig.infomation.city_id =
+ this.editConfig.infomation.city_id === 0 ? "" : this.editConfig.infomation.city_id
getAllData()
.then((res) => {
- console.log(res)
this.memberOptions = res.data.member
+ this.$set(this.editConfig.infomation,'member_id',this.editConfig.infomation.member_id)
this.clientSourceOptions = res.data.client_origin
this.clientStatusOptions = res.data.client_status
this.importantLevelOptions = res.data.client_level
@@ -542,9 +642,8 @@
this.registerCapitalOptions = res.data.registered_capital
this.enterpriseNatureOptions = res.data.enterprise_nature
this.enterpriseScaleOptions = res.data.enterprise_scale
- this.countryOptions = res.data.country
+ // this.countryOptions = res.data.country
this.provinceOptions = res.data.province
- this.cityOptions = res.data.city
this.regionOptions = res.data.region
})
.catch((err) => {
@@ -553,46 +652,44 @@
},
handleClose() {
this.editConfig.visible = false
+ if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) {
+ this.$parent.handleClose()
+ }
},
// 淇濆瓨
saveClick(formName) {
+
this.$refs[formName].validate((valid) => {
if (valid) {
console.log(this.editConfig.infomation)
const params = this.saveParams()
- console.log(params)
if (this.editConfig.title === "鏂板缓") {
- getAddClient(params)
- .then((res) => {
- console.log(res)
- this.editConfig.visible = false
- if (res.code === 200) {
- this.$message({
- message: "娣诲姞鎴愬姛",
- type: "success"
- })
+ getAddClient(params).then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("娣诲姞鎴愬姛")
+ if (this.editConfig.isSalesOpportunity) {
+ this.$emit("salesOpportunityClick", this.editConfig.infomation)
+ } else if (this.editConfig.title === "鏂板缓" && this.editConfig.infomation.sales_leads_id) {
+ this.$parent.handleClose()
+ } else {
this.$parent.getData()
}
- })
- .catch((err) => {
- console.log(err)
- })
+ if (this.editConfig.isResh) {
+ this.$emit("reshData")
+ }
+ }
+ })
} else {
- getUpdateClient(params)
- .then((res) => {
- console.log(res)
- this.editConfig.visible = false
- if (res.code === 200) {
- this.$message({
- message: "缂栬緫鎴愬姛",
- type: "success"
- })
- this.$parent.getData()
- }
- })
- .catch((err) => {
- console.log(err)
- })
+ getUpdateClient(params).then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("缂栬緫鎴愬姛")
+ this.$parent.getData()
+ }
+ })
}
} else {
console.log("error submit")
@@ -605,7 +702,7 @@
let params = {
id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
business_scope: data.business_scope,
- city_id: 0,
+ city_id: data.city_id || 0,
client_level_id: data.client_level_id || 0,
client_origin_id: data.client_origin_id || 0,
client_status_id: data.client_status_id || 0,
@@ -637,13 +734,16 @@
name: data.name || "",
next_visit_time: data.next_visit_time || "",
number: data.number || "",
- province_id: 0,
+ province_id: data.province_id || 0,
region_id: 0,
registered_capital_id: data.registered_capital_id || 0,
registration_time: data.registration_time || "",
remark: data.remark || "",
representative: data.representative || "",
- service_member_id: data.service_member_id || 0
+ service_member_id: data.service_member_id || 0,
+ sales_leads_id: data.sales_leads_id || 0,
+ contact_id: data.contact_id || 0,
+ codeStandID:data.ID,
}
return params
},
@@ -656,6 +756,31 @@
console.log("aaa")
this.editDropdownConfig.editVisible = true
this.editDropdownConfig.title = "瀹㈡埛鏉ユ簮"
+ },
+ // 閫夋嫨鐪佷唤
+ selProvinceChange(val) {
+ this.getCityList(val, "sel")
+ },
+ async getCityList(val, value) {
+ await getCityList({ province_id: val }).then((res) => {
+ console.log(res)
+ if (res.code === 200) {
+ this.cityOptions = res.data.list
+ if (value === "sel") {
+ this.editConfig.infomation.city_id = ""
+ }
+ }
+ })
+ },
+ // 鏌ラ噸
+ async checkNameClient(rule, value, callback) {
+ if (this.editConfig.title === "鏂板缓" || this.clientName !== this.editConfig.infomation.name) {
+ await checkNameClient({ name: value }).then((res) => {
+ if (res.data.code === 700001) {
+ return callback(new Error("瀹㈡埛鍚嶇О閲嶅"))
+ }
+ })
+ }
}
}
}
@@ -663,54 +788,56 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
-.add-client-manage {
- .basic-info {
- .basic-info-title {
- background-color: #f4f8fe;
- padding-left: 10px;
- font-size: 15px;
- font-weight: bold;
- color: #666;
- height: 42px;
- line-height: 42px;
- }
- .basic-info-view {
- margin-top: 10px;
- padding-right: 40px;
- .custom-name,
- .common-select {
+::v-deep {
+ .iframe-dialog .el-dialog__body {
+ .basic-info {
+ .basic-info-title {
+ background-color: #f4f8fe;
+ padding-left: 10px;
+ font-size: 15px;
+ font-weight: bold;
+ color: #666;
+ height: 42px;
+ line-height: 42px;
+ }
+ .basic-info-view {
+ margin-top: 10px;
+ padding-right: 40px;
+ .custom-name,
+ .common-select {
+ display: flex;
+ .common-select-btn {
+ margin-left: 5px;
+ font-size: 18px;
+ cursor: pointer;
+ }
+ }
+ .common-select {
+ .common-select-sel {
+ width: 100%;
+ }
+ }
+ }
+ .annex-view {
display: flex;
- .common-select-btn {
- margin-left: 5px;
- font-size: 18px;
- cursor: pointer;
- }
- }
- .common-select {
- .common-select-sel {
- width: 270px;
+ color: #6166d3;
+ .setFormat {
+ margin-left: 10px;
}
}
}
- .annex-view {
+ .unflod-collapse {
display: flex;
+ height: 30px;
+ justify-content: center;
+ align-items: center;
color: #6166d3;
- .setFormat {
- margin-left: 10px;
- }
}
- }
- .unflod-collapse {
- display: flex;
- height: 30px;
- justify-content: center;
- align-items: center;
- color: #6166d3;
- }
- .dialog-footer {
- background-color: #f5f5f5;
- height: 55px;
- line-height: 55px;
+ .dialog-footer {
+ background-color: #f5f5f5;
+ height: 55px;
+ line-height: 55px;
+ }
}
}
</style>
--
Gitblit v1.8.0