|
@@ -9,7 +9,13 @@
|
|
|
<h3>导入配置</h3>
|
|
|
<el-form :model="registerForm" ref="registerForm" label-width="100px" class="registerForm" label-position="top">
|
|
|
<el-form-item label="人员导入模板" prop="resource">
|
|
|
- <upload :datafileList="registerForm.resource" :changeFillId="handleAvatarSuccess" :fileName="'courseResource'" :filleNumber="1" :uploadType="'xls'" />
|
|
|
+ <upload :datafileList="registerForm.resource" :changeFillId="handleAvatarSuccess" :fileName="'courseResource'" :filleNumber="1" :uploadType="'xls'" :showList="true" />
|
|
|
+ <ul v-if="registerForm.resource.length>0" class="resource-list">
|
|
|
+ <li v-for="(itemR,indexR) in registerForm.resource" :key="indexR">
|
|
|
+ <a @click="handlePreview(itemR)"><svg-icon icon-class="xlsx" class="icon-logo"></svg-icon><span>{{itemR.name}}</span></a>
|
|
|
+ <i class="el-icon-delete" @click="handleDelResource(indexR)"></i>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="onSubmit('registerForm')" size="small" :loading="loading">保存</el-button>
|
|
@@ -19,6 +25,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="resourceFlag"
|
|
|
+ :show-close="true"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :modal-append-to-body="false"
|
|
|
+ width="1000px"
|
|
|
+ class="login-dialog"
|
|
|
+ v-if="resourceFlag">
|
|
|
+ <iframe
|
|
|
+ :src="resourceUrl"
|
|
|
+ width="100%"
|
|
|
+ height="600px"
|
|
|
+ ></iframe>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -30,6 +50,8 @@ import NavMenu from "../../components/NavMenu.vue"
|
|
|
import Breadcrumb from '../../components/Breadcrumb.vue';
|
|
|
import Upload from "../../components/Upload.vue"
|
|
|
import { getLogin } from "@/api/ajax";
|
|
|
+import { mapState } from 'vuex';
|
|
|
+const Base64 = require("js-base64").Base64;
|
|
|
|
|
|
export default {
|
|
|
//import引入的组件需要注入到对象中才能使用
|
|
@@ -62,12 +84,14 @@ export default {
|
|
|
file_id: '',
|
|
|
file_url: ''
|
|
|
},
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ resourceUrl: '', // 课节资源预览地址
|
|
|
+ resourceFlag: false,
|
|
|
}
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
|
computed: {
|
|
|
-
|
|
|
+ ...mapState(['file_preview_url']),
|
|
|
},
|
|
|
//监控data中数据变化
|
|
|
watch: {
|
|
@@ -87,12 +111,9 @@ export default {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
- let MethodName = "/OrgServer/Manager/SysUserManager/UpdateSysUser_BaseInfo";
|
|
|
+ let MethodName = "/OrgServer/Manager/SysConfigManager/SetSysConfig_DataImport";
|
|
|
let data = {
|
|
|
- email: this.registerForm.email,
|
|
|
- smtp: this.registerForm.smtp,
|
|
|
- emailName: this.registerForm.emailName,
|
|
|
- newPwd: this.registerForm.newPwd
|
|
|
+ person_data_import_template_file_id: this.registerForm.file_id
|
|
|
}
|
|
|
getLogin(MethodName, data)
|
|
|
.then((res) => {
|
|
@@ -117,9 +138,57 @@ export default {
|
|
|
this.registerForm.file_id = fileList[0]&&fileList[0].response&&fileList[0].response.file_info_list&&fileList[0].response.file_info_list[0]?fileList[0].response.file_info_list[0].file_id:''
|
|
|
this.registerForm.file_url = fileList[0]&&fileList[0].response&&fileList[0].response.file_info_list&&fileList[0].response.file_info_list[0]?fileList[0].response.file_info_list[0].file_url:''
|
|
|
},
|
|
|
+ // 预览文件
|
|
|
+ handlePreview(){
|
|
|
+ let MethodName = '/FileServer/GetFileInfo'
|
|
|
+ let data = {
|
|
|
+ file_id: this.registerForm.file_id
|
|
|
+ }
|
|
|
+ getLogin(MethodName, data)
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ let path =
|
|
|
+ `${this.file_preview_url}/onlinePreview?url=` +
|
|
|
+ Base64.encode(res.file_url);
|
|
|
+ this.resourceUrl = path;
|
|
|
+ this.resourceFlag = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ // 删除资源文件
|
|
|
+ handleDelResource(i){
|
|
|
+ this.$confirm("确定删除吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ this.registerForm.resource.splice(i, 1);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 得到信息
|
|
|
+ getInfo(){
|
|
|
+ let MethodName = "/OrgServer/Manager/SysConfigManager/GetSysConfig_DataImport";
|
|
|
+ getLogin(MethodName, {})
|
|
|
+ .then((res) => {
|
|
|
+ if(res.status===1){
|
|
|
+ this.registerForm.file_id = res.person_data_import_template_file_id
|
|
|
+ this.registerForm.file_url = res.person_data_import_template_file_url,
|
|
|
+ this.registerForm.resource = [
|
|
|
+ {
|
|
|
+ id: res.person_data_import_template_file_id,
|
|
|
+ name: res.person_data_import_template_file_name
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }).catch((res) =>{
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
+ this.getInfo()
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
@@ -158,6 +227,48 @@ export default {
|
|
|
color: #1D2129;
|
|
|
}
|
|
|
}
|
|
|
+.resource-list{
|
|
|
+ list-style: none;
|
|
|
+ margin: 12px 0;
|
|
|
+ padding: 0;
|
|
|
+ li{
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 16px;
|
|
|
+ a{
|
|
|
+ width: 360px;
|
|
|
+ padding: 7px 12px;
|
|
|
+ background: #F7F8FA;
|
|
|
+ border-radius: 2px;
|
|
|
+ color: #1D2129;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ span{
|
|
|
+ overflow:hidden;
|
|
|
+ text-overflow:ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ flex: 1;
|
|
|
+ display: block;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 22px;
|
|
|
+ }
|
|
|
+ .svg-icon{
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ margin-right: 8px;
|
|
|
+ color: #4E5969;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-icon-delete{
|
|
|
+ color: #4E5969;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-left: 12px;
|
|
|
+ &:hover{
|
|
|
+ color: #165DFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style lang="scss">
|