Skip to content

Instantly share code, notes, and snippets.

@bubnenkoff
Created November 30, 2020 12:19
Show Gist options
  • Save bubnenkoff/e6d663732663d87ef730df3b772dfcf4 to your computer and use it in GitHub Desktop.
Save bubnenkoff/e6d663732663d87ef730df3b772dfcf4 to your computer and use it in GitHub Desktop.
<template>
<el-container >
<el-main>
<el-card class="box-card" >
<div slot="header" class="clearfix" >
Перейти на <el-button type="warning" plain @click="go_to_graph_page">Модуль поиска связей хозяйствующих субъектов</el-button>
Перейти на <el-button type="warning" plain @click="go_to_eis_page">Модуль работы с ЕИС</el-button>
</div>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="Группа Графиков 1" name="first">
<el-form ref="MyResultForm" :model="MyResultForm" label-width="250px" style="width: 92%" >
<el-form-item label="Регион">
<el-select v-model="MyResultForm.selected_region" filterable placeholder="Регион" class="select-input" clearable multiple>
<el-option
v-for="item in MyForm.region"
:key="item.name"
:label="item.name"
:value="item.name" > <!-- отправляем русское название из-за того, что у нас разные правила транслитерации у разных ФЗ -->
</el-option>
</el-select>
</el-form-item>
<el-form-item label="Заказчик">
<el-form-item v-for="(p, index) in MyResultForm.SelectedCustomerINN" :key="p.key" style="padding-bottom: 5px;" >
<el-form-item :rules="rules.INN">
<el-input placeholder="ИНН" v-model="MyResultForm.SelectedCustomerINN[index].inn" @change="onSelectedCustomerINNChange(p)"
@keyup.enter.native="onSelectedCustomerINNSubmit(p)" clearable @keyup.enter.native="onSelectedCustomerINNSubmit(p)">
<el-button slot="append" icon="el-icon-search" @click="onSelectedCustomerINNSubmit(p)"></el-button>
</el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="На основании ЕГРЮЛ" v-model="MyResultForm.SelectedCustomerINN[index].name" :disabled="true"> </el-input> <el-button v-if="index>0" @click="removeCustomerINN(p)">-</el-button>
</el-form-item>
</el-form-item>
<div style="display: flex; justify-content: flex-end; padding-bottom: 5px;">
<el-button @click="addCustomerINN">+</el-button>
</div>
</el-form-item>
<el-form-item label="Период" style="width: 50%">
<div style="display: flex; justify-content: left;">
<!-- Нам нужен формат вида 2018-12-05T21:00:00.000Z -->
<!-- value-format -- текстовое представление даты -->
<el-date-picker
v-model="MyResultForm.selected_period[0]"
type="date"
placeholder="Дата начала" format="dd.MM.yyyy" value-format="yyyy-MM-dd">
</el-date-picker>
<span>-</span>
<el-date-picker
v-model="MyResultForm.selected_period[1]"
type="date"
placeholder="Дата конца" format="dd.MM.yyyy" value-format="yyyy-MM-dd">
</el-date-picker>
</div>
</el-form-item>
</el-form>
<div style="display: flex; flex-direction: row;justify-content: flex-end; ">
<div>
<el-button v-if="!isLooking" type="primary" plain @click="search">Поиск</el-button>
<el-button v-else type="primary" plain>Идет Поиск</el-button>
</div>
</div>
<apexchart width="1420" type="bar" :options="options" :series="series"></apexchart>
<apexchart width="1420" type="bar" :options="options2" :series="series2"></apexchart>
<apexchart width="1420" type="bar" :options="options3" :series="series3"></apexchart>
<apexchart width="1420" type="bar" :options="options4" :series="series4"></apexchart>
<apexchart width="1420" type="bar" :options="options5" :series="series5"></apexchart>
<apexchart width="1420" type="bar" :options="options6" :series="series6"></apexchart>
<!-- вторая часть -->
</el-tab-pane>
<el-tab-pane label="Группа Графиков 2" name="second">
<el-form ref="MyResultForm" :model="MyResultForm" label-width="250px" style="width: 92%" >
<el-form-item label="Победа одного участника">
<el-form-item prop="selected_winner_inn">
<el-input placeholder="ИНН" v-model="MyResultForm.selected_winner_inn" @keyup.enter.native="onWinnerSubmit()" clearable>
<el-button slot="append" icon="el-icon-search" @click="onWinnerSubmit()" @keyup.enter.native="onWinnerSubmit()"></el-button>
</el-input>
</el-form-item>
<el-form-item>
<el-input placeholder="На основании ЕГРЮЛ" v-model="MyResultForm.selected_winner_name" :disabled="true"> </el-input>
</el-form-item>
</el-form-item>
<el-form-item label="Период" style="width: 50%">
<div style="display: flex; justify-content: left;">
<!-- Нам нужен формат вида 2018-12-05T21:00:00.000Z -->
<!-- value-format -- текстовое представление даты -->
<el-date-picker
v-model="MyResultForm.selected_period[0]"
type="date"
placeholder="Дата начала" format="dd.MM.yyyy" value-format="yyyy-MM-dd">
</el-date-picker>
<span>-</span>
<el-date-picker
v-model="MyResultForm.selected_period[1]"
type="date"
placeholder="Дата конца" format="dd.MM.yyyy" value-format="yyyy-MM-dd">
</el-date-picker>
</div>
</el-form-item>
</el-form>
<div style="display: flex; flex-direction: row;justify-content: flex-end; ">
<div>
<el-button v-if="!isLooking" type="primary" plain @click="search2">Поиск</el-button>
<el-button v-else type="primary" plain>Идет Поиск</el-button>
</div>
</div>
<apexchart width="1420" type="bar" :options="options7" :series="series7"></apexchart>
<!-- круговой -->
<apexchart width="1220" type="pie" :options="options8" :series="series8"></apexchart>
<!-- падение НМЦК круговой -->
<apexchart width="1220" type="pie" :options="options9" :series="series9"></apexchart>
<!--
<el-table :data="filteredDataForTable.slice((currentPage-1)*itemsPerPage,currentPage*itemsPerPage)" stripe border>
<el-table-column prop="fz" label="ФЗ №" width="70"> </el-table-column>
<el-table-column sortable prop="registration_number" label="№ Закупки" width="170">
<template slot-scope="scope">
<a v-if="scope.row.fz=='223' " :href="'http://zakupki.gov.ru/223/purchase/public/purchase/info/common-info.html?regNumber=' + scope.row.registration_number ">{{scope.row.registration_number}}</a>
<a v-if="scope.row.fz=='44' " :href="'http://zakupki.gov.ru/epz/order/notice/ea44/view/common-info.html?regNumber=' + scope.row.registration_number " target="_blank" >{{scope.row.registration_number}}</a>
</template>
</el-table-column>
<el-table-column sortable label="Номер лота" width="120">
<template slot-scope="scope">
{{scope.row.lots.lot_number}}
</template>
</el-table-column>
<el-table-column label="ЭТП" width="170">
<template slot-scope="scope">
<div>{{scope.row.etp}}</div>
</template>
</el-table-column>
<el-table-column label="Статус закупки" width="170">
<template slot-scope="scope">
<div>{{scope.row.processing_status}}</div>
</template>
</el-table-column>
<el-table-column sortable prop="fas_complaints" label="Жалоба в ФАС" width="170">
<template slot-scope="scope">
<a v-if="scope.row.fas_complaints=='True'">Имеется жалоба в ФАС</a>
<a v-if="scope.row.fas_complaints=='False'"></a>
</template>
</el-table-column>
<el-table-column label="Способ определения поставщика" width="170">
<template slot-scope="scope">
<div>{{scope.row.placing_way}}</div>
</template>
</el-table-column>
<el-table-column sortable label="Дата Публикации" width="180">
<template slot-scope="scope">
{{scope.row.publication_date}}
</template>
</el-table-column>
<el-table-column sortable label="Дата Исполнения" width="180">
<template slot-scope="scope">
{{scope.row.complete_date}}
</template>
</el-table-column>
<el-table-column sortable label="Организатор (заказчик)" width="250">
<template slot-scope="scope">
{{scope.row.organizer_name}}
</template>
</el-table-column>
<el-table-column sortable label="Организатор ИНН" width="250">
<template slot-scope="scope">
<div>{{scope.row.organizer_inn}}</div>
</template>
</el-table-column>
<el-table-column sortable label="Заказчик наименование" width="250">
<template slot-scope="scope">
{{scope.row.customer_short_name}}
</template>
</el-table-column>
<el-table-column sortable label="Заказчик ИНН" width="250">
<template slot-scope="scope">
<div>{{scope.row.customer_inn}}</div>
</template>
</el-table-column>
<el-table-column sortable label="НМЦК" width="180">
<template slot-scope="scope">
{{scope.row.lots.nmck}}
</template>
</el-table-column>
<el-table-column sortable label="Участник наименование" width="460">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
{{item.supplier_name}}
</div>
</template>
</el-table-column>
<el-table-column sortable label="Наличие в реестре РНП" width="198">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
<div v-if="item.dishonest=='True'">Участник занесен в РНП</div>
<div v-if="item.dishonest=='False'">-</div>
</div>
</template>
</el-table-column>
<el-table-column sortable label="Претензия конкурсной комиссии" width="250">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
<div v-if="(item.reject_reason).length>='1'">{{item.inn}} - {{item.reject_reason}} </div>
<div v-if="(item.reject_reason).length=='0'"></div>
</div>
</template>
</el-table-column>
<el-table-column sortable label="Фирме менее года" width="192">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
<div v-if="item.registered_recently=='True'">Фирме менее года</div>
<div v-if="item.registered_recently=='False'"></div>
</div>
</template>
</el-table-column>
<el-table-column sortable label="Единственный поставщик" width="192">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
<div v-if="item.only_supplier=='True'">Единственный поставщик</div>
<div v-if="item.only_supplier=='False'"></div>
</div>
</template>
</el-table-column>
<el-table-column sortable label="Участник ИНН" width="460">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
<div>{{item.inn}}</div>
</div>
</template>
</el-table-column>
<el-table-column sortable label="Участник адрес" width="460">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
{{item.address}}
</div>
</template>
</el-table-column>
<el-table-column sortable label="Позиции лота" width="460">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.lot_items">
{{item.object_name}}
</div>
</template>
</el-table-column>
<el-table-column sortable label="ОКВЭД лота" width="460">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.lot_items">
{{item.object_code}}
</div>
</template>
</el-table-column>
<el-table-column sortable label="Победитель наименование" width="460">
<template slot-scope="scope">
<div v-for="item in scope.row.lots.suppliers">
<div v-if="item.winner == 'True'">
{{item.supplier_name}}
</div>
</div>
</template>
</el-table-column>
<el-table-column sortable label="Цена контракта" width="180">
<template slot-scope="scope">
{{scope.row.lots.contract_price}}
</template>
</el-table-column>
<el-table-column sortable label="Падение НМЦК (%)" width="180">
<template slot-scope="scope">
{{scope.row.lots.prc_fall_nmck}}
</template>
</el-table-column>
<el-table-column sortable label="Номер контракта" width="180">
<template slot-scope="scope">
{{scope.row.lots.contract_number}}
</template>
</el-table-column>
<el-table-column sortable label="Дата заключения контракта" width="220">
<template slot-scope="scope">
{{scope.row.lots.contract_date}}
</template>
</el-table-column>
<el-table-column sortable label="№ реестровой записи контракта" width="230">
<template slot-scope="scope">
{{scope.row.lots.contract_reestr_number}}
</template>
</el-table-column>
</el-table>
-->
</el-tab-pane>
</el-tabs>
<el-card>
</el-main>
</el-container>
</template>
<script>
export default {
data () {
return {
currentPage: 1,
itemsPerPage: 15,
activeName: 'first',
originalData: [], // тут храним оригинальный запрос
filteredDataForTable: [], // тут храним оригинальный запрос
res: {
inn_list: [],
inn_and_names_list: [],
dishonest_total: [],
dishonest_true: [],
dishonest_rest: [],
winner_total: [],
winner_true: [],
winner_rest: [],
has_offer_total: [],
has_offer_true: [],
has_offer_rest: [],
only_supplier_total: [],
only_supplier_true: [],
only_supplier_rest: [],
//registered_recently_rest
registered_recently_total: [],
registered_recently_true: [],
registered_recently_rest: [],
//fas_complaints
fas_complaints_total: [],
fas_complaints_true: [],
fas_complaints_rest: [],
// у каких заказчиков победил или проиграл указанный ИНН
customer_inn_and_name_list: [],
customer_count_win: [],
customer_count_lose: [],
},
isLooking: false, // когда нажимаем кнопку поиска меняем на Тру и текст кнопки поиска тоже меняем
MyResultForm: {
selected_region: null,
selected_period: [],
SelectedCustomerINN: [
{
key: 1,
inn: '',
name: ''
}
],
selected_winner_inn: null, // победа одного из участников
selected_winner_name: null, // победа одного из участников
},
MyForm:
{
region: [],
industry: [],
customer: [], // заказчик
nmck_min: [],
nmck_max: [],
period: [], // [ "2018-11-06T21:00:00.000Z", "2018-11-14T21:00:00.000Z" ]
decline_nmck_min: '',
decline_nmck_max: '', // снижение НМЦК
winner: [], // победа одного из участников
HowToIdentifySupplierList: [{name: "электронный аукцион"}, {name: "закупки у единственного поставщика"}, {name: "запрос котировок"}, {name: "открытый конкурс"}],
selected_winner_inn: null, // победа одного из участников
selected_winner_name: null, // победа одного из участников
},
rules: { // не будет работать т.к. у нас el-form-item вложен в el-form-item
selected_customer_inn: [
{required: false, pattern: /^[0-9]+$/, message: 'Только цифры'},
],
selected_nmck_min: [
{required: false, pattern: /^[0-9]+$/, message: 'Только цифры'},
]
},
series: [{name: 'Поражения', data: [] }, { name: 'Победы', data: [] }],
series2: [{name: 'Присутствует в РНП', data: [] }, { name: 'Отсутствует в РНП', data: []}],
series3: [{name: 'Было ценовое предложение', data: [] }, { name: 'Не было ценового предложения', data: []}],
series4: [{name: 'Меньше года с момента регистрации', data: [] }, { name: 'Больше года с момента регистрации', data: []}],
series5: [{name: 'Закупки с множеством поставщиков', data: [] }, { name: 'Закупки с единственным поставщиком', data: []}],
series6: [{name: 'Была жалоба', data: [] }, { name: 'Не было жалобы', data: []}],
series7: [{name: 'Поражения', data: [] }, { name: 'Победы', data: []}],
series8: [],
series9: [], // падение нмцк
options: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'Рейтинг Победителей',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options2: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'Поставщик в РНП',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options3: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'Закупки без ценового предложения',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options4: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'Срок существования хозяйствующего субъекта',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options5: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'Единственный поставщик',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options6: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'Закупки с жалобами в ФАС',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options7: {
colors: ['#de1a00', '#1fb800', ],
chart: {
type: 'bar',
// height: 350,
stacked: true,
dropShadow: {
enabled: true,
blur: 1,
opacity: 0.25
}
},
plotOptions: {
bar: {
horizontal: true,
// barHeight: '80%',
},
},
dataLabels: {
enabled: false
},
stroke: {
width: 0,
},
title: {
text: 'У каких заказчиков победил или проиграл указанный ИНН',
style: {
fontSize: '20px',
},
},
xaxis: {
categories: [],
},
yaxis: {
title: {
text: undefined
},
axisTicks: {
show: true,
borderType: 'solid',
color: '#78909C',
width: 6,
offsetX: 0,
offsetY: 0
},
labels: {
maxWidth: 320,
style: {
fontSize: '14px',
},
fillColor: '#B3F7CA',
formatter: function(value) {
return value;
}
},
},
tooltip: {
shared: false,
y: {
formatter: function(val) {
// return val + "K"
}
}
},
fill: {
opacity: 1,
},
states: {
hover: {
filter: 'none'
}
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '14px'
}
},
options8: {
// series8: [44, 55, 13, 43, 22],
chart: {
width: 380,
type: 'pie',
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '16px'
},
title: {
text: 'Совместное участие в закупках',
style: {
fontSize: '20px',
},
},
labels: [],
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200
},
legend: {
position: 'bottom'
}
}
}]
},
options9: {
chart: {
width: 380,
type: 'pie',
},
title: {
text: 'Падение НМЦК',
style: {
fontSize: '20px',
},
},
legend: {
position: 'right',
offsetY: 40,
fontSize: '16px'
},
labels: ["Отсутствует (приближение равно НМЦК)", "от 0 до 2", "от 2 (включительно) до 5", "от 5 (включительно) и выше"],
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200
},
legend: {
position: 'bottom'
}
}
}]
},
}
},
methods:
{
handleScroll1: function () {
if(this.scrolling) {
this.scrolling = false;
return;
}
this.scrolling = true;
this.$refs["wrapper2"].scrollLeft = this.$refs["wrapper1"].scrollLeft;
},
handleScroll2: function () {
if(this.scrolling) {
this.scrolling = false;
return;
}
this.scrolling = true;
console.log(this.scrolling, this.$refs["wrapper2"].scrollLeft);
this.$refs["wrapper1"].scrollLeft = this.$refs["wrapper2"].scrollLeft;
},
go_to_graph_page(){
window.open("/graph.html", '_blank');
},
go_to_eis_page(){
window.open("/", '_blank');
},
addCustomerINN()
{
this.MyResultForm.SelectedCustomerINN.push({
key: Date.now(),
inn: '',
name: ''
})
},
removeCustomerINN(item)
{
var index = this.MyResultForm.SelectedCustomerINN.indexOf(item);
if (index !== -1) {
this.MyResultForm.SelectedCustomerINN.splice(index, 1);
}
},
onSelectedCustomerINNChange(p) // немного кривоватый способ очистить имя
{
var index = this.MyResultForm.SelectedCustomerINN.indexOf(p)
if((this.MyResultForm.SelectedCustomerINN[index].inn).length < 8)
{
this.MyResultForm.SelectedCustomerINN[index].name = null
}
},
onSelectedCustomerINNSubmit(p)
{
var index = this.MyResultForm.SelectedCustomerINN.indexOf(p)
if(this.MyResultForm.SelectedCustomerINN[index].inn.length >= 10 && this.MyResultForm.SelectedCustomerINN[index].inn.length <=12)
{
axios.get(base_url + '/api/name-by-inn?inn=' + this.MyResultForm.SelectedCustomerINN[index].inn) //?inn=7736188555
.then((response) => {
if(response.data.status == 'fail')
{
console.log(response.data.message)
this.$notify({title: 'ИНН не найден', message: 'Указанный ИНН не найден в базе данных', position: 'bottom-right', type: 'warning' });
}
else
this.MyResultForm.SelectedCustomerINN[index].name = response.data.name;
})
.catch((error) => {
console.log(error);
});
}
else
{
console.log("Too short or too long INN: ", this.MyResultForm.CollectiveParticipations[index].inn)
this.$notify({title: 'Не корректная длина ИНН', message: 'ИНН должен быть от 10 до 12 символов', position: 'bottom-right', type: 'warning' });
}
},
onCollectiveParticipationChange(p) // немного кривоватый способ очистить имя
{
var index = this.MyResultForm.CollectiveParticipations.indexOf(p)
if((this.MyResultForm.CollectiveParticipations[index].inn).length < 8)
{
this.MyResultForm.CollectiveParticipations[index].name = null
}
},
onSelectedCustomerINNChange(p) // немного кривоватый способ очистить имя
{
var index = this.MyResultForm.SelectedCustomerINN.indexOf(p)
if((this.MyResultForm.SelectedCustomerINN[index].inn).length < 8)
{
this.MyResultForm.SelectedCustomerINN[index].name = null
}
},
onWinnerSubmit()
{
if(this.MyResultForm.selected_winner_inn.length >= 10 && this.MyResultForm.selected_winner_inn.length <=12)
{
axios.get(base_url + '/api/name-by-inn?inn=' + this.MyResultForm.selected_winner_inn) //?inn=7736188555
.then((response) => {
console.log("response.data.name: ", response.data.name)
if(response.data.status == 'fail')
{
console.log(response.data.message)
this.$notify({title: 'ИНН не найден', message: 'Указанный ИНН не найден в базе данных', position: 'bottom-right', type: 'warning' });
}
else
this.MyResultForm.selected_winner_name = response.data.name;
})
.catch((error) => {
console.log(error);
});
}
else
{
console.log("Too short or too long INN: ", this.MyResultForm.selected_winner_inn)
this.$notify({title: 'Не корректная длина ИНН', message: 'ИНН должен быть от 10 до 12 символов', position: 'bottom-right', type: 'warning' });
}
},
display_charts() {
this.options.xaxis.categories.push(...this.res.inn_and_names_list.slice(0, 20))
this.options2.xaxis.categories.push(...this.res.inn_and_names_list.slice(0, 20))
this.options3.xaxis.categories.push(...this.res.inn_and_names_list.slice(0, 20))
this.options4.xaxis.categories.push(...this.res.inn_and_names_list.slice(0, 20))
this.options5.xaxis.categories.push(...this.res.inn_and_names_list.slice(0, 20))
this.options6.xaxis.categories.push(...this.res.inn_and_names_list.slice(0, 20))
//
this.options7.xaxis.categories.push(...this.res.customer_inn_and_name_list.slice(0, 20))
this.series = [{data: this.res.winner_true.slice(0, 20)},{data: this.res.winner_rest.slice(0, 20)}]
this.series2 = [{data: this.res.dishonest_true.slice(0, 20)},{data: this.res.dishonest_rest.slice(0, 20)}]
this.series3 = [{data: this.res.has_offer_true.slice(0, 20)},{data: this.res.has_offer_rest.slice(0, 20)}]
this.series4 = [{data: this.res.registered_recently_true.slice(0, 20)},{data: this.res.registered_recently_rest.slice(0, 20)}]
this.series5 = [{data: this.res.only_supplier_true.slice(0, 20)},{data: this.res.only_supplier_rest.slice(0, 20)}]
this.series6 = [{data: this.res.fas_complaints_true.slice(0, 20)},{data: this.res.fas_complaints_rest.slice(0, 20)}]
},
display_charts2() {
//
this.options7.xaxis.categories.push(...this.res.customer_inn_and_name_list.slice(0, 20))
this.series7 = [{data: this.res.customer_count_win.slice(0, 20)},{data: this.res.customer_count_lose.slice(0, 20)}]
},
search()
{
this.isLooking = true // кнопка нажата поиск запущен
var my_data = {};
var result = {}
my_data["selected_region"] = this.MyResultForm.selected_region
my_data["selected_customer_inn"] = this.MyResultForm.SelectedCustomerINN.map(a => a.inn).filter(a=>a != "")
my_data["selected_period"] = this.MyResultForm.selected_period
result["data"] = my_data
// console.log(result)
axios.post(base_url + '/api/new-answer', result) //?inn=7736188555
.then((response) => {
this.server_answer = response.data.data
// console.log(this.server_answer)
// console.log("----")
if('error' in this.server_answer)
{
console.log(this.server_answer['error'])
this.isLooking = false
}
else
{
var data2 = []
this.server_answer.forEach(el => el.lots.suppliers.forEach(
s => data2.push({
supplier_name: s.supplier_name,
inn: s.inn,
dishonest: s.dishonest,
winner: s.winner,
has_offer: s.has_offer,
only_supplier: s.only_supplier,
registered_recently: s.registered_recently,
fas_complaints: s.fas_complaints
})) )
let subres = {}
for(let el of data2) {
if(!(el.inn in subres)) {
subres[el.inn] = {
total: 0,
dishonest: 0,
winner: 0,
has_offer: 0,
only_supplier: 0,
registered_recently: 0,
fas_complaints: 0,
supplier_name: el.supplier_name
}
}
let cur = subres[el.inn];
cur.total++;
if(el.dishonest === 'True') cur.dishonest++;
if(el.winner === 'True') cur.winner++;
if(el.has_offer === 'True') cur.has_offer++;
if(el.only_supplier === 'True') cur.only_supplier++;
if(el.registered_recently === 'True') cur.registered_recently++;
if(el.fas_complaints === 'True') cur.fas_complaints++;
}
let dishonest_total = [];
let dishonest_true = [] ;
let dishonest_rest = [];
let winner_total = [];
let winner_true = [];
let winner_rest = [];
let has_offer_total = []
let has_offer_true = []
let has_offer_rest = []
let only_supplier_total = []
let only_supplier_true = []
let only_supplier_rest = []
let registered_recently_total = []
let registered_recently_true = []
let registered_recently_rest = []
let fas_complaints_total = []
let fas_complaints_true = []
let fas_complaints_rest = []
for(let [inn, el] of Object.entries(subres)) {
this.res.inn_list.push(inn);
this.res.inn_and_names_list.push(inn + " " + el.supplier_name);
dishonest_total.push(el.total);
dishonest_true.push(el.dishonest);
winner_total.push(el.total);
winner_true.push(el.winner);
has_offer_total.push(el.total);
has_offer_true.push(el.has_offer);
only_supplier_total.push(el.total);
only_supplier_true.push(el.only_supplier);
registered_recently_total.push(el.total);
registered_recently_true.push(el.registered_recently);
fas_complaints_total.push(el.total);
fas_complaints_true.push(el.fas_complaints);
}
// console.log(this.res)
dishonest_rest = dishonest_total.map((v, i) => v - dishonest_true[i]);
winner_rest = winner_total.map((v, i) => v - winner_true[i]);
has_offer_rest = has_offer_total.map((v, i) => v - has_offer_true[i]);
only_supplier_rest = only_supplier_total.map((v, i) => v - only_supplier_true[i]);
registered_recently_rest = registered_recently_total.map((v, i) => v - registered_recently_true[i]);
fas_complaints_rest = fas_complaints_total.map((v, i) => v - fas_complaints_true[i]);
function sortByFirst(input) {
var first_key = Object.keys(input)[0];
var len = input[first_key].length;
const merged_array = [];
for (var i = 0; i < len; i++) {
merged_array[i] = merge_object(Object.keys(input));
}
Object.keys(input).forEach((key) => {
input[key].forEach((val, i) => {
merged_array[i][key] = val;
});
});
merged_array.sort((a, b) => a[first_key] - b[first_key]);
var result = {};
Object.keys(input).forEach((key) => {
result[key] = [];
});
merged_array.forEach((el) => {
Object.keys(el).forEach((key) => {
result[key].push(el[key]);
});
});
return result;
}
function merge_object(keys, rep = null) {
var res = {};
keys.forEach((el) => {
res[el] = rep;
});
return res;
}
// dishonest_total = foo({dishonest_total, customer_inn_and_name_list}).dishonest_total
this.res.dishonest_true = sortByFirst({dishonest_total, dishonest_true}).dishonest_true.reverse()
this.res.dishonest_rest = sortByFirst({dishonest_total, dishonest_rest}).dishonest_rest.reverse()
this.res.winner_true = sortByFirst({winner_total, winner_true}).winner_true.reverse()
this.res.winner_rest = sortByFirst({winner_total, winner_rest}).winner_rest.reverse()
this.res.has_offer_true = sortByFirst({has_offer_total, has_offer_true}).has_offer_true.reverse()
this.res.has_offer_rest = sortByFirst({has_offer_total, has_offer_rest}).has_offer_rest.reverse()
this.res.only_supplier_true = sortByFirst({only_supplier_total, only_supplier_true}).only_supplier_true.reverse()
this.res.only_supplier_rest = sortByFirst({only_supplier_total, only_supplier_rest}).only_supplier_rest.reverse()
this.res.registered_recently_true = sortByFirst({registered_recently_total, registered_recently_true}).registered_recently_true.reverse()
this.res.registered_recently_rest = sortByFirst({registered_recently_total, registered_recently_rest}).registered_recently_rest.reverse()
this.res.fas_complaints_true = sortByFirst({fas_complaints_total, fas_complaints_true}).fas_complaints_true.reverse()
this.res.fas_complaints_rest = sortByFirst({fas_complaints_total, fas_complaints_rest}).fas_complaints_rest.reverse()
// this.series9.push(...[0, 0, 0, 2])
//
console.log("Loading charts data done. Displaying...")
this.display_charts();
this.isLooking = false
}
})
.catch((error) => {
// console.log(error);
this.isLooking = false
});
},
search2()
{
this.isLooking = true // кнопка нажата поиск запущен
var my_data = {};
var result = {}
// my_data["selected_region"] = this.MyResultForm.selected_region
// my_data["selected_customer_inn"] = this.MyResultForm.SelectedCustomerINN.map(a => a.inn).filter(a=>a != "")
my_data["selected_period"] = this.MyResultForm.selected_period
my_data["selected_winner_inn"] = this.MyResultForm.selected_winner_inn
result["data"] = my_data
// console.log(result)
axios.post(base_url + '/api/new-answer', result) //?inn=7736188555
.then((response) => {
this.server_answer = response.data.data
this.originalData = response.data.data
if('error' in this.server_answer)
{
console.log(this.server_answer['error'])
this.isLooking = false
}
else
{
// У каких заказчиков победил или проиграл указанный ИНН
let customer_inn_and_name_winner_list = [];
this.server_answer.forEach(item => {
if (item.lots.suppliers.findIndex(s => s.winner === "True" && s.inn === '0268019693' ) !== -1)
{
console.log("!TRUE!")
console.log(item.customers[0].customer_inn)
customer_inn_and_name_winner_list.push({
customer_inn: item.customers[0].customer_inn,
customer_name: item.customers[0].customer_short_name,
winner: "True"
});
}
if (item.lots.suppliers.findIndex(s => s.winner === "False" && s.inn === '0268019693' ) !== -1)
{
console.log("!FALSE!")
console.log(item.customers[0].customer_inn)
customer_inn_and_name_winner_list.push({
customer_inn: item.customers[0].customer_inn,
customer_name: item.customers[0].customer_short_name,
winner: "False"
});
}
});
console.log("!We are here!")
console.log(customer_inn_and_name_winner_list)
console.log("----------+++")
let subres2 = {}
for(let el of customer_inn_and_name_winner_list) {
if(!(el.customer_inn in subres2)) {
subres2[el.customer_inn] = {win: 0, lose: 0, customer_name: el.customer_name}
}
let cur = subres2[el.customer_inn];
if(el.winner === 'True') cur.win++;
if(el.winner === 'False') cur.lose++;
}
console.log(subres2)
for(let [inn, el] of Object.entries(subres2)) {
// this.res.customer_inn_and_name_list.push(inn);
this.res.customer_inn_and_name_list.push(inn + " " + el.customer_name);
this.res.customer_count_win.push(el.win);
this.res.customer_count_lose.push(el.lose);
}
// ----------------------
const inn_and_supl_for_round_chart = [];
this.server_answer.forEach(item => {
// // console.log(item)
if (item.lots.suppliers.findIndex(s => s.inn === '0268087943' ) !== -1) {
item.lots.suppliers.map(
s => {
if(s.inn !== '0268087943')
inn_and_supl_for_round_chart.push( {inn: s.inn, supplier_name: s.supplier_name} )
}
);
}
});
let subres4 = {}
for(let el of inn_and_supl_for_round_chart) {
if(!(el.inn in subres4)) {
subres4[el.inn] = {total: 0, supplier_name: el.inn + " " + el.supplier_name}
}
let cur = subres4[el.inn];
cur.total++;
}
// console.log(subres3
// считаем сумму всех значений чтобы потом проценты посчитать
var totalSum = 0;
for (const [key, value] of Object.entries(subres4) )
{
totalSum += value.total
}
var result_for_round_chart = []
// // заполняем резалт в нужной для графика форме
for (const [key, value] of Object.entries(subres4) )
{
value.total = value.total * 100 / totalSum
// result_for_round_chart.push({value: value.total, label: value.supplier_name})
this.series8.push(value.total)
this.options8.labels.push(value.supplier_name)
}
// console.log(this.series8)
// ВТОРОЙ круговой график
const output2 = [];
this.server_answer.forEach(item => {
if (item.lots.suppliers.findIndex(s => s.inn === '0278209090' ) !== -1) {
item.lots.suppliers.map(
s => {
if (item.lots.prc_fall_nmck != 'Связь с контрактом не установлена')
if (s.inn === '0278209090')
output2.push( {inn: s.inn, supplier_name: s.supplier_name, prc_fall_nmck: item.lots.prc_fall_nmck} )
}
);
}
});
let groups = {
zero: {total: 0},
up_to_two: {total: 0},
from_two_to_five: {total: 0},
more_than_five: {total: 0},
}
let maxFallBackNMCK = 0
for(let el of output2)
{
// console.log(el)
if (parseInt(el.prc_fall_nmck) == 0) {
// groups.zero = { inn: el.inn, supplier_name: el.supplier_name, prc_fall_nmck: el.prc_fall_nmck}
groups.zero.total++;
}
if (parseInt(el.prc_fall_nmck) > 0 && parseInt(el.prc_fall_nmck) < 2) {
// groups.up_to_two = {inn: el.inn, supplier_name: el.supplier_name, prc_fall_nmck: el.prc_fall_nmck}
groups.up_to_two.total++;
}
if (parseInt(el.prc_fall_nmck) >= 2 && parseInt(el.prc_fall_nmck) < 5) {
// groups.from_two_to_five = {inn: el.inn, supplier_name: el.supplier_name, prc_fall_nmck: el.prc_fall_nmck}
groups.from_two_to_five.total++;
}
if (parseInt(el.prc_fall_nmck) >= 5) {
// groups.more_than_five = {inn: el.inn, supplier_name: el.supplier_name, prc_fall_nmck: el.prc_fall_nmck}
groups.more_than_five.total++;
}
if (maxFallBackNMCK < el.prc_fall_nmck)
{
maxFallBackNMCK = el.prc_fall_nmck
}
}
this.series9.push(...[groups.zero.total, groups.up_to_two.total, groups.from_two_to_five.total, groups.more_than_five.total])
// this.series9.push(...[0, 0, 0, 2])
this.filteredDataForTable = this.originalData.filter(a => {
if(parseFloat(a.lots.prc_fall_nmck) <= 2)
return a
}
)
console.log("Loading charts data done. Displaying...")
this.display_charts();
this.isLooking = false
}
})
.catch((error) => {
// console.log(error);
this.isLooking = false
});
},
handleClick(tab, event) {
console.log(tab, event);
}
},
created()
{
axios.get(base_url + '/api/regions')
.then((response) => {
this.MyForm.region = response.data;
})
.catch((error) => {
console.log(error);
});
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment