Commit a01d8130 by lichengming

修改了委托单管理委托单位下拉

parent 04077f21
...@@ -8,6 +8,12 @@ import { https } from '../https' ...@@ -8,6 +8,12 @@ import { https } from '../https'
export default { export default {
// page // page
page: data => http.post('meter/v1/entrust/page', data).then(res => res), page: data => http.post('meter/v1/entrust/page', data).then(res => res),
// list
pageList: data => http.get('res/v1/customer/list').then(res => res),
// querylist
pageQueryList: data =>
http.get('/res/v1/customer/list?cname=' + data).then(res => res),
pageSendEntrust: data => pageSendEntrust: data =>
http http
.post('meter/v1/entrust/page_send_draft_entrust', data) .post('meter/v1/entrust/page_send_draft_entrust', data)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
transfer transfer
change-on-select> change-on-select>
<Input <Input
v-model="value" v-model="value.join(' ')"
@on-change="_clear" @on-change="_clear"
placeholder="请选择省、市、区" placeholder="请选择省、市、区"
readonly readonly
......
...@@ -14,7 +14,10 @@ ...@@ -14,7 +14,10 @@
</Radio-group> </Radio-group>
</Form-item> </Form-item>
<Form-item label="委托单位" prop="client" class="width-48"> <Form-item label="委托单位" prop="client" class="width-48">
<Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/> <!-- <Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/>-->
<AutoComplete :value="formObj.client" :downData="customerData" @on-result-change="_cusNameChange"
name="client" placeholder="请输入或选择委托单位"
></AutoComplete>
</Form-item> </Form-item>
<Form-item label="联系人" prop="operation.person" class="width-48"> <Form-item label="联系人" prop="operation.person" class="width-48">
<Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/> <Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/>
...@@ -122,10 +125,11 @@ ...@@ -122,10 +125,11 @@
*/ */
import { lmsBaseDict, meterEntrust } from '../../../api' import { lmsBaseDict, meterEntrust } from '../../../api'
import CityNameCascader from '../../../components/base/CityNameCascader' import CityNameCascader from '../../../components/base/CityNameCascader'
import AutoComplete from '../../../components/base/AutoCompletes'
import EditModal from './EditModal' import EditModal from './EditModal'
export default { export default {
components: { EditModal, CityNameCascader }, components: { EditModal, CityNameCascader, AutoComplete },
data() { data() {
const validateRemark = (rule, value, callback) => { const validateRemark = (rule, value, callback) => {
if (this.testedCityData.length === 0) { if (this.testedCityData.length === 0) {
...@@ -134,13 +138,20 @@ export default { ...@@ -134,13 +138,20 @@ export default {
callback() callback()
} }
} }
const validateClient = (rule, value, callback) => {
if (this.formObj.client === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
return { return {
formId: 'meterSendTestEditFormId', formId: 'meterSendTestEditFormId',
getPage: { getPage: {
records: [] records: []
}, },
testedCityData: [], testedCityData: [],
customerData: [],
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }], judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
iconMsg: [ iconMsg: [
{ type: 'ios-clock', id: '', name: '编辑' }, { type: 'ios-clock', id: '', name: '编辑' },
...@@ -216,7 +227,12 @@ export default { ...@@ -216,7 +227,12 @@ export default {
} }
], ],
client: [ client: [
{ required: true, message: '委托单位不能为空', trigger: 'blur' } {
required: true,
validator: validateClient,
message: '委托单位不能为空',
trigger: 'blur'
}
], ],
'operation.person': [ 'operation.person': [
{ required: true, message: '联系人不能为空', trigger: 'blur' } { required: true, message: '联系人不能为空', trigger: 'blur' }
...@@ -246,6 +262,34 @@ export default { ...@@ -246,6 +262,34 @@ export default {
// ) // )
// }, // },
methods: { methods: {
_cusNameChange(msg, data) {
// this.financeObj = {} // 清空维护发票信息的数据
if (this.$string(this.id).isEmpty()) {
// 添加的时候选择单位
switch (msg) {
case 'select':
this._customerMatch(data)
break
case 'query':
this._cusNameQuery(data)
break
}
} else {
// 编辑的时候选择单位(互不影响)
alert('编辑')
// this.cusName = data
// this.formObj.customer.cname = data
}
},
_customerMatch(data) {
// this.formObj.client = data
this._getQueryList(data)
console.log(data)
},
_cusNameQuery(query) {
alert('query')
console.log(query)
},
_ctimeChange(data) { _ctimeChange(data) {
console.log('时间', data) console.log('时间', data)
this.formObj.edate = data this.formObj.edate = data
...@@ -470,6 +514,7 @@ export default { ...@@ -470,6 +514,7 @@ export default {
}, },
_open() { _open() {
this.showModal = true this.showModal = true
this._getList()
this.$refs.formObj.resetFields() this.$refs.formObj.resetFields()
this._hideLoading() this._hideLoading()
this.getPage.records = [] this.getPage.records = []
...@@ -480,6 +525,7 @@ export default { ...@@ -480,6 +525,7 @@ export default {
}, },
_openEdit(formObj) { _openEdit(formObj) {
this._getList()
this.getPage.records = [] this.getPage.records = []
this.showModal = true this.showModal = true
this.$refs.formObj.resetFields() this.$refs.formObj.resetFields()
...@@ -492,6 +538,34 @@ export default { ...@@ -492,6 +538,34 @@ export default {
this.getPage.records = formObj.sampleList this.getPage.records = formObj.sampleList
console.log(this.formObj) console.log(this.formObj)
}, },
_getList: async function() {
const result = await meterEntrust.pageList()
const list = []
console.log('result', result)
if (result) {
for (let i = 0; i < result.length; i++) {
console.log(result[i].cname)
list.push(result[i].cname)
}
console.log('委托单位名单', list)
this.customerData = list
}
},
_getQueryList: async function(data) {
const result = await meterEntrust.pageQueryList(data)
console.log(result)
if (result) {
this.formObj.client = data
this.formObj.operation.person = result[0].contact
this.formObj.operation.tel = result[0].mobile
this.formObj.operation.fax = result[0].fax
this.testedCityData = [
result[0].province,
result[0].city,
result[0].area
]
}
},
_getAptitudeList: async function() { _getAptitudeList: async function() {
const result = await lmsBaseDict.getItem('subcontractorAptitude') const result = await lmsBaseDict.getItem('subcontractorAptitude')
if (result) { if (result) {
......
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
</Radio-group> </Radio-group>
</Form-item> </Form-item>
<Form-item label="委托单位" prop="client" class="width-48"> <Form-item label="委托单位" prop="client" class="width-48">
<Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/> <!-- <Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/>-->
<AutoComplete :value="formObj.client" :downData="customerData" @on-result-change="_cusNameChange"
name="client" placeholder="请输入或选择委托单位"
></AutoComplete>
</Form-item> </Form-item>
<Form-item label="联系人" prop="operation.person" class="width-48"> <Form-item label="联系人" prop="operation.person" class="width-48">
<Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/> <Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/>
...@@ -124,10 +127,11 @@ ...@@ -124,10 +127,11 @@
*/ */
import { lmsBaseDict, meterEntrust } from '../../../api' import { lmsBaseDict, meterEntrust } from '../../../api'
import CityNameCascader from '../../../components/base/CityNameCascader' import CityNameCascader from '../../../components/base/CityNameCascader'
import AutoComplete from '../../../components/base/AutoCompletes'
import EditModal from './EditModal' import EditModal from './EditModal'
export default { export default {
components: { CityNameCascader, EditModal }, components: { CityNameCascader, EditModal, AutoComplete },
data() { data() {
const validateRemark = (rule, value, callback) => { const validateRemark = (rule, value, callback) => {
if (this.testedCityData.length === 0) { if (this.testedCityData.length === 0) {
...@@ -136,11 +140,19 @@ export default { ...@@ -136,11 +140,19 @@ export default {
callback() callback()
} }
} }
const validateClient = (rule, value, callback) => {
if (this.formObj.client === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
return { return {
formId: 'meterSendTestEditFormId', formId: 'meterSendTestEditFormId',
getPage: { getPage: {
records: [] records: []
}, },
customerData: [],
cityData: [], cityData: [],
testedCityData: [], testedCityData: [],
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }], judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
...@@ -195,21 +207,27 @@ export default { ...@@ -195,21 +207,27 @@ export default {
postcode: '', postcode: '',
email: '', email: '',
fee: '' fee: ''
},
testedTemp: {
testedName: '',
testedContactor: '',
testedContactorTel: '',
testedTel: '',
testedProvince: '',
testedCity: '',
testedCounty: '',
testedStreet: ''
} }
}, },
testedTemp: {
testedName: '',
testedContactor: '',
testedContactorTel: '',
testedTel: '',
testedProvince: '',
testedCity: '',
testedCounty: '',
testedStreet: ''
},
ruleValidate: { ruleValidate: {
client: [ client: [
{ required: true, message: '委托单位不能为空', trigger: 'blur' } {
required: true,
message: '委托单位不能为空',
validator: validateClient,
trigger: 'blur'
}
], ],
'operation.person': [ 'operation.person': [
{ required: true, message: '联系人不能为空', trigger: 'blur' } { required: true, message: '联系人不能为空', trigger: 'blur' }
...@@ -237,14 +255,42 @@ export default { ...@@ -237,14 +255,42 @@ export default {
aptitudeData: [] aptitudeData: []
} }
}, },
created() { // created() {
this.$set( // this.$set(
this.formObj, // this.formObj,
'tested', // 'tested',
JSON.parse(JSON.stringify(this.testedTemp)) // JSON.parse(JSON.stringify(this.testedTemp))
) // )
}, // },
methods: { methods: {
_cusNameChange(msg, data) {
// this.financeObj = {} // 清空维护发票信息的数据
if (this.$string(this.id).isEmpty()) {
// 添加的时候选择单位
switch (msg) {
case 'select':
this._customerMatch(data)
break
case 'query':
this._cusNameQuery(data)
break
}
} else {
// 编辑的时候选择单位(互不影响)
alert('编辑')
// this.cusName = data
// this.formObj.customer.cname = data
}
},
_customerMatch(data) {
// this.formObj.client = data
this._getQueryList(data)
console.log(data)
},
_cusNameQuery(query) {
alert('query')
console.log(query)
},
_ctimeChange(data) { _ctimeChange(data) {
console.log('时间', data) console.log('时间', data)
this.formObj.edate = data this.formObj.edate = data
...@@ -329,16 +375,22 @@ export default { ...@@ -329,16 +375,22 @@ export default {
_emptyProvince() { _emptyProvince() {
this.cityData = [] this.cityData = []
this.testedCityData = [] this.testedCityData = []
this.formObj.tested.testedProvince = '' // this.formObj.tested.testedProvince = ''
this.formObj.tested.testedCity = '' // this.formObj.tested.testedCity = ''
this.formObj.tested.testedCounty = '' // this.formObj.tested.testedCounty = ''
// this.formObj.testedTemp.testedProvince = ''
// this.formObj.testedTemp.testedCity = ''
// this.formObj.testedTemp.testedCounty = ''
}, },
_testedChange(data, msg) { _testedChange(data, msg) {
// 省、市、区 // 省、市、区
if (msg === 'clear') { if (msg === 'clear') {
this.formObj.tested.testedProvince = '' // this.formObj.tested.testedProvince = ''
this.formObj.tested.testedCity = '' // this.formObj.tested.testedCity = ''
this.formObj.tested.testedCounty = '' // this.formObj.tested.testedCounty = ''
this.formObj.testedTemp.testedProvince = ''
this.formObj.testedTemp.testedCity = ''
this.formObj.testedTemp.testedCounty = ''
this.formObj.province = '' this.formObj.province = ''
this.formObj.city = '' this.formObj.city = ''
this.formObj.county = '' this.formObj.county = ''
...@@ -347,7 +399,6 @@ export default { ...@@ -347,7 +399,6 @@ export default {
// this.formObj.tested.testedProvince = data.value[0] // this.formObj.tested.testedProvince = data.value[0]
// this.formObj.tested.testedCity = data.value[1] // this.formObj.tested.testedCity = data.value[1]
// this.formObj.tested.testedCounty = data.value[2] // this.formObj.tested.testedCounty = data.value[2]
this.formObj.province = data.value[0] this.formObj.province = data.value[0]
this.formObj.city = data.value[1] this.formObj.city = data.value[1]
this.formObj.county = data.value[2] this.formObj.county = data.value[2]
...@@ -456,6 +507,7 @@ export default { ...@@ -456,6 +507,7 @@ export default {
}, },
_open(formObj) { _open(formObj) {
this.showModal = true this.showModal = true
this._getList()
this.$refs.formObj.resetFields() this.$refs.formObj.resetFields()
this._emptyProvince() this._emptyProvince()
this._hideLoading() this._hideLoading()
...@@ -473,6 +525,7 @@ export default { ...@@ -473,6 +525,7 @@ export default {
} }
}, },
_openEdit(formObj) { _openEdit(formObj) {
this._getList()
this.getPage.records = [] this.getPage.records = []
this.showModal = true this.showModal = true
this.$refs.formObj.resetFields() this.$refs.formObj.resetFields()
...@@ -496,6 +549,34 @@ export default { ...@@ -496,6 +549,34 @@ export default {
this.testedCityData.push(formObj.county) this.testedCityData.push(formObj.county)
} }
}, },
_getList: async function() {
const result = await meterEntrust.pageList()
const list = []
console.log('result', result)
if (result) {
for (let i = 0; i < result.length; i++) {
console.log(result[i].cname)
list.push(result[i].cname)
}
console.log('委托单位名单', list)
this.customerData = list
}
},
_getQueryList: async function(data) {
const result = await meterEntrust.pageQueryList(data)
console.log(result)
if (result) {
this.formObj.client = data
this.formObj.operation.person = result[0].contact
this.formObj.operation.tel = result[0].mobile
this.formObj.operation.fax = result[0].fax
this.testedCityData = [
result[0].province,
result[0].city,
result[0].area
]
}
},
_getAptitudeList: async function() { _getAptitudeList: async function() {
const result = await lmsBaseDict.getItem('subcontractorAptitude') const result = await lmsBaseDict.getItem('subcontractorAptitude')
if (result) { if (result) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment