Commit 671a146a authored by Babin Egor's avatar Babin Egor

up util order vue

parent 73fceb41
...@@ -826,7 +826,7 @@ Vue.component('app-registration-form', { ...@@ -826,7 +826,7 @@ Vue.component('app-registration-form', {
<!-- Debug ---> <!-- Debug --->
<div style="display: block; position: fixed; right: 0;top: 0%; background-color:#fff; z-index:1000; width: 300px; padding: 10px; border: 1px solid #999;"> <div style="display: none; position: fixed; right: 0;top: 0%; background-color:#fff; z-index:1000; width: 300px; padding: 10px; border: 1px solid #999;">
<pre> <pre>
{{ wUnitAmounts }} {{ wUnitAmounts }}
</pre> </pre>
......
...@@ -116,11 +116,10 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -116,11 +116,10 @@ Vue.component('app-waste-utilisation-order-form', {
initValue: { initValue: {
value: '0' value: '0'
}, },
ShowDrop: 'false', serverUrl: 'https://r52.ru/',
} }
}, },
created() { created() {
this.localRecord = this.isEditing ? Object.assign({},this.record) : { this.localRecord = this.isEditing ? Object.assign({},this.record) : {
wType: { wType: {
name: 'communal', name: 'communal',
...@@ -175,32 +174,17 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -175,32 +174,17 @@ Vue.component('app-waste-utilisation-order-form', {
if (this.address.city) { if (this.address.city) {
this.localRecord.isAddress.value = true; this.localRecord.isAddress.value = true;
this.localRecord.wAddress = this.address; this.localRecord.wAddress = this.address;
} }
}, },
mounted() {
if (this.isEditing) {
//console.log("Режим редактирования")
} else {
//console.log("Режим создания новой записи")
}
// Подгружаем группы отходов
mounted() {
this.wasteMainGroupsLoad(); this.wasteMainGroupsLoad();
this.wasteGroupsLoad(); this.wasteGroupsLoad();
this.fiasInit(); this.fiasInit();
}, },
computed: { computed: {
wasteGroupUrl() {
//https://r52.ru/
return '/api/type/' + this.localRecord.wType.name + (this.localRecord.wMainGroup.value ? "/" + this.localRecord.wMainGroup.value : "/");
},
wasteMainGroupUrl(){
return '/api/mainType/' + this.localRecord.wType.name
},
// Открываем кнопку "сохранить" // Открываем кнопку "сохранить"
formFilledRight() { formFilledRight() {
return (!this.objEmty(this.localRecord.wGroup)) && return (!this.objEmty(this.localRecord.wGroup)) &&
...@@ -209,12 +193,43 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -209,12 +193,43 @@ Vue.component('app-waste-utilisation-order-form', {
(this.localRecord.wAddress.city.name !== '') && (this.localRecord.wAddress.city.name !== '') &&
(this.localRecord.wAddress.street.name !== '') && (this.localRecord.wAddress.street.name !== '') &&
(this.localRecord.wAddress.building.name !== ''); (this.localRecord.wAddress.building.name !== '');
},
// следим на ссылкой на группы отходов
wasteGroupUrl() {
return this.serverUrl + 'api/type/' + this.localRecord.wType.name + (this.localRecord.wMainGroup.value ? "/" + this.localRecord.wMainGroup.value : "/");
},
// следим за ссылкой на виды отходов
wasteMainGroupUrl(){
return this.serverUrl + 'api/mainType/' + this.localRecord.wType.name
},
groupSelStyle() {
if (this.wDangerClassSelect.options.length) {
return 'col-md-9';
} else {
return 'col-md-12';
}
},
DangerClassActive() {
if (this.wDangerClassSelect.options.length) {
return true;
} else {
return false;
}
} }
}, },
methods: { methods: {
// Вводи кода отхода вручную // Ввод кода отхода вручную
/*
codeUp(){ codeUp(){
this.localRecord.wGroup = {}; this.localRecord.wGroup = {};
...@@ -246,6 +261,7 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -246,6 +261,7 @@ Vue.component('app-waste-utilisation-order-form', {
}, },
*/
objEmty(obj) { objEmty(obj) {
return Object.keys(obj).length === 0 return Object.keys(obj).length === 0
...@@ -376,9 +392,7 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -376,9 +392,7 @@ Vue.component('app-waste-utilisation-order-form', {
.get(this.wasteGroupUrl) .get(this.wasteGroupUrl)
.then(response => response.data) .then(response => response.data)
.then(options => { .then(options => {
this.initValue.value = !this.isEditing ? this.initValue.value = !this.isEditing ? this.initValue.value : this.localRecord.wGroup.value;
this.initValue.value :
this.localRecord.wGroup.value;
let groupsArr = []; let groupsArr = [];
for(var k in options){ for(var k in options){
...@@ -390,9 +404,11 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -390,9 +404,11 @@ Vue.component('app-waste-utilisation-order-form', {
this.dateFromGroup(); this.dateFromGroup();
}) })
}, },
dateFromMainGroup() { dateFromMainGroup() {
this.wasteGroupsLoad(); this.wasteGroupsLoad();
}, },
dateFromGroup() { dateFromGroup() {
axios axios
.get(this.wasteGroupUrl) .get(this.wasteGroupUrl)
...@@ -413,6 +429,7 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -413,6 +429,7 @@ Vue.component('app-waste-utilisation-order-form', {
} }
}) })
}, },
priceFromSelect() { priceFromSelect() {
axios axios
.get(this.wasteGroupUrl) .get(this.wasteGroupUrl)
...@@ -456,6 +473,7 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -456,6 +473,7 @@ Vue.component('app-waste-utilisation-order-form', {
} }
}, },
// стоимость транспортировки
delivCost(){ delivCost(){
if (this.localRecord.isTransport.value) { if (this.localRecord.isTransport.value) {
...@@ -474,7 +492,7 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -474,7 +492,7 @@ Vue.component('app-waste-utilisation-order-form', {
amount: this.localRecord.wAmount, amount: this.localRecord.wAmount,
group: this.localRecord.wGroup["value"] group: this.localRecord.wGroup["value"]
}, },
url: "/api/transport/getPrice/" url: this.serverUrl + "api/transport/getPrice/"
}).then(response => response.data) }).then(response => response.data)
.then(options => { .then(options => {
this.localRecord.wTransportCost["value"] = parseFloat(options["price"]).toFixed(2); this.localRecord.wTransportCost["value"] = parseFloat(options["price"]).toFixed(2);
...@@ -482,11 +500,12 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -482,11 +500,12 @@ Vue.component('app-waste-utilisation-order-form', {
} }
}, },
// Фильтр по главным типам отходов
onFilterChange(e) { onFilterChange(e) {
this.localRecord.wType = e; this.localRecord.wType = e;
this.localRecord.wMainGroup = {} this.localRecord.wMainGroup = {}
this.localRecord.wGroup = {}; this.localRecord.wGroup = {};
this.localRecord.wDangerClass = {}; this.localRecord.wDangerClass = {};
...@@ -513,19 +532,12 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -513,19 +532,12 @@ Vue.component('app-waste-utilisation-order-form', {
clickOnDeleteFormBtn() { clickOnDeleteFormBtn() {
this.$emit('clickOnDeleteFormBtn') this.$emit('clickOnDeleteFormBtn')
}, },
// При изменении списка файлов // При изменении списка файлов
updateDocs(e) { updateDocs(e) {
this.localRecord.wDocs = this.$children["4"].localFiles; this.localRecord.wDocs = this.$children["4"].localFiles;
}, },
// открываем/закрываем выпадашку селектора
changeShowDrop() {
if (this.ShowDrop) {
this.ShowDrop = false;
} else {
this.ShowDrop = true;
}
}
}, },
template: ` template: `
<div class="row utilization-table__row" ref="orderForm"> <div class="row utilization-table__row" ref="orderForm">
...@@ -539,15 +551,14 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -539,15 +551,14 @@ Vue.component('app-waste-utilisation-order-form', {
</div> </div>
<!-- Debug ---> <!-- Debug --->
<!--
<div class="debug" <div class="debug"
style="position: absolute; right: -270px;top: 500px; background-color:#fff; z-index:1000; width: 400px; height: 1000px; padding: 10px; border: 1px solid #999;"> style="position: absolute; right: -270px;top: 20px; background-color:#fff; z-index:1; width: 400px; height: 1500px; padding: 10px; border: 1px solid #999;">
<pre> <pre>
{{ ShowDrop }} {{ localRecord }}
</pre> </pre>
</div> </div>
--!>
<!-- end Debug --> <!-- end Debug -->
<!-- Form --> <!-- Form -->
...@@ -559,12 +570,10 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -559,12 +570,10 @@ Vue.component('app-waste-utilisation-order-form', {
<fieldset class="form__fieldset"> <fieldset class="form__fieldset">
<legend class="form__legend">Вид отхода</legend> <legend class="form__legend">Вид отхода</legend>
<!-- not lamp --> <div class="row">
<div class="row"
v-if="localRecord.wType['name'] != 'lamps'">
<div class="col-md-12"> <div class="col-md-12"
v-if="localRecord.wType['name'] != 'lamps'">
<div class="block_orange-b"> <div class="block_orange-b">
<!-- Вид отхода. Список --> <!-- Вид отхода. Список -->
<field-select <field-select
...@@ -577,10 +586,9 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -577,10 +586,9 @@ Vue.component('app-waste-utilisation-order-form', {
</div> </div>
</div> </div>
<div class="col-md-9" <div v-bind:class="[groupSelStyle]">
v-if="localRecord.wType['name'] != 'communal'">
<div class="block_orange-b"> <div class="block_orange-b">
<!-- Вид отхода. Список --> <!-- Группа отхода. Список -->
<field-select <field-select
v-bind="wGroupSelect" v-bind="wGroupSelect"
:init="localRecord.wGroup" :init="localRecord.wGroup"
...@@ -591,24 +599,9 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -591,24 +599,9 @@ Vue.component('app-waste-utilisation-order-form', {
</div> </div>
</div> </div>
<div class="col-md-12"
v-if="localRecord.wType['name'] == 'communal'">
<div class="block_orange-b">
<!-- Вид отхода. Список -->
<field-select
v-bind="wGroupSelect"
:init="localRecord.wGroup"
@change="localRecord.wGroup = $event"
@change="dateFromGroup"
:showDropProp="this.ShowDrop"
>
</field-select>
</div>
</div>
<div class="col-7 col-sm-4 col-md-3 col-lg-4 col-xl-3" <div class="col-7 col-sm-4 col-md-3 col-lg-4 col-xl-3"
v-if="localRecord.wType['name'] != 'communal'"> v-if="DangerClassActive">
<div class="block_orange-b"> <div class="block_orange-b">
<field-select <field-select
v-bind="wDangerClassSelect" v-bind="wDangerClassSelect"
...@@ -622,73 +615,11 @@ Vue.component('app-waste-utilisation-order-form', { ...@@ -622,73 +615,11 @@ Vue.component('app-waste-utilisation-order-form', {
</div> </div>
<info-block>
<info-block v-if="localRecord.wType['name'] != 'lamps'"> Список содержит часто спрашиваемые виды отходов. Если Вы не нашли необходимый вид отхода, сообщите нам в
Список содержит часто спрашиваемые виды отходов. Если Вы не нашли необходимый вид отхода, введите наименование отхода <a href="" data-toggle="modal" data-target="#modal-callback">тех. поддержку</a>
<a href="javascript:void(0)" @click="changeShowDrop"> самостоятельно</a>
</info-block>
<!-- /if not lamp -->
<!-- if lamp -->
<div class="row"
v-if="localRecord.wType['name'] == 'lamps'">
<div class="col-md-12">
<div class="block_orange-b">
<!-- Вид отхода. Список -->
<field-select
v-bind="wGroupSelect"
:title="wGroupLampSelect.title"
:init="localRecord.wGroup"
@change="localRecord.wGroup = $event"
@change="dateFromGroup"
>
</field-select>
</div>
</div>
</div>
<div class="block_cyan-b"
v-if="localRecord.wType['name'] == 'lamps'">
<div class="row">
<div class="col-6 col-sm-6">
<label class="field-text">
<span class="field-text__name">Длина</span>
<span class="field-text__input-wrap">
<input
type="text"
placeholder="Длина"
class="field-text__input"
:disabled="false"
>
</span>
</label>
</div>
<div class="col-6 col-sm-6">
<label class="field-text">
<span class="field-text__name">Диметр</span>
<span class="field-text__input-wrap">
<input
type="text"
placeholder="Диметр"
class="field-text__input"
:disabled="false"
>
</span>
</label>
</div>
</div>
</div>
<info-block v-if="localRecord.wType['name'] == 'lamps'">
Список содержит часто спрашиваемые виды отходов. Если Вы не нашли необходимую маркировку лампы, введите длину и диаметр <a href=""> самостоятельно</a>
</info-block> </info-block>
<!-- /if lamp -->
</fieldset> </fieldset>
<div class="hr"></div> <div class="hr"></div>
......
...@@ -20,9 +20,6 @@ Vue.component('field-select', { ...@@ -20,9 +20,6 @@ Vue.component('field-select', {
init: { init: {
type: Object type: Object
}, },
showDropProp: {
type: Boolean
}
}, },
model: { model: {
prop: 'attrs.value', prop: 'attrs.value',
...@@ -32,7 +29,6 @@ Vue.component('field-select', { ...@@ -32,7 +29,6 @@ Vue.component('field-select', {
function () { function () {
return { return {
choices: null, choices: null,
showDrop: this.showDropProp,
} }
}, },
mounted() { mounted() {
...@@ -41,15 +37,9 @@ Vue.component('field-select', { ...@@ -41,15 +37,9 @@ Vue.component('field-select', {
computed: { computed: {
}, },
watch: { watch: {
showDropProp: function() {
this.choices.showDropdown();
},
options: 'choicesUpdate', //отслеживаем изменение объекта с опциями options: 'choicesUpdate', //отслеживаем изменение объекта с опциями
}, },
methods: { methods: {
showDrop() {
return this.showDrop;
},
choicesInit() { choicesInit() {
this.choices = new Choices(this.$refs.select, this.settings); this.choices = new Choices(this.$refs.select, this.settings);
}, },
......
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