1
0
Fork 0

editor to textareag

master
panliang 2023-09-24 13:58:02 +08:00
parent 7cdea4108f
commit aa60103568
6 changed files with 94 additions and 102 deletions

View File

@ -1,6 +1,7 @@
<template> <template>
<u-modal :show="show" showCancelButton @cancel="close" @confirm="confirm"> <u-modal :show="show" showCancelButton @cancel="close" @confirm="confirm">
<editor id="editor" placeholder="请输入内容" @ready="onEditorReady" /> <!-- <editor id="editor" placeholder="请输入内容" @ready="onEditorReady" /> -->
<textarea v-model="value" />
</u-modal> </u-modal>
</template> </template>
@ -37,10 +38,13 @@ export default {
if (this.editor) { if (this.editor) {
this.editor.getContents({ this.editor.getContents({
success: (e) => { success: (e) => {
this.$emit('confirm', e) this.$emit('confirm', e.html)
this.close() this.close()
} }
}) })
} else {
this.$emit('confirm', this.value)
this.close()
} }
}, },
} }

View File

@ -56,7 +56,12 @@
isLink isLink
rightIcon="edit-pen" rightIcon="edit-pen"
@click="openEditor" @click="openEditor"
/> >
<view slot="value">
<!-- <rich-text :nodes="info.illness" /> -->
<text>{{info.illness}}</text>
</view>
</u-cell>
<u-cell title="图片资料"> <u-cell title="图片资料">
<view slot="value"> <view slot="value">
<cu-image ref="images" @update="updateImages" /> <cu-image ref="images" @update="updateImages" />
@ -197,9 +202,9 @@ export default {
this.$refs['editor'].open(this.info.illness) this.$refs['editor'].open(this.info.illness)
}, },
confirmEditor(e) { confirmEditor(e) {
this.update({ illness: e.html }).then(res => { this.update({ illness: e }).then(res => {
if (res.status == 0) { if (res.status == 0) {
this.info.illness = e.html this.info.illness = e
} }
}) })
}, },

View File

