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