|
@@ -56,7 +56,7 @@
|
|
|
<el-upload
|
|
|
class="upload-demo"
|
|
|
ref="upload"
|
|
|
- action="http://172.16.32.160:8706/manageDoctorInfo/uploadPortrait"
|
|
|
+ :action="apiUrl + '/manageDoctorInfo/uploadPortrait'"
|
|
|
:headers="header"
|
|
|
:file-list="fileList"
|
|
|
:limit="1"
|
|
@@ -169,8 +169,7 @@
|
|
|
</el-container>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
-import Cookies from 'js-cookie'
|
|
|
+<script setup>
|
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
|
import {
|
|
|
deleteDoctor,
|
|
@@ -186,243 +185,203 @@ import {
|
|
|
import store from '@/store'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import axios from 'axios'
|
|
|
-export default {
|
|
|
- setup() {
|
|
|
- const windowSize = store.state.app.windowSize
|
|
|
- const tableHeight = windowSize.h - 85
|
|
|
- const allTitles = ref([])
|
|
|
- const allMzDepts = ref([])
|
|
|
- const allDoctors = ref([])
|
|
|
- const totalSize = ref(0)
|
|
|
- const yesOrNo = [
|
|
|
- { code: 1, name: '推荐' },
|
|
|
- { code: 0, name: '不推荐' },
|
|
|
- ]
|
|
|
- const sexCodes = [
|
|
|
- { code: 1, name: '男' },
|
|
|
- { code: 2, name: '女' },
|
|
|
- { code: 9, name: '未知' },
|
|
|
- ]
|
|
|
|
|
|
- const queryParam = reactive({
|
|
|
- deptCode: '',
|
|
|
- doctorName: '',
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 15,
|
|
|
- })
|
|
|
-
|
|
|
- const handleSizeChange = (val) => {
|
|
|
- queryParam.pageSize = val
|
|
|
- fetchDoctors()
|
|
|
- }
|
|
|
- const handleCurrentChange = (val) => {
|
|
|
- queryParam.currentPage = val
|
|
|
- fetchDoctors()
|
|
|
- }
|
|
|
+const apiUrl = import.meta.env.VITE_BASE_URL
|
|
|
+const windowSize = store.state.app.windowSize
|
|
|
+const tableHeight = windowSize.h - 85
|
|
|
+const allTitles = ref([])
|
|
|
+const allMzDepts = ref([])
|
|
|
+const allDoctors = ref([])
|
|
|
+const totalSize = ref(0)
|
|
|
+const yesOrNo = [
|
|
|
+ { code: 1, name: '推荐' },
|
|
|
+ { code: 0, name: '不推荐' },
|
|
|
+]
|
|
|
+const sexCodes = [
|
|
|
+ { code: 1, name: '男' },
|
|
|
+ { code: 2, name: '女' },
|
|
|
+ { code: 9, name: '未知' },
|
|
|
+]
|
|
|
|
|
|
- const resetSearch = () => {
|
|
|
- queryParam.deptCode = queryParam.doctorName = ''
|
|
|
- fetchDoctors()
|
|
|
- }
|
|
|
+const queryParam = reactive({
|
|
|
+ deptCode: '',
|
|
|
+ doctorName: '',
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 15,
|
|
|
+})
|
|
|
|
|
|
- const handleSelectRec = (code, flag) => {
|
|
|
- updateDoctorWxHomepageFlag(code, flag).then(() => {
|
|
|
- const message = flag === 1 ? '已在微信服务号首页推荐此医生。' : '已取消此医生在微信服务号首页的推荐。'
|
|
|
- const type = flag === 1 ? 'success' : 'warning'
|
|
|
- ElMessage({
|
|
|
- message,
|
|
|
- type,
|
|
|
- duration: 3000,
|
|
|
- showClose: true,
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
+const handleSizeChange = (val) => {
|
|
|
+ queryParam.pageSize = val
|
|
|
+ fetchDoctors()
|
|
|
+}
|
|
|
+const handleCurrentChange = (val) => {
|
|
|
+ queryParam.currentPage = val
|
|
|
+ fetchDoctors()
|
|
|
+}
|
|
|
|
|
|
- const viewDoctor = (val) => {
|
|
|
- getDoctorInfo(val.code).then((res) => {
|
|
|
- doctor.value = res
|
|
|
- edit.value = false
|
|
|
- drawer.value = true
|
|
|
- })
|
|
|
- }
|
|
|
- const editDoctor = (val) => {
|
|
|
- getDoctorInfo(val.code).then((res) => {
|
|
|
- doctor.value = res
|
|
|
- edit.value = true
|
|
|
- drawer.value = true
|
|
|
- })
|
|
|
- }
|
|
|
+const resetSearch = () => {
|
|
|
+ queryParam.deptCode = queryParam.doctorName = ''
|
|
|
+ fetchDoctors()
|
|
|
+}
|
|
|
|
|
|
- const doctor = ref({})
|
|
|
- const editStyle = {
|
|
|
- padding: '0 15px 15px 50px',
|
|
|
- height: window.innerHeight + 'px',
|
|
|
- overflowY: 'scroll',
|
|
|
- }
|
|
|
- const edit = ref(true)
|
|
|
- const drawer = ref(false)
|
|
|
+const handleSelectRec = (code, flag) => {
|
|
|
+ updateDoctorWxHomepageFlag(code, flag).then(() => {
|
|
|
+ const message = flag === 1 ? '已在微信服务号首页推荐此医生。' : '已取消此医生在微信服务号首页的推荐。'
|
|
|
+ const type = flag === 1 ? 'success' : 'warning'
|
|
|
+ ElMessage({
|
|
|
+ message,
|
|
|
+ type,
|
|
|
+ duration: 3000,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- const fileList = ref([])
|
|
|
+const viewDoctor = (val) => {
|
|
|
+ getDoctorInfo(val.code).then((res) => {
|
|
|
+ doctor.value = res
|
|
|
+ edit.value = false
|
|
|
+ drawer.value = true
|
|
|
+ })
|
|
|
+}
|
|
|
+const editDoctor = (val) => {
|
|
|
+ getDoctorInfo(val.code).then((res) => {
|
|
|
+ doctor.value = res
|
|
|
+ edit.value = true
|
|
|
+ drawer.value = true
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- const beforeAvatarUpload = (file) => {
|
|
|
- const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
|
- const isLt1M = file.size / 1024 / 1024 < 1
|
|
|
- if (!isJPG) {
|
|
|
- ElMessage.error('上传头像图片只能是 jpg 或 png 格式!')
|
|
|
- }
|
|
|
- if (!isLt1M) {
|
|
|
- ElMessage.error('上传头像图片大小不能超过 1MB!')
|
|
|
- }
|
|
|
- return isJPG && isLt1M
|
|
|
- }
|
|
|
+const doctor = ref({})
|
|
|
+const editStyle = {
|
|
|
+ padding: '0 15px 15px 50px',
|
|
|
+ height: window.innerHeight + 'px',
|
|
|
+ overflowY: 'scroll',
|
|
|
+}
|
|
|
+const edit = ref(true)
|
|
|
+const drawer = ref(false)
|
|
|
|
|
|
- const upload = ref(null)
|
|
|
- const header = {
|
|
|
- token: Cookies.get('token'),
|
|
|
- }
|
|
|
- const submitUpload = () => {
|
|
|
- upload.value.submit()
|
|
|
- }
|
|
|
- const fileSizeOutLimit = () => {
|
|
|
- ElMessage.error('已经选取头像,如须更换请先移除已选取的头像!')
|
|
|
- }
|
|
|
- const uploadSuccess = () => {
|
|
|
- ElMessage.success('上传成功!')
|
|
|
- }
|
|
|
- const uploadError = () => {
|
|
|
- ElMessage.error('上传失败!')
|
|
|
- }
|
|
|
+const fileList = ref([])
|
|
|
|
|
|
- const saveDoctor = () => {
|
|
|
- saveDoctorInfo(doctor.value).then(() => {
|
|
|
- ElMessage.success('保存成功')
|
|
|
- })
|
|
|
- }
|
|
|
+const beforeAvatarUpload = (file) => {
|
|
|
+ const isJPG = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
|
+ const isLt1M = file.size / 1024 / 1024 < 1
|
|
|
+ if (!isJPG) {
|
|
|
+ ElMessage.error('上传头像图片只能是 jpg 或 png 格式!')
|
|
|
+ }
|
|
|
+ if (!isLt1M) {
|
|
|
+ ElMessage.error('上传头像图片大小不能超过 1MB!')
|
|
|
+ }
|
|
|
+ return isJPG && isLt1M
|
|
|
+}
|
|
|
|
|
|
- const avatarError = () => {
|
|
|
- return true
|
|
|
- }
|
|
|
+const upload = ref(null)
|
|
|
+const header = {
|
|
|
+ token: store.state.user.token,
|
|
|
+}
|
|
|
+const submitUpload = () => {
|
|
|
+ upload.value.submit()
|
|
|
+}
|
|
|
+const fileSizeOutLimit = () => {
|
|
|
+ ElMessage.error('已经选取头像,如须更换请先移除已选取的头像!')
|
|
|
+}
|
|
|
+const uploadSuccess = () => {
|
|
|
+ ElMessage.success('上传成功!')
|
|
|
+}
|
|
|
+const uploadError = () => {
|
|
|
+ ElMessage.error('上传失败!')
|
|
|
+}
|
|
|
|
|
|
- const manageOrderDialog = ref(false)
|
|
|
- const recommendDoctors = ref([])
|
|
|
- const manageRecommendOrder = () => {
|
|
|
- getAllRecommendDoctors().then((res) => {
|
|
|
- recommendDoctors.value = res
|
|
|
- manageOrderDialog.value = true
|
|
|
- })
|
|
|
- }
|
|
|
- const modifyOrder = (val) => {
|
|
|
- ElMessageBox.prompt('请输入新序号', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- inputPattern: /^[1-9]\d*$/,
|
|
|
- inputErrorMessage: '请输入大于0的整数',
|
|
|
- })
|
|
|
- .then(({ value }) => {
|
|
|
- updateWxHomepageOrder(val.code, value).then(() => {
|
|
|
- val.wxHomepageOrder = value
|
|
|
- ElMessage({
|
|
|
- message: '保存排序成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000,
|
|
|
- showClose: true,
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- }
|
|
|
+const saveDoctor = () => {
|
|
|
+ saveDoctorInfo(doctor.value).then(() => {
|
|
|
+ ElMessage.success('保存成功')
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- const refreshWxDoctorCache = () => {
|
|
|
- axios('http://192.168.200.3:8805/wxserver/homepage/refreshHomePageDoctors').then((res) => {
|
|
|
- if (res.data.code === 200) {
|
|
|
- ElMessage({
|
|
|
- message: '强制刷新成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000,
|
|
|
- showClose: true,
|
|
|
- })
|
|
|
- } else {
|
|
|
- ElMessage.error(res.data.message)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+const avatarError = () => {
|
|
|
+ return true
|
|
|
+}
|
|
|
|
|
|
- const beforeDelete = (row) => {
|
|
|
- ElMessageBox.confirm('删除后将无法在服务号首页推荐,是否确认删除?', '提示', {
|
|
|
- type: 'warning',
|
|
|
- confirmButtonText: '删除',
|
|
|
- cancelButtonText: '取消',
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- deleteDoctor(row.code).then((res) => {
|
|
|
- ElMessage({
|
|
|
- message: res,
|
|
|
- type: 'success',
|
|
|
- duration: 2000,
|
|
|
- showClose: true,
|
|
|
- })
|
|
|
- fetchDoctors()
|
|
|
- })
|
|
|
+const manageOrderDialog = ref(false)
|
|
|
+const recommendDoctors = ref([])
|
|
|
+const manageRecommendOrder = () => {
|
|
|
+ getAllRecommendDoctors().then((res) => {
|
|
|
+ recommendDoctors.value = res
|
|
|
+ manageOrderDialog.value = true
|
|
|
+ })
|
|
|
+}
|
|
|
+const modifyOrder = (val) => {
|
|
|
+ ElMessageBox.prompt('请输入新序号', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ inputPattern: /^[1-9]\d*$/,
|
|
|
+ inputErrorMessage: '请输入大于0的整数',
|
|
|
+ })
|
|
|
+ .then(({ value }) => {
|
|
|
+ updateWxHomepageOrder(val.code, value).then(() => {
|
|
|
+ val.wxHomepageOrder = value
|
|
|
+ ElMessage({
|
|
|
+ message: '保存排序成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000,
|
|
|
+ showClose: true,
|
|
|
})
|
|
|
- .catch(() => {})
|
|
|
- }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+}
|
|
|
|
|
|
- const fetchDoctors = () => {
|
|
|
- getAllDoctors(queryParam).then((res) => {
|
|
|
- totalSize.value = res.totalSize
|
|
|
- allDoctors.value = res.list
|
|
|
+const refreshWxDoctorCache = () => {
|
|
|
+ axios('http://192.168.200.3:8805/wxserver/homepage/refreshHomePageDoctors').then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ ElMessage({
|
|
|
+ message: '强制刷新成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000,
|
|
|
+ showClose: true,
|
|
|
})
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.data.message)
|
|
|
}
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- getAllTitles().then((res) => {
|
|
|
- allTitles.value = res
|
|
|
- })
|
|
|
- getAllMzDept().then((res) => {
|
|
|
- allMzDepts.value = res
|
|
|
+const beforeDelete = (row) => {
|
|
|
+ ElMessageBox.confirm('删除后将无法在服务号首页推荐,是否确认删除?', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ confirmButtonText: '删除',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ deleteDoctor(row.code).then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: res,
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000,
|
|
|
+ showClose: true,
|
|
|
+ })
|
|
|
fetchDoctors()
|
|
|
})
|
|
|
})
|
|
|
+ .catch(() => {})
|
|
|
+}
|
|
|
|
|
|
- return {
|
|
|
- header,
|
|
|
- allTitles,
|
|
|
- handleSelectRec,
|
|
|
- allMzDepts,
|
|
|
- allDoctors,
|
|
|
- tableHeight,
|
|
|
- viewDoctor,
|
|
|
- editDoctor,
|
|
|
- yesOrNo,
|
|
|
- resetSearch,
|
|
|
- handleSizeChange,
|
|
|
- handleCurrentChange,
|
|
|
- edit,
|
|
|
- doctor,
|
|
|
- editStyle,
|
|
|
- drawer,
|
|
|
- beforeAvatarUpload,
|
|
|
- saveDoctor,
|
|
|
- sexCodes,
|
|
|
- avatarError,
|
|
|
- upload,
|
|
|
- fileList,
|
|
|
- submitUpload,
|
|
|
- fileSizeOutLimit,
|
|
|
- uploadSuccess,
|
|
|
- uploadError,
|
|
|
- manageOrderDialog,
|
|
|
- recommendDoctors,
|
|
|
- manageRecommendOrder,
|
|
|
- modifyOrder,
|
|
|
- refreshWxDoctorCache,
|
|
|
- totalSize,
|
|
|
- queryParam,
|
|
|
- fetchDoctors,
|
|
|
- beforeDelete,
|
|
|
- }
|
|
|
- },
|
|
|
+const fetchDoctors = () => {
|
|
|
+ getAllDoctors(queryParam).then((res) => {
|
|
|
+ totalSize.value = res.totalSize
|
|
|
+ allDoctors.value = res.list
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getAllTitles().then((res) => {
|
|
|
+ allTitles.value = res
|
|
|
+ })
|
|
|
+ getAllMzDept().then((res) => {
|
|
|
+ allMzDepts.value = res
|
|
|
+ fetchDoctors()
|
|
|
+ })
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|