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

a

parent 2a86db2b
......@@ -51,7 +51,10 @@ export default {
getProjectClient: {
url: '/vue/project/of-client'
},
// 获取客户信息商机筛选
getProjectClinetFilter: {
url: '/vue/project/get-filter-of-client'
},
// 搜索客户联系人
searchContactByClientId: {
url: '/vue/search/contact-by-client-id'
......
......@@ -2,10 +2,8 @@
<section class="pull-right page-footer">
<el-pagination v-if="total > pager.pagesize" class=""
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pager.page"
:page-sizes="[10, 20, 40, 60, 80, 100]"
:page-size="pager.pagesize"
layout="total, prev, pager, next, jumper"
:total="total">
......@@ -36,13 +34,6 @@
// this.$emit('update:pager', this.pager)
},
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) {
this.pager.page = val
// this.totalcount = this.total
......
......@@ -5,7 +5,7 @@
title="产品信息"
:title-span="6"
:model="form"
search-key="Products"
search-key="ProductSearch"
key-code="keyword"
type="keyword"
button-title="新建产品信息 "
......@@ -15,7 +15,7 @@
<client-form ref="clientForm"
:filter="filter"
:update-filter="updateFilter"
@update:clientList="form =>{ updateForm(form)}"
@update:clientList="(key, val) =>{ updateForm(key, val)}"
:form-search-key="formSearchKey"></client-form>
<div class="page-body-content">
<children-nav></children-nav>
......@@ -96,7 +96,7 @@
list: []
},
form: {
'Products[keyword]': ''
'ProductSearch[keyword]': ''
},
filter: [],
pagenation: {
......@@ -104,35 +104,53 @@
},
totalcount: 0,
loading: false,
formSearchKey: 'Products'
formSearchKey: 'ProductSearch'
}
},
methods: {
updateFilter (form, trigger) {
if (trigger.key === 'Products[product_type]') {
// console.log(trigger)
if (trigger.key === 'ProductSearch[product_type]') {
this.getTypeOptions({
product_type: trigger.value
}, 'ProductSearch[product_component]')
}
if (trigger.key === 'ProductSearch[product_component]' || trigger.key === 'ProductSearch[product_brand]') {
this.getBrandOptions({
product_brand: form['ProductSearch[product_brand]'],
product_component: form['ProductSearch[product_component]']
}, 'ProductSearch[product_serie]')
if (trigger.key === 'ProductSearch[product_brand]') {
if (trigger.key === 'ProductSearch[product_component]' !== '') {
this.getBrandOptions({
product_brand: form['ProductSearch[product_brand]'],
product_component: form['ProductSearch[product_component]']
}, 'ProductSearch[product_serie]')
}
}
},
getTypeOptions (data, key) {
// console.log(key, this.filter)
requestAPI(api.getProductComponent, {
data
}).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) {
requestAPI(api.getProductSerie, {
data
}).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) {
......@@ -173,7 +191,7 @@
})
},
close (getList) {
console.log(getList)
// console.log(getList)
this.$refs.sidePopup &&
this.$refs.sidePopup.close()
if (getList) {
......@@ -194,18 +212,16 @@
this.$refs.sidePopup.close()
},
searchKeyword (search) {
this.updateForm(search)
this.getList()
},
updateForm (form) {
updateForm (key, val) {
// console.log(key, val)
let trigger = {
key: '',
value: ''
key: key,
value: val
}
Object.keys(form).forEach(item => {
trigger.key = item
trigger.value = form[item]
})
Object.assign(this.form, form)
// debugger
Object.assign(this.form, {[key]: val})
this.updateFilter(this.form, trigger)
this.getList()
},
......
......@@ -17,7 +17,7 @@
<el-select clearable
v-model="clientForm[item.key]"
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"
:key="optKey"
:label="option.name"
......@@ -41,8 +41,11 @@
clientForm: {}
}
},
props: ['filter', 'formSearchKey'],
props: ['filter', 'formSearchKey', 'updateFilter'],
methods: {
updateFormSelect (key, val) {
this.updateFilter(key, val)
},
setSortIcon () {
if (this.clientForm['Filter[sort]'] === '') {
return 'fa-sort-amount-desc'
......@@ -60,14 +63,7 @@
} 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))
this.$emit('update:clientList', 'Filter[sort]', this.clientForm['Filter[sort]'])
},
resetForm () {
Object.keys(this.clientForm).forEach(item => {
......@@ -78,7 +74,7 @@
watch: {
clientForm: {
handler (val) {
this.$emit('update:clientList', Object.assign({}, val, this.clientTimeForm))
this.$emit('update:clientList', Object.assign({}, val))
},
deep: true
}
......
......@@ -96,13 +96,13 @@
},
methods: {
updateProduceType () {
this.$emit('update:form', {productType: this.form.productType})
this.$emit('update:form', {product_type: this.form.productType})
},
updateProductComponent () {
this.$emit('update:form', {productComponent: this.form.productComponent})
this.$emit('update:form', {product_component: this.form.productComponent})
},
updateProductBrand () {
this.$emit('update:form', {productBrand: this.form.productBrand})
this.$emit('update:form', {product_brand: this.form.productBrand})
},
tableRowClassName ({row, rowIndex}) {
if (rowIndex % 2 === 0) {
......
......@@ -123,10 +123,10 @@
})
},
updateForm (form) {
if (form.productType) {
if (form.product_type) {
requestAPI(api.getProductComponent, {
data: {
product_type: form.productType
product_type: form.product_type
}
}).then(res => {
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 @@
:title="'客户名称:' + model.name"
:title-span="12"
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">
<client-nav :trigger="addProject" trigger-text="新建商机"></client-nav>
<div v-loading="loading">
......@@ -81,6 +85,7 @@
requestAPI,
api
} from '@/lib/commonMixin'
import clientForm from './projectClientForm'
import ScheduleItem from '../scheduleItem'
import clientHeader from '../../common/clientHeader'
import Pagenation from '../../common/schedulePagenation'
......@@ -95,6 +100,7 @@
},
data () {
return {
formSearchKey: 'ProjectSearch',
lmTemplate: [
{
name: '客户名称',
......@@ -157,6 +163,7 @@
client_id: '',
loading: false,
clientName: '',
form: {},
model: {
name: ''
},
......@@ -167,11 +174,13 @@
pagenation: {
page: 1
},
filter: [],
totalcount: 0,
tableList: []
}
},
components: {
clientForm,
ScheduleItem,
clientHeader,
Pagenation,
......@@ -180,6 +189,14 @@
operationAnnotation
},
methods: {
updateForm (form) {
Object.assign(this.form, form)
this.getList()
},
popupClose () {
this.$refs.sidePopup &&
this.$refs.sidePopup.close()
},
editAnnotation (item) {
this.operationPage = 'operationAnnotation'
this.operationTitle = '编辑商机批注'
......@@ -245,6 +262,11 @@
Object.assign(this.pagenation, pager)
this.getList(true)
},
getFilter () {
requestAPI(api.getProjectClinetFilter).then(res => {
this.filter = res
})
},
getList (toTop) {
if (this.loading) {
return
......@@ -252,6 +274,7 @@
this.loading = true
requestAPI(api.getProjectClient, {
data: {
...this.form,
id: this.$route.params.id,
page: this.pagenation.page
}
......@@ -276,7 +299,10 @@
Object.keys(res.model).forEach(item => {
this.$set(this.model, item, res.model[item])
})
this.getList()
this.getFilter()
this.$nextTick(() => {
this.getList()
})
}, error => {
if (Array.isArray(error.msg)) {
error.msg.forEach(item => {
......
......@@ -157,7 +157,9 @@
popupClose () {
this.$refs.sidePopup &&
this.$refs.sidePopup.close()
this.$refs[this.operationPage].reset && this.$refs[this.operationPage].reset()
if (this.operationPage !== '') {
this.$refs[this.operationPage].reset && this.$refs[this.operationPage].reset()
}
},
resetForm () {
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