1
0
Fork 0

form editor preview

master
panliang 2023-09-22 11:00:18 +08:00
parent eaad940502
commit 360825af63
5 changed files with 34 additions and 33 deletions

View File

@ -55,12 +55,9 @@
title="病情描述" title="病情描述"
isLink isLink
rightIcon="edit-pen" rightIcon="edit-pen"
value="点击修改"
@click="openEditor" @click="openEditor"
> />
<view slot="label">
<rich-text :nodes="info.illness" />
</view>
</u-cell>
<u-cell <u-cell
title="录入时间" title="录入时间"
:value="info.created_at" :value="info.created_at"
@ -166,9 +163,9 @@ export default {
confirmModal() { confirmModal() {
const key = this.modal.key const key = this.modal.key
const value = this.modal.value const value = this.modal.value
const params = { id: this.id } const params = {}
params[key] = value params[key] = value
this.$ajax.put(`/admin-api/patient/${this.id}`, params).then(res => { this.update(params).then(res => {
this.modal.show = false this.modal.show = false
if (res.status == 0) { if (res.status == 0) {
this.info[key] = value this.info[key] = value
@ -182,7 +179,7 @@ export default {
this.$refs['editor'].open(this.info.illness) this.$refs['editor'].open(this.info.illness)
}, },
confirmEditor(e) { confirmEditor(e) {
this.$ajax.put(`/admin-api/patient/${this.id}`, { id: this.id, illness: e.html }).then(res => { this.update({ illness: e.html }).then(res => {
if (res.status == 0) { if (res.status == 0) {
this.info.illness = e.html this.info.illness = e.html
} }
@ -192,7 +189,7 @@ export default {
this.genderSheet.show = !this.genderSheet.show this.genderSheet.show = !this.genderSheet.show
}, },
selectGender(e) { selectGender(e) {
this.$ajax.put(`/admin-api/patient/${this.id}`, {id: this.id, sex: e.value}).then(res => { this.update({ sex: e.value }).then(res => {
if (res.status == 0) { if (res.status == 0) {
this.info.sex = e.value this.info.sex = e.value
this.info.sex_text = e.name this.info.sex_text = e.name
@ -209,9 +206,9 @@ export default {
selectBirthday(e) { selectBirthday(e) {
const time = Math.floor(e.value / 1000) const time = Math.floor(e.value / 1000)
const key = this.datePicker.name const key = this.datePicker.name
const params = { id: this.id } const params = {}
params[key] = time params[key] = time
this.$ajax.put(`/admin-api/patient/${this.id}`, params).then(res => { this.update(params).then(res => {
if (res.status == 0) { if (res.status == 0) {
this.info[key] = e.value this.info[key] = e.value
this.toggleBirthday() this.toggleBirthday()
@ -225,7 +222,7 @@ export default {
this.$refs['select-admin-user'].close() this.$refs['select-admin-user'].close()
}, },
selectDoctor(e) { selectDoctor(e) {
this.$ajax.put(`/admin-api/patient/${this.id}`, {id: this.id, doctor_id: e.id}).then(res => { this.update({ doctor_id: e.id }).then(res => {
if (res.status == 0) { if (res.status == 0) {
this.info.doctor_id = e.id this.info.doctor_id = e.id
this.info.doctor.name = e.name this.info.doctor.name = e.name
@ -250,6 +247,10 @@ export default {
} }
}) })
}, },
update(data) {
const params = Object.assign({id: this.id}, data)
return this.$ajax.put(`/admin-api/patient/${this.id}`, params, { custom: { loading: true } })
},
delete(id) { delete(id) {
uni.showLoading() uni.showLoading()
this.$ajax.delete(`/admin-api/patient/${id}`).then(res => { this.$ajax.delete(`/admin-api/patient/${id}`).then(res => {

View File

@ -39,8 +39,8 @@
</u-form-item> </u-form-item>
<u-form-item label="病情描述" prop="illness" @click="openEditor"> <u-form-item label="病情描述" prop="illness" @click="openEditor">
<view class="input-text"> <view class="input-text">
<rich-text v-if="form.illness" :nodes="form.illness" /> <!-- <rich-text v-if="form.illness" :nodes="form.illness" /> -->
<text v-else class="input-placeholder">点击填写病情描述</text> <text :class="{'input-placeholder': !form.illness}">{{form.illness ? '点击修改' : '点击填写'}}</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </u-form-item>
@ -66,7 +66,7 @@
@close="toggleGender" @close="toggleGender"
@select="selectGender" @select="selectGender"
/> />
<cu-editor ref="editor" placeholder="请输入病情描述" @confirm="confirmEditor" /> <cu-editor ref="editor" @confirm="confirmEditor" />
</view> </view>
</template> </template>
@ -104,7 +104,7 @@ export default {
show: false, show: false,
name: '', name: '',
value: (new Date).getTime(), value: (new Date).getTime(),
minDate: (new Date('1900-1-1')).getTime() minDate: (new Date('1900/1/1')).getTime()
}, },
doctor: { doctor: {
text: '', text: '',
@ -128,9 +128,9 @@ export default {
name: res.data.name, name: res.data.name,
sex: res.data.sex, sex: res.data.sex,
phone: res.data.phone, phone: res.data.phone,
birthday: res.data.birthday, birthday: res.data.birthday ? res.data.birthday.replaceAll('-', '/') : '',
address: res.data.address, address: res.data.address,
treat_at: res.data.treat_at, treat_at: res.data.treat_at ? res.data.treat_at.replaceAll('-', '/') : '',
doctor_id: res.data.doctor_id, doctor_id: res.data.doctor_id,
illness: res.data.illness illness: res.data.illness
} }

View File

@ -49,15 +49,11 @@
/> />
<u-cell <u-cell
title="诊疗情况" title="诊疗情况"
:label="info.content"
isLink isLink
rightIcon="edit-pen" rightIcon="edit-pen"
value="点击修改"
@click="openEditor" @click="openEditor"
> />
<view slot="label">
<rich-text :nodes="info.content" />
</view>
</u-cell>
<u-cell <u-cell
title="下次就诊时间" title="下次就诊时间"
:value="info.next_treat_at | date" :value="info.next_treat_at | date"
@ -226,7 +222,7 @@ export default {
id: this.id, id: this.id,
} }
params[key] = value params[key] = value
return this.$ajax.put(`/admin-api/record/${this.id}`, params) return this.$ajax.put(`/admin-api/record/${this.id}`, params, {custom: { loading: true }})
}, },
opendAdminUser(name) { opendAdminUser(name) {
this.adminUser.key = name this.adminUser.key = name

View File

@ -54,8 +54,8 @@
</u-form-item> </u-form-item>
<u-form-item label="请输入诊疗情况" prop="content" :borderBottom="true" @click="openEditor"> <u-form-item label="请输入诊疗情况" prop="content" :borderBottom="true" @click="openEditor">
<view class="input-text"> <view class="input-text">
<rich-text v-if="form.content" :nodes="form.content" /> <!-- <rich-text v-if="form.content" :nodes="form.content" /> -->
<text v-else class="input-placeholder">点击填写诊疗情况</text> <text :class="{'input-placeholder': !form.content}">{{form.content ? '点击修改' : '点击填写'}}</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </u-form-item>
@ -158,7 +158,7 @@ export default {
show: false, show: false,
name: '', name: '',
value: (new Date).getTime(), value: (new Date).getTime(),
minDate: (new Date('1900-1-1')).getTime() minDate: (new Date('1900/1/1')).getTime()
}, },
adminUser: { adminUser: {
key: '' key: ''
@ -202,14 +202,14 @@ export default {
patient_id: this.info.patient_id, patient_id: this.info.patient_id,
type_id: this.info.type_id, type_id: this.info.type_id,
doctor_id: this.info.doctor_id, doctor_id: this.info.doctor_id,
treat_at: this.info.treat_at, treat_at: this.info.treat_at ? this.info.treat_at.replaceAll('-', '/') : '',
origin_price: this.info.origin_price, origin_price: this.info.origin_price,
sell_price: this.info.sell_price, sell_price: this.info.sell_price,
order_status: this.info.order_status, order_status: this.info.order_status,
content: this.info.content, content: this.info.content,
next_treat_at: this.info.next_treat_at, next_treat_at: this.info.next_treat_at ? this.info.next_treat_at.replaceAll('-', '/') : '',
notify_user_id: this.info.notify_user_id, notify_user_id: this.info.notify_user_id,
notify_at: this.info.notify_at, notify_at: this.info.notify_at ? this.info.notify_at.replaceAll('-', '/') : '',
notify_remarks: this.info.notify_remarks notify_remarks: this.info.notify_remarks
} }
} }

View File

@ -5,7 +5,8 @@ module.exports = () => {
uni.$u.http.setConfig((config) => { uni.$u.http.setConfig((config) => {
config.baseURL = process.env.VUE_APP_BASE_API config.baseURL = process.env.VUE_APP_BASE_API
config.custom = { config.custom = {
toast: true toast: true,
loading: false
} }
return config return config
}) })
@ -18,6 +19,9 @@ module.exports = () => {
config.header['Authorization'] = `Bearer ${token}` config.header['Authorization'] = `Bearer ${token}`
} }
config.header['Accept'] = 'application/json' config.header['Accept'] = 'application/json'
if (config.custom.loading) {
uni.showLoading()
}
return config return config
}, },
config => { config => {
@ -31,7 +35,7 @@ module.exports = () => {
uni.hideLoading() uni.hideLoading()
const res = response.data const res = response.data
if (res.status != 0 && res.doNotDisplayToast != 1) { if (response.config.custom.toast && res.status != 0 && res.doNotDisplayToast != 1) {
uni.showModal({ uni.showModal({
title: res.msg, title: res.msg,
showCancel: false showCancel: false