feat: v3版疗休养优化6
This commit is contained in:
@@ -105,11 +105,11 @@ const nation = [
|
||||
'基诺族'
|
||||
];
|
||||
|
||||
const loc = () => {
|
||||
function loc() {
|
||||
return location.href.replace(location.search, "").replace(location.hash, "")
|
||||
}
|
||||
|
||||
const clone = (obj) => {
|
||||
function clone(obj) {
|
||||
return JSON.parse(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
const sublime = {
|
||||
jumpPagePjax(url) {
|
||||
window.location.href = url;
|
||||
},
|
||||
showLoadingbar() {
|
||||
if (!document.getElementById('therapy-loading')) {
|
||||
const bar = document.createElement('div');
|
||||
@@ -12,6 +15,77 @@ const sublime = {
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$validateForm = function(form) {
|
||||
return new Promise(resolve => {
|
||||
if (!form) {
|
||||
this.$message.error('表单尚未加载完成');
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
const uploading = component => {
|
||||
if (Array.isArray(component.uploadFiles) && component.uploadFiles.some(file => file.status === 'uploading')) return true;
|
||||
return (component.$children || []).some(uploading);
|
||||
};
|
||||
if (uploading(form)) {
|
||||
this.$message.warning('请等待图片或附件上传完成后再提交');
|
||||
resolve(false);
|
||||
return;
|
||||
}
|
||||
form.validate((valid, fields) => {
|
||||
if (!valid) {
|
||||
const errors = Object.values(fields || {}).flat();
|
||||
this.$message.warning(errors.length ? errors[0].message : '请检查必填项和填写格式');
|
||||
}
|
||||
resolve(valid);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Vue.prototype.$confirmAction = async function(...args) {
|
||||
try {
|
||||
return await this.$confirm(...args);
|
||||
} catch (error) {
|
||||
if (error === 'cancel' || error === 'close') return false;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$actionError = function(error) {
|
||||
if (error === 'cancel' || error === 'close') return;
|
||||
const message = error && (error.responseJSON && error.responseJSON.msg || error.msg || error.message);
|
||||
this.$message.error(message || '操作失败,请稍后重试');
|
||||
};
|
||||
|
||||
Vue.prototype.$downloadFile = function(url) {
|
||||
window.location.href = url;
|
||||
};
|
||||
|
||||
Vue.prototype.$importExcel = function(url, files) {
|
||||
const data = new FormData();
|
||||
files.forEach(file => data.append('file', file.raw, file.raw.name));
|
||||
return $.ajax({url: url, type: 'POST', data: data, processData: false, contentType: false});
|
||||
};
|
||||
|
||||
Vue.directive('throttle', {
|
||||
bind(el) {
|
||||
let lastClick = 0;
|
||||
el.therapyThrottleHandler = event => {
|
||||
const now = Date.now();
|
||||
if (now - lastClick < 1000) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
lastClick = now;
|
||||
};
|
||||
el.addEventListener('click', el.therapyThrottleHandler, true);
|
||||
},
|
||||
unbind(el) {
|
||||
el.removeEventListener('click', el.therapyThrottleHandler, true);
|
||||
delete el.therapyThrottleHandler;
|
||||
}
|
||||
});
|
||||
|
||||
$.ajaxSetup({
|
||||
traditional: true,
|
||||
error(xhr) {
|
||||
|
||||
+5
-2
@@ -54,7 +54,7 @@ const initTableMixins = {
|
||||
removeFile()
|
||||
}
|
||||
|
||||
if (size && !file.size < size) {
|
||||
if (size && file.size > size) {
|
||||
this.notifyWarning(`文件大小不能超过 ${size / 1024 / 1024}MB!`)
|
||||
removeFile()
|
||||
}
|
||||
@@ -104,7 +104,10 @@ const initTableMixins = {
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
}, "json");
|
||||
}, "json").always(() => {
|
||||
sublime.closeLoadingbar();
|
||||
this.tableLoading = false;
|
||||
});
|
||||
},
|
||||
notifySuccess(msg) {
|
||||
this.$notify({
|
||||
|
||||
@@ -280,9 +280,11 @@ module.exports = {
|
||||
if (v.data && v.data.code === 0) {
|
||||
insertImgFn(v.data.data)
|
||||
} else {
|
||||
this.$message.error("图片上传失败")
|
||||
_this.$message.error(v.data && v.data.msg || "图片上传失败")
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
_this.$message.error("图片上传失败,请重试")
|
||||
})
|
||||
}
|
||||
this.editor.config.pasteFilterStyle = false
|
||||
|
||||
+5
-3
@@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<el-drawer title="参加人员范围设置" :visible.sync="userScopeDialog" size="90%" :append-to-body="true" @closed="loadGroups">
|
||||
<el-drawer title="参加人员范围设置" :visible.sync="userScopeDialog" size="40%" :append-to-body="true" @closed="loadGroups">
|
||||
<div style="padding:0 20px 10px">
|
||||
<el-select :value="group_id" placeholder="选择疗休养参加人员分组" filterable clearable @change="$emit('update:group_id', $event)">
|
||||
<el-select :value="group_id" placeholder="选择疗休养参加人员分组" filterable clearable style="width:100%" @change="$emit('update:group_id', $event)">
|
||||
<el-option v-for="group in groups" :key="group.groupId" :label="group.groupName" :value="group.groupId"></el-option>
|
||||
</el-select>
|
||||
<el-button type="text" @click="loadGroups">刷新分组</el-button>
|
||||
</div>
|
||||
<iframe v-if="userScopeDialog" src="/platform/activity/basic/scope" title="参加人员范围设置" style="width:100%;height:calc(100vh - 150px);border:0"></iframe>
|
||||
<div style="padding:0 20px;text-align:right">
|
||||
<el-button type="primary" @click="userScopeDialog = false">确定</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
+3
-3
@@ -74,17 +74,17 @@
|
||||
<el-table-column label="身份证号" prop="idCard"></el-table-column>
|
||||
<el-table-column label="年龄" prop="age"></el-table-column>
|
||||
<el-table-column label="床型" prop="bedType">
|
||||
<template scope="{row}">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.bedInfo?.bedType }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="床位" prop="bedNum">
|
||||
<template scope="{row}">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.bedInfo?.bedNum }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="意向拼床人" prop="otherSleepUser">
|
||||
<template scope="{row}">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.bedInfo?.otherSleepUser ? row.bedInfo?.otherSleepUser : '暂无' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
+11
-4
@@ -3,9 +3,9 @@
|
||||
<div v-if="view">
|
||||
<a v-for="file in files" :key="file.id || file.filepath" :href="file.downloadPath || file.filepath || preview(file.id)" target="_blank" style="display:block">{{ file.name || file.filename }}</a>
|
||||
</div>
|
||||
<el-upload v-else action="/platform/inclusiveTherapyV3/common/uploadFile" name="file"
|
||||
<el-upload v-else action="/platform/sys/file/uploadDynamicReturnUrl" name="file"
|
||||
:limit="max" :multiple="max > 1" :file-list="fileList" :drag="card"
|
||||
:before-upload="beforeUpload" :on-success="success" :on-remove="remove" :on-preview="open">
|
||||
:before-upload="beforeUpload" :on-success="success" :on-error="error" :on-remove="remove" :on-preview="open">
|
||||
<el-button size="small" type="primary">选择文件</el-button>
|
||||
<div slot="tip"><slot></slot></div>
|
||||
</el-upload>
|
||||
@@ -32,10 +32,17 @@ module.exports = {
|
||||
list.splice(list.indexOf(file), 1);
|
||||
this.$message.error(result.msg); return;
|
||||
}
|
||||
file.rawInfo = result.data;
|
||||
file.url = result.data.downloadPath || result.data.filepath;
|
||||
if (typeof result.data !== 'string' || !result.data) {
|
||||
list.splice(list.indexOf(file), 1);
|
||||
this.$message.error('上传未返回文件地址'); return;
|
||||
}
|
||||
const id = new URL(result.data, window.location.origin).searchParams.get('id');
|
||||
file.rawInfo = {id: id, name: file.name, filename: file.name,
|
||||
downloadPath: result.data, filepath: result.data, url: result.data};
|
||||
file.url = result.data;
|
||||
this.emit(list);
|
||||
},
|
||||
error() { this.$message.error('文件上传失败,请重试'); },
|
||||
remove(file, list) { this.emit(list); },
|
||||
emit(list) {
|
||||
this.$emit('update:files', list.map(file => file.rawInfo || file.response && file.response.data).filter(Boolean));
|
||||
|
||||
+16
-5
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-upload action="/platform/inclusiveTherapyV3/common/uploadFile" name="file" list-type="picture-card"
|
||||
<el-upload action="/platform/sys/file/uploadDynamicReturnUrl" name="file" list-type="picture-card"
|
||||
:file-list="fileList" :limit="limit" :before-upload="beforeUpload"
|
||||
:on-success="success" :on-remove="remove" :on-preview="open"
|
||||
:on-success="success" :on-error="error" :on-exceed="exceed" :on-remove="remove" :on-preview="open"
|
||||
:style="{'--therapy-width': width + 'px', '--therapy-height': height + 'px'}">
|
||||
<i class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
@@ -30,16 +30,27 @@ module.exports = {
|
||||
list.splice(list.indexOf(file), 1);
|
||||
this.$message.error(result.msg); return;
|
||||
}
|
||||
file.url = result.data.filepath;
|
||||
file.storedValue = result.data.filepath;
|
||||
if (typeof result.data !== 'string' || !result.data) {
|
||||
list.splice(list.indexOf(file), 1);
|
||||
this.$message.error('上传未返回图片地址'); return;
|
||||
}
|
||||
file.url = result.data;
|
||||
file.storedValue = result.data;
|
||||
this.emit(list);
|
||||
},
|
||||
error() { this.$message.error('图片上传失败,请重试'); },
|
||||
exceed() { this.$message.warning('最多上传' + this.limit + '张图片'); },
|
||||
remove(file, list) { this.emit(list); },
|
||||
emit(list) {
|
||||
const values = list.map(file => file.storedValue).filter(Boolean);
|
||||
this.$emit('input', Array.isArray(this.value) ? values : values[0] || '');
|
||||
},
|
||||
open(file) { window.open(file.url); }
|
||||
open(file) {
|
||||
const img = new Image();
|
||||
img.src = file.url;
|
||||
const viewer = new Viewer(img, {hidden() { viewer.destroy(); }});
|
||||
viewer.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+3
-3
@@ -67,17 +67,17 @@
|
||||
<el-table-column label="身份证号" prop="idCard"></el-table-column>
|
||||
<el-table-column label="年龄" prop="age"></el-table-column>
|
||||
<el-table-column label="床型" prop="bedType">
|
||||
<template scope="{row}">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.bedInfo?.bedType }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="床位" prop="bedNum">
|
||||
<template scope="{row}">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.bedInfo?.bedNum }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="意向拼床人" prop="otherSleepUser">
|
||||
<template scope="{row}">
|
||||
<template slot-scope="{row}">
|
||||
{{ row.bedInfo?.otherSleepUser ? row.bedInfo?.otherSleepUser : '暂无' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
Reference in New Issue
Block a user