Commit 27bd0959 by linjinhong

修改结果弹窗

parent 6ae1feac
......@@ -4,6 +4,7 @@
v-model="resultDialog"
width="600px"
:close-on-click-modal="false"
@closed="closedFn"
>
<div style="display: flex">
<el-checkbox
......@@ -24,16 +25,16 @@
<el-button type="danger" @click="resultfilter(false)">
{{ '选择异常' }}
</el-button>
<el-button type="success" @click="copyAllCode(list, 'shopNumber')">
{{ '复制店铺单号' }}
<el-button type="success" @click="copyAllCode('factoryOrderNumber')">
{{ '复制工厂订单号' }}
</el-button>
</div>
<div style="height: 50vh; overflow: auto">
<div style="margin: 15px 0"></div>
<el-checkbox-group v-model="selectedList" @change="checkChange">
<div style="display: block" v-for="(item, index) in list" :key="index">
<el-checkbox :value="item.id">
{{ '店铺编号:' + item.shopNumber + ' ' + item.message }}
<el-checkbox :value="item">
{{ '工厂订单号:' + item.factoryOrderNumber + ' ' + item.message }}
</el-checkbox>
</div>
</el-checkbox-group>
......@@ -55,7 +56,8 @@ import { copyText } from '@/utils/index'
interface IList {
id: string | number
shopNumber: string
shopNumber?: string
factoryOrderNumber?: string
message: string
status: boolean
}
......@@ -71,7 +73,7 @@ const props = withDefaults(
const resultDialog = ref(false)
const isIndeterminate = ref(false)
const checkAll = ref(false)
const selectedList = ref<(string | number)[]>([])
const selectedList = ref<IList[]>([])
// 显示弹窗
const showDialog = (type?: string) => {
......@@ -84,7 +86,7 @@ const showDialog = (type?: string) => {
// 全选状态改变
const checkAllChange = (value: boolean) => {
selectedList.value = value ? props.list.map((v) => v.id) : []
selectedList.value = value ? props.list : []
isIndeterminate.value = false
}
......@@ -98,36 +100,52 @@ const checkChange = () => {
// 确认选择
const confirm = () => {
resultDialog.value = false
emits('confirm', selectedList.value)
// emits('confirm', selectedList.value)
}
// 结果过滤
const resultfilter = (bool: boolean) => {
const arr = props.list
.filter((item) => item.status === bool)
.map((item) => item.id)
const arr = props.list.filter((item) => item.status === bool)
selectedList.value = arr
const checkedCount = arr.length
console.log(112, checkedCount)
console.log(113, props.list)
checkAll.value = checkedCount === props.list.length
isIndeterminate.value = checkedCount > 0 && checkedCount < props.list.length
}
// 复制店铺单号
const copyAllCode = (list: IList[], field: string) => {
const str = list.map((el) => el[field as keyof IList]).join(',')
const copyAllCode = (field: string) => {
if (!selectedList.value.length) {
return ElMessage.warning('请先选择数据')
}
const str = selectedList.value.map((el) => el[field as keyof IList]).join(',')
console.log('复制店铺单号', str)
copyText(str)
}
function closedFn() {
emits('confirm', selectedList.value)
}
// 监听弹窗状态
// watch(
// () => resultDialog.value,
// (v) => {
// if (v) {
// console.log(127, props.list)
// resultfilter(true)
// }
// },
// )
watch(
() => resultDialog.value,
() => props.list,
(v) => {
if (v) {
console.log(127)
if (v.length) {
console.log(127, v)
resultfilter(true)
}
},
......@@ -137,7 +155,7 @@ defineExpose({
showDialog,
})
const emits = defineEmits<{
(e: 'confirm', data: (string | number)[]): void
(e: 'confirm', data: IList[]): void
}>()
</script>
......
......@@ -1697,13 +1697,13 @@ const handleProductionClientChange = async (v: string) => {
const downloadFacebook = async (row: string) => {
window.open(filePath + row, '_blank')
}
const confirm = async (row: ProductList) => {
confirmDialogShow.value = true
productionClientValue.value = ''
confirmRowData.value = row
confirmData.value = []
confirmSelectionData.value = []
}
// const confirm = async (row: ProductList) => {
// confirmDialogShow.value = true
// productionClientValue.value = ''
// confirmRowData.value = row
// confirmData.value = []
// confirmSelectionData.value = []
// }
//确认生产
async function confirmProduct() {
if (selection.value.length === 0) {
......@@ -1717,12 +1717,17 @@ async function confirmProduct() {
type: 'warning',
})
const ids = selection.value.map((el) => el.id)
await confirmProductApi([...ids])
const { code, data } = await confirmProductApi([...ids])
if (code === 200) {
resultInfo.value = data || []
resultRefs.value?.showDialog()
}
ElMessage.success('操作成功')
search()
await loadTabData()
// search()
// await loadTabData()
} catch {
resultInfo.value = []
return
}
}
......@@ -1737,13 +1742,19 @@ async function confirmProductToRiin() {
cancelButtonText: '取消',
type: 'warning',
})
const ids = selection.value.map((el) => el.id)
await confirmProductToRiinApi([...ids])
const { code, data } = await confirmProductToRiinApi([...ids])
if (code === 200) {
resultInfo.value = data || []
resultRefs.value?.showDialog()
}
ElMessage.success('操作成功')
search()
await loadTabData()
// search()
// await loadTabData()
} catch {
resultInfo.value = []
return
}
}
......@@ -1890,37 +1901,7 @@ const updateOrder = async () => {
loading.close()
}
}
const asyncOrderAddress = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
}
try {
await showConfirm('确定同步收货地址吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await syncReceiverAddress(ids)
if (res.code !== 200) return
ElMessage.success('同步成功')
search()
await loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const assignOrder = async () => {
if (selection.value.length === 0) {
return ElMessage.warning('请选择数据')
......@@ -2325,6 +2306,7 @@ const getOrderByIdApi = async (type: string) => {
const resultInfo = ref([])
const resultConfim = () => {
search()
loadTabData()
}
/**
......@@ -2528,8 +2510,8 @@ const logisticsToPicking = async () => {
resultInfo.value = res.data || []
resultRefs.value?.showDialog()
ElMessage.success('操作成功')
search()
loadTabData()
// search()
// loadTabData()
} catch (e) {
resultInfo.value = []
console.error(e)
......
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