| | |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request"; |
| | | import deepClone from "@/utils/deepClone"; |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import VXETable from "vxe-table"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {ElMessage} from "element-plus"; |
| | | |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const userid = userStore.user.userId |
| | | let router=useRouter() |
| | | let produceList = ref([]) |
| | | let tableRef = ref([]) |
| | |
| | | } |
| | | }) |
| | | |
| | | let pageNum=ref(1) |
| | | let total = reactive({ |
| | | pageTotal : 0, |
| | | dataTotal : 0, |
| | | pageSize : 10 |
| | | }) |
| | | |
| | | |
| | | //第一次调用 |
| | | request.post("/FinishedGoodsInventory/getseletwarehousing/1/100",filterData.value).then((res) => { |
| | | request.post(`/FinishedGoodsInventory/getseletwarehousing/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | pageTotal.value=res.data.total |
| | | pageNum=1 |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | }) |
| | | |
| | | |
| | | //定义页面总页数 |
| | | let pageTotal=ref('') |
| | | //定义当前页数 |
| | | let pageNum=$ref(1) |
| | | |
| | | let pageState = null |
| | | |
| | | /*使用筛选,后端获取数据*/ |
| | |
| | | }else{ |
| | | filterData.value[column.property] = value |
| | | } |
| | | request.post("/FinishedGoodsInventory/getseletwarehousing/1/100",filterData.value).then((res) => { |
| | | request.post(`/FinishedGoodsInventory/getseletwarehousing/1/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | console.log(res.data) |
| | | pageTotal.value=res.data.total |
| | | pageNum=1 |
| | | total.dataTotal = res.data.total.total*1 |
| | | total.pageTotal= res.data.total.pageTotal |
| | | pageNum.value=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | |
| | | } |
| | | }) |
| | | } |
| | | const selectOrderList = ()=>{ |
| | | |
| | | request.post(`/FinishedGoodsInventory/getseletwarehousing/${pageNum.value}/${total.pageSize}`,filterData.value).then((res) => { |
| | | |
| | | if(res.code==200){ |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | //页脚跳转 |
| | | const handlePageChange = ({ currentPage, pageSize }) => { |
| | | total.pageTotal = pageSize |
| | | pageNum.value=currentPage |
| | | |
| | | selectOrderList() |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return `页数:${pageNum}/${pageTotal.value}` |
| | | return `合计` |
| | | } |
| | | |
| | | return '' |
| | |
| | | const xGrid = ref(); |
| | | const storageRegion = ref(null); |
| | | const remark = ref(null); |
| | | const flowcard = ref(null); |
| | | |
| | | const gridEvents = { |
| | | toolbarButtonClick ({ code }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'add': { |
| | | //判断输入框值不能为null |
| | | if(storageRegion.value!==null && storageRegion.value!=""){ |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | //循环获取选中的复选框 |
| | | for (let i=0;i<selectRecords.length;i++){ |
| | | //定义后端需要的参数 |
| | | let flowData = ref({ |
| | | finishedGoodsInventory:{ |
| | | storageRegion:storageRegion.value, |
| | | remark:remark.value |
| | | }, |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | |
| | | flowcard:selectRecords[0] |
| | | }) |
| | | console.log(flowcard.value) |
| | | request.post("/FinishedGoodsInventory/addseletwarehousing",flowData.value).then((res) => { |
| | | /* request.post("/FinishedGoodsInventory/addseletwarehousing/"+storageRegion.value+"/"+remark.value,flowData.value).then((res) => {*/ |
| | | if(res.code===200){ |
| | | alert(`入库成功`) |
| | | request.post("/FinishedGoodsInventory/getseletwarehousing/1/100",filterData.value).then((res) => { |
| | | let flowData = ref({ |
| | | userId:userid, |
| | | userName:username, |
| | | storageRegion:storageRegion.value, |
| | | remark:remark.value, |
| | | flowcard:selectRecords |
| | | }) |
| | | |
| | | if(res.code===200){ |
| | | console.log(res.data) |
| | | pageTotal.value=res.data.total |
| | | pageNum=1 |
| | | produceList = deepClone(res.data.data) |
| | | xGrid.value.loadData(produceList) |
| | | gridOptions.loading=false |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | return; |
| | | request.post("/FinishedGoodsInventory/addseletwarehousing",flowData.value).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success("入库成功") |
| | | location.reload(); |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | |
| | | |
| | | }else{ |
| | | alert(`请输入库位`) |
| | | } |
| | | return; |
| | | |
| | | } |
| | | |
| | |
| | | </div> |
| | | </template> |
| | | |
| | | <template #pager> |
| | | <!--使用 pager 插槽--> |
| | | <vxe-pager |
| | | @page-change="handlePageChange" |
| | | :layouts="[ 'PrevPage', 'Jump','PageCount', 'NextPage', 'Total']" |
| | | v-model:current-page="pageNum" |
| | | v-model:page-size="total.pageSize" |
| | | v-model:pager-count="total.pageTotal" |
| | | :total="total.dataTotal" |
| | | > |
| | | </vxe-pager> |
| | | </template> |
| | | |
| | | |
| | | </vxe-grid> |
| | | </div> |