flat: zanc
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import request from '@/router/axios';
|
||||
import { Message } from 'element-ui';
|
||||
/*获取人才列表*/
|
||||
export const getList =
|
||||
(current, size, params, groupId) => {
|
||||
@@ -104,3 +105,22 @@ export const transferDept =
|
||||
export const upload = () => {
|
||||
return `/api/jobslink-api/policy/group/import?isCovered=1`
|
||||
}
|
||||
|
||||
|
||||
export const uploadFilePolicy = (formData) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/api/jobslink-api/resource/file/save',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data;'
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
resolve(res)
|
||||
}).catch(err => {
|
||||
Message.error('上传失败' + err.data.message || '上传失败');
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
:permission="permissionList" :before-open="beforeOpen" @row-del="rowDel" @row-update="rowUpdate"
|
||||
@row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
|
||||
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
|
||||
@refresh-change="refreshChange" class="customPage">
|
||||
@refresh-change="refreshChange" class="customPage" @upload-after="uploadSearchAfter">
|
||||
<!--自定义列-->
|
||||
<template slot="labelName" slot-scope="{ row }">
|
||||
<el-tooltip effect="dark" placement="top">
|
||||
@@ -96,15 +96,31 @@
|
||||
</template>
|
||||
<template slot="policyFileUrlForm">
|
||||
<div class="policyFileUrlWrapper">
|
||||
<div class="uploadWrapperAb"><avue-upload :action="'/api/jobslink-api/resource/file/save'" :propsHttp="propsHttp"
|
||||
v-model="form"></avue-upload></div>
|
||||
<div class="uploadWrapperAb">
|
||||
<!-- <avue-upload :action="action" :propsHttp="policyFileUrlHttpProps" v-model="policyFileUrl"></avue-upload>-->
|
||||
<el-upload
|
||||
action="#"
|
||||
ref="upload"
|
||||
:show-file-list="false"
|
||||
:http-request="allUpload"
|
||||
:multiple="false"
|
||||
><el-button size="small" type="primary">点击上传</el-button></el-upload>
|
||||
</div>
|
||||
<avue-input disabled v-model="policyFileUrl" placeholder="点击上传文件"></avue-input>
|
||||
</div>
|
||||
</template>
|
||||
<template slot="guidelineFileUrlForm">
|
||||
<div class="policyFileUrlWrapper">
|
||||
<div class="uploadWrapperAb"><avue-upload :action="'/api/jobslink-api/resource/file/save'" :propsHttp="propsHttp"
|
||||
v-model="form"></avue-upload></div>
|
||||
<div class="uploadWrapperAb">
|
||||
<!-- <avue-upload :action="action" :propsHttp="propsHttp" v-model="form"></avue-upload>-->
|
||||
<el-upload
|
||||
action="#"
|
||||
ref="upload"
|
||||
:show-file-list="false"
|
||||
:http-request="allUploadGuideline"
|
||||
:multiple="false"
|
||||
><el-button size="small" type="primary">点击上传</el-button></el-upload>
|
||||
</div>
|
||||
<avue-input disabled v-model="guidelineFileUrl" placeholder="点击上传文件"></avue-input>
|
||||
</div>
|
||||
</template>
|
||||
@@ -169,6 +185,7 @@ import {
|
||||
getDept,
|
||||
removeDept,
|
||||
upload,
|
||||
uploadFilePolicy
|
||||
} from "@/api/tenant/policy";
|
||||
import { getWorkTypes, getLabelList } from "@/api/tenant/common";
|
||||
import { mapGetters } from "vuex";
|
||||
@@ -195,6 +212,8 @@ export default {
|
||||
name: "tenant_policy",
|
||||
data() {
|
||||
return {
|
||||
policyFileUrl: '',
|
||||
guidelineFileUrl: '',
|
||||
activeNames: "1",
|
||||
isIndeterminate: false,
|
||||
checkAll: false,
|
||||
@@ -571,17 +590,20 @@ export default {
|
||||
label: "政策文件地址",
|
||||
prop: "policyFileUrl",
|
||||
hide: true,
|
||||
type: "upload",
|
||||
// accept:["png", "jpg", "jpeg"],
|
||||
showFileList: true,
|
||||
action: "https://api.avuejs.com/imgupload",
|
||||
headers: [],
|
||||
data: "",
|
||||
span: 24,
|
||||
propsHttp: {
|
||||
res: "data",
|
||||
url: "link",
|
||||
},
|
||||
// type: "upload",
|
||||
// // accept:["png", "jpg", "jpeg"],
|
||||
// showFileList: true,
|
||||
// action: "/api/jobslink-api/resource/file/save",
|
||||
// headers: [],
|
||||
// data: "",
|
||||
// span: 24,
|
||||
// propsHttp: {
|
||||
// // res: "data",
|
||||
// url: "msg",
|
||||
// name: "msg", // 解析responseJSON中的data.fileName为文件名
|
||||
// // "fileName": "attach" // 指定
|
||||
// },
|
||||
// tip: '上传政策文件',
|
||||
slot: true,
|
||||
formslot: true,
|
||||
showWordLimit: true,
|
||||
@@ -688,6 +710,22 @@ export default {
|
||||
this.getLabelList();
|
||||
},
|
||||
methods: {
|
||||
async allUpload(file) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file.file);
|
||||
let resData = await uploadFilePolicy(formData)
|
||||
if(resData.data.code === 200) {
|
||||
this.policyFileUrl = resData.data.msg
|
||||
}
|
||||
},
|
||||
async allUploadGuideline(file) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file.file);
|
||||
let resData = await uploadFilePolicy(formData)
|
||||
if(resData.data.code === 200) {
|
||||
this.guidelineFileUrl = resData.data.msg
|
||||
}
|
||||
},
|
||||
getWorkTypes() {
|
||||
|
||||
getWorkTypes().then((res) => {
|
||||
@@ -847,6 +885,8 @@ export default {
|
||||
this.tempWorkType = this.obj.labelName ? this.obj.labelName.split(",") : [];
|
||||
this.guidelineContent = this.obj.guidelineContent
|
||||
this.policyContent = this.obj.policyContent
|
||||
this.guidelineFileUrl = this.obj.guidelineFileUrl
|
||||
this.policyFileUrl = this.obj.policyFileUrl
|
||||
done();
|
||||
},
|
||||
(error) => {
|
||||
@@ -862,7 +902,6 @@ export default {
|
||||
},
|
||||
/*新增人才*/
|
||||
rowSave(row, done) {
|
||||
console.log(this.form);
|
||||
debugger
|
||||
add({
|
||||
// groupId: row.groupId,
|
||||
@@ -882,8 +921,8 @@ export default {
|
||||
// status: row.status,
|
||||
// issuingNumber: row.issuingNumber,
|
||||
...row,
|
||||
guidelineFileUrl: row.guidelineFileUrl.join(','),
|
||||
policyFileUrl: row.policyFileUrl.join(','),
|
||||
guidelineFileUrl: this.guidelineFileUrl,
|
||||
policyFileUrl: this.policyFileUrl,
|
||||
labelName: this.selectedWorkTypes.map((item) => item.name).join(','),
|
||||
policyContent: this.policyContent,
|
||||
guidelineContent: this.guidelineContent
|
||||
@@ -894,6 +933,8 @@ export default {
|
||||
message: "操作成功!",
|
||||
});
|
||||
done();
|
||||
this.guidelineFileUrl = ''
|
||||
this.policyFileUrl = ''
|
||||
this.refresh();
|
||||
},
|
||||
(error) => {
|
||||
@@ -916,7 +957,9 @@ export default {
|
||||
// remarks: row.remarks,
|
||||
...copyRow,
|
||||
guidelineContent: this.guidelineContent,
|
||||
policyContent: this.policyContent
|
||||
policyContent: this.policyContent,
|
||||
guidelineFileUrl: this.guidelineFileUrl,
|
||||
policyFileUrl: this.policyFileUrl,
|
||||
}).then(
|
||||
() => {
|
||||
done();
|
||||
@@ -924,6 +967,8 @@ export default {
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
this.guidelineFileUrl = ''
|
||||
this.policyFileUrl = ''
|
||||
this.refresh();
|
||||
},
|
||||
(error) => {
|
||||
@@ -1054,6 +1099,7 @@ export default {
|
||||
}
|
||||
},
|
||||
uploadAfter(res, done) {
|
||||
console.log(res)
|
||||
if (!(res instanceof Error) && !res.data) {
|
||||
this.excelBox = false;
|
||||
} else if (res.data && res.data.code === 900) {
|
||||
|
||||
Reference in New Issue
Block a user