diff --git a/api/views.py b/api/views.py index e0092498cb..37429ef3ef 100644 --- a/api/views.py +++ b/api/views.py @@ -2655,13 +2655,19 @@ 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( @@ -2673,6 +2679,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") == "Работодатель": @@ -2698,6 +2705,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 487b6a731f..1204bf903c 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -68,7 +68,16 @@ 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 8fb30b100c..3ca506ed1f 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);