From 6fc7bb975eca07193843a031e378ac3f82317d35 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期二, 12 八月 2025 15:16:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/mes/MesProductionWorkOrderList.vue | 776 +++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 543 insertions(+), 233 deletions(-)
diff --git a/src/views/mes/MesProductionWorkOrderList.vue b/src/views/mes/MesProductionWorkOrderList.vue
index 46029a3..8d1fe7d 100644
--- a/src/views/mes/MesProductionWorkOrderList.vue
+++ b/src/views/mes/MesProductionWorkOrderList.vue
@@ -1,256 +1,566 @@
<template>
- <a-card :bordered="false">
- <!-- 鏌ヨ鍖哄煙 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="searchQuery">
- <a-row :gutter="24">
- </a-row>
- </a-form>
- </div>
- <!-- 鏌ヨ鍖哄煙-END -->
+ <a-row :gutter="{ xs: 4, sm: 8, md: 16}">
+ <a-col :span="12">
+ <a-card :bordered="false">
+ <!-- 鏌ヨ鍖哄煙 -->
+ <div class="table-page-search-wrapper">
+ <a-form layout="inline" @keyup.enter.native="searchQuery">
+ <a-row :gutter="24">
+ <a-col :span="12">
+ <a-form-item label="浜х嚎">
+ <j-tree-select dict="base_factory,factory_name,id" pid-field="parent_id"
+ v-model="queryParam.factoryId"></j-tree-select>
+ </a-form-item>
+ </a-col>
+ <a-col :span="12">
+ <a-form-item label="璧锋鏃ユ湡">
+ <a-range-picker
+ style="width: 100%"
+ @change="dateRangeChange"
+ :value="dateRange"
+ :disabledDate="disabledDate"
+ @openChange="onOpenChange"
+ />
+ </a-form-item>
+ </a-col>
+ <a-col :xl="6" :lg="7" :md="8" :sm="24">
+ <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+ <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
+ <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button>
+ <a-button type="primary" @click="productionSchedule" icon="retweet"
+ style="margin-left: 8px">鎺掍骇</a-button>
+ </span>
+ </a-col>
+ </a-row>
+ </a-form>
+ </div>
- <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
- <div class="table-operator">
- <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>
- <a-button type="primary" icon="download" @click="handleExportXls('鎺掍骇宸ュ崟')">瀵煎嚭</a-button>
- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
- <a-button type="primary" icon="import">瀵煎叆</a-button>
- </a-upload>
- <!-- 楂樼骇鏌ヨ鍖哄煙 -->
- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
- <a-dropdown v-if="selectedRowKeys.length > 0">
- <a-menu slot="overlay">
- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item>
- </a-menu>
- <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button>
- </a-dropdown>
- </div>
-
- <!-- table鍖哄煙-begin -->
- <div>
- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
- <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�
- <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
- </div>
-
- <a-table
- ref="table"
- size="middle"
- :scroll="{x:true}"
- bordered
- rowKey="id"
- :columns="columns"
- :dataSource="dataSource"
- :pagination="ipagination"
- :loading="loading"
- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
- class="j-table-force-nowrap"
- @change="handleTableChange">
-
- <template slot="htmlSlot" slot-scope="text">
- <div v-html="text"></div>
- </template>
- <template slot="imgSlot" slot-scope="text,record">
- <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>
- <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
- </template>
- <template slot="fileSlot" slot-scope="text">
- <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>
- <a-button
- v-else
- :ghost="true"
- type="primary"
- icon="download"
- size="small"
- @click="downloadFile(text)">
- 涓嬭浇
- </a-button>
- </template>
-
- <span slot="action" slot-scope="text, record">
- <a @click="handleEdit(record)">缂栬緫</a>
-
- <a-divider type="vertical" />
- <a-dropdown>
- <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
+ <div class="table-operator">
+ <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
- <a-menu-item>
- <a @click="handleDetail(record)">璇︽儏</a>
- </a-menu-item>
- <a-menu-item>
- <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
- <a>鍒犻櫎</a>
- </a-popconfirm>
+ <a-menu-item key="1" @click="batchDel">
+ <a-icon type="delete" />
+ 鍒犻櫎
</a-menu-item>
</a-menu>
+ <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔
+ <a-icon type="down" />
+ </a-button>
</a-dropdown>
+ </div>
+ <div>
+ <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+ <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a
+ style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�
+ <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
+ </div>
+
+ <a-table
+ ref="table"
+ size="middle"
+ :scroll="{x:true}"
+ bordered
+ rowKey="id"
+ :columns="columns"
+ :dataSource="dataSource"
+ :pagination="ipagination"
+ :loading="loading"
+ :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+ class="j-table-force-nowrap"
+ @change="handleTableChange">
+
+ <template slot="htmlSlot" slot-scope="text">
+ <div v-html="text"></div>
+ </template>
+ <template slot="imgSlot" slot-scope="text,record">
+ <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>
+ <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
+ style="max-width:80px;font-size: 12px;font-style: italic;" />
+ </template>
+ <template slot="fileSlot" slot-scope="text">
+ <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>
+ <a-button
+ v-else
+ :ghost="true"
+ type="primary"
+ icon="download"
+ size="small"
+ @click="downloadFile(text)">
+ 涓嬭浇
+ </a-button>
+ </template>
+
+ <span slot="action" slot-scope="text, record">
+ <span v-if="record.workOrderStatus === 'NEW'">
+ <a-popconfirm title="纭畾鍙戝竷鍚�?" @confirm="() => handlePublish(record.id)">
+ <a>鍙戝竷</a>
+ </a-popconfirm>
+ <a-divider type="vertical" />
+ </span>
+ <span v-if="record.workOrderStatus === 'PUBLISHED'">
+ <a @click="handleRePublish(record)">閲嶅彂甯�</a>
+ <a-divider type="vertical" />
+ </span>
+ <span>
+ <a-dropdown v-if="record.workOrderStatus === 'NEW'">
+ <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
+ <a-menu slot="overlay">
+ <a-menu-item>
+ <a @click="handleDetail(record)">璇︽儏</a>
+ </a-menu-item>
+ <a-menu-item>
+ <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
+ <a>鍒犻櫎</a>
+ </a-popconfirm>
+ </a-menu-item>
+ </a-menu>
+ </a-dropdown>
+ </span>
+ <span v-if="record.workOrderStatus !== 'NEW'">
+ <a @click="handleDetail(record)">璇︽儏</a>
+ </span>
</span>
+ </a-table>
+ </div>
- </a-table>
- </div>
-
- <mes-production-work-order-modal ref="modalForm" @ok="modalFormOk"></mes-production-work-order-modal>
- </a-card>
+ <mes-production-work-order-list-modal ref="modal" @ok="modalFormOk"></mes-production-work-order-list-modal>
+ <mes-production-work-order-modal ref="modalForm"></mes-production-work-order-modal>
+ <mes-production-work-order-republish-modal ref="republishModal" @ok="modalFormOk"></mes-production-work-order-republish-modal>
+ </a-card>
+ </a-col>
+ <a-col :span="12">
+ <a-card>
+ <MesProductionWeekCalendar
+ ref="weekCalendar"
+ :start-date="calendarStartDate"
+ @select="onDateSelect"
+ @change="onCalendarChange"
+ >
+ <!-- 浣跨敤鎻掓Ы鑷畾涔夋棩鏈熷崟鍏冩牸鍐呭 -->
+ <template #dateCell="{ date, isSelected, isToday }">
+ <div class="custom-date-content">
+ <!-- 绀轰緥锛氬湪鏃ユ湡鍗曞厓鏍间腑鏄剧ず宸ュ崟淇℃伅 -->
+ <div
+ v-for="workOrder in getWorkOrdersForDate(date)"
+ :key="workOrder.id"
+ class="work-order-item"
+ :class="{ 'urgent': isUrgent(workOrder) }"
+ >
+ <span class="work-order-shift">{{ workOrder.groupName }}</span>
+ <span class="work-order-material">{{ workOrder.materialName }}</span>
+ <span class="work-order-quantity">{{ workOrder.planQuantity }}</span>
+ </div>
+ </div>
+ </template>
+ </MesProductionWeekCalendar>
+ </a-card>
+ </a-col>
+ </a-row>
</template>
<script>
- import '@/assets/less/TableExpand.less'
- import { mixinDevice } from '@/utils/mixin'
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import MesProductionWorkOrderModal from './modules/MesProductionWorkOrderModal'
- import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
+import '@/assets/less/TableExpand.less'
+import { mixinDevice } from '@/utils/mixin'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import MesProductionWorkOrderModal from './modules/MesProductionWorkOrderModal'
+import MesProductionWeekCalendar from '@views/mes/modules/MesProductionWeekCalendar.vue'
+import MesProductionWorkOrderListModal from '@views/mes/modules/MesProductionWorkOrderListModal.vue'
+import MesProductionWorkOrderRepublishModal from '@views/mes/modules/MesProductionWorkOrderRepublishModal.vue'
+import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
+import moment from 'moment'
+import { getAction, postAction, requestPut } from '@api/manage'
- export default {
- name: 'MesProductionWorkOrderList',
- mixins:[JeecgListMixin, mixinDevice],
- components: {
- MesProductionWorkOrderModal
- },
- data () {
- return {
- description: '鎺掍骇宸ュ崟绠$悊椤甸潰',
- // 琛ㄥご
- columns: [
- {
- title: '#',
- dataIndex: '',
- key:'rowIndex',
- width:60,
- align:"center",
- customRender:function (t,r,index) {
- return parseInt(index)+1;
- }
- },
- {
- title:'鍒犻櫎鏍囪',
- align:"center",
- dataIndex: 'delFlag'
- },
- {
- title:'宸ュ崟鍙�(浠诲姟鍙�)',
- align:"center",
- dataIndex: 'workOrderCode'
- },
- {
- title:'鐗╂枡缂栫爜',
- align:"center",
- dataIndex: 'materialNumber'
- },
- {
- title:'鐗╂枡鍚嶇О',
- align:"center",
- dataIndex: 'materialName'
- },
- {
- title:'璁″垝鐢熶骇鏁伴噺',
- align:"center",
- dataIndex: 'planQuantity'
- },
- {
- title:'浜х嚎ID(鍐椾綑)',
- align:"center",
- dataIndex: 'factoryId'
- },
- {
- title:'鐝粍ID',
- align:"center",
- dataIndex: 'groupId'
- },
- {
- title:'鐝ID(鍐椾綑)',
- align:"center",
- dataIndex: 'shiftId'
- },
- {
- title:'鎺掍骇鏃ユ湡',
- align:"center",
- dataIndex: 'workOrderDate'
- },
- {
- title:'宸ュ崟鐘舵��',
- align:"center",
- dataIndex: 'workOrderStatus_dictText'
- },
- {
- title:'瀹為檯鎶ュ伐鏁伴噺',
- align:"center",
- dataIndex: 'actualQuantity'
- },
- {
- title:'鍙戝竷浜�',
- align:"center",
- dataIndex: 'publisher'
- },
- {
- title:'鍙戝竷鏃堕棿',
- align:"center",
- dataIndex: 'publishTime'
- },
- {
- title:'閲嶅彂甯冧汉',
- align:"center",
- dataIndex: 'republisher'
- },
- {
- title:'閲嶅彂甯冩椂闂�',
- align:"center",
- dataIndex: 'republishTime'
- },
- {
- title: '鎿嶄綔',
- dataIndex: 'action',
- align:"center",
- fixed:"right",
- width:147,
- scopedSlots: { customRender: 'action' }
+export default {
+ name: 'MesProductionWorkOrderList',
+ mixins: [JeecgListMixin, mixinDevice],
+ components: {
+ MesProductionWorkOrderModal,
+ MesProductionWeekCalendar,
+ MesProductionWorkOrderListModal,
+ MesProductionWorkOrderRepublishModal
+ },
+ data() {
+ return {
+ description: '鎺掍骇宸ュ崟绠$悊椤甸潰',
+ // 琛ㄥご
+ columns: [
+ {
+ title: '#',
+ dataIndex: '',
+ key: 'rowIndex',
+ width: 60,
+ align: 'center',
+ customRender: function(t, r, index) {
+ return parseInt(index) + 1
}
- ],
- url: {
- list: "/mesproductionworkorder/mesProductionWorkOrder/list",
- delete: "/mesproductionworkorder/mesProductionWorkOrder/delete",
- deleteBatch: "/mesproductionworkorder/mesProductionWorkOrder/deleteBatch",
- exportXlsUrl: "/mesproductionworkorder/mesProductionWorkOrder/exportXls",
- importExcelUrl: "mesproductionworkorder/mesProductionWorkOrder/importExcel",
-
},
- dictOptions:{},
- superFieldList:[],
+ {
+ title: '宸ュ崟鍙�(浠诲姟鍙�)',
+ align: 'center',
+ dataIndex: 'workOrderCode'
+ },
+ {
+ title: '鐗╂枡缂栫爜',
+ align: 'center',
+ dataIndex: 'materialNumber'
+ },
+ {
+ title: '鐗╂枡鍚嶇О',
+ align: 'center',
+ dataIndex: 'materialName'
+ },
+ {
+ title: '璁″垝鐢熶骇鏁伴噺',
+ align: 'center',
+ dataIndex: 'planQuantity'
+ },
+ {
+ title: '浜х嚎',
+ align: 'center',
+ dataIndex: 'factoryId_dictText'
+ },
+ {
+ title: '鐝粍',
+ align: 'center',
+ dataIndex: 'groupId_dictText'
+ },
+ {
+ title: '鐝',
+ align: 'center',
+ dataIndex: 'shiftId_dictText'
+ },
+ {
+ title: '鎺掍骇鏃ユ湡',
+ align: 'center',
+ dataIndex: 'workOrderDate'
+ },
+ {
+ title: '宸ュ崟鐘舵��',
+ align: 'center',
+ dataIndex: 'workOrderStatus_dictText'
+ },
+ {
+ title: '瀹為檯鎶ュ伐鏁伴噺',
+ align: 'center',
+ dataIndex: 'actualQuantity'
+ },
+ {
+ title: '鍙戝竷浜�',
+ align: 'center',
+ dataIndex: 'publisher'
+ },
+ {
+ title: '鍙戝竷鏃堕棿',
+ align: 'center',
+ dataIndex: 'publishTime'
+ },
+ {
+ title: '閲嶅彂甯冧汉',
+ align: 'center',
+ dataIndex: 'republisher'
+ },
+ {
+ title: '閲嶅彂甯冩椂闂�',
+ align: 'center',
+ dataIndex: 'republishTime'
+ },
+ {
+ title: '鎿嶄綔',
+ dataIndex: 'action',
+ align: 'center',
+ fixed: 'right',
+ width: 147,
+ scopedSlots: { customRender: 'action' }
+ }
+ ],
+ url: {
+ list: '/mesproductionworkorder/mesProductionWorkOrder/list',
+ delete: '/mesproductionworkorder/mesProductionWorkOrder/delete',
+ deleteBatch: '/mesproductionworkorder/mesProductionWorkOrder/deleteBatch',
+ exportXlsUrl: '/mesproductionworkorder/mesProductionWorkOrder/exportXls',
+ importExcelUrl: 'mesproductionworkorder/mesProductionWorkOrder/importExcel',
+ listProductionLinesOption: '/base/factory/queryIdTree',
+ schedule: '/mesproductionworkorder/mesProductionWorkOrder/schedule',
+ publish: '/mesproductionworkorder/mesProductionWorkOrder/publish'
+ },
+ dictOptions: {},
+ superFieldList: [],
+ // 鐢ㄤ簬婕旂ず鐨勫伐鍗曟暟鎹�
+ workOrdersByDate: {},
+ // 鏃ュ巻璧峰鏃ユ湡
+ calendarStartDate: moment(),
+ productionLineData: [],
+ dateRange: [],
+ tempStartDate: null, // 涓存椂瀛樺偍寮�濮嬫棩鏈�
+ hoveredDate: null, // 瀛樺偍榧犳爣鎮仠鐨勬棩鏈�
+ }
+ },
+ created() {
+ this.getSuperFieldList()
+ this.initDictConfig()
+ },
+ computed: {
+ importExcelUrl: function() {
+ return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
+ }
+ },
+ methods: {
+ modalFormOk() {
+ this.onClearSelected()
+ this.loadData(1).then(() => {
+ if (this.queryParam.factoryId) {
+ // 鍚屾椂鏇存柊鏃ュ巻涓殑宸ュ崟鏁版嵁
+ this.updateCalendarWorkOrders()
+ }
+ }).catch(error => {
+ console.error('鏁版嵁鍔犺浇澶辫触:', error)
+ })
+ },
+ loadData(arg) {
+ return new Promise((resolve, reject) => {
+ if (!this.url.list) {
+ this.$message.error("璇疯缃畊rl.list灞炴��!")
+ reject(new Error("璇疯缃畊rl.list灞炴��!"))
+ return
+ }
+ //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭
+ if (arg === 1) {
+ this.ipagination.current = 1;
+ }
+ var params = this.getQueryParams();//鏌ヨ鏉′欢
+ console.log('params', params)
+ if (!params) {
+ reject(new Error("鏌ヨ鍙傛暟鏃犳晥"))
+ return false;
+ }
+ this.loading = true;
+ getAction(this.url.list, params).then((res) => {
+ if (res.success) {
+ // console.log(res)
+ //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------
+ this.dataSource = res.result.records || res.result;
+ if (res.result.total) {
+ this.ipagination.total = res.result.total;
+ } else {
+ this.ipagination.total = 0;
+ }
+ //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------
+ resolve(res)
+ } else {
+ this.$message.warning(res.message)
+ reject(new Error(res.message))
+ }
+ }).catch(error => {
+ reject(error)
+ }).finally(() => {
+ this.loading = false
+ })
+ })
+ },
+ searchQuery() {
+ this.queryParam = Object.assign(this.queryParam, this.dateRange)
+ this.loadData(1).then(() => {
+ if (this.queryParam.factoryId) {
+ // 鍚屾椂鏇存柊鏃ュ巻涓殑宸ュ崟鏁版嵁
+ this.updateCalendarWorkOrders()
+ }
+ }).catch(error => {
+ console.error('鏁版嵁鍔犺浇澶辫触:', error)
+ })
+ },
+ searchReset() {
+ this.queryParam = {}
+ this.dateRange = []
+ this.workOrdersByDate = {}
+ this.loadData(1);
+ },
+ handlePublish(id) {
+ requestPut(this.url.publish, null, { ids: id }).then(res => {
+ if (res.success) {
+ this.$message.success(res.message)
+ this.loadData(1).then(() => {
+ if (this.queryParam.factoryId) {
+ // 鍚屾椂鏇存柊鏃ュ巻涓殑宸ュ崟鏁版嵁
+ this.updateCalendarWorkOrders()
+ }
+ }).catch(error => {
+ console.error('鏁版嵁鍔犺浇澶辫触:', error)
+ })
+ } else {
+ this.$message.warning(res.message)
+ }
+ })
+ },
+ handleRePublish(record) {
+ this.$refs.republishModal.add(record)
+ },
+ initDictConfig() {
+ getAction(this.url.listProductionLinesOption, null).then(res => {
+ if (res.success) {
+ this.productionLineData = res.result
+ }
+ })
+ },
+ getSuperFieldList() {
+ let fieldList = []
+ fieldList.push({ type: 'int', value: 'delFlag', text: '鍒犻櫎鏍囪', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'workOrderCode', text: '宸ュ崟鍙�(浠诲姟鍙�)', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'materialNumber', text: '鐗╂枡缂栫爜', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'materialName', text: '鐗╂枡鍚嶇О', dictCode: '' })
+ fieldList.push({ type: 'double', value: 'planQuantity', text: '璁″垝鐢熶骇鏁伴噺', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'factoryId', text: '浜х嚎ID(鍐椾綑)', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'groupId', text: '鐝粍ID', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'shiftId', text: '鐝ID(鍐椾綑)', dictCode: '' })
+ fieldList.push({ type: 'datetime', value: 'workOrderDate', text: '鎺掍骇鏃ユ湡' })
+ fieldList.push({ type: 'string', value: 'workOrderStatus', text: '宸ュ崟鐘舵��', dictCode: 'work_order_status' })
+ fieldList.push({ type: 'double', value: 'actualQuantity', text: '瀹為檯鎶ュ伐鏁伴噺', dictCode: '' })
+ fieldList.push({ type: 'string', value: 'publisher', text: '鍙戝竷浜�', dictCode: '' })
+ fieldList.push({ type: 'datetime', value: 'publishTime', text: '鍙戝竷鏃堕棿' })
+ fieldList.push({ type: 'string', value: 'republisher', text: '閲嶅彂甯冧汉', dictCode: '' })
+ fieldList.push({ type: 'datetime', value: 'republishTime', text: '閲嶅彂甯冩椂闂�' })
+ this.superFieldList = fieldList
+ },
+ productionSchedule() {
+ if (!this.queryParam.factoryId || this.dateRange.length === 0) {
+ this.$message.warning('璇烽�夋嫨浜х嚎鍙婃帓浜ф棩鏈熻寖鍥达紒')
+ return
+ }
+ getAction(this.url.schedule, {
+ factoryId: this.queryParam.factoryId,
+ startDate: this.dateRange[0].format('YYYY-MM-DD'),
+ endDate: this.dateRange[1].format('YYYY-MM-DD')
+ }).then(res => {
+ if (res.success) {
+ this.$refs.modal.edit(res.result, this.dateRange)
+ }
+ })
+ },
+ onOpenChange(open) {
+ if (!open) {
+ // 鍏抽棴閫夋嫨鍣ㄦ椂閲嶇疆鐘舵��
+ this.tempStartDate = null
+ this.hoveredDate = null
}
},
- created() {
- this.getSuperFieldList();
- },
- computed: {
- importExcelUrl: function(){
- return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
- },
- },
- methods: {
- initDictConfig(){
- },
- getSuperFieldList(){
- let fieldList=[];
- fieldList.push({type:'int',value:'delFlag',text:'鍒犻櫎鏍囪',dictCode:''})
- fieldList.push({type:'string',value:'workOrderCode',text:'宸ュ崟鍙�(浠诲姟鍙�)',dictCode:''})
- fieldList.push({type:'string',value:'materialNumber',text:'鐗╂枡缂栫爜',dictCode:''})
- fieldList.push({type:'string',value:'materialName',text:'鐗╂枡鍚嶇О',dictCode:''})
- fieldList.push({type:'double',value:'planQuantity',text:'璁″垝鐢熶骇鏁伴噺',dictCode:''})
- fieldList.push({type:'string',value:'factoryId',text:'浜х嚎ID(鍐椾綑)',dictCode:''})
- fieldList.push({type:'string',value:'groupId',text:'鐝粍ID',dictCode:''})
- fieldList.push({type:'string',value:'shiftId',text:'鐝ID(鍐椾綑)',dictCode:''})
- fieldList.push({type:'datetime',value:'workOrderDate',text:'鎺掍骇鏃ユ湡'})
- fieldList.push({type:'string',value:'workOrderStatus',text:'宸ュ崟鐘舵��',dictCode:'work_order_status'})
- fieldList.push({type:'double',value:'actualQuantity',text:'瀹為檯鎶ュ伐鏁伴噺',dictCode:''})
- fieldList.push({type:'string',value:'publisher',text:'鍙戝竷浜�',dictCode:''})
- fieldList.push({type:'datetime',value:'publishTime',text:'鍙戝竷鏃堕棿'})
- fieldList.push({type:'string',value:'republisher',text:'閲嶅彂甯冧汉',dictCode:''})
- fieldList.push({type:'datetime',value:'republishTime',text:'閲嶅彂甯冩椂闂�'})
- this.superFieldList = fieldList
+ disabledDate(current) {
+ // 濡傛灉鏈変复鏃跺紑濮嬫棩鏈燂紝鍒欓檺鍒剁粨鏉熸棩鏈熻寖鍥�
+ if (this.tempStartDate) {
+ const startDate = this.tempStartDate.clone().startOf('day')
+ const maxDate = startDate.clone().add(6, 'days').endOf('day') // 7澶╁寘鎷捣濮嬫棩
+ const minDate = startDate.clone().subtract(6, 'days').startOf('day') // 涔熷彲浠ュ悜鍓嶉��6澶�
+ // 绂佺敤瓒呭嚭7澶╄寖鍥寸殑鏃ユ湡
+ return current && (current < minDate || current > maxDate)
}
+ // 榛樿涓嶇鐢�
+ return false
+ },
+ dateRangeChange(dates, dateStrings) {
+ this.dateRange = dates
+ if (dates && dates.length > 0) {
+ if (dates.length === 1) {
+ // 閫夋嫨浜嗗紑濮嬫棩鏈燂紝淇濆瓨鍒颁复鏃跺彉閲�
+ this.tempStartDate = dates[0]
+ this.hoveredDate = dates[0]
+ } else if (dates.length === 2) {
+ // 閫夋嫨浜嗙粨鏉熸棩鏈燂紝楠岃瘉鑼冨洿
+ const startDate = dates[0]
+ const endDate = dates[1]
+ const diffDays = endDate.diff(startDate, 'days') + 1
+
+ if (diffDays > 7) {
+ this.$message.warning('鏃ユ湡鑼冨洿涓嶈兘瓒呰繃7澶�')
+ // 鑷姩璋冩暣涓�7澶╄寖鍥�
+ const adjustedEndDate = startDate.clone().add(6, 'days')
+ this.dateRange = [startDate, adjustedEndDate]
+ this.queryParam.startDate = startDate.format('YYYY-MM-DD')
+ this.queryParam.endDate = adjustedEndDate.format('YYYY-MM-DD')
+ } else {
+ this.queryParam.startDate = dateStrings[0]
+ this.queryParam.endDate = dateStrings[1]
+ }
+ // 閲嶇疆涓存椂鐘舵��
+ this.tempStartDate = null
+ this.hoveredDate = null
+ }
+ } else {
+ // 娓呴櫎浜嗛�夋嫨
+ this.queryParam.startDate = null
+ this.queryParam.endDate = null
+ this.tempStartDate = null
+ this.hoveredDate = null
+ }
+ },
+ // 澶勭悊鏃ユ湡閫夋嫨浜嬩欢
+ onDateSelect(date) {
+ console.log('Selected date:', date.format('YYYY-MM-DD'))
+ },
+ // 澶勭悊鏃ュ巻鍛ㄥ彉鍖栦簨浠�
+ onCalendarChange(date) {
+ console.log('Calendar week changed:', date.format('YYYY-MM-DD'))
+ },
+ // 鏇存柊鏃ュ巻涓殑宸ュ崟鏁版嵁
+ updateCalendarWorkOrders() {
+ // 灏嗗綋鍓嶈〃鏍兼暟鎹寜鏃ユ湡鍒嗙粍鏄剧ず鍦ㄦ棩鍘嗕腑
+ const workOrdersByDate = {}
+ this.dataSource.filter(workOrder => workOrder.workOrderStatus !== 'NEW').forEach(workOrder => {
+ const workOrderDate = workOrder.workOrderDate
+ if (workOrderDate) {
+ if (!workOrdersByDate[workOrderDate]) {
+ workOrdersByDate[workOrderDate] = []
+ }
+ workOrdersByDate[workOrderDate].push({
+ id: workOrder.id,
+ groupName: workOrder.groupId_dictText || '',
+ materialName: workOrder.materialName || '',
+ planQuantity: workOrder.planQuantity || 0
+ })
+ }
+ })
+ this.workOrdersByDate = workOrdersByDate
+ },
+ // 鑾峰彇鎸囧畾鏃ユ湡鐨勫伐鍗�
+ getWorkOrdersForDate(date) {
+ const dateStr = date.format('YYYY-MM-DD')
+ console.log(dateStr)
+ return this.workOrdersByDate[dateStr] || []
+ },
+ // 鍒ゆ柇宸ュ崟鏄惁绱ф��
+ isUrgent(workOrder) {
+ return workOrder.status === 'urgent'
}
}
+}
</script>
<style scoped>
- @import '~@assets/less/common.less';
+@import '~@assets/less/common.less';
+
+.work-order-item {
+ font-size: 12px;
+ padding: 2px 4px;
+ margin-bottom: 2px;
+ background-color: #f0f0f0;
+ border-radius: 2px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.work-order-item.urgent {
+ background-color: #ffccc7;
+ border-left: 2px solid #ff4d4f;
+}
+
+.work-order-shift {
+ font-weight: bold;
+ margin-right: 4px;
+}
+
+.work-order-material {
+ margin-right: 4px;
+}
+
+.work-order-quantity {
+ float: right;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3