| | |
| | | <script setup> |
| | | |
| | | import {reactive, ref} from "vue"; |
| | | import {useRouter} from 'vue-router' |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import {ElDatePicker, ElMessage} from "element-plus" |
| | | import useProductGlassTypeStore from "@/stores/sd/product/productGlassType" |
| | | import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue" |
| | | import {Search} from "@element-plus/icons-vue" |
| | | import GlassType from "@/components/sd/product/GlassType.vue" |
| | | import {useRouter} from 'vue-router' |
| | | import Sortable from 'sortablejs' |
| | | import BasicTable from '@/components/basic/BasicTable.vue' |
| | | import {VXETable} from "vxe-table"; |
| | | let router=useRouter() |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | |
| | | } |
| | | } |
| | | |
| | | //工序 |
| | | const value = ref('') |
| | | const options = [ |
| | | { |
| | | value: '切割', |
| | | label: '切割', |
| | | }, |
| | | { |
| | | value: '磨边', |
| | | label: '磨边', |
| | | }, |
| | | { |
| | | value: '钢化', |
| | | label: '钢化', |
| | | }, |
| | | ] |
| | | |
| | | //排产状态 |
| | | const stateValue = ref('1') |
| | | const stateOptions = [ |
| | | { |
| | | value: '2', |
| | | label: '已排产', |
| | | }, |
| | | { |
| | | value: '1', |
| | | label: '未排产', |
| | | }, |
| | | ] |
| | | |
| | | function padLeftZero(str) { |
| | | return ('00' + str).substr(str.length) |
| | | } |
| | | |
| | | //定义表单值 |
| | | const form = reactive({ |
| | | date1: '', |
| | | orderId:'' |
| | | }) |
| | | |
| | | |
| | | |
| | | //表尾求和 |
| | |
| | | return count.toFixed(2) |
| | | } |
| | | |
| | | //子组件接收参数 |
| | | //定义滚动条高度 |
| | | let scrollTop = ref(null) |
| | | let scrollHeight = ref(null) |
| | | let clientHeight = ref(null) |
| | | const scrollEvnt = (row) => { |
| | | // 内容高度 |
| | | scrollTop.value = row.$event.target.scrollTop |
| | | scrollHeight.value = row.$event.target.scrollHeight |
| | | clientHeight.value = row.$event.target.clientHeight |
| | | } |
| | | //筛选条件,有外键需要先定义明细里面的数据 |
| | | let filterData = ref({ |
| | | order: { |
| | | project: '' |
| | | }, |
| | | orderDetail: { |
| | | productId: '', |
| | | productName: '', |
| | | computeGrossArea: '', |
| | | processingNote: '', |
| | | } |
| | | |
| | | }) |
| | | //定义页面总页数 |
| | | let pageTotal = ref('') |
| | | //定义数据返回结果 |
| | | let produceList = ref([]) |
| | | //定义当前页数 |
| | | let pageNum = $ref(1) |
| | | let pageState = null |
| | | |
| | | |
| | | //获取七天前到当前时间 |
| | | function getNowTime() { |
| | | 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) |
| | | .toISOString() |
| | | .replace('T', ' ') |
| | | .slice(0,10)//默认结束时间当前时间 |
| | | return [start, end] |
| | | } |
| | | |
| | | //第一次加载获取近七天时间和默认状态 |
| | | form.date1=getNowTime() |
| | | let startTime = form.date1[0] |
| | | let endTime = form.date1[1] |
| | | //第一次加载数据 |
| | | |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | produceList = produceList.value.concat(deepClone(res.data.data)) |
| | | xGrid.value.reloadData(produceList) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | |
| | | //点击时查询 |
| | | const getWorkOrder = () => { |
| | | let selectProcesses=value.value |
| | | let selectState = stateValue.value |
| | | let inputVal=form.orderId |
| | | if (inputVal== ''){ |
| | | inputVal=null |
| | | } |
| | | if (selectProcesses== ''){ |
| | | selectProcesses=null |
| | | } |
| | | if (inputVal== null && selectState==1){ |
| | | //根据时间查询未排产数据 |
| | | request.post(`/productionScheduling/selectLastScheduling/${startTime}/${endTime}`, filterData.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | pageTotal.value = res.data.total |
| | | xGrid.value.loadData(res.data.data) |
| | | gridOptions.loading = false |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | 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 |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | 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 |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | 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 |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | //子组件接收参数 |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | |
| | | {type:'expand',fixed:"left",slots: { content:'content' },width: 50}, |
| | | { type: 'checkbox',fixed:"left", title: '选择', width: 80 }, |
| | | { type: 'seq',fixed:"left", title: '自序', width: 50 }, |
| | | {field: '排产编号', title: '排产编号', sortable: true, width: 120 }, |
| | | {field: '销售单号', title: '销售单号',slots: { filter: 'num1_filter' }, sortable: true, width: 100 }, |
| | | {field: '客户名称', title: '客户名称', sortable: true, width: 110}, |
| | | {field: '项目名称', title: '项目名称', sortable: true , width: 100}, |
| | | {field: '序号', title: '序号', sortable: true,filters:[{ data: '' }],slots: { filter: 'num1_filter' }, width: 90}, |
| | | {field: '产品名称', title: '产品名称', sortable: true, width: 140}, |
| | | {field: '宽', title: '宽', sortable: true , width: 70}, |
| | | {field: '高', title: '高', sortable: true , width: 70}, |
| | | {field: '数量', title: '数量', sortable: true , width: 70}, |
| | | {field: '面积', title: '面积', sortable: true , width: 90}, |
| | | {field: '排产数量' , width: 120,editRender: { name: 'input', attrs: { placeholder: '' } }, title: '排产数量', sortable: true}, |
| | | {field: '已排产数量', title: '已排产数量', sortable: true , width: 120}, |
| | | {field: '已排产面积', title: '已排产面积', sortable: true , width: 120}, |
| | | {field: '未排产数量', title: '未排产数量', sortable: true , width: 120}, |
| | | {field: '未排产面积', title: '未排产面积', sortable: true , width: 120}, |
| | | {field: '形状', title: '形状', sortable: true , width: 80}, |
| | | {field: '备注', title: '备注', sortable: true , width: 120}, |
| | | {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: '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: 'print_lck', name: '删除',status:'primary' }, |
| | | {code: 'print_lck', 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, |
| | | print: true, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | data: [ |
| | | { |
| | | 排产编号:"PC20230100001", |
| | | 销售单号: 'NG231207', |
| | | 客户名称:'XXX公司', |
| | | 项目名称:"XXXX公园", |
| | | 序号: '1', |
| | | 产品名称: '6mm超白Low-E(外)+A12+6mm超白平钢(内)', |
| | | 宽: '2000', |
| | | 高: '1000', |
| | | 数量: '10', |
| | | 面积: '20000', |
| | | 排产数量: '', |
| | | 已排产数量: '10000', |
| | | 已排产面积: '10000', |
| | | 未排产数量: '', |
| | | 未排产面积: '', |
| | | 形状: '矩形', |
| | | 备注: '备注' |
| | | }, |
| | | { |
| | | 排产编号:"PC20230100001", |
| | | 销售单号: 'NG231207', |
| | | 客户名称:'XXX公司', |
| | | 项目名称:"XXXX公园", |
| | | 序号: '1', |
| | | 产品名称: '6mm超白Low-E(外)+A12+6mm超白平钢(内)', |
| | | 宽: '2000', |
| | | 高: '1000', |
| | | 数量: '10', |
| | | 面积: '20000', |
| | | 排产数量: '', |
| | | 已排产数量: '10000', |
| | | 已排产面积: '10000', |
| | | 未排产数量: '', |
| | | 未排产面积: '', |
| | | 形状: '矩形', |
| | | 备注: '备注' |
| | | }, |
| | | { |
| | | 排产编号:"PC20230100001", |
| | | 销售单号: 'NG231207', |
| | | 客户名称:'XXX公司', |
| | | 项目名称:"XXXX公园", |
| | | 序号: '1', |
| | | 产品名称: '6mm超白Low-E(外)+A12+6mm超白平钢(内)', |
| | | 宽: '2000', |
| | | 高: '1000', |
| | | 数量: '10', |
| | | 面积: '20000', |
| | | 排产数量: '', |
| | | 已排产数量: '10000', |
| | | 已排产面积: '10000', |
| | | 未排产数量: '', |
| | | 未排产面积: '', |
| | | 形状: '矩形', |
| | | 备注: '备注' |
| | | }, |
| | | |
| | | ],//table body实际数据 |
| | | //脚部求和 |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | |
| | | |
| | | }) |
| | | |
| | | const form = reactive({ |
| | | name: '', |
| | | region: '', |
| | | date1: '', |
| | | date2: '', |
| | | delivery: false, |
| | | type: [], |
| | | resource: '', |
| | | desc: '', |
| | | }) |
| | | const value = ref('') |
| | | const options = [ |
| | | { |
| | | value: 'Option1', |
| | | label: 'Option1', |
| | | |
| | | const gridEvents = { |
| | | toolbarButtonClick({code}) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'save': { |
| | | const $table = xGrid.value |
| | | if ($table) { |
| | | const selectRecords = $table.getCheckboxRecords() |
| | | let selectProcesses=value.value |
| | | |
| | | let schedulingData = ref({ |
| | | scheduling: selectRecords, |
| | | Processes:selectProcesses |
| | | }) |
| | | if (selectRecords.length==0){ |
| | | ElMessage.success("请勾选排产数据") |
| | | 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 |
| | | if (start==null || end==null || number==null){ |
| | | ElMessage.success("请填入对应的值再进行保存") |
| | | return; |
| | | } |
| | | } |
| | | console.log(schedulingData.value) |
| | | // request.post("/workOrder/addOrderWork", schedulingData.value).then((res) => { |
| | | // if (res.code == 200) { |
| | | // ElMessage.success("保存成功") |
| | | // location.reload(); |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // router.push("/login") |
| | | // } |
| | | // }) |
| | | |
| | | } |
| | | return; |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | value: 'Option2', |
| | | label: 'Option2', |
| | | }, |
| | | { |
| | | value: 'Option3', |
| | | label: 'Option3', |
| | | }, |
| | | ] |
| | | |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <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" |
| | | |
| | | /> |
| | | |
| | | <el-select v-model="value" class="m-2" placeholder="工序"> |
| | | <el-input placeholder="销售单号" v-model="form.orderId" style="width: 110px"></el-input> |
| | | |
| | | <el-select v-model="value" class="m-2" placeholder="工序" style="width: 90px;"> |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="value" class="m-2" placeholder="是否排产"> |
| | | |
| | | <el-select v-model="stateValue" class="m-2" placeholder="是否排产" style="width: 120px"> |
| | | <el-option |
| | | v-for="item in options" |
| | | v-for="item in stateOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | |
| | | <el-button type="primary">查询</el-button> |
| | | <el-button |
| | | @click="getWorkOrder" |
| | | id="select" |
| | | type="primary" :icon="Search">查询 |
| | | </el-button> |
| | | </el-row> |
| | | |
| | | </div> |
| | |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | |
| | | v-on="gridEvents" |
| | | > |
| | | <!-- @toolbar-button-click="toolbarButtonClickEvent"--> |
| | | <!-- 下拉显示所有信息插槽--> |
| | | <template #content="{ row}"> |
| | | <template #content="{ row }"> |
| | | <ul class="expand-wrapper"> |
| | | <li v-for="(item,key,index) in row"> |
| | | <span style="font-weight: bold">{{key+': '}}</span> |
| | | <span>{{ item }}</span> |
| | | <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined "> |
| | | <span style="font-weight: bold">{{ item.title + ': ' }}</span> |
| | | <span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span> |
| | | <span v-else>{{ row[item.field] }}</span> |
| | | |
| | | </li> |
| | | </ul> |
| | | </template> |
| | | |
| | | <!--左边固定显示的插槽--> |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">打印</el-button> |
| | | <el-button @click="getTableRow(row,'setType')" link type="primary" size="small">排版</el-button> |
| | | <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button> |
| | | </template> |
| | | |
| | | <template #num1_filter="{ column, $panel }"> |
| | | <div> |
| | | <div v-for="(option, index) in column.filters" :key="index"> |