Commit 135c9927 by wangweidong

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	pages/meter-statistics/annual-entrust/YearContractTable.vue
parents defcd248 1946beca
<template>
<div>
<form id="form-customer-table">
<input name="queryDateBegin" type="hidden"/>
<input name="queryDateEnd" type="hidden"/>
</form>
<PTVXETable id="customer-contract-table" ref="pageTable"
:tableHeight="tableHeight" @on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox click-value>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detail(scope.row)">{{scope.row[item.key]}}</a>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
<!--详情-->
<Detail ref="detailModal"/>
</div>
</template>
<script>
import { meterContract } from '../../../api'
import Detail from './Detail'
export default {
components: { Detail },
data() {
return {
pageColumns: [
{
title: '客户名称',
key: 'client',
width: 120,
fixed: 'left'
},
{ title: '委托数量', key: 'total' },
{ title: '委托额度', key: 'price' },
{ title: '已收额度', key: 'collectPrice' },
{ title: '未收额度', key: 'noCollectPrice' }
],
formObj: {
client: undefined
},
getPage: {},
customer: '',
queryDateBegin: '',
queryDateEnd: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('noBtn')
}
},
methods: {
// 查看所有委托
_detail(data) {
this.$refs.detailModal._open({
cname: data.customer,
queryDateBegin: this.queryDateBegin,
queryDateEnd: this.queryDateEnd
})
},
_openTable(data) {
this.customer = data.customer
$('input[name=queryDateBegin]').val(data.queryDateBegin)
$('input[name=queryDateEnd]').val(data.queryDateEnd)
this.queryDateBegin = data.queryDateBegin
this.queryDateEnd = data.queryDateEnd
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterContract.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// _page() {
// const data = {}
// if (this.customer) {
// data.customer = this.customer
// }
// this.$refs.pageTable._page(
// 'form-customer-table',
// 'StatisticContract/pageCustomerContract',
// data
// )
// },
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.StatisticContract.page
break
case 'singleSelect':
// 单击
this.$emit('on-result-change', data)
break
case 'dbSelect':
// 双击
this.customer = ''
break
case 'changeSize':
// this._page()
break
}
},
/** *********************************导出客户委托分析表-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch(
'StatisticContract/pageCustomerContract',
this._searchParams()
)
.then(() => {
result = this.$store.state.StatisticContract.page.records
if (result.length === 0) {
this.$Message.warning('暂无数据,不可导出!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据(最多导出5000条)?',
onOk: () => {
this.$exportExcel(
'customer-contract-table',
'客户委托分析表',
this.pageColumns,
result
)
}
})
}
})
},
// 参数
_searchParams() {
const data = this.$serialize('form-customer-table')
if (this.customer) {
data.customer = this.customer
}
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出客户委托分析表-end*********************************************/
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="1000" class="modal-footer-none">
<p slot="header">详情</p>
<div>
<!--内容-->
<Row>
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
export default {
data() {
return {
showModal: false,
getPage: {},
pageColumns: [
{ title: '委托名称', key: 'name' },
{ title: '委托编号', key: 'code', width: 180 },
{ title: '委托金额(元)', key: 'contractAmount', width: 160 },
{ title: '已收金额(元) ', key: 'bereturnedAmount', width: 160 },
{ title: '未收金额(元)', key: 'noreturnedAmount', width: 160 }
],
dateList: [],
formObj: {
cname: '',
queryDateBegin: '',
queryDateEnd: ''
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_open(data) {
this.formObj = data
this.showModal = true
this.$nextTick(function() {
// this._page()
})
},
_page() {
this.$refs.pageTable._page(
'search-contract-detail',
'FoodContract/pageContractByCustomer',
this.$serializeFormSearch(this.formObj)
)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
// default :
// this._page();
case 'changeSize':
// this._page()
break
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top:10px">
<Form :d="formId" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检定依据:" style="margin-left: -20px">
<Input @on-enter="_formSearch" v-model="formObj.code" name="judgeBasis" placeholder="请输入判定依据" clearable/>
</Form-item>
<Form-item class="search-item" label="检定依据名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="judgeBasisName" placeholder="请输入判定依据名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Row style="margin-top: 10px;">
<!--查询条件-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
<div class="fl">
<Form id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="客户名称:">
<Input v-model="tempData.customer" @on-click="_selectCustomer" @on-change="_cusChange"
placeholder="请选择客户名称" class="width-200" clearable icon="plus" readonly/>
</Form-item>
<Form-item label="制单日期:">
<el-date-picker
v-model="queryDate"
@change="_dateChange"
type="monthrange"
range-separator="-"
start-placeholder="开始月份"
end-placeholder="结束月份"
size="small"
value-format="yyyy-MM">
</el-date-picker>
</Form-item>
<Form-item class="search-btn">
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
</div>
<div class="fr">
<Button @click="_export" class="width-80">导出</Button>
</div>
<div class="clear"></div>
</Col>
<!-- 表格 -->
<!--内容-->
<Col span="24">
<PTVXETable
ref="pageTable"
:form-id="formId"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
<Row :gutter="16">
<Col span="24">
<!--table-->
<CustomerTable ref="tableModal" @on-result-change="_customerChange"></CustomerTable>
</Col>
<Col span="10">
<!--pie-->
<!-- <CustomerPie ref="pieModal"></CustomerPie>-->
</Col>
</Row>
</Col>
</Row>
</div>
</div>
<!--选择客户-->
<Customer ref="cunstomerModal" @on-result-change="_customerResult"></Customer>
</div>
</template>
<script>
import { meterAptitude } from '../../../api'
import Customer from '../../../components/user-info/customer'
import CustomerTable from './CustomerTable'
export default {
name: 'MeterAptitudeStandard',
components: {},
components: {
CustomerTable,
Customer
},
data() {
const now = new Date()
const date = this.$dateformat(now, 'yyyy-mm')
return {
formId: 'meterAptitudeFormId',
pageColumns: [
{ title: '检定依据', key: 'code', width: 160 },
{ title: '检定依据名称', key: 'name' },
{ title: '登记时间', key: 'ctime', date: true, width: 140 },
{ title: '备注', key: 'remark' }
],
btn: [
{ type: 'success', id: '', name: '添加' },
{ type: 'error', id: '', name: '删除' }
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'md-trash', id: '', name: '删除' }
],
formObj: {
name: undefined,
code: undefined
tempData: {
queryDateBegin: date,
queryDateEnd: date,
customer: ''
},
searchOpen: true,
selectIds: [],
getPage: {},
typeData: []
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
queryDate: [date, date]
}
},
mounted() {
this._page()
this._search()
},
methods: {
_btnClick(msg) {
switch (msg) {
case '添加':
this._editModal(false)
break
case '删除':
this._deleteSelected()
break
case '导入':
this._import()
break
case '导出':
this._export()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '删除':
this._deleteById(data.id)
break
case '操作日志':
this._record(data.id)
break
}
},
_page: async function() {
console.log(9522123)
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterAptitude.page(this.formObj)
if (result) {
console.log(55555)
console.log(result)
this.getPage = result
console.log(123456789)
console.log(this.getPage)
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodJudgeBasis.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
_dateChange(data) {
if (data) {
this.tempData.queryDateBegin = data[0]
this.tempData.queryDateEnd = data[1]
} else {
this.tempData.queryDateBegin = ''
this.tempData.queryDateEnd = ''
}
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
_open() {
this.$refs.tableModal._openTable(this.tempData)
// this.$refs.pieModal._openAllPie(this.tempData)
},
_delete: async function(ids) {
const result = await meterAptitude.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
_search() {
this._open()
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
_export() {
this.$refs.tableModal._exportSampleForm()
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除这 ' + ids.length + ' 条记录?')
}
_selectCustomer() {
this.$refs.cunstomerModal._open()
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
this._getById(id)
// 编辑
// this.$store.dispatch('FoodJudgeBasis/getById', id).then(() => {
// this.$refs.editModal._open(this.$store.state.FoodJudgeBasis.model)
// })
} else {
// 添加
this.$refs.editModal._open()
}
_customerResult(data) {
this.tempData.customer = data.cname
this._search()
},
_getById: async function(id) {
const result = await meterAptitude.getById(id)
if (result) {
this.$refs.editModal._open(result)
}
_customerChange(data) {
// this.$refs.pieModal._openPie(data, this.tempData)
},
// 导入
_import() {
const data = {
importUrl:
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_import',
downloadUrl: '/food/v1/excel/template/FoodAptitudeJudgeBasis',
title: '导入检验方法管理'
}
this.$refs.sampleModal._open(data)
},
// 导出
_export() {
console.log('.this.selectIds', this.selectIds)
if (this.selectIds.length === 0) {
this.$Message.warning('请选择需要导出的数据')
} else {
const content = '确定导出 ' + this.selectIds.length + ' 条记录?'
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
// eslint-disable-next-line no-undef
http.open(
'/food/v1/food_aptitude_judge_basis/food_aptitude_judge_export?ids=' +
this.selectIds
)
}
})
// 选择人员为空的情况
_cusChange(data) {
if (data.target.value === '') {
this.tempData.customer = ''
this._search()
}
}
}
}
</script>
<style scoped>
</style>
......@@ -106,8 +106,25 @@ export default {
(document.documentElement.clientWidth - 200) / 2.6 + 'px'
},
_openPie(data) {
console.log('123456')
// alert(this.option.series[0].data)
// this.option.series[0].data = data
const testerList = []
const seriesList = []
let total = 0
for (let i = 0; i < data.length; i++) {
testerList.push(data[i].tester)
total = total + data[i].total
seriesList.push({
value: data[i].total,
name: data[i].tester,
total: data[i].total,
ratio: data[i].ratio
})
}
this.option.title.text = '检测项目总量(个):' + total
this.option.legend.data = testerList
this.option.series[0].data = seriesList
console.log(this.option.series[0].data)
},
_searchParams() {
......
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