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>
<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>
</template>
@ -37,10 +38,13 @@ export default {
if (this.editor) {
this.editor.getContents({
success: (e) => {
this.$emit('confirm', e)
this.$emit('confirm', e.html)
this.close()
}
})
} else {
this.$emit('confirm', this.value)
this.close()
}
},
}

View File

@ -56,7 +56,12 @@
isLink
rightIcon="edit-pen"
@click="openEditor"
/>
>
<view slot="value">
<!-- <rich-text :nodes="info.illness" /> -->
<text>{{info.illness}}</text>
</view>
</u-cell>
<u-cell title="图片资料">
<view slot="value">
<cu-image ref="images" @update="updateImages" />
@ -197,9 +202,9 @@ export default {
this.$refs['editor'].open(this.info.illness)
},
confirmEditor(e) {
this.update({ illness: e.html }).then(res => {
this.update({ illness: e }).then(res => {
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">
<view class="input-text">
<!-- <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" />
</view>
</u-form-item>
@ -191,7 +192,7 @@ export default {
this.$refs['editor'].open(this.form.illness)
},
confirmEditor(e) {
this.form.illness = e.html
this.form.illness = e
},
submit() {
this.form.images = this.$refs['images'].getList().map(item => item.url)

View File

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

View File

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

View File

@ -167,7 +167,7 @@ export default {
},
add() {
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}` })
}
}
}