Commit 348cfbd5 authored by 高宇's avatar 高宇

a

parent 2a86db2b
...@@ -51,7 +51,10 @@ export default { ...@@ -51,7 +51,10 @@ export default {
getProjectClient: { getProjectClient: {
url: '/vue/project/of-client' url: '/vue/project/of-client'
}, },
// 获取客户信息商机筛选
getProjectClinetFilter: {
url: '/vue/project/get-filter-of-client'
},
// 搜索客户联系人 // 搜索客户联系人
searchContactByClientId: { searchContactByClientId: {
url: '/vue/search/contact-by-client-id' url: '/vue/search/contact-by-client-id'
......
...@@ -2,10 +2,8 @@ ...@@ -2,10 +2,8 @@
<section class="pull-right page-footer"> <section class="pull-right page-footer">
<el-pagination v-if="total > pager.pagesize" class="" <el-pagination v-if="total > pager.pagesize" class=""
background background
@size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="pager.page" :current-page="pager.page"
:page-sizes="[10, 20, 40, 60, 80, 100]"
:page-size="pager.pagesize" :page-size="pager.pagesize"
layout="total, prev, pager, next, jumper" layout="total, prev, pager, next, jumper"
:total="total"> :total="total">
...@@ -36,13 +34,6 @@ ...@@ -36,13 +34,6 @@
// this.$emit('update:pager', this.pager) // this.$emit('update:pager', this.pager)
}, },
methods: { methods: {
handleSizeChange (val) {
this.pager.page = 1
this.pager.pagesize = val
// this.totalcount = this.total
this.$emit('update:pager', this.pager)
// this.$parent.loadList()
},
handleCurrentChange (val) { handleCurrentChange (val) {
this.pager.page = val this.pager.page = val
// this.totalcount = this.total // this.totalcount = this.total
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
title="产品信息" title="产品信息"
:title-span="6" :title-span="6"
:model="form" :model="form"
search-key="Products" search-key="ProductSearch"
key-code="keyword" key-code="keyword"
type="keyword" type="keyword"
button-title="新建产品信息 " button-title="新建产品信息 "
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<client-form ref="clientForm" <client-form ref="clientForm"
:filter="filter" :filter="filter"
:update-filter="updateFilter" :update-filter="updateFilter"
@update:clientList="form =>{ updateForm(form)}" @update:clientList="(key, val) =>{ updateForm(key, val)}"
:form-search-key="formSearchKey"></client-form> :form-search-key="formSearchKey"></client-form>
<div class="page-body-content"> <div class="page-body-content">
<children-nav></children-nav> <children-nav></children-nav>
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
list: [] list: []
}, },
form: { form: {
'Products[keyword]': '' 'ProductSearch[keyword]': ''
}, },
filter: [], filter: [],
pagenation: { pagenation: {
...@@ -104,35 +104,53 @@ ...@@ -104,35 +104,53 @@
}, },
totalcount: 0, totalcount: 0,
loading: false, loading: false,
formSearchKey: 'Products' formSearchKey: 'ProductSearch'
} }
}, },
methods: { methods: {
updateFilter (form, trigger) { updateFilter (form, trigger) {
if (trigger.key === 'Products[product_type]') { // console.log(trigger)
if (trigger.key === 'ProductSearch[product_type]') {
this.getTypeOptions({ this.getTypeOptions({
product_type: trigger.value product_type: trigger.value
}, 'ProductSearch[product_component]') }, 'ProductSearch[product_component]')
} }
if (trigger.key === 'ProductSearch[product_component]' || trigger.key === 'ProductSearch[product_brand]') { if (trigger.key === 'ProductSearch[product_brand]') {
if (trigger.key === 'ProductSearch[product_component]' !== '') {
this.getBrandOptions({ this.getBrandOptions({
product_brand: form['ProductSearch[product_brand]'], product_brand: form['ProductSearch[product_brand]'],
product_component: form['ProductSearch[product_component]'] product_component: form['ProductSearch[product_component]']
}, 'ProductSearch[product_serie]') }, 'ProductSearch[product_serie]')
} }
}
}, },
getTypeOptions (data, key) { getTypeOptions (data, key) {
// console.log(key, this.filter)
requestAPI(api.getProductComponent, { requestAPI(api.getProductComponent, {
data data
}).then(res => { }).then(res => {
this.$set(this.filter, key, res) let filterItem = this.filter.find(item => {
return item.key === key
})
// console.log(filterItem)
if (filterItem) {
filterItem.value = res
}
// this.$set(this.filter, key, res)
// console.log(this.filter)
}) })
}, },
getBrandOptions (data, key) { getBrandOptions (data, key) {
requestAPI(api.getProductSerie, { requestAPI(api.getProductSerie, {
data data
}).then(res => { }).then(res => {
this.$set(this.filter, key, res) let filterItem = this.filter.find(item => {
return item.key === key
})
// console.log(filterItem)
if (filterItem) {
filterItem.value = res
}
}) })
}, },
delProduct (id) { delProduct (id) {
...@@ -173,7 +191,7 @@ ...@@ -173,7 +191,7 @@
}) })
}, },
close (getList) { close (getList) {
console.log(getList) // console.log(getList)
this.$refs.sidePopup && this.$refs.sidePopup &&
this.$refs.sidePopup.close() this.$refs.sidePopup.close()
if (getList) { if (getList) {
...@@ -194,18 +212,16 @@ ...@@ -194,18 +212,16 @@
this.$refs.sidePopup.close() this.$refs.sidePopup.close()
}, },
searchKeyword (search) { searchKeyword (search) {
this.updateForm(search) this.getList()
}, },
updateForm (form) { updateForm (key, val) {
// console.log(key, val)
let trigger = { let trigger = {
key: '', key: key,
value: '' value: val
} }
Object.keys(form).forEach(item => { // debugger
trigger.key = item Object.assign(this.form, {[key]: val})
trigger.value = form[item]
})
Object.assign(this.form, form)
this.updateFilter(this.form, trigger) this.updateFilter(this.form, trigger)
this.getList() this.getList()
}, },
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<el-select clearable <el-select clearable
v-model="clientForm[item.key]" v-model="clientForm[item.key]"
placeholder="请选择" placeholder="请选择"
v-if="!item.itemKey && item.key !== 'Filter[sort]'" size="mini"> v-if="!item.itemKey && item.key !== 'Filter[sort]'" size="mini" @change="(val) => {updateFormSelect(item.key, val)}">
<el-option v-for="(option, optKey) in item.value" <el-option v-for="(option, optKey) in item.value"
:key="optKey" :key="optKey"
:label="option.name" :label="option.name"
...@@ -41,8 +41,11 @@ ...@@ -41,8 +41,11 @@
clientForm: {} clientForm: {}
} }
}, },
props: ['filter', 'formSearchKey'], props: ['filter', 'formSearchKey', 'updateFilter'],
methods: { methods: {
updateFormSelect (key, val) {
this.updateFilter(key, val)
},
setSortIcon () { setSortIcon () {
if (this.clientForm['Filter[sort]'] === '') { if (this.clientForm['Filter[sort]'] === '') {
return 'fa-sort-amount-desc' return 'fa-sort-amount-desc'
...@@ -60,14 +63,7 @@ ...@@ -60,14 +63,7 @@
} else { } else {
this.clientForm['Filter[sort]'] = 'ASC' this.clientForm['Filter[sort]'] = 'ASC'
} }
}, this.$emit('update:clientList', 'Filter[sort]', this.clientForm['Filter[sort]'])
setSearchTime () {
let from = this.clientTimeRange.from
let to = this.clientTimeRange.to
this.$emit('update:clientList', Object.assign({}, {
[this.formSearchKey + '[from]']: from,
[this.formSearchKey + '[to]']: to
}, this.clientTimeForm, this.clientForm))
}, },
resetForm () { resetForm () {
Object.keys(this.clientForm).forEach(item => { Object.keys(this.clientForm).forEach(item => {
...@@ -78,7 +74,7 @@ ...@@ -78,7 +74,7 @@
watch: { watch: {
clientForm: { clientForm: {
handler (val) { handler (val) {
this.$emit('update:clientList', Object.assign({}, val, this.clientTimeForm)) this.$emit('update:clientList', Object.assign({}, val))
}, },
deep: true deep: true
} }
......
...@@ -96,13 +96,13 @@ ...@@ -96,13 +96,13 @@
}, },
methods: { methods: {
updateProduceType () { updateProduceType () {
this.$emit('update:form', {productType: this.form.productType}) this.$emit('update:form', {product_type: this.form.productType})
}, },
updateProductComponent () { updateProductComponent () {
this.$emit('update:form', {productComponent: this.form.productComponent}) this.$emit('update:form', {product_component: this.form.productComponent})
}, },
updateProductBrand () { updateProductBrand () {
this.$emit('update:form', {productBrand: this.form.productBrand}) this.$emit('update:form', {product_brand: this.form.productBrand})
}, },
tableRowClassName ({row, rowIndex}) { tableRowClassName ({row, rowIndex}) {
if (rowIndex % 2 === 0) { if (rowIndex % 2 === 0) {
......
...@@ -123,10 +123,10 @@ ...@@ -123,10 +123,10 @@
}) })
}, },
updateForm (form) { updateForm (form) {
if (form.productType) { if (form.product_type) {
requestAPI(api.getProductComponent, { requestAPI(api.getProductComponent, {
data: { data: {
product_type: form.productType product_type: form.product_type
} }
}).then(res => { }).then(res => {
this.$refs.productSerieTable.resetComponent() this.$refs.productSerieTable.resetComponent()
......
<template>
<div :style="setFormStyle()">
<el-form size="mini" :model="clientForm" label-width="0" label-position="top">
<el-row class="form-content">
<el-col :span="4" v-for="(item, key) in filter" :key="key">
<el-form-item>
<span slot="label" v-if="item.key !== 'Filter[sort]'">
<a @click.prevent="timeSort" v-if="item.key === 'Filter[name]'">
{{item.name}}
<i :class="['fa', setSortIcon()]"></i>
</a>
<span v-else>
{{item.name}}
</span>
</span>
<el-select clearable
v-model="clientForm[item.key]"
placeholder="请选择"
v-if="!item.itemKey && item.key !== 'Filter[sort]'" size="mini">
<el-option v-for="(option, optKey) in item.value"
:key="optKey"
:label="option.name"
:value="option.key">
<span style="font-size: 12px;">{{option.name}}</span>
</el-option>
</el-select>
<el-cascader
:ref="'elCasc' + key"
v-model="item.cascader"
:props="props"
clearable
change-on-select
v-if="item.itemKey"
:options="item.value"
@change="setCascader(item, key)"
></el-cascader>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import {findWhere} from '../../../lib/viewHelper'
import $ from 'jquery'
const timeItem = ['period']
export default {
name: 'client-form',
data () {
return {
clientTimeForm: {},
clientTimeRange: {
from: '',
to: ''
},
clientForm: {},
props: {
label: 'name',
value: 'key',
children: 'child'
}
}
},
props: ['filter', 'formSearchKey'],
methods: {
setFormStyle () {
if (navigator.appVersion.indexOf('MSIE') !== -1) {
let len = this.filter.length
if (len > 5) {
return {minHeight: '185px'}
} else if (len > 10) {
return {minHeight: '225px'}
} else {
return {minHeight: '110px'}
}
}
},
setCascader (item, key) {
if (item.cascader.length === 1) {
this.clientForm[item.key] = item.cascader[0]
this.clientForm[item.itemKey] = ''
} else if (item.cascader.length === 2) {
this.clientForm[item.itemKey] = item.cascader[0]
this.clientForm[item.key] = item.cascader[1]
} else {
this.clientForm[item.itemKey] = ''
this.clientForm[item.key] = ''
}
},
setDefault (filter) {
filter.forEach(item => {
if (item.default) {
let keys = findWhere(item.value, item.default, 'key')
if (keys.node) {
if (keys.parentNode) {
this.clientForm[item.itemKey] = keys.parentNode.key
this.clientForm[item.key] = keys.node.key
item.cascader = [keys.parentNode.key, keys.node.key]
} else {
this.clientForm[item.itemKey] = ''
this.clientForm[item.key] = keys.node.key
item.cascader = [keys.node.key]
}
}
}
})
},
init (isCascader) {
this.$watch('clientForm', (val) => {
this.$emit('update:clientList', Object.assign({}, val, this.clientTimeForm))
}, {deep: true})
this.$watch('clientTimeForm', (val) => {
let perid = val[this.formSearchKey + '[period]']
this.$emit('update:clientList', Object.assign({}, {[this.formSearchKey + '[period]']: perid}, this.clientForm))
}, {deep: true})
let _this = this
if (isCascader) {
$(document).ready(() => {
$(document).on('mouseleave', '.el-cascader-menus', () => {
Object.keys(_this.$refs).forEach(item => {
_this.$refs[item][0].menuVisible = false
})
})
})
}
},
setSortIcon () {
if (this.clientForm['Filter[sort]'] === '') {
return 'fa-sort-amount-desc'
} else if (this.clientForm['Filter[sort]'] === 'DESC') {
return 'fa-sort-amount-desc'
} else {
return 'fa-sort-amount-asc'
}
},
timeSort () {
if (this.clientForm['Filter[sort]'] === '') {
this.clientForm['Filter[sort]'] = 'ASC'
} else if (this.clientForm['Filter[sort]'] === 'ASC') {
this.clientForm['Filter[sort]'] = 'DESC'
} else {
this.clientForm['Filter[sort]'] = 'ASC'
}
},
setSearchTime () {
let from = this.clientTimeRange.from
let to = this.clientTimeRange.to
this.$emit('update:clientList', Object.assign({}, {
[this.formSearchKey + '[from]']: from,
[this.formSearchKey + '[to]']: to
}, this.clientTimeForm, this.clientForm))
},
resetForm () {
Object.keys(this.clientForm).forEach(item => {
this.clientForm[item] = ''
})
Object.keys(this.clientTimeRange).forEach(item => {
this.clientTimeRange[item] = ''
})
Object.keys(this.clientTimeForm).forEach(item => {
this.clientTimeForm[item] = ''
})
}
},
mounted () {
},
watch: {
'filter' (val) {
let isCascader = false
val.forEach(item => {
if (item.itemKey) {
this.$set(this.clientForm, item.itemKey, '')
this.$set(item, 'cascader', [])
isCascader = true
}
this.$set(this.clientForm, item.key, '')
})
this.$nextTick(() => {
this.init(isCascader)
this.setDefault(val)
})
},
'formSearchKey': {
handler (val) {
if (val !== '') {
timeItem.forEach(item => {
this.$set(this.clientTimeForm, val + '[' + item + ']', '')
})
}
},
immediate: true
}
}
}
</script>
<style scoped>
.form-content-time-top {
background: #FFF;
}
.form-content-time-top .el-form-item {
margin: 7px 0 9px;
}
.form-content-time-top .el-col {
padding: 0 15px;
}
</style>
<style>
.form-content .el-form-item__label {
font-size: 12px;
font-weight: normal;
padding: 0 2px 0 0;
}
.form-content-time-top .el-radio-button__orig-radio:checked + .el-radio-button__inner {
color: #fff !important;
background-color: #333744 !important;
border-color: #282b35 !important;
box-shadow: -1px 0 0 0 #282b35;
}
.form-content-time-top .el-radio-button:first-child .el-radio-button__inner {
border-left: 1px solid #DCDFE6;
}
.form-content-time-top .el-radio-button__inner:hover {
border-color: #DCDFE6 !important;
}
.form-content-time-top .el-form-item .el-form-item__content .form-content-time-range {
display: flex;
font-size: 12px;
}
</style>
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
:title="'客户名称:' + model.name" :title="'客户名称:' + model.name"
:title-span="12" :title-span="12"
type=""></client-header> type=""></client-header>
<client-form ref="clientForm"
:filter="filter"
@update:clientList="form =>{ updateForm(form)}"
:form-search-key="formSearchKey"></client-form>
<div class="page-body-content"> <div class="page-body-content">
<client-nav :trigger="addProject" trigger-text="新建商机"></client-nav> <client-nav :trigger="addProject" trigger-text="新建商机"></client-nav>
<div v-loading="loading"> <div v-loading="loading">
...@@ -81,6 +85,7 @@ ...@@ -81,6 +85,7 @@
requestAPI, requestAPI,
api api
} from '@/lib/commonMixin' } from '@/lib/commonMixin'
import clientForm from './projectClientForm'
import ScheduleItem from '../scheduleItem' import ScheduleItem from '../scheduleItem'
import clientHeader from '../../common/clientHeader' import clientHeader from '../../common/clientHeader'
import Pagenation from '../../common/schedulePagenation' import Pagenation from '../../common/schedulePagenation'
...@@ -95,6 +100,7 @@ ...@@ -95,6 +100,7 @@
}, },
data () { data () {
return { return {
formSearchKey: 'ProjectSearch',
lmTemplate: [ lmTemplate: [
{ {
name: '客户名称', name: '客户名称',
...@@ -157,6 +163,7 @@ ...@@ -157,6 +163,7 @@
client_id: '', client_id: '',
loading: false, loading: false,
clientName: '', clientName: '',
form: {},
model: { model: {
name: '' name: ''
}, },
...@@ -167,11 +174,13 @@ ...@@ -167,11 +174,13 @@
pagenation: { pagenation: {
page: 1 page: 1
}, },
filter: [],
totalcount: 0, totalcount: 0,
tableList: [] tableList: []
} }
}, },
components: { components: {
clientForm,
ScheduleItem, ScheduleItem,
clientHeader, clientHeader,
Pagenation, Pagenation,
...@@ -180,6 +189,14 @@ ...@@ -180,6 +189,14 @@
operationAnnotation operationAnnotation
}, },
methods: { methods: {
updateForm (form) {
Object.assign(this.form, form)
this.getList()
},
popupClose () {
this.$refs.sidePopup &&
this.$refs.sidePopup.close()
},
editAnnotation (item) { editAnnotation (item) {
this.operationPage = 'operationAnnotation' this.operationPage = 'operationAnnotation'
this.operationTitle = '编辑商机批注' this.operationTitle = '编辑商机批注'
...@@ -245,6 +262,11 @@ ...@@ -245,6 +262,11 @@
Object.assign(this.pagenation, pager) Object.assign(this.pagenation, pager)
this.getList(true) this.getList(true)
}, },
getFilter () {
requestAPI(api.getProjectClinetFilter).then(res => {
this.filter = res
})
},
getList (toTop) { getList (toTop) {
if (this.loading) { if (this.loading) {
return return
...@@ -252,6 +274,7 @@ ...@@ -252,6 +274,7 @@
this.loading = true this.loading = true
requestAPI(api.getProjectClient, { requestAPI(api.getProjectClient, {
data: { data: {
...this.form,
id: this.$route.params.id, id: this.$route.params.id,
page: this.pagenation.page page: this.pagenation.page
} }
...@@ -276,7 +299,10 @@ ...@@ -276,7 +299,10 @@
Object.keys(res.model).forEach(item => { Object.keys(res.model).forEach(item => {
this.$set(this.model, item, res.model[item]) this.$set(this.model, item, res.model[item])
}) })
this.getFilter()
this.$nextTick(() => {
this.getList() this.getList()
})
}, error => { }, error => {
if (Array.isArray(error.msg)) { if (Array.isArray(error.msg)) {
error.msg.forEach(item => { error.msg.forEach(item => {
......
...@@ -157,7 +157,9 @@ ...@@ -157,7 +157,9 @@
popupClose () { popupClose () {
this.$refs.sidePopup && this.$refs.sidePopup &&
this.$refs.sidePopup.close() this.$refs.sidePopup.close()
if (this.operationPage !== '') {
this.$refs[this.operationPage].reset && this.$refs[this.operationPage].reset() this.$refs[this.operationPage].reset && this.$refs[this.operationPage].reset()
}
}, },
resetForm () { resetForm () {
this.pagenation.page = 1 this.pagenation.page = 1
......
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