From b09e0423b15d6402b44d4ef338bfb85f027daf3c Mon Sep 17 00:00:00 2001 From: chenlu <1320612696@qq.com> Date: 星期二, 27 二月 2024 14:03:58 +0800 Subject: [PATCH] 更新程序,流程卡删除,修改排版状态 --- north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue | 405 ++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 283 insertions(+), 122 deletions(-) diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue index e5ca6ad..24eda07 100644 --- a/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue +++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue @@ -1,7 +1,16 @@ <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) { @@ -21,6 +30,46 @@ } } +//宸ュ簭 +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:'' +}) + //琛ㄥ熬姹傚拰 @@ -32,8 +81,139 @@ 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,//淇濇寔婧愭暟鎹� @@ -66,94 +246,44 @@ {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 }) {//椤佃剼鍑芥暟 @@ -173,31 +303,58 @@ }) -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> @@ -207,12 +364,17 @@ <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" @@ -220,16 +382,21 @@ :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> @@ -239,26 +406,20 @@ 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"> -- Gitblit v1.8.0