|
|
|
@ -22,6 +22,9 @@
|
|
|
|
|
<el-button type="primary" icon="CirclePlusFilled" @click="InventoryTask" |
|
|
|
|
>创建盘点任务</el-button |
|
|
|
|
> |
|
|
|
|
<el-button type="primary" icon="CircleCloseFilled" @click="discard" |
|
|
|
|
>废弃盘点任务</el-button |
|
|
|
|
> |
|
|
|
|
</div> |
|
|
|
|
<!-- 头部右侧按钮模块 --> |
|
|
|
|
<div class="avue-crud__right"> |
|
|
|
@ -93,8 +96,21 @@
|
|
|
|
|
</el-row> |
|
|
|
|
</div> |
|
|
|
|
<!-- 创建判断任务 --> |
|
|
|
|
<el-dialog v-model="InventoryPopup" title="创建盘点任务" width="30%"> |
|
|
|
|
<el-form :model="formInventory" label-width="120px"> |
|
|
|
|
<el-dialog |
|
|
|
|
v-model="InventoryPopup" |
|
|
|
|
title="创建盘点任务" |
|
|
|
|
width="30%" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
:show-close="false" |
|
|
|
|
> |
|
|
|
|
<el-form |
|
|
|
|
:model="formInventory" |
|
|
|
|
label-width="120px" |
|
|
|
|
ref="ruleFormRef" |
|
|
|
|
:rules="rules" |
|
|
|
|
v-loading="formInventoryloading" |
|
|
|
|
element-loading-text="正在处理中,此任务可能较耗时请耐心等待..." |
|
|
|
|
> |
|
|
|
|
<el-form-item label="商场名称"> |
|
|
|
|
<el-select |
|
|
|
|
multiple |
|
|
|
@ -119,7 +135,7 @@
|
|
|
|
|
<el-input v-model="formInventory.brandName" disabled placeholder="品牌名称" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="盘点时间" class="pdsj"> |
|
|
|
|
<el-form-item label="盘点时间" prop="time"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="formInventory.time" |
|
|
|
|
type="datetimerange" |
|
|
|
@ -135,15 +151,33 @@
|
|
|
|
|
</el-form> |
|
|
|
|
<template #footer> |
|
|
|
|
<span class="dialog-footer"> |
|
|
|
|
<el-button @click="InventoryPopup = false">取消</el-button> |
|
|
|
|
<el-button type="primary" @click="InventorySubmit"> 提交 </el-button> |
|
|
|
|
<el-button @click="InventoryPopup = false">关闭</el-button> |
|
|
|
|
<el-button type="primary" @click="InventorySubmit" :disabled="formInventoryloading"> |
|
|
|
|
提交 |
|
|
|
|
</el-button> |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<!-- 备货删除提示 --> |
|
|
|
|
<DeleteWarningDialog |
|
|
|
|
v-model="popupnotification" |
|
|
|
|
:width="'600'" |
|
|
|
|
title="废弃盘点计划警告!" |
|
|
|
|
confirmButtonText="确认取消" |
|
|
|
|
:loading="popupnotificationloading" |
|
|
|
|
@confirm="handleDialogConfirm" |
|
|
|
|
> |
|
|
|
|
<template #content> |
|
|
|
|
<el-text class="mx-1" size="large"> |
|
|
|
|
<el-icon><StarFilled /></el-icon> |
|
|
|
|
是否确定<strong>废弃</strong>盘点计划,此操作<strong>不可撤销</strong>会造成<strong>数据丢失</strong>,是否继续? |
|
|
|
|
</el-text> |
|
|
|
|
</template> |
|
|
|
|
</DeleteWarningDialog> |
|
|
|
|
</basic-container> |
|
|
|
|
<!-- 列表配置显示 --> |
|
|
|
|
<edittablehead |
|
|
|
|
@setcolum="setnewcolum" |
|
|
|
|
@closce="showdrawer" |
|
|
|
|
:drawerShow="drawerShow" |
|
|
|
|
:columnList="details.columnList" |
|
|
|
@ -161,9 +195,14 @@ import {
|
|
|
|
|
getTaskQuestPage, |
|
|
|
|
getAllDataWithPackage, |
|
|
|
|
getDictList, |
|
|
|
|
postAddtaskQuest, |
|
|
|
|
$_postBatchDelete, |
|
|
|
|
} from '@/api/distribution/createTask'; |
|
|
|
|
import DeleteWarningDialog from '@/components/popupnotification/popupnotification.vue'; |
|
|
|
|
import { useStore } from 'vuex'; |
|
|
|
|
import dayjs from 'dayjs'; |
|
|
|
|
import { Value } from 'sass'; |
|
|
|
|
import error from '@/error'; |
|
|
|
|
const $router = useRouter(); //跳转 |
|
|
|
|
const $useStore = useStore(); //权限 |
|
|
|
|
const $route = useRoute(); //获取地址栏参数 |
|
|
|
@ -171,6 +210,13 @@ const $route = useRoute(); //获取地址栏参数
|
|
|
|
|
const formInventory = ref({}); |
|
|
|
|
const shoppingmall = ref([]); // 商场 |
|
|
|
|
const InventoryPopup = ref(false); //创建盘点任务弹窗 |
|
|
|
|
const popupnotificationloading = ref(false); |
|
|
|
|
const popupnotification = ref(false); |
|
|
|
|
const ruleFormRef = ref(null); |
|
|
|
|
const formInventoryloading = ref(false); |
|
|
|
|
const rules = reactive({ |
|
|
|
|
time: [{ required: true, message: '请选择盘点时间', trigger: 'blur' }], |
|
|
|
|
}); |
|
|
|
|
const details = reactive({ |
|
|
|
|
/** 是否开启搜索 */ |
|
|
|
|
search: false, |
|
|
|
@ -429,7 +475,6 @@ const Getshoppingmall = () => {
|
|
|
|
|
} |
|
|
|
|
if (res.data?.data.length) { |
|
|
|
|
res.data.data.forEach(item => { |
|
|
|
|
console.log(item, '盘点任务返回值'); |
|
|
|
|
shoppingmall.value.push({ |
|
|
|
|
clientName: item.clientName, // 商城名称 |
|
|
|
|
id: item.id, // 商场id |
|
|
|
@ -449,10 +494,109 @@ onLoadPage();
|
|
|
|
|
const InventoryTask = () => { |
|
|
|
|
InventoryPopup.value = true; |
|
|
|
|
}; |
|
|
|
|
const InventorySubmit=()=>{ |
|
|
|
|
console.log(formInventory.value); |
|
|
|
|
|
|
|
|
|
// 废弃盘点任务 |
|
|
|
|
const discard = () => { |
|
|
|
|
if (!details.selectionList.length) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: '请选择要废弃的盘点任务', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
popupnotification.value = true; |
|
|
|
|
}; |
|
|
|
|
// 废弃盘点取消 |
|
|
|
|
|
|
|
|
|
// 废弃盘点确认 |
|
|
|
|
const handleDialogConfirm = () => { |
|
|
|
|
let data = { |
|
|
|
|
ids: details.selectionList.map(item => item.id).join(','), |
|
|
|
|
}; |
|
|
|
|
popupnotificationloading.value = true; |
|
|
|
|
$_postBatchDelete(data) |
|
|
|
|
.then(res => { |
|
|
|
|
console.log(res); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}); |
|
|
|
|
onLoad(); |
|
|
|
|
popupnotification.value = false; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(error => { |
|
|
|
|
console.log(error, 'error'); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
popupnotificationloading.value = false; |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// 处理商场名称函数根据传入ID读取列表中的商场 |
|
|
|
|
function matchInfoById(idArray, infoArray) { |
|
|
|
|
const matchedInfo = []; |
|
|
|
|
idArray.forEach(id => { |
|
|
|
|
const matchedItem = infoArray.find(item => item.id === id); |
|
|
|
|
if (matchedItem) { |
|
|
|
|
matchedInfo.push(matchedItem); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return matchedInfo; |
|
|
|
|
} |
|
|
|
|
// 商场名称选择回调 |
|
|
|
|
const formInventoryChange = Value => { |
|
|
|
|
const matchedInfo = matchInfoById(Value, shoppingmall.value); |
|
|
|
|
formInventory.value.brandName; |
|
|
|
|
let name = []; |
|
|
|
|
matchedInfo.forEach(item => { |
|
|
|
|
name.push(item.brandName); |
|
|
|
|
}); |
|
|
|
|
formInventory.value.brandName = name.join(','); //处理品牌名称显示 |
|
|
|
|
}; |
|
|
|
|
// 盘点提交 |
|
|
|
|
const InventorySubmit = async () => { |
|
|
|
|
try { |
|
|
|
|
await ruleFormRef.value.validate(); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error('表单验证失败:', error); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//结构参数 |
|
|
|
|
const { |
|
|
|
|
scname, |
|
|
|
|
time: [startTime, endTime], |
|
|
|
|
} = formInventory.value; |
|
|
|
|
//商场处理 |
|
|
|
|
const matchedInfo = (scname && matchInfoById(scname, shoppingmall.value)) || []; |
|
|
|
|
|
|
|
|
|
const list = scname |
|
|
|
|
? matchedInfo.map(({ id, clientName }) => ({ |
|
|
|
|
refId: id, |
|
|
|
|
refName: clientName, |
|
|
|
|
})) |
|
|
|
|
: []; |
|
|
|
|
//构建提交数据 |
|
|
|
|
const data = { startTime, endTime, list }; |
|
|
|
|
console.log('数据:', data); |
|
|
|
|
formInventoryloading.value = true; |
|
|
|
|
postAddtaskQuest(data) |
|
|
|
|
.then(res => { |
|
|
|
|
if ((res.data.code = 200)) { |
|
|
|
|
ElMessage({ |
|
|
|
|
message: res.data.msg, |
|
|
|
|
type: 'success', |
|
|
|
|
}); |
|
|
|
|
InventoryPopup.value = false; |
|
|
|
|
onLoad(); //初始化页面 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(error => { |
|
|
|
|
console.log(error, 'error'); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
|
formInventoryloading.value = false; |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// 页面初始化方法 |
|
|
|
|
// 导出盘点数据 |
|
|
|
|
const ExportDataIndexRwo = row => { |
|
|
|
|