Commit 54b2bcb7 by 前端

Merge branch 'SAAS+V5.7.0' into 'SAAS+V5.7.2'

上线合并

See merge request !574
2 parents b408b960 abb8a936
Showing 41 changed files with 304 additions and 1824 deletions
...@@ -55,7 +55,7 @@ export function baseGoodsUpOrDown(data) { ...@@ -55,7 +55,7 @@ export function baseGoodsUpOrDown(data) {
// 删除商品 // 删除商品
export function baseGoodsDelete(data) { export function baseGoodsDelete(data) {
data.method = `${path2}basegoods.delete` data.method = `${path2}basegoods.delete`
return request(data, "post") return request(data, "post", [], { useResponseMessage: true })
} }
// 导出 // 导出
......
...@@ -107,5 +107,5 @@ export function getBaseGoodsOperationLogPage(data) { ...@@ -107,5 +107,5 @@ export function getBaseGoodsOperationLogPage(data) {
// 删除 SKU(升级商品) // 删除 SKU(升级商品)
export function upgradeGoodsDelete(data) { export function upgradeGoodsDelete(data) {
data.method = "dj.smartcarlife.api.upgradegoods.delete"; data.method = "dj.smartcarlife.api.upgradegoods.delete";
return request(data, "post"); return request(data, "post", [], { useResponseMessage: true });
} }
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
label-width="120px" label-width="120px"
:model="form" :model="form"
:rules="rules"> :rules="rules">
<el-form-item label="导入文件:" <slot name="prepend" />
<el-form-item :label="formItemLabel"
prop="fileName"> prop="fileName">
<el-col :span="16"> <el-col :span="16">
<el-input v-model="form.fileName" <el-input v-model="form.fileName"
readonly /> readonly />
<slot name="tip" />
</el-col> </el-col>
<el-col class="m-l-md" <el-col class="m-l-md"
:span="4"> :span="4">
...@@ -61,6 +63,10 @@ export default { ...@@ -61,6 +63,10 @@ export default {
type: String, type: String,
default: "模版下载", default: "模版下载",
}, },
formItemLabel: {
type: String,
default: "导入文件:",
},
}, },
data() { data() {
return { return {
......
import store from "@/store" import axios from "axios";
import axios from "axios" import { Message } from "element-ui";
import { Message } from "element-ui" import Qs from "qs";
import util from "@/libs/util" import util from "@/libs/util";
import router from "@/router" import { baseConfig } from "@/main";
import { baseConfig } from "@/main" import router from "@/router";
import Qs from "qs" import store from "@/store";
axios.defaults.withCredentials = true
axios.defaults.withCredentials = true;
// const expiresMinute = 60 // 过期时间(分钟) // const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误 // 创建一个错误
export function errorCreate(msg) { export function errorCreate(msg) {
const error = new Error(msg) const error = new Error(msg);
errorLog(error) errorLog(error);
throw error throw error;
} }
// 记录和显示错误 // 记录和显示错误
function errorLog(error) { function errorLog(error) {
...@@ -20,20 +21,20 @@ function errorLog(error) { ...@@ -20,20 +21,20 @@ function errorLog(error) {
message: "数据请求异常", message: "数据请求异常",
type: "danger", type: "danger",
meta: { meta: {
error error,
} },
}) });
// 打印到控制台 // 打印到控制台
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
util.log.danger(">>>>>> Error >>>>>>") util.log.danger(">>>>>> Error >>>>>>");
console.log(error) console.log(error);
} }
// 显示提示 // 显示提示
Message({ Message({
message: error.message, message: error.message,
type: "error", type: "error",
duration: 5 * 1000 duration: 5 * 1000,
}) });
} }
// 网络请求公用地址 http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS // 网络请求公用地址 http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
// VUE_APP_API=http://192.168.3.191:8944/router // VUE_APP_API=http://192.168.3.191:8944/router
...@@ -43,16 +44,16 @@ const service = axios.create({ ...@@ -43,16 +44,16 @@ const service = axios.create({
timeout: 100000, // 请求超时时间 timeout: 100000, // 请求超时时间
transformRequest: [ transformRequest: [
function (data) { function (data) {
return Qs.stringify(data) return Qs.stringify(data);
} },
] ],
}) });
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config) => { (config) => {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
await store.commit("d2admin/loading/set", true) await store.commit("d2admin/loading/set", true);
// const uuid = util.cookies.get('uuid') // const uuid = util.cookies.get('uuid')
// 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作) // 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作)
// if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) { // if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) {
...@@ -73,18 +74,18 @@ service.interceptors.request.use( ...@@ -73,18 +74,18 @@ service.interceptors.request.use(
// console.log(config.data.method) // console.log(config.data.method)
if (process.env.NODE_ENV == "development") { if (process.env.NODE_ENV == "development") {
// 处理图片开发环境没用的问题 // 处理图片开发环境没用的问题
const type = Object.prototype.toString.call(config.data) const type = Object.prototype.toString.call(config.data);
const methodList = [ const methodList = [
"dj.api.common.uploadImg", "dj.api.common.uploadImg",
"dj.api.common.ocr.recognition", "dj.api.common.ocr.recognition",
"dj.api.smartcarlife.sms.sendSmsCode" "dj.api.smartcarlife.sms.sendSmsCode",
] ];
if ( if (
type == "[object Object]" && type == "[object Object]"
methodList.includes(config.data.method) && methodList.includes(config.data.method)
) { ) {
config.url = "http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router" config.url = "http://dj.test.glsx.com.cn/rop-dj-smartcarlife/router";
return resolve(config) return resolve(config);
} }
} }
// if (config.isPoint) { // if (config.isPoint) {
...@@ -95,21 +96,21 @@ service.interceptors.request.use( ...@@ -95,21 +96,21 @@ service.interceptors.request.use(
// config.url = baseConfig.axios.baseURL // config.url = baseConfig.axios.baseURL
// } // }
// console.log(config) // console.log(config)
resolve(config) resolve(config);
}) });
}, },
(error) => { (error) => {
store.commit("d2admin/loading/set", false) store.commit("d2admin/loading/set", false);
// 发送失败 // 发送失败
console.log(error) console.log(error);
Promise.reject(error) Promise.reject(error);
} },
) );
// 响应拦截器 // 响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
(response) => { (response) => {
// console.log(response) // console.log(response)
store.commit("d2admin/loading/set", false) store.commit("d2admin/loading/set", false);
// dataAxios 是 axios 返回数据中的 data // dataAxios 是 axios 返回数据中的 data
// const dataAxios = { // const dataAxios = {
// code: "20", // code: "20",
...@@ -117,33 +118,34 @@ service.interceptors.response.use( ...@@ -117,33 +118,34 @@ service.interceptors.response.use(
// solution: "将添加会话ID请求参数", // solution: "将添加会话ID请求参数",
// subErrors: null // subErrors: null
// } // }
const dataAxios = response.data const dataAxios = response.data;
const ruleResult = baseConfig.axios.result const ruleResult = baseConfig.axios.result;
const returnAll = response.config.returnAll const returnAll = response.config.returnAll;
// 这个状态码是和后端约定的 // 这个状态码是和后端约定的
// 有 code 代表这是一个后端接口 可以进行进一步的判断 // 有 code 代表这是一个后端接口 可以进行进一步的判断
var goBackArr = ["20", "21"] let goBackArr = ["20", "21"];
// console.log(dataAxios[ruleResult.code_key]) // console.log(dataAxios[ruleResult.code_key])
if (goBackArr.includes(dataAxios[ruleResult.code_key])) { if (goBackArr.includes(dataAxios[ruleResult.code_key])) {
// await store.dispatch('d2admin/account/logout') // await store.dispatch('d2admin/account/logout')
store.dispatch("d2admin/user/clear") store.dispatch("d2admin/user/clear");
util.cookies.remove("token") util.cookies.remove("token");
router.replace("/login") router.replace("/login");
return errorCreate("登录超时,请重新登录") return errorCreate("登录超时,请重新登录");
// return Promise.reject(new Error("登录超时,请重新登录")) // return Promise.reject(new Error("登录超时,请重新登录"))
// return Promise.reject(new Error(response.message || 'Error')) // return Promise.reject(new Error(response.message || 'Error'))
} }
if(returnAll) return dataAxios if (returnAll)
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode return dataAxios;
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode;
switch (+codeValue) { switch (+codeValue) {
case ruleResult.code_success_value: case ruleResult.code_success_value:
// [ 示例 ] code === 0 代表没有错误 // [ 示例 ] code === 0 代表没有错误
return dataAxios[ruleResult.data_key] return dataAxios[ruleResult.data_key];
default: default:
// 不是正确的 code // 不是正确的 code
console.log(dataAxios) console.log(dataAxios);
errorCreate(`${dataAxios[ruleResult.message_key]}`) errorCreate(`${dataAxios[ruleResult.message_key]}`);
break break;
} }
}, },
...@@ -151,52 +153,53 @@ service.interceptors.response.use( ...@@ -151,52 +153,53 @@ service.interceptors.response.use(
if (error && error.response) { if (error && error.response) {
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:
error.message = "请求错误" error.message = "请求错误";
break break;
case 401: case 401:
error.message = "未授权,请登录" error.message = "未授权,请登录";
break break;
case 403: case 403:
error.message = "拒绝访问" error.message = "拒绝访问";
break break;
case 404: case 404:
error.message = `请求地址出错: ${error.response.config.url}` error.message = `请求地址出错: ${error.response.config.url}`;
break break;
case 408: case 408:
error.message = "请求超时" error.message = "请求超时";
break break;
case 500: case 500:
error.message = "服务器内部错误" error.message = "服务器内部错误";
break break;
case 501: case 501:
error.message = "服务未实现" error.message = "服务未实现";
break break;
case 502: case 502:
error.message = "网关错误" error.message = "网关错误";
break break;
case 503: case 503:
error.message = "服务不可用" error.message = "服务不可用";
break break;
case 504: case 504:
error.message = "网关超时" error.message = "网关超时";
break break;
case 505: case 505:
error.message = "HTTP版本不受支持" error.message = "HTTP版本不受支持";
break break;
default: default:
break break;
} }
} }
if (error && error?.stack?.indexOf("timeout") > -1) { if (error && error?.stack?.indexOf("timeout") > -1) {
if (error.stack.indexOf("5000ms")) { if (error.stack.indexOf("5000ms")) {
error.message = "查询超时,请刷新页面重试!" error.message = "查询超时,请刷新页面重试!";
} }
// console.log('超时') // console.log('超时')
// console.log(error) // console.log(error)
} }
store.commit("d2admin/loading/set", false) store.commit("d2admin/loading/set", false);
if (!error.__CANCEL__) errorLog(error) // 取消请求 不做错误提示 if (!error.__CANCEL__)
return Promise.reject(error) errorLog(error); // 取消请求 不做错误提示
} return Promise.reject(error);
) },
export default service );
export default service;
...@@ -279,7 +279,7 @@ export const routerName = { ...@@ -279,7 +279,7 @@ export const routerName = {
parentId: "90905", parentId: "90905",
label: "批量下载发货签收单", label: "批量下载发货签收单",
category: "Button", category: "Button",
type: "plain", type: "primary",
handle: "downloadDeliveryPdf", handle: "downloadDeliveryPdf",
}, },
{ {
......
...@@ -42,44 +42,11 @@ ...@@ -42,44 +42,11 @@
<auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" /> <auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" />
</d2-table> </d2-table>
</div> </div>
<d2-dialog :title="'上传文件'" :is-visible="fileVisible" @closeDialog="handleImport" @confirmDialog="handleConfirmImport"> <d2-file-import-dialog :is-visible="fileVisible"
<slot> title="上传文件"
<el-form :model="fileForm" ref="fileRuleForm" :rules="fileRules" label-width="120px"> @closeDialog="handleImport"
<!-- <el-form-item v-if="userInfo.beSuper" label="园区店:" prop="yqMerchantId"> @confirmDialog="handleConfirmImport"
<el-select v-model="fileForm.yqMerchantId"> @downloadTemplate="exportTemplate" />
<el-option v-for="item in baseData.parkServiceList.filter(i => i.merchantName !== '全部')"
:key="item.merchantId" :value="item.merchantId" :label="item.merchantName" />
</el-select>
</el-form-item> -->
<el-form-item label="导入文件:" prop="fileName">
<el-col :span="16">
<el-input readonly v-model="fileForm.fileName" />
</el-col>
<el-col :span="4" class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file" id="fileUpload" class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<!-- <el-link href="http://img01.glsx.com.cn/upload/salesexcel/预录订单导入模板.xlsx" type="primary"
class="import-template" icon="el-icon-link">
模版下载
</el-link> -->
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
<el-form-item v-show="showNum">
<span>导入成功{{ importNum.succNum }}条,导入失败{{ importNum.failNum }}条</span>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
</d2-container> </d2-container>
</template> </template>
...@@ -97,17 +64,7 @@ export default { ...@@ -97,17 +64,7 @@ export default {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
hideVisible: false, hideVisible: false,
fileVisible: false, fileVisible: false,
fileForm: {},
total: 0, total: 0,
showNum: false,
importNum: {
succNum: 0,
failNum: 0
},
fileRules: {
yqMerchantId: [{ required: true, message: '请选择园区店', trigger: 'change' }],
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
tableSearchForm: {}, tableSearchForm: {},
searchForm: { searchForm: {
shopOrYqMerchantId: '', shopOrYqMerchantId: '',
...@@ -359,30 +316,7 @@ export default { ...@@ -359,30 +316,7 @@ export default {
handleShowHide() { handleShowHide() {
this.hideVisible = !this.hideVisible this.hideVisible = !this.hideVisible
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过9M')
document.getElementById('fileUpload').value = ''
}
},
handleImport() { handleImport() {
this.fileForm = {
fileName: ''
}
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
}, },
exportFailList(list) { exportFailList(list) {
...@@ -396,17 +330,14 @@ export default { ...@@ -396,17 +330,14 @@ export default {
formatJson(filterVal, jsonData) { formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => v[j])) return jsonData.map(v => filterVal.map(j => v[j]))
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
recordUpload(params).then(res => { recordUpload(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -417,8 +348,6 @@ export default { ...@@ -417,8 +348,6 @@ export default {
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
handleAdd() { handleAdd() {
this.close({ tagName: '/editCustomer' }) this.close({ tagName: '/editCustomer' })
...@@ -479,29 +408,4 @@ export default { ...@@ -479,29 +408,4 @@ export default {
margin: 0 0; margin: 0 0;
} }
.record-list .m-l-md {
margin-left: 20px;
}
.record-list .import-btn {
position: relative;
}
.record-list .import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.record-list .import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -48,7 +48,7 @@ const STRATEGY_FORM_2456 = [ ...@@ -48,7 +48,7 @@ const STRATEGY_FORM_2456 = [
let { let {
executePersons executePersons
} = val } = val
return executePersons.map(item => item.username).join('、') return executePersons.map(item => item.username).join('/')
}, },
hide: (val) => { hide: (val) => {
let { let {
...@@ -74,17 +74,16 @@ const STRATEGY_FORM_3 = [ ...@@ -74,17 +74,16 @@ const STRATEGY_FORM_3 = [
}, },
] ]
const STRATEGY_FORM_7 = [{ const STRATEGY_FORM_7 = [
label: '留言人', CREATED,
key: 'createdBy', CREATED_DATE,
},
{ {
label: '处理人', label: '处理人',
format: (val) => { format: (val) => {
let { let {
executePersons executePersons
} = val } = val
return executePersons.map(item => item.username).join('、') || '-' return executePersons.map(item => item.username).join('/') || '-'
}, },
}, },
] ]
......
...@@ -192,23 +192,25 @@ export default { ...@@ -192,23 +192,25 @@ export default {
} }
}, },
strategyDetailFormList () { strategyDetailFormList () {
let { strategyType } = this.detailInfo, const { strategyType } = this.detailInfo
list = [2, 4, 5, 6].includes(strategyType) const formMap = {
? STRATEGY_FORM_2456 : 0: STRATEGY_FORM_01,
[0, 1].includes(strategyType) 1: STRATEGY_FORM_01,
? STRATEGY_FORM_01 2: STRATEGY_FORM_2456,
: STRATEGY_FORM_3 3: STRATEGY_FORM_3,
if (strategyType == 7) list = STRATEGY_FORM_7 4: STRATEGY_FORM_2456,
else list = [ 5: STRATEGY_FORM_2456,
6: STRATEGY_FORM_2456,
7: STRATEGY_FORM_7
}
const list = formMap[strategyType] || STRATEGY_FORM_2456
return [
{ {
label: '执行策略', label: '执行策略',
format: item => { format: item => {
return STRATEGYTYPEOPTIONS[item.strategyType] return STRATEGYTYPEOPTIONS[item.strategyType]
} }
}, },
...list
]
return [
...list, ...list,
{ {
label: '策略说明', label: '策略说明',
......
...@@ -21,7 +21,7 @@ const STAFF_FORMAT = (label) => { ...@@ -21,7 +21,7 @@ const STAFF_FORMAT = (label) => {
label, label,
format: (val) => { format: (val) => {
let { staffList } = val let { staffList } = val
return staffList.map(item => item.userName).join('、') || '-' return staffList.map(item => item.userName).join('/') || '-'
} }
} }
} }
......
...@@ -459,23 +459,10 @@ ...@@ -459,23 +459,10 @@
<download-account-dialog :account-visible="accountVisible" v-if="accountVisible" :scene="searchForm.sceneType" @custTmpl="handleCustTmpl" @handleBill="handleBill" @accountClose="accountClose" /> <download-account-dialog :account-visible="accountVisible" v-if="accountVisible" :scene="searchForm.sceneType" @custTmpl="handleCustTmpl" @handleBill="handleBill" @accountClose="accountClose" />
<!-- 出库面板 --> <!-- 出库面板 -->
<warehouse-detail v-if="warehouseVisible" :warehouse-visible="warehouseVisible" :order-info-id="orderId" @handleDrawerClose="handleDrawerClose" /> <warehouse-detail v-if="warehouseVisible" :warehouse-visible="warehouseVisible" :order-info-id="orderId" @handleDrawerClose="handleDrawerClose" />
<d2-dialog :title="'上传文件'" :is-visible="fileVisible" @closeDialog="handleImport" @confirmDialog="handleConfirmImport"> <d2-file-import-dialog :is-visible="fileVisible"
<slot> title="上传文件"
<el-form :model="fileForm" ref="fileRuleForm" :rules="fileRules" label-width="120px"> @closeDialog="handleImport"
<el-form-item label="导入文件:" prop="fileName"> @confirmDialog="handleConfirmImport" />
<el-col :span="16">
<el-input readonly v-model="fileForm.fileName" />
</el-col>
<el-col :span="4" class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file" id="fileUpload" class="import-input" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" @change="importFile($event)" />
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<tmpl-drawer v-if="tmplDrawerVisible" :tmplDrawerVisible="tmplDrawerVisible" :type="tmplInfo.type" :tmplSelectList="tmplInfo.tmplSelectList" @handleConfirm="handleCustConfirm" @handleClose="handleCustVisible"></tmpl-drawer> <tmpl-drawer v-if="tmplDrawerVisible" :tmplDrawerVisible="tmplDrawerVisible" :type="tmplInfo.type" :tmplSelectList="tmplInfo.tmplSelectList" @handleConfirm="handleCustConfirm" @handleClose="handleCustVisible"></tmpl-drawer>
<system-bill-dialog v-if="billVisible" :billVisible="billVisible" :billTmplInfo="billTmplInfo" @handleClose="handleBillVisible" @handleConfirm="handleBillVisible"></system-bill-dialog> <system-bill-dialog v-if="billVisible" :billVisible="billVisible" :billTmplInfo="billTmplInfo" @handleClose="handleBillVisible" @handleConfirm="handleBillVisible"></system-bill-dialog>
</div> </div>
...@@ -748,10 +735,6 @@ export default { ...@@ -748,10 +735,6 @@ export default {
/** 根据场景控制页面显示隐藏end */ /** 根据场景控制页面显示隐藏end */
sceneList: sceneList, sceneList: sceneList,
positionTypeList: [], // 商品部位数据 positionTypeList: [], // 商品部位数据
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }]
},
fileForm: {},
fileVisible: false, fileVisible: false,
tmplDrawerVisible: false, tmplDrawerVisible: false,
tmplInfo: { tmplInfo: {
...@@ -899,46 +882,17 @@ export default { ...@@ -899,46 +882,17 @@ export default {
}, },
handleImport() { handleImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields() },
}, handleConfirmImport({ fileName, fileData }) {
// 上传文件,转码为base64
importFile(e) {
console.log(e)
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = (event) => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(",")
this.fileInfo =
e.target.files[0].name.split(".")[
e.target.files[0].name.split(".")?.length - 1
] +
"@" +
arrBase64[1]
document.getElementById("fileUpload").value = ""
}
} else {
this.notice.errorTips("上传文件不可超过9M")
document.getElementById('fileUpload').value = ''
}
},
handleConfirmImport() {
this.$refs.fileRuleForm.validate((valid) => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
api.uploadFile(params).then((res) => { api.uploadFile(params).then((res) => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [ const list = [
...this.updateList, ...this.updateList,
{ {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: "upload" type: "upload"
...@@ -949,12 +903,9 @@ export default { ...@@ -949,12 +903,9 @@ export default {
this.handleBatchImport() this.handleBatchImport()
} }
}) })
}
})
}, },
handleBatchImport() { handleBatchImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
}, },
async getBaseData() { async getBaseData() {
this.baseData.channelTypeList = await this.get(BaseData.channelType) this.baseData.channelTypeList = await this.get(BaseData.channelType)
...@@ -1527,26 +1478,4 @@ export default { ...@@ -1527,26 +1478,4 @@ export default {
margin-right: 5px; margin-right: 5px;
display: inline-block; display: inline-block;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -31,8 +31,9 @@ ...@@ -31,8 +31,9 @@
<el-select v-else <el-select v-else
v-model="scope.row.inventoryType" v-model="scope.row.inventoryType"
placeholder="请选择"> placeholder="请选择">
<el-option label="虚拟" :value="1"></el-option>
<el-option label="实物" :value="2"></el-option> <el-option label="实物" :value="2"></el-option>
<el-option label="虚拟" :value="1"></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
......
...@@ -178,39 +178,11 @@ ...@@ -178,39 +178,11 @@
@handleBatchCopyClose="handleBatchCopyClose" @handleBatchCopyClose="handleBatchCopyClose"
@handleBatchCopyConfirm="handleBatchCopyConfirm"> @handleBatchCopyConfirm="handleBatchCopyConfirm">
</BatchCopyDialog> </BatchCopyDialog>
<d2-dialog :is-visible="fileVisible" <d2-file-import-dialog :is-visible="fileVisible"
title="上传文件" title="上传文件"
@closeDialog="handleBatchImport" @closeDialog="handleBatchImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate" />
<el-form ref="fileRuleForm"
label-width="120px"
:model="fileForm"
:rules="fileRules">
<el-form-item label="导入文件:" prop="fileName">
<el-col :span="16">
<el-input v-model="fileForm.fileName" readonly />
</el-col>
<el-col class="m-l-md" :span="4">
<el-button class="import-btn">
导入文件
<input id="fileUpload"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
class="import-input"
type="file"
@change="importFile($event)">
<el-link class="import-template"
icon="el-icon-link"
type="primary"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 批量修改库存模式弹窗 --> <!-- 批量修改库存模式弹窗 -->
<BatchModifyInventoryDialog :selected-data="selectedTableData" <BatchModifyInventoryDialog :selected-data="selectedTableData"
...@@ -657,22 +629,21 @@ export default { ...@@ -657,22 +629,21 @@ export default {
confId: "3", confId: "3",
confValue: "已失效", confValue: "已失效",
}], }],
inventoryTypeList: [{ inventoryTypeList: [
confId: 1, {
confValue: "虚拟",
}, {
confId: 2, confId: 2,
confValue: "实物", confValue: "实物",
}], },
{
confId: 1,
confValue: "虚拟",
},
],
}, },
selfBuildGoodsType: baseConfig.selfBuildGoodsType || "", selfBuildGoodsType: baseConfig.selfBuildGoodsType || "",
batchCopySelectScene: "", // 批量复制选中的场景值 batchCopySelectScene: "", // 批量复制选中的场景值
batchCopyVisible: false, batchCopyVisible: false,
batchCopySelectData: [], // 批量辅助选中的上架数据 batchCopySelectData: [], // 批量辅助选中的上架数据
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }],
},
fileForm: {},
fileVisible: false, fileVisible: false,
batchModifyInventoryVisible: false, batchModifyInventoryVisible: false,
selectedTableData: [], selectedTableData: [],
...@@ -845,37 +816,15 @@ export default { ...@@ -845,37 +816,15 @@ export default {
}, },
handleBatchImport() { handleBatchImport() {
this.fileVisible = !this.fileVisible; this.fileVisible = !this.fileVisible;
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields();
},
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024;
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name);
// // 转码base64
const reader = new FileReader();
reader.readAsDataURL(e.target.files[0]);
reader.onload = (event) => {
const imgFile = event.target.result;
const arrBase64 = imgFile.split(",");
this.fileInfo = e.target.files[0].name.split(".")[e.target.files[0].name.split(".")?.length - 1] + "@" + arrBase64[1];
document.getElementById("fileUpload").value = "";
};
} else {
this.notice.errorTips("上传文件不可超过9M");
}
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate((valid) => {
if (valid) {
let params = { let params = {
file: this.fileInfo, file: fileData,
}; };
groundingImport(params).then((res) => { groundingImport(params).then((res) => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: "upload", type: "upload",
...@@ -886,8 +835,6 @@ export default { ...@@ -886,8 +835,6 @@ export default {
this.handleBatchImport(); this.handleBatchImport();
} }
}); });
}
});
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
...@@ -1181,30 +1128,5 @@ export default { ...@@ -1181,30 +1128,5 @@ export default {
margin-left: 8px; margin-left: 8px;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
} }
</style> </style>
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
default: null, default: null,
}, },
commodityInfoSkuId: { commodityInfoSkuId: {
type: String, type: [String, Number],
default: "", default: "",
}, },
positionTypeList: { positionTypeList: {
......
...@@ -71,8 +71,7 @@ ...@@ -71,8 +71,7 @@
<span style="margin-right: 10px;"> <span style="margin-right: 10px;">
<auth-button :data="getAuthButtonData(scope.scope)" :show-btn-ids="['9030703']" /> <auth-button :data="getAuthButtonData(scope.scope)" :show-btn-ids="['9030703']" />
</span> </span>
<auth-button v-if="(!scope.scope.goodsInfo || scope.scope.goodsInfo.scrmFlag !== 'Y') && !scope.scope.isLastSku" <auth-button :data="getAuthButtonData(scope.scope)"
:data="getAuthButtonData(scope.scope)"
:show-btn-ids="['9030706']" /> :show-btn-ids="['9030706']" />
</div> </div>
</template> </template>
...@@ -562,6 +561,8 @@ export default { ...@@ -562,6 +561,8 @@ export default {
} else if (isSkuMode) { } else if (isSkuMode) {
// Y 模式:listData 直接为 SKU 平铺,逐条处理 // Y 模式:listData 直接为 SKU 平铺,逐条处理
val.isLastSku = (baseGoodsIdCount[val.baseGoodsId || val.id] || 0) === 1; val.isLastSku = (baseGoodsIdCount[val.baseGoodsId || val.id] || 0) === 1;
// console.log(val.isLastSku, baseGoodsIdCount, val.baseGoodsId, val.id, baseGoodsIdCount[val.baseGoodsId || val.id], "val");
this._processSkuItem(val, val, null); this._processSkuItem(val, val, null);
} else { } else {
this._setSpuOnlyDefaults(val); this._setSpuOnlyDefaults(val);
...@@ -811,13 +812,15 @@ export default { ...@@ -811,13 +812,15 @@ export default {
}).then(() => {}); }).then(() => {});
return; return;
} }
console.log(row);
this.$confirm(isSpuRow ? spuConfirmMsg : skuConfirmMsg, "提示", { this.$confirm(isSpuRow ? spuConfirmMsg : skuConfirmMsg, "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
type: "warning", type: "warning",
}).then(() => { }).then(() => {
const req = isSpuRow const req = isSpuRow
? baseGoodsDelete({ baseGoodsId: row.id }) ? baseGoodsDelete({ baseGoodsId: row.id })
: upgradeGoodsDelete({ id: row.skuId }); : upgradeGoodsDelete({ id: row.upgradeGoodsId || row.skuId });
req.then((res) => { req.then((res) => {
this.notice.okTips(); this.notice.okTips();
this.$refs.productManageTable.refreshTable(); this.$refs.productManageTable.refreshTable();
...@@ -832,6 +835,14 @@ export default { ...@@ -832,6 +835,14 @@ export default {
this.commodityDetailInfoId = ""; this.commodityDetailInfoId = "";
this.commodityDetailInfoSkuId = ""; this.commodityDetailInfoSkuId = "";
// 仅查看SKU模式下,始终打开SKU详情抽屉
if (this.searchForm.showSkuMode === "Y") {
this.commodityDetailInfoId = row.baseGoodsId || row.id;
this.commodityDetailInfoSkuId = row.upgradeGoodsId;
this.drawerSkuDetailVisible = true;
this.drawerDetailVisible = false;
return;
}
// 根据行类型判断:有 upgradeGoodsList 为 SPU 行用 SPU 抽屉,否则为 SKU 行用 SKU 抽屉 // 根据行类型判断:有 upgradeGoodsList 为 SPU 行用 SPU 抽屉,否则为 SKU 行用 SKU 抽屉
const isSpuRow = row.upgradeGoodsList && row.upgradeGoodsList.length > 0; const isSpuRow = row.upgradeGoodsList && row.upgradeGoodsList.length > 0;
if (isSpuRow) { if (isSpuRow) {
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
* 使用方需提供: $refs.headerRow (表头 tr), $refs.bodyTable (表体 table) * 使用方需提供: $refs.headerRow (表头 tr), $refs.bodyTable (表体 table)
*/ */
const MIN_COL_WIDTH = 80; const MIN_COL_WIDTH = 80;
const MAX_COL_WIDTH = 400; const MAX_COL_WIDTH = 800;
const RESIZE_DELTA_SCALE = 2;
export default { export default {
data() { data() {
...@@ -111,7 +112,7 @@ export default { ...@@ -111,7 +112,7 @@ export default {
this._resizeState = { index, startX, startWidth, minW, maxW }; this._resizeState = { index, startX, startWidth, minW, maxW };
this._onResizeMove = (ev) => { this._onResizeMove = (ev) => {
const delta = ev.clientX - startX; const delta = (ev.clientX - startX) * RESIZE_DELTA_SCALE;
let newWidth = Math.round(startWidth + delta); let newWidth = Math.round(startWidth + delta);
newWidth = Math.max(minW, Math.min(maxW, newWidth)); newWidth = Math.max(minW, Math.min(maxW, newWidth));
this.$set(this.columnWidths, index, newWidth); this.$set(this.columnWidths, index, newWidth);
......
...@@ -117,29 +117,11 @@ ...@@ -117,29 +117,11 @@
:selected-scene="batchCopySelectScene" @handleBatchCopyConfirm="handleBatchCopyConfirm" :selected-scene="batchCopySelectScene" @handleBatchCopyConfirm="handleBatchCopyConfirm"
@handleBatchCopyClose="handleBatchCopyClose"> @handleBatchCopyClose="handleBatchCopyClose">
</batch-copy-dialog> </batch-copy-dialog>
<d2-dialog :title="'上传文件'" :is-visible="fileVisible" @closeDialog="handleBatchImport" <d2-file-import-dialog :is-visible="fileVisible"
@confirmDialog="handleConfirmImport"> title="上传文件"
<slot> @closeDialog="handleBatchImport"
<el-form :model="fileForm" ref="fileRuleForm" :rules="fileRules" label-width="120px"> @confirmDialog="handleConfirmImport"
<el-form-item label="导入文件:" prop="fileName"> @downloadTemplate="exportTemplate" />
<el-col :span="16">
<el-input readonly v-model="fileForm.fileName" />
</el-col>
<el-col :span="4" class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file" id="fileUpload" class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary" class="import-template" icon="el-icon-link" @click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
</d2-container> </d2-container>
</template> </template>
<script> <script>
...@@ -520,10 +502,6 @@ export default { ...@@ -520,10 +502,6 @@ export default {
batchCopySelectScene: '', // 批量复制选中的场景值 batchCopySelectScene: '', // 批量复制选中的场景值
batchCopyVisible: false, batchCopyVisible: false,
batchCopySelectData: [], // 批量辅助选中的上架数据 batchCopySelectData: [], // 批量辅助选中的上架数据
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
fileForm: {},
fileVisible: false fileVisible: false
} }
}, },
...@@ -704,38 +682,15 @@ export default { ...@@ -704,38 +682,15 @@ export default {
}, },
handleBatchImport() { handleBatchImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields() },
}, handleConfirmImport({ fileName, fileData }) {
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过9M')
document.getElementById('fileUpload').value = ''
}
},
handleConfirmImport() {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
groundingImport(params).then(res => { groundingImport(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -746,8 +701,6 @@ export default { ...@@ -746,8 +701,6 @@ export default {
this.handleBatchImport() this.handleBatchImport()
} }
}) })
}
})
}, },
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
...@@ -982,30 +935,5 @@ export default { ...@@ -982,30 +935,5 @@ export default {
margin-left: 8px; margin-left: 8px;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
} }
</style> </style>
...@@ -93,52 +93,11 @@ ...@@ -93,52 +93,11 @@
</slot> </slot>
</d2-dialog> </d2-dialog>
<!-- 导入门店设置 --> <d2-file-import-dialog :is-visible="fileVisible"
<d2-dialog :title="'上传文件'" :is-visible="fileVisible" @closeDialog="handleImport" title="上传文件"
@confirmDialog="handleConfirmImport" width="600px"> @closeDialog="handleImport"
<slot> @confirmDialog="handleConfirmImport"
<div> @downloadTemplate="downLoadTemplate" />
<el-form :model="fileForm" :rules="fileRules" ref="fileRuleForm" label-width="120px">
<el-form-item label="导入文件:" prop="fileName">
<el-col :span="16">
<el-input readonly v-model="fileForm.fileName" />
</el-col>
<el-col :span="4" class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file" id="fileUpload" class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)" />
<!-- href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/对账单模版.xlsx" -->
<el-link type="primary" class="import-template" @click="downLoadTemplate" icon="el-icon-link">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
<span v-show="showNum">
<div class="upload-statistics">
<div class="quantity">
<div class="success">{{ importNum.successCount }}</div>
<div>有效数据</div>
</div>
<div class="line"></div>
<div class="quantity">
<div class="err">{{ importNum.failCount }}</div>
<div>异常数据</div>
</div>
</div>
<div class="abnormal">
<p>数据异常的可能原因:</p>
<p class="color-33">
1. 订单编号不匹配
</p>
</div>
</span>
</div>
</slot>
</d2-dialog>
</div> </div>
</template> </template>
...@@ -162,15 +121,6 @@ export default { ...@@ -162,15 +121,6 @@ export default {
data() { data() {
return { return {
fileVisible: false, fileVisible: false,
showNum: false,
importNum: {
succNum: 0,
failNum: 0
},
fileForm: {},
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }]
},
pickerOptions: { pickerOptions: {
disabledDate: (time) => { disabledDate: (time) => {
const maxMonth = dayjs().subtract(-1, 'months').endOf('month') const maxMonth = dayjs().subtract(-1, 'months').endOf('month')
...@@ -297,51 +247,14 @@ export default { ...@@ -297,51 +247,14 @@ export default {
result && downLoadFile(result) result && downLoadFile(result)
}) })
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
console.log(e)
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = (event) => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(",")
this.fileInfo =
e.target.files[0].name.split(".")[1] + "@" + arrBase64[1]
// orderManage.pictureUpload({ file: this.fileInfo }).then((res) => {
// if (res) {
// this.fileForm.fileUrl = res
// }
// // const refName = "file" + row.id
// // const refName = "file"
// e.target.value = ""
// // this.$refs[refName].value = ""
// })
document.getElementById("fileUpload").value = ""
}
} else {
this.notice.errorTips("上传文件不可超过9M")
document.getElementById("fileUpload").value = ""
}
},
handleImport() { handleImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate((valid) => { merchantOutputValueTargetImport({ file: fileData }).then((result) => {
if (valid) {
// var params = {
// fileUrl: this.fileForm.fileUrl
// }
merchantOutputValueTargetImport({ file: this.fileInfo }).then((result) => {
if (result) { if (result) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: result, uuid: result,
type: 'upload' type: 'upload'
...@@ -351,56 +264,6 @@ export default { ...@@ -351,56 +264,6 @@ export default {
this.notice.okTips('上传成功') this.notice.okTips('上传成功')
this.handleImport() this.handleImport()
} }
// console.log(result, 'result')
// const { url, dataList } = result
// console.log(url, 'url')
// if (url) {
// // this.$message.error('上传失败')
// this.$message.error('上传失败')
// downLoadFile(url)
// }
// if (dataList) {
// this.$message.success('上传成功')
// this.fileVisible = false
// this.hasPage = false
// // const listFilter = result.list
// this.tableData = dataList.map((item) => {
// item.dataMonth = this.search.targetDate
// item.isEdit = true
// item.areaSupervision = item.areaSupervision || {}
// item.residentManager = item.residentManager || {}
// item.area = item.area || ''
// // item.residentManagerOptionsList = item.residentManager?{}
// if (item.residentManager) {
// item.residentManagerOptionsList = [{
// userId: item.residentManager.userId,
// userName: item.residentManager.userName,
// userNum: item.residentManager.userNum,
// userType: item.residentManager.userType
// }]
// } else {
// item.residentManagerOptionsList = []
// }
// return item
// })
// // this.tableTotal = result.total
// }
})
// .catch((err) => {
// })
// orderManage.orderEndExportApi(params).then((res) => {
// if (res) {
// this.showNum = true
// this.importNum = {
// successCount: res.successCount,
// failCount: res.failCount
// }
// this.$message.success('上传成功')
// // this.handleImport()
// }
// })
}
}) })
}, },
// 每页条数 // 每页条数
...@@ -602,66 +465,4 @@ export default { ...@@ -602,66 +465,4 @@ export default {
margin-top: 94px; margin-top: 94px;
} }
.upload-wrap {
display: flex;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
.m-l-md {
margin-left: 20px;
}
.upload-statistics {
display: flex;
align-items: center;
justify-content: space-between;
margin: 30px 70px;
.quantity {
font-size: 14px;
color: #333333;
text-align: center;
.success {
font-size: 26px;
color: #2cca74;
text-align: center;
margin-bottom: 4px;
}
.err {
font-size: 26px;
color: #eb4e4e;
text-align: center;
margin-bottom: 4px;
}
}
.line {
width: 1px;
height: 56px;
background: #e8e8ea;
}
}
</style> </style>
...@@ -24,26 +24,11 @@ ...@@ -24,26 +24,11 @@
<auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" /> <auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" />
</d2-table> </d2-table>
</div> </div>
<d2-dialog :title="'上传文件'" :is-visible="fileVisible" @closeDialog="handleImport" @confirmDialog="handleConfirmImport"> <d2-file-import-dialog :is-visible="fileVisible"
<slot> title="上传文件"
<el-form :model="fileForm" ref="fileRuleForm" :rules="fileRules" label-width="120px"> @closeDialog="handleImport"
<el-form-item label="导入文件:" prop="fileName"> @confirmDialog="handleConfirmImport"
<el-col :span="16"> @downloadTemplate="exportTemplate" />
<el-input readonly v-model="fileForm.fileName" />
</el-col>
<el-col :span="4" class="m-l-md">
<el-button class="import-btn">导入文件
<input type="file" id="fileUpload" class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link href="http://img01.glsx.com.cn/upload/salesexcel/企微推送对象导入模板.xlsx" type="primary"
class="import-template" icon="el-icon-link">模版下载</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<d2-dialog :title="chooseType" @closeDialog="handleObject" @confirmDialog="handleConfirmObject" <d2-dialog :title="chooseType" @closeDialog="handleObject" @confirmDialog="handleConfirmObject"
:is-visible="pushVisible"> :is-visible="pushVisible">
<slot> <slot>
...@@ -92,9 +77,7 @@ export default { ...@@ -92,9 +77,7 @@ export default {
data() { data() {
return { return {
state, state,
// 上传文件数据
fileVisible: false, fileVisible: false,
fileForm: {},
// 搜索表格数据 // 搜索表格数据
tableSearchForm: {}, tableSearchForm: {},
searchForm: { searchForm: {
...@@ -170,9 +153,6 @@ export default { ...@@ -170,9 +153,6 @@ export default {
} }
] ]
}, },
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
changeList: [], changeList: [],
superviseList: [], superviseList: [],
residentialList: [], residentialList: [],
...@@ -196,25 +176,6 @@ export default { ...@@ -196,25 +176,6 @@ export default {
methods: { methods: {
...mapActions('d2admin/user', ['actionSetDownloadList']), ...mapActions('d2admin/user', ['actionSetDownloadList']),
...mapMutations('d2admin/user', ['setUpdateRefesh']), ...mapMutations('d2admin/user', ['setUpdateRefesh']),
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过9M')
document.getElementById('fileUpload').value = ''
}
},
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
this.tableSearchForm = deepClone(this.searchForm) this.tableSearchForm = deepClone(this.searchForm)
...@@ -224,21 +185,17 @@ export default { ...@@ -224,21 +185,17 @@ export default {
keyDowmGetList() { keyDowmGetList() {
this.$refs.outputValueTable.refreshTable() this.$refs.outputValueTable.refreshTable()
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
importContact(params).then(res => { importContact(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
// labelText: ''
}] }]
this.actionSetDownloadList({ list, type: 'updateList' }) this.actionSetDownloadList({ list, type: 'updateList' })
...@@ -246,16 +203,13 @@ export default { ...@@ -246,16 +203,13 @@ export default {
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
handleImport() { handleImport() {
// this.fileForm = {
// fileName: ''
// }
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
}, },
exportTemplate() {
window.open('http://img01.glsx.com.cn/upload/salesexcel/企微推送对象导入模板.xlsx')
},
merchantData(type) { merchantData(type) {
const superviseParams = { const superviseParams = {
currentPage: 1, currentPage: 1,
...@@ -401,31 +355,5 @@ export default { ...@@ -401,31 +355,5 @@ export default {
.outputValue-list { .outputValue-list {
position: relative; position: relative;
} }
.outputValue-list .m-l-md {
margin-left: 20px;
}
.outputValue-list .import-btn {
position: relative;
}
.outputValue-list .import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.outputValue-list .import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -605,46 +605,11 @@ ...@@ -605,46 +605,11 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
@size-change="handleSizeChange" /> @size-change="handleSizeChange" />
</div> </div>
<d2-dialog :is-visible="fileVisible" <d2-file-import-dialog :is-visible="fileVisible"
title="上传文件" title="上传文件"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate" />
<el-form ref="fileRuleForm"
label-width="120px"
:model="fileForm"
:rules="fileRules">
<el-form-item label="导入文件:" prop="fileName">
<el-col :span="16">
<el-input v-model="fileForm.fileName" readonly />
</el-col>
<el-col class="m-l-md" :span="4">
<el-button class="import-btn">
导入文件
<input id="fileUpload"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
class="import-input"
type="file"
@change="importFile($event)" />
<el-link class="import-template"
href="http://img01.glsx.com.cn/upload/salesexcel/园区店客户订单导入模板.xlsx"
icon="el-icon-link"
type="primary">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
<el-form-item v-show="showNum">
<span>
导入成功{{ importNum.succNum }}条,导入失败{{
importNum.failNum
}}条
</span>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 选择分账规则 --> <!-- 选择分账规则 -->
<ChooseRuleDialog v-if="ruleVisible" <ChooseRuleDialog v-if="ruleVisible"
...@@ -714,15 +679,6 @@ export default { ...@@ -714,15 +679,6 @@ export default {
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
fileForm: {},
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }],
},
showNum: false,
importNum: {
succNum: 0,
failNum: 0,
},
fileVisible: false, fileVisible: false,
waitOrderNum: 0, waitOrderNum: 0,
statusOpts: { statusOpts: {
...@@ -1394,50 +1350,20 @@ export default { ...@@ -1394,50 +1350,20 @@ export default {
}, },
handleImport() { handleImport() {
this.fileVisible = !this.fileVisible; this.fileVisible = !this.fileVisible;
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields();
},
// 上传文件,转码为base64
importFile(e) {
// console.log(e)
const size = e.target.files[0].size / 1024 / 1024;
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name);
// // 转码base64
const reader = new FileReader();
reader.readAsDataURL(e.target.files[0]);
reader.onload = (event) => {
const imgFile = event.target.result;
const arrBase64 = imgFile.split(",");
this.fileInfo
= e.target.files[0].name.split(".")[1] + "@" + arrBase64[1];
document.getElementById("fileUpload").value = "";
};
} else {
this.notice.errorTips("上传文件不可超过9M");
document.getElementById("fileUpload").value = "";
}
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate((valid) => {
if (valid) {
let params = { let params = {
// advanceUserId: this.userInfo.detail.uuid, file: fileData,
// advanceUserName: this.userInfo.merchantAccountLevel == 4 ? this.userInfo.detail.userName : this.userInfo.detail.merchantName,
// yqMerchantId: this.userInfo.beSuper ? this.fileForm.yqMerchantId : this.userInfo.detail.merchantId,
file: this.fileInfo,
}; };
orderImport(params).then((res) => { orderImport(params).then((res) => {
// console.log(res)
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [ const list = [
...this.updateList, ...this.updateList,
{ {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: "upload", type: "upload",
// labelText: ''
}, },
]; ];
...@@ -1445,22 +1371,11 @@ export default { ...@@ -1445,22 +1371,11 @@ export default {
this.notice.okTips("上传成功"); this.notice.okTips("上传成功");
this.handleImport(); this.handleImport();
} }
// this.showNum = !!res.failNum
// res.succNum && this.$refs.recordTable.refreshTable()
// if (res.failNum) {
// this.importNum = {
// succNum: res.succNum,
// failNum: res.failNum
// }
// this.exportFailList(res.errorList)
// return true
// }
// this.handleImport()
// this.notice.okTips('上传成功')
});
}
}); });
}, },
exportTemplate() {
window.open('http://img01.glsx.com.cn/upload/salesexcel/园区店客户订单导入模板.xlsx');
},
handleReset() { handleReset() {
this.searchForm = { this.searchForm = {
sceneType: 0, sceneType: 0,
...@@ -1999,30 +1914,4 @@ export default { ...@@ -1999,30 +1914,4 @@ export default {
margin-top: 40px; margin-top: 40px;
} }
.order-list .m-l-md {
margin-left: 20px;
}
// .order-list
.order-list .import-btn {
position: relative;
}
.order-list .import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.order-list .import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -607,17 +607,14 @@ ...@@ -607,17 +607,14 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
@size-change="handleSizeChange" /> @size-change="handleSizeChange" />
</div> </div>
<d2-dialog :is-visible="fileVisible" <d2-file-import-dialog :is-visible="fileVisible"
title="上传文件" title="上传文件"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate">
<el-form ref="fileRuleForm" <template #prepend>
label-width="120px" <el-form-item label="选择门店:">
:model="fileForm" <el-select v-model="selectedMerchantId"
:rules="fileRules">
<el-form-item label="选择门店:" prop="merchantId">
<el-select v-model="fileForm.merchantId"
filterable filterable
:loading="loading" :loading="loading"
placeholder="请输入关键字" placeholder="请输入关键字"
...@@ -632,38 +629,8 @@ ...@@ -632,38 +629,8 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="导入文件:" prop="fileName"> </template>
<el-col :span="16"> </d2-file-import-dialog>
<el-input v-model="fileForm.fileName" readonly />
</el-col>
<el-col class="m-l-md" :span="4">
<el-button class="import-btn">
导入文件
<input id="fileUpload"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
class="import-input"
type="file"
@change="importFile($event)" />
<!-- href="http://img01.glsx.com.cn/upload/salesexcel/园区店客户订单导入模板.xlsx" -->
<el-link class="import-template"
icon="el-icon-link"
type="primary"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
<el-form-item v-show="showNum">
<span>
导入成功{{ importNum.succNum }}条,导入失败{{
importNum.failNum
}}条
</span>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 选择分账规则 --> <!-- 选择分账规则 -->
<ChooseRuleDialog v-if="ruleVisible" <ChooseRuleDialog v-if="ruleVisible"
...@@ -764,16 +731,7 @@ export default { ...@@ -764,16 +731,7 @@ export default {
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
fileForm: {}, selectedMerchantId: "",
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }],
// merchantId: [{ required: true, message: '请选择门店', trigger: 'change' }]
},
showNum: false,
importNum: {
succNum: 0,
failNum: 0,
},
fileVisible: false, fileVisible: false,
waitOrderNum: 0, waitOrderNum: 0,
statusOpts: { statusOpts: {
...@@ -1416,51 +1374,21 @@ export default { ...@@ -1416,51 +1374,21 @@ export default {
handleImport() { handleImport() {
this.fileVisible = !this.fileVisible; this.fileVisible = !this.fileVisible;
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields(); this.selectedMerchantId = "";
},
// 上传文件,转码为base64
importFile(e) {
// console.log(e)
const size = e.target.files[0].size / 1024 / 1024;
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name);
// // 转码base64
const reader = new FileReader();
reader.readAsDataURL(e.target.files[0]);
reader.onload = (event) => {
const imgFile = event.target.result;
const arrBase64 = imgFile.split(",");
this.fileInfo
= e.target.files[0].name.split(".")[1] + "@" + arrBase64[1];
document.getElementById("fileUpload").value = "";
};
} else {
this.notice.errorTips("上传文件不可超过9M");
document.getElementById("fileUpload").value = "";
}
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate((valid) => {
if (valid) {
let params = { let params = {
// advanceUserId: this.userInfo.detail.uuid, file: fileData,
// advanceUserName: this.userInfo.merchantAccountLevel == 4 ? this.userInfo.detail.userName : this.userInfo.detail.merchantName,
// yqMerchantId: this.userInfo.beSuper ? this.fileForm.yqMerchantId : this.userInfo.detail.merchantId,
file: this.fileInfo,
}; };
orderImport(params).then((res) => { orderImport(params).then((res) => {
// console.log(res)
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [ const list = [
...this.updateList, ...this.updateList,
{ {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: "upload", type: "upload",
// labelText: ''
}, },
]; ];
...@@ -1468,20 +1396,6 @@ export default { ...@@ -1468,20 +1396,6 @@ export default {
this.notice.okTips("上传成功"); this.notice.okTips("上传成功");
this.handleImport(); this.handleImport();
} }
// this.showNum = !!res.failNum
// res.succNum && this.$refs.recordTable.refreshTable()
// if (res.failNum) {
// this.importNum = {
// succNum: res.succNum,
// failNum: res.failNum
// }
// this.exportFailList(res.errorList)
// return true
// }
// this.handleImport()
// this.notice.okTips('上传成功')
});
}
}); });
}, },
handleReset() { handleReset() {
...@@ -1926,8 +1840,8 @@ export default { ...@@ -1926,8 +1840,8 @@ export default {
// 模板下载 // 模板下载
exportTemplate() { exportTemplate() {
let params = {}; let params = {};
if (this.fileForm.merchantId) { if (this.selectedMerchantId) {
params.merchantId = this.fileForm.merchantId; params.merchantId = this.selectedMerchantId;
} else { } else {
this.notice.warningTips("请选择门店"); this.notice.warningTips("请选择门店");
return; return;
...@@ -2101,31 +2015,6 @@ export default { ...@@ -2101,31 +2015,6 @@ export default {
margin-top: 40px; margin-top: 40px;
} }
.order-list .m-l-md {
margin-left: 20px;
}
.order-list .import-btn {
position: relative;
}
.order-list .import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.order-list .import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
.add-dialog { .add-dialog {
// margin: 20px 0; // margin: 20px 0;
......
...@@ -509,7 +509,7 @@ export default { ...@@ -509,7 +509,7 @@ export default {
}, },
handleExport() { handleExport() {
// this.filterSearchTime() // this.filterSearchTime()
let params = deepClone(this.searchForm); let params = deepClone(this.tableSearchForm);
// 处理查询条件时间 // 处理查询条件时间
// for (const key in params) { // for (const key in params) {
// if (key == 'orderTimeStr') { // if (key == 'orderTimeStr') {
......
...@@ -58,42 +58,11 @@ ...@@ -58,42 +58,11 @@
</div> </div>
</d2-table> </d2-table>
</div> </div>
<d2-dialog :title="'上传文件'" <d2-file-import-dialog :is-visible="fileVisible"
:is-visible="fileVisible" title="上传文件"
@closeDialog="handleBatchImport" @closeDialog="handleBatchImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate" />
<el-form :model="fileForm"
ref="fileRuleForm"
:rules="fileRules"
label-width="120px">
<el-form-item label="导入文件:"
prop="fileName">
<el-col :span="16">
<el-input readonly
v-model="fileForm.fileName" />
</el-col>
<el-col :span="4"
class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file"
id="fileUpload"
class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 新增积分记录 --> <!-- 新增积分记录 -->
<add-dialog :add-visible="addVisible" <add-dialog :add-visible="addVisible"
...@@ -300,10 +269,6 @@ export default { ...@@ -300,10 +269,6 @@ export default {
handleVisible: false, handleVisible: false,
recordInfo: {}, recordInfo: {},
params_obj: {}, params_obj: {},
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
fileForm: {},
fileVisible: false, fileVisible: false,
addVisible: false addVisible: false
} }
...@@ -433,50 +398,18 @@ export default { ...@@ -433,50 +398,18 @@ export default {
}, },
handleBatchImport() { handleBatchImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
}, },
// 上传文件,转码为base64 handleConfirmImport({ fileName, fileData }) {
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过9M')
document.getElementById('fileUpload').value = ''
}
},
handleConfirmImport() {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
pointImport(params).then(res => { pointImport(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
// const list = [...this.updateList, {
// name: this.fileForm.fileName,
// ifSuccess: false,
// uuid: res,
// type: 'upload'
// }]
// this.actionSetDownloadList({ list, type: 'updateList' })
this.notice.okTips(res) this.notice.okTips(res)
this.handleBatchImport() this.handleBatchImport()
this.$refs.detailListTable.refreshTable() this.$refs.detailListTable.refreshTable()
} }
}) })
}
})
}, },
findAllPersonRelations(sourceType) { findAllPersonRelations(sourceType) {
...@@ -516,28 +449,6 @@ export default { ...@@ -516,28 +449,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.points-record { .points-record {
margin-top: 40px; margin-top: 40px;
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
} }
.more-info { .more-info {
white-space: nowrap; white-space: nowrap;
......
...@@ -76,10 +76,10 @@ export default { ...@@ -76,10 +76,10 @@ export default {
id: '1' id: '1'
}, { }, {
name: '权益', name: '权益',
id: '2' id: '3'
}, { }, {
name: '轻改', name: '轻改',
id: '3' id: '2'
}], }],
getListApi: getSupervisorDetailApi, getListApi: getSupervisorDetailApi,
activeName: '0', activeName: '0',
...@@ -100,7 +100,7 @@ export default { ...@@ -100,7 +100,7 @@ export default {
label: "归属业务", label: "归属业务",
prop: "bizNames", prop: "bizNames",
formatter: (cellValue) => { formatter: (cellValue) => {
let names = ['', '延保', '权益', '轻改'] let names = ['', '延保', '轻改', '权益']
if (!cellValue.bizNames) return '-' if (!cellValue.bizNames) return '-'
let bizArray = cellValue.bizNames?.split(',')?.map(item => item.trim()).filter(item => item !== '') let bizArray = cellValue.bizNames?.split(',')?.map(item => item.trim()).filter(item => item !== '')
let result = bizArray.map(index => names[parseInt(index)]).filter(name => name !== '').join(',') let result = bizArray.map(index => names[parseInt(index)]).filter(name => name !== '').join(',')
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<div class="view-item"> <div class="view-item">
<div class="label">本月总产值</div> <div class="label">本月总产值</div>
<div class="value"> <div class="value">
<span class="green">{{staticsData.monthlyOutput !== '-' ? `¥${staticsData.monthlyOutput}万元` : '-'}}</span> <span class="green">{{staticsData.monthlyOutput !== '-' ? `¥${staticsData.monthlyOutput}元` : '-'}}</span>
</div> </div>
</div> </div>
<div class="view-item"> <div class="view-item">
......
...@@ -69,11 +69,17 @@ ...@@ -69,11 +69,17 @@
<el-input v-model="scope.row.minValue" <el-input v-model="scope.row.minValue"
disabled disabled
style="width: 140px;margin:0 8px;"> style="width: 140px;margin:0 8px;">
<template v-if="scope.row.indicatorCode === 'A085'" #append>
%
</template>
</el-input> </el-input>
<span>-</span> <span>-</span>
<el-input v-model="scope.row.maxValue" <el-input v-model="scope.row.maxValue"
disabled disabled
style="width: 140px;margin:0 8px;"> style="width: 140px;margin:0 8px;">
<template v-if="scope.row.indicatorCode === 'A085'" #append>
%
</template>
</el-input> </el-input>
</div> </div>
</div> </div>
......
...@@ -267,13 +267,16 @@ export default { ...@@ -267,13 +267,16 @@ export default {
confLabel: "自采入库", confLabel: "自采入库",
}], }],
upgradeFlags, upgradeFlags,
inventoryTypeList: [{ inventoryTypeList: [
confId: 1, {
confValue: "虚拟",
}, {
confId: 2, confId: 2,
confValue: "实物", confValue: "实物",
}], },
{
confId: 1,
confValue: "虚拟",
},
],
}, },
paramsObj: {}, paramsObj: {},
}; };
......
...@@ -342,11 +342,11 @@ export default { ...@@ -342,11 +342,11 @@ export default {
technicianList: [], technicianList: [],
upgradeFlags, upgradeFlags,
inventoryTypeList: [{ inventoryTypeList: [{
confId: 1,
confValue: "虚拟",
}, {
confId: 2, confId: 2,
confValue: "实物", confValue: "实物",
}, {
confId: 1,
confValue: "虚拟",
}], }],
}, },
statisticsData: {}, statisticsData: {},
......
...@@ -87,42 +87,11 @@ ...@@ -87,42 +87,11 @@
</div> </div>
</d2-table> </d2-table>
</div> </div>
<d2-dialog :title="'交付数导入'" <d2-file-import-dialog :is-visible="fileVisible"
:is-visible="fileVisible" title="交付数导入"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate" />
<el-form :model="fileForm"
ref="fileRuleForm"
:rules="fileRules"
label-width="120px">
<el-form-item label="导入文件:"
prop="fileName">
<el-col :span="16">
<el-input readonly
v-model="fileForm.fileName" />
</el-col>
<el-col :span="4"
class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file"
id="fileUpload"
class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 新增&修改&详情 --> <!-- 新增&修改&详情 -->
<edit-dialog :visible.sync="editVisible" <edit-dialog :visible.sync="editVisible"
v-if="editVisible" v-if="editVisible"
...@@ -251,15 +220,11 @@ export default { ...@@ -251,15 +220,11 @@ export default {
merchantList: [], merchantList: [],
brandList: [] brandList: []
}, },
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
recordInfo: null, recordInfo: null,
operationType: "add", operationType: "add",
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
fileVisible: false, fileVisible: false,
fileForm: {},
editVisible: false, editVisible: false,
track_event_code: 'shopConfig_deliver_list', track_event_code: 'shopConfig_deliver_list',
track_businessParam_key: 'searchForm' track_businessParam_key: 'searchForm'
...@@ -470,43 +435,18 @@ export default { ...@@ -470,43 +435,18 @@ export default {
this.actionSetDownloadList({ list, type: 'dowloadList' }) this.actionSetDownloadList({ list, type: 'dowloadList' })
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 10) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过10M')
}
},
handleImport() { handleImport() {
this.fileForm = {
fileName: ''
}
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
deliverTargeConfigImport(params).then(res => { deliverTargeConfigImport(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -518,8 +458,6 @@ export default { ...@@ -518,8 +458,6 @@ export default {
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
// 删除 // 删除
...@@ -549,27 +487,4 @@ export default { ...@@ -549,27 +487,4 @@ export default {
margin-top: 40px; margin-top: 40px;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -110,49 +110,12 @@ ...@@ -110,49 +110,12 @@
]" :data="scope.scope" /> ]" :data="scope.scope" />
</d2-table> </d2-table>
</div> </div>
<!-- 导入门店设置 --> <d2-file-import-dialog :is-visible="fileVisible"
<d2-dialog :title="'上传文件'" :is-visible="fileVisible" @closeDialog="handleImport" title="上传文件"
@confirmDialog="handleConfirmImport" width="600px"> template-name="文件下载"
<slot> @closeDialog="handleImport"
<div> @confirmDialog="handleConfirmImport"
<el-form :model="fileForm" :rules="fileRules" ref="fileRuleForm" label-width="120px"> @downloadTemplate="downLoadTemplate" />
<el-form-item label="导入文件:" prop="fileName">
<el-col :span="16">
<el-input readonly v-model="fileForm.fileName" />
</el-col>
<el-col :span="4" class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file" id="fileUpload" class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)" />
<el-link type="primary" class="import-template" @click="downLoadTemplate" icon="el-icon-link">
文件下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
<span v-show="showNum">
<div class="upload-statistics">
<div class="quantity">
<div class="success">{{ importNum.successCount }}</div>
<div>有效数据</div>
</div>
<div class="line"></div>
<div class="quantity">
<div class="err">{{ importNum.failCount }}</div>
<div>异常数据</div>
</div>
</div>
<div class="abnormal">
<p>数据异常的可能原因:</p>
<p class="color-33">1. 订单编号不匹配</p>
</div>
</span>
</div>
</slot>
</d2-dialog>
<!-- 收款码 --> <!-- 收款码 -->
<qrcode-dialog :q-rcode-visible="qRcodeVisible" :info="recordInfo" v-if="qRcodeVisible" <qrcode-dialog :q-rcode-visible="qRcodeVisible" :info="recordInfo" v-if="qRcodeVisible"
...@@ -667,16 +630,7 @@ export default { ...@@ -667,16 +630,7 @@ export default {
recordInfo: null, recordInfo: null,
fileVisible: false, fileVisible: false,
signVisible: false, signVisible: false,
showNum: false,
warningVisible: false, warningVisible: false,
importNum: {
succNum: 0,
failNum: 0
},
fileForm: {},
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }]
},
qRcodeVisible: false, qRcodeVisible: false,
employeeVisible: false, employeeVisible: false,
flagVisible: false, flagVisible: false,
...@@ -1236,57 +1190,28 @@ export default { ...@@ -1236,57 +1190,28 @@ export default {
} }
) )
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, "fileName", e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = (event) => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(",")
this.fileInfo =
e.target.files[0].name.split(".")[1] + "@" + arrBase64[1]
document.getElementById("fileUpload").value = ""
}
} else {
this.notice.errorTips("上传文件不可超过9M")
document.getElementById("fileUpload").value = ""
}
},
handleImport() { handleImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
const that = this merchantOutputValueTargetImport({ file: fileData }).then(
this.$refs.fileRuleForm.validate((valid) => {
if (valid) {
merchantOutputValueTargetImport({ file: this.fileInfo }).then(
(result) => { (result) => {
if (result) { if (result) {
// debugger
// 异步处理文件上传 把id传入处理轮询
const list = [ const list = [
...that.updateList, ...this.updateList,
{ {
name: that.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: result, uuid: result,
type: "upload" type: "upload"
// labelText: ''
} }
] ]
that.actionSetDownloadList({ list, type: "updateList" }) this.actionSetDownloadList({ list, type: "updateList" })
that.notice.okTips("上传成功") this.notice.okTips("上传成功")
that.handleImport() this.handleImport()
} }
} }
) )
}
})
}, },
// 收款二维码按钮 // 收款二维码按钮
...@@ -1623,69 +1548,6 @@ export default { ...@@ -1623,69 +1548,6 @@ export default {
border: 0; border: 0;
} }
.upload-wrap {
display: flex;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
.m-l-md {
margin-left: 20px;
}
.upload-statistics {
display: flex;
align-items: center;
justify-content: space-between;
margin: 30px 70px;
.quantity {
font-size: 14px;
color: #333333;
text-align: center;
.success {
font-size: 26px;
color: #2cca74;
text-align: center;
margin-bottom: 4px;
}
.err {
font-size: 26px;
color: #eb4e4e;
text-align: center;
margin-bottom: 4px;
}
}
.line {
width: 1px;
height: 56px;
background: #e8e8ea;
}
}
.points-set-form { .points-set-form {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -93,42 +93,11 @@ ...@@ -93,42 +93,11 @@
</div> </div>
</d2-table> </d2-table>
</div> </div>
<d2-dialog :title="'产值导入'" <d2-file-import-dialog :is-visible="fileVisible"
:is-visible="fileVisible" title="产值导入"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate" />
<el-form :model="fileForm"
ref="fileRuleForm"
:rules="fileRules"
label-width="120px">
<el-form-item label="导入文件:"
prop="fileName">
<el-col :span="16">
<el-input readonly
v-model="fileForm.fileName" />
</el-col>
<el-col :span="4"
class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file"
id="fileUpload"
class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 新增&修改&详情 --> <!-- 新增&修改&详情 -->
<edit-dialog :visible.sync="editVisible" <edit-dialog :visible.sync="editVisible"
v-if="editVisible" v-if="editVisible"
...@@ -268,15 +237,11 @@ export default { ...@@ -268,15 +237,11 @@ export default {
}, },
merchantList: [] merchantList: []
}, },
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
recordInfo: null, recordInfo: null,
operationType: "add", operationType: "add",
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
fileVisible: false, fileVisible: false,
fileForm: {},
editVisible: false, editVisible: false,
track_event_code: 'shopConfig_Output_list', track_event_code: 'shopConfig_Output_list',
track_businessParam_key: 'searchForm' track_businessParam_key: 'searchForm'
...@@ -467,43 +432,18 @@ export default { ...@@ -467,43 +432,18 @@ export default {
this.actionSetDownloadList({ list, type: 'dowloadList' }) this.actionSetDownloadList({ list, type: 'dowloadList' })
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 10) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过10M')
}
},
handleImport() { handleImport() {
this.fileForm = {
fileName: ''
}
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
targeConfigImport(params).then(res => { targeConfigImport(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -515,8 +455,6 @@ export default { ...@@ -515,8 +455,6 @@ export default {
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
// 删除 // 删除
...@@ -572,27 +510,4 @@ export default { ...@@ -572,27 +510,4 @@ export default {
color: #43cf7c; color: #43cf7c;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -93,42 +93,11 @@ ...@@ -93,42 +93,11 @@
</div> </div>
</d2-table> </d2-table>
</div> </div>
<d2-dialog :title="'成交率导入'" <d2-file-import-dialog :is-visible="fileVisible"
:is-visible="fileVisible" title="成交率导入"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate" />
<el-form :model="fileForm"
ref="fileRuleForm"
:rules="fileRules"
label-width="120px">
<el-form-item label="导入文件:"
prop="fileName">
<el-col :span="16">
<el-input readonly
v-model="fileForm.fileName" />
</el-col>
<el-col :span="4"
class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file"
id="fileUpload"
class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 新增&修改&详情 --> <!-- 新增&修改&详情 -->
<edit-dialog :visible.sync="editVisible" <edit-dialog :visible.sync="editVisible"
v-if="editVisible" v-if="editVisible"
...@@ -304,15 +273,11 @@ export default { ...@@ -304,15 +273,11 @@ export default {
2: "延保" 2: "延保"
}, },
}, },
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
recordInfo: null, recordInfo: null,
operationType: "add", operationType: "add",
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
fileVisible: false, fileVisible: false,
fileForm: {},
editVisible: false, editVisible: false,
track_event_code: 'shopConfig_personalConversion_list', track_event_code: 'shopConfig_personalConversion_list',
track_businessParam_key: 'searchForm' track_businessParam_key: 'searchForm'
...@@ -534,43 +499,18 @@ export default { ...@@ -534,43 +499,18 @@ export default {
this.actionSetDownloadList({ list, type: 'dowloadList' }) this.actionSetDownloadList({ list, type: 'dowloadList' })
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 10) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过10M')
}
},
handleImport() { handleImport() {
this.fileForm = {
fileName: ''
}
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
personalConfigImport(params).then(res => { personalConfigImport(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -581,8 +521,6 @@ export default { ...@@ -581,8 +521,6 @@ export default {
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
// 删除 // 删除
...@@ -612,22 +550,6 @@ export default { ...@@ -612,22 +550,6 @@ export default {
margin-top: 40px; margin-top: 40px;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
@mixin typeBase { @mixin typeBase {
width: 52px; width: 52px;
...@@ -654,10 +576,4 @@ export default { ...@@ -654,10 +576,4 @@ export default {
color: #43cf7c; color: #43cf7c;
} }
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
</style> </style>
...@@ -85,44 +85,17 @@ ...@@ -85,44 +85,17 @@
</div> </div>
</d2-table> </d2-table>
</div> </div>
<!-- 导入文件弹框 --> <d2-file-import-dialog :is-visible="fileVisible"
<d2-dialog :title="'毛利导入'" title="毛利导入"
:is-visible="fileVisible" form-item-label="毛利信息表:"
:max-size="10"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport"
<slot> @downloadTemplate="exportTemplate">
<el-form :model="fileForm" <template #tip>
ref="fileRuleForm"
:rules="fileRules"
label-width="120px">
<el-form-item label="毛利信息表:"
prop="fileName">
<el-col :span="16">
<el-input readonly
v-model="fileForm.fileName" />
<p class="tips">请选择需要导入的毛利信息表格</p> <p class="tips">请选择需要导入的毛利信息表格</p>
</el-col> </template>
<el-col :span="4" </d2-file-import-dialog>
class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file"
id="fileUpload"
class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 新增&修改&详情 --> <!-- 新增&修改&详情 -->
<edit-dialog :visible.sync="editVisible" <edit-dialog :visible.sync="editVisible"
v-if="editVisible" v-if="editVisible"
...@@ -269,15 +242,11 @@ ...@@ -269,15 +242,11 @@
4: "二手车" 4: "二手车"
}, },
}, },
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
recordInfo: null, recordInfo: null,
operationType: "add", operationType: "add",
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
fileVisible: false, fileVisible: false,
fileForm: {},
editVisible: false, editVisible: false,
// 保存编辑前的分页状态 // 保存编辑前的分页状态
savedPageState: null, savedPageState: null,
...@@ -535,43 +504,18 @@ ...@@ -535,43 +504,18 @@
this.actionSetDownloadList({ list, type: 'dowloadList' }) this.actionSetDownloadList({ list, type: 'dowloadList' })
}, },
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 10) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过10M')
}
},
handleImport() { handleImport() {
this.fileForm = {
fileName: ''
}
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
importProfit(params).then(res => { importProfit(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -582,8 +526,6 @@ ...@@ -582,8 +526,6 @@
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
// 删除 // 删除
...@@ -613,22 +555,6 @@ ...@@ -613,22 +555,6 @@
margin-top: 40px; margin-top: 40px;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
@mixin typeBase { @mixin typeBase {
width: 52px; width: 52px;
...@@ -660,12 +586,6 @@ ...@@ -660,12 +586,6 @@
color: #5850FFFF; color: #5850FFFF;
} }
.import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
.tips { .tips {
color: #999999ff; color: #999999ff;
font-size: 14px; font-size: 14px;
......
...@@ -76,43 +76,11 @@ ...@@ -76,43 +76,11 @@
</d2-table> </d2-table>
</div> </div>
<!-- 导入 --> <!-- 导入 -->
<d2-dialog :title="'上传文件'" <d2-file-import-dialog :is-visible="fileVisible"
:is-visible="fileVisible" title="上传文件"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport" @confirmDialog="handleConfirmImport"
width="530px"> @downloadTemplate="exportTemplate" />
<slot>
<el-form :model="fileForm"
ref="fileRuleForm"
:rules="fileRules"
label-width="120px">
<el-form-item label="导入文件:"
prop="fileName">
<el-col :span="16">
<el-input readonly
v-model="fileForm.fileName" />
</el-col>
<el-col :span="4"
class="m-l-md">
<el-button class="import-btn">
导入文件
<input type="file"
id="fileUpload"
class="import-input"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
@change="importFile($event)">
<el-link type="primary"
class="import-template"
icon="el-icon-link"
@click="exportTemplate">
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<!-- 导出 --> <!-- 导出 -->
<d2-dialog :title="'员工业绩导出'" <d2-dialog :title="'员工业绩导出'"
:is-visible="exportFileVisible" :is-visible="exportFileVisible"
...@@ -179,7 +147,6 @@ export default { ...@@ -179,7 +147,6 @@ export default {
return date.getTime() > Date.now() - 24 * 60 * 60 * 1000 * `${days}` return date.getTime() > Date.now() - 24 * 60 * 60 * 1000 * `${days}`
} }
}, },
fileForm: {},
exportFileForm: { // 导出条件 exportFileForm: { // 导出条件
exportYqMerchantId: [], exportYqMerchantId: [],
exportMonth: '' exportMonth: ''
...@@ -187,9 +154,6 @@ export default { ...@@ -187,9 +154,6 @@ export default {
exportFormRules: { exportFormRules: {
exportMonth: [{ required: true, message: '请选择导出月份', trigger: 'blur' }] exportMonth: [{ required: true, message: '请选择导出月份', trigger: 'blur' }]
}, },
fileRules: {
fileName: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
totalNum: 0, // 已启用商学院员工数量 totalNum: 0, // 已启用商学院员工数量
fileVisible: false, // 导入弹窗 fileVisible: false, // 导入弹窗
exportFileVisible: false, // 导出弹窗 exportFileVisible: false, // 导出弹窗
...@@ -380,41 +344,17 @@ export default { ...@@ -380,41 +344,17 @@ export default {
keyDownGetList() { keyDownGetList() {
this.$refs.staffManageTable.refreshTable() this.$refs.staffManageTable.refreshTable()
}, },
// 导入员工
handleImport() { handleImport() {
this.fileVisible = !this.fileVisible this.fileVisible = !this.fileVisible
this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
},
// 上传文件,转码为base64
importFile(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 9) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
} else {
this.notice.errorTips('上传文件不可超过9M')
document.getElementById('fileUpload').value = ''
}
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = { var params = {
file: this.fileInfo file: fileData
} }
importStaffApi(params).then(res => { importStaffApi(params).then(res => {
if (res) { if (res) {
// 异步处理文件上传 把id传入处理轮询
const list = [...this.updateList, { const list = [...this.updateList, {
name: this.fileForm.fileName, name: fileName,
ifSuccess: false, ifSuccess: false,
uuid: res, uuid: res,
type: 'upload' type: 'upload'
...@@ -425,8 +365,6 @@ export default { ...@@ -425,8 +365,6 @@ export default {
this.handleImport() this.handleImport()
} }
}) })
}
})
}, },
// 模板下载 // 模板下载
exportTemplate() { exportTemplate() {
...@@ -584,31 +522,6 @@ export default { ...@@ -584,31 +522,6 @@ export default {
color: #d9646c; color: #d9646c;
} }
} }
.staff-list .m-l-md {
margin-left: 20px;
}
.staff-list .import-btn {
position: relative;
}
.staff-list .import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.staff-list .import-template {
position: absolute;
height: 20px;
top: 50px;
left: 0;
}
::v-deep .el-tag--info { ::v-deep .el-tag--info {
max-width: 140px; max-width: 140px;
overflow: hidden; overflow: hidden;
......
...@@ -101,36 +101,10 @@ ...@@ -101,36 +101,10 @@
@dialogClose="closePushDialog" /> @dialogClose="closePushDialog" />
<!-- 导入更新 --> <!-- 导入更新 -->
<d2-dialog :is-visible="fileVisible" <d2-file-import-dialog :is-visible="fileVisible"
title="导入" title="导入"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport" />
<slot>
<el-form ref="fileRuleForm"
label-width="120px"
:model="fileForm"
:rules="fileRules">
<el-form-item label="导入文件:"
prop="fileName">
<el-col :span="16">
<el-input v-model="fileForm.fileName"
readonly />
</el-col>
<el-col class="m-l-md"
:span="4">
<el-button class="import-btn">
导入文件
<input id="fileUpload"
accept=".xlsx,.xls"
class="import-input"
type="file"
@change="importFile($event)">
</el-button>
</el-col>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
<el-dialog :close-on-click-modal="false" <el-dialog :close-on-click-modal="false"
:show-close="false" :show-close="false"
title="提示" title="提示"
...@@ -280,10 +254,6 @@ export default { ...@@ -280,10 +254,6 @@ export default {
dateVisible: false, dateVisible: false,
recordInfo: {}, recordInfo: {},
fileVisible: false, fileVisible: false,
fileForm: {},
fileRules: {
fileName: [{ required: true, message: "请上传文件", trigger: "change" }],
},
dialogVisible: false, dialogVisible: false,
updateStatus: "", updateStatus: "",
updatePercentage: 0, updatePercentage: 0,
...@@ -410,59 +380,16 @@ export default { ...@@ -410,59 +380,16 @@ export default {
// this.$refs.recordTable.refreshTable(false, true) // this.$refs.recordTable.refreshTable(false, true)
}, },
// 上传文件,转码为base64
importFile(e) {
console.log(e, "e");
const file = e.target.files[0];
console.log(file, "file");
if (!file)
return; // 防止取消选择时报错
if (
!file.name.includes(".xlsx")
&& !file.name.includes(".xls")
) {
this.$message({
message: "文件格式不支持",
type: "error",
});
return false;
}
const size = file.size / 1024 / 1024;
// 先清空 input,防止下次无法触发 change
document.getElementById("fileUpload").value = "";
if (size < 10) {
this.$set(this.fileForm, "fileName", file.name);
// // 转码base64
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (event) => {
this.$set(
this.fileForm,
"fileInfo",
file,
);
// document.getElementById("fileUpload").value = ""
};
} else {
this.notice.errorTips("上传文件不可超过10M");
}
},
handleImport(row) { handleImport(row) {
this.recordInfo = row; this.recordInfo = row;
this.fileForm = {
fileName: "",
};
this.fileVisible = !this.fileVisible; this.fileVisible = !this.fileVisible;
}, },
handleConfirmImport() { handleConfirmImport({ fileName, fileData }) {
this.$refs.fileRuleForm.validate((valid) => {
if (valid) {
this.dialogVisible = true; this.dialogVisible = true;
const formData = new FormData(); const formData = new FormData();
formData.append("file", this.fileForm.fileInfo); formData.append("file", fileData);
formData.append("key", this.recordInfo.key); formData.append("key", this.recordInfo.key);
// 调试:打印内容
for (const [key, value] of formData.entries()) { for (const [key, value] of formData.entries()) {
console.log(key, value); console.log(key, value);
} }
...@@ -474,8 +401,6 @@ export default { ...@@ -474,8 +401,6 @@ export default {
this.errMsg = res.message; this.errMsg = res.message;
} }
}); });
}
});
}, },
gotoList() { gotoList() {
...@@ -541,22 +466,6 @@ export default { ...@@ -541,22 +466,6 @@ export default {
font-size: 14px; font-size: 14px;
color: #999999; color: #999999;
} }
.m-l-md {
margin-left: 20px;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 98px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.dialog-content { .dialog-content {
text-align: center; text-align: center;
.dialog-tips-big { .dialog-tips-big {
......
...@@ -189,13 +189,10 @@ export default { ...@@ -189,13 +189,10 @@ export default {
computed: { computed: {
detailList() { detailList() {
const list = this.detailInfo?.priceHistoryListDTO; const list = this.detailInfo?.priceHistoryListDTO;
const filtered = Array.isArray(list) if (!Array.isArray(list)) {
? list.filter(x => x && +x.opType === 40) return [];
: [];
if (filtered.length) {
return filtered;
} }
return Array.isArray(list) && list.length ? list : [this.detailInfo || {}]; return list.filter(x => x && +x.opType === 40);
}, },
}, },
}; };
......
...@@ -199,7 +199,7 @@ export default { ...@@ -199,7 +199,7 @@ export default {
}, },
{ {
label: "排量", label: "排量",
prop: "vehicleType", prop: "displacement",
minWidth: 120, minWidth: 120,
}, },
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!