| | |
| | | import BasicTable from '@/components/basic/BasicTable.vue' |
| | | import {VXETable} from "vxe-table"; |
| | | import useUserInfoStore from "@/stores/userInfo"; |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | import {changeFilterEvent, filterChanged} from "@/hook" |
| | | import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove"; |
| | | |
| | | |
| | | let router = useRouter() |
| | | const userStore = useUserInfoStore() |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //工序 |
| | | const value = ref('') |
| | | const value = ref('切割') |
| | | |
| | | |
| | | //排产状态 |
| | |
| | | return [start, end] |
| | | } |
| | | |
| | | onMounted(()=>{ |
| | | //启用表格拖动选中 |
| | | addListener(xGrid.value,gridOptions) |
| | | }) |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1 = getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | let selectProcesses = value.value |
| | | let inputVal = form.orderId |
| | | if (inputVal == '') { |
| | | inputVal = null |
| | | } |
| | | if (selectProcesses == '') { |
| | | selectProcesses = null |
| | | } |
| | | //第一次加载数据 |
| | | |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => { |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}/${selectProcesses}/${inputVal}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | titleSelectJson.value.processType=res.data.process |
| | | titleSelectJson.value.processType = res.data.process |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | console.log(res.data) |
| | | //禁用删除、保存按钮 |
| | | gridOptions.toolbarConfig.buttons[0].disabled = true |
| | | gridOptions.toolbarConfig.buttons[1].disabled = true |
| | |
| | | } |
| | | if (inputVal == null && selectState == 1) { |
| | | //根据时间查询未排产数据 |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => { |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}/${selectProcesses}/${inputVal}`, 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 |
| | | //启用保存 |
| | |
| | | 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 if (inputVal == null && selectState == 2) { |
| | | //根据时间查询已排产数据 |
| | | console.log(startTime, endTime, selectProcesses, selectState) |
| | | 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 |
| | | //禁用保存 |
| | |
| | | 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 |
| | | //禁用保存 |
| | |
| | | |
| | | } |
| | | |
| | | /*后端返回结果多层嵌套展示*/ |
| | | const hasDecimal = (value) => { |
| | | const regex = /\./; // 定义正则表达式,查找小数点 |
| | | return regex.test(value); // 返回true/false |
| | | } |
| | | |
| | | |
| | | //子组件接收参数 |
| | | const xGrid = ref() |
| | |
| | | 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: {}, |
| | |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | // remote: true |
| | | // remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | },//表头参数 |
| | | }, |
| | | menuConfig: { |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'copyChecked', name: '选中相同', prefixIcon: 'vxe-icon-copy', visible: true, disabled: false }, |
| | | { code: 'copyAll', name: '之后相同', prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false }, |
| | | { code: 'clearChecked', name: '清除选中', prefixIcon: 'vxe-icon-indicator', visible: true, disabled: false }, |
| | | ] |
| | | ] |
| | | } |
| | | }, |
| | | //表头参数 |
| | | columns: [ |
| | | {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50}, |
| | | {type: 'checkbox', fixed: "left", title: '选择', width: 80}, |
| | |
| | | title: '计划结束时间' |
| | | }, |
| | | // {field: '排产编号', title: '排产编号', width: 120 }, |
| | | {field: 'order_id', title: '销售单号', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 100,filterMethod:filterChanged}, |
| | | {field: 'customer_name', title: '客户名称', width: 110, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, |
| | | {field: 'project', title: '项目名称', width: 100, filters: [{data: ''}], slots: {filter: 'num1_filter'},filterMethod:filterChanged}, |
| | | {field: 'order_number', title: '序号', filters: [{data: ''}], slots: {filter: 'num1_filter'}, width: 70,filterMethod:filterChanged}, |
| | | |
| | | {field: 'width', title: '宽', width: 60,filters: [{data: ''}],slots: {filter: 'num1_filter'},filterMethod:filterChanged}, |
| | | {field: 'height', title: '高', width: 60,filters: [{data: ''}],slots: {filter: 'num1_filter'},filterMethod:filterChanged}, |
| | | { |
| | | field: 'order_id', |
| | | title: '销售单号', |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | width: 100, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'customer_name', |
| | | title: '客户名称', |
| | | width: 110, |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'project', |
| | | title: '项目名称', |
| | | width: 100, |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'order_number', |
| | | title: '序号', |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | width: 70, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'technology_number', |
| | | title: '小片顺序', |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | width: 70, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'child_width', |
| | | title: '宽', |
| | | width: 60, |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | { |
| | | field: 'child_height', |
| | | title: '高', |
| | | width: 60, |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged |
| | | }, |
| | | {field: 'quantity', title: '订单数量', width: 70}, |
| | | {field: 'area', title: '订单面积', width: 90}, |
| | | { |
| | |
| | | {field: 'productionScheduledArea', title: '已排产面积', width: 120}, |
| | | {field: 'review_status', title: '审核状态', width: 140}, |
| | | {field: 'reviewer', title: '审核人', width: 140}, |
| | | {field: 'product_name', title: '产品名称', width: 140}, |
| | | {field: 'glass_child', title: '产品名称', width: 140}, |
| | | {field: 'shape', title: '形状', width: 80}, |
| | | {field: 'notes', title: '备注', editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120}, |
| | | {field: 'scheduling_id', title: '排产编号',width: 120}, |
| | | {field: 'scheduling_id', title: '排产编号', width: 120}, |
| | | ],//表头按钮 |
| | | |
| | | toolbarConfig: { |
| | |
| | | |
| | | }) |
| | | |
| | | //删除 |
| | | |
| | | |
| | | //表格按钮 |
| | | const gridEvents = { |
| | | async toolbarButtonClick({code}) { |
| | | const $grid = xGrid.value |
| | |
| | | processes: selectProcesses,//工序 |
| | | userName: username//审核人 |
| | | }) |
| | | //禁用保存 |
| | | gridOptions.toolbarConfig.buttons[2].disabled = true |
| | | //保存排产数据 |
| | | request.post("/productionScheduling/addScheduling", schedulingData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success("保存成功") |
| | | location.reload(); |
| | | // 启用保存 |
| | | gridOptions.toolbarConfig.buttons[2].disabled = false |
| | | router.push({ |
| | | path: '/main/processCard/ProductionScheduling', |
| | | query: { random: Math.random()} |
| | | }) |
| | | } else { |
| | | // 启用保存 |
| | | gridOptions.toolbarConfig.buttons[2].disabled = false |
| | | ElMessage.warning(res.msg) |
| | | |
| | | } |
| | |
| | | scheduling: selectRecords, |
| | | }) |
| | | |
| | | request.post("/productionScheduling/deleteScheduling",schedulingData.value).then((res) => { |
| | | request.post("/productionScheduling/deleteScheduling", schedulingData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success("删除成功") |
| | | location.reload(); |
| | |
| | | scheduling: selectRecords, |
| | | userName: username//审核人 |
| | | }) |
| | | request.post("/productionScheduling/examineScheduling",schedulingData.value).then((res) => { |
| | | request.post("/productionScheduling/examineScheduling", schedulingData.value).then((res) => { |
| | | if (res.code == 200) { |
| | | ElMessage.success("审核成功") |
| | | location.reload(); |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | case 'copyChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | case 'copyAll' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | const val = dataList[result.start][result.cell] |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start ){ |
| | | item[result.cell] = val |
| | | } |
| | | }) |
| | | } |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | case 'clearChecked' :{ |
| | | let result = toolbarButtonClickEvent() |
| | | if(result){ |
| | | const dataList = xGrid.value.getTableData().visibleData |
| | | dataList.forEach((item,index) =>{ |
| | | if(index>=result.start && index<=result.end){ |
| | | item[result.cell] = '' |
| | | } |
| | | }) |
| | | } |
| | | gridOptions.menuConfig.body.options[0][5].disabled=false |
| | | break |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | |
| | | const determineNum = () => { |
| | | const $grid = xGrid.value |
| | | const table = $grid.getTableData().fullData |
| | | const selectRecords = $grid.getCheckboxRecords() |
| | | let selectState = stateValue.value |
| | | table.forEach((selectRecords) => { |
| | | if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity) { |
| | | if (selectRecords.scheduling_quantity > selectRecords.pendingProductionQuantity && selectState==1) { |
| | | ElMessage.warning("排产数量不能大于待排产数量") |
| | | //禁用保存按钮 |
| | | //gridOptions.toolbarConfig.buttons[2].disabled = true |
| | |
| | | |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | |
| | | |
| | | /> |
| | | |
| | | <el-input v-model="form.orderId" placeholder="销售单号" clearable style="width: 110px"></el-input> |
| | | <el-input v-model="form.orderId" clearable placeholder="销售单号" style="width: 110px"></el-input> |
| | | |
| | | <el-select v-model="value" clearable placeholder="请选择工序" style="width: 120px"> |
| | | <el-select v-model="value" clearable default-value="default_city" style="width: 120px"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | | :key="item.id" |
| | |
| | | <vxe-grid |
| | | ref="xGrid" |
| | | class="mytable-scrollbar" |
| | | max-height="100%" |
| | | height="100%" |
| | | max-height="100%" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @filter-change="filterChanged" |
| | |
| | | |
| | | </vxe-grid> |
| | | </div> |
| | | <div class="vxe-table--cell-area" ref="cellArea" > |
| | | <span class="vxe-table--cell-main-area" ></span> |
| | | |
| | | <span class="vxe-table--cell-active-area" ></span> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | |
| | | height: 6%; |
| | | text-align: center; |
| | | } |
| | | .vxe-grid { |
| | | /* 禁用浏览器默认选中 */ |
| | | -webkit-user-select: none; |
| | | -moz-user-select: none; |
| | | -ms-user-select: none; |
| | | user-select: none; |
| | | } |
| | | </style> |