Commit 44fd99a2 authored by tanghao's avatar tanghao

123

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