From da3dbb56388ae49097e50ded584ed2abb7f5022d Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 17 十月 2023 14:16:25 +0800
Subject: [PATCH] bug修复(5243)
---
src/views/sales/contractManage/AddContractManageDialog.vue | 345 +++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 273 insertions(+), 72 deletions(-)
diff --git a/src/views/sales/contractManage/AddContractManageDialog.vue b/src/views/sales/contractManage/AddContractManageDialog.vue
index 2e1baa7..7585886 100644
--- a/src/views/sales/contractManage/AddContractManageDialog.vue
+++ b/src/views/sales/contractManage/AddContractManageDialog.vue
@@ -11,7 +11,7 @@
:model="editConfig.infomation"
:rules="rules"
label-position="right"
- label-width="308px"
+ label-width="168px"
size="mini"
>
<!-- 淇℃伅 -->
@@ -21,26 +21,63 @@
<div class="basic-info-view">
<el-row>
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О" prop="client_id">
+ <el-form-item label="鍗曟嵁缂栧彿" prop="number">
+ <!-- <el-input v-model="editConfig.infomation.number" style="width: 100%"></el-input> -->
+ <WordInput
+ v-if="codenumer && (explain != '' || isIdDisabled) && method == 0"
+ :codenumer="codenumer"
+ :sum="sum"
+ :disabled="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>{{ editConfig.title === "鏂板缓" ? "鑷姩鐢熸垚" : editConfig.infomation.number }}</span>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍚堝悓鍚嶇О" prop="contractName">
<div class="custom-name">
- <el-input v-model="editConfig.infomation.client_id"></el-input>
- <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div>
- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div>
+ <el-input v-model="editConfig.infomation.contractName"></el-input>
</div>
</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="client_name">
+ <div class="custom-name">
+ <el-autocomplete
+ v-model="editConfig.infomation.client_name"
+ :fetch-suggestions="
+ (queryString, callback) => {
+ querySearchAsync(queryString, callback, 'client')
+ }
+ "
+ value-key="name"
+ @select="handleSelectClient('client', $event)"
+ style="width: 100%"
+ ></el-autocomplete>
+ <div class="common-select-btn" @click="selClientClick('client')">
+ <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+ </div>
+ <div
+ v-if="editConfig.infomation.client_name && editConfig.infomation.client_name.length > 0"
+ class="common-select-btn"
+ @click="clearupClient('client')"
+ >
+ <i class="el-icon-remove-outline" title="娓呴櫎"></i>
+ </div>
+ </div>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="璐熻矗浜�" prop="member_id">
+ <el-form-item label="璐熻矗浜�" prop="memberId">
<el-select
- v-model="editConfig.infomation.member_id"
+ v-model="editConfig.infomation.memberId"
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>
@@ -48,27 +85,52 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍚堝悓鐘舵��" prop="status_id">
+ <el-form-item label="鍚堝悓鐘舵��" prop="statusId">
<div class="common-select">
<el-select
- v-model="editConfig.infomation.status_id"
+ v-model="editConfig.infomation.statusId"
placeholder="璇烽�夋嫨"
class="common-select-sel"
size="mini"
+ style="width: 100%"
>
<el-option v-for="item in statusOptions" :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-form-item label="閿�鍞姤浠峰崟" prop="quotation_id">
+ <el-form-item label="閿�鍞姤浠峰崟" prop="quotation_number">
<div class="custom-name">
- <el-input v-model="editConfig.infomation.quotation_id"></el-input>
- <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="閫夋嫨"></i></div>
- <div class="common-select-btn"><i class="el-icon-edit" title="缂栬緫"></i></div>
+ <el-autocomplete
+ v-model="editConfig.infomation.quotation_number"
+ :fetch-suggestions="
+ (queryString, callback) => {
+ querySearchAsync(queryString, callback, 'quotation')
+ }
+ "
+ value-key="number"
+ @select="handleSelectClient('quotation', $event)"
+ style="width: 100%"
+ placeholder="璇峰厛閫夋嫨瀹㈡埛鍚嶇О"
+ :disabled="isAddQuatation"
+ ></el-autocomplete>
+ <div v-if="!isAddQuatation" class="common-select-btn" @click="selClientClick('quotation')">
+ <i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
+ </div>
+ <div
+ v-if="
+ editConfig.infomation.quotation_number &&
+ editConfig.infomation.quotation_number.length > 0 &&
+ !isAddQuatation
+ "
+ class="common-select-btn"
+ @click="clearupClient('quotation')"
+ >
+ <i class="el-icon-remove-outline" title="娓呴櫎"></i>
+ </div>
</div>
</el-form-item>
</el-col>
@@ -102,11 +164,11 @@
</el-row>
</div>
<!-- 灞曞紑鏀惰捣 -->
- <div v-if="editConfig.title === '鏂板缓'" class="unflod-collapse" @click="unflodCollapseClick">
+ <!-- <div v-if="editConfig.title === '鏂板缓'" class="unflod-collapse" @click="unflodCollapseClick">
<div>{{ unflodCollapseStr }}</div>
<div v-if="isUnflod"><i class="el-icon-arrow-up"></i></div>
<div v-else><i class="el-icon-arrow-down"></i></div>
- </div>
+ </div> -->
<!-- 閫夋嫨瀹℃壒娴佺▼ -->
<!-- <div class="basic-info-title">閫夋嫨瀹℃壒娴佺▼</div>
<div class="basic-info-view">
@@ -153,6 +215,18 @@
<el-button type="primary" size="small" @click="saveClick('form')">淇濆瓨</el-button>
<el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
</div>
+ <!-- 閫夋嫨瀹㈡埛 -->
+ <SelectClientDialog
+ v-if="editSelectClientConfig.editVisible"
+ :edit-common-config="editSelectClientConfig"
+ @selClient="selClient"
+ />
+ <!-- 鎶ヤ环鍗� -->
+ <SelectCommonDialog
+ v-if="editSelCommonConfig.editVisible"
+ :edit-common-config="editSelCommonConfig"
+ @selClient="selClient"
+ />
</el-dialog>
</div>
</template>
@@ -160,8 +234,13 @@
<script>
import { getAllData } from "@/api/client/client"
import { getAddContract, getUpdateContract } from "@/api/sales/contractManage"
+import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
+import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
+import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
+import { getQuotationList } from "@/api/sales/quotation"
export default {
name: "AddContractManageDialog",
+ mixins: [codeMixin],
props: {
editCommonConfig: {
type: Object,
@@ -174,36 +253,79 @@
}
}
},
- components: {},
- computed: {},
+ components: { SelectClientDialog, SelectCommonDialog },
+ computed: {
+ clientList() {
+ return this.$store.state.getClientName.clientList
+ }
+ // quotationList() {
+ // return this.$store.state.getClientName.quotationList
+ // }
+ },
data() {
return {
- dialogWidth: "80%",
+ dialogWidth: "50%",
editConfig: this.editCommonConfig,
rules: {
- number: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }]
+ number: [{ required: true, validator: this.checkCode, trigger: "blur" }],
+ client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }],
+ member_id: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ contractName: [{ required: true, message: "璇疯緭鍏ュ悎鍚屽悕绉�", trigger: "blur" }]
},
memberOptions: [],
- statusOptions: [
- { id: "1", name: "寰呭鎵�" },
- { id: "2", name: "瀹℃壒涓�" },
- { id: "3", name: "宸插鎵�" },
- { id: "4", name: "宸插綊妗�" }
- ], // 鍚堝悓鐘舵��
+ statusOptions: [], // 鍚堝悓鐘舵��
approvalWorkflowOptions: [], // 瀹℃壒娴佺▼
unflodCollapseStr: "鏀惰捣",
- isUnflod: true
+ isUnflod: true,
+ editSelectClientConfig: {
+ editVisible: false,
+ title: "",
+ infomation: {}
+ },
+ editSelCommonConfig: {
+ editVisible: false,
+ title: "",
+ infomation: {}
+ },
+ clientId: this.editCommonConfig.infomation.clientId,
+ quotationId: this.editCommonConfig.infomation.quotationId,
+ isAddQuatation: true,
+ quotationList: []
}
},
created() {
+ this.$store.dispatch("geClient")
+ // this.$store.dispatch("geQuotation")
+ if (this.editConfig.title !== "鏂板缓") {
+ this.isAddQuatation = false
+ }
this.getCommonData()
+ this.formInfo()
+ },
+ watch: {
+ "editCommonConfig.visible"(val) {
+ if (val) {
+ this.formInfo()
+ }
+ },
+ "editCommonConfig.infomation.codeStandID"() {
+ 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() {
getAllData()
.then((res) => {
this.memberOptions = res.data.member
+ this.statusOptions = res.data.serviceContractStatus
})
.catch((err) => {
console.log(err)
@@ -212,42 +334,29 @@
// 淇濆瓨
saveClick(formName) {
this.$refs[formName].validate((valid) => {
+ this.validateFormNumber()
if (valid) {
console.log(this.editConfig.infomation)
const params = this.saveParams()
console.log(params)
if (this.editConfig.title === "鏂板缓") {
- getAddContract(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)
- })
+ getAddContract(params).then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("娣诲姞鎴愬姛")
+ this.$parent.getData()
+ }
+ })
} else {
- getUpdateContract(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)
- })
+ getUpdateContract(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")
@@ -257,19 +366,108 @@
},
saveParams() {
let data = this.editConfig.infomation
+ console.log(data)
let params = {
id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
- client_id: parseInt(data.client_id) || 0,
+ contractName: data.contractName || "",
+ client_id: this.clientId || 0,
file: "",
- member_id: data.member_id || 0,
+ member_id: data.memberId || 0,
number: data.number || "",
- quotation_id: data.quotation_id || 0,
- status_id: data.status_id || 0
+ quotation_id: this.quotationId || 0,
+ status_id: data.statusId || 0,
+ codeStandID: data.ID,
+ codeRule: this.codeRule
}
return params
},
handleClose() {
this.editConfig.visible = false
+ },
+ // 鑾峰彇鎶ヤ环鍗�
+ getQuotation(id) {
+ getQuotationList({
+ page: 0,
+ pageSize: 0,
+ search_map: {
+ client_id: id
+ }
+ }).then((res) => {
+ if (res.code == 200) {
+ console.log(res)
+ this.quotationList = res.data.list
+ }
+ })
+ },
+ // 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
+ querySearchAsync(queryString, cb, value) {
+ var restaurants = []
+ if (value === "client") {
+ restaurants = this.clientList
+ } else if (value === "quotation") {
+ restaurants = this.quotationList
+ }
+ var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants
+ cb(results)
+ },
+ createStateFilter(queryString, value) {
+ return (state) => {
+ if (value === "contract" || value === "quotation") {
+ return state.number.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+ } else {
+ return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+ }
+ }
+ },
+ handleSelectClient(value, item) {
+ console.log(item)
+ if (value === "client") {
+ this.editConfig.infomation.client_name = item.name
+ this.clientId = item.id
+ this.isAddQuatation = false
+ this.getQuotation(item.id)
+ } else if (value === "quotation") {
+ this.editConfig.infomation.quotation_number = item.number
+ this.quotationId = item.id
+ }
+ },
+ selClientClick(value) {
+ console.log("aaaa")
+ if (value === "client") {
+ this.editSelectClientConfig.editVisible = true
+ } else if (value === "quotation") {
+ this.editSelCommonConfig.title = "鎶ヤ环鍗�"
+ this.editSelCommonConfig.editVisible = true
+ this.editSelCommonConfig.clientId = this.clientId
+ this.editSelCommonConfig.tableInfomation = [...this.quotationList]
+ }
+ },
+ selClient(row, value) {
+ console.log("bbbb")
+ console.log(value)
+ if (value === "client") {
+ this.editConfig.infomation.client_name = row.name
+ this.clientId = row.id
+ this.isAddQuatation = false
+ this.getQuotation(row.id)
+ } else if (value === "quotation") {
+ this.editConfig.infomation.quotation_number = row.number
+ this.quotationId = row.id
+ }
+ },
+ // 娓呴櫎宸查�夋嫨鐢ㄦ埛
+ clearupClient(value) {
+ console.log(value)
+ if (value === "client") {
+ this.editConfig.infomation.client_name = ""
+ this.clientId = 0
+ this.isAddQuatation = true
+ this.editConfig.infomation.quotation_number = ""
+ this.quotationId = 0
+ } else if (value === "quotation") {
+ this.editConfig.infomation.quotation_number = ""
+ this.quotationId = 0
+ }
},
// 娣诲姞闄勪欢
addAnnexClick() {},
@@ -283,6 +481,14 @@
} else {
this.unflodCollapseStr = "鏀惰捣"
this.isUnflod = true
+ }
+ },
+ // 璁㈠崟缂栫爜鍗曠嫭鏍¢獙
+ checkCode(rule, value, callback) {
+ if (this.editConfig.infomation.number && this.editConfig.infomation.number.length > 0) {
+ callback()
+ } else {
+ callback(new Error("璇疯緭鍏ュ崟鎹紪鍙�"))
}
}
}
@@ -305,7 +511,8 @@
.basic-info-view {
margin-top: 10px;
padding-right: 40px;
- .custom-name {
+ .custom-name,
+ .common-select {
display: flex;
.common-select-btn {
margin-left: 5px;
@@ -313,14 +520,8 @@
}
}
.common-select {
- display: flex;
.common-select-sel {
width: 270px;
- }
- .common-select-btn {
- margin-left: 5px;
- font-size: 16px;
- cursor: pointer;
}
}
}
--
Gitblit v1.8.0