@ -40,7 +40,8 @@
<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 :class="{'input-placeholder': !form.illness}">点击修改</text> <text v-if="form.illness">{{ form.illness }}</text>
<text v-else class="input-placeholder">点击修改</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </u-form-item>
@ -191,7 +192,7 @@ export default {
this.$refs['editor'].open(this.form.illness) this.$refs['editor'].open(this.form.illness)
}, },
confirmEditor(e) { confirmEditor(e) {
this.form.illness = e.html this.form.illness = e
}, },
submit() { submit() {
this.form.images = this.$refs['images'].getList().map(item => item.url) this.form.images = this.$refs['images'].getList().map(item => item.url)

View File

@ -52,7 +52,12 @@
isLink isLink
rightIcon="edit-pen" rightIcon="edit-pen"
@click="openEditor" @click="openEditor"
/> >
<view slot="value">
<!-- <rich-text :nodes="info.illness" /> -->
<text>{{info.content}}</text>
</view>
</u-cell>
<u-cell title="图片资料"> <u-cell title="图片资料">
<view slot="value"> <view slot="value">
<cu-image ref="images" @update="updateImages" /> <cu-image ref="images" @update="updateImages" />
@ -331,7 +336,7 @@ export default {
this.$refs['editor'].open(this.info.content) this.$refs['editor'].open(this.info.content)
}, },
confirmEditor(e) { confirmEditor(e) {
const value = e.html const value = e
const key = 'content' const key = 'content'
this.update(key, value).then(res => { this.update(key, value).then(res => {
if (res.status == 0) { if (res.status == 0) {

View File

@ -26,26 +26,28 @@
</view> </view>
</u-form-item> </u-form-item>
<u-form-item prop="form.origin_price" label="划线价" :required="true" :borderBottom="true"> <u-form-item prop="form.origin_price" label="划线价" :required="true" :borderBottom="true">
<u-number-box <!-- <u-number-box
v-model="form.origin_price" v-model="form.origin_price"
:showMinus="false" :showMinus="false"
:showPlus="false" :showPlus="false"
:min="0" :min="0"
decimalLength="2" decimalLength="2"
:asyncChange="true"
inputWidth="100%" inputWidth="100%"
/> asyncChange
/> -->
<input type="number" v-model="form.origin_price" placeholder="输入划线价" />
</u-form-item> </u-form-item>
<u-form-item prop="form.sell_price" label="实收价" :required="true" :borderBottom="true"> <u-form-item prop="form.sell_price" label="实收价" :required="true" :borderBottom="true">
<u-number-box <!-- <u-number-box
v-model="form.sell_price" v-model="form.sell_price"
:showMinus="false" :showMinus="false"
:showPlus="false" :showPlus="false"
:min="0" :min="0"
decimalLength="2" decimalLength="2"
:asyncChange="true"
inputWidth="100%" inputWidth="100%"
/> asyncChange
/> -->
<input type="number" v-model="form.sell_price" placeholder="输入实收价" />
</u-form-item> </u-form-item>
<u-form-item prop="order_status" label="收费情况" :required="true" :borderBottom="true"> <u-form-item prop="order_status" label="收费情况" :required="true" :borderBottom="true">
<u-radio-group v-model="form.order_status"> <u-radio-group v-model="form.order_status">
@ -53,9 +55,10 @@
</u-radio-group> </u-radio-group>
</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.illness" :nodes="form.illness" /> -->
<text :class="{'input-placeholder': !form.content}">点击修改</text> <text v-if="form.content">{{ form.content }}</text>
<text v-else class="input-placeholder">点击修改</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </u-form-item>
@ -125,8 +128,8 @@ export default {
type_id: '', type_id: '',
doctor_id: '', doctor_id: '',
treat_at: Math.floor((new Date).getTime() / 1000), treat_at: Math.floor((new Date).getTime() / 1000),
origin_price: 0, origin_price: '',
sell_price: 0, sell_price: '',
order_status: orderStatus.success.value, order_status: orderStatus.success.value,
content: '', content: '',
next_treat_at: '', next_treat_at: '',
@ -134,28 +137,6 @@ export default {
notify_at: '', notify_at: '',
notify_remarks: '' notify_remarks: ''
}, },
rules: {
'treat_at': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
'doctor_id': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
'origin_price': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
'sell_price': {
required: true,
message: '必填',
trigger: ['blur', 'change']
},
},
typeList: [], typeList: [],
patient: {}, patient: {},
datePicker: { datePicker: {
@ -174,32 +155,39 @@ export default {
}, },
onLoad(e) { onLoad(e) {
this.id = e.id this.id = e.id
if (!e.id) { this.form.patient_id = e.patient
uni.setNavigationBarTitle({ this.form.type_id = e.type
title: '添加病历' this.init()
}) },
if (!e.patient) { methods: {
return uni.showModal({ async init() {
title: '请选择病人', let res
showCancel: false, res = await this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}})
success: () => { if (res.status == 0) {
uni.navigateBack() this.typeList = res.data.items
} let type_id = this.form.type_id
}) if (!type_id) {
} type_id = uni.getStorageSync('medical_record_treat_type_id')
const params = { _action: 'getData' }
this.$ajax.get(`/admin-api/patient/${e.patient}`, { params }).then(res => {
if (res.status == 0) {
this.patient = res.data
this.form.patient_id = this.patient.id
} }
}) if (type_id) {
} else { this.form.type_id = parseInt(type_id)
uni.setNavigationBarTitle({ this.typeChange(type_id)
title: '修改病历' }
}) }
res = await this.$ajax.get('/admin-api/current-user')
if (res.status == 0) {
this.currentUser = res.data
this.form.doctor_id = this.currentUser.id
this.adminUser.doctor_name = this.currentUser.name
this.form.notify_user_id = this.currentUser.id
this.adminUser.notify_user_name = this.currentUser.name
}
if (this.id) {
uni.setNavigationBarTitle({
title: '修改病历'
})
this.$ajax.get(`/admin-api/record/${e.id}`, { params: {_action: 'getData'}}).then(res => { res = await this.$ajax.get(`/admin-api/record/${this.id}`, { params: {_action: 'getData'}})
if (res.status == 0) { if (res.status == 0) {
this.info = res.data this.info = res.data
this.patient = res.data.patient this.patient = res.data.patient
@ -218,45 +206,34 @@ export default {
notify_remarks: this.info.notify_remarks notify_remarks: this.info.notify_remarks
} }
} }
}) } else {
} uni.setNavigationBarTitle({
this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}}).then(res => { title: '添加病历'
if (res.status == 0) { })
this.typeList = res.data.items if (!this.form.patient_id) {
let type_id = e.type_id return uni.showModal({
if (!type_id) { title: '请选择病人',
type_id = uni.getStorageSync('medical_record_treat_type_id') showCancel: false,
success: () => {
uni.navigateBack()
}
})
} }
if (type_id) { const params = { _action: 'getData' }
this.form.type_id = parseInt(type_id) res = await this.$ajax.get(`/admin-api/patient/${this.form.patient_id}`, { params })
this.typeChange(type_id) if (res.status == 0) {
this.patient = res.data
} }
} }
}) },
this.$ajax.get('/admin-api/current-user').then(res => {
if (res.status == 0) {
this.currentUser = res.data
this.form.doctor_id = this.currentUser.id
this.adminUser.doctor_name = this.currentUser.name
this.form.notify_user_id = this.currentUser.id
this.adminUser.notify_user_name = this.currentUser.name
}
})
},
onReady() {
this.$refs['form'].setRules(this.rules)
},
methods: {
submit() { submit() {
this.form.images = this.$refs['images'].getList().map(item => item.url) this.form.images = this.$refs['images'].getList().map(item => item.url)
this.$refs['form'].validate().then(res => { uni.showLoading()
uni.showLoading() if (this.id) {
if (this.id) { this.update()
this.update() } else {
} else { this.create()
this.create() }
}
}).catch(error => {})
}, },
update() { update() {
this.form.id = this.id this.form.id = this.id
@ -324,7 +301,7 @@ export default {
this.$refs['editor'].open(this.form.content) this.$refs['editor'].open(this.form.content)
}, },
confirmEditor(e) { confirmEditor(e) {
this.form.content = e.html this.form.content = e
} }
} }
} }

View File

@ -167,7 +167,7 @@ export default {
}, },
add() { add() {
const type = this.typeList[this.typeIndex] const type = this.typeList[this.typeIndex]
return uni.navigateTo({ url: `/pages/record/form?patient=${this.patient_id}&type_id=${type.id}` }) return uni.navigateTo({ url: `/pages/record/form?patient=${this.patient_id}&type=${type.id}` })
} }
} }
} }