Commit 0175906b by Administrator

Merge branch 'dev' into 'master'

Dev

See merge request !68
parents 5530d0d1 473240f9
......@@ -535,3 +535,11 @@ export function rejectToApi(params: {
params,
)
}
// 状态推送
export function statusPushApi(params: (string | number)[]) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/statusPush`,
params,
)
}
......@@ -111,6 +111,16 @@
<ArrowRight />
</el-icon>
</div>
<!-- 右侧工具栏 -->
<div class="tool_warper">
<div
title="格式工具"
style="cursor: pointer"
@click="formatDrawer = true"
>
<img src="../assets/images/brush-no.png" width="24" height="24" />
</div>
</div>
</div>
<el-dialog
v-model="dialogVisible"
......@@ -157,6 +167,45 @@
</span>
</template>
</el-dialog>
<span>
<el-drawer
v-model="formatDrawer"
class="format-drawer"
title="格式工具"
direction="rtl"
size="45%"
>
<el-input
v-model="textareaT"
style="width: 100%"
:rows="10"
type="textarea"
placeholder="请输入"
@input="confimTools"
/>
<div
style="
margin-top: 10px;
height: 250px;
overflow: auto;
border: 1px solid #ddd;
padding: 10px;
"
>
{{ newTextareaT }}
</div>
<template #footer>
<span style="display: flex; justify-content: center">
<el-button size="medium" @click="formatDrawer = false">
取 消
</el-button>
<el-button size="medium" type="primary" @click="copy">
拷 贝
</el-button>
</span>
</template>
</el-drawer>
</span>
</template>
<script setup lang="ts">
import {
......@@ -205,6 +254,9 @@ const menuList = reactive(Menu)
const userStore = userUserStore()
const userInfo = userStore.user
const dialogVisible = ref(false)
const formatDrawer = ref(false)
const textareaT = ref('')
const newTextareaT = ref('')
// 密码form
const [passwordForm, resetPasswordForm] = useValue<PasswordForm>(
{} as PasswordForm,
......@@ -396,6 +448,43 @@ const ensureActiveTabVisible = () => {
})
}
// 格式工具输入
const confimTools = (v: string) => {
// 先处理结尾的多个空格,只保留一个
let text = v.replace(/\s+$/, ' ')
// 处理开头的多个空格,只保留一个
text = text.replace(/^\s+/, ' ')
// 将多个连续空格替换为单个空格
text = text.replace(/\s+/g, ' ')
// 然后将所有空格和换行符替换为逗号
text = text.replace(/(\s|[\r\n])/g, ',')
// 如果结尾是逗号,则删除
if (text.slice(-1) === ',') {
newTextareaT.value = text.slice(0, -1)
} else {
newTextareaT.value = text
}
}
const copy = () => {
const oInput = document.createElement('input')
oInput.value = newTextareaT.value
document.body.appendChild(oInput)
oInput.select() // 选择对象
document.execCommand('Copy') // 执行浏览器复制命令
oInput.className = 'oInput'
oInput.style.display = 'none'
document.body.removeChild(oInput)
ElMessage({
message: '复制成功',
type: 'success',
})
}
// 监听路由变化,自动添加标签
watch(
() => route.path,
......@@ -537,4 +626,24 @@ onUnmounted(() => {
display: flex;
align-items: center;
}
.tool_warper {
position: absolute;
top: 50px;
right: 0;
bottom: 0;
width: 40px;
background: #001529;
z-index: 9999;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
::v-deep(.el-drawer.rtl) {
height: 80% !important;
top: 15%;
right: 40px;
}
</style>
......@@ -20,7 +20,7 @@ import NavMenu from '@/components/NavMenu.vue'
.container {
flex: 1;
padding: 0 10px 10px;
padding: 0 50px 10px 10px;
background-color: #f6f6f6;
overflow: hidden;
}
......
......@@ -572,6 +572,9 @@
</ElDropdown>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton type="warning" @click="statusPush">状态推送</ElButton>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton type="success" @click="exportData">导出</ElButton>
</span>
</ElFormItem>
......@@ -2229,6 +2232,7 @@ import {
getgetInterceptStateGroupList,
interceptUpdateApi,
rejectToApi,
statusPushApi,
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -4718,6 +4722,39 @@ const interceptChange = async (status: boolean) => {
}
}
// 状态推送
const statusPush = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await ElMessageBox.confirm('是否确认状态推送?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await statusPushApi(selection.value.map((item) => item.id))
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
} finally {
loading.close()
}
}
useRouter().beforeEach((to, from, next) => {
handleBeforeRouteLeave(to, from, next)
})
......
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