提交 a6fdd0bb 编写于 作者: zhongyao.qiao's avatar zhongyao.qiao

Merge branch 'feature/qiao' into 'release'

Feature/qiao

See merge request !281
......@@ -17,4 +17,4 @@ VUE_APP_IS_LOCAL=true
VUE_APP_APPID=wxf4e66242d31c81c2
#本地token
VUE_APP_TOKEN=D321743AA7464709A42053132F5D2F8D
VUE_APP_TOKEN=B638EE700AD348B8B432E7DF53A48E87
......@@ -2,7 +2,7 @@ module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
sourceType: 'module',
},
env: {
browser: true,
......@@ -12,76 +12,98 @@ module.exports = {
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// 全局变量
globals: {
'gdp': true,
gdp: true,
},
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
'no-console': 0,
'no-debugger': 0,
'comma-spacing': [2, { // 控制逗号前面没有空格,后面必须有空格
'before': false,
'after': true
}],
'arrow-spacing': [2, { // 要求箭头函数前后有空格
'before': true,
'after': true
}],
'no-multi-spaces': 2,// 禁止使用多个空格,
'no-spaced-func': 2,// 禁止 function 标识符和括号之间出现空格,this.getList () 报错
'semi-spacing': [2, {// 强制分号之前不允许有空格
'before': false,
'after': true
}],
'space-infix-ops': 2,// 要求操作符前后必须有空格: 2 + 3 2 === 2 3 > 2
'comma-spacing': [
2,
{
// 控制逗号前面没有空格,后面必须有空格
before: false,
after: true,
},
],
'arrow-spacing': [
2,
{
// 要求箭头函数前后有空格
before: true,
after: true,
},
],
'no-multi-spaces': 2, // 禁止使用多个空格,
'no-spaced-func': 2, // 禁止 function 标识符和括号之间出现空格,this.getList () 报错
'semi-spacing': [
2,
{
// 强制分号之前不允许有空格
before: false,
after: true,
},
],
'space-infix-ops': 2, // 要求操作符前后必须有空格: 2 + 3 2 === 2 3 > 2
'spaced-comment': [2, 'always'], // 强制在注释中 // 或 /* 使用一致的空格
'array-bracket-spacing': [2, 'never'],// 指定数组的元素之间要以空格隔开(, 后面), never参数:[ 之后和 ] 之前不能带空格,always参数:[ 之后和 ] 之前必须带空格
"space-before-blocks": 2, // if/function等的大括号之前需要有空格
"vue/script-indent": 'off',
'array-bracket-spacing': [2, 'never'], // 指定数组的元素之间要以空格隔开(, 后面), never参数:[ 之后和 ] 之前不能带空格,always参数:[ 之后和 ] 之前必须带空格
'space-before-blocks': 2, // if/function等的大括号之前需要有空格
'vue/script-indent': 'off',
'no-undef-init': 2,// 禁止将变量初始化为 undefined,保存时会将let a = undefined变成let a
'semi': [2, 'always'],//强制结尾必须有分号;
'prefer-const': 2,// 要求使用 const 声明那些声明后不再被修改的变量
'quotes': [2, 'single'],//js中强制使用单引号
'no-multiple-empty-lines': [2, {// 不允许多个空行,最多一行
'max': 1
}],
'vue/order-in-components': ['error', {
'order': [
'el',
'name',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
'inheritAttrs',
'model',
['props', 'propsData'],
'data',
'computed',
'watch',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError'
]
}],
'vue/attributes-order': ['error', {
'order': [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT'
]
}],
}
}
'no-undef-init': 2, // 禁止将变量初始化为 undefined,保存时会将let a = undefined变成let a
semi: [2, 'always'], //强制结尾必须有分号;
'prefer-const': 2, // 要求使用 const 声明那些声明后不再被修改的变量
quotes: [2, 'single'], //js中强制使用单引号
'no-multiple-empty-lines': [
2,
{
// 不允许多个空行,最多一行
max: 1,
},
],
'vue/order-in-components': [
'error',
{
order: [
'el',
'name',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
'inheritAttrs',
'model',
['props', 'propsData'],
'data',
'computed',
'watch',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError',
],
},
],
'vue/attributes-order': [
'error',
{
order: [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT',
],
},
],
},
};
......@@ -401,6 +401,15 @@
<el-option v-for="item of sexList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> -->
</el-form-item>
<el-form-item label="助诊医生地区">
<el-input
:value="`${formData.userProvince || ''}${formData.userCity || ''}${
formData.userCounty || ''
}${formData.userTown || ''}`"
class="set-width"
disabled
/>
</el-form-item>
<el-form-item label="助诊医生所在机构">
<el-input
v-model="formData.userHospital"
......@@ -484,6 +493,15 @@
<el-option v-for="item of sexList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> -->
</el-form-item>
<el-form-item label="接诊医生地区">
<el-input
:value="`${formData.doctorProvince || ''}${
formData.doctorCity || ''
}${formData.doctorCounty || ''}${formData.doctorTown || ''}`"
class="set-width"
disabled
/>
</el-form-item>
<el-form-item label="接诊医生所在机构">
<el-input
v-model="formData.doctorHospital"
......@@ -963,254 +981,254 @@
</div>
</template>
<script>
import {
diagnoseUpdate,
getAdminDiagnose,
getDiagnoseLog,
getDoctorList,
import {
diagnoseUpdate,
getAdminDiagnose,
getDiagnoseLog,
getDoctorList,
} from '@/api/diagnosis';
import uploadImg from '@/components/editor/upload-img';
import uploadMusic from '@/components/editor/upload-music';
import {
CAR_LIST,
D_S_LIST,
FOLLW_LIST,
PAY_LIST,
RELATION_LIST,
SEX_LIST,
SOURCE_LIST,
STATUS_LIST,
TYPE_LIST,
CAR_LIST,
D_S_LIST,
FOLLW_LIST,
PAY_LIST,
RELATION_LIST,
SEX_LIST,
SOURCE_LIST,
STATUS_LIST,
TYPE_LIST,
} from '@/utils/constants';
import { getBirth } from '@/utils/index';
const PAY_TYPE = {
1: '自动付款',
2: '手动付款',
};
export default {
components: {
uploadImg,
uploadMusic,
},
data() {
return {
asd: 123,
diagnoseLogId: '',
birthDisable: false,
noable: false,
editorType: 1, // //1为编辑状态,2为查看
loading: true,
btnDisable: false,
oldDiagnoseAdvice: '', // 旧的诊断建议
formData: {
// 预约单信息
diagnoseType: '',
appointSource: '',
createdTime: '',
operateTime: '',
doneTime: '',
payType: '',
crrsName: '',
// 预约信息
status: 1,
operateUserName: '',
appointBeginTime: '',
appointEndTime: '',
triageOperatorName: '', // 分诊人员姓名
receptionOperatorName: '', // 接诊人员姓名
assistantBeginTime: '', // 助诊意向开始时间
assistantEndTime: '', // 助诊意向结束时间
assistantRemark: '', // 助诊备注
triageDepartmentId: '', // 分诊科室id,
triageDepartment: '', // 分诊科室名
triageRemark: '', // 分诊备注
receptionBeginTime: '', // 接诊意向开始时间
receptionEndTime: '', // 接诊意向结束时间
// 患者信息
patientName: '',
idCardType: 1,
idCard: '',
birthdayStr: '',
birthday: '',
sex: 1,
patientMobilePhone: '',
// 助诊信息
userName: '',
userTitle: '',
userHospital: '',
userDepartment: '',
userMobile: '',
patientRelation: '',
// crrsName: '', // 招募人
// 医生信息
doctorName: '',
doctorTitle: '',
doctorHospital: '',
doctorDepartment: '',
doctorMobile: '',
doctorSource: '',
serviceFee: '',
outsideDoctor: '', // 站外医生姓名
// 问诊信息
diagnoseStage: '',
determineFlag: '',
diagnoseDisease: '',
illnessDetail: '',
illnessImageUrls: [],
diagnoseAdvice: '',
illnessAudioUrls: [],
followFlag: 1,
drugFollow: '',
drugFollowStatus: '',
checkFollow: '',
checkFollowStatus: '',
otherFollowStatus: '',
otherFollow: '',
remark: '',
maritalStatus: 2,
createType: 1, // //创建方式1.系统创建 2.手动创建
// 备注信息
patInFlag: '', // 患者是否在场 1是 2否
valueFlag: '', // 是否有价值 1是 2否
worthlessReason: '', // 无价值原因
otherRemark: '', // 其他备注
// 结算信息
receptionServiceFee: 0, // 接诊医生服务费单位分
receptionServiceFeeStr: '', // 接诊医生服务费展示字段
receptionPayType: '', // 接诊医生付款方式1自动打款2手动打款
receptionSettleTime: '', // 接诊医生结算时间
assistantServiceFee: 0, // 助诊医生服务费单位分
assistantServiceFeeStr: '', // 助诊医生服务费展示字段
assistantPayType: '', // 助诊医生付款方式1自动打款2手动打款
assistantSettleTime: '', // 助诊医生结算时间
// 录像信息
vodList: {
name: '',
url: '',
},
const PAY_TYPE = {
1: '自动付款',
2: '手动付款',
};
export default {
components: {
uploadImg,
uploadMusic,
},
data() {
return {
asd: 123,
diagnoseLogId: '',
birthDisable: false,
noable: false,
editorType: 1, // //1为编辑状态,2为查看
loading: true,
btnDisable: false,
oldDiagnoseAdvice: '', // 旧的诊断建议
formData: {
// 预约单信息
diagnoseType: '',
appointSource: '',
createdTime: '',
operateTime: '',
doneTime: '',
payType: '',
crrsName: '',
// 预约信息
status: 1,
operateUserName: '',
appointBeginTime: '',
appointEndTime: '',
triageOperatorName: '', // 分诊人员姓名
receptionOperatorName: '', // 接诊人员姓名
assistantBeginTime: '', // 助诊意向开始时间
assistantEndTime: '', // 助诊意向结束时间
assistantRemark: '', // 助诊备注
triageDepartmentId: '', // 分诊科室id,
triageDepartment: '', // 分诊科室名
triageRemark: '', // 分诊备注
receptionBeginTime: '', // 接诊意向开始时间
receptionEndTime: '', // 接诊意向结束时间
// 患者信息
patientName: '',
idCardType: 1,
idCard: '',
birthdayStr: '',
birthday: '',
sex: 1,
patientMobilePhone: '',
// 助诊信息
userName: '',
userTitle: '',
userHospital: '',
userDepartment: '',
userMobile: '',
patientRelation: '',
// crrsName: '', // 招募人
// 医生信息
doctorName: '',
doctorTitle: '',
doctorHospital: '',
doctorDepartment: '',
doctorMobile: '',
doctorSource: '',
serviceFee: '',
outsideDoctor: '', // 站外医生姓名
// 问诊信息
diagnoseStage: '',
determineFlag: '',
diagnoseDisease: '',
illnessDetail: '',
illnessImageUrls: [],
diagnoseAdvice: '',
illnessAudioUrls: [],
followFlag: 1,
drugFollow: '',
drugFollowStatus: '',
checkFollow: '',
checkFollowStatus: '',
otherFollowStatus: '',
otherFollow: '',
remark: '',
maritalStatus: 2,
createType: 1, // //创建方式1.系统创建 2.手动创建
// 备注信息
patInFlag: '', // 患者是否在场 1是 2否
valueFlag: '', // 是否有价值 1是 2否
worthlessReason: '', // 无价值原因
otherRemark: '', // 其他备注
// 结算信息
receptionServiceFee: 0, // 接诊医生服务费单位分
receptionServiceFeeStr: '', // 接诊医生服务费展示字段
receptionPayType: '', // 接诊医生付款方式1自动打款2手动打款
receptionSettleTime: '', // 接诊医生结算时间
assistantServiceFee: 0, // 助诊医生服务费单位分
assistantServiceFeeStr: '', // 助诊医生服务费展示字段
assistantPayType: '', // 助诊医生付款方式1自动打款2手动打款
assistantSettleTime: '', // 助诊医生结算时间
// 录像信息
vodList: {
name: '',
url: '',
},
tyleList: TYPE_LIST,
payList: PAY_LIST,
sourceList: SOURCE_LIST,
statusList: STATUS_LIST,
carList: CAR_LIST,
sexList: SEX_LIST,
relationList: RELATION_LIST,
doctorSourceList: D_S_LIST,
followList: FOLLW_LIST,
doctorList: [],
rules: {
appointBeginTime: [
{ required: true, message: '请输入预约时间', trigger: 'change' },
],
patientName: [
{
required: true,
message: '请输入患姓名',
trigger: ['blur', 'change'],
},
{
min: 2,
max: 20,
message: '长度在 2 到 20 个字符',
trigger: ['blur', 'change'],
},
],
idCardType: [
{ required: true, message: '请选择证件类型', trigger: 'change' },
],
idCard: [
{ min: 18, message: '长度18个字符', trigger: 'blur' },
{ pattern: /[0-9A-Za-z]{6,24}$/, message: '只能是数字或字母' },
],
birth: [{ required: true, message: '请选择生日', trigger: 'change' }],
sex: [{ required: true, message: '请选择性别', trigger: 'change' }],
maritalStatus: [
{ required: true, message: '请选择婚否', trigger: 'change' },
],
patientMobilePhone: [
{
required: true,
message: '请输入患者电话',
trigger: ['blur', 'change'],
},
],
doctorName: [
{ required: true, message: '请选择接诊医生', trigger: 'change' },
],
serviceFee: [
{ required: false, message: '请输入医生服务费', trigger: 'change' },
{
pattern:
/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
message: '请输入正确额格式,可保留两位小数',
},
],
diagnoseStage: [
{ required: true, message: '请选择初/复诊', trigger: 'change' },
],
determineFlag: [
{ required: true, message: '是否确诊', trigger: 'change' },
],
illnessDetail: [
{ required: true, message: '请输入病情描述', trigger: 'change' },
],
diagnoseAdvice: [
{ required: true, message: '请输入诊断建议', trigger: 'change' },
],
worthlessReason: [
{
required: true,
min: 2,
max: 1000,
message: '必填项,支持2-1000个字符',
trigger: 'change',
},
],
otherRemark: [
{
required: true,
min: 2,
max: 1000,
message: '必填项,支持2-1000个字符',
trigger: 'change',
},
],
patInFlag: [
{
required: true,
message: '必填项',
},
],
valueFlag: [
{
required: true,
message: '必填项',
},
],
},
endDateOpt: {
disabledData: (time) => {
if (
this.formData.appointEndTime != '' &&
this.formData.appointEndTime != null
) {
return (
time.getTime() > new Date(this.formData.appointEndTime).getTime()
);
}
},
tyleList: TYPE_LIST,
payList: PAY_LIST,
sourceList: SOURCE_LIST,
statusList: STATUS_LIST,
carList: CAR_LIST,
sexList: SEX_LIST,
relationList: RELATION_LIST,
doctorSourceList: D_S_LIST,
followList: FOLLW_LIST,
doctorList: [],
rules: {
appointBeginTime: [
{ required: true, message: '请输入预约时间', trigger: 'change' },
],
patientName: [
{
required: true,
message: '请输入患姓名',
trigger: ['blur', 'change'],
},
},
endDateOpt1: {
disabledDate: (time) => {
{
min: 2,
max: 20,
message: '长度在 2 到 20 个字符',
trigger: ['blur', 'change'],
},
],
idCardType: [
{ required: true, message: '请选择证件类型', trigger: 'change' },
],
idCard: [
{ min: 18, message: '长度18个字符', trigger: 'blur' },
{ pattern: /[0-9A-Za-z]{6,24}$/, message: '只能是数字或字母' },
],
birth: [{ required: true, message: '请选择生日', trigger: 'change' }],
sex: [{ required: true, message: '请选择性别', trigger: 'change' }],
maritalStatus: [
{ required: true, message: '请选择婚否', trigger: 'change' },
],
patientMobilePhone: [
{
required: true,
message: '请输入患者电话',
trigger: ['blur', 'change'],
},
],
doctorName: [
{ required: true, message: '请选择接诊医生', trigger: 'change' },
],
serviceFee: [
{ required: false, message: '请输入医生服务费', trigger: 'change' },
{
pattern:
/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
message: '请输入正确额格式,可保留两位小数',
},
],
diagnoseStage: [
{ required: true, message: '请选择初/复诊', trigger: 'change' },
],
determineFlag: [
{ required: true, message: '是否确诊', trigger: 'change' },
],
illnessDetail: [
{ required: true, message: '请输入病情描述', trigger: 'change' },
],
diagnoseAdvice: [
{ required: true, message: '请输入诊断建议', trigger: 'change' },
],
worthlessReason: [
{
required: true,
min: 2,
max: 1000,
message: '必填项,支持2-1000个字符',
trigger: 'change',
},
],
otherRemark: [
{
required: true,
min: 2,
max: 1000,
message: '必填项,支持2-1000个字符',
trigger: 'change',
},
],
patInFlag: [
{
required: true,
message: '必填项',
},
],
valueFlag: [
{
required: true,
message: '必填项',
},
],
},
endDateOpt: {
disabledData: (time) => {
if (
this.formData.appointEndTime != '' &&
this.formData.appointEndTime != null
) {
return (
time.getTime() < new Date(this.formData.appointBeginTime).getTime()
time.getTime() > new Date(this.formData.appointEndTime).getTime()
);
},
}
},
},
endDateOpt1: {
disabledDate: (time) => {
return (
time.getTime() < new Date(this.formData.appointBeginTime).getTime()
);
},
// 操作日志数据
/* 元素结构
},
// 操作日志数据
/* 元素结构
{
operateTime: '2016-05-02',
operateUserName: '赵丽颖',
......@@ -1218,233 +1236,233 @@ import { getBirth } from '@/utils/index';
from: '助诊医生时间不匹配'
}
*/
logData: [],
logData: [],
// 分页功能与产品沟通不做
// logCurrentPage: 1,
// logTotalCount: 0
};
};
},
computed: {
getReceptionPayType() {
return PAY_TYPE[this.formData.receptionPayType];
},
computed: {
getReceptionPayType() {
return PAY_TYPE[this.formData.receptionPayType];
},
getAssistantPayType() {
return PAY_TYPE[this.formData.assistantPayType];
},
illnessImageUrls() {
const m = this.formData.illnessImageUrls.filter((i) => {
console.log('---', i);
});
return m;
},
getAssistantPayType() {
return PAY_TYPE[this.formData.assistantPayType];
},
created() {
this.editorType = this.$route.query.editorType;
this.diagnoseLogId = this.$route.query.id;
this.search();
illnessImageUrls() {
const m = this.formData.illnessImageUrls.filter((i) => {
console.log('---', i);
});
return m;
},
mounted() {},
methods: {
search() {
this.loading = true;
getAdminDiagnose({
id: this.diagnoseLogId,
})
.then((res) => {
this.loading = false;
if (res.code == '000000') {
this.formData = res.data;
this.formData.price = this.priceFilter(this.formData.price);
this.formData.serviceFee = this.priceFilter(
this.formData.serviceFee
);
if (!this.formData.illnessImageUrls) {
this.formData.illnessImageUrls = [];
} else {
this.formData.illnessImageUrls = this.setObjectArr(
this.formData.illnessImageUrls
);
}
console.log(
'this.formData.illnessImageUrls',
},
created() {
this.editorType = this.$route.query.editorType;
this.diagnoseLogId = this.$route.query.id;
this.search();
},
mounted() {},
methods: {
search() {
this.loading = true;
getAdminDiagnose({
id: this.diagnoseLogId,
})
.then((res) => {
this.loading = false;
if (res.code == '000000') {
this.formData = res.data;
this.formData.price = this.priceFilter(this.formData.price);
this.formData.serviceFee = this.priceFilter(
this.formData.serviceFee
);
if (!this.formData.illnessImageUrls) {
this.formData.illnessImageUrls = [];
} else {
this.formData.illnessImageUrls = this.setObjectArr(
this.formData.illnessImageUrls
);
if (!this.formData.illnessAudioUrls) {
this.formData.illnessAudioUrls = [];
} else {
this.formData.illnessAudioUrls = this.setObjectArr(
this.formData.illnessAudioUrls
);
}
if (this.formData.diagnoseAdvice) {
this.oldDiagnoseAdvice = this.formData.diagnoseAdvice;
this.formData.diagnoseAdvice = '';
}
if (!this.formData.sex) {
this.formData.sex = 1;
}
if (!this.formData.maritalStatus) {
this.formData.maritalStatus = 1;
}
}
console.log(
'this.formData.illnessImageUrls',
this.formData.illnessImageUrls
);
if (!this.formData.illnessAudioUrls) {
this.formData.illnessAudioUrls = [];
} else {
this.$message.info('请稍后重试');
this.formData.illnessAudioUrls = this.setObjectArr(
this.formData.illnessAudioUrls
);
}
this.getDoctorList();
this.queryOperationLogs();
})
.catch(() => {
if (this.formData.diagnoseAdvice) {
this.oldDiagnoseAdvice = this.formData.diagnoseAdvice;
this.formData.diagnoseAdvice = '';
}
if (!this.formData.sex) {
this.formData.sex = 1;
}
if (!this.formData.maritalStatus) {
this.formData.maritalStatus = 1;
}
} else {
this.$message.info('请稍后重试');
});
},
getDoctorList() {
this.loading = true;
getDoctorList({
diagnoseType: this.formData.diagnoseType,
}
this.getDoctorList();
this.queryOperationLogs();
})
.then((res) => {
this.loading = false;
if (res.code == '000000') {
this.doctorList = res.data;
} else {
this.$message.info('请稍后重试');
}
})
.catch(() => {
this.loading = false;
.catch(() => {
this.$message.info('请稍后重试');
});
},
getDoctorList() {
this.loading = true;
getDoctorList({
diagnoseType: this.formData.diagnoseType,
})
.then((res) => {
this.loading = false;
if (res.code == '000000') {
this.doctorList = res.data;
} else {
this.$message.info('请稍后重试');
});
},
queryOperationLogs() {
getDiagnoseLog({
id: this.diagnoseLogId,
}
})
.catch(() => {
this.loading = false;
this.$message.info('请稍后重试');
});
},
queryOperationLogs() {
getDiagnoseLog({
id: this.diagnoseLogId,
})
.then((res) => {
if (res.code == '000000') {
this.logData = res.data;
}
// 非交互性功能接口不提示
})
.catch(() => {
this.loading = false;
});
},
// 预约开始时间选择时
continueBeginChange(val) {
if (this.formData.appointEndTime) {
if (
new Date(val).getTime() >
new Date(this.formData.appointEndTime).getTime()
) {
this.$message.info('开始时间要小于结束时间');
this.formData.appointBeginTime = '';
return;
}
}
},
// 预约结束时间选择时
continueEndChange(val) {
if (this.formData.appointBeginTime) {
if (
new Date(val).getTime() <=
new Date(this.formData.appointBeginTime).getTime()
) {
this.$message.info('结束时间要大于开始时间');
this.formData.appointEndTime = '';
return;
}
}
},
blurFn() {
if (
this.formData.idCardType == 1 &&
this.formData.idCard &&
this.formData.idCard.length == 18
) {
this.formData.birthdayStr = getBirth(this.formData.idCard);
this.birthDisable = true;
} else {
this.formData.birthdayStr = '';
this.birthDisable = false;
}
},
cancle() {
this.$router.back();
},
priceFilter(value) {
if (!value) return 0;
if (value) {
return value / 100;
}
},
setPrice(value) {
if (!value) return 0;
if (value) {
return value * 100;
}
},
doctorChanged(value) {
const selected = this.doctorList.find((item) => item.doctorId === value);
if (selected) {
this.formData.doctorId = value;
this.formData.doctorName = selected.doctorName;
this.formData.doctorTitle = selected.doctorTitle;
this.formData.doctorHospital = selected.doctorHospital;
this.formData.doctorDepartment = selected.doctorDepartment;
this.formData.doctorMobile = selected.doctorMobile;
this.formData.serviceFee = this.priceFilter(selected.serviceFee);
}
},
save() {
this.$refs.form.validate(() => {
this.formData.birthday = new Date(this.formData.birthdayStr);
// this.formData.birthday = this.formData.birthdayStr;
const params = JSON.parse(JSON.stringify(this.formData));
params.illnessImageUrls = this.$refs.imgComponent
? [...this.$refs.imgComponent.setNewArr()]
: [];
params.illnessAudioUrls = this.$refs.musicComponent
? [...this.$refs.musicComponent.setNewArr()]
: [];
params.price = this.setPrice(params.price);
params.serviceFee = this.setPrice(params.serviceFee);
if (!params.diagnoseAdvice) {
params.diagnoseAdvice = this.oldDiagnoseAdvice;
}
this.loading = true;
this.btnDisable = true;
diagnoseUpdate(params)
.then((res) => {
this.loading = false;
this.btnDisable = false;
if (res.code == '000000') {
this.logData = res.data;
this.$message.success('保存成功');
this.$router.back();
} else {
this.$message({
message: res.message,
type: 'error',
});
}
// 非交互性功能接口不提示
})
.catch(() => {
this.btnDisable = false;
this.loading = false;
});
},
// 预约开始时间选择时
continueBeginChange(val) {
if (this.formData.appointEndTime) {
if (
new Date(val).getTime() >
new Date(this.formData.appointEndTime).getTime()
) {
this.$message.info('开始时间要小于结束时间');
this.formData.appointBeginTime = '';
return;
}
}
},
// 预约结束时间选择时
continueEndChange(val) {
if (this.formData.appointBeginTime) {
if (
new Date(val).getTime() <=
new Date(this.formData.appointBeginTime).getTime()
) {
this.$message.info('结束时间要大于开始时间');
this.formData.appointEndTime = '';
return;
}
}
},
blurFn() {
if (
this.formData.idCardType == 1 &&
this.formData.idCard &&
this.formData.idCard.length == 18
) {
this.formData.birthdayStr = getBirth(this.formData.idCard);
this.birthDisable = true;
} else {
this.formData.birthdayStr = '';
this.birthDisable = false;
}
},
cancle() {
this.$router.back();
},
priceFilter(value) {
if (!value) return 0;
if (value) {
return value / 100;
}
},
setPrice(value) {
if (!value) return 0;
if (value) {
return value * 100;
}
},
doctorChanged(value) {
const selected = this.doctorList.find((item) => item.doctorId === value);
if (selected) {
this.formData.doctorId = value;
this.formData.doctorName = selected.doctorName;
this.formData.doctorTitle = selected.doctorTitle;
this.formData.doctorHospital = selected.doctorHospital;
this.formData.doctorDepartment = selected.doctorDepartment;
this.formData.doctorMobile = selected.doctorMobile;
this.formData.serviceFee = this.priceFilter(selected.serviceFee);
}
},
save() {
this.$refs.form.validate(() => {
this.formData.birthday = new Date(this.formData.birthdayStr);
// this.formData.birthday = this.formData.birthdayStr;
const params = JSON.parse(JSON.stringify(this.formData));
params.illnessImageUrls = this.$refs.imgComponent
? [...this.$refs.imgComponent.setNewArr()]
: [];
params.illnessAudioUrls = this.$refs.musicComponent
? [...this.$refs.musicComponent.setNewArr()]
: [];
params.price = this.setPrice(params.price);
params.serviceFee = this.setPrice(params.serviceFee);
if (!params.diagnoseAdvice) {
params.diagnoseAdvice = this.oldDiagnoseAdvice;
}
this.loading = true;
this.btnDisable = true;
diagnoseUpdate(params)
.then((res) => {
this.loading = false;
this.btnDisable = false;
if (res.code == '000000') {
this.$message.success('保存成功');
this.$router.back();
} else {
this.$message({
message: res.message,
type: 'error',
});
}
})
.catch(() => {
this.btnDisable = false;
this.loading = false;
});
});
},
// 格式话音频/视频数组
setObjectArr(array) {
const newArr = [];
array.forEach((element) => {
newArr.push({ from: 'all', url: element });
});
return newArr;
},
openPdf(item) {
window.open(item.url);
},
});
},
// 格式话音频/视频数组
setObjectArr(array) {
const newArr = [];
array.forEach((element) => {
newArr.push({ from: 'all', url: element });
});
return newArr;
},
openPdf(item) {
window.open(item.url);
},
};
},
};
</script>
<style lang="scss" scoped>
.diagnosis-list-content {
......
......@@ -146,137 +146,137 @@
</div>
</template>
<script>
import dayjs from 'dayjs';
import FullCalendar from '@fullcalendar/vue';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import {
dutyRosterQuery,
saveDutyRoster,
getLevel,
getDoctorInfo,
saveLevelAndDayCount,
getLevelAndDayCount,
} from '@/api/serviceSchedule';
export default {
name: 'Scheduing',
components: {
FullCalendar,
},
data() {
return {
maxPreNum: '',
chooseList: true,
id: '',
doctorId: '',
schedulingTypeValue: {},
schedulingType: 1, // 1 新增 2 编辑 3 查看
createList: [],
listDate: [],
week: 1, // 1:当前周 2:上一周 3:下一周
currentIndex: 3,
haveWeek: [1],
businessHours: true,
calendarOptions: {
// 引入的插件,比如fullcalendar/daygrid,fullcalendar/timegrid引入后才可显示月,周,日
plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
initialView: 'timeGridWeek', // 默认为那个视图(月:dayGridMonth,周:timeGridWeek,日:timeGridDay)
selectable: true,
selectMirror: true,
selectAllow: this.selectAllow,
selectOverlap: false,
select: this.selectInfo,
selectMinDistance: 0,
eventOverlap: false,
navLinks: true,
navLinkDayClick: this.navLinkDayClick,
// eventDurationEditable:false,
eventDrop: this.eventDrop,
editable: true,
overlap: false,
defaultDate: new Date(),
datesSet: this.handleDatesSet,
events: [],
slotEventOverlap: true,
header: {
center: 'month,agendaFourDay', // buttons for switching between views
},
firstDay: 1, // 设置一周中显示的第一天是哪天,周日是0,周一是1,类推
locale: 'zh-cn', // 切换语言,当前为中文
eventColor: '#fff', // 全部日历日程背景色3BB2E3
eventBackgroundColor: '#E7F4F5',
// themeSystem: 'bootstrap', // 主题色(本地测试未能生效)
// initialDate: moment().format('YYYY-MM-DD'), // 自定义设置背景颜色时一定要初始化日期时间
timeGridEventMinHeight: '40', // 设置事件的最小高度
aspectRatio: 1.35, // 设置日历单元格宽度与高度的比例。
// displayEventTime: false, // 是否显示时间
allDaySlot: false, // 周,日视图时,all-day 不显示
eventLimit: true, // 设置月日程,与all-day slot的最大显示数量,超过的通过弹窗显示
customButtons: {
myCustomButton: {
text: '本周',
},
},
headerToolbar: {
// 日历头部按钮位置
left: '',
center: 'prev myCustomButton next',
right: '',
import FullCalendar from '@fullcalendar/vue';
import dayGridPlugin from '@fullcalendar/daygrid';
import interactionPlugin from '@fullcalendar/interaction';
import timeGridPlugin from '@fullcalendar/timegrid';
import {
dutyRosterQuery,
getDoctorInfo,
getLevel,
getLevelAndDayCount,
saveDutyRoster,
saveLevelAndDayCount,
} from '@/api/serviceSchedule';
import dayjs from 'dayjs';
export default {
name: 'Scheduing',
components: {
FullCalendar,
},
data() {
return {
maxPreNum: '',
chooseList: true,
id: '',
doctorId: '',
schedulingTypeValue: {},
schedulingType: 1, // 1 新增 2 编辑 3 查看
createList: [],
listDate: [],
week: 1, // 1:当前周 2:上一周 3:下一周
currentIndex: 3,
haveWeek: [1],
businessHours: true,
calendarOptions: {
// 引入的插件,比如fullcalendar/daygrid,fullcalendar/timegrid引入后才可显示月,周,日
plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
initialView: 'timeGridWeek', // 默认为那个视图(月:dayGridMonth,周:timeGridWeek,日:timeGridDay)
selectable: true,
selectMirror: true,
selectAllow: this.selectAllow,
selectOverlap: false,
select: this.selectInfo,
selectMinDistance: 0,
eventOverlap: false,
navLinks: true,
navLinkDayClick: this.navLinkDayClick,
// eventDurationEditable:false,
eventDrop: this.eventDrop,
editable: true,
overlap: false,
defaultDate: new Date(),
datesSet: this.handleDatesSet,
events: [],
slotEventOverlap: true,
header: {
center: 'month,agendaFourDay', // buttons for switching between views
},
firstDay: 1, // 设置一周中显示的第一天是哪天,周日是0,周一是1,类推
locale: 'zh-cn', // 切换语言,当前为中文
eventColor: '#fff', // 全部日历日程背景色3BB2E3
eventBackgroundColor: '#E7F4F5',
// themeSystem: 'bootstrap', // 主题色(本地测试未能生效)
// initialDate: moment().format('YYYY-MM-DD'), // 自定义设置背景颜色时一定要初始化日期时间
timeGridEventMinHeight: '40', // 设置事件的最小高度
aspectRatio: 1.35, // 设置日历单元格宽度与高度的比例。
// displayEventTime: false, // 是否显示时间
allDaySlot: false, // 周,日视图时,all-day 不显示
eventLimit: true, // 设置月日程,与all-day slot的最大显示数量,超过的通过弹窗显示
customButtons: {
myCustomButton: {
text: '本周',
},
expandRows: true,
slotMinWidth: 50,
slotDuration: '01:00:00',
slotMinTime: '09:00',
slotMaxTime: '21:00',
slotLabelInterval: '',
scrollTime: false,
slotLabelFormat: {
hour: 'numeric',
minute: '2-digit',
meridiem: 'short',
hour12: false, // 设置时间为24小时
},
headerToolbar: {
// 日历头部按钮位置
left: '',
center: 'prev myCustomButton next',
right: '',
},
expandRows: true,
slotMinWidth: 50,
slotDuration: '01:00:00',
slotMinTime: '01:00',
slotMaxTime: '23:00',
slotLabelInterval: '',
scrollTime: false,
slotLabelFormat: {
hour: 'numeric',
minute: '2-digit',
meridiem: 'short',
hour12: false, // 设置时间为24小时
},
eventLimitNum: {
// 事件显示数量限制(本地测试未能生效)
dayGrid: {
eventLimit: 5,
},
eventLimitNum: {
// 事件显示数量限制(本地测试未能生效)
dayGrid: {
eventLimit: 5,
},
timeGrid: {
eventLimit: 4, // adjust to 6 only for timeGridWeek/timeGridDay
},
timeGrid: {
eventLimit: 4, // adjust to 6 only for timeGridWeek/timeGridDay
},
eventClick: this.handleEventClick,
},
workingTicketVisible: false, // 工作表票详情页面
scrollerHeight: 0,
loading: false,
isDoIt: false,
getStartWeek: '',
copyArr: [],
centerDialogVisible: false,
maxNumValue: '',
showFirNum: '',
showMaxNum: '',
};
},
computed: {},
watch: {
week(newV, oldV) {
if (this.haveWeek.indexOf(newV) == -1) {
this.haveWeek.push(newV);
this.handleInitSearch();
}
if (newV !== oldV) {
this.handleInitSearch();
this.saveDoctoreScheduling(2, oldV);
}
eventClick: this.handleEventClick,
},
workingTicketVisible: false, // 工作表票详情页面
scrollerHeight: 0,
loading: false,
isDoIt: false,
getStartWeek: '',
copyArr: [],
centerDialogVisible: false,
maxNumValue: '',
showFirNum: '',
showMaxNum: '',
};
},
computed: {},
watch: {
week(newV, oldV) {
if (this.haveWeek.indexOf(newV) == -1) {
this.haveWeek.push(newV);
this.handleInitSearch();
}
if (newV !== oldV) {
this.handleInitSearch();
this.saveDoctoreScheduling(2, oldV);
}
},
created() {
this.schedulingType = this.$route.query.type || 1;
this.id = this.$route.query.id;
(this.doctorId = this.$route.query.doctorId),
},
created() {
this.schedulingType = this.$route.query.type || 1;
this.id = this.$route.query.id;
(this.doctorId = this.$route.query.doctorId),
getDoctorInfo({ id: this.id }).then((res) => {
if (res.code == '000000') {
this.schedulingTypeValue = res.data;
......@@ -285,412 +285,409 @@
this.$toast(res.message);
}
});
getLevel().then((res) => {
if (res.code == '000000') {
this.createList = res.data;
}
});
},
mounted() {
this.scrollerHeight = this.$refs.agment.clientHeight + 'px';
this.init();
getLevel().then((res) => {
if (res.code == '000000') {
this.createList = res.data;
}
});
},
mounted() {
this.scrollerHeight = this.$refs.agment.clientHeight + 'px';
this.init();
},
methods: {
/**
* 点击日历日程事件
*
* info: 事件信息
* event是日程(事件)对象
* jsEvent是个javascript事件
* view是当前视图对象。
*/
init() {
// schedulingType 1,2 表示编辑新加,其他表示查看
if (this.schedulingType == 1 || this.schedulingType == 2) {
this.calendarOptions.editable = true;
} else {
// 查看
this.calendarOptions.slotDuration = '01:00:00';
this.calendarOptions.selectable = false;
this.calendarOptions.editable = false;
}
this.handleInitSearch();
this.getLevelAndDayCount();
},
methods: {
/**
* 点击日历日程事件
*
* info: 事件信息
* event是日程(事件)对象
* jsEvent是个javascript事件
* view是当前视图对象。
*/
init() {
// schedulingType 1,2 表示编辑新加,其他表示查看
if (this.schedulingType == 1 || this.schedulingType == 2) {
this.calendarOptions.editable = true;
} else {
// 查看
this.calendarOptions.slotDuration = '01:00:00';
this.calendarOptions.selectable = false;
this.calendarOptions.editable = false;
}
this.handleInitSearch();
this.getLevelAndDayCount();
},
getLevelAndDayCount(newV) {
const params = {
workId: newV ? newV : this.id,
};
getLevelAndDayCount(params).then((res) => {
if (res.code === '000000') {
console.log(res, 'res');
this.currentIndex = res.data.level;
this.maxNumValue = res.data.preNum;
(this.showFirNum = res.data.level),
getLevelAndDayCount(newV) {
const params = {
workId: newV ? newV : this.id,
};
getLevelAndDayCount(params).then((res) => {
if (res.code === '000000') {
console.log(res, 'res');
this.currentIndex = res.data.level;
this.maxNumValue = res.data.preNum;
(this.showFirNum = res.data.level),
(this.showMaxNum = res.data.preNum);
}
});
},
navLinkDayClick(date) {
const day = dayjs(date).day();
const dayDate = dayjs(date).date();
const dayFormat = dayjs(date).format('YYYY-MM-DD');
let selectDate = dayFormat + ' ' + '09:00:00';
selectDate = dayjs(selectDate).unix();
const nowDate = dayjs(new Date()).unix();
let isAddAllDay = true;
const haveSelectDate = this.calendarOptions.events;
const len = haveSelectDate.length;
const differenceTime = ((nowDate - selectDate) / 3600) | 0;
if (differenceTime > 0 && differenceTime >= 24) {
return this.$message.info('你不能添加过去的时间的排班');
}
for (var i = 0; i < len; i++) {
const itemDay = dayjs(haveSelectDate[i].start).day();
if (!haveSelectDate[i].constraint && day === itemDay) {
haveSelectDate[i].allStatus && (isAddAllDay = false);
const index = this.getIdDeleteData(haveSelectDate[i].id);
this.isDoIt = true;
this.calendarOptions.events.splice(index, 1);
i--;
}
}
if (isAddAllDay) {
// 添加日期
const selectAllDay = [
{ startTime: '09:00:00', endTime: '12:00:00' },
{ startTime: '13:00:00', endTime: '21:00:00' },
];
selectAllDay.forEach((item) => {
const allDayData = {};
allDayData.id =
dayDate + (this.calendarOptions.events.length + 1) * 10;
allDayData.week = this.week;
allDayData.end = dayFormat + ' ' + item.endTime;
allDayData.start = dayFormat + ' ' + item.startTime;
allDayData.allStatus = true;
console.log(allDayData);
this.calendarOptions.events.push(allDayData);
});
});
},
navLinkDayClick(date) {
const day = dayjs(date).day();
const dayDate = dayjs(date).date();
const dayFormat = dayjs(date).format('YYYY-MM-DD');
let selectDate = dayFormat + ' ' + '01:00:00';
selectDate = dayjs(selectDate).unix();
const nowDate = dayjs(new Date()).unix();
let isAddAllDay = true;
const haveSelectDate = this.calendarOptions.events;
const len = haveSelectDate.length;
const differenceTime = ((nowDate - selectDate) / 3600) | 0;
if (differenceTime > 0 && differenceTime >= 24) {
return this.$message.info('你不能添加过去的时间的排班');
}
for (var i = 0; i < len; i++) {
const itemDay = dayjs(haveSelectDate[i].start).day();
if (!haveSelectDate[i].constraint && day === itemDay) {
haveSelectDate[i].allStatus && (isAddAllDay = false);
const index = this.getIdDeleteData(haveSelectDate[i].id);
this.isDoIt = true;
this.calendarOptions.events.splice(index, 1);
i--;
}
},
getCopyData(lastWeekData) {
const copyDate = [];
const addDay = 7;
lastWeekData.noAcceptList.map((item) => {
const nowWeekTime = {};
nowWeekTime['startTime'] = dayjs(item.startTime)
.add(addDay, 'day')
.format('YYYY-MM-DD HH:mm:ss');
nowWeekTime['endTime'] = dayjs(item.endTime)
.add(addDay, 'day')
.format('YYYY-MM-DD HH:mm:ss');
copyDate.push(nowWeekTime);
}
if (isAddAllDay) {
// 添加日期
const selectAllDay = [{ startTime: '01:00:00', endTime: '23:00:00' }];
selectAllDay.forEach((item) => {
const allDayData = {};
allDayData.id =
dayDate + (this.calendarOptions.events.length + 1) * 10;
allDayData.week = this.week;
allDayData.end = dayFormat + ' ' + item.endTime;
allDayData.start = dayFormat + ' ' + item.startTime;
allDayData.allStatus = true;
console.log(allDayData);
this.calendarOptions.events.push(allDayData);
});
this.calendarOptions.events = [];
lastWeekData.noAcceptList = copyDate;
this.isDoIt = true;
},
handleInitSearch(isReset, isLoopLast) {
//
if (isReset && isLoopLast != 1) {
this.calendarOptions.events = this.calendarOptions.events.filter(
(v) => v.week !== this.week
);
}
let copyWeek = '';
if (isLoopLast == 1) {
if (this.week == 1) {
copyWeek = 2;
} else if (this.week == 3) {
copyWeek = 1;
} else if (this.week == 4) {
copyWeek = 3;
} else if (this.week == 5) {
copyWeek = 4;
}
}
},
getCopyData(lastWeekData) {
const copyDate = [];
const addDay = 7;
lastWeekData.noAcceptList.map((item) => {
const nowWeekTime = {};
nowWeekTime['startTime'] = dayjs(item.startTime)
.add(addDay, 'day')
.format('YYYY-MM-DD HH:mm:ss');
nowWeekTime['endTime'] = dayjs(item.endTime)
.add(addDay, 'day')
.format('YYYY-MM-DD HH:mm:ss');
copyDate.push(nowWeekTime);
});
this.calendarOptions.events = [];
lastWeekData.noAcceptList = copyDate;
this.isDoIt = true;
},
handleInitSearch(isReset, isLoopLast) {
//
if (isReset && isLoopLast != 1) {
this.calendarOptions.events = this.calendarOptions.events.filter(
(v) => v.week !== this.week
);
}
let copyWeek = '';
if (isLoopLast == 1) {
if (this.week == 1) {
copyWeek = 2;
} else if (this.week == 3) {
copyWeek = 1;
} else if (this.week == 4) {
copyWeek = 3;
} else if (this.week == 5) {
copyWeek = 4;
}
const searchLastWeek = {};
searchLastWeek.doctorId = this.doctorId;
searchLastWeek.week = isLoopLast == 1 ? copyWeek : this.week;
// isLoopLast == 1 表示 copy
searchLastWeek.workId = this.id;
dutyRosterQuery(searchLastWeek).then((res) => {
if (res.code == '000000') {
console.log(res.data.noAcceptList, 'res.data.noAcceptList');
if (isLoopLast == 1 && !res.data.noAcceptList.length) {
return this.$toast('没有上周的排班信息可以用');
} else {
this.calendarOptions.events = [];
}
if (isLoopLast == 1 && res.data.noAcceptList.length) {
this.getCopyData(res.data);
}
this.handleInitData(res.data);
}
const searchLastWeek = {};
searchLastWeek.doctorId = this.doctorId;
searchLastWeek.week = isLoopLast == 1 ? copyWeek : this.week;
// isLoopLast == 1 表示 copy
searchLastWeek.workId = this.id;
dutyRosterQuery(searchLastWeek).then((res) => {
if (res.code == '000000') {
console.log(res.data.noAcceptList, 'res.data.noAcceptList');
if (isLoopLast == 1 && !res.data.noAcceptList.length) {
return this.$toast('没有上周的排班信息可以用');
} else {
this.$toast(res.message);
this.calendarOptions.events = [];
}
});
},
handleInitData(weekData) {
var newDate = null;
if (this.schedulingType != 3) {
newDate = [].concat(weekData.noAcceptList);
if (isLoopLast == 1 && res.data.noAcceptList.length) {
this.getCopyData(res.data);
}
this.handleInitData(res.data);
} else {
var acceptList = [];
weekData.acceptList.forEach((item) => {
item.type = 88;
acceptList.push(item);
});
newDate = [].concat(acceptList, weekData.noAcceptList);
this.$toast(res.message);
}
newDate.forEach((item) => {
const selectDate = {};
const id = (this.calendarOptions.events.length + 1) * 10;
selectDate['week'] = this.week;
selectDate['id'] = id;
selectDate['end'] = item.endTime;
selectDate['start'] = item.startTime;
selectDate['type'] = item.type;
if (item.type == 88) {
selectDate['color'] = '#FFEDE9';
}
this.calendarOptions.events.push(selectDate);
});
},
handleInitData(weekData) {
var newDate = null;
if (this.schedulingType != 3) {
newDate = [].concat(weekData.noAcceptList);
} else {
var acceptList = [];
weekData.acceptList.forEach((item) => {
item.type = 88;
acceptList.push(item);
});
this.limmitDateFun();
},
limmitDateFun() {
for (let i = 0; i < 7; i++) {
const limitTime = {};
const day = dayjs(this.getEveryDay)
.add(i, 'day')
.format('YYYY-MM-DD HH:mm:ss');
limitTime.start = dayjs(day)
.add(12, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
limitTime.end = dayjs(day)
.add(13, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
limitTime.constraint = 'businessHours';
limitTime.color = '#ccc';
limitTime.display = 'background';
limitTime.editable = false;
this.calendarOptions.events.push(limitTime);
}
console.log('obj', this.getEveryDay);
},
handleDatesSet(dataInfo) {
this.getEveryDay = dayjs(dataInfo.start).format('YYYY-MM-DD HH:mm:ss');
const currentTime = new Date().getTime(); // 今天的时间戳
const getTime = new Date(dataInfo.start).getTime(); // 每周周一的时间戳
const cz = currentTime - getTime; // 每周周一时间戳 - 今天的时间
const oneHour = 1 * 60 * 60 * 1000 * 24; // 一天的时间戳
const timeDifference = (cz / oneHour) | 0; // 每周一时间距离今天时间数量
const weekHeadTitle = this.calendarOptions.customButtons.myCustomButton;
console.log(timeDifference, 'timeDifference', cz / oneHour);
// debugger;
const exactTime = cz / oneHour;
if (timeDifference == 0 && exactTime > 0) {
this.week = 1;
weekHeadTitle.text = '本周';
return;
newDate = [].concat(acceptList, weekData.noAcceptList);
}
newDate.forEach((item) => {
const selectDate = {};
const id = (this.calendarOptions.events.length + 1) * 10;
selectDate['week'] = this.week;
selectDate['id'] = id;
selectDate['end'] = item.endTime;
selectDate['start'] = item.startTime;
selectDate['type'] = item.type;
if (item.type == 88) {
selectDate['color'] = '#FFEDE9';
}
if (timeDifference > 0 && timeDifference <= 6) {
// 过去
this.week = 1;
weekHeadTitle.text = '本周';
} else if (timeDifference >= -6 && timeDifference <= 0) {
// 未来
this.week = 3;
weekHeadTitle.text = '下周';
} else if (timeDifference >= -13 && timeDifference <= -7) {
// 未来
this.week = 4;
weekHeadTitle.text = '第二周';
} else if (timeDifference >= -20 && timeDifference <= -14) {
// 未来
this.week = 5;
weekHeadTitle.text = '第三周';
} else if (timeDifference >= 7) {
// 现在
weekHeadTitle.text = '上周';
this.week = 2;
this.calendarOptions.events.push(selectDate);
});
// this.limmitDateFun();
},
limmitDateFun() {
for (let i = 0; i < 7; i++) {
const limitTime = {};
const day = dayjs(this.getEveryDay)
.add(i, 'day')
.format('YYYY-MM-DD HH:mm:ss');
limitTime.start = dayjs(day)
.add(12, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
limitTime.end = dayjs(day)
.add(13, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
limitTime.constraint = 'businessHours';
limitTime.color = '#ccc';
limitTime.display = 'background';
limitTime.editable = false;
this.calendarOptions.events.push(limitTime);
}
},
handleDatesSet(dataInfo) {
this.getEveryDay = dayjs(dataInfo.start).format('YYYY-MM-DD HH:mm:ss');
const currentTime = new Date().getTime(); // 今天的时间戳
const getTime = new Date(dataInfo.start).getTime(); // 每周周一的时间戳
const cz = currentTime - getTime; // 每周周一时间戳 - 今天的时间
const oneHour = 1 * 60 * 60 * 1000 * 24; // 一天的时间戳
const timeDifference = (cz / oneHour) | 0; // 每周一时间距离今天时间数量
const weekHeadTitle = this.calendarOptions.customButtons.myCustomButton;
console.log(timeDifference, 'timeDifference', cz / oneHour);
// debugger;
const exactTime = cz / oneHour;
if (timeDifference == 0 && exactTime > 0) {
this.week = 1;
weekHeadTitle.text = '本周';
return;
}
if (timeDifference > 0 && timeDifference <= 6) {
// 过去
this.week = 1;
weekHeadTitle.text = '本周';
} else if (timeDifference >= -6 && timeDifference <= 0) {
// 未来
this.week = 3;
weekHeadTitle.text = '下周';
} else if (timeDifference >= -13 && timeDifference <= -7) {
// 未来
this.week = 4;
weekHeadTitle.text = '第二周';
} else if (timeDifference >= -20 && timeDifference <= -14) {
// 未来
this.week = 5;
weekHeadTitle.text = '第三周';
} else if (timeDifference >= 7) {
// 现在
weekHeadTitle.text = '上周';
this.week = 2;
}
},
eventResize(event) {
const index = this.getIdDeleteData(event.event.id);
const oldData = this.calendarOptions.events;
const keyAll = Object.keys(oldData[index]);
const dataObj = {};
keyAll.forEach((item) => {
if (item === 'week' || item === 'type') {
dataObj[item] = oldData[index][item];
} else {
dataObj[item] = event.event[item];
}
},
eventResize(event) {
});
oldData.splice(index, 1, dataObj);
this.getHandleTime(dataObj);
},
handleEventClick(event) {
if (!this.calendarOptions.selectable || event.event.constraint) {
return;
}
this.$confirm('你要取消日期吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then((_) => {
console.log(_);
const index = this.getIdDeleteData(event.event.id);
const oldData = this.calendarOptions.events;
const keyAll = Object.keys(oldData[index]);
const dataObj = {};
keyAll.forEach((item) => {
if (item === 'week' || item === 'type') {
dataObj[item] = oldData[index][item];
} else {
dataObj[item] = event.event[item];
}
});
oldData.splice(index, 1, dataObj);
this.getHandleTime(dataObj);
},
handleEventClick(event) {
if (!this.calendarOptions.selectable || event.event.constraint) {
return;
this.isDoIt = true;
this.calendarOptions.events.splice(index, 1);
});
},
eventDrop(event) {
event.revert();
return;
},
// 每小时接诊上限人数
getMaxNumValue(value) {
console.log(value, 'getMaxNumValue');
this.maxNumValue = value;
},
// 提交优先级和人数
submitSetData() {
const params = {
doctorId: this.doctorId,
level: this.currentIndex,
workId: this.id,
preNum: this.maxNumValue,
};
saveLevelAndDayCount(params).then((res) => {
if (res.code === '000000') {
this.$message({
message: '设置成功',
type: 'success',
});
this.centerDialogVisible = false;
this.getLevelAndDayCount();
}
this.$confirm('你要取消日期吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then((_) => {
console.log(_);
const index = this.getIdDeleteData(event.event.id);
this.isDoIt = true;
this.calendarOptions.events.splice(index, 1);
});
},
selectInfo(info) {
console.log(info, 'infoinfoinfo');
const day = dayjs(info.start).date();
const id = day + (this.calendarOptions.events.length + 1) * 10;
info.id = id;
const keyAll = ['end', 'id', 'start', 'week'];
const selectTime = {};
keyAll.forEach((item) => {
if (item == 'week') {
selectTime[item] = this.week;
} else {
selectTime[item] = info[item];
}
});
console.log(selectTime, 'dataObjdataObj');
this.calendarOptions.events.push(selectTime);
},
selectAllow(info) {
this.isDoIt = true;
const startDay = new Date(info.start).getDay();
const endDay = new Date(info.end).getDay();
console.log(dayjs(info.start).format('YYYY-MM-DD HH:mm:ss'));
if (startDay != endDay) {
return false;
}
const currentDate = new Date();
const start = info.start;
const end = info.end;
return start <= end && start >= currentDate;
},
getIdDeleteData(eventId) {
// 删除现有排班
const data = this.calendarOptions.events;
const index = data.findIndex((event) => event.id == eventId);
return index;
},
getHandleTime(info) {
// 对于排班交叉部分处理
const infoStart = new Date(info.start).getTime();
const infoEnd = new Date(info.end).getTime();
const haveSelectTime = this.calendarOptions.events;
const correctDate = [];
let isRepeat = false;
haveSelectTime.forEach((item) => {
const selectEndTime = new Date(item.end).getTime();
const selectStartTime = new Date(item.start).getTime();
if (selectStartTime > infoStart && infoEnd >= selectEndTime) {
isRepeat = true;
} else if (selectStartTime > infoStart && infoEnd >= selectStartTime) {
isRepeat = true;
} else {
const id = (correctDate.length + 1) * 10;
item.id = id;
correctDate.push(item);
}
});
this.calendarOptions.events = correctDate;
return isRepeat;
},
handlePriority(index) {
this.isDoIt = true;
this.currentIndex = index;
},
resetDoctoreScheduling() {
this.handleInitSearch(true);
},
copyDoctoreScheduling() {
this.handleInitSearch(true, 1);
},
saveDoctoreScheduling(type, weekV = 0) {
if (this.isDoIt) {
this.loading = true;
const saveParms = {};
saveParms.week = weekV ? weekV : this.week;
saveParms.workId = this.schedulingTypeValue.id;
const lastData = [];
const haveSelectDate = this.calendarOptions.events;
haveSelectDate.forEach((item) => {
if (item.week == (weekV ? weekV : this.week)) {
const saveDate = {};
saveDate.startTime = dayjs(item.start).format(
'YYYY-MM-DD HH:mm:ss'
);
saveDate.endTime = dayjs(item.end).format('YYYY-MM-DD HH:mm:ss');
lastData.push(saveDate);
}
});
},
eventDrop(event) {
event.revert();
return;
},
// 每小时接诊上限人数
getMaxNumValue(value) {
console.log(value, 'getMaxNumValue');
this.maxNumValue = value;
},
// 提交优先级和人数
submitSetData() {
const params = {
doctorId: this.doctorId,
level: this.currentIndex,
workId: this.id,
preNum: this.maxNumValue,
};
saveLevelAndDayCount(params).then((res) => {
console.log('saveParms=======', saveParms);
// saveParms.list = lastData.filter((item) => {
// return item.startTime.split(' ')[1] !== '12:00:00';
// });
saveParms.list = lastData.slice(0);
saveDutyRoster(saveParms).then((res) => {
if (res.code === '000000') {
this.loading = false;
this.$message({
message: '设置成功',
message: '排班保存成功',
type: 'success',
});
this.centerDialogVisible = false;
this.getLevelAndDayCount();
}
});
},
selectInfo(info) {
console.log(info, 'infoinfoinfo');
const day = dayjs(info.start).date();
const id = day + (this.calendarOptions.events.length + 1) * 10;
info.id = id;
const keyAll = ['end', 'id', 'start', 'week'];
const selectTime = {};
keyAll.forEach((item) => {
if (item == 'week') {
selectTime[item] = this.week;
this.isDoIt = false;
this.handleInitSearch(true);
} else {
selectTime[item] = info[item];
this.$message.error(res.message || '排班保存失败');
}
});
console.log(selectTime, 'dataObjdataObj');
this.calendarOptions.events.push(selectTime);
},
selectAllow(info) {
this.isDoIt = true;
const startDay = new Date(info.start).getDay();
const endDay = new Date(info.end).getDay();
const startHour = dayjs(info.start).hour();
console.log(dayjs(info.start).format('YYYY-MM-DD HH:mm:ss'));
if (startDay != endDay || startHour == 12) {
return false;
}
const currentDate = new Date();
const start = info.start;
const end = info.end;
return start <= end && start >= currentDate;
},
getIdDeleteData(eventId) {
// 删除现有排班
const data = this.calendarOptions.events;
const index = data.findIndex((event) => event.id == eventId);
return index;
},
getHandleTime(info) {
// 对于排班交叉部分处理
const infoStart = new Date(info.start).getTime();
const infoEnd = new Date(info.end).getTime();
const haveSelectTime = this.calendarOptions.events;
const correctDate = [];
let isRepeat = false;
haveSelectTime.forEach((item) => {
const selectEndTime = new Date(item.end).getTime();
const selectStartTime = new Date(item.start).getTime();
if (selectStartTime > infoStart && infoEnd >= selectEndTime) {
isRepeat = true;
} else if (selectStartTime > infoStart && infoEnd >= selectStartTime) {
isRepeat = true;
} else {
const id = (correctDate.length + 1) * 10;
item.id = id;
correctDate.push(item);
}
});
this.calendarOptions.events = correctDate;
return isRepeat;
},
handlePriority(index) {
this.isDoIt = true;
this.currentIndex = index;
},
resetDoctoreScheduling() {
this.handleInitSearch(true);
},
copyDoctoreScheduling() {
this.handleInitSearch(true, 1);
},
saveDoctoreScheduling(type, weekV = 0) {
if (this.isDoIt) {
this.loading = true;
const saveParms = {};
saveParms.week = weekV ? weekV : this.week;
saveParms.workId = this.schedulingTypeValue.id;
const lastData = [];
const haveSelectDate = this.calendarOptions.events;
haveSelectDate.forEach((item) => {
if (item.week == (weekV ? weekV : this.week)) {
const saveDate = {};
saveDate.startTime = dayjs(item.start).format(
'YYYY-MM-DD HH:mm:ss'
);
saveDate.endTime = dayjs(item.end).format('YYYY-MM-DD HH:mm:ss');
lastData.push(saveDate);
}
});
console.log('saveParms=======', saveParms);
saveParms.list = lastData.filter((item) => {
return item.startTime.split(' ')[1] !== '12:00:00';
});
saveDutyRoster(saveParms).then((res) => {
if (res.code === '000000') {
this.loading = false;
this.$message({
message: '排班保存成功',
type: 'success',
});
this.isDoIt = false;
this.handleInitSearch(true);
} else {
this.$message.error(res.message || '排班保存失败');
}
if (!this.maxNumValue && this.maxNumValue != 0) {
return this.$message({
message: '请设置优先级和接诊上限设置',
type: 'warning',
});
if (!this.maxNumValue && this.maxNumValue != 0) {
return this.$message({
message: '请设置优先级和接诊上限设置',
type: 'warning',
});
}
}
},
}
},
};
},
};
</script>
<style lang="scss" scoped>
......
......@@ -106,244 +106,244 @@
</div>
</template>
<script>
import { departmentAll } from '@/api/diagnosis';
import FullCalendar from '@fullcalendar/vue';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import interactionPlugin from '@fullcalendar/interaction';
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';
import {
previewWork,
setPlatformUpper,
getPlatformUpper,
} from '@/api/serviceSchedule';
export default {
name: 'Index',
components: {
FullCalendar,
},
data() {
return {
maxDiaNum: 10,
dateTime: '',
interfaceOptions: [],
innerform: [],
props: {
// props定义的值根据接口返回的数据定的
label: 'value',
value: 'no',
children: 'interface',
},
departmentId: '',
id: '',
doctorId: '',
schedulingTypeValue: {},
schedulingType: 1, // 1 新增 2 编辑 3 查看
createList: [],
listDate: [],
week: 1, // 1:当前周 2:上一周 3:下一周
currentIndex: 3,
haveWeek: [1],
calendarOptions: {
plugins: [
dayGridPlugin,
interactionPlugin,
timeGridPlugin,
resourceTimeGridPlugin,
],
// timeZone: 'UTC',
locale: 'zh-cn',
aspectRatio: 2.8, // 设置日历单元格宽度与高度的比例。
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
initialView: 'resourceTimeGridDay',
resources: [],
eventColor: '#fff',
eventBackgroundColor: '#fff',
events: [],
slotMinWidth: 50,
resourceAreaWidth: '5%',
allDaySlot: false, // 周,日视图时,all-day 不显示
slotDuration: '01:00:00',
slotMinTime: '09:00',
slotMaxTime: '21:00',
slotLabelInterval: '',
scrollTime: false,
initialDate: '2021-10-31',
slotLabelFormat: {
hour: 'numeric',
minute: '2-digit',
meridiem: 'short',
hour12: false, // 设置时间为24小时
},
expandRows: true,
import { departmentAll } from '@/api/diagnosis';
import {
getPlatformUpper,
previewWork,
setPlatformUpper,
} from '@/api/serviceSchedule';
import dayGridPlugin from '@fullcalendar/daygrid';
import interactionPlugin from '@fullcalendar/interaction';
import resourceTimeGridPlugin from '@fullcalendar/resource-timegrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import FullCalendar from '@fullcalendar/vue';
export default {
name: 'Index',
components: {
FullCalendar,
},
data() {
return {
maxDiaNum: 10,
dateTime: '',
interfaceOptions: [],
innerform: [],
props: {
// props定义的值根据接口返回的数据定的
label: 'value',
value: 'no',
children: 'interface',
},
departmentId: '',
id: '',
doctorId: '',
schedulingTypeValue: {},
schedulingType: 1, // 1 新增 2 编辑 3 查看
createList: [],
listDate: [],
week: 1, // 1:当前周 2:上一周 3:下一周
currentIndex: 3,
haveWeek: [1],
calendarOptions: {
plugins: [
dayGridPlugin,
interactionPlugin,
timeGridPlugin,
resourceTimeGridPlugin,
],
// timeZone: 'UTC',
locale: 'zh-cn',
aspectRatio: 2.8, // 设置日历单元格宽度与高度的比例。
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
initialView: 'resourceTimeGridDay',
resources: [],
eventColor: '#fff',
eventBackgroundColor: '#fff',
events: [],
slotMinWidth: 50,
resourceAreaWidth: '5%',
allDaySlot: false, // 周,日视图时,all-day 不显示
slotDuration: '01:00:00',
slotMinTime: '01:00',
slotMaxTime: '23:00',
slotLabelInterval: '',
scrollTime: false,
initialDate: '2021-10-31',
slotLabelFormat: {
hour: 'numeric',
minute: '2-digit',
meridiem: 'short',
hour12: false, // 设置时间为24小时
},
workingTicketVisible: false, // 工作表票详情页面
scrollerHeight: 0,
loading: false,
doctorList: [],
index: 0,
getWidth: '100%',
getMaxWidth: '100%',
allTilst: [],
allList: {},
expandRows: true,
},
workingTicketVisible: false, // 工作表票详情页面
scrollerHeight: 0,
loading: false,
doctorList: [],
index: 0,
getWidth: '100%',
getMaxWidth: '100%',
allTilst: [],
allList: {},
};
},
watch: {},
created() {
this.departmentAll();
// this.getPlatformUpper();
},
mounted() {},
methods: {
getPlatformUpper() {
getPlatformUpper().then((res) => {
if (res.code === '000000') {
console.log(res);
this.maxDiaNum = res.data;
}
});
},
setPlatformUpper() {
const params = {
num: this.maxDiaNum,
};
setPlatformUpper(params).then((res) => {
if (res.code === '000000') {
this.$message({
message: '保存成功',
type: 'success',
});
this.getPlatformUpper();
}
});
},
watch: {},
created() {
this.departmentAll();
// this.getPlatformUpper();
getInputNumber(value) {
console.log(value, 'getInputNumbergetInputNumber');
},
mounted() {},
methods: {
getPlatformUpper() {
getPlatformUpper().then((res) => {
if (res.code === '000000') {
console.log(res);
this.maxDiaNum = res.data;
}
});
},
setPlatformUpper() {
const params = {
num: this.maxDiaNum,
departmentAll() {
departmentAll().then((res) => {
if (res.code == '000000') {
console.log(res, 'res111');
this.allList = res.data || {};
this.showListALL();
}
});
},
showListALL() {
const arr = [];
const { departmentMapList, parentDepartmentList } = this.allList;
parentDepartmentList.map((item) => {
const obj = {
label: item.departmentName,
value: item.departmentId,
children: [],
};
setPlatformUpper(params).then((res) => {
if (res.code === '000000') {
this.$message({
message: '保存成功',
type: 'success',
departmentMapList.map((info) => {
if (info.parentDepartmentId === obj.value) {
const children = [];
info.diagnoseDepartmentRespList.map((detail) => {
const secondObj = {
label: detail.departmentName,
value: detail.departmentId,
text: '',
};
let secondChildren = '';
(detail.departmentDeseaseRespList || []).map((res) => {
secondChildren += res.deseaseName + ' ';
});
secondObj.text = secondChildren ? `(${secondChildren})` : '';
children.push(secondObj);
});
this.getPlatformUpper();
obj.children = children;
}
});
},
getInputNumber(value) {
console.log(value, 'getInputNumbergetInputNumber');
},
departmentAll() {
departmentAll().then((res) => {
if (res.code == '000000') {
console.log(res, 'res111');
this.allList = res.data || {};
this.showListALL();
}
arr.push(obj);
});
console.log(arr);
this.allTilst = arr;
},
// 获取选择的值
changeDepartment() {
const checkedNodes = this.$refs['cascader'].getCheckedNodes();
if (checkedNodes.length > 0) {
this.departmentId = checkedNodes[0].value;
} else {
this.departmentId = '';
}
},
getNowDate(value) {
this.dateTime = value;
},
search() {
if (!this.dateTime || !this.departmentId) {
return this.$message({
message: '科室和时间都需要选择哦!',
type: 'warning',
});
},
showListALL() {
const arr = [];
const { departmentMapList, parentDepartmentList } = this.allList;
parentDepartmentList.map((item) => {
const obj = {
label: item.departmentName,
value: item.departmentId,
children: [],
};
departmentMapList.map((info) => {
if (info.parentDepartmentId === obj.value) {
const children = [];
info.diagnoseDepartmentRespList.map((detail) => {
const secondObj = {
label: detail.departmentName,
value: detail.departmentId,
text: '',
};
let secondChildren = '';
(detail.departmentDeseaseRespList || []).map((res) => {
secondChildren += res.deseaseName + ' ';
});
secondObj.text = secondChildren ? `(${secondChildren})` : '';
children.push(secondObj);
});
obj.children = children;
}
const params = {
dateTime: this.dateTime,
departmentId: this.departmentId,
};
previewWork({ ...params }).then((res) => {
if (res.code === '000000' && res.data) {
this.calendarOptions.resources = (res.data.doctorList || []).map(
(item) => {
return {
id: item.doctorId,
title: item.doctorName,
};
}
});
arr.push(obj);
});
console.log(arr);
this.allTilst = arr;
},
// 获取选择的值
changeDepartment() {
const checkedNodes = this.$refs['cascader'].getCheckedNodes();
if (checkedNodes.length > 0) {
this.departmentId = checkedNodes[0].value;
} else {
this.departmentId = '';
}
},
getNowDate(value) {
this.dateTime = value;
},
search() {
if (!this.dateTime || !this.departmentId) {
return this.$message({
message: '科室和时间都需要选择哦!',
type: 'warning',
});
}
const params = {
dateTime: this.dateTime,
departmentId: this.departmentId,
};
previewWork({ ...params }).then((res) => {
if (res.code === '000000' && res.data) {
this.calendarOptions.resources = (res.data.doctorList || []).map(
(item) => {
return {
id: item.doctorId,
title: item.doctorName,
};
}
);
const dutyRosterPreList = (res.data.dutyRosterPreList || []).map(
(item, index) => {
return {
id: index,
resourceId: item.doctorId,
end: item.endTime,
start: item.startTime,
color: '#FFEDE9',
};
}
);
const dutyWorkList = (res.data.dutyWorkList || []).map(
(item, index) => {
return {
id: index,
resourceId: item.doctorId,
end: item.endTime,
start: item.startTime,
color: '#E7F4F5',
};
}
);
if (res.data) {
this.calendarOptions.events = [].concat(
dutyRosterPreList,
dutyWorkList
);
);
const dutyRosterPreList = (res.data.dutyRosterPreList || []).map(
(item, index) => {
return {
id: index,
resourceId: item.doctorId,
end: item.endTime,
start: item.startTime,
color: '#FFEDE9',
};
}
);
const dutyWorkList = (res.data.dutyWorkList || []).map(
(item, index) => {
return {
id: index,
resourceId: item.doctorId,
end: item.endTime,
start: item.startTime,
color: '#E7F4F5',
};
}
);
if (res.data) {
this.calendarOptions.events = [].concat(
dutyRosterPreList,
dutyWorkList
);
}
const calendarApi = this.$refs.fullCalendar.getApi();
this.getWidth = `${
(this.calendarOptions.resources.length + 1) * 150
}px`;
this.getMaxWidth = `${
this.calendarOptions.resources.length * 150 + 100
}px`;
calendarApi.gotoDate(this.dateTime);
const calendarApi = this.$refs.fullCalendar.getApi();
this.getWidth = `${
(this.calendarOptions.resources.length + 1) * 150
}px`;
this.getMaxWidth = `${
this.calendarOptions.resources.length * 150 + 100
}px`;
calendarApi.gotoDate(this.dateTime);
console.log(this.calendarOptions.resources);
console.log(this.calendarOptions.events);
} else {
this.calendarOptions.events = [];
this.calendarOptions.resources = [];
}
});
},
console.log(this.calendarOptions.resources);
console.log(this.calendarOptions.events);
} else {
this.calendarOptions.events = [];
this.calendarOptions.resources = [];
}
});
},
};
},
};
</script>
<style lang="scss" scoped>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册