From fddb322da477cefc06bf968fddc4014d8cbae6b7 Mon Sep 17 00:00:00 2001 From: Wellheor Date: Tue, 21 Nov 2023 09:52:46 +0800 Subject: [PATCH 1/5] =?UTF-8?q?*=20=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20Symbol?= =?UTF-8?q?=5Fcode=20+=20id=20=D0=BD=D0=B0=20=D1=84=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/views.py | 11 +++++-- contracts/models.py | 3 +- l2-frontend/src/construct/ConstructPrice.vue | 30 ++++++++++++++++++-- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/api/views.py b/api/views.py index 50657d840..63050bc67 100644 --- a/api/views.py +++ b/api/views.py @@ -2651,13 +2651,16 @@ def update_price(request): current_price = None if request_data["id"] == -1: if request_data.get("typePrice") == "Работодатель": - current_price = PriceName(title=request_data["title"], date_start=request_data["start"], date_end=request_data["end"], company_id=request_data["company"]) + current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], + company_id=request_data["company"]) elif request_data.get("typePrice") == "Заказчик": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() - current_price = PriceName(title=request_data["title"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, subcontract=True) + current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, + subcontract=True) elif request_data.get("typePrice") == "Внешний исполнитель": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() - current_price = PriceName(title=request_data["title"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, external_performer=True) + current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, + external_performer=True) if current_price: current_price.save() Log.log( @@ -2669,6 +2672,7 @@ def update_price(request): else: current_price = PriceName.objects.get(pk=request_data["id"]) current_price.title = request_data["title"] + current_price.symbol_code = request_data["code"] current_price.date_start = request_data["start"] current_price.date_end = request_data["end"] if request_data.get("typePrice") == "Заказчик" or request_data.get("typePrice") == "Работодатель": @@ -2694,6 +2698,7 @@ def copy_price(request): current_price = PriceName.objects.get(pk=request_data["id"]) new_price = PriceName( title=f"{current_price.title} - новый прайс", + symbol_code=f"{current_price.symbol_code} - новый", date_start=current_price.date_start, date_end=current_price.date_end, company=current_price.company, diff --git a/contracts/models.py b/contracts/models.py index 46cf324c5..081581268 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -65,7 +65,8 @@ def as_json(price): else: company_title = "" company_id = "" - json_data = {"id": price.id, "title": price.title, "start": price.date_start, "end": price.date_end, "company": company_id, "companyTitle": company_title, "uuid": str(price.uuid)} + json_data = {"id": price.id, "title": price.title, "code": price.symbol_code, "start": price.date_start, "end": price.date_end, "company": company_id, "companyTitle": company_title, + "uuid": str(price.uuid)} return json_data @staticmethod diff --git a/l2-frontend/src/construct/ConstructPrice.vue b/l2-frontend/src/construct/ConstructPrice.vue index 8fb30b100..3ca506ed1 100644 --- a/l2-frontend/src/construct/ConstructPrice.vue +++ b/l2-frontend/src/construct/ConstructPrice.vue @@ -20,6 +20,7 @@ + Название + + Код + Дата начала @@ -51,6 +55,13 @@ :disabled="!priceIsActive" > + + + + + ID + + + {{ priceData.id }} + UUID {{ priceData.uuid }} @@ -379,7 +398,9 @@ export default { selectedPrice() { if (!this.selectedPrice) { this.priceData = { + id: -1, title: '', + code: '', start: '', end: '', company: null, @@ -454,6 +475,7 @@ export default { const { ok, message } = await this.$api('update-price', { id: this.selectedPrice, title: this.priceData.title, + code: this.priceData.code, start: this.priceData.start, end: this.priceData.end, company: this.priceData.company, @@ -471,6 +493,7 @@ export default { const { ok, message } = await this.$api('update-price', { id: -1, title: this.priceData.title, + code: this.priceData.code, start: this.priceData.start, end: this.priceData.end, company: this.priceData.company, @@ -481,10 +504,13 @@ export default { this.$root.$emit('msg', 'ok', 'Прайс добавлен'); await this.getPrices(); this.priceData = { + id: -1, title: '', + code: '', start: '', end: '', company: null, + uuid: '', }; } else { this.$root.$emit('msg', 'error', message); From 1f9e2532b4958999ad18ac573da913e9095845cf Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:14:24 +0800 Subject: [PATCH 2/5] Update contracts/models.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- contracts/models.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contracts/models.py b/contracts/models.py index 081581268..6e0fc12f9 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -65,8 +65,16 @@ def as_json(price): else: company_title = "" company_id = "" - json_data = {"id": price.id, "title": price.title, "code": price.symbol_code, "start": price.date_start, "end": price.date_end, "company": company_id, "companyTitle": company_title, - "uuid": str(price.uuid)} + json_data = { + "id": price.id, + "title": price.title, + "code": price.symbol_code, + "start": price.date_start, + "end": price.date_end, + "company": company_id, + "companyTitle": company_title, + "uuid": str(price.uuid), + } return json_data @staticmethod From 3bf3598f3994469b9ad283821fa5c9c18b778ee9 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:14:34 +0800 Subject: [PATCH 3/5] Update api/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index 63050bc67..18bfc0481 100644 --- a/api/views.py +++ b/api/views.py @@ -2651,8 +2651,9 @@ def update_price(request): current_price = None if request_data["id"] == -1: if request_data.get("typePrice") == "Работодатель": - current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], - company_id=request_data["company"]) + current_price = PriceName( + title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], company_id=request_data["company"] + ) elif request_data.get("typePrice") == "Заказчик": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, From 68e0b304a3c2e38bdcc15f926d8943e9ecddf491 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:14:42 +0800 Subject: [PATCH 4/5] Update api/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index 18bfc0481..cbc028d50 100644 --- a/api/views.py +++ b/api/views.py @@ -2656,8 +2656,9 @@ def update_price(request): ) elif request_data.get("typePrice") == "Заказчик": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() - current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, - subcontract=True) + current_price = PriceName( + title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, subcontract=True + ) elif request_data.get("typePrice") == "Внешний исполнитель": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, From 760c7380fb1c1e29e22a6abaab45b286de24a5e6 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:14:49 +0800 Subject: [PATCH 5/5] Update api/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index cbc028d50..ecb552756 100644 --- a/api/views.py +++ b/api/views.py @@ -2661,8 +2661,9 @@ def update_price(request): ) elif request_data.get("typePrice") == "Внешний исполнитель": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() - current_price = PriceName(title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, - external_performer=True) + current_price = PriceName( + title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, external_performer=True + ) if current_price: current_price.save() Log.log(