| | |
| | | import BasicTable from '@/components/basic/BasicTable.vue' |
| | | import {VXETable} from "vxe-table"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | |
| | | let router = useRouter() |
| | | const userStore = useUserInfoStore() |
| | | const username = userStore.user.userName |
| | | const getTableRow = (row,type) =>{ |
| | | const getTableRow = (row, type) => { |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | case 'edit' : { |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/processCard/PrintFlowCard', query: { id: row.id }}) |
| | | router.push({path: '/main/processCard/PrintFlowCard', query: {id: row.id}}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | case 'delete': { |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | case 'setType':{ |
| | | case 'setType': { |
| | | alert('我接收到子组件传送的排版状态') |
| | | break |
| | | } |
| | |
| | | //定义表单值 |
| | | const form = reactive({ |
| | | date1: '', |
| | | orderId:'' |
| | | orderId: '' |
| | | }) |
| | | |
| | | |
| | | |
| | | //表尾求和 |
| | |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | const start = new Date(new Date().getTime()- 3600 * 1000 * 24 * 7) |
| | | const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0,10) //默认开始时间7天前 |
| | | const end = new Date(new Date().getTime()+3600 * 1000 * 24) |
| | | .slice(0, 10) //默认开始时间7天前 |
| | | const end = new Date(new Date().getTime() + 3600 * 1000 * 24) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0,10)//默认结束时间当前时间 |
| | | .slice(0, 10)//默认结束时间当前时间 |
| | | return [start, end] |
| | | } |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1=getNowTime() |
| | | form.date1 = getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | //第一次加载数据 |
| | |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | //禁用删除、保存按钮 |
| | | gridOptions.toolbarConfig.buttons[0].disabled = true |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | |
| | | |
| | | //点击时查询 |
| | | const getWorkOrder = () => { |
| | | let selectProcesses=value.value |
| | | let selectProcesses = value.value |
| | | let selectState = stateValue.value |
| | | let inputVal=form.orderId |
| | | if (inputVal== ''){ |
| | | inputVal=null |
| | | let inputVal = form.orderId |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | if (selectProcesses== ''){ |
| | | selectProcesses=null |
| | | if (selectProcesses == '') { |
| | | selectProcesses = null |
| | | } |
| | | if (inputVal== null && selectState==1){ |
| | | if (inputVal == null && selectState == 1) { |
| | | //根据时间查询未排产数据 |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => { |
| | | |
| | |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | | //禁用删除、保存按钮 |
| | | gridOptions.toolbarConfig.buttons[0].disabled = true |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | else if(inputVal!=null && selectState==1){ |
| | | } else if (inputVal != null && selectState == 1) { |
| | | //根据订单号查询未排产数据 |
| | | request.post(`/productionScheduling/selectScheduling/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | | //禁用删除、保存按钮 |
| | | gridOptions.toolbarConfig.buttons[0].disabled = true |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | else if(inputVal== null && selectState==2){ |
| | | } else if (inputVal == null && selectState == 2) { |
| | | //根据时间查询已排产数据 |
| | | request.post(`/productionScheduling/selectScheduling/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | | //启用删除、保存按钮 |
| | | gridOptions.toolbarConfig.buttons[0].disabled = false |
| | | gridOptions.toolbarConfig.buttons[1].disabled = false |
| | | //禁用保存 |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | else if(inputVal!= null && selectState==2){ |
| | | } else if (inputVal != null && selectState == 2) { |
| | | //根据订单号查询已排产数据 |
| | | request.post(`/productionScheduling/selectSchedulingNot/${startTime}/${endTime}/${inputVal}/${selectProcesses}/${selectState}`, filterData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | | //启用删除、保存按钮 |
| | | gridOptions.toolbarConfig.buttons[0].disabled = false |
| | | gridOptions.toolbarConfig.buttons[1].disabled = false |
| | | //禁用保存 |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | //子组件接收参数 |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | stripe: true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true, height: 50},//鼠标移动或选择高亮 |
| | | id: 'CustomerList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | scrollY: {enabled: true},//开启虚拟滚动 |
| | | showOverflow: true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | columns:[ |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | { type: 'checkbox',fixed:"left", title: '选择', width: 80 }, |
| | | { type: 'seq',fixed:"left", title: '自序', width: 50 }, |
| | | {field: 'scheduled_start_time' , width: 120,editRender: { name: 'input', attrs: { placeholder: '',type:'date' } }, title: '计划开始时间'}, |
| | | {field: 'plan_end_time' , width: 120,editRender: { name: 'input', attrs: { placeholder: '',type:'date' } }, title: '计划结束时间'}, |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {type: 'checkbox', fixed: "left", title: '选择', width: 80}, |
| | | {type: 'seq', fixed: "left", title: '自序', width: 50}, |
| | | { |
| | | field: 'scheduled_start_time', |
| | | width: 120, |
| | | editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}}, |
| | | title: '计划开始时间' |
| | | }, |
| | | { |
| | | field: 'plan_end_time', |
| | | width: 120, |
| | | editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}}, |
| | | title: '计划结束时间' |
| | | }, |
| | | // {field: '排产编号', title: '排产编号', width: 120 }, |
| | | {field: 'order_id', title: '销售单号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, width: 100 }, |
| | | {field: 'customer_name', title: '客户名称', width: 110,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'project', title: '项目名称', width: 100,filters:[{ data: '' }],slots: { filter: 'num1_filter' }}, |
| | | {field: 'order_number', title: '序号', filters:[{ data: '' }],slots: { filter: 'num1_filter' }, width: 70}, |
| | | {field: 'order_id', title: '销售单号', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 100}, |
| | | {field: 'customer_name', title: '客户名称', width: 110, filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'project', title: '项目名称', width: 100, filters: [{data: ''}], slots: {filter: 'num1_filter'}}, |
| | | {field: 'order_number', title: '序号', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 70}, |
| | | |
| | | {field: 'width', title: '宽', width: 60}, |
| | | {field: 'height', title: '高', width: 60}, |
| | | {field: 'quantity', title: '订单数量', width: 70}, |
| | | {field: 'area', title: '订单面积', width: 90}, |
| | | {field: 'scheduling_quantity' , width: 120,editRender: { name: 'input', attrs: { placeholder: '' } }, title: '排产数量', sortable: true}, |
| | | {field: 'pendingProductionQuantity', title: '待排产数量', width: 120}, |
| | | {field: 'pendingProductionArea', title: '待排产面积', width: 120}, |
| | | {field: 'productionScheduledQuantity', title: '已排产数量', width: 120}, |
| | | {field: 'productionScheduledArea', title: '已排产面积', width: 120}, |
| | | {field: 'review_status', title: '审核状态', width: 140}, |
| | | {field: 'reviewer', title: '审核人', width: 140}, |
| | | {field: 'product_name', title: '产品名称', width: 140}, |
| | | {field: 'shape', title: '形状', width: 80}, |
| | | {field: 'notes', title: '备注', editRender: { name: 'input', attrs: { placeholder: '' } }, width: 120}, |
| | | {field: 'width', title: '宽', width: 60}, |
| | | {field: 'height', title: '高', width: 60}, |
| | | {field: 'quantity', title: '订单数量', width: 70}, |
| | | {field: 'area', title: '订单面积', width: 90}, |
| | | { |
| | | field: 'scheduling_quantity', |
| | | width: 120, |
| | | editRender: {name: 'input', attrs: {placeholder: ''}}, |
| | | title: '排产数量', |
| | | sortable: true |
| | | }, |
| | | {field: 'pendingProductionQuantity', title: '待排产数量', width: 120}, |
| | | {field: 'pendingProductionArea', title: '待排产面积', width: 120}, |
| | | {field: 'productionScheduledQuantity', title: '已排产数量', width: 120}, |
| | | {field: 'productionScheduledArea', title: '已排产面积', width: 120}, |
| | | {field: 'review_status', title: '审核状态', width: 140}, |
| | | {field: 'reviewer', title: '审核人', width: 140}, |
| | | {field: 'product_name', title: '产品名称', width: 140}, |
| | | {field: 'shape', title: '形状', width: 80}, |
| | | {field: 'notes', title: '备注', editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120}, |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | {code: 'delete', name: '删除',status:'primary' }, |
| | | {code: 'review', name: '审核',status:'primary' }, |
| | | {code: 'save', name: '排产',status:'primary' ,icon:'vxe-icon-save'}, |
| | | {code: 'delete', name: '删除', status: 'primary'}, |
| | | {code: 'review', name: '审核', status: 'primary'}, |
| | | {code: 'save', name: '排产', status: 'primary', icon: 'vxe-icon-save'}, |
| | | ], |
| | | import: false, |
| | | // export: true, |
| | |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [ |
| | | |
| | | ],//table body实际数据 |
| | | data: [],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | let footList=['数量','面积','排产数量','已排产数量','已排产面积','未排产数量','未排产面积'] |
| | | return[ |
| | | footerMethod({columns, data}) {//页脚函数 |
| | | let footList = ['数量', '面积', '排产数量', '已排产数量', '已排产面积', '未排产数量', '未排产面积'] |
| | | return [ |
| | | columns.map((column, columnIndex) => { |
| | | if (columnIndex === 0) { |
| | | return '合计:' |
| | |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | if (selectRecords.length==0){ |
| | | ElMessage.success("请勾选排产数据") |
| | | if (selectRecords.length == 0) { |
| | | ElMessage.warning("请勾选排产数据") |
| | | return; |
| | | } |
| | | for (let i = 0; i < selectRecords.length; i++){ |
| | | let start= selectRecords[i].scheduled_start_time |
| | | let end= selectRecords[i].plan_end_time |
| | | let number=selectRecords[i].scheduling_quantity |
| | | for (let i = 0; i < selectRecords.length; i++) { |
| | | let start = selectRecords[i].scheduled_start_time |
| | | let end = selectRecords[i].plan_end_time |
| | | let number = selectRecords[i].scheduling_quantity |
| | | //计划开始、结束时间,排产数量不能为空 |
| | | if (start==null || end==null || number==null){ |
| | | ElMessage.success("请填入对应的值再进行保存") |
| | | if (start == null || end == null || number == null) { |
| | | ElMessage.warning("请填入对应的值再进行保存") |
| | | return; |
| | | } |
| | | } |
| | | let selectProcesses=value.value |
| | | if (selectProcesses==null || selectProcesses==""){ |
| | | ElMessage.success("请选择排产工序") |
| | | let selectProcesses = value.value |
| | | if (selectProcesses == null || selectProcesses == "") { |
| | | ElMessage.warning("请选择排产工序") |
| | | return; |
| | | } |
| | | |
| | | let schedulingData = ref({ |
| | | scheduling: selectRecords, |
| | | processes:selectProcesses,//工序 |
| | | userName:username//审核人 |
| | | processes: selectProcesses,//工序 |
| | | userName: username//审核人 |
| | | }) |
| | | console.log(schedulingData.value) |
| | | //保存排产数据 |
| | |
| | | |
| | | } |
| | | |
| | | const determineNum = () => { |
| | | const $grid = xGrid.value |
| | | const table = $grid.getTableData().fullData |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | console.log(selectRecords) |
| | | table.forEach((selectRecords) => { |
| | | if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity) { |
| | | ElMessage.warning("排产数量不能大于待排产数量") |
| | | //禁用保存按钮 |
| | | //gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | } |
| | | |
| | | |
| | | }) |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | |
| | | <el-row :gutter="0"> |
| | | <el-date-picker |
| | | v-model="form.date1" |
| | | type="daterange" |
| | | format="YYYY/MM/DD" |
| | | value-format="YYYY-MM-DD" |
| | | start-placeholder="开始时间" |
| | | end-placeholder="结束时间" |
| | | :default-time="defaultTime" |
| | | end-placeholder="结束时间" |
| | | format="YYYY/MM/DD" |
| | | start-placeholder="开始时间" |
| | | type="daterange" |
| | | value-format="YYYY-MM-DD" |
| | | |
| | | /> |
| | | |
| | | <el-input placeholder="销售单号" v-model="form.orderId" style="width: 110px"></el-input> |
| | | <el-input v-model="form.orderId" placeholder="销售单号" style="width: 110px"></el-input> |
| | | |
| | | <el-select v-model="value" class="m-2" placeholder="工序" style="width: 90px;"> |
| | | <el-option |
| | |
| | | </el-select> |
| | | |
| | | <el-button |
| | | @click="getWorkOrder" |
| | | id="select" |
| | | type="primary" :icon="Search">查询 |
| | | :icon="Search" |
| | | type="primary" @click="getWorkOrder">查询 |
| | | </el-button> |
| | | </el-row> |
| | | |
| | | </div> |
| | | <vxe-grid |
| | | max-height="100%" |
| | | @filter-change="filterChanged" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | max-height="100%" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @filter-change="filterChanged" |
| | | @checkbox-change="determineNum" |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |
| | | <input type="type" v-model="option.data" @input="changeFilterEvent($event, option, $panel)"/> |
| | | <input v-model="option.data" type="type" @input="changeFilterEvent($event, option, $panel)"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <style scoped> |
| | | .main-div-customer{ |
| | | .main-div-customer { |
| | | width: 99%; |
| | | height: 100%; |
| | | } |
| | | |
| | | #selectForm { |
| | | width: 70%; |
| | | text-align: center; |