fix create form and fix origin
This commit is contained in:
@@ -15,9 +15,8 @@
|
||||
:popup-content-style="{height: candidates?.length > 3 ? '216px' : ''}"
|
||||
v-model="value"
|
||||
ref="selectRef"
|
||||
@blur="pasteFullName"
|
||||
)
|
||||
//template(#selected)
|
||||
// .text-dark.text-sm.font-medium(v-if="person") {{ person.last_name + ' ' + person.first_name + ' ' + person.patronymic }}
|
||||
template(v-slot:iconLeft)
|
||||
q-icon.search-icon(name="app:search", size="20px")
|
||||
template(v-slot:customOption="{props, data}")
|
||||
@@ -60,6 +59,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
pickedFullName() {
|
||||
if (!this.value.first_name) return "";
|
||||
return (
|
||||
this.value.last_name +
|
||||
" " +
|
||||
@@ -70,8 +70,8 @@ export default {
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
pickedFullName(val) {
|
||||
this.$refs?.selectRef?.updateInputValue(val, true);
|
||||
pickedFullName() {
|
||||
this.pasteFullName();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -87,8 +87,10 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
test(slotProps) {
|
||||
console.log(slotProps);
|
||||
pasteFullName() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs?.selectRef?.updateInputValue(this.pickedFullName, true);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
:placeholder="useInput && placeholder ? placeholder : ''",
|
||||
@filter="filterFn",
|
||||
:popup-content-style="popupContentStyle"
|
||||
@blur="$emit('blur')"
|
||||
)
|
||||
template(v-slot:selected)
|
||||
template(#selected)
|
||||
slot(name="selected")
|
||||
template(v-slot:option="scope", v-if="!customOption")
|
||||
q-item(v-bind="scope.itemProps", style="justify-content: center", v-if="value?.icon")
|
||||
@@ -79,7 +80,7 @@ export default {
|
||||
filterFn: Function,
|
||||
popupContentStyle: Object,
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
emits: ["update:modelValue", "blur"],
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
.wrapper-info.h-full
|
||||
.grid.grid-cols-2.gap-x-4.gap-y-6
|
||||
base-input(
|
||||
:disabled="!!patient.id"
|
||||
v-model="phone",
|
||||
placeholder="+7 (915) 644–92–23",
|
||||
mask="+7 (###) ###-##-##",
|
||||
@@ -19,6 +20,7 @@
|
||||
important
|
||||
)
|
||||
base-input-date(
|
||||
:disabled="!!patient.id"
|
||||
v-model="birth_date",
|
||||
size="M",
|
||||
important,
|
||||
@@ -63,6 +65,11 @@ export default {
|
||||
currentStatus: patientData.statuses.find((e) => e.name === "Не принят"),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
primaryNumber() {
|
||||
return this.patient?.contacts?.find((e) => e.category === "PHONE")?.value;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
getEvents: "getEvents",
|
||||
@@ -90,6 +97,16 @@ export default {
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
watch: {
|
||||
patient(val) {
|
||||
if (val.birth_date) {
|
||||
this.birth_date = val.birth_date;
|
||||
}
|
||||
if (this.primaryNumber) {
|
||||
this.phone = this.primaryNumber;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
const getOrigin = () =>
|
||||
process.env.NODE_ENV === "development"
|
||||
? "https://astra-dev.dopcore.com"
|
||||
: window.origin;
|
||||
|
||||
function prepareUrl(url) {
|
||||
if (url.startsWith("http")) return url;
|
||||
return `https://astra-dev.dopcore.com/api/${url}`;
|
||||
return `${getOrigin}/api/${url}`;
|
||||
}
|
||||
|
||||
function handleRequest(method, url, headers, attempts, body, type) {
|
||||
|
||||
@@ -20,10 +20,6 @@ export function getObjectChangeField(objInit, objUpdate) {
|
||||
return resultObj;
|
||||
}
|
||||
|
||||
export function checkTypeofObject(obj) {
|
||||
return typeof obj === "object" && obj !== "null";
|
||||
}
|
||||
|
||||
export function checkChangeData(dataInit, dataChange) {
|
||||
return JSON.stringify(dataInit) !== JSON.stringify(dataChange);
|
||||
}
|
||||
|
||||
@@ -1,31 +1,5 @@
|
||||
import { fetchWrapper } from "../fetchWrapper";
|
||||
import { removeEmptyFields, checkChangeData } from "./changesObjects";
|
||||
|
||||
export function getRequestChangeData(
|
||||
createData,
|
||||
updateData,
|
||||
initData,
|
||||
key,
|
||||
id
|
||||
) {
|
||||
let isInitDataEmpty = [...Object.keys(removeEmptyFields(initData))].length;
|
||||
if (Object.keys(removeEmptyFields(updateData)).length) {
|
||||
if (!isInitDataEmpty) {
|
||||
return fetchWrapper.post(
|
||||
`general/${key}/create/`,
|
||||
removeEmptyFields(createData)
|
||||
);
|
||||
}
|
||||
if (JSON.stringify(updateData) !== JSON.stringify(initData)) {
|
||||
return fetchWrapper.post(
|
||||
`general/${key}/${id}/update/`,
|
||||
removeEmptyFields(updateData)
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
import { checkChangeData } from "./changesObjects";
|
||||
|
||||
export function getRequestArrayData(
|
||||
initData,
|
||||
|
||||
Reference in New Issue
Block a user