Commit 44fd99a2 authored by tanghao's avatar tanghao

123

parent 26422566
......@@ -188,3 +188,17 @@ export const getCheckOrder = (orderItemId: any) => {
};
export const deleteOrderFiles = (ids: string) => {
return axios.get('/api/orderVar/batchDeleteByIds', {
params: { ids },
headers: formHeader
})
}
export const deleteTemplateiles = (ids: string) => {
return axios.get('/api/varTemplateFile/batchDeleteByIds', {
params: { ids },
headers: formHeader
})
}
\ No newline at end of file
......@@ -88,8 +88,8 @@ export function handleRangeTitle(range: any) {
}
for (let r = (isVertical ? columnLen : rowLen) - 1; r >= 0; r--) {
const cell = isVertical ? range[c][r] : range[r][c]
isVertical ? (title.row = +beginRow + c) : (title.colum = +beginColum + c)
// isVertical ? (title.row = +beginRow + c) : (title.colum = +endColum - c)
// 如果获取值报错,那么断定单元格值为空,直接取上一个单元格的值
try {
title.title = (cell.m || cell.v || cell?.ct?.s.map((itm) => itm.v).join('')).replaceAll(
......@@ -110,12 +110,67 @@ export function handleRangeTitle(range: any) {
}
titles.push(title)
}
return titles
}
export function handlePublicRangeTitle(range: any) {
const { beginColum, beginRow, endRow, endColum, sheetNum, rowLen, columnLen } =
getRangeState(range)
const titles: Recordable[] = []
let isVertical = false
// 只有一行,只能横向
if (rowLen == 1) {
isVertical = false
} else if (
rowLen - 1 === endRow - beginRow &&
(columnLen - 1 !== endColum - beginColum || columnLen == 1)
) {
isVertical = true
}
/**
* 由底向上循环
* 横向 -> row 不变 纵向 -> column 不变
*
*/
for (let c = 0; c < (isVertical ? rowLen : columnLen); c++) {
const title = {
title: '',
sheet: sheetNum,
row: !isVertical ? +beginRow + rowLen - 1 : endRow - rowLen - 1,
colum: isVertical ? +beginColum + columnLen - 1 : endColum - columnLen - 1
}
for (let r = (isVertical ? columnLen : rowLen) - 1; r >= 0; r--) {
const cell = isVertical ? range[c][r] : range[r][c]
// isVertical ? (title.row = +beginRow + c) : (title.colum = +beginColum + c)
isVertical ? (title.row = +beginRow + c) : (title.colum = +endColum - c)
// 如果获取值报错,那么断定单元格值为空,直接取上一个单元格的值
try {
title.title = (cell.m || cell.v || cell?.ct?.s.map((itm) => itm.v).join('')).replaceAll(
/(\s+)/g,
''
)
// 如果有值那么直接进入下一列或者下一行
if (title.title) {
// 如果有合并单元格,直接跳过合并的单元格
if (cell?.mc?.rs > 1 || cell?.mc?.cs > 1) {
c += (isVertical ? cell.mc.rs : cell.mc.cs) - 1
}
break
}
} catch {
continue
}
}
titles.push(title)
}
return titles
}
export function handleRangeCell(range: any, cb?: any, skipEmpty: boolean = true) {
console.log(luckysheet.getRangeValue(), 'range-----')
// return
const { beginRow, beginColum, endRow, sheetNum, endColum, columnLen, rowLen } =
getRangeState(range)
......@@ -153,7 +208,7 @@ export function handleRangeCell(range: any, cb?: any, skipEmpty: boolean = true)
titles.push(t)
cb && cb(t)
} catch (e) {
console.log(r, c, t, e, cell, 'error')
// console.log(r, c, t, e, cell, 'error')
if (!skipEmpty) {
titles.push(t)
cb && cb(t)
......@@ -161,7 +216,7 @@ export function handleRangeCell(range: any, cb?: any, skipEmpty: boolean = true)
}
}
}
console.log('----titles', titles)
// console.log('----titles', titles)
return titles
}
/**
......@@ -270,7 +325,7 @@ export function filterRunData(data: any, config: boolean = false) {
templateFileId: ''
}
console.log(data, 'data-----')
// console.log(data, 'data-----')
data.forEach((row: any) => {
const rw: Recordable = {}
......@@ -299,7 +354,7 @@ export function filterRunData(data: any, config: boolean = false) {
res.push(rw)
})
console.log('----res', res)
// console.log('----res', res)
return {
res,
......
......@@ -392,7 +392,7 @@ const getScriptList = async () => {
const scriptChange = (item, e) => {
if (e) {
console.log(e)
// console.log(e)
item.script = scriptList.value.find((item1) => item1.srciptName == e)?.scriptContent
} else {
item.script = ''
......@@ -646,7 +646,7 @@ const chooseConnect = (row: any) => {
}
const connectFiledStr = (row: any) => {
console.log(row)
// console.log(row)
return row.map(item => item.title).join(', ');
}
......
......@@ -168,7 +168,7 @@ const saveCellConfig = async () => {
if (getIsSelectedRow.value) {
const oldBegin = getSheetBegin.value[formState.sheetNum]
const isAlready = !!oldBegin?.forIndexId
console.log('oldBegin', oldBegin)
// console.log('oldBegin', oldBegin)
// 如果设置的循环体开始行是一样,就不执行
if (oldBegin?.rowNum == formState.rowNum) {
......
......@@ -212,7 +212,7 @@ const loadExcel = () => {
}
// 设置显示begin开始行颜色
const beginOrderIndex = getSheetBegin.value[0]
console.log(beginOrderIndex, '----')
// console.log(beginOrderIndex, '----')
if (beginOrderIndex.forIndexId) {
const po = [beginOrderIndex.rowNum, beginOrderIndex.rowNum, 0, 10]
window.luckysheet.menuButton.customUpdateFormat(null, 'bg', '#c7f5d3', ...po)
......
......@@ -530,7 +530,7 @@ const toDetail = async (row: any) => {
const excludeTitles = ['sortNum', '数据区', 'expendData']
detailTable.value = res
tableTitle.value = titles.filter((v) => !excludeTitles.includes(v))
console.log(tableTitle.value)
// console.log(tableTitle.value)
nextTick(() => {
detailVisible.value = true
......@@ -664,7 +664,7 @@ const onCopy = () => {
}
const onPaste = () => {
console.log(copyInfo)
// console.log(copyInfo)
// 将复制的配置信息,一条一条设置
copyInfo.value.forEach((item: any) => {
......
......@@ -127,7 +127,7 @@ const addScript = () => {
}
onMounted(() => {
console.log('onmounted')
// console.log('onmounted')
isVariable.value = !!props.item.orderFiled?.variable
})
......
......@@ -201,12 +201,12 @@ const onReset = () => {
}
const editRow = (row) => {
console.log("查看脚本" + JSON.stringify(row.orders))
// console.log("查看脚本" + JSON.stringify(row.orders))
Object.assign(formEdit, row)
// jsonStr = JSON.stringify(row.orders);
jsonStr.value = row.orders
console.log(jsonStr.value)
// console.log(jsonStr.value)
showEdit.value = true
}
......
......@@ -247,7 +247,7 @@ const onHide = () => {
unitRatio: ''
})
console.log(formEdit, 'formEdit--onhide')
// console.log(formEdit, 'formEdit--onhide')
}
const onReset = () => {
......
......@@ -41,6 +41,13 @@
</el-form>
<div class="">
<vxe-toolbar>
<template #buttons>
<el-button type="danger" @click="removeRows">删除</el-button>
</template>
</vxe-toolbar>
<vxe-table
ref="xTable"
size="small"
......@@ -114,7 +121,7 @@
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue'
import { getVarFilePage } from '@/api/var'
import { getVarFilePage ,deleteTemplateiles} from '@/api/var'
import { ElMessage } from 'element-plus'
import type { VxeTableInstance } from 'vxe-table'
import { useRouter } from 'vue-router'
......@@ -146,6 +153,16 @@ const xTable = ref<VxeTableInstance>()
const tableData = ref([])
const removeRows = async () => {
const list = xTable.value?.getCheckboxRecords()
if (list?.length) {
const ids = list.map((v) => v.varFileId).join(',')
await deleteTemplateiles(ids)
ElMessage.success('删除成功')
onQuery()
}
}
const onReset = () => {
Object.assign(formState, {
productCode:'',
......
......@@ -281,7 +281,7 @@ const showPopover = (e: any, title: string) => {
currentConfigTitle.value = title
const hasConf = !!getAllMapConfigs.value[title].filedConfs.length
console.log(getAllMapConfigs.value[title], '------')
// console.log(getAllMapConfigs.value[title], '------')
const conf = hasConf
? getAllMapConfigs.value[title]
: {
......
......@@ -178,7 +178,7 @@ const addScript = (type = 'script') => {
}
onMounted(() => {
console.log('onmounted')
// console.log('onmounted')
// isVariable.value = !!props.item.orderFiled?.variable
})
......
......@@ -400,7 +400,7 @@ const areaTypeLen = computed(() => {
const scriptChange = (item, e) => {
if (e) {
console.log(e)
// console.log(e)
item.script = scriptList.value.find((item1) => item1.srciptName == e)?.scriptContent
} else {
item.script = ''
......@@ -427,7 +427,7 @@ const initExcelAreaMarksKey = (len: number) => {
})
}
const connectFiledStr = (row: any) => {
console.log(row)
// console.log(row)
return row.map(item => item.title).join(', ');
}
......@@ -720,7 +720,7 @@ const loadExcel = () => {
'/api/sys/static/' + getFileInfo.value.mergeFilePath,
new Date().getTime() + '.xlsx',
async (exportJson: any) => {
console.log('---exportJson', exportJson)
// console.log('---exportJson', exportJson)
initIsSetSheetMark(exportJson.sheets.length)
initExcelAreaMarksKey(exportJson.sheets.length)
......
......@@ -84,7 +84,7 @@
<script lang="ts" setup>
import { ref, reactive, unref } from 'vue'
import { compareSameCell, getRangetxt, handleRangeCell, handleRangeTitle } from '@/utils/excel'
import { compareSameCell, getRangetxt, handleRangeCell, handleRangeTitle ,handlePublicRangeTitle} from '@/utils/excel'
import { areaMarksColor } from '@/constants/excelConfig'
import { ElMessage } from 'element-plus'
import type { Recordable } from '@/types/global'
......@@ -151,12 +151,15 @@ const setAreaTitle = () => {
if (sheet.order != props.currentAreaMark.sheetNum) {
return ElMessage.error('请在同一sheet页中选择数据!')
}
// console.log(props.currentAreaMark)
const isPublic = props.currentAreaMark.excelAreaType == 'public_area'
const isSelf = props.currentAreaMark.oneself !== 'Y'
const [sr, er] = sheet.luckysheet_select_save[0].row
const [sc, ec] = sheet.luckysheet_select_save[0].column
const rangeData = luckysheet.getRangeValue()
const titles = isPublic
? handleRangeTitle(rangeData)
const titles = isPublic&&isSelf
? handlePublicRangeTitle(rangeData)
: handleRangeTitle(rangeData).map((item) => {
Reflect.set(item, 'numTitle', '')
Reflect.set(item, 'numFlag', 'N')
......
......@@ -46,11 +46,21 @@
</el-form>
<div class="">
<vxe-toolbar>
<template #buttons>
<el-button type="danger" @click="removeRows">删除</el-button>
</template>
</vxe-toolbar>
<vxe-table
ref="xTable"
size="small"
min-height="460"
border
:column-config="{
resizable: true
}"
:loading="loading"
:data="tableData"
>
......@@ -101,7 +111,7 @@
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue'
import { getVarOrderFilePage } from '@/api/var'
import { getVarOrderFilePage ,deleteOrderFiles} from '@/api/var'
import { ElMessage } from 'element-plus'
import type { VxeTableInstance } from 'vxe-table'
import { apiDictList } from '@/api/common'
......@@ -156,6 +166,17 @@ const onReset = () => {
})
}
const removeRows = async () => {
const list = xTable.value?.getCheckboxRecords()
if (list?.length) {
const ids = list.map((v) => v.orderVarFileId).join(',')
await deleteOrderFiles(ids)
ElMessage.success('删除成功')
onQuery()
}
}
const confirmUser = (list: any) => {
const [user] = list
if (user) {
......
......@@ -279,7 +279,7 @@ const handleImportVar = async (row) => {
importVisible.value = true
}
const imporModalHide = () => {
console.log("关闭")
// console.log("关闭")
importForm.value.customerName = ''
importForm.value.productName = ''
importForm.value.customerId = ''
......@@ -301,7 +301,7 @@ const changeUpload = (file: any) => {
})
const formData = new FormData()
formData.append('file', file.raw)
console.log(file, 'file')
// console.log(file, 'file')
uploadFile(formData).then(({ data }) => {
loading.close()
if (data?.code === 200) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment