Compare commits
	
		
			1 Commits
		
	
	
		
			projects/s
			...
			projects/r
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 1b56696da9 | 
							
								
								
									
										2
									
								
								.env.dev
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								.env.dev
									
									
									
									
									
								
							| @@ -13,7 +13,7 @@ VUE_APP_TITLE = 智能监控分析系统 | ||||
|  | ||||
| # 芋道管理系统/开发环境 | ||||
| # VUE_APP_BASE_API = 'http://192.168.8.22:48080' | ||||
| VUE_APP_BASE_API = 'http://172.16.32.40:48080' | ||||
| VUE_APP_BASE_API = 'http://172.16.32.79:48082' | ||||
|  | ||||
| # 路由懒加载 | ||||
| VUE_CLI_BABEL_TRANSPILE_MODULES = true | ||||
|   | ||||
| @@ -44,16 +44,25 @@ export function getProductAuto(data) { | ||||
| // 班组自动报表分页 | ||||
| export function getTeamReportPage(data) { | ||||
|   return request({ | ||||
|     url: '/monitoring/team-auto-report/page', | ||||
| 		url: '/monitoring/group-off-record/page', | ||||
| 		method: 'post', | ||||
|     data: data | ||||
|   }) | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| // 班组自动报表分页详细 | ||||
| export function getTeamReportPageDet(id) { | ||||
|   return request({ | ||||
|     url: '/monitoring/team-auto-report/pageDet?id=' + id, | ||||
|     url: '/monitoring/group-off-record/get?id=' + id, | ||||
|     method: 'get', | ||||
|   }) | ||||
| } | ||||
|  | ||||
| export function exportGroupProductReportExcel(data) { | ||||
|   return request({ | ||||
| 		url: '/monitoring/group-off-record/export-det-excel', | ||||
| 		method: 'get', | ||||
| 		params: data, | ||||
| 		responseType: 'blob', | ||||
| 	}); | ||||
| } | ||||
|   | ||||
							
								
								
									
										18
									
								
								src/api/material/issue.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/api/material/issue.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| import request from '@/utils/request' | ||||
| // 获得工厂分页 | ||||
| export function getMaterialReceiptIssuePageData(data) { | ||||
| 	return request({ | ||||
| 		url: '/base/material-warehouse-his/page', | ||||
| 		method: 'post', | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
|  | ||||
|  | ||||
| export function createMaterialIssue(data) { | ||||
| 	return request({ | ||||
| 		url: '/base/material-warehouse-his/create', | ||||
| 		method: 'post', | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
							
								
								
									
										45
									
								
								src/api/order/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/api/order/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| import request from '@/utils/request' | ||||
|  | ||||
| export function getOrderPage(data) { | ||||
| 	return request({ | ||||
| 		url: '/base/core-work-order/page', | ||||
| 		method: 'post', | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| export function updateOrderData(data) { | ||||
| 	return request({ | ||||
| 		url: '/base/core-work-order/updatee', | ||||
| 		method: 'put', | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| export function createOrderData(data) { | ||||
| 	return request({ | ||||
| 		url: '/base/core-work-order/create', | ||||
| 		method: 'post', | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
| export function getOrderData(id) { | ||||
|   return request({ | ||||
| 		url: '/base/core-work-order/get?id=' + id, | ||||
| 		method: 'get', | ||||
| 	}); | ||||
| } | ||||
| export function getOrderCode(data) { | ||||
| 	return request({ | ||||
| 		url: '/base/core-work-order/getCode', | ||||
| 		method: 'get', | ||||
| 		data: data, | ||||
| 	}); | ||||
| } | ||||
|  | ||||
| export function deleteOrder(id) { | ||||
|   return request({ | ||||
|     url: '/base/core-work-order/delete?id=' + id, | ||||
|     method: 'delete' | ||||
|   }) | ||||
| } | ||||
| @@ -1,30 +1,16 @@ | ||||
| <!-- | ||||
|     filename: index.vue | ||||
|     author: liubin | ||||
|     date: 2024-04-02 09:49:36 | ||||
|     description: | ||||
| --> | ||||
|  | ||||
| <template> | ||||
|   <!-- 按钮切换 --> | ||||
|   <div v-if="buttonMode" class="button-nav"> | ||||
|     <button | ||||
|       v-for="m in menus" | ||||
|       :key="m" | ||||
|       @click="currentMenu = m" | ||||
|     <button v-for="m in menus" :key="m" @click="handleClick(m)" | ||||
|       :data-text="m" | ||||
|       :class="[m === currentMenu ? 'active' : '']" | ||||
|       ></button> | ||||
|   </div> | ||||
|   <!-- 标签切换 --> | ||||
|   <div v-else class="custom-tabs" style="height: 100%; width: 100%"> | ||||
|     <el-tabs class="tag-nav" v-model="currentMenu" style="height: 100%"> | ||||
|       <el-tab-pane | ||||
|         v-for="(m, idx) in menus" | ||||
|         :key="m" | ||||
|         :label="idx == 0 ? `\u2002${m}\u2002` : `\u3000${m}\u3000`" | ||||
|         :name="m" | ||||
|       > | ||||
|     <el-tabs class="tag-nav" v-model="currentMenu" style="height: 100%" @tab-click="handleTabClick"> | ||||
|       <el-tab-pane v-for="(m, idx) in menus" :key="m" :label="idx == 0 ? `\u2002${m}\u2002` : `\u3000${m}\u3000`" | ||||
|         :name="m"> | ||||
|         <slot :name="`tab${idx + 1}`"></slot> | ||||
|       </el-tab-pane> | ||||
|     </el-tabs> | ||||
| @@ -39,14 +25,17 @@ export default { | ||||
|       type: Array, | ||||
|       required: true, | ||||
|       default: () => [], | ||||
|       validator: (val) => { | ||||
|         return val.length > 0; | ||||
|       }, | ||||
|       validator: (val) => val.length > 0, | ||||
|     }, | ||||
|     buttonMode: { | ||||
|       type: Boolean, | ||||
|       default: true, | ||||
|     }, | ||||
|     // 新增:支持外部传入选中值(v-model 绑定) | ||||
|     value: { | ||||
|       type: String, | ||||
|       default: "", | ||||
|     }, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
| @@ -54,16 +43,34 @@ export default { | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|     this.currentMenu = this.menus[0]; | ||||
|     // 优先使用外部传入的 value,否则默认第一个 | ||||
|     this.currentMenu = this.value || this.menus[0]; | ||||
|   }, | ||||
|   watch: { | ||||
|     // 监听外部 value 变化,同步到内部 currentMenu | ||||
|     value(newVal) { | ||||
|       this.currentMenu = newVal; | ||||
|     }, | ||||
|     // 监听内部 currentMenu 变化,通知外部 | ||||
|     currentMenu(val) { | ||||
|       this.$emit("change", val); | ||||
|       this.$emit("input", val); // 触发 v-model 同步 | ||||
|       this.$emit("change", val); // 保留原 change 事件 | ||||
|     }, | ||||
|   }, | ||||
|   methods: { | ||||
|     // 按钮点击事件 | ||||
|     handleClick(m) { | ||||
|       this.currentMenu = m; | ||||
|     }, | ||||
|     // 标签点击事件(el-tabs 自带) | ||||
|     handleTabClick(tab) { | ||||
|       this.currentMenu = tab.name; | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
| </script> | ||||
|  | ||||
| <!-- 样式不变 --> | ||||
| <style scoped lang="scss"> | ||||
| .button-nav { | ||||
|   width: 100%; | ||||
| @@ -113,6 +120,7 @@ export default { | ||||
|   display: inline-block; | ||||
|   /* transform: translateY(-12px); */ | ||||
| } | ||||
|  | ||||
| .custom-tabs>>>.el-tabs__item { | ||||
|   padding-left: 0px !important; | ||||
|   padding-right: 0px !important; | ||||
| @@ -123,6 +131,7 @@ export default { | ||||
| .custom-tabs>>>.el-tabs__content { | ||||
|   height: calc(100% - 42px); | ||||
| } | ||||
|  | ||||
| .custom-tabs>>>.el-tab-pane { | ||||
|   box-sizing: border-box; | ||||
|   height: 100%; | ||||
|   | ||||
| @@ -1,57 +1,43 @@ | ||||
| <template> | ||||
|   <div> | ||||
|     <div style="background: #f2f4f9; height: 40px; width: 100%"> | ||||
| 			<ButtonNav :menus="['当前', '历史']" @change="currentMenu"> | ||||
| 				<template v-slot:tab1> | ||||
|       <ButtonNav :menus="['当前', '历史']" @change="currentMenu" v-model="activeName"> | ||||
|         <!-- <template v-slot:tab1> | ||||
|           <div>当前</div> | ||||
|         </template> | ||||
|         <template v-slot:tab2> | ||||
|           <div>历史</div> | ||||
| 				</template> | ||||
|         </template> --> | ||||
|       </ButtonNav> | ||||
|     </div> | ||||
|     <div class="app-container energyOverlimitLog"> | ||||
| 			<div v-show="activeName === 'his'"> | ||||
|       <div v-if="activeName === '历史' && routeType !== 'order'"> | ||||
|         <!-- 搜索工作栏 --> | ||||
| 				<search-bar | ||||
| 					:formConfigs="formConfig" | ||||
| 					ref="searchBarForm" | ||||
| 					@select-changed="handleSearchBarChanged" | ||||
|         <search-bar :formConfigs="formConfig" ref="searchBarForm" @select-changed="handleSearchBarChanged" | ||||
|           @headBtnClick="buttonClick" /> | ||||
|       </div> | ||||
| 			<div v-show="activeName === 'now'"></div> | ||||
|       <h2 v-else> | ||||
|         订单名称:{{ name }} | ||||
|         订单编码:{{ code }} | ||||
|         <el-button    v-hasPermi="['base:core-work-order:export']" type="primary" @click="handleExport">导出</el-button> | ||||
|       </h2> | ||||
|       <div v-show="activeName === '当前'"></div> | ||||
|       <!-- 列表 --> | ||||
| 			<div v-if="activeName === 'his'"> | ||||
| 				<base-table-s | ||||
| 					:page="1" | ||||
| 					:limit="100" | ||||
| 					:table-props="tableProps" | ||||
| 					:table-data="tableData" | ||||
|       <div v-if="activeName === '历史'"> | ||||
|         <base-table-s :page="1" :limit="100" :table-props="tableProps" :table-data="tableData" | ||||
|           :max-height="tableH / 2"></base-table-s> | ||||
|         <div v-if="listQuery.lineId.length !== 1 && tableData.length > 0"> | ||||
| 					<barChart | ||||
| 						style="margin-top: 50px" | ||||
| 						ref="barChart" | ||||
| 						height="600px" | ||||
| 						:bar-data="tableData" /> | ||||
|           <barChart style="margin-top: 50px" ref="barChart" height="600px" :bar-data="tableData" /> | ||||
|         </div> | ||||
|       </div> | ||||
| 			<div v-if="activeName === 'now'"> | ||||
|       <div v-if="activeName === '当前'"> | ||||
|         <span class="blue-block"></span> | ||||
|         <span class="tip">当班数据</span> | ||||
| 				<base-table-s | ||||
| 					:page="1" | ||||
| 					:limit="100" | ||||
| 					:table-props="tableProps" | ||||
| 					:table-data="tableData2" | ||||
|         <base-table-s :page="1" :limit="100" :table-props="tableProps" :table-data="tableData2" | ||||
|           :max-height="tableH / 2" /> | ||||
|         <span class="blue-block"></span> | ||||
|         <span class="tip">当天数据</span> | ||||
| 				<base-table-s | ||||
| 					:page="1" | ||||
| 					:limit="100" | ||||
| 					:table-props="tableProps" | ||||
| 					:table-data="tableData3" | ||||
|         <base-table-s :page="1" :limit="100" :table-props="tableProps" :table-data="tableData3" | ||||
|           :max-height="tableH / 2" /> | ||||
|       </div> | ||||
|     </div> | ||||
| @@ -281,6 +267,9 @@ export default { | ||||
| 			urlOptions: { | ||||
| 				getDataListURL: getPdlAutoReportNewSearch, | ||||
|       }, | ||||
|       routeType: 'line', | ||||
|       code: '', | ||||
|       name:'', | ||||
| 			formConfig: [ | ||||
| 				{ | ||||
| 					type: 'select', | ||||
| @@ -295,6 +284,7 @@ export default { | ||||
| 					selectOptions: [], | ||||
| 					param: 'lineId', | ||||
|           multiple: true, | ||||
|           defaultSelect:[] | ||||
| 				}, | ||||
| 				{ | ||||
| 					type: 'datePicker', | ||||
| @@ -306,6 +296,7 @@ export default { | ||||
| 					startPlaceholder: '开始时间', | ||||
| 					endPlaceholder: '结束时间', | ||||
|           param: 'timeVal', | ||||
|           defaultSelect:[], | ||||
| 					width: 350, | ||||
| 				}, | ||||
| 				{ | ||||
| @@ -318,8 +309,8 @@ export default { | ||||
| 					type: 'separate', | ||||
| 				}, | ||||
| 				{ | ||||
| 					// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '', | ||||
| 					type: 'button', | ||||
|           type: this.$auth.hasPermi('|base:core-work-order:export') ? 'button' : '', | ||||
| 					// type: 'button', | ||||
| 					btnName: '导出', | ||||
| 					name: 'export', | ||||
| 					color: 'warning', | ||||
| @@ -328,7 +319,7 @@ export default { | ||||
| 			listQuery: { | ||||
| 				lineId: [], | ||||
| 			}, | ||||
| 			activeName: 'now', | ||||
|       activeName: '当前', | ||||
| 			tableProps, | ||||
| 			tableData: [], | ||||
| 			tableData2: [], | ||||
| @@ -340,8 +331,30 @@ export default { | ||||
| 		baseTableS, | ||||
| 		barChart, | ||||
| 	}, | ||||
| 	created() { | ||||
| 		this.getPdLineList(); | ||||
| 	mounted() { | ||||
|     this.getPdLineList() | ||||
|     this.$nextTick(() => { | ||||
|       const tab = this.$route.query.tab; // 获取路由参数 | ||||
|       console.log(this.$route.query); | ||||
|       this.routeType = this.$route.query.buttonType === 'order' ? 'order' : 'line' | ||||
|       this.code = this.$route.query.code | ||||
|       this.name = this.$route.query.name | ||||
|  | ||||
|       if (tab === 'his') { | ||||
|         // 路由参数为 his 时,切换到“历史”标签 | ||||
|         this.activeName = '历史'; // 注意:这里直接传标签名('历史'),不是'his' | ||||
|         this.formConfig[1].defaultSelect = this.$route.query.lineId | ||||
|         this.formConfig[2].defaultSelect[0] = this.$route.query.startProduceTime | ||||
|         this.formConfig[2].defaultSelect[1] = this.$route.query.finishProduceTime | ||||
|         // this.buttonClick() | ||||
|         this.listQuery.lineId = this.$route.query.lineId | ||||
|       } else { | ||||
|         this.activeName = '当前'; // 默认“当前”标签 | ||||
|       } | ||||
|     }) | ||||
|  | ||||
|  | ||||
|   // ... 其他方法 ... | ||||
|   }, | ||||
|   methods: { | ||||
| 		getPdLineList() { | ||||
| @@ -363,7 +376,7 @@ export default { | ||||
| 					this.listQuery.lineId = val.lineId || []; | ||||
| 					this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined; | ||||
| 					this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined; | ||||
| 					if (this.activeName === 'his') { | ||||
| 					if (this.activeName === '历史') { | ||||
| 						this.getDataList(); | ||||
| 					} else { | ||||
| 						this.getDataList2(); | ||||
| @@ -377,11 +390,17 @@ export default { | ||||
| 			} | ||||
|     }, | ||||
|     currentMenu(val) { | ||||
| 			this.activeName = val === '历史' ? 'his' : 'now'; | ||||
| 			if (this.activeName === 'his') { | ||||
| 				this.$refs.searchBarForm.resetForm(); | ||||
|       this.activeName = val; // 同步标签名到 activeName | ||||
|       let actualName = val === '历史' ? 'his' : 'now'; // 转换为内部状态 | ||||
|  | ||||
|     // 后续逻辑不变(根据 activeName 加载对应数据) | ||||
|       if (actualName === 'his') { | ||||
| 				// this.$refs.searchBarForm.resetForm(); | ||||
|         this.listQuery.factoryId = undefined; | ||||
|         if (!this.$route.query.lineId) { | ||||
|           this.listQuery.lineId = []; | ||||
|  | ||||
|         } | ||||
| 				// 获取当前时间 | ||||
| 				const now = new Date(); | ||||
| 				// 获取前一天的同一时间 | ||||
| @@ -404,11 +423,62 @@ export default { | ||||
| 				this.getDataList2(); | ||||
| 			} | ||||
| 		}, | ||||
| 		// 获取数据列表 | ||||
|  | ||||
|     getDataList() { | ||||
|       if (this.listQuery.startTime) { | ||||
|         this.dataListLoading = true; | ||||
| 				this.urlOptions.getDataListURL(this.listQuery).then((response) => { | ||||
|  | ||||
|         // 判断是否为order类型且lineId有值 | ||||
|         if (this.routeType === 'order' && this.listQuery.lineId?.length) { | ||||
|           // 存储所有接口请求的Promise | ||||
|           const requests = this.listQuery.lineId.map(lineId => { | ||||
|             // 复制原有查询参数,替换当前lineId | ||||
|             const params = { ...this.listQuery, lineId: [lineId] }; | ||||
|             return this.urlOptions.getDataListURL(params); | ||||
|           }); | ||||
|  | ||||
|           // 并行执行所有请求 | ||||
|           Promise.all(requests) | ||||
|             .then(responses => { | ||||
|               // 合并所有接口返回的数据 | ||||
|               this.tableData = responses.flatMap(response => { | ||||
|                 return response.data.map(item => { | ||||
|                   // 处理嵌套属性 | ||||
|                   item.originalLossNum = item.original?.lossNum; | ||||
|                   item.originalLossArea = item.original?.lossArea; | ||||
|                   item.edgeLossNum = item.edge?.lossNum; | ||||
|                   item.edgeLossArea = item.edge?.lossArea; | ||||
|                   item.drillLossNum = item.drill?.lossNum; | ||||
|                   item.drillLossArea = item.drill?.lossArea; | ||||
|                   item.coatingLossNum = item.coating?.lossNum; | ||||
|                   item.coatingLossArea = item.coating?.lossArea; | ||||
|                   item.silkLossNum = item.silk?.lossNum; | ||||
|                   item.silkLossArea = item.silk?.lossArea; | ||||
|                   item.temperingLossNum = item.tempering?.lossNum; | ||||
|                   item.temperingLossArea = item.tempering?.lossArea; | ||||
|                   item.packingLossNum = item.packing?.lossNum; | ||||
|                   item.packingLossArea = item.packing?.lossArea; | ||||
|                   return item; | ||||
|                 }); | ||||
|               }); | ||||
|  | ||||
|               this.$nextTick(() => { | ||||
|                 if (this.tableData.length > 0) { | ||||
|                   this.$refs.barChart.initChart(); | ||||
|                 } | ||||
|               }); | ||||
|             }) | ||||
|             .catch(error => { | ||||
|               console.error('接口请求失败:', error); | ||||
|               this.$message.error('数据加载失败,请重试'); | ||||
|             }) | ||||
|             .finally(() => { | ||||
|               this.dataListLoading = false; | ||||
|             }); | ||||
|         } else { | ||||
|           // 非order类型或无lineId时,正常单次请求 | ||||
|           this.urlOptions.getDataListURL(this.listQuery) | ||||
|             .then(response => { | ||||
|               this.tableData = response.data.map((item, index) => { | ||||
|                 item.originalLossNum = item.original?.lossNum; | ||||
|                 item.originalLossArea = item.original?.lossArea; | ||||
| @@ -426,13 +496,21 @@ export default { | ||||
|                 item.packingLossArea = item.packing?.lossArea; | ||||
|                 return item; | ||||
|               }); | ||||
|  | ||||
|               this.$nextTick(() => { | ||||
|                 if (this.tableData.length > 0) { | ||||
|                   this.$refs.barChart.initChart(); | ||||
|                 } | ||||
|               }); | ||||
|             }) | ||||
|             .catch(error => { | ||||
|               console.error('接口请求失败:', error); | ||||
|               this.$message.error('数据加载失败,请重试'); | ||||
|             }) | ||||
|             .finally(() => { | ||||
|               this.dataListLoading = false; | ||||
|             }); | ||||
|         } | ||||
|       } else { | ||||
|         this.$message.warning('请选择时间范围'); | ||||
|       } | ||||
|   | ||||
| @@ -7,71 +7,95 @@ | ||||
| --> | ||||
| <template> | ||||
|   <div> | ||||
| 		<search-bar | ||||
| 			:formConfigs="formConfig" | ||||
| 			ref="searchBarForm" | ||||
| 			@headBtnClick="buttonClick" /> | ||||
| 		<el-table | ||||
| 			id="detail" | ||||
| 			:data="tableData" | ||||
| 			:header-cell-style="{ | ||||
|     <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> | ||||
|     <el-table id="detail" :data="tableData" :header-cell-style="{ | ||||
| 				background: '#F2F4F9', | ||||
| 				color: '#606266', | ||||
| 			}" | ||||
| 			border | ||||
| 			:span-method="arraySpanMethod" | ||||
| 			v-loading="dataListLoading" | ||||
| 			style="width: 100%" | ||||
| 			ref="dataList"> | ||||
| 			}" border  v-loading="dataListLoading" style="width: 100%" ref="dataList"> | ||||
|       <el-table-column prop="lineName" label="产线" align="center" /> | ||||
| 			<el-table-column | ||||
| 				prop="sizes" | ||||
| 				width="105" | ||||
| 				showOverflowtooltip | ||||
|         align="center" | ||||
| 				label="规格" /> | ||||
| 			<el-table-column prop="process" label="产品工艺" align="center" /> | ||||
| 			<el-table-column prop="inputN" label="投入" align="center"> | ||||
| 				<el-table-column prop="inputNum" label="投入数量/片" /> | ||||
| 				<el-table-column prop="inputArea" label="投入面积/m²"> | ||||
|       <!-- <el-table-column prop="sizes" width="105" showOverflowtooltip align="center" label="规格" /> --> | ||||
|       <!-- <el-table-column prop="process" label="产品工艺" align="center" /> --> | ||||
|       <el-table-column prop="inputN" label="磨边" align="center"> | ||||
|         <el-table-column prop="edgeNum" label="投入数量/片" /> | ||||
|         <el-table-column prop="edgeTime" label="数据上报时间"> | ||||
|           <template v-slot="scope"> | ||||
|             <span> | ||||
|               {{ | ||||
| 								scope.row.inputArea != null | ||||
| 									? scope.row.inputArea.toFixed(2) | ||||
|               scope.row.reportType === 0 | ||||
|               ? parseTime(scope.row.edgeTime) | ||||
|               : '-' | ||||
|               }} | ||||
|             </span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table-column> | ||||
| 			<el-table-column prop="outputN" label="产出" align="center"> | ||||
| 				<el-table-column prop="outputNum" label="产出数量/片" /> | ||||
| 				<el-table-column prop="outputArea" label="产出面积/m²"> | ||||
|       <el-table-column prop="outputN" label="打孔/丝印" align="center"> | ||||
|         <el-table-column prop="drillCoating" label="投入数量"> | ||||
|           <template v-slot="scope"> | ||||
|             <span> | ||||
|               {{ | ||||
| 								scope.row.outputArea != null | ||||
| 									? scope.row.outputArea.toFixed(2) | ||||
|               (scope.row.drillNum ?? '-') | ||||
|               + '/' | ||||
|               + (scope.row.coatingNum ?? '-') | ||||
|               }} | ||||
|             </span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column prop="coatingTime" label="数据上报时间"> | ||||
|           <template v-slot="scope"> | ||||
|             <span> | ||||
|               {{ | ||||
|   scope.row.reportType === 0 | ||||
|               ? parseTime(scope.row.coatingTime) | ||||
|               : '-' | ||||
|               }} | ||||
|             </span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table-column> | ||||
| 			<el-table-column prop="lossN" label="不良" align="center"> | ||||
| 				<el-table-column prop="lossNum" label="不良数量/片" /> | ||||
| 				<el-table-column prop="lossArea" label="不良面积/m²"> | ||||
|       <el-table-column prop="lossN" label="镀膜" align="center"> | ||||
|         <el-table-column prop="silkNum" label="投入数量" /> | ||||
|         <el-table-column prop="silkTime" label="数据上报时间"> | ||||
|           <template v-slot="scope"> | ||||
|             <span> | ||||
|               {{ | ||||
| 								scope.row.lossArea != null ? scope.row.lossArea.toFixed(2) : '-' | ||||
|   scope.row.reportType === 0 | ||||
|               ? parseTime(scope.row.silkTime) | ||||
|               : '-' | ||||
|               }} | ||||
|             </span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table-column> | ||||
| 			<el-table-column prop="lossRatio" label="不良率/%"> | ||||
|       <el-table-column prop="lossN" label="钢化" align="center"> | ||||
|         <el-table-column prop="temperingNum" label="投入数量" /> | ||||
|         <el-table-column prop="temperingTime" label="数据上报时间"> | ||||
|           <template v-slot="scope"> | ||||
|             <span> | ||||
|               {{ | ||||
|   scope.row.reportType === 0 | ||||
|               ? parseTime(scope.row.temperingTime) | ||||
|               : '-' | ||||
|               }} | ||||
|             </span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table-column> | ||||
|       <el-table-column prop="lossN" label="包装" align="center"> | ||||
|         <el-table-column prop="packingNum" label="投入数量" /> | ||||
|         <el-table-column prop="packingTime" label="数据上报时间"> | ||||
|           <template v-slot="scope"> | ||||
|             <span> | ||||
|               {{ | ||||
|   scope.row.reportType === 0 | ||||
|               ? parseTime(scope.row.packingTime) | ||||
|               : '-' | ||||
|               }} | ||||
|             </span> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table-column> | ||||
|       <!-- <el-table-column prop="lossRatio" label="不良率/%"> | ||||
|         <template v-slot="scope"> | ||||
|           <span> | ||||
|             {{ | ||||
| @@ -186,20 +210,12 @@ | ||||
|               </span> | ||||
|             </template> | ||||
|           </el-table-column> | ||||
| 				</el-table-column> | ||||
| 				<el-table-column prop="packing" label="包装" align="center"> | ||||
| 					<el-table-column prop="packingLossNum" label="包装不良/片" /> | ||||
| 					<el-table-column prop="packingLossArea" label="包装不良/m²"> | ||||
| 						<template v-slot="scope"> | ||||
| 							<span> | ||||
| 								{{ | ||||
| 									scope.row.packingLossArea != null | ||||
| 										? scope.row.packingLossArea.toFixed(2) | ||||
| 										: '-' | ||||
| 								}} | ||||
| 							</span> | ||||
| 						</template> | ||||
| 					</el-table-column> | ||||
|         </el-table-column> --> | ||||
|       <el-table-column prop="down" label="下片" align="center"> | ||||
|         <el-table-column prop="downNum" label="成品数量" /> | ||||
|         <el-table-column prop="scrapNum" label="废片数量" /> | ||||
|         <el-table-column prop="inputOutputRate" label="投入产出率" /> | ||||
|         <el-table-column prop="yieldRate" label="加工成品率" /> | ||||
|       </el-table-column> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
| @@ -207,7 +223,7 @@ | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import { getTeamReportPageDet } from '@/api/core/monitoring/auto'; | ||||
| import { getTeamReportPageDet, exportGroupProductReportExcel } from '@/api/core/monitoring/auto'; | ||||
| import * as XLSX from 'xlsx'; | ||||
| import FileSaver from 'file-saver'; | ||||
|  | ||||
| @@ -216,6 +232,7 @@ export default { | ||||
| 	data() { | ||||
| 		return { | ||||
|       tableData: [], | ||||
|       id:null, | ||||
| 			dataListLoading: false, | ||||
| 			formConfig: [ | ||||
| 				{ | ||||
| @@ -234,6 +251,7 @@ export default { | ||||
| 	methods: { | ||||
| 		// 获取数据列表 | ||||
|     init(id) { | ||||
|       this.id = id | ||||
| 			this.dataListLoading = true; | ||||
| 			getTeamReportPageDet(id).then((response) => { | ||||
| 				this.tableData = response.data?.map((item, index) => { | ||||
| @@ -259,17 +277,17 @@ export default { | ||||
| 				this.dataListLoading = false; | ||||
| 			}); | ||||
| 		}, | ||||
| 		arraySpanMethod({ row, column, rowIndex, columnIndex }) { | ||||
| 			if (row.isSummaryReport) { | ||||
| 				if (columnIndex === 0) { | ||||
| 					return [1, 3]; | ||||
| 				} else if (columnIndex === 1) { | ||||
| 					return [0, 0]; | ||||
| 				} else if (columnIndex === 2) { | ||||
| 					return [0, 0]; | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		// arraySpanMethod({ row, column, rowIndex, columnIndex }) { | ||||
| 		// 	if (row.isSummaryReport) { | ||||
| 		// 		if (columnIndex === 0) { | ||||
| 		// 			return [1, 3]; | ||||
| 		// 		} else if (columnIndex === 1) { | ||||
| 		// 			return [0, 0]; | ||||
| 		// 		} else if (columnIndex === 2) { | ||||
| 		// 			return [0, 0]; | ||||
| 		// 		} | ||||
| 		// 	} | ||||
| 		// }, | ||||
|  | ||||
| 		buttonClick(val) { | ||||
| 			switch (val.btnName) { | ||||
| @@ -281,26 +299,32 @@ export default { | ||||
| 			} | ||||
| 		}, | ||||
|     handleExport() { | ||||
| 			let tables = document.querySelector('#detail').cloneNode(true); | ||||
| 			let exportTable = XLSX.utils.table_to_book(tables); | ||||
|       this.$modal.confirm('是否确认导出').then(() => { | ||||
|           return exportGroupProductReportExcel({id:this.id}); | ||||
|         }).then(response => { | ||||
|           console.log(response) | ||||
|           this.$download.excel(response, '班组生产报表-详情.xls'); | ||||
|         }).catch(() => {}) | ||||
| 			// let tables = document.querySelector('#detail').cloneNode(true); | ||||
| 			// let exportTable = XLSX.utils.table_to_book(tables); | ||||
|  | ||||
| 			var exportTableOut = XLSX.write(exportTable, { | ||||
| 				bookType: 'xlsx', | ||||
| 				bookSST: true, | ||||
| 				type: 'array', | ||||
| 			}); | ||||
| 			// sheetjs.xlsx为导出表格的标题名称 | ||||
| 			try { | ||||
| 				FileSaver.saveAs( | ||||
| 					new Blob([exportTableOut], { | ||||
| 						type: 'application/octet-stream', | ||||
| 					}), | ||||
| 					'班组生产报表-详情.xlsx' | ||||
| 				); | ||||
| 			} catch (e) { | ||||
| 				if (typeof console !== 'undefined') console.log(e, exportTableOut); | ||||
| 			} | ||||
| 			return exportTableOut; | ||||
| 			// var exportTableOut = XLSX.write(exportTable, { | ||||
| 			// 	bookType: 'xlsx', | ||||
| 			// 	bookSST: true, | ||||
| 			// 	type: 'array', | ||||
| 			// }); | ||||
| 			// // sheetjs.xlsx为导出表格的标题名称 | ||||
| 			// try { | ||||
| 			// 	FileSaver.saveAs( | ||||
| 			// 		new Blob([exportTableOut], { | ||||
| 			// 			type: 'application/octet-stream', | ||||
| 			// 		}), | ||||
| 			// 		'班组生产报表-详情.xlsx' | ||||
| 			// 	); | ||||
| 			// } catch (e) { | ||||
| 			// 	if (typeof console !== 'undefined') console.log(e, exportTableOut); | ||||
| 			// } | ||||
| 			// return exportTableOut; | ||||
| 		}, | ||||
| 	}, | ||||
| }; | ||||
|   | ||||
| @@ -74,7 +74,7 @@ const tableProps = [ | ||||
|     fixed: true | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'reportName', | ||||
|     prop: 'reportDate', | ||||
| 		label: '日期', | ||||
| 		width: 180, | ||||
|     fixed: true | ||||
| @@ -89,211 +89,241 @@ const tableProps = [ | ||||
| 		label: '班组', | ||||
|     fixed: true | ||||
| 	}, | ||||
|  | ||||
|   { | ||||
|     prop: 'edgeNum', | ||||
|     label: '磨边', | ||||
|     fixed: true | ||||
|   }, { | ||||
|     prop: 'drillOrCoating', | ||||
|     label: '打孔/丝印', | ||||
|     fixed: true | ||||
|   }, { | ||||
|     prop: 'silkNum', | ||||
|     label: '镀膜', | ||||
|     fixed: true | ||||
|   }, { | ||||
|     prop: 'temperingNum', | ||||
|     label: '钢化', | ||||
|     fixed: true | ||||
|   }, { | ||||
|     prop: 'packingNum', | ||||
|     label: '包装', | ||||
|     fixed: true | ||||
|   }, | ||||
| 	{ | ||||
| 		prop: 'inputN', | ||||
| 		label: '投入', | ||||
| 		label: '下片', | ||||
| 		align: 'center', | ||||
| 		children: [ | ||||
| 			{ | ||||
| 				prop: 'inputNum', | ||||
| 				label: '投入数量/片', | ||||
|         prop: 'downNum', | ||||
| 				label: '成品数量', | ||||
|         width:100 | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'inputArea', | ||||
| 				label: '投入面积/m²', | ||||
|         prop: 'scrapNum', | ||||
| 				label: '废片数量', | ||||
|         width:100 | ||||
|       }, | ||||
|       { | ||||
|         prop: 'inputOutputRate', | ||||
|         label: '投入产出率', | ||||
|         width: 100 | ||||
|       }, | ||||
|       { | ||||
|         prop: 'yieldRate', | ||||
|         label: '加工成品率', | ||||
|         width: 100 | ||||
|       }, | ||||
| 		], | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'outputN', | ||||
| 		label: '产出', | ||||
| 		align: 'center', | ||||
| 		children: [ | ||||
| 			{ | ||||
| 				prop: 'outputNum', | ||||
| 				label: '产出数量/片', | ||||
|         width:100 | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'outputArea', | ||||
| 				label: '产出面积/㎡', | ||||
| 				filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|         width:100 | ||||
| 			}, | ||||
| 		], | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'lossN', | ||||
| 		label: '不良', | ||||
| 		align: 'center', | ||||
| 		children: [ | ||||
| 			{ | ||||
| 				prop: 'lossNum', | ||||
| 				label: '不良数量/片', | ||||
|         width:100 | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'lossArea', | ||||
| 				label: '不良面积/㎡', | ||||
| 				filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|         width:100 | ||||
| 			}, | ||||
| 		], | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'lossRatio', | ||||
| 		label: '不良率/%', | ||||
| 		filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|     width:100 | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'outputRatio', | ||||
| 		label: '投入产出率/%', | ||||
| 		filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|     width:110 | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'processingRatio', | ||||
| 		label: '加工成品率/%', | ||||
| 		filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|     width:110 | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'lossD', | ||||
| 		label: '不良详情', | ||||
| 		align: 'center', | ||||
| 		children: [ | ||||
| 			{ | ||||
| 				prop: 'original', | ||||
| 				label: '原片', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'originalLossNum', | ||||
| 						label: '原片不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'originalLossArea', | ||||
| 						label: '原片不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'edge', | ||||
| 				label: '磨边', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'edgeLossNum', | ||||
| 						label: '磨边不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'edgeLossArea', | ||||
| 						label: '磨边不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'drill', | ||||
| 				label: '打孔', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'drillLossNum', | ||||
| 						label: '打孔不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'drillLossArea', | ||||
| 						label: '打孔不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'coating', | ||||
| 				label: '镀膜', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'coatingLossNum', | ||||
| 						label: '镀膜不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'coatingLossArea', | ||||
| 						label: '镀膜不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'silk', | ||||
| 				label: '丝印', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'silkLossNum', | ||||
| 						label: '丝印不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'silkLossArea', | ||||
| 						label: '丝印不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'tempering', | ||||
| 				label: '钢化', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'temperingLossNum', | ||||
| 						label: '钢化不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'temperingLossArea', | ||||
| 						label: '钢化不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 			{ | ||||
| 				prop: 'packing', | ||||
| 				label: '包装', | ||||
|         align: 'center', | ||||
| 				children: [ | ||||
| 					{ | ||||
| 						prop: 'packingLossNum', | ||||
| 						label: '包装不良/片', | ||||
|             width:100 | ||||
| 					}, | ||||
| 					{ | ||||
| 						prop: 'packingLossArea', | ||||
| 						label: '包装不良/㎡', | ||||
| 						filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|             width:100 | ||||
| 					}, | ||||
| 				], | ||||
| 			}, | ||||
| 		], | ||||
| 	}, | ||||
| 	// { | ||||
| 	// 	prop: 'outputN', | ||||
| 	// 	label: '产出', | ||||
| 	// 	align: 'center', | ||||
| 	// 	children: [ | ||||
| 	// 		{ | ||||
| 	// 			prop: 'outputNum', | ||||
| 	// 			label: '产出数量/片', | ||||
|   //       width:100 | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'outputArea', | ||||
| 	// 			label: '产出面积/㎡', | ||||
| 	// 			filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //       width:100 | ||||
| 	// 		}, | ||||
| 	// 	], | ||||
| 	// }, | ||||
| 	// { | ||||
| 	// 	prop: 'lossN', | ||||
| 	// 	label: '不良', | ||||
| 	// 	align: 'center', | ||||
| 	// 	children: [ | ||||
| 	// 		{ | ||||
| 	// 			prop: 'lossNum', | ||||
| 	// 			label: '不良数量/片', | ||||
|   //       width:100 | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'lossArea', | ||||
| 	// 			label: '不良面积/㎡', | ||||
| 	// 			filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //       width:100 | ||||
| 	// 		}, | ||||
| 	// 	], | ||||
| 	// }, | ||||
| 	// { | ||||
| 	// 	prop: 'lossRatio', | ||||
| 	// 	label: '不良率/%', | ||||
| 	// 	filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //   width:100 | ||||
| 	// }, | ||||
| 	// { | ||||
| 	// 	prop: 'outputRatio', | ||||
| 	// 	label: '投入产出率/%', | ||||
| 	// 	filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //   width:110 | ||||
| 	// }, | ||||
| 	// { | ||||
| 	// 	prop: 'processingRatio', | ||||
| 	// 	label: '加工成品率/%', | ||||
| 	// 	filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //   width:110 | ||||
| 	// }, | ||||
| 	// { | ||||
| 	// 	prop: 'lossD', | ||||
| 	// 	label: '不良详情', | ||||
| 	// 	align: 'center', | ||||
| 	// 	children: [ | ||||
| 	// 		{ | ||||
| 	// 			prop: 'original', | ||||
| 	// 			label: '原片', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'originalLossNum', | ||||
| 	// 					label: '原片不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'originalLossArea', | ||||
| 	// 					label: '原片不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'edge', | ||||
| 	// 			label: '磨边', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'edgeLossNum', | ||||
| 	// 					label: '磨边不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'edgeLossArea', | ||||
| 	// 					label: '磨边不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'drill', | ||||
| 	// 			label: '打孔', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'drillLossNum', | ||||
| 	// 					label: '打孔不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'drillLossArea', | ||||
| 	// 					label: '打孔不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'coating', | ||||
| 	// 			label: '镀膜', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'coatingLossNum', | ||||
| 	// 					label: '镀膜不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'coatingLossArea', | ||||
| 	// 					label: '镀膜不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'silk', | ||||
| 	// 			label: '丝印', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'silkLossNum', | ||||
| 	// 					label: '丝印不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'silkLossArea', | ||||
| 	// 					label: '丝印不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'tempering', | ||||
| 	// 			label: '钢化', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'temperingLossNum', | ||||
| 	// 					label: '钢化不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'temperingLossArea', | ||||
| 	// 					label: '钢化不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 		{ | ||||
| 	// 			prop: 'packing', | ||||
| 	// 			label: '包装', | ||||
|   //       align: 'center', | ||||
| 	// 			children: [ | ||||
| 	// 				{ | ||||
| 	// 					prop: 'packingLossNum', | ||||
| 	// 					label: '包装不良/片', | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 				{ | ||||
| 	// 					prop: 'packingLossArea', | ||||
| 	// 					label: '包装不良/㎡', | ||||
| 	// 					filter: (val) => (val != null ? val.toFixed(2) : '-'), | ||||
|   //           width:100 | ||||
| 	// 				}, | ||||
| 	// 			], | ||||
| 	// 		}, | ||||
| 	// 	], | ||||
| 	// }, | ||||
| ]; | ||||
|  | ||||
| export default { | ||||
| @@ -310,16 +340,21 @@ export default { | ||||
|         reportType: 1, | ||||
| 				pageSize: 10, | ||||
|         pageNo: 1, | ||||
|         startTime: undefined, | ||||
|         endTime: undefined, | ||||
| 				total: 1, | ||||
| 			}, | ||||
| 			fileName: '', | ||||
| 			dataListLoading: false, | ||||
| 			tableProps, | ||||
|       tableBtn: [ | ||||
| 				{ | ||||
|         this.$auth.hasPermi(`monitoring:group-off:update`) | ||||
|           ? { | ||||
|             type: 'eq', | ||||
|             btnName: '详情', | ||||
| 				}, | ||||
|           } | ||||
|           : undefined, | ||||
|  | ||||
| 			].filter((v) => v), | ||||
| 			showData: [], | ||||
| 			tableData: [], | ||||
| @@ -340,14 +375,18 @@ export default { | ||||
| 					type: 'select', | ||||
| 					label: '报表类型', | ||||
|           selectOptions: [ | ||||
|             { | ||||
|               id: 0, | ||||
|               name: '班', | ||||
|             }, | ||||
| 						{ | ||||
| 							id: 1, | ||||
| 							name: '日', | ||||
| 						}, | ||||
| 						{ | ||||
| 							id: 2, | ||||
| 							name: '周', | ||||
| 						}, | ||||
| 						// { | ||||
| 						// 	id: 2, | ||||
| 						// 	name: '周', | ||||
| 						// }, | ||||
| 						{ | ||||
| 							id: 3, | ||||
| 							name: '月', | ||||
| @@ -372,7 +411,8 @@ export default { | ||||
| 					param: 'timeVal', | ||||
| 				}, | ||||
| 				{ | ||||
| 					type: 'button', | ||||
|           type: this.$auth.hasPermi('monitoring:group-off:query') ? 'button' : '', | ||||
|  | ||||
| 					btnName: '查询', | ||||
| 					name: 'search', | ||||
| 					color: 'primary', | ||||
| @@ -381,8 +421,8 @@ export default { | ||||
| 					type: 'separate', | ||||
| 				}, | ||||
| 				{ | ||||
| 					// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '', | ||||
| 					type: 'button', | ||||
|           type: this.$auth.hasPermi('monitoring:group-off:export') ? 'button' : '', | ||||
| 					// type: 'button', | ||||
| 					btnName: '导出', | ||||
| 					name: 'export', | ||||
| 					color: 'warning', | ||||
| @@ -402,7 +442,9 @@ export default { | ||||
| 		// 设置为23:59:59 | ||||
| 		const end = new Date(yesterday.getTime()); | ||||
| 		end.setHours(23, 59, 59, 59); | ||||
| 		this.listQuery.reportStartTime = [yesterday.getTime(),end.getTime()]; | ||||
|     this.listQuery.startTime = yesterday.getTime(), [end.getTime()]; | ||||
|     this.listQuery.endTime = end.getTime() | ||||
|  | ||||
| 		this.$nextTick(() => { | ||||
| 			this.$refs.searchBarForm.formInline.timeVal = [yesterday.getTime(),end.getTime()]; | ||||
| 		}); | ||||
| @@ -461,8 +503,11 @@ export default { | ||||
| 					this.listQuery.factoryId = val.factoryId || undefined; | ||||
| 					this.listQuery.teamId = val.teamId || undefined; | ||||
| 					this.listQuery.reportType = val.reportType || undefined; | ||||
| 					this.listQuery.reportStartTime = val.timeVal | ||||
| 						? val.timeVal | ||||
|           this.listQuery.startTime = val.timeVal | ||||
| 						? val.timeVal[0] | ||||
|             : undefined; | ||||
|           this.listQuery.endTime = val.timeVal | ||||
|             ? val.timeVal[1] | ||||
|             : undefined; | ||||
| 					this.getDataList(); | ||||
| 					break; | ||||
| @@ -476,7 +521,9 @@ export default { | ||||
| 		// 获取数据列表 | ||||
| 		getDataList() { | ||||
|       this.dataListLoading = true; | ||||
| 			const arr = ['日', '周', '月', '年']; | ||||
|       console.log(this.listQuery); | ||||
|  | ||||
|       const arr = ['班', '日', '', '月', '年']; // 索引0对应班,1对应日,3对应月,4对应年,索引2留空 | ||||
| 			this.urlOptions.getDataListURL(this.listQuery).then((response) => { | ||||
| 				if (!response.data.list) { | ||||
| 					this.showData = []; | ||||
| @@ -484,7 +531,8 @@ export default { | ||||
| 					return; | ||||
| 				} | ||||
| 				this.tableData = response.data?.list.map((item, index) => { | ||||
| 					item.reportType = arr[item.reportType - 1]; | ||||
|           item.reportType = arr[item.reportType] || item.reportType; | ||||
|           item.drillOrCoating = item.drillNum + "/" + item.coatingNum | ||||
| 					item.originalLossNum = item.original?.lossNum; | ||||
| 					item.originalLossArea = item.original?.lossArea; | ||||
| 					item.edgeLossNum = item.edge?.lossNum; | ||||
| @@ -508,7 +556,7 @@ export default { | ||||
| 		}, | ||||
| 		handleClick(val) { | ||||
| 			this.addOrUpdateVisible = true; | ||||
|       const time = val.data.reportName?val.data.reportName:'- ' | ||||
|       const time = val.data.timeVal ? parseTime(val.data.timeVal[0]) + '-' + parseTime(val.data.timeVal[1]) : '- ' | ||||
|       const teamName = val.data.teamName?val.data.teamName:'- ' | ||||
|       const teamLeader = val.data.teamLeader?val.data.teamLeader:'- ' | ||||
| 			this.addOrEditTitle = | ||||
|   | ||||
							
								
								
									
										123
									
								
								src/views/materialReceiptIssue/base/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/views/materialReceiptIssue/base/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,123 @@ | ||||
| <!-- | ||||
|  * @Author: zwq | ||||
|  * @Date: 2021-11-18 14:16:25 | ||||
|  * @LastEditors: DY | ||||
|  * @LastEditTime: 2023-10-16 11:16:48 | ||||
|  * @Description: | ||||
| --> | ||||
| <template> | ||||
|   <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="物料名称" prop="materialName"> | ||||
|           <el-input v-model="dataForm.materialName" clearable placeholder="请输入物料名称" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="物料规格" prop="materialSize"> | ||||
|           <el-input v-model="dataForm.materialSize" clearable placeholder="请输入物料规格" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="物料批次" prop="materialDate"> | ||||
|           <el-input v-model="dataForm.materialDate" clearable placeholder="请输入物料批次" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <!-- <el-form-item label="启用状态" prop="enabled"> | ||||
| 			<el-select | ||||
| 				v-model="dataForm.enabled" | ||||
| 				placeholder="请选择启用状态"> | ||||
| 				<el-option | ||||
| 					v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)" | ||||
| 					:key="dict.value" | ||||
| 					:label="dict.label" | ||||
| 					:value="dict.value" /> | ||||
| 			</el-select> | ||||
| 		</el-form-item> --> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="入库数量" prop="materialNum"> | ||||
|           <el-input v-model="dataForm.materialNum" clearable placeholder="请输入入库数量" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|   </el-form> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import basicAdd from './../mixins/basic-add'; | ||||
| import { | ||||
|   createMaterialIssue, | ||||
| } from '@/api/material/issue'; | ||||
|  | ||||
| export default { | ||||
| 	mixins: [basicAdd], | ||||
| 	data() { | ||||
| 		return { | ||||
| 			urlOptions: { | ||||
| 			  isGetCode: false, | ||||
|         // codeURL: getCode, | ||||
|         createURL: createMaterialIssue, | ||||
| 				// updateURL: updateFactory, | ||||
| 				// infoURL: getFactory, | ||||
| 			}, | ||||
| 			dataForm: { | ||||
|         id: undefined, | ||||
|         materialName: undefined, | ||||
|         materialNum: undefined, | ||||
|         materialDate: undefined, | ||||
|         materialSize: undefined, | ||||
|         operateStatus:undefined | ||||
| 			}, | ||||
| 			dataRule: { | ||||
|         materialName: [{ required: true, message: "物料名称不能为空", trigger: "blur" }], | ||||
|         materialNum: [{  required: true, message: "数量不能为空", trigger: "blur" }], | ||||
|       } | ||||
| 		}; | ||||
| 	}, | ||||
|   methods: { | ||||
|     init(operateStatus) { | ||||
|       this.dataForm.operateStatus = operateStatus; | ||||
|       this.visible = true; | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs["dataForm"].resetFields(); | ||||
|         // if (this.dataForm.id) { | ||||
|         //   this.urlOptions.infoURL(id).then(response => { | ||||
|         //     this.dataForm = response.data; | ||||
|         //     if (this.setData) { | ||||
|         //       this.setDataForm() | ||||
|         //     } | ||||
|         //   }); | ||||
|         // } else { | ||||
|         //   if (this.urlOptions.isGetCode) { | ||||
|         //     this.getCode() | ||||
|         //   } | ||||
|         // } | ||||
|       }); | ||||
|     }, | ||||
|     dataFormSubmit() { | ||||
|       this.$refs["dataForm"].validate((valid) => { | ||||
|         if (!valid) { | ||||
|           return false; | ||||
|         } | ||||
|         // 修改的提交 | ||||
|         // if (this.dataForm.id) { | ||||
|         //   this.urlOptions.updateURL(this.dataForm).then(response => { | ||||
|         //     this.$modal.msgSuccess("修改成功"); | ||||
|         //     this.visible = false; | ||||
|         //     this.$emit("refreshDataList"); | ||||
|         //   }); | ||||
|         //   return; | ||||
|         // } | ||||
|         // 添加的提交 | ||||
|         this.urlOptions.createURL(this.dataForm).then(response => { | ||||
|           this.$modal.msgSuccess("新增成功"); | ||||
|           this.visible = false; | ||||
|           this.$emit("refreshDataList"); | ||||
|         }); | ||||
|       }); | ||||
|     }, | ||||
| 	}, | ||||
| }; | ||||
| </script> | ||||
							
								
								
									
										243
									
								
								src/views/materialReceiptIssue/base/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										243
									
								
								src/views/materialReceiptIssue/base/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,243 @@ | ||||
| <template> | ||||
| 	<div class="app-container"> | ||||
| 		<search-bar | ||||
| 			:formConfigs="formConfig" | ||||
| 			ref="searchBarForm" | ||||
| 			@headBtnClick="buttonClick" /> | ||||
| 		<base-table | ||||
| 			v-loading="dataListLoading" | ||||
| 			:table-props="tableProps" | ||||
| 			:page="listQuery.pageNo" | ||||
| 			:limit="listQuery.pageSize" | ||||
| 			:table-data="tableData"> | ||||
| 			<!-- <method-btn | ||||
| 				v-if="tableBtn.length" | ||||
| 				slot="handleBtn" | ||||
| 				:width="120" | ||||
| 				label="操作" | ||||
| 				:method-list="tableBtn" | ||||
| 				@clickBtn="handleClick" /> --> | ||||
| 		</base-table> | ||||
| 		<pagination | ||||
| 			:limit.sync="listQuery.pageSize" | ||||
| 			:page.sync="listQuery.pageNo" | ||||
| 			:total="listQuery.total" | ||||
| 			@pagination="getDataList" /> | ||||
| 		<base-dialog | ||||
| 			:dialogTitle="addOrEditTitle" | ||||
| 			:dialogVisible="addOrUpdateVisible" | ||||
| 			@cancel="handleCancel" | ||||
| 			@confirm="handleConfirm" | ||||
| 			:before-close="handleCancel" | ||||
| 			width="30%"> | ||||
| 			<add-or-update | ||||
| 				ref="addOrUpdate" | ||||
| 				@refreshDataList="successSubmit"></add-or-update> | ||||
| 		</base-dialog> | ||||
| 	</div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import AddOrUpdate from './add-or-updata'; | ||||
| import basicPage from './../mixins/basic-page'; | ||||
| import { parseTime } from './../mixins/code-filter'; | ||||
| import { | ||||
|   getMaterialReceiptIssuePageData, | ||||
| } from '@/api/material/issue'; | ||||
|  | ||||
| const tableProps = [ | ||||
| 	{ | ||||
|     prop: 'materialName', | ||||
| 		label: '物料名称' | ||||
| 	}, | ||||
| 	{ | ||||
|     prop: 'materialSize', | ||||
| 		label: '物料规格' | ||||
| 	}, | ||||
| 	{ | ||||
|     prop: 'materialDate', | ||||
|     label: '物料批次' | ||||
| 	}, | ||||
| 	{ | ||||
|     prop: 'operateStatus', | ||||
|     label: '操作状态', | ||||
|     filter: (val) => ['', '入库', '出库'][val] | ||||
|   }, | ||||
|   { | ||||
|     prop: 'materialNum', | ||||
|     label: '出入库数量', | ||||
|     // filter: (val) => ['', '入库', '出库', '移库'][val] | ||||
|   }, | ||||
| 	{ | ||||
| 		prop: 'createTime', | ||||
| 		label: '操作时间', | ||||
| 		filter: parseTime | ||||
|   }, | ||||
|   { | ||||
|     prop: 'creator', | ||||
|     label: '操作人', | ||||
|     // filter: parseTime | ||||
|   }, | ||||
| ]; | ||||
|  | ||||
| export default { | ||||
| 	mixins: [basicPage], | ||||
| 	data() { | ||||
| 		return { | ||||
| 			urlOptions: { | ||||
|         getDataListURL: getMaterialReceiptIssuePageData, | ||||
| 				// deleteURL: deleteFactory, | ||||
| 				// exportURL: exportFactoryExcel, | ||||
|       }, | ||||
|       operateStatus:undefined, | ||||
| 			tableProps, | ||||
| 			// tableBtn: [ | ||||
| 			// 	this.$auth.hasPermi(`base:factory:update`) | ||||
| 			// 		? { | ||||
| 			// 				type: 'edit', | ||||
| 			// 				btnName: '编辑', | ||||
| 			// 		  } | ||||
| 			// 		: undefined, | ||||
|       //     this.$auth.hasPermi(`base:factory:delete`) | ||||
| 			// 		? { | ||||
| 			// 				type: 'delete', | ||||
| 			// 				btnName: '删除', | ||||
| 			// 		  } | ||||
| 			// 		: undefined, | ||||
| 			// ].filter((v)=>v), | ||||
| 			tableData: [], | ||||
| 			formConfig: [ | ||||
| 				{ | ||||
|           type: 'input', | ||||
|           label: '物料名称', | ||||
| 					placeholder: '物料名称', | ||||
|           param: 'materialName', | ||||
| 				}, | ||||
| 				{ | ||||
| 					type: 'input', | ||||
|           label: '操作人', | ||||
| 					placeholder: '操作人', | ||||
|           param: 'operateName', | ||||
|         }, | ||||
|         { | ||||
|           type: 'select', | ||||
|           label: '操作状态', | ||||
|           placeholder: '操作状态', | ||||
|           selectOptions: [{ | ||||
|             id: 1, | ||||
|             name:'入库' | ||||
|           }, | ||||
|             { | ||||
|               id: 2, | ||||
|               name: '出库' | ||||
|             }], | ||||
|           param: 'operateStatus', | ||||
|         }, | ||||
|         { | ||||
|           type: 'datePicker', | ||||
|           label: '操作时间', | ||||
|           dateType: 'daterange', | ||||
|           format: 'yyyy-MM-dd', | ||||
|           valueFormat: 'timestamp', | ||||
|           rangeSeparator: '-', | ||||
|           startPlaceholder: '开始时间', | ||||
|           endPlaceholder: '结束时间', | ||||
|           param: 'timeVal', | ||||
|         }, | ||||
| 				{ | ||||
|           type: this.$auth.hasPermi('base:material-warehouse-his:query') ? 'button' : '', | ||||
| 					btnName: '搜索', | ||||
| 					name: 'search', | ||||
| 					color: 'primary', | ||||
| 				}, | ||||
| 				// { | ||||
| 				// 	type: 'separate', | ||||
| 				// }, | ||||
| 				// { | ||||
| 				// 	type: 'button', | ||||
| 				// 	btnName: '重置', | ||||
| 				// 	name: 'reset', | ||||
| 				// }, | ||||
| 				{ | ||||
| 					type: 'separate', | ||||
| 				}, | ||||
| 				{ | ||||
|           type: this.$auth.hasPermi('base:material-warehouse-his:create') ? 'button' : '', | ||||
| 					btnName: '入库', | ||||
|           name: 'receipt', | ||||
| 					color: 'success', | ||||
| 					plain: true, | ||||
|         }, | ||||
|         { | ||||
|           type: this.$auth.hasPermi('base:material-warehouse-his:create') ? 'button' : '', | ||||
|           btnName: '出库', | ||||
|           name: 'issue', | ||||
|           color: 'success', | ||||
|           plain: true, | ||||
|         }, | ||||
| 				// { | ||||
| 				// 	type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '', | ||||
| 				// }, | ||||
| 				// { | ||||
| 				// 	type: this.$auth.hasPermi('base:factory:export') ? 'button' : '', | ||||
| 				// 	btnName: '导出', | ||||
| 				// 	name: 'export', | ||||
| 				// 	color: 'warning', | ||||
| 				// }, | ||||
| 			], | ||||
| 		}; | ||||
| 	}, | ||||
| 	components: { | ||||
| 		AddOrUpdate, | ||||
| 	}, | ||||
| 	created() {}, | ||||
|   methods: { | ||||
|     addOrUpdateHandle() { | ||||
|       this.addOrUpdateVisible = true; | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs.addOrUpdate.init(this.operateStatus); | ||||
|       }); | ||||
|     }, | ||||
| 		buttonClick(val) { | ||||
| 			switch (val.btnName) { | ||||
| 				case 'search': | ||||
| 					this.listQuery.pageNo = 1; | ||||
|           this.listQuery.pageSize = 10; | ||||
|           this.listQuery.operateName = val.operateName ? val.operateName :undefined; | ||||
|           this.listQuery.operateTimeStart = val.timeVal? val.timeVal[0] :undefined; | ||||
|           this.listQuery.operateTimeEnd = val.timeVal ? val.timeVal[1] : undefined; | ||||
|           this.listQuery.materialName = val.materialName ? val.materialName : undefined; | ||||
|           this.listQuery.operateStatus = val.operateStatus ? val.operateStatus : undefined; | ||||
| 					this.getDataList(); | ||||
| 					break; | ||||
| 				case 'reset': | ||||
| 					this.$refs.searchBarForm.resetForm(); | ||||
| 					this.listQuery = { | ||||
| 						pageSize: 10, | ||||
| 						pageNo: 1, | ||||
| 						total: 1, | ||||
| 					}; | ||||
| 					this.getDataList(); | ||||
| 					break; | ||||
|         case 'receipt': | ||||
| 					this.addOrEditTitle = '入库'; | ||||
|           this.addOrUpdateVisible = true; | ||||
|           this.operateStatus = 1 | ||||
|           this.addOrUpdateHandle(); | ||||
|           break; | ||||
|         case 'issue': | ||||
|           this.addOrEditTitle = '出库'; | ||||
|           this.addOrUpdateVisible = true; | ||||
|           this.operateStatus = 2 | ||||
|           this.addOrUpdateHandle(); | ||||
|           break; | ||||
| 				case 'export': | ||||
| 					this.handleExport(); | ||||
| 					break; | ||||
| 				default: | ||||
| 					console.log(val); | ||||
| 			} | ||||
| 		}, | ||||
| 	}, | ||||
| }; | ||||
| </script> | ||||
							
								
								
									
										100
									
								
								src/views/materialReceiptIssue/mixins/basic-add.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								src/views/materialReceiptIssue/mixins/basic-add.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| /* | ||||
|  * @Author: zwq | ||||
|  * @Date: 2022-08-24 11:19:43 | ||||
|  * @LastEditors: zwq | ||||
|  * @LastEditTime: 2023-08-03 14:21:04 | ||||
|  * @Description: | ||||
|  */ | ||||
| export default { | ||||
|   data() { | ||||
|     /* eslint-disable */ | ||||
|     return { | ||||
|       urlOptions: { | ||||
|         createURL: '', | ||||
|         updateURL: '', | ||||
|         infoURL: '', | ||||
|         codeURL: '', | ||||
|         getOption: false, | ||||
|         isGetCode: false, | ||||
|         optionArrUrl: [], | ||||
|         optionArr: {} | ||||
|       }, | ||||
|       visible: false, | ||||
|       setData: false | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|   }, | ||||
|   activated() { | ||||
|   }, | ||||
|   methods: { | ||||
|     init(id) { | ||||
|       this.dataForm.id = id || ""; | ||||
|       this.visible = true; | ||||
|       if (this.urlOptions.getOption) { | ||||
|         this.getArr() | ||||
|       } | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs["dataForm"].resetFields(); | ||||
|         if (this.dataForm.id) { | ||||
|           this.urlOptions.infoURL(id).then(response => { | ||||
|             this.dataForm = response.data; | ||||
|             if (this.setData) { | ||||
|               this.setDataForm() | ||||
|             } | ||||
|           }); | ||||
|         } else { | ||||
|           if (this.urlOptions.isGetCode) { | ||||
|             this.getCode() | ||||
|           } | ||||
| 				} | ||||
|       }); | ||||
|     }, | ||||
| 		getCode() { | ||||
| 			this.urlOptions.codeURL() | ||||
| 				.then(({ data: res }) => { | ||||
| 					this.dataForm.code = res; | ||||
| 				}) | ||||
| 				.catch(() => {}); | ||||
| 		}, | ||||
|     getArr() { | ||||
|       const params = { | ||||
|         pageSize: 100, | ||||
|         pageNo: 1, | ||||
|       } | ||||
|       this.urlOptions.optionArrUrl.forEach((item, index) => { | ||||
|         item(params).then(({ data: res }) => { | ||||
|           this.$set(this.urlOptions.optionArr, `arr${index}`, res.list) | ||||
|         }) | ||||
|           .catch(() => { | ||||
|           }); | ||||
|       }); | ||||
|     }, | ||||
|     // 表单提交 | ||||
|     dataFormSubmit() { | ||||
|       this.$refs["dataForm"].validate((valid) => { | ||||
|         if (!valid) { | ||||
|           return false; | ||||
|         } | ||||
|         // 修改的提交 | ||||
|         if (this.dataForm.id) { | ||||
|           this.urlOptions.updateURL(this.dataForm).then(response => { | ||||
|             this.$modal.msgSuccess("修改成功"); | ||||
|             this.visible = false; | ||||
|             this.$emit("refreshDataList"); | ||||
|           }); | ||||
|           return; | ||||
|         } | ||||
|         // 添加的提交 | ||||
|         this.urlOptions.createURL(this.dataForm).then(response => { | ||||
|           this.$modal.msgSuccess("新增成功"); | ||||
|           this.visible = false; | ||||
|           this.$emit("refreshDataList"); | ||||
|         }); | ||||
|       }); | ||||
|     }, | ||||
|     formClear() { | ||||
|       this.$refs.dataForm.resetFields() | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										168
									
								
								src/views/materialReceiptIssue/mixins/basic-page.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								src/views/materialReceiptIssue/mixins/basic-page.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,168 @@ | ||||
| /* | ||||
|  * @Author: zwq | ||||
|  * @Date: 2022-08-24 11:19:43 | ||||
|  * @LastEditors: DY | ||||
|  * @LastEditTime: 2023-09-21 16:02:07 | ||||
|  * @Description: | ||||
|  */ | ||||
| export default { | ||||
|   data() { | ||||
|     /* eslint-disable */ | ||||
|     return { | ||||
|       urlOptions: { | ||||
|         getDataListURL: '', | ||||
|         deleteURL: '', | ||||
|         statusUrl: '', | ||||
|         exportURL: '' | ||||
|       }, | ||||
|       tableData: [], | ||||
|       listQuery: { | ||||
|         pageSize: 10, | ||||
|         pageNo: 1, | ||||
|         total: 1, | ||||
|       }, | ||||
|       exportLoading: false, | ||||
|       dataListLoading: false, | ||||
|       addOrEditTitle: '', | ||||
|       addOrUpdateVisible: false, | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|   }, | ||||
|   mounted() { | ||||
|     this.getDataList() | ||||
|   }, | ||||
|   methods: { | ||||
|     // 获取数据列表 | ||||
|     getDataList() { | ||||
|       this.dataListLoading = true; | ||||
|       this.urlOptions.getDataListURL(this.listQuery).then(response => { | ||||
|         this.tableData = response.data.list; | ||||
|         this.listQuery.total = response.data.total; | ||||
|         this.dataListLoading = false; | ||||
|       }); | ||||
|     }, | ||||
|     // 每页数 | ||||
|     sizeChangeHandle(val) { | ||||
|       this.listQuery.pageSize = val; | ||||
|       this.listQuery.pageNo = 1; | ||||
|       this.getDataList(); | ||||
|     }, | ||||
|     // 当前页 | ||||
|     currentChangeHandle(val) { | ||||
|       this.listQuery.pageNo = val; | ||||
|       this.getDataList(); | ||||
|     }, | ||||
|     // 新增 / 修改 | ||||
|     addOrUpdateHandle(id) { | ||||
|       this.addOrUpdateVisible = true; | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs.addOrUpdate.init(id); | ||||
|       }); | ||||
|     }, | ||||
|     cancel(id) { | ||||
|       this.$refs["popover-" + id].showPopper = false; | ||||
|     }, | ||||
|     //改变状态 | ||||
|     changeStatus(id) { | ||||
|       this.$http | ||||
|         .post(this.urlOptions.statusUrl, { id }) | ||||
|         .then(({ data: res }) => { | ||||
|           if (res.code !== 0) { | ||||
|             return this.$message.warning(res.msg); | ||||
|           } | ||||
|           this.$refs["popover-" + id].showPopper = false; | ||||
|           this.$message({ | ||||
|             message: this.$t("prompt.success"), | ||||
|             type: "success", | ||||
|             duration: 500, | ||||
|             onClose: () => { | ||||
|               this.getDataList(); | ||||
|             }, | ||||
|           }); | ||||
|         }) | ||||
|         .catch(() => { }); | ||||
|     }, | ||||
|     //tableBtn点击 | ||||
|     handleClick(val) { | ||||
|       if (val.type === "edit") { | ||||
|         this.addOrUpdateVisible = true; | ||||
|         this.addOrEditTitle = "编辑"; | ||||
|         this.$nextTick(() => { | ||||
|           this.$refs.addOrUpdate.init(val.data.id); | ||||
|         }); | ||||
|       } else if (val.type === "delete") { | ||||
|         this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex) | ||||
|       } else if (val.type === "change") { | ||||
|         this.changeStatus(val.data.id) | ||||
|       } else { | ||||
|         this.otherMethods(val) | ||||
|       } | ||||
|     }, | ||||
|     // 删除 | ||||
|     deleteHandle(id, name, index) { | ||||
|       this.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", { | ||||
|         confirmButtonText: "确定", | ||||
|         cancelButtonText: "取消", | ||||
|         type: "warning", | ||||
|       }) | ||||
|         .then(() => { | ||||
|           this.urlOptions.deleteURL(id).then(({ data }) => { | ||||
|             this.$message({ | ||||
|               message: "操作成功", | ||||
|               type: "success", | ||||
|               duration: 1500, | ||||
|               onClose: () => { | ||||
|                 this.getDataList(); | ||||
|               }, | ||||
|             }); | ||||
|           }); | ||||
|         }) | ||||
|         .catch(() => { }); | ||||
|     }, | ||||
|     //search-bar点击 | ||||
|     buttonClick(val) { | ||||
|       switch (val.btnName) { | ||||
|         case "search": | ||||
|           this.listQuery.xm1 = val.xm1; | ||||
|           this.listQuery.xm2 = val.xm2; | ||||
|           this.listQuery.pageNo = 1; | ||||
|           this.getDataList(); | ||||
|           break; | ||||
|         case "add": | ||||
|           this.addOrEditTitle = '新增' | ||||
|           this.addOrUpdateVisible = true; | ||||
|           this.addOrUpdateHandle() | ||||
|           break; | ||||
|         default: | ||||
|           console.log(val) | ||||
|       } | ||||
|     }, | ||||
|     handleCancel() { | ||||
|       this.$refs.addOrUpdate.formClear() | ||||
|       this.addOrUpdateVisible = false | ||||
|       this.addOrEditTitle = '' | ||||
|     }, | ||||
|     handleConfirm() { | ||||
|       this.$refs.addOrUpdate.dataFormSubmit() | ||||
|     }, | ||||
|     successSubmit() { | ||||
|       this.handleCancel() | ||||
|       this.getDataList() | ||||
|     }, | ||||
|     /** 导出按钮操作 */ | ||||
|     handleExport() { | ||||
|       // 处理查询参数 | ||||
|       let params = { ...this.queryParams }; | ||||
|       params.pageNo = undefined; | ||||
|       params.pageSize = undefined; | ||||
|       this.$modal.confirm('是否确认导出所有数据项?').then(() => { | ||||
|         this.exportLoading = true; | ||||
|         return this.urlOptions.exportURL(params); | ||||
|       }).then(response => { | ||||
|         this.$download.excel(response, '工厂.xls'); | ||||
|         this.exportLoading = false; | ||||
|       }).catch(() => { }); | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										73
									
								
								src/views/materialReceiptIssue/mixins/code-filter.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								src/views/materialReceiptIssue/mixins/code-filter.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
|  | ||||
| /* | ||||
|  * @Date: 2020-12-29 16:49:28 | ||||
|  * @LastEditors: DY | ||||
|  * @LastEditTime: 2023-09-12 11:13:34 | ||||
|  * @FilePath: \basic-admin\src\filters\basicData\index.js | ||||
|  * @Description: | ||||
|  */ | ||||
|  | ||||
| const table = { | ||||
|   lineStatus: { | ||||
|     1: '生产中', | ||||
|     2: '停止', | ||||
|     3: '未知', | ||||
|   }, | ||||
|   reportType: { | ||||
|     1: '日', | ||||
|     2: '周', | ||||
|     3: '月' | ||||
|   }, | ||||
|   pdType: { | ||||
|     1: '原片', | ||||
|     0: '深加工', | ||||
|   }, | ||||
| } | ||||
|  | ||||
| // 日期格式化 | ||||
| export function parseTime(time, pattern) { | ||||
|   if (arguments.length === 0 || !time) { | ||||
|     return null | ||||
|   } | ||||
|   const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' | ||||
|   let date | ||||
|   if (typeof time === 'object') { | ||||
|     date = time | ||||
|   } else { | ||||
|     if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { | ||||
|       time = parseInt(time) | ||||
|     } else if (typeof time === 'string') { | ||||
|       time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),''); | ||||
|     } | ||||
|     if ((typeof time === 'number') && (time.toString().length === 10)) { | ||||
|       time = time * 1000 | ||||
|     } | ||||
|     date = new Date(time) | ||||
|   } | ||||
|   const formatObj = { | ||||
|     y: date.getFullYear(), | ||||
|     m: date.getMonth() + 1, | ||||
|     d: date.getDate(), | ||||
|     h: date.getHours(), | ||||
|     i: date.getMinutes(), | ||||
|     s: date.getSeconds(), | ||||
|     a: date.getDay() | ||||
|   } | ||||
|   const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { | ||||
|     let value = formatObj[key] | ||||
|     // Note: getDay() returns 0 on Sunday | ||||
|     if (key === 'a') { | ||||
|       return ['日', '一', '二', '三', '四', '五', '六'][value] | ||||
|     } | ||||
|     if (result.length > 0 && value < 10) { | ||||
|       value = '0' + value | ||||
|     } | ||||
|     return value || 0 | ||||
|   }) | ||||
|   return time_str | ||||
| } | ||||
| export default function (dictTable) { | ||||
|   return function (val) { | ||||
|     return table?.[dictTable]?.[val] | ||||
|   } | ||||
| } | ||||
							
								
								
									
										172
									
								
								src/views/order/base/order/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								src/views/order/base/order/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,172 @@ | ||||
| <!-- | ||||
|  * @Author: zwq | ||||
|  * @Date: 2023-08-01 13:52:10 | ||||
|  * @LastEditors: DY | ||||
|  * @LastEditTime: 2023-10-16 13:40:00 | ||||
|  * @Description: | ||||
| --> | ||||
| <template> | ||||
|   <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" | ||||
|     label-width="130px"> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="订单名称" prop="name"> | ||||
|           <el-input v-model="dataForm.name" clearable placeholder="请输入订单名称" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="订单编码" prop="code"> | ||||
|           <el-input v-model="dataForm.code" clearable placeholder="请输入订单编码" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="客户" prop="customerName"> | ||||
|           <el-input v-model="dataForm.customerName" clearable placeholder="请输入客户" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="计划加工量(片)" prop="planProductNum"> | ||||
|           <el-input v-model="dataForm.planProductNum" clearable placeholder="请输入计划加工量" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="产品工艺" prop="processName"> | ||||
|           <el-input v-model="dataForm.processName" clearable placeholder="请输入产品工艺" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="产品规格" prop="planProductSize"> | ||||
|           <el-input v-model="dataForm.planProductSize" clearable placeholder="请输入产品规格" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="交货日期" prop="deliveryTime"> | ||||
|           <el-date-picker v-model="dataForm.deliveryTime" type="date" placeholder="选择交货日期" value-format="timestamp"> | ||||
|           </el-date-picker> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="包装规格(片/箱)" prop="packSpec"> | ||||
|           <el-input v-model="dataForm.packSpec" clearable placeholder="请输入包装规格" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="备注" prop="remark"> | ||||
|           <el-input v-model="dataForm.remark" clearable placeholder="请输入备注" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <span>产线信息</span> | ||||
|     <el-button type="text" icon="el-icon-plus" @click="handleAdd" style="color: #409EFF;float: right;"> | ||||
|     </el-button> | ||||
|     <el-divider></el-divider> | ||||
|     <el-row :gutter="24" v-for="(item, index) in dataForm.bindLineList" :key="index"> | ||||
|       <el-col :span="8"> | ||||
|         <el-form-item label="产线" :prop="'bindLineList.' + index + '.lineId'"> | ||||
|           <el-select v-model="item.lineId" filterable clearable placeholder="请选择产线"> | ||||
|             <el-option v-for="line in urlOptions.optionArr.arr0" :key="line.id" :label="line.name" | ||||
|               :value="line.id"></el-option> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="14"> | ||||
|         <el-form-item label="实际生产时间段" :prop="'bindLineList[' + index + '].dateRange'"> | ||||
|           <el-date-picker v-model="item.dateRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" | ||||
|             end-placeholder="结束日期" value-format="timestamp" @change="(va1) => handleChange(va1, index)" /> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|       <el-col :span="2"> | ||||
|         <!-- 删除按钮(至少保留一项) --> | ||||
|         <el-button type="text" icon="el-icon-delete" @click="handleDelete(index)" | ||||
|           :disabled="dataForm.bindLineList.length <= 1" style="color: #f56c6c;"></el-button> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|     <!-- <el-form-item label="备注" prop="remark"> | ||||
|       <el-input v-model="dataForm.remark" clearable placeholder="请输入备注" /> | ||||
|     </el-form-item> --> | ||||
|   </el-form> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import basicAdd from '../../mixins/basic-add'; | ||||
| import { | ||||
|   updateOrderData, | ||||
|   createOrderData, | ||||
|   getOrderData, | ||||
|   getOrderCode | ||||
|   // exportWorkshopSectionExcel | ||||
| } from "@/api/order/index"; | ||||
| import { | ||||
| 	getProductionLinePage, | ||||
| } from '@/api/core/base/productionLine'; | ||||
|  | ||||
| export default { | ||||
| 	mixins: [basicAdd], | ||||
| 	data() { | ||||
| 		return { | ||||
| 			urlOptions: { | ||||
|         getOption: true, | ||||
| 			  isGetCode: true, | ||||
|         codeURL: getOrderCode, | ||||
|         createURL: createOrderData, | ||||
|         updateURL: updateOrderData, | ||||
|         infoURL: getOrderData, | ||||
|         optionArrUrl: [getProductionLinePage], | ||||
| 			}, | ||||
| 			dataForm: { | ||||
| 				id: undefined, | ||||
| 				code: undefined, | ||||
|         bindLineList: [ | ||||
|         ], | ||||
|         deliveryTime:undefined, | ||||
| 				name: undefined, | ||||
|         remark: undefined, | ||||
|         planProductSize: undefined, | ||||
|         planProductNum: undefined, | ||||
|         customerName: undefined, | ||||
|         processName: undefined, | ||||
|         packSpec: undefined, | ||||
| 			}, | ||||
| 			dataRule: { | ||||
| 				code: [ | ||||
| 					{ required: true, message: '订单编码不能为空', trigger: 'blur' }, | ||||
| 				], | ||||
| 				name: [ | ||||
| 					{ required: true, message: '订单名称不能为空', trigger: 'blur' }, | ||||
| 				], | ||||
| 			}, | ||||
| 		}; | ||||
| 	}, | ||||
|   methods: { | ||||
|     handleAdd() { | ||||
|       const newItem = { | ||||
|         productionLineId: '', | ||||
|         dateRange: [] | ||||
|       }; | ||||
|       // 使用 this.$set 向数组添加元素(确保响应式) | ||||
|       this.$set( | ||||
|         this.dataForm.bindLineList, | ||||
|         this.dataForm.bindLineList.length,  // 新元素的索引(数组长度即最后一个位置) | ||||
|         newItem  // 要添加的新元素 | ||||
|       ); | ||||
|     }, | ||||
|     handleChange(val, index) { | ||||
|       console.log(val); | ||||
|       this.dataForm.bindLineList[index].startProduceTime = val[0] | ||||
|       this.dataForm.bindLineList[index].finishProduceTime = val[1] | ||||
|     }, | ||||
|     handleDelete(index) { | ||||
|       this.dataForm.bindLineList.splice(index, 1); | ||||
|       Message.info('已删除该配置'); | ||||
|     }, | ||||
| 	}, | ||||
| }; | ||||
| </script> | ||||
							
								
								
									
										358
									
								
								src/views/order/base/order/detail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										358
									
								
								src/views/order/base/order/detail.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,358 @@ | ||||
| <!-- | ||||
|  * @Author: zhp | ||||
|  * @Date: 2021-12-04 16:27:09 | ||||
|  * @LastEditTime: 2022-08-09 09:47:17 | ||||
|  * @LastEditors: zhp | ||||
|  * @Description: | ||||
| --> | ||||
| <template> | ||||
|   <div> | ||||
|     <el-drawer title="详情" :visible.sync="drawer" :before-close="handleClose" size="60%"> | ||||
|       <div class="detailBox"> | ||||
|         <h2 style="margin-left: 32px;"> | ||||
|           订单编号: {{ dataForm.code}} | ||||
|         </h2> | ||||
|         <el-row> | ||||
|           <el-col :span="8"> | ||||
|             <p class="title">订单名称</p> | ||||
|             <p class="text">{{ dataForm.name }}</p> | ||||
|           </el-col> | ||||
|           <el-col :span="8"> | ||||
|             <p class="title">客户</p> | ||||
|             <p class="text">{{ dataForm.customerName }}</p> | ||||
|           </el-col> | ||||
|           <el-col :span="8"> | ||||
|             <p class="title">计划加工量</p> | ||||
|             <p class="text">{{ dataForm?.planProductNum }}</p> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|         <!-- <el-divider /> --> | ||||
|         <div> | ||||
|           <el-row> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">产品工艺</p> | ||||
|               <p class="text">{{ dataForm?.processName }}</p> | ||||
|             </el-col> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">产品规格</p> | ||||
|               <p class="text">{{ dataForm?.planProductSize }}</p> | ||||
|             </el-col> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">交货日期</p> | ||||
|               <p class="text">{{ parseTime(dataForm?.deliveryTime) }}</p> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|           <el-row> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">包装规格(片/箱)</p> | ||||
|               <p class="text">{{ dataForm?.packSpec }}</p> | ||||
|             </el-col> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">实际生产时间</p> | ||||
|               <p class="text">{{ parseTime(dataForm?.startProduceTime) + '-' + parseTime(dataForm?.finishProduceTime) }}</p> | ||||
|             </el-col> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">实际投入数量</p> | ||||
|               <p class="text">{{ dataForm?.assignQuantity }}</p> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|           <el-row> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">实际产出数量</p> | ||||
|               <p class="text">{{ dataForm?.actualQuantity }}</p> | ||||
|             </el-col> | ||||
|             <el-col :span="8"> | ||||
|               <p class="title">备注</p> | ||||
|               <p class="text">{{ dataForm?.remark }}</p> | ||||
|             </el-col> | ||||
|           </el-row> | ||||
|         </div> | ||||
|         <!-- <div v-if="glass === 4"> --> | ||||
|         <!-- 铜铟镓硒待完成 --> | ||||
|         <!-- </div> --> | ||||
|       </div> | ||||
|       <!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> --> | ||||
|  | ||||
|       <h2 style="margin-left: 32px;"> | ||||
|         产线信息 | ||||
|       </h2> | ||||
|       <el-divider /> | ||||
|       <el-button @click="handleRoute" type="text" style="float: right;margin-right: 20px;">订单生产详情</el-button> | ||||
|       <base-table :table-props="tableProps" :table-data="tableData"> | ||||
|         <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn" | ||||
|           @clickBtn="handleClick" /> | ||||
|       </base-table> | ||||
|       <!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" | ||||
|         @pagination="getDataList" /> --> | ||||
|     </el-drawer> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| const tableProps = [{ | ||||
|   prop: 'lineName', | ||||
|   label: '产线', | ||||
|   align: 'center' | ||||
| }, | ||||
|   { | ||||
|     prop: 'processName', | ||||
|     label: '产品工艺', | ||||
|     align: 'center' | ||||
|   }, { | ||||
|     prop: 'planProductSize', | ||||
|     label: '产品规格', | ||||
|     align: 'center' | ||||
|   }, { | ||||
|     prop: 'startProduceTime', | ||||
|     label: '开始时间', | ||||
|     filter: parseTime, | ||||
|  | ||||
|     align: 'center' | ||||
|   }, { | ||||
|     prop: 'finishProduceTime', | ||||
|     label: '结束时间', | ||||
|     filter: parseTime, | ||||
|     align: 'center' | ||||
|   }, { | ||||
|     prop: 'assignQuantity', | ||||
|     label: '投入数量', | ||||
|     align: 'center' | ||||
|   }, { | ||||
|     prop: 'actualQuantity', | ||||
|     label: '产出数量', | ||||
|     align: 'center' | ||||
|   }, | ||||
| ] | ||||
| // import { getPageWareHouseSubstrateHistory } from '@/api/equipment/trans' | ||||
| // import BaseTable from '@/components/BaseTable' | ||||
| // // import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn' | ||||
| // import Pagination from '@/components/Pagination' | ||||
| // edit here | ||||
| // import i18n from '@/lang' | ||||
|  | ||||
| // import HeadForm from '@/components/basicData/HeadForm' | ||||
| import { | ||||
|   getOrderData, | ||||
|   // exportWorkshopSectionExcel | ||||
| } from "@/api/order/index"; | ||||
| import { parseTime } from '../../mixins/code-filter'; | ||||
|  | ||||
| export default { | ||||
|   components: { | ||||
|     // BaseTable, | ||||
|     // Pagination, | ||||
|     // HeadForm | ||||
|     // MethodBtn | ||||
|     // MethodBtn | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       tableProps, | ||||
|       drawer: false, | ||||
|       list: [], | ||||
|       tableBtn: [{ | ||||
|             type: 'detail', | ||||
|             btnName: '产线生产详情', | ||||
|           } | ||||
|         // this.$auth.hasPermi(`base:workshop-section:delete`) | ||||
|         // ? { | ||||
|         // 		type: 'delete', | ||||
|         // 		btnName: '删除', | ||||
|         //   } | ||||
|         // : undefined, | ||||
|       ].filter((v) => v), | ||||
|       tableData:[], | ||||
|       listLoading: false, | ||||
|       total: 0, | ||||
|       edit: false, | ||||
|       // dataForm: { | ||||
|       //   id: null, | ||||
|       //   io: null, | ||||
|       //   status: null | ||||
|       // }, | ||||
|       lineIdList:[], | ||||
|       dataForm: { | ||||
|         id: null, | ||||
|         name: '', // 订单名称 | ||||
|         customerName: '', // 客户 | ||||
|         planProductNum: '', // 计划加工量 | ||||
|         processName: '', // 产品工艺 | ||||
|         planProductSize: '', // 产品规格 | ||||
|         deliveryTime: '', // 交货日期 | ||||
|         packSpec: '', // 包装规格(片/箱) | ||||
|         startProduceTime: '', // 实际生产时间 | ||||
|         assignQuantity: '', // 实际投入数量 | ||||
|         actualQuantity: '', // 实际产出数量 | ||||
|         remark: '' // 备注 | ||||
|       }, | ||||
|       listQuery: { | ||||
|  | ||||
|       }, | ||||
|       // headFormConfig: [ | ||||
|       //   { | ||||
|       //     label: this.$t('module.equipmentManager.trans.inEqTime'), | ||||
|       //     type: 'datePickRange', | ||||
|       //     dateType: 'datetimerange', | ||||
|       //     format: 'yyyy-MM-dd HH:mm:ss', | ||||
|       //     valueFormat: 'yyyy-MM-ddTHH:mm:ss', | ||||
|       //     param: 'inTime' | ||||
|       //   }, | ||||
|       //   { | ||||
|       //     label: this.$t('module.equipmentManager.trans.outTime'), | ||||
|       //     type: 'datePickRange', | ||||
|       //     dateType: 'datetimerange', | ||||
|       //     format: 'yyyy-MM-dd HH:mm:ss', | ||||
|       //     valueFormat: 'yyyy-MM-ddTHH:mm:ss', | ||||
|       //     param: 'outTime' | ||||
|       //   }, | ||||
|       //   { | ||||
|       //     type: 'button', | ||||
|       //     btnName: 'btn.search', | ||||
|       //     name: 'search', | ||||
|       //     color: 'primary' | ||||
|       //   } | ||||
|       //   // { | ||||
|       //   //   type: 'button', | ||||
|       //   //   btnName: 'btn.exportBtn', | ||||
|       //   //   name: 'exportBtn', | ||||
|       //   //   color: 'primary' | ||||
|       //   // } | ||||
|       // ], | ||||
|       rules: { | ||||
|         // slotNo: [ | ||||
|         //   { required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.trans.slotNo')]), trigger: 'blur' } | ||||
|         // ], | ||||
|         // substrateId: [ | ||||
|         //   { required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.equipmentManager.trans.substrateId')]), trigger: 'blur' } | ||||
|         // ] | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     handleClose() { | ||||
|       this.drawer = false | ||||
|     }, | ||||
|     handleRoute() { | ||||
|       console.log(this.lineIdList); | ||||
|  | ||||
|       this.$router.push({ | ||||
|         path: '/core/monitoring/production-line-data', | ||||
|         query: { | ||||
|           lineId: this.lineIdList, | ||||
|           startProduceTime: this.dataForm.startProduceTime, | ||||
|           finishProduceTime: this.dataForm.finishProduceTime, | ||||
|           tab: 'his', | ||||
|           name: this.dataForm.name, | ||||
|           code: this.dataForm.code, | ||||
|  | ||||
|           buttonType:'order' | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     handleClick(val) { | ||||
|       console.log(val); | ||||
|  | ||||
|       this.$router.push({ | ||||
|         path: '/core/monitoring/production-line-data', | ||||
|         query: { | ||||
|           lineId: [val.data.lineId], | ||||
|           startProduceTime: val.data.startProduceTime, | ||||
|           finishProduceTime: val.data.finishProduceTime, | ||||
|           tab:'his' | ||||
|         } | ||||
|       }) | ||||
|     }, | ||||
|     async init(id) { | ||||
|       // if (id !== undefined) { | ||||
|       this.dataForm.id = id || '' | ||||
|       //   this.edit = true | ||||
|       // } | ||||
|       // console.log(this.edit) | ||||
|       this.drawer = true | ||||
|       this.$nextTick(() => { | ||||
|         // this.$refs['dataForm'].resetFields() | ||||
|         getOrderData(id).then((res) => { | ||||
|           this.dataForm = res.data | ||||
|           this.tableData = res.data.bindLines | ||||
|  | ||||
|           this.tableData.forEach(ele => { | ||||
|             this.lineIdList.push( | ||||
|               ele.lineId | ||||
|             ) | ||||
|           }); | ||||
|  | ||||
|         }) | ||||
|         // console.log(); | ||||
|  | ||||
|         // if (this.listQuery.id) { | ||||
|         //   this.getList() | ||||
|         // } | ||||
|       }) | ||||
|     }, | ||||
|     getList() { | ||||
|       getPageWareHouseSubstrateHistory(this.listQuery).then(res => { | ||||
|         console.log(res) | ||||
|  | ||||
|         this.list = res.data.records | ||||
|         this.total = res.data.total | ||||
|       }) | ||||
|     } | ||||
|     // dataSubmit() { | ||||
|     //   this.$refs['dataForm'].validate((valid) => { | ||||
|     //     if (valid) { | ||||
|     //       if (this.dataForm.id) { | ||||
|     //         const data = { | ||||
|     //           id: this.dataForm.id, | ||||
|     //           io: this.dataForm.io, | ||||
|     //           status: this.dataForm.status | ||||
|     //         } | ||||
|     //         addOrUpdateLineSideWareHouseDetailData(data).then(res => { | ||||
|     //           this.$message({ | ||||
|     //             message: this.$t('module.basicData.visual.success'), | ||||
|     //             type: 'success', | ||||
|     //             duration: 1500, | ||||
|     //             onClose: () => { | ||||
|     //               this.drawer = false | ||||
|     //               this.$emit('refreshDataList') | ||||
|     //             } | ||||
|     //           }) | ||||
|     //         }) | ||||
|     //       } | ||||
|     //     } | ||||
|     //   }) | ||||
|     // } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|     .detailBox p { | ||||
|       margin: 0; | ||||
|       padding: 0 32px; | ||||
|     } | ||||
|  | ||||
|     .detailBox.title { | ||||
|       /* width: 56px; */ | ||||
|       /* height: 14px; */ | ||||
|       font-family: Source Han Sans CN, Source Han Sans CN; | ||||
|       font-weight: 400; | ||||
|       font-size: 14px; | ||||
|       color: rgba(0, 0, 0, 0.85); | ||||
|       line-height: 16px; | ||||
|       text-align: left; | ||||
|       font-style: normal; | ||||
|       text-transform: none; | ||||
|     } | ||||
|  | ||||
|     .detailBox.text { | ||||
|       font-size: 14px; | ||||
|       font-weight: 400; | ||||
|       color: rgba(102, 102, 102, 0.75); | ||||
|       padding-bottom: 20px; | ||||
|     } | ||||
|  | ||||
|     .detailBox { | ||||
|       width: 98%; | ||||
|       padding: 30px 0; | ||||
|     } | ||||
| </style> | ||||
							
								
								
									
										362
									
								
								src/views/order/base/order/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										362
									
								
								src/views/order/base/order/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,362 @@ | ||||
| <template> | ||||
|   <div class="app-container"> | ||||
|     <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> | ||||
|     <el-table v-loading="dataListLoading" :data="tableData" row-key="id" border style="width: 100%"> | ||||
|       <el-table-column label="序号" type="index" width="50" /> | ||||
|       <!-- 订单名称/产线名称列 --> | ||||
|       <el-table-column prop="name" label="订单名称/产线名称" align="center" /> | ||||
|  | ||||
|       <!-- 订单编号列 --> | ||||
|       <el-table-column prop="code" label="订单编号" align="center" /> | ||||
|  | ||||
|       <!-- 客户列 --> | ||||
|       <el-table-column prop="customerName" label="客户" align="center" /> | ||||
|  | ||||
|       <!-- 计划加工量列 --> | ||||
|       <el-table-column prop="planProductNum" label="计划加工量" align="center" /> | ||||
|  | ||||
|       <!-- 实际加工量列 --> | ||||
|       <el-table-column prop="actualQuantity" label="实际加工量" align="center" /> | ||||
|  | ||||
|       <!-- 产品工艺列 --> | ||||
|       <el-table-column prop="processName" label="产品工艺" align="center" /> | ||||
|  | ||||
|       <!-- 产品规格列 --> | ||||
|       <el-table-column prop="planProductSize" label="产品规格" align="center" /> | ||||
|  | ||||
|       <!-- 交货时间列(带时间格式化) --> | ||||
|       <el-table-column prop="deliveryTime" label="交货时间" align="center"> | ||||
|         <template #default="scope"> | ||||
|           {{ parseTime(scope.row.deliveryTime) }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|  | ||||
|       <!-- 开始时间列(带时间格式化) --> | ||||
|       <el-table-column prop="startProduceTime" label="开始时间" align="center"> | ||||
|         <template #default="scope"> | ||||
|           {{ parseTime(scope.row.startProduceTime) }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|  | ||||
|       <!-- 结束时间列(带时间格式化) --> | ||||
|       <el-table-column prop="finishProduceTime" label="结束时间" align="center"> | ||||
|         <template #default="scope"> | ||||
|           {{ parseTime(scope.row.finishProduceTime) }} | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|  | ||||
|       <!-- 产线数量列 --> | ||||
|       <el-table-column prop="bindLineNum" label="产线数量" align="center" /> | ||||
|  | ||||
|       <!-- 操作列(对应原handleBtn插槽) --> | ||||
|       <el-table-column fixed="right" label="操作" width="120"> | ||||
|         <template #default="scope"> | ||||
|           <!-- 只在 level 为 0 时显示操作按钮 --> | ||||
|           <div v-if="scope.row.level === 0"> | ||||
|             <!-- 详情按钮 --> | ||||
|             <span v-hasPermi="['base:core-work-order:update']" class="iconfont icon-detail  primary-color" | ||||
|               @click="handleDetail(scope.row)" style="cursor: pointer; margin-right: 10px;"></span> | ||||
|  | ||||
|             <!-- 编辑按钮 --> | ||||
|             <span v-hasPermi="['base:core-work-order:update']" class="iconfont icon-edit primary-color" | ||||
|               @click="handleEdit(scope.row)" style="cursor: pointer; margin-right: 10px;"></span> | ||||
|  | ||||
|             <!-- 删除按钮 --> | ||||
|             <span v-hasPermi="['base:core-work-order:delete']" class="iconfont icon-delete delete-color" | ||||
|               @click="deleteHandle(scope.row.id,scope.row.name,scope.row.index)" style="cursor: pointer;"></span> | ||||
|           </div> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
|     <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total" | ||||
|       @pagination="getDataList" /> | ||||
|     <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" @cancel="handleCancel" | ||||
|       @confirm="handleConfirm" :before-close="handleCancel" width="50%"> | ||||
|       <add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update> | ||||
|     </base-dialog> | ||||
|     <detail v-if="dialogVisibleDetail" ref="detailDialog" @refreshDataList="getDataList" /> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| import AddOrUpdate from './add-or-updata'; | ||||
| import detail from './detail'; | ||||
|  | ||||
| import basicPage from '../../mixins/basic-page'; | ||||
| import { parseTime } from '../../mixins/code-filter'; | ||||
| import { | ||||
|   getOrderPage, | ||||
|   deleteOrder | ||||
|   // getWorkshopSectionPage, | ||||
|   // exportWorkshopSectionExcel | ||||
| } from "@/api/order/index"; | ||||
| import { getPdList } from '@/api/core/monitoring/auto'; | ||||
| import { getFactoryPage } from '@/api/core/base/factory'; | ||||
|  | ||||
| const tableProps = [ | ||||
| 	{ | ||||
| 		prop: 'name', | ||||
| 		label: '订单名称/产线名称' | ||||
| 	}, | ||||
| 	{ | ||||
| 		prop: 'code', | ||||
| 		label: '订单编号' | ||||
| 	}, | ||||
| 	{ | ||||
|     prop: 'customerName', | ||||
| 		label: '客户' | ||||
| 	}, | ||||
| 	{ | ||||
|     prop: 'planProductNum', | ||||
| 		label: '计划加工量' | ||||
|   }, | ||||
|   { | ||||
|     prop: 'productNum', | ||||
|     label: '实际加工量' | ||||
|   }, | ||||
|   { | ||||
|     prop: 'processName', | ||||
|     label: '产品工艺' | ||||
|   }, | ||||
|   { | ||||
|     prop: 'planProductSize', | ||||
|     label: '产品规格' | ||||
|   }, | ||||
| 	{ | ||||
|     prop: 'deliveryTime', | ||||
|     label: '交货时间', | ||||
| 		filter: parseTime | ||||
|   }, | ||||
|   { | ||||
|     prop: 'startProduceTime', | ||||
|     label: '开始时间', | ||||
|     filter: parseTime | ||||
|   }, | ||||
|   { | ||||
|     prop: 'finishProduceTime', | ||||
|     label: '结束时间', | ||||
|     filter: parseTime | ||||
|   }, | ||||
|   { | ||||
|     prop: 'bindLineNum', | ||||
|     label: '产线数量', | ||||
|   }, | ||||
| ]; | ||||
|  | ||||
| export default { | ||||
| 	mixins: [basicPage], | ||||
| 	data() { | ||||
| 		return { | ||||
| 			urlOptions: { | ||||
|         getDataListURL: getOrderPage, | ||||
|         deleteURL: deleteOrder, | ||||
| 				// exportURL: exportWorkshopSectionExcel, | ||||
| 			}, | ||||
|       tableProps, | ||||
|       dialogVisibleDetail:false, | ||||
| 			tableBtn: [ | ||||
|         this.$auth.hasPermi(`base:core-work-order:update`) | ||||
| 					? { | ||||
| 							type: 'edit', | ||||
| 							btnName: '编辑', | ||||
| 					  } | ||||
| 					: undefined, | ||||
|         this.$auth.hasPermi(`base:core-work-order:delete`) | ||||
| 					? { | ||||
| 							type: 'delete', | ||||
| 							btnName: '删除', | ||||
| 					  } | ||||
| 					: undefined, | ||||
| 			].filter((v)=>v), | ||||
| 			listQuery: { | ||||
|         lineId: null, | ||||
|         startTime: undefined, | ||||
|         endTime:undefined | ||||
| 			}, | ||||
| 			tableData: [], | ||||
|       formConfig: [ | ||||
|         { | ||||
|           type: 'input', | ||||
|           label: '订单名称', | ||||
|           placeholder: '工段名称', | ||||
|           param: 'name', | ||||
|         }, | ||||
| 				// { | ||||
| 				// 	type: 'select', | ||||
| 				// 	label: '工厂', | ||||
| 				// 	selectOptions: [], | ||||
| 				// 	param: 'factoryId', | ||||
| 				// 	onchange: true, | ||||
| 				// }, | ||||
| 				{ | ||||
| 					type: 'select', | ||||
| 					label: '产线', | ||||
| 					selectOptions: [], | ||||
| 					param: 'lineId', | ||||
| 					// multiple: true, | ||||
| 				}, | ||||
|         { | ||||
|           type: 'datePicker', | ||||
|           label: '时间范围', | ||||
|           dateType: 'daterange', | ||||
|           format: 'yyyy-MM-dd', | ||||
|           valueFormat: 'timestamp', | ||||
|           rangeSeparator: '-', | ||||
|           startPlaceholder: '开始时间', | ||||
|           endPlaceholder: '结束时间', | ||||
|           param: 'timeVal', | ||||
|         }, | ||||
| 				{ | ||||
|           type: this.$auth.hasPermi('base:core-work-order:query') ? 'button' : '', | ||||
| 					btnName: '搜索', | ||||
| 					name: 'search', | ||||
| 					color: 'primary', | ||||
| 				}, | ||||
| 				// { | ||||
| 				// 	type: 'separate', | ||||
| 				// }, | ||||
| 				// { | ||||
| 				// 	type: 'button', | ||||
| 				// 	btnName: '重置', | ||||
| 				// 	name: 'reset', | ||||
| 				// }, | ||||
| 				{ | ||||
| 					type: 'separate', | ||||
| 				}, | ||||
| 				{ | ||||
|           type: this.$auth.hasPermi('base:core-work-order:create') ? 'button' : '', | ||||
| 					btnName: '新增', | ||||
| 					name: 'add', | ||||
| 					color: 'success', | ||||
| 					plain: true, | ||||
| 				}, | ||||
| 				// { | ||||
| 				// 	type: this.$auth.hasPermi('base:workshop-section:create') ? 'separate' : '', | ||||
| 				// }, | ||||
| 				// { | ||||
| 				// 	type: this.$auth.hasPermi('base:workshop-section:export') ? 'button' : '', | ||||
| 				// 	btnName: '导出', | ||||
| 				// 	name: 'export', | ||||
| 				// 	color: 'warning', | ||||
| 				// }, | ||||
| 			], | ||||
| 		}; | ||||
| 	}, | ||||
| 	components: { | ||||
|     AddOrUpdate, | ||||
|     detail | ||||
| 	}, | ||||
| 	created() { | ||||
| 		this.getPdLineList(); | ||||
| 	}, | ||||
| 	methods: { | ||||
| 		getPdLineList() { | ||||
| 			getPdList().then((res) => { | ||||
| 				this.formConfig[1].selectOptions = res.data || []; | ||||
| 			}); | ||||
| 			const params = { | ||||
| 				pageSize: 100, | ||||
| 				pageNo: 1, | ||||
| 			}; | ||||
| 			getFactoryPage(params).then((res) => { | ||||
| 				this.formConfig[0].selectOptions = res.data.list || []; | ||||
| 			}); | ||||
| 		}, | ||||
| 		// handleSearchBarChanged({ param, value }) { | ||||
| 		// 	this.listQuery.lineId = null; | ||||
| 		// 	this.$refs.searchBarForm.formInline.lineId = undefined; | ||||
| 		// 	getPdList(value).then((res) => { | ||||
| 		// 		this.formConfig[1].selectOptions = res.data || []; | ||||
| 		// 	}); | ||||
|     // }, | ||||
|     getDataList() { | ||||
|       this.dataListLoading = true; | ||||
|       this.urlOptions.getDataListURL(this.listQuery).then(response => { | ||||
|         this.tableData = response.data.list.map((ele) => { | ||||
|           ele.children = ele.bindLines.map((item) => { | ||||
|             item.name = item.lineName; | ||||
|             item.level = 1 | ||||
|             return item | ||||
|           }) | ||||
|           ele.level = 0 | ||||
|           return ele; | ||||
|         }) | ||||
|         console.log(this.tableData); | ||||
|         this.listQuery.total = response.data.total; | ||||
|         this.dataListLoading = false; | ||||
|       }); | ||||
|     }, | ||||
|     handleEdit(val) { | ||||
|       console.log(val); | ||||
|  | ||||
|       // if (val.type === "edit") { | ||||
|         this.addOrUpdateVisible = true; | ||||
|         this.addOrEditTitle = "编辑"; | ||||
|         this.$nextTick(() => { | ||||
|           this.$refs.addOrUpdate.init(val.id); | ||||
|         }); | ||||
|       // } | ||||
|     }, | ||||
|     handleDetail(val) { | ||||
|       console.log(val); | ||||
|  | ||||
|       // if (val.type === "edit") { | ||||
|       this.dialogVisibleDetail = true; | ||||
|       // this.addOrEditTitle = "编辑"; | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs.detailDialog.init(val.id); | ||||
|       }); | ||||
|       // } | ||||
|     }, | ||||
|     addOrUpdateHandle(id) { | ||||
|       this.addOrUpdateVisible = true; | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs.addOrUpdate.init(id); | ||||
|       }); | ||||
|     }, | ||||
|     buttonClick(val) { | ||||
|       console.log(val); | ||||
|  | ||||
| 			switch (val.btnName) { | ||||
| 				case 'search': | ||||
| 					this.listQuery.pageNo = 1; | ||||
| 					this.listQuery.pageSize = 10; | ||||
| 					this.listQuery.name = val.name; | ||||
| 					this.listQuery.factoryId = val.factoryId || undefined; | ||||
|           this.listQuery.lineId = val.lineId || null; | ||||
|           this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined | ||||
|           this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined | ||||
| 					this.getDataList(); | ||||
| 					break; | ||||
| 				case 'reset': | ||||
| 					this.$refs.searchBarForm.resetForm(); | ||||
| 					this.listQuery = { | ||||
| 						pageSize: 10, | ||||
| 						pageNo: 1, | ||||
| 						total: 1, | ||||
| 					}; | ||||
| 					this.getDataList(); | ||||
| 					break; | ||||
| 				case 'add': | ||||
| 					this.addOrEditTitle = '新增'; | ||||
| 					this.addOrUpdateVisible = true; | ||||
| 					this.addOrUpdateHandle(); | ||||
| 					break; | ||||
| 				case 'export': | ||||
| 					this.handleExport(); | ||||
| 					break; | ||||
| 				default: | ||||
| 					console.log(val); | ||||
| 			} | ||||
| 		}, | ||||
| 	}, | ||||
| }; | ||||
| </script> | ||||
| <style> | ||||
| .delete-color { | ||||
|   color: #ff5454; | ||||
| } | ||||
| .primary-color { | ||||
|   color: #0b58ff; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										109
									
								
								src/views/order/mixins/basic-add.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								src/views/order/mixins/basic-add.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| /* | ||||
|  * @Author: zwq | ||||
|  * @Date: 2022-08-24 11:19:43 | ||||
|  * @LastEditors: zwq | ||||
|  * @LastEditTime: 2023-08-03 14:21:04 | ||||
|  * @Description: | ||||
|  */ | ||||
| export default { | ||||
|   data() { | ||||
|     /* eslint-disable */ | ||||
|     return { | ||||
|       urlOptions: { | ||||
|         createURL: '', | ||||
|         updateURL: '', | ||||
|         infoURL: '', | ||||
|         codeURL: '', | ||||
|         getOption: false, | ||||
|         isGetCode: false, | ||||
|         optionArrUrl: [], | ||||
|         optionArr: {} | ||||
|       }, | ||||
|       dataForm:{}, | ||||
|       visible: false, | ||||
|       setData: false | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|   }, | ||||
|   activated() { | ||||
|   }, | ||||
|   methods: { | ||||
|     init(id) { | ||||
|       this.dataForm.id = id || ""; | ||||
|       this.visible = true; | ||||
|       if (this.urlOptions.getOption) { | ||||
|         this.getArr() | ||||
|       } | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs["dataForm"].resetFields(); | ||||
|         this.dataForm.bindLineList = [] | ||||
|         if (this.dataForm.id) { | ||||
|           this.urlOptions.infoURL(id).then(response => { | ||||
|             this.dataForm = response.data; | ||||
|             this.dataForm.bindLineList = response.data.bindLines.map((ele) => { | ||||
|               ele.lineId = ele.lineId; | ||||
|               ele.dateRange = [ele.startProduceTime, ele.finishProduceTime]; | ||||
|               return ele | ||||
|             }) | ||||
|  | ||||
|             if (this.setData) { | ||||
|               this.setDataForm() | ||||
|             } | ||||
|           }); | ||||
|         } else { | ||||
|           if (this.urlOptions.isGetCode) { | ||||
|             this.getCode() | ||||
|           } | ||||
| 				} | ||||
|       }); | ||||
|     }, | ||||
| 		getCode() { | ||||
| 			this.urlOptions.codeURL() | ||||
| 				.then(({ data: res }) => { | ||||
| 					this.dataForm.code = res; | ||||
| 				}) | ||||
| 				.catch(() => {}); | ||||
| 		}, | ||||
|     getArr() { | ||||
|       const params = { | ||||
|         pageSize: 100, | ||||
|         pageNo: 1, | ||||
|       } | ||||
|       this.urlOptions.optionArrUrl.forEach((item, index) => { | ||||
|         item(params).then(({ data: res }) => { | ||||
|           this.$set(this.urlOptions.optionArr, `arr${index}`, res.list) | ||||
|         }) | ||||
|           .catch(() => { | ||||
|           }); | ||||
|       }); | ||||
|     }, | ||||
|     // 表单提交 | ||||
|     dataFormSubmit() { | ||||
|       this.$refs["dataForm"].validate((valid) => { | ||||
|         if (!valid) { | ||||
|           return false; | ||||
|         } | ||||
|         // 修改的提交 | ||||
|         if (this.dataForm.id) { | ||||
|           this.urlOptions.updateURL(this.dataForm).then(response => { | ||||
|             this.$modal.msgSuccess("修改成功"); | ||||
|             this.visible = false; | ||||
|             this.$emit("refreshDataList"); | ||||
|           }); | ||||
|           return; | ||||
|         } | ||||
|         // 添加的提交 | ||||
|         this.urlOptions.createURL(this.dataForm).then(response => { | ||||
|           this.$modal.msgSuccess("新增成功"); | ||||
|           this.visible = false; | ||||
|           this.$emit("refreshDataList"); | ||||
|         }); | ||||
|       }); | ||||
|     }, | ||||
|     formClear() { | ||||
|       this.$refs.dataForm.resetFields() | ||||
|  | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										168
									
								
								src/views/order/mixins/basic-page.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								src/views/order/mixins/basic-page.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,168 @@ | ||||
| /* | ||||
|  * @Author: zwq | ||||
|  * @Date: 2022-08-24 11:19:43 | ||||
|  * @LastEditors: DY | ||||
|  * @LastEditTime: 2023-09-21 16:02:07 | ||||
|  * @Description: | ||||
|  */ | ||||
| export default { | ||||
|   data() { | ||||
|     /* eslint-disable */ | ||||
|     return { | ||||
|       urlOptions: { | ||||
|         getDataListURL: '', | ||||
|         deleteURL: '', | ||||
|         statusUrl: '', | ||||
|         exportURL: '' | ||||
|       }, | ||||
|       tableData: [], | ||||
|       listQuery: { | ||||
|         pageSize: 10, | ||||
|         pageNo: 1, | ||||
|         total: 1, | ||||
|       }, | ||||
|       exportLoading: false, | ||||
|       dataListLoading: false, | ||||
|       addOrEditTitle: '', | ||||
|       addOrUpdateVisible: false, | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|   }, | ||||
|   mounted() { | ||||
|     this.getDataList() | ||||
|   }, | ||||
|   methods: { | ||||
|     // 获取数据列表 | ||||
|     getDataList() { | ||||
|       this.dataListLoading = true; | ||||
|       this.urlOptions.getDataListURL(this.listQuery).then(response => { | ||||
|         this.tableData = response.data.list; | ||||
|         this.listQuery.total = response.data.total; | ||||
|         this.dataListLoading = false; | ||||
|       }); | ||||
|     }, | ||||
|     // 每页数 | ||||
|     sizeChangeHandle(val) { | ||||
|       this.listQuery.pageSize = val; | ||||
|       this.listQuery.pageNo = 1; | ||||
|       this.getDataList(); | ||||
|     }, | ||||
|     // 当前页 | ||||
|     currentChangeHandle(val) { | ||||
|       this.listQuery.pageNo = val; | ||||
|       this.getDataList(); | ||||
|     }, | ||||
|     // 新增 / 修改 | ||||
|     addOrUpdateHandle(id) { | ||||
|       this.addOrUpdateVisible = true; | ||||
|       this.$nextTick(() => { | ||||
|         this.$refs.addOrUpdate.init(id); | ||||
|       }); | ||||
|     }, | ||||
|     cancel(id) { | ||||
|       this.$refs["popover-" + id].showPopper = false; | ||||
|     }, | ||||
|     //改变状态 | ||||
|     changeStatus(id) { | ||||
|       this.$http | ||||
|         .post(this.urlOptions.statusUrl, { id }) | ||||
|         .then(({ data: res }) => { | ||||
|           if (res.code !== 0) { | ||||
|             return this.$message.warning(res.msg); | ||||
|           } | ||||
|           this.$refs["popover-" + id].showPopper = false; | ||||
|           this.$message({ | ||||
|             message: this.$t("prompt.success"), | ||||
|             type: "success", | ||||
|             duration: 500, | ||||
|             onClose: () => { | ||||
|               this.getDataList(); | ||||
|             }, | ||||
|           }); | ||||
|         }) | ||||
|         .catch(() => { }); | ||||
|     }, | ||||
|     //tableBtn点击 | ||||
|     handleClick(val) { | ||||
|       if (val.type === "edit") { | ||||
|         this.addOrUpdateVisible = true; | ||||
|         this.addOrEditTitle = "编辑"; | ||||
|         this.$nextTick(() => { | ||||
|           this.$refs.addOrUpdate.init(val.data.id); | ||||
|         }); | ||||
|       } else if (val.type === "delete") { | ||||
|         this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex) | ||||
|       } else if (val.type === "change") { | ||||
|         this.changeStatus(val.data.id) | ||||
|       } else { | ||||
|         this.otherMethods(val) | ||||
|       } | ||||
|     }, | ||||
|     // 删除 | ||||
|     deleteHandle(id, name, index) { | ||||
|       this.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", { | ||||
|         confirmButtonText: "确定", | ||||
|         cancelButtonText: "取消", | ||||
|         type: "warning", | ||||
|       }) | ||||
|         .then(() => { | ||||
|           this.urlOptions.deleteURL(id).then(({ data }) => { | ||||
|             this.$message({ | ||||
|               message: "操作成功", | ||||
|               type: "success", | ||||
|               duration: 1500, | ||||
|               onClose: () => { | ||||
|                 this.getDataList(); | ||||
|               }, | ||||
|             }); | ||||
|           }); | ||||
|         }) | ||||
|         .catch(() => { }); | ||||
|     }, | ||||
|     //search-bar点击 | ||||
|     buttonClick(val) { | ||||
|       switch (val.btnName) { | ||||
|         case "search": | ||||
|           this.listQuery.xm1 = val.xm1; | ||||
|           this.listQuery.xm2 = val.xm2; | ||||
|           this.listQuery.pageNo = 1; | ||||
|           this.getDataList(); | ||||
|           break; | ||||
|         case "add": | ||||
|           this.addOrEditTitle = '新增' | ||||
|           this.addOrUpdateVisible = true; | ||||
|           this.addOrUpdateHandle() | ||||
|           break; | ||||
|         default: | ||||
|           console.log(val) | ||||
|       } | ||||
|     }, | ||||
|     handleCancel() { | ||||
|       this.$refs.addOrUpdate.formClear() | ||||
|       this.addOrUpdateVisible = false | ||||
|       this.addOrEditTitle = '' | ||||
|     }, | ||||
|     handleConfirm() { | ||||
|       this.$refs.addOrUpdate.dataFormSubmit() | ||||
|     }, | ||||
|     successSubmit() { | ||||
|       this.handleCancel() | ||||
|       this.getDataList() | ||||
|     }, | ||||
|     /** 导出按钮操作 */ | ||||
|     handleExport() { | ||||
|       // 处理查询参数 | ||||
|       let params = { ...this.queryParams }; | ||||
|       params.pageNo = undefined; | ||||
|       params.pageSize = undefined; | ||||
|       this.$modal.confirm('是否确认导出所有数据项?').then(() => { | ||||
|         this.exportLoading = true; | ||||
|         return this.urlOptions.exportURL(params); | ||||
|       }).then(response => { | ||||
|         this.$download.excel(response, '工厂.xls'); | ||||
|         this.exportLoading = false; | ||||
|       }).catch(() => { }); | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										73
									
								
								src/views/order/mixins/code-filter.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								src/views/order/mixins/code-filter.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
|  | ||||
| /* | ||||
|  * @Date: 2020-12-29 16:49:28 | ||||
|  * @LastEditors: DY | ||||
|  * @LastEditTime: 2023-09-12 11:13:34 | ||||
|  * @FilePath: \basic-admin\src\filters\basicData\index.js | ||||
|  * @Description: | ||||
|  */ | ||||
|  | ||||
| const table = { | ||||
|   lineStatus: { | ||||
|     1: '生产中', | ||||
|     2: '停止', | ||||
|     3: '未知', | ||||
|   }, | ||||
|   reportType: { | ||||
|     1: '日', | ||||
|     2: '周', | ||||
|     3: '月' | ||||
|   }, | ||||
|   pdType: { | ||||
|     1: '原片', | ||||
|     0: '深加工', | ||||
|   }, | ||||
| } | ||||
|  | ||||
| // 日期格式化 | ||||
| export function parseTime(time, pattern) { | ||||
|   if (arguments.length === 0 || !time) { | ||||
|     return null | ||||
|   } | ||||
|   const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' | ||||
|   let date | ||||
|   if (typeof time === 'object') { | ||||
|     date = time | ||||
|   } else { | ||||
|     if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { | ||||
|       time = parseInt(time) | ||||
|     } else if (typeof time === 'string') { | ||||
|       time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),''); | ||||
|     } | ||||
|     if ((typeof time === 'number') && (time.toString().length === 10)) { | ||||
|       time = time * 1000 | ||||
|     } | ||||
|     date = new Date(time) | ||||
|   } | ||||
|   const formatObj = { | ||||
|     y: date.getFullYear(), | ||||
|     m: date.getMonth() + 1, | ||||
|     d: date.getDate(), | ||||
|     h: date.getHours(), | ||||
|     i: date.getMinutes(), | ||||
|     s: date.getSeconds(), | ||||
|     a: date.getDay() | ||||
|   } | ||||
|   const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { | ||||
|     let value = formatObj[key] | ||||
|     // Note: getDay() returns 0 on Sunday | ||||
|     if (key === 'a') { | ||||
|       return ['日', '一', '二', '三', '四', '五', '六'][value] | ||||
|     } | ||||
|     if (result.length > 0 && value < 10) { | ||||
|       value = '0' + value | ||||
|     } | ||||
|     return value || 0 | ||||
|   }) | ||||
|   return time_str | ||||
| } | ||||
| export default function (dictTable) { | ||||
|   return function (val) { | ||||
|     return table?.[dictTable]?.[val] | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user