From ed6f35069824d71ee6da599a328d865eb0c58550 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期四, 25 四月 2024 09:16:26 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/a1536384743/erp_-override
---
north-glass-erp/northglass-erp/src/views/pp/processCard/ProductionScheduling.vue | 391 ++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 300 insertions(+), 91 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 698333c..93408a3 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
@@ -9,9 +9,14 @@
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 BasicTable from '@/components/sd/product/BasicTable.vue'
import {VXETable} from "vxe-table";
import useUserInfoStore from "@/stores/userInfo";
+import {changeFilterEvent, filterChanged} from "@/hook"
+import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove";
+import { useI18n } from 'vue-i18n'
+//璇█鑾峰彇
+const { t } = useI18n()
let router = useRouter()
const userStore = useUserInfoStore()
@@ -23,10 +28,7 @@
router.push({path: '/main/processCard/PrintFlowCard', query: {id: row.id}})
break
}
- case 'delete': {
- alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鍒犻櫎淇℃伅')
- break
- }
+
case 'setType': {
alert('鎴戞帴鏀跺埌瀛愮粍浠朵紶閫佺殑鎺掔増鐘舵��')
break
@@ -34,33 +36,21 @@
}
}
+
//宸ュ簭
-const value = ref('')
-const options = [
- {
- value: '鍒囧壊',
- label: '鍒囧壊',
- },
- {
- value: '纾ㄨ竟',
- label: '纾ㄨ竟',
- },
- {
- value: '閽㈠寲',
- label: '閽㈠寲',
- },
-]
+const value = ref('鍒囧壊')
+
//鎺掍骇鐘舵��
const stateValue = ref('1')
const stateOptions = [
{
value: '2',
- label: '宸叉帓浜�',
+ label: t('processCard.ProductionSchedulingOk'),
},
{
value: '1',
- label: '鏈帓浜�',
+ label: t('processCard.ProductionSchedulingNo'),
},
]
@@ -72,6 +62,11 @@
const form = reactive({
date1: '',
orderId: ''
+})
+
+//瀹氫箟鎺ユ敹鍔犺浇琛ㄥご涓嬫媺鏁版嵁
+const titleSelectJson = ref({
+ processType: [],
})
@@ -118,10 +113,10 @@
//鑾峰彇涓冨ぉ鍓嶅埌褰撳墠鏃堕棿
function getNowTime() {
- const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)
+ const start = new Date(new Date().getTime() - 3600 * 1000 * 24 * 3)
.toISOString()
.replace('T', ' ')
- .slice(0, 10) //榛樿寮�濮嬫椂闂�7澶╁墠
+ .slice(0, 10) //榛樿寮�濮嬫椂闂�3澶╁墠
const end = new Date(new Date().getTime() + 3600 * 1000 * 24)
.toISOString()
.replace('T', ' ')
@@ -129,17 +124,30 @@
return [start, end]
}
-//绗竴娆″姞杞借幏鍙栬繎涓冨ぉ鏃堕棿鍜岄粯璁ょ姸鎬�
+onMounted(()=>{
+ //鍚敤琛ㄦ牸鎷栧姩閫変腑
+ addListener(xGrid.value,gridOptions)
+})
+
+//绗竴娆″姞杞借幏鍙栬繎3澶╂椂闂村拰榛樿鐘舵��
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
xGrid.value.reloadData(produceList)
gridOptions.loading = false
//绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
@@ -152,6 +160,8 @@
//鐐瑰嚮鏃舵煡璇�
const getWorkOrder = () => {
+ let startTime = form.date1[0]
+ let endTime = form.date1[1]
let selectProcesses = value.value
let selectState = stateValue.value
let inputVal = form.orderId
@@ -163,29 +173,33 @@
}
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
+ //鍚敤淇濆瓨
+ gridOptions.toolbarConfig.buttons[2].disabled = 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
- //绂佺敤鍒犻櫎銆佷繚瀛樻寜閽�
+ //绂佺敤鍒犻櫎銆佸鏍告寜閽�
gridOptions.toolbarConfig.buttons[0].disabled = true
gridOptions.toolbarConfig.buttons[1].disabled = true
+ //鍚敤淇濆瓨
+ gridOptions.toolbarConfig.buttons[2].disabled = false
} else {
ElMessage.warning(res.msg)
}
@@ -197,7 +211,7 @@
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
//绂佺敤淇濆瓨
@@ -213,7 +227,7 @@
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
//绂佺敤淇濆瓨
@@ -227,15 +241,22 @@
}
+/*鍚庣杩斿洖缁撴灉澶氬眰宓屽灞曠ず*/
+const hasDecimal = (value) => {
+ const regex = /\./; // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+ return regex.test(value); // 杩斿洖true/false
+}
+
//瀛愮粍浠舵帴鏀跺弬鏁�
const xGrid = ref()
const gridOptions = reactive({
+ loading: true,
border: "full",//琛ㄦ牸鍔犺竟妗�
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: {},
@@ -248,65 +269,128 @@
useKey: true
},
filterConfig: { //绛涢�夐厤缃」
- remote: true
+ // remote: true
},
customConfig: {
storage: true
},
- editConfig: {
+
+ editConfig: {
trigger: 'click',
mode: 'row',
showStatus: true
- },//琛ㄥご鍙傛暟
+ },
+ menuConfig: {
+ body: {
+ options: [
+ [
+ { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
+ { code: 'copyAll', name: t('basicData.sameAfterwards'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false },
+ { code: 'clearChecked', name: t('basicData.clearSelection'), 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},
- {type: 'seq', fixed: "left", title: '鑷簭', width: 50},
+ {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
+ {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
{
field: 'scheduled_start_time',
width: 120,
editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},
- title: '璁″垝寮�濮嬫椂闂�'
+ title: t('processCard.scheduledStartTime')
},
{
field: 'plan_end_time',
width: 120,
editRender: {name: 'input', attrs: {placeholder: '', type: 'date'}},
- title: '璁″垝缁撴潫鏃堕棿'
+ title: t('processCard.planEndTime')
},
// {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: 'order_id',
+ title: t('order.orderId'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ width: 100,
+ filterMethod: filterChanged
+ },
+ {
+ field: 'customer_name',
+ title: t('processCard.customerName'),
+ width: 110,
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ filterMethod: filterChanged
+ },
+ {
+ field: 'project',
+ title: t('order.project'),
+ width: 100,
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ filterMethod: filterChanged
+ },
+ {
+ field: 'order_number',
+ title: t('order.OrderNum'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ width: 70,
+ filterMethod: filterChanged
+ },
+ {
+ field: 'technology_number',
+ title: t('processCard.technologyNumber'),
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ width: 70,
+ filterMethod: filterChanged
+ },
+ {
+ field: 'child_width',
+ title: t('order.width'),
+ width: 60,
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ filterMethod: filterChanged
+ },
+ {
+ field: 'child_height',
+ title: t('order.height'),
+ width: 60,
+ filters: [{data: ''}],
+ slots: {filter: 'num1_filter'},
+ filterMethod: filterChanged
+ },
+ {field: 'quantity', title: t('processCard.orderQuantity'), width: 70},
+ {field: 'area', title: t('processCard.orderArea'), width: 90},
{
field: 'scheduling_quantity',
width: 120,
editRender: {name: 'input', attrs: {placeholder: ''}},
- title: '鎺掍骇鏁伴噺',
+ title: t('processCard.productionSchedulingQuantity'),
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: 'pendingProductionQuantity', title: t('processCard.quantityToScheduled'), width: 120},
+ {field: 'pendingProductionArea', title: t('processCard.areaToScheduled'), width: 120},
+ {field: 'productionScheduledQuantity', title: t('processCard.plannedProductionQuantity'), width: 120},
+ {field: 'productionScheduledArea', title: t('processCard.plannedProductionArea'), width: 120},
+ {field: 'review_status', title: t('processCard.reviewedState'), width: 140},
+ {field: 'reviewer', title: t('processCard.reviewed'), width: 140},
+ {field: 'glass_child', title: t('order.product'), width: 140},
+ {field: 'shape', title: t('order.shape'), width: 80},
+ {field: 'notes', title: t('processCard.notes'), editRender: {name: 'input', attrs: {placeholder: ''}}, width: 120},
+ {field: 'scheduling_id', title: t('processCard.schedulingId'), 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: t('basicData.delete'), status: 'primary'},
+ {code: 'review', name: t('basicData.review'), status: 'primary'},
+ {code: 'save', name: t('processCard.scheduling'), status: 'primary', icon: 'vxe-icon-save'},
],
import: false,
// export: true,
@@ -316,26 +400,26 @@
},
data: [],//table body瀹為檯鏁版嵁
//鑴氶儴姹傚拰
- footerMethod({columns, data}) {//椤佃剼鍑芥暟
- let footList = ['鏁伴噺', '闈㈢Н', '鎺掍骇鏁伴噺', '宸叉帓浜ф暟閲�', '宸叉帓浜ч潰绉�', '鏈帓浜ф暟閲�', '鏈帓浜ч潰绉�']
- return [
- columns.map((column, columnIndex) => {
- if (columnIndex === 0) {
- return '鍚堣:'
- }
- if (footList.includes(column.field)) {
- return sumNum(data, column.field)
- }
- return ''
- })
- ]
- }
+ // footerMethod({columns, data}) {//椤佃剼鍑芥暟
+ // let footList = ['鏁伴噺', '闈㈢Н', '鎺掍骇鏁伴噺', '宸叉帓浜ф暟閲�', '宸叉帓浜ч潰绉�', '鏈帓浜ф暟閲�', '鏈帓浜ч潰绉�']
+ // return [
+ // columns.map((column, columnIndex) => {
+ // if (columnIndex === 0) {
+ // return '鍚堣:'
+ // }
+ // if (footList.includes(column.field)) {
+ // return sumNum(data, column.field)
+ // }
+ // return ''
+ // })
+ // ]
+ // }
})
-
+//琛ㄦ牸鎸夐挳
const gridEvents = {
- toolbarButtonClick({code}) {
+ async toolbarButtonClick({code}) {
const $grid = xGrid.value
if ($grid) {
switch (code) {
@@ -368,15 +452,23 @@
processes: selectProcesses,//宸ュ簭
userName: username//瀹℃牳浜�
})
- console.log(schedulingData.value)
+ //绂佺敤淇濆瓨
+ 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)
- router.push("/login")
+
}
})
@@ -385,19 +477,122 @@
}
+ case 'delete': {
+ const $table = xGrid.value
+ const selectRecords = $table.getCheckboxRecords()
+ if ($table) {
+ if (selectRecords.length == 0) {
+ ElMessage.warning("璇峰嬀閫夋帓浜ф暟鎹�")
+ return;
+ }
+ const type = await VXETable.modal.confirm('鎮ㄧ‘瀹氳鍒犻櫎璇ユ暟鎹�?')
+ if (type === 'confirm') {
+ let schedulingData = ref({
+ scheduling: selectRecords,
+ })
+
+ request.post("/productionScheduling/deleteScheduling", schedulingData.value).then((res) => {
+ if (res.code == 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛")
+ location.reload();
+ } else {
+ ElMessage.warning(res.msg)
+
+ }
+ })
+ }
+ }
+ return;
+ }
+ case 'review': {
+ const $table = xGrid.value
+ const selectRecords = $table.getCheckboxRecords()
+ if ($table) {
+ if (selectRecords.length == 0) {
+ ElMessage.warning("璇峰嬀閫夋帓浜ф暟鎹�")
+ return;
+ }
+ let schedulingData = ref({
+ scheduling: selectRecords,
+ userName: username//瀹℃牳浜�
+ })
+ request.post("/productionScheduling/examineScheduling", schedulingData.value).then((res) => {
+ if (res.code == 200) {
+ ElMessage.success("瀹℃牳鎴愬姛")
+ location.reload();
+ } else {
+ ElMessage.warning(res.msg)
+
+ }
+ })
+
+ }
+ return;
+ }
}
}
},
+ menuClick ({ menu, row, column }) {
+ const $grid = xGrid.value
+ if ($grid) {
+ switch (menu.code) {
+ case 'copyChecked' :{
+ let result = toolbarButtonClickEvent()
+ if (result.cell === "scheduled_start_time" ||result.cell === "plan_end_time"){
+ 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
+ }
+ })
+ }
+ }
+ break
+ }
+ case 'copyAll' :{
+ let result = toolbarButtonClickEvent()
+ if (result.cell === "scheduled_start_time" ||result.cell === "plan_end_time") {
+ 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
+ }
+ })
+ }
+ }
+ break
+ }
+ case 'clearChecked' :{
+ let result = toolbarButtonClickEvent()
+ if (result.cell === "scheduled_start_time" ||result.cell === "plan_end_time") {
+ if (result) {
+ const dataList = xGrid.value.getTableData().visibleData
+ dataList.forEach((item, index) => {
+ if (index >= result.start && index <= result.end) {
+ item[result.cell] = ''
+ }
+ })
+ }
+ }
+ break
+ }
+ }
+ }
+ },
}
const determineNum = () => {
const $grid = xGrid.value
const table = $grid.getTableData().fullData
const selectRecords = $grid.getCheckboxRecords()
- console.log(selectRecords)
+ 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
@@ -425,14 +620,14 @@
/>
- <el-input v-model="form.orderId" placeholder="閿�鍞崟鍙�" style="width: 110px"></el-input>
+ <el-input v-model="form.orderId" clearable :placeholder="$t('order.orderId')" style="width: 110px"></el-input>
- <el-select v-model="value" class="m-2" placeholder="宸ュ簭" style="width: 90px;">
+ <el-select v-model="value" clearable default-value="default_city" style="width: 120px">
<el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
+ v-for="item in titleSelectJson['processType']"
+ :key="item.id"
+ :label="item.basic_name"
+ :value="item.basic_name"
/>
</el-select>
@@ -448,7 +643,7 @@
<el-button
id="select"
:icon="Search"
- type="primary" @click="getWorkOrder">鏌ヨ
+ type="primary" @click="getWorkOrder">{{$t('basicData.search')}}
</el-button>
</el-row>
@@ -456,6 +651,7 @@
<vxe-grid
ref="xGrid"
class="mytable-scrollbar"
+ height="100%"
max-height="100%"
v-bind="gridOptions"
v-on="gridEvents"
@@ -485,6 +681,11 @@
</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>
@@ -495,6 +696,14 @@
#selectForm {
width: 70%;
+ height: 6%;
text-align: center;
}
+.vxe-grid {
+ /* 绂佺敤娴忚鍣ㄩ粯璁ら�変腑 */
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0