Browse Source

选择客户--新增客户

zhanglei
yunuo970428 11 months ago
parent
commit
772e86d4d6
  1. 110
      yxt-as-ui/src/components/publicPage/selectCustomer.vue

110
yxt-as-ui/src/components/publicPage/selectCustomer.vue

@ -23,7 +23,7 @@
</el-form-item>
<el-form-item label="客户类型">
<el-select v-model="listQuery.params.customerTypeKey" class="addinputw" placeholder="请选择">
<el-option v-for="(item, index) in merType" :key="index.dictKey" :label="item.dictValue" :value="item.dictKey"/>
<el-option v-for="(item, index) in customerType_list" :key="index.dictKey" :label="item.dictValue" :value="item.dictKey"/>
</el-select>
</el-form-item>
</el-form>
@ -44,7 +44,7 @@
<el-table-column fixed label="序号" type="index" width="80" :index="indexMethod" align="center"/>
<el-table-column fixed label="操作" width="100" align="center">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="handleConfirm(scope.row)">确认</el-button>
<el-button type="primary" size="small" @click="handleAffirm(scope.row)">确认</el-button>
</template>
</el-table-column>
<el-table-column prop="customerName" label="客户名称" width="120" align="center"/>
@ -64,6 +64,35 @@
<!--End查询列表部分-->
</div>
</div>
<!-- 新增客户 -->
<customermanagementAdd ref="divAdd" v-show="viewState == 2" @doback="resetState" @reloadlist="getList" />
<!-- 客户登记 -->
<el-dialog :visible.sync="dialogVisible" width="30%" :show-close="false">
<el-form ref="form_obj" v-model="formobj" class="formaddcopy02">
<el-row style="border-top: 1px solid #E0E3EB">
<el-col :span="24">
<div class="span-sty">联络方式</div>
<el-form-item>
<el-select v-model="formobj.visitWayKey" class="addinputInfo" filterable placeholder="" @change="visitWayChange">
<el-option v-for="item in visitWay_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<div class="span-sty">客户类型</div>
<el-form-item>
<el-radio-group class="addinputInfo" v-model="formobj.customerType">
<el-radio v-for="item in customerType_list" :key="item.dictKey" :label="item.dictValue" @change="customerTypeChange">{{ item.dictValue }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirm()"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -72,18 +101,27 @@ import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import ButtonBar from '@/components/ButtonBar'
import { customerList, typeValues } from '@/api/Common/dictcommons'
import customermanagementAdd from '@/views/client/customermanagement/customermanagementAdd'
export default {
name: 'Customer',
components: {
Pagination,
pageye,
ButtonBar
ButtonBar,
customermanagementAdd
},
data() {
return {
btndisabled: false,
btnList: [
{
type: 'primary',
size: 'small',
icon: 'plus',
btnKey: 'toAdd',
btnLabel: '新增客户'
},
{
type: 'info',
size: 'small',
@ -98,7 +136,6 @@ export default {
tableKey: 0,
list: [],
sids: [], // SIDs
merType: [],
FormLoading: false,
listLoading: false,
//
@ -115,7 +152,17 @@ export default {
billType: '',
useOrgSid: ''
}
}
},
dialogVisible: false,
formobj: {
visitWay: '', //
visitWayKey: '',
customerType: '', //
customerTypeKey: '',
psid: ''
},
visitWay_list: [],
customerType_list: []
}
},
mounted() {
@ -123,9 +170,14 @@ export default {
},
methods: {
init() {
typeValues({ type: 'visitWay' }).then((res) => {
if (res.success) {
this.visitWay_list = res.data
}
})
typeValues({ type: 'customerType' }).then((res) => {
if (res.success) {
this.merType = res.data
this.customerType_list = res.data
}
})
},
@ -141,6 +193,9 @@ export default {
btnHandle(btnKey) {
console.log('XXXXXXXXXXXXXXX ' + btnKey)
switch (btnKey) {
case 'toAdd':
this.toAdd()
break
case 'doClose':
this.doClose()
break
@ -191,9 +246,44 @@ export default {
this.listQuery.params.customerTypeKey = ''
this.getList()
},
handleConfirm(row) {
toAdd() {
this.dialogVisible = true
this.formobj = {
visitWay: '', //
visitWayKey: '',
customerType: '', //
customerTypeKey: '',
psid: ''
}
},
visitWayChange(value) {
const choose = this.visitWay_list.filter((item) => item.dictKey === value)
if (choose.length > 0 && choose !== null) {
this.formobj.visitWay = choose[0].dictValue
}
},
customerTypeChange(value) {
const choose = this.customerType_list.filter((item) => item.dictValue === value)
if (choose.length > 0 && choose !== null) {
this.formobj.customerTypeKey = choose[0].dictKey
this.formobj.psid = choose[0].sid
}
},
handleConfirm() {
if (this.formobj.customerType !== '' && this.formobj.visitWay !== '') {
this.dialogVisible = false
this.viewState = 2
this.$refs['divAdd'].showAdd(this.formobj)
} else {
this.$message({ showClose: true, message: '请填写联络方式和客户类型', type: 'warning' })
}
},
handleAffirm(row) {
this.$emit('backData', row)
},
resetState() {
this.viewState = 1
},
doClose() {
this.$emit('doback')
}
@ -201,4 +291,10 @@ export default {
}
</script>
<style scoped>
.span-sty {
width: 100px !important;
}
.addinputInfo {
margin-left: 90px !important;
}
</style>

Loading…
Cancel
Save