Commit 27bd0959 by linjinhong

修改结果弹窗

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