From 7fb0a8f0ab16c149484bf043754cd10cfa94de2f Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期一, 19 一月 2026 14:48:05 +0800
Subject: [PATCH] 增加了业务员,保管员和验收员的对应的显示
---
src/views/GyCustomer/CustomerEdit/index.vue | 312 ++++++++++++++++++++++++++++++---------------------
1 files changed, 182 insertions(+), 130 deletions(-)
diff --git a/src/views/GyCustomer/CustomerEdit/index.vue b/src/views/GyCustomer/CustomerEdit/index.vue
index c5f1c65..8d1f30f 100644
--- a/src/views/GyCustomer/CustomerEdit/index.vue
+++ b/src/views/GyCustomer/CustomerEdit/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="customer-edit">
- <el-dialog
+ <!-- <el-dialog
:title="dialogTitle"
:visible.sync="openEdit"
width="1480px"
@@ -8,7 +8,7 @@
class="customerBox"
:before-close="handleClose"
:close-on-click-modal="false"
- >
+ > -->
<div class="dialog-content">
<el-card style="margin-bottom: 10px;">
<div class="card-header">
@@ -23,15 +23,15 @@
<el-card>
<div class="card-body">
<h1 style="text-align:center;margin-bottom:20px;"><b>瀹㈡埛璧勬枡</b></h1>
-
+
<el-tabs v-model="activeTab" type="card">
<el-tab-pane label="鍩烘湰淇℃伅" name="basic">
<el-form ref="form" :model="formData" label-width="100px" :rules="rules">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="瀹㈡埛浠g爜" prop="HNumber">
- <el-input
- v-model="formData.HNumber"
+ <el-input
+ v-model="formData.HNumber"
placeholder="璇疯緭鍏ュ鎴蜂唬鐮�"
:readonly="operationType === 3"
></el-input>
@@ -78,8 +78,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="鍒涘缓缁勭粐" prop="HCreateOrgID">
- <el-select
- v-model="formData.HCreateOrgID"
+ <el-select
+ v-model="formData.HCreateOrgID"
placeholder="璇烽�夋嫨鍒涘缓缁勭粐"
:disabled="operationType !== 1"
style="width: 100%"
@@ -98,8 +98,8 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="浣跨敤缁勭粐" prop="HUSEORGID">
- <el-select
- v-model="formData.HUSEORGID"
+ <el-select
+ v-model="formData.HUSEORGID"
placeholder="璇烽�夋嫨浣跨敤缁勭粐"
:disabled="operationType !== 1"
style="width: 100%"
@@ -117,17 +117,17 @@
</el-form>
</el-tab-pane>
-
+
<el-tab-pane label="鍏朵粬淇℃伅" name="other">
- <el-form ref="formOther" :model="formData" label-width="100px">
+ <el-form ref="formOther" :model="formData" :rules="rules" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鑱旂郴浜�">
+ <el-form-item label="鑱旂郴浜�" prop="HLinkMan">
<el-input v-model="formData.HLinkMan" placeholder="璇疯緭鍏ヨ仈绯讳汉"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鑱旂郴鐢佃瘽">
+ <el-form-item label="鑱旂郴鐢佃瘽" prop="HLinkPhone">
<el-input v-model="formData.HLinkPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�"></el-input>
</el-form-item>
</el-col>
@@ -148,7 +148,7 @@
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鍦板潃">
+ <el-form-item label="鍦板潃" prop="HAddress">
<el-input v-model="formData.HAddress" placeholder="璇疯緭鍏ュ湴鍧�"></el-input>
</el-form-item>
</el-col>
@@ -220,17 +220,17 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍦板尯">
- <el-input
- v-model="formData.HAreaName"
+ <el-form-item label="鍦板尯" prop="HAreaID">
+ <el-input
+ v-model="formData.HAreaName"
placeholder="璇烽�夋嫨鍦板尯"
readonly
style="width: calc(100% - 50px)"
>
</el-input>
- <el-button
- type="primary"
- icon="el-icon-search"
+ <el-button
+ type="primary"
+ icon="el-icon-search"
style="margin-left: 10px;"
@click="openAreaDialog"
></el-button>
@@ -242,16 +242,16 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="榛樿璐у竵">
- <el-input
- v-model="formData.HCurName"
+ <el-input
+ v-model="formData.HCurName"
placeholder="璇烽�夋嫨榛樿璐у竵"
readonly
style="width: calc(100% - 50px)"
>
</el-input>
- <el-button
- type="primary"
- icon="el-icon-search"
+ <el-button
+ type="primary"
+ icon="el-icon-search"
style="margin-left: 10px;"
@click="openCurrencyDialog"
></el-button>
@@ -260,16 +260,16 @@
</el-col>
<el-col :span="12">
<el-form-item label="缁撶畻鏂瑰紡">
- <el-input
- v-model="formData.HSSName"
+ <el-input
+ v-model="formData.HSSName"
placeholder="璇烽�夋嫨缁撶畻鏂瑰紡"
readonly
style="width: calc(100% - 50px)"
>
</el-input>
- <el-button
- type="primary"
- icon="el-icon-search"
+ <el-button
+ type="primary"
+ icon="el-icon-search"
style="margin-left: 10px;"
@click="openSettleStyleDialog"
></el-button>
@@ -280,7 +280,7 @@
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="瀹㈡埛鐘舵��">
+ <el-form-item label="瀹㈡埛鐘舵��" prop="HCusStatus">
<el-select v-model="formData.HCusStatus" placeholder="璇烽�夋嫨瀹㈡埛鐘舵��" style="width: 100%">
<el-option label="娼滃湪" value="101"></el-option>
<el-option label="鍚堟牸" value="102"></el-option>
@@ -292,16 +292,16 @@
</el-col>
<el-col :span="12">
<el-form-item label="瀹㈡埛鍒嗙被">
- <el-input
- v-model="formData.HCusTypeName"
+ <el-input
+ v-model="formData.HCusTypeName"
placeholder="璇烽�夋嫨瀹㈡埛鍒嗙被"
readonly
style="width: calc(100% - 50px)"
>
</el-input>
- <el-button
- type="primary"
- icon="el-icon-search"
+ <el-button
+ type="primary"
+ icon="el-icon-search"
style="margin-left: 10px;"
@click="openCustomerTypeDialog"
></el-button>
@@ -372,32 +372,32 @@
</el-card>
</div>
-
+
<!-- 鍦板尯tanchuang -->
- <AreaDialog
+ <AreaDialog
:visible.sync="areaDialogVisible"
@selected="handleAreaSelected"
/>
-
-
+
+
<!-- 璐у竵tanchuang -->
- <CurrencyDialog
+ <CurrencyDialog
:visible.sync="currencyDialogVisible"
@selected="handleCurrencySelected"
/>
<!-- 缁撶畻鏂瑰紡tanchuang -->
- <SettleStyleDialog
+ <SettleStyleDialog
:visible.sync="settleStyleDialogVisible"
@selected="handleSettleStyleSelected"
/>
<!-- 瀹㈡埛鍒嗙被tanchuang -->
- <CustomerTypeDialog
+ <CustomerTypeDialog
:visible.sync="customerTypeDialogVisible"
@selected="handleCustomerTypeSelected"
/>
- </el-dialog>
+ <!-- </el-dialog> -->
</div>
</template>
@@ -442,7 +442,7 @@
return {
openEdit: true,
activeTab: 'basic',
-
+
// 琛ㄥ崟鏁版嵁
formData: {
HNumber: '',
@@ -454,7 +454,7 @@
HMateOutEmp: '',
HCreateOrgID: '',
HUSEORGID: '',
-
+
// 鍏朵粬淇℃伅
HLinkMan: '',
HLinkPhone: '',
@@ -480,7 +480,7 @@
HCusStatus: '',
HCusTypeName: '',
HCusTypeID: '0',
-
+
// 绯荤粺淇℃伅
HCreator: '',
HCreateDate: '',
@@ -491,7 +491,7 @@
HDeleteMan: '',
HDeleteDate: ''
},
-
+
// 楠岃瘉
rules: {
HNumber: [
@@ -507,19 +507,19 @@
{ required: true, message: '璇烽�夋嫨浣跨敤缁勭粐', trigger: 'change' }
]
},
-
+
organizationList: [],
-
-
+
+
areaDialogVisible: false,
currencyDialogVisible: false,
settleStyleDialogVisible: false,
customerTypeDialogVisible: false,
-
+
saveDisabled: false,
auditDisabled: false,
-
- baseURL: process.env.VUE_APP_BASE_URL || 'http://47.96.97.237/API/',
+
+ baseURL: process.env.VUE_APP_BASE_API || 'http://47.96.97.237/API/',
user: 'admin'
}
},
@@ -548,15 +548,16 @@
this.initData()
this.loadOrganizations()
this.handleOperationType()
+ this.setConditionalRules()
},
methods: {
initData() {
this.formData.HCreator = this.user
this.formData.HCreateDate = new Date().toLocaleString()
},
-
+
loadOrganizations() {
- axios.get(`${this.baseURL}/Web/GetOrganizations`)
+ axios.get(`${this.$baseUrl}/Web/GetOrganizations`)
.then(response => {
if (response.data.count === 1) {
this.organizationList = response.data.data
@@ -571,7 +572,7 @@
this.$modal.msgError('鍔犺浇缁勭粐鏁版嵁澶辫触!')
})
},
-
+
handleOperationType() {
switch (this.operationType) {
case 1: // 鏂板
@@ -588,13 +589,13 @@
break
}
},
-
+
handleAddNew() {
this.auditDisabled = true
this.getMaxBillID()
},
-
+
handleSerialAdd() {
this.formData.HCusTypeName = this.HCusClsName
@@ -602,21 +603,21 @@
this.setHNumber(this.HCusTypeID)
this.auditDisabled = true
},
-
-
+
+
handleEdit() {
this.loadEditData(this.linterid)
},
-
-
+
+
handleCopy() {
this.loadEditData(this.linterid)
this.auditDisabled = true
},
-
-
+
+
getMaxBillID() {
- axios.get(`${this.baseURL}/Gy_Customer/GetMAXBillID`)
+ axios.get(`${this.$baseUrl}/Gy_Customer/GetMAXBillID`)
.then(response => {
console.log('Max Bill ID:', response.data)
})
@@ -624,10 +625,10 @@
console.error('鑾峰彇鏈�澶у崟鎹甀D澶辫触:', error)
})
},
-
+
// 璁剧疆娴佹按鍙�
setHNumber(typeID) {
- axios.get(`${this.baseURL}/Gy_Customer/getMaxNum`, {
+ axios.get(`${this.$baseUrl}/Gy_Customer/getMaxNum`, {
params: {
HCusTypeID: typeID,
user: this.user,
@@ -643,16 +644,16 @@
this.$modal.msgError('鑾峰彇娴佹按鍙峰け璐�!')
})
},
-
+
loadEditData(interId) {
- axios.get(`${this.baseURL}/Gy_Customer/xg_extendCheckEmp`, {
+ axios.get(`${this.$baseUrl}/Gy_Customer/xg_extendCheckEmp`, {
params: { HInterID: interId }
})
.then(response => {
if (response.data.data && response.data.data.length > 0) {
const data = response.data.data[0]
this.populateFormData(data)
-
+
if (data.瀹℃牳浜� && data.瀹℃牳浜� !== '') {
this.saveDisabled = true
this.auditDisabled = true
@@ -663,8 +664,8 @@
this.$modal.msgError('鍔犺浇瀹㈡埛鏁版嵁澶辫触!')
})
},
-
-
+
+
populateFormData(data) {
this.formData = {
...this.formData,
@@ -702,64 +703,115 @@
HChecker: data.瀹℃牳浜� || '',
HCheckDate: data.瀹℃牳鏃ユ湡 || ''
}
-
+
this.formData.HUpDater = this.user
this.formData.HUpDateDate = new Date().toLocaleString()
},
-
+
// 淇濆瓨
- handleSave() {
- this.$refs.form.validate(valid => {
- if (valid) {
- if (!this.validateForm()) {
- return
- }
-
- const formData = { ...this.formData }
- formData.HStopflag = formData.HStopflag ? 'true' : 'false'
-
- let url = `${this.baseURL}/Gy_Customer/AddBill`
- let params = { oMain: JSON.stringify(formData) + ';' + this.user }
-
- if (this.operationType === 3) {
- // 缂栬緫淇濆瓨
- url = `${this.baseURL}/Gy_Customer/AddBill1`
- params = {
- oMain: JSON.stringify(formData) + ';' + this.linterid + ';' + this.user + ';Gy_Customer_Edit'
- }
- }
-
- axios.post(url, params)
- .then(response => {
- if (response.data.count === 1) {
- this.$modal.msgSuccess(response.data.Message)
- this.saveDisabled = true
- this.saveConfig()
- this.openEdit = false
- this.$emit('editClose', true)
- } else {
- this.$modal.msgError(response.data.Message)
- }
- })
- .catch(error => {
- this.$modal.msgError('淇濆瓨澶辫触!')
- })
- }
+ async handleSave() {
+ const validMain = await new Promise(resolve => {
+ this.$refs.form.validate(valid => resolve(valid))
})
+
+ let validOther = true
+ if (this.$refs.formOther) {
+ validOther = await new Promise(resolve => {
+ this.$refs.formOther.validate(valid => resolve(valid))
+ })
+ }
+
+ if (validMain && validOther) {
+ if (!this.validateForm()) {
+ return
+ }
+
+ const formData = { ...this.formData }
+ formData.HStopflag = formData.HStopflag ? 'true' : 'false'
+
+ let url = `${this.$baseUrl}/Gy_Customer/AddBill`
+ let params = { oMain: JSON.stringify(formData) + ';' + this.user }
+
+ if (this.operationType === 3) {
+ // 缂栬緫淇濆瓨
+ url = `${this.$baseUrl}/Gy_Customer/AddBill1`
+ params = {
+ oMain: JSON.stringify(formData) + ';' + this.linterid + ';' + this.user + ';Gy_Customer_Edit'
+ }
+ }
+
+ axios.post(url, params)
+ .then(response => {
+ if (response.data.count === 1) {
+ this.$modal.msgSuccess(response.data.Message)
+ this.saveDisabled = true
+ this.saveConfig()
+ this.openEdit = false
+ this.$emit('editClose', true)
+ } else {
+ this.$modal.msgError(response.data.Message)
+ }
+ })
+ .catch(error => {
+ this.$modal.msgError('淇濆瓨澶辫触!')
+ })
+ }
},
-
+
+ setConditionalRules() {
+ this.rules.HLinkMan = [
+ { validator: this.validateRequiredIfAdd, trigger: 'blur', message: '璇疯緭鍏ヨ仈绯讳汉' }
+ ]
+
+ this.rules.HLinkPhone = [
+ { validator: this.validateRequiredIfAdd, trigger: 'blur', message: '璇疯緭鍏ヨ仈绯荤數璇�' }
+ ]
+
+ this.rules.HAddress = [
+ { validator: this.validateRequiredIfAdd, trigger: 'blur', message: '璇疯緭鍏ュ湴鍧�' }
+ ]
+
+ this.rules.HAreaID = [
+ { validator: this.validateRequiredIfAdd, trigger: 'change', message: '璇烽�夋嫨鍦板尯' }
+ ]
+
+ this.rules.HCusStatus = [
+ { validator: this.validateRequiredIfAdd, trigger: 'change', message: '璇烽�夋嫨瀹㈡埛鐘舵��' }
+ ]
+ },
+
+ validateRequiredIfAdd(rule, value, callback) {
+ if (this.operationType !== 1) {
+ return callback()
+ }
+
+ if (value === null || value === undefined) {
+ return callback(new Error(rule.message || '璇ラ」涓哄繀濉�'))
+ }
+
+ if (typeof value === 'string' && value.trim() === '') {
+ return callback(new Error(rule.message || '璇ラ」涓哄繀濉�'))
+ }
+
+ if (value === '0') {
+ return callback(new Error(rule.message || '璇ラ」涓哄繀濉�'))
+ }
+
+ return callback()
+ },
+
// 琛ㄥ崟楠岃瘉
validateForm() {
if (!this.formData.HNumber) {
this.$modal.msgWarning('璇疯緭鍏ュ鎴蜂唬鐮�!')
return false
}
-
+
if (!this.formData.HName) {
this.$modal.msgWarning('璇疯緭鍏ュ鎴峰悕绉�!')
return false
}
-
+
// 澧炲�肩◣鐜囬獙璇�
const taxRate = this.formData.HTaxRate
// if (taxRate && taxRate.substring(taxRate.length - 1) === '.') {
@@ -771,13 +823,13 @@
this.$modal.msgWarning('澧炲�肩◣鐜囪杈撳叆姝g‘鏁板瓧!')
return false
}
-
+
return true
},
-
+
// 瀹℃牳
handleAudit() {
- axios.get(`${this.baseURL}/Gy_Customer/AuditGy_Customer`, {
+ axios.get(`${this.$baseUrl}/Gy_Customer/AuditGy_Customer`, {
params: {
HInterID: this.linterid,
IsAudit: 0,
@@ -797,13 +849,13 @@
this.$modal.msgError('瀹℃牳澶辫触!')
})
},
-
+
// 閫�鍑�
handleExit() {
this.openEdit = false
this.$emit('editClose', false)
},
-
+
// 鍏抽棴瀵硅瘽妗�
handleClose(done) {
this.$confirm('纭鍏抽棴锛�')
@@ -813,7 +865,7 @@
})
.catch(_ => {})
},
-
+
// 淇濆瓨閰嶇疆
saveConfig() {
const config = {
@@ -824,40 +876,40 @@
}
localStorage.setItem('Gy_Customer_Edit', JSON.stringify(config))
},
-
+
// 鎵撳紑瀵硅瘽妗嗘柟娉�
openAreaDialog() {
this.areaDialogVisible = true
},
-
+
openCurrencyDialog() {
this.currencyDialogVisible = true
},
-
+
openSettleStyleDialog() {
this.settleStyleDialogVisible = true
},
-
+
openCustomerTypeDialog() {
this.customerTypeDialogVisible = true
},
-
+
// 瀵硅瘽妗嗛�夋嫨鍥炶皟
handleAreaSelected(data) {
this.formData.HAreaName = data.鍦板尯鍚嶇О
this.formData.HAreaID = data.HItemID
},
-
+
handleCurrencySelected(data) {
this.formData.HCurName = data.璐у竵鍚嶇О
this.formData.HCurID = data.HItemID
},
-
+
handleSettleStyleSelected(data) {
this.formData.HSSName = data.缁撶畻鏂瑰紡鍚嶇О
this.formData.HSSID = data.HItemID
},
-
+
handleCustomerTypeSelected(data) {
this.formData.HCusTypeName = data.瀹㈡埛鍒嗙被鍚嶇О
this.formData.HCusTypeID = data.HItemID
@@ -895,4 +947,4 @@
.el-button-group {
margin-bottom: 10px;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.1