Commit 0f4e7b9b authored by 罗超's avatar 罗超

1

parent 2246aa0e
......@@ -153,6 +153,14 @@ class CustomerService {
data
})
}
//获取客户线索下载模板地址
static async getCustomerClueTemplateUrl(data: any): Promise<HttpResponse> {
return Axios('/QYCustomer/GetCustomerClueExportFile', {
method: 'post',
responseType: 'json',
data
})
}
}
export {CutomerParams}
export default CustomerService
......@@ -25,7 +25,7 @@
</n-upload>
<div class="uplaod-tips">
请上传xls、xlsx文件
<q-btn flat color="primary" label="下载模板" /><br/>
<q-btn flat color="primary" label="下载模板" @click="getTemplate"/><br/>
每次最多可上传10000条数据
</div>
<div class="q-mt-sm full-width">
......@@ -46,9 +46,10 @@
ref,
watch
} from 'vue'
import {
UploadSelfFile
} from '@/utils/upload'
// import {UploadSelfFile} from '@/utils/upload'
import {getStoreGetter} from '@/store/utils'
import CustomerService from '@/api/customer'
import {UploadLocalSystem} from '@/utils/upload'
export default {
props: {
modelValue: {
......@@ -71,11 +72,20 @@
}
let FileList = ref<any[]> ([])
let customUploadFile = file => {
UploadSelfFile('/horse', file.file.file, res => {
FileList.value.push({
FileName: res.FileName,
FileUrl: res.FileUrl,
})
// UploadSelfFile('/horse', file.file.file, res => {
// FileList.value.push({
// FileName: res.FileName,
// FileUrl: res.FileUrl,
// })
// })
const LoginUserInfo = getStoreGetter('user', 'getLoginUserInfo')
const fileParams = {
Excel: 1,
Analysis: 1,
Uid:LoginUserInfo.Id
}
UploadLocalSystem(fileParams,file.file.file,(res)=>{
console.log(88,res)
})
}
const confirm=()=>{
......@@ -83,12 +93,18 @@
ctx.emit('confirm', FileList.value)
show.value = false
}
const getTemplate=()=>{
CustomerService.getCustomerClueTemplateUrl({}).then(res=>{
console.log(89,res)
})
}
return {
show,
hideDialog,
FileList,
customUploadFile,
confirm
confirm,
getTemplate
}
}
}
......
......@@ -124,21 +124,26 @@ const editRuleModule = () => {
}
// 新增,修改
const setCustomerClueRuleInfo = () => {
// console.log(data.editMsg.ConditionList)
// const flag = condition.value.checkRule(data.editMsg.ConditionList)
// console.log(94, flag)
// if (!flag) return
customerSetService.setCustomerClueRuleInfo(data.editMsg).then(res => {
message.successMsg(res.data.Message)
setTimeout(() => {
router.push({
path: '/customerSetup',
query: {
type: 'clue'
console.log(data.editMsg.ConditionList)
const flag = condition.value.checkRule(data.editMsg.ConditionList)
console.log(94, flag)
if (!flag) return
if (data.editMsg.DeptList.length == 0 && data.editMsg.EmpList.length == 0) {
message.warnMsg('适用部门/成员')
return
}
})
}, 2000)
})
// customerSetService.setCustomerClueRuleInfo(data.editMsg).then(res => {
// message.successMsg(res.data.Message)
// setTimeout(() => {
// router.push({
// path: '/customerSetup',
// query: {
// type: 'clue'
// }
// })
// }, 2000)
// })
}
return {
msg,
......
......@@ -228,7 +228,7 @@
</div>
</template>
</importComponents>
<departmentStaff v-model="data.showDptDialog" nodeKey="newId" labelKey="DeptName"
<departmentStaff v-model="data.showDptDialog" :defaultArray="[]" nodeKey="newId" labelKey="DeptName"
childrenKey="ChildList" strategy="leaf" :treeData="data.EmployeeList" @select="getDeptDig" />
</div>
</template>
......
......@@ -296,7 +296,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL
export function downloadLocalFile(fileName, filePath) {
const a = document.createElement('a')
a.setAttribute('download', '')
const url = process.env.API
const url = process.env.BASE_APP_API
a.setAttribute('href', url + '/Upload/DownloadFileForPdf?fileName=' + fileName + '.pdf&fPath=' + filePath)
a.click()
}
......@@ -377,3 +377,49 @@ export function DownLoadFileByUrl(url, fileName) {
// UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback)
// }
// }
/**
* 上传到当前站点
*/
export function UploadLocalSystem(configObj, fileObj, successCall) {
const uploadLoadding = Loading
uploadLoadding.show({
message: '正在上传文件,请稍后...'
})
const url = process.env.BASE_APP_API + '/Upload/UploadFile'
const formData = new FormData()
if (configObj) {
formData.append("params", configObj);
}
formData.append('myfile', fileObj)
const xhr = new XMLHttpRequest()
xhr.onload = function () {
uploadLoadding.hide();
const jsonObj = JSON.parse(xhr.responseText)
if (jsonObj && jsonObj.StatusCode && jsonObj.StatusCode == 1 && successCall) {
const uploadResult = {
Code: 1,
FileName: fileObj.name,
FileUrl: process.env.BASE_APP_API + jsonObj.FilePath,
VideoCoverImg: process.env.BASE_APP_API + jsonObj.VideoCoverImg,
Data: jsonObj.Data
}
if (successCall) {
successCall(uploadResult);
}
}
if (jsonObj && jsonObj.Code && jsonObj.Code == 1 && successCall) {
const uploadResult = {
Code: 1,
Data: jsonObj.Data,
Message: jsonObj.Message
}
if (successCall) {
successCall(uploadResult);
}
}
}
xhr.open('post', url, true)
xhr.send(formData)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment