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

View File

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

View File

@ -49,15 +49,11 @@
/>
<u-cell
title="诊疗情况"
:label="info.content"
isLink
rightIcon="edit-pen"
value="点击修改"
@click="openEditor"
>
<view slot="label">
<rich-text :nodes="info.content" />
</view>
</u-cell>
/>
<u-cell
title="下次就诊时间"
:value="info.next_treat_at | date"
@ -226,7 +222,7 @@ export default {
id: this.id,
}
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) {
this.adminUser.key = name

View File

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

View File

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