|
@@ -0,0 +1,96 @@
|
|
|
+<template>
|
|
|
+ <view class="main">
|
|
|
+ <view class="form">
|
|
|
+ <view class="form_group">
|
|
|
+ <view class="lable">所属科室</view>
|
|
|
+ <input v-model="item.title" placeholder="请输入标题" />
|
|
|
+ </view>
|
|
|
+ <view class="form_group">
|
|
|
+ <view class="lable">随访模板</view>
|
|
|
+ <picker :range="templateList" range-key="title" @change="picker($event, 'type')">
|
|
|
+ <input placeholder="请选择" v-model="item.type" :disabled="true" />
|
|
|
+ <view class="icon more"></view>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ <view class="form_group">
|
|
|
+ <view class="lable">随访模板</view>
|
|
|
+ <picker @change="picker($event, 'type')">
|
|
|
+ <input placeholder="请选择" v-model="item.type" :disabled="true" />
|
|
|
+ <view class="icon more"></view>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <button class="btn" @click="add()">确认</button>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ item: { state: 0 },
|
|
|
+ templateList: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad(e) {
|
|
|
+ this.getTemplateList();
|
|
|
+ if (e.id) {
|
|
|
+ this.http.request({
|
|
|
+ url: '/work/knowledge/detail/' + e.id,
|
|
|
+ success: (res) => {
|
|
|
+ this.item = res.data.data;
|
|
|
+ this.$refs.editor.setContents();
|
|
|
+ uni.setNavigationBarTitle({ title: '编辑知识库' });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ picker(e, tag) {
|
|
|
+ if (tag == 'type') {
|
|
|
+ this.item.type = this.type[e.detail.value].dictLabel;
|
|
|
+ } else {
|
|
|
+ this.item[tag] = e.detail.value;
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ getTemplateList() {
|
|
|
+ this.http.request({
|
|
|
+ url: '/work/record/template/list',
|
|
|
+ success: (res) => {
|
|
|
+ this.templateList = res.data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ add() {
|
|
|
+ let rule = [
|
|
|
+ { name: 'title', checkType: 'notnull', errorMsg: '请输入标题' },
|
|
|
+ { name: 'type', checkType: 'notnull', errorMsg: '请选择分类' },
|
|
|
+ { name: 'content', checkType: 'notnull', errorMsg: '请输入内容' }
|
|
|
+ ];
|
|
|
+ if (!this.verify.check(this.item, rule)) {
|
|
|
+ uni.showModal({ content: this.verify.error, showCancel: false });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.http.request({
|
|
|
+ url: this.item.id ? '/work/knowledge/edit' : '/work/knowledge/add',
|
|
|
+ method: 'POST',
|
|
|
+ data: this.item,
|
|
|
+ success: (res) => {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '操作成功',
|
|
|
+ showCancel: false,
|
|
|
+ success: (res) => {
|
|
|
+ uni.$emit('knowledge');
|
|
|
+ uni.navigateBack();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss"></style>
|