|
@@ -1,89 +1,160 @@
|
|
|
<template>
|
|
|
- <view>
|
|
|
- <uni-section padding>
|
|
|
- <uni-forms ref="bhForms" :modelValue="forms" :rules="rules">
|
|
|
- <uni-forms-item label="病患描述" name="bhms">
|
|
|
- <uni-easyinput v-model="forms.bhms" placeholder="请输入病患描述" />
|
|
|
- </uni-forms-item>
|
|
|
- <uni-forms-item label="病患类别" name="bhlb">
|
|
|
- <uni-data-select v-model="forms.bhlb" placeholder="请选择病患类别" :localdata="bhlbData" />
|
|
|
- </uni-forms-item>
|
|
|
- <uni-forms-item label="患病时间" name="bhsj">
|
|
|
- <uni-easyinput v-model="forms.bhsj" placeholder="请输入患病时间段" />
|
|
|
- </uni-forms-item>
|
|
|
- <uni-forms-item label="使用药物" name="syyw">
|
|
|
- <uni-easyinput type="textarea" v-model="forms.syyw" placeholder="请输入使用药物" />
|
|
|
- </uni-forms-item>
|
|
|
- <uni-forms-item label="处置手段">
|
|
|
- <uni-easyinput type="textarea" v-model="forms.czsd" placeholder="请输入处置手段" />
|
|
|
- </uni-forms-item>
|
|
|
- <uni-forms-item label="愈后情况">
|
|
|
- <uni-easyinput type="textarea" v-model="forms.yhqk" placeholder="请输入愈后情况" />
|
|
|
- </uni-forms-item>
|
|
|
- <uni-forms-item label="康复措施">
|
|
|
- <uni-easyinput type="textarea" v-model="forms.kfcs" placeholder="请输入康复措施" />
|
|
|
- </uni-forms-item>
|
|
|
+ <view>
|
|
|
+ <uni-section padding>
|
|
|
+ <uni-forms ref="bhForms" :model="forms" :rules="rules">
|
|
|
+ <uni-forms-item label="病患描述" name="bhms">
|
|
|
+ <uni-easyinput v-model="forms.bhms" placeholder="请输入病患描述" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="病患类别" name="bhlb">
|
|
|
+ <uni-data-select v-model="forms.bhlb" placeholder="请选择病患类别" :localdata="dicts.KH004" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="患病时间" name="bhsj">
|
|
|
+ <uni-easyinput v-model="forms.bhsj" placeholder="请输入患病时间段" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="使用药物" name="syyw">
|
|
|
+ <uni-easyinput type="textarea" v-model="forms.syyw" placeholder="请输入使用药物" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="处置手段">
|
|
|
+ <uni-easyinput type="textarea" v-model="forms.czsd" placeholder="请输入处置手段" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="愈后情况">
|
|
|
+ <uni-easyinput type="textarea" v-model="forms.yhqk" placeholder="请输入愈后情况" />
|
|
|
+ </uni-forms-item>
|
|
|
+ <uni-forms-item label="康复措施">
|
|
|
+ <uni-easyinput type="textarea" v-model="forms.kfcs" placeholder="请输入康复措施" />
|
|
|
+ </uni-forms-item>
|
|
|
|
|
|
- <button type="primary" v-if="active==0" @click="add('bhForms')">保存</button>
|
|
|
- </uni-forms>
|
|
|
- </uni-section>
|
|
|
- </view>
|
|
|
+ <view class="bottomButton">
|
|
|
+ <button type="primary" size="mini" @click="submitForm">保存</button>
|
|
|
+ </view>
|
|
|
+ </uni-forms>
|
|
|
+ </uni-section>
|
|
|
+ </view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- forms: [],
|
|
|
- rules: {
|
|
|
- bhms: {
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- errorMessage: '病患描述不能为空'
|
|
|
+ import { addKhbhls, updateKhbhls } from '@/api/lr.js'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ dicts: {
|
|
|
+ KH004: [],
|
|
|
+ },
|
|
|
+
|
|
|
+ khId: null,
|
|
|
+ forms: {
|
|
|
+ bhms: null,
|
|
|
+ bhlb: null,
|
|
|
+ bhsj: null,
|
|
|
+ syyw: null,
|
|
|
+ czsd: null,
|
|
|
+ yhqk: null,
|
|
|
+ kfcs: null,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ bhms: {
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ errorMessage: '病患描述不能为空'
|
|
|
}]
|
|
|
- },
|
|
|
- bhlb: {
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- errorMessage: '请选择病患类别'
|
|
|
+ },
|
|
|
+ bhlb: {
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ errorMessage: '请选择病患类别'
|
|
|
}]
|
|
|
- },
|
|
|
- bhsj: {
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- errorMessage: '患病时间段不能为空'
|
|
|
+ },
|
|
|
+ bhsj: {
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ errorMessage: '患病时间段不能为空'
|
|
|
}]
|
|
|
- },
|
|
|
- syyw: {
|
|
|
- rules: [{
|
|
|
- required: true,
|
|
|
- errorMessage: '使用药物不能为空'
|
|
|
+ },
|
|
|
+ syyw: {
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ errorMessage: '使用药物不能为空'
|
|
|
}]
|
|
|
- },
|
|
|
- },
|
|
|
- bhlbData: [{
|
|
|
- value: '0',
|
|
|
- text: "急性病"
|
|
|
- }, {
|
|
|
- value: '1',
|
|
|
- text: "慢性病"
|
|
|
- }, ]
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- add(ref) {
|
|
|
- this.$refs[ref].validate().then(res => {
|
|
|
- console.log('success', res);
|
|
|
- uni.showToast({
|
|
|
- title: `校验通过`
|
|
|
- })
|
|
|
- }).catch(err => {
|
|
|
- console.log('err', err);
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDictList(Object.keys(this.dicts), this.dicts)
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ if (option.item) {
|
|
|
+ this.forms = JSON.parse(option.item)
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: '修改病史记录'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.khId = option.id
|
|
|
+ this.xm = option.xm
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ submitForm() {
|
|
|
+ this.$refs['bhForms'].validate().then(res => {
|
|
|
+ const submitForm = {
|
|
|
+ ...this.forms,
|
|
|
+ khId: this.khId,
|
|
|
+ xm: this.xm,
|
|
|
+ };
|
|
|
+ if (this.forms.id) {
|
|
|
+ updateKhbhls(submitForm).then(res => {
|
|
|
+ if (res.code !== 200) return
|
|
|
+ // 关闭窗口后,恢复默认内容
|
|
|
+ uni.showToast({
|
|
|
+ title: `修改成功!`,
|
|
|
+ duration: 2000,
|
|
|
+ success: (res) => {
|
|
|
+ uni.$emit('changeBhls', 'bhls')
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.navigateBack({ delta: 1 });
|
|
|
+ }, 1000)
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ addKhbhls(submitForm).then(res => {
|
|
|
+ if (res.code !== 200) return
|
|
|
+ // 关闭窗口后,恢复默认内容
|
|
|
+ uni.showToast({
|
|
|
+ title: `新增成功!`,
|
|
|
+ duration: 2000,
|
|
|
+ success: (res) => {
|
|
|
+ uni.$emit('changeBhls', 'bhls')
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.navigateBack({ delta: 1 });
|
|
|
+ }, 1000)
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('err', err);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
-<style>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .bottomButton {
|
|
|
+ height: 140rpx;
|
|
|
+ width: 60%;
|
|
|
+ margin: 0 auto;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ button {
|
|
|
+ width: 40%;
|
|
|
+ }
|
|
|
+
|
|
|
+ button+button {
|
|
|
+ margin-left: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|