ezhizao 1 жил өмнө
parent
commit
24bcc33b24

+ 101 - 95
src/api/business/daywork.js

@@ -8,20 +8,28 @@ const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
  * @returns
  * @returns
  */
  */
 export function listDaywork(query) {
 export function listDaywork(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/list',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/list',
+		method: 'get',
+		params: query
+	})
 }
 }
+export function listForOutsource(query) {
+	return request({
+		url: baseUrl + '/business/productionDaywork/listForOutsource',
+		method: 'get',
+		params: query
+	})
+}
+
 // 查询工序管理
 // 查询工序管理
-export function getDayworkProcessList (query) {
-    return request({
-      url: baseUrl + '/business/productionDaywork/getDayworkProcessList',
-      method: 'get',
-      params: query
-    })
-  }
+export function getDayworkProcessList(query) {
+	return request({
+		url: baseUrl + '/business/productionDaywork/getDayworkProcessList',
+		method: 'get',
+		params: query
+	})
+}
 /**
 /**
  * 获取 计划查询的工段列表
  * 获取 计划查询的工段列表
  * @param {*} data
  * @param {*} data
@@ -33,11 +41,11 @@ export function getDayworkProcessList (query) {
  * @returns
  * @returns
  */
  */
 export function getDayworkInfo(query) {
 export function getDayworkInfo(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getDayworkInfo',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getDayworkInfo',
+		method: 'get',
+		params: query
+	})
 }
 }
 /**
 /**
  * 获取 计划查询的工段列表
  * 获取 计划查询的工段列表
@@ -45,11 +53,11 @@ export function getDayworkInfo(query) {
  * @returns
  * @returns
  */
  */
 export function getDeptInfo(query) {
 export function getDeptInfo(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getDeptInfo',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getDeptInfo',
+		method: 'get',
+		params: query
+	})
 }
 }
 /**
 /**
  * 获取 已生产批次 列表
  * 获取 已生产批次 列表
@@ -57,11 +65,11 @@ export function getDeptInfo(query) {
  * @returns
  * @returns
  */
  */
 export function getProducedLot(query) {
 export function getProducedLot(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getProducedLot',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getProducedLot',
+		method: 'get',
+		params: query
+	})
 }
 }
 /**
 /**
  * 获取 报工记录的工段
  * 获取 报工记录的工段
@@ -69,19 +77,19 @@ export function getProducedLot(query) {
  * @returns
  * @returns
  */
  */
 export function getDeptList(query) {
 export function getDeptList(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getDeptList',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getDeptList',
+		method: 'get',
+		params: query
+	})
 }
 }
 
 
 /** 查询批次信息 */
 /** 查询批次信息 */
 export function getDayworkItemProcess(id) {
 export function getDayworkItemProcess(id) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getDayworkItemProcess/' + id,
-        method: 'get',
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getDayworkItemProcess/' + id,
+		method: 'get'
+	})
 }
 }
 
 
 /**
 /**
@@ -90,11 +98,11 @@ export function getDayworkItemProcess(id) {
  * @returns
  * @returns
  */
  */
 export function listDayworkItem(query) {
 export function listDayworkItem(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/listItem',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/listItem',
+		method: 'get',
+		params: query
+	})
 }
 }
 
 
 /**
 /**
@@ -103,11 +111,11 @@ export function listDayworkItem(query) {
  * @returns
  * @returns
  */
  */
 export function checkUseEquipment(data) {
 export function checkUseEquipment(data) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/checkUseEquipment',
-        method: 'post',
-        data: data
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/checkUseEquipment',
+		method: 'post',
+		data: data
+	})
 }
 }
 
 
 /**
 /**
@@ -116,45 +124,43 @@ export function checkUseEquipment(data) {
  * @returns
  * @returns
  */
  */
 export function updateItem(data) {
 export function updateItem(data) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/updateItem',
-        method: 'post',
-        data: data
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/updateItem',
+		method: 'post',
+		data: data
+	})
 }
 }
 
 
-
 /**
 /**
  * 查询是否为首序
  * 查询是否为首序
  */
  */
 export function getIsFirstOrder(dayworkId) {
 export function getIsFirstOrder(dayworkId) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getIsFirstOrder/' + dayworkId,
-        method: 'get',
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getIsFirstOrder/' + dayworkId,
+		method: 'get'
+	})
 }
 }
 
 
-
 /**
 /**
  * 获取报工批次工序列表
  * 获取报工批次工序列表
  * @param {*} data
  * @param {*} data
  * @returns
  * @returns
  */
  */
 export function getProcessList(query) {
 export function getProcessList(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getProcessList',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getProcessList',
+		method: 'get',
+		params: query
+	})
 }
 }
 
 
 // 查询工段资源组能够选择的设备
 // 查询工段资源组能够选择的设备
 export function getEquipmentInfo(query) {
 export function getEquipmentInfo(query) {
-    return request({
-        url: baseUrl + '/business/detail/equipmentInfo',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/detail/equipmentInfo',
+		method: 'get',
+		params: query
+	})
 }
 }
 
 
 /**
 /**
@@ -163,11 +169,11 @@ export function getEquipmentInfo(query) {
  * @returns
  * @returns
  */
  */
 export function getDayworkItemRejectList(query) {
 export function getDayworkItemRejectList(query) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/getDayworkItemRejectList',
-        method: 'get',
-        params: query
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/getDayworkItemRejectList',
+		method: 'get',
+		params: query
+	})
 }
 }
 
 
 /**
 /**
@@ -176,39 +182,39 @@ export function getDayworkItemRejectList(query) {
  * @returns
  * @returns
  */
  */
 export function updateDayworkItemInfo(data) {
 export function updateDayworkItemInfo(data) {
-    return request({
-        url: baseUrl + '/business/productionDaywork/updateDayworkItemInfo',
-        method: 'post',
-        data: data
-    })
+	return request({
+		url: baseUrl + '/business/productionDaywork/updateDayworkItemInfo',
+		method: 'post',
+		data: data
+	})
 }
 }
 
 
 export function addDaywork(data) {
 export function addDaywork(data) {
-    return request({
-        url: baseUrl + '/business/daywork',
-        method: 'post',
-        data: data
-    })
+	return request({
+		url: baseUrl + '/business/daywork',
+		method: 'post',
+		data: data
+	})
 }
 }
 
 
 export function getDaywork(id) {
 export function getDaywork(id) {
-    return request({
-        url: baseUrl + '/business/daywork/' + id,
-        method: 'get'
-    })
+	return request({
+		url: baseUrl + '/business/daywork/' + id,
+		method: 'get'
+	})
 }
 }
 
 
 export function updateDaywork(data) {
 export function updateDaywork(data) {
-    return request({
-        url: baseUrl + '/business/daywork',
-        method: 'put',
-        data: data
-    })
+	return request({
+		url: baseUrl + '/business/daywork',
+		method: 'put',
+		data: data
+	})
 }
 }
 
 
 export function delDaywork(id) {
 export function delDaywork(id) {
-    return request({
-        url: baseUrl + '/business/daywork/' + id,
-        method: 'delete'
-    })
+	return request({
+		url: baseUrl + '/business/daywork/' + id,
+		method: 'delete'
+	})
 }
 }

+ 18 - 9
src/views/business/outsource/DialogProducts.vue

@@ -1,9 +1,9 @@
 <template>
 <template>
 	<el-dialog title="添加产品" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
 	<el-dialog title="添加产品" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
 		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
 		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
-			<el-form-item label="产品描述:" prop="description" label-width="104">
+			<el-form-item label="产品描述:" prop="productDescription" label-width="104">
 				<el-input
 				<el-input
-					v-model.trim="queryParams.description"
+					v-model.trim="queryParams.productDescription"
 					type="text"
 					type="text"
 					@keydown.enter.prevent
 					@keydown.enter.prevent
 					style="width: 160px"
 					style="width: 160px"
@@ -12,7 +12,11 @@
 					@keyup.enter="handleSearch"
 					@keyup.enter="handleSearch"
 				/>
 				/>
 			</el-form-item>
 			</el-form-item>
-			<el-form-item v-if="supplierId !== '' && supplierId !== '0'" label="只看外协商配置的产品:" prop="description">
+			<el-form-item
+				v-if="supplierId !== '' && supplierId !== '0'"
+				label="只看外协商配置的产品:"
+				prop="isSupplierProducts"
+			>
 				<el-switch
 				<el-switch
 					v-model="queryParams.isSupplierProducts"
 					v-model="queryParams.isSupplierProducts"
 					active-text="是"
 					active-text="是"
@@ -37,8 +41,10 @@
 		>
 		>
 			<el-table-column type="selection" width="40" align="center" />
 			<el-table-column type="selection" width="40" align="center" />
 			<el-table-column type="index" label="行号" width="50" align="center" />
 			<el-table-column type="index" label="行号" width="50" align="center" />
-			<el-table-column label="料号" align="center" prop="productCode" width="120" />
-			<el-table-column label="产品描述" align="center" prop="description" />
+			<el-table-column label="批次号" align="center" prop="lotCode" width="96" />
+			<el-table-column label="料号" align="center" prop="productCode" width="96" />
+			<el-table-column label="产品描述" align="center" prop="productDescription" />
+			<el-table-column label="箱号" align="center" prop="originalCarrier" width="220" />
 		</el-table>
 		</el-table>
 		<!-- 分页 -->
 		<!-- 分页 -->
 		<pagination
 		<pagination
@@ -59,7 +65,7 @@
 	</el-dialog>
 	</el-dialog>
 </template>
 </template>
 <script setup>
 <script setup>
-import { getProductsForOutsource } from '@/api/business/product'
+import { listForOutsource } from '@/api/business/daywork'
 const { proxy } = getCurrentInstance()
 const { proxy } = getCurrentInstance()
 /** 字典数组区 */
 /** 字典数组区 */
 const { process_status } = proxy.useDict('process_status')
 const { process_status } = proxy.useDict('process_status')
@@ -81,10 +87,12 @@ const productList = ref([])
 const visible = ref(false)
 const visible = ref(false)
 const loading = ref(false)
 const loading = ref(false)
 const queryParams = ref({
 const queryParams = ref({
+	existingDayworkIds: [],
+	deptCode: '170000',
 	// 是否看所有产品【0:看全部产品,1:只看该外协商配置的产品】
 	// 是否看所有产品【0:看全部产品,1:只看该外协商配置的产品】
 	isSupplierProducts: 0,
 	isSupplierProducts: 0,
 	supplierId: '',
 	supplierId: '',
-	description: '',
+	productDescription: '',
 	pageNum: 1,
 	pageNum: 1,
 	pageSize: 10
 	pageSize: 10
 })
 })
@@ -93,8 +101,9 @@ const selections = ref([])
 /**
 /**
  * 对话框打开 事件
  * 对话框打开 事件
  */
  */
-function open() {
+function open(existingDayworkIds) {
 	visible.value = true
 	visible.value = true
+	queryParams.value.existingDayworkIds = existingDayworkIds
 	getList()
 	getList()
 }
 }
 
 
@@ -114,7 +123,7 @@ function close() {
 function getList() {
 function getList() {
 	loading.value = true
 	loading.value = true
 	queryParams.value.supplierId = props.supplierId
 	queryParams.value.supplierId = props.supplierId
-	getProductsForOutsource(queryParams.value).then((res) => {
+	listForOutsource(queryParams.value).then((res) => {
 		productList.value = res.rows
 		productList.value = res.rows
 		total.value = res.total
 		total.value = res.total
 		loading.value = false
 		loading.value = false

+ 66 - 32
src/views/business/outsource/form.vue

@@ -111,49 +111,63 @@
 			</div>
 			</div>
 			<div class="el-table-container">
 			<div class="el-table-container">
 				<div class="el-table-inner-container">
 				<div class="el-table-inner-container">
-					<el-table v-loading="loading" :data="formatDetails" size="small" border height="100%">
-						<el-table-column label="批次号" align="center" prop="lotCode" width="120" />
-						<el-table-column label="产品描述" align="center" prop="supplierName" width="320" />
+					<el-table v-loading="loading" :data="form.details" size="small" border height="100%">
+						<el-table-column label="行号" type="index" align="center" width="48" />
+						<el-table-column label="批次号" align="center" prop="lotCode" width="104" />
+						<el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
 						<el-table-column
 						<el-table-column
-							:label="form.packagingMethod === 0 ? '箱号' : '原箱号'"
+							:label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
 							align="center"
 							align="center"
-							prop="original_carrier"
+							prop="originalCarrier"
 							width="320"
 							width="320"
 						/>
 						/>
 						<el-table-column
 						<el-table-column
-							v-if="form.packagingMethod === 1"
+							v-if="form.packagingMethod === '1'"
 							label="新箱号"
 							label="新箱号"
 							align="center"
 							align="center"
 							prop="new_carrier"
 							prop="new_carrier"
 							width="320"
 							width="320"
 						>
 						>
 							<template #default="scope">
 							<template #default="scope">
-								<el-input v-if="editStatus" v-model="scope.row.originalCarrier" readonly placeholder="请选择新箱号">
+								<el-input v-if="editStatus" v-model="scope.row.newCarrier" readonly placeholder="请选择新箱号">
 									<template #append>
 									<template #append>
 										<el-button icon="Search" @click="handleShowDialogOutsourceCarriers" />
 										<el-button icon="Search" @click="handleShowDialogOutsourceCarriers" />
 									</template>
 									</template>
 								</el-input>
 								</el-input>
-								<span v-else>{{ scope.row.originalCarrier }}</span>
+								<span v-else>{{ scope.row.newCarrier }}</span>
+							</template>
+						</el-table-column>
+						<el-table-column label="外协工序" align="center" prop="new_carrier" width="320">
+							<template #default="scope">
+								<el-input v-if="editStatus" v-model="scope.row.processNames" readonly placeholder="请选择工序">
+									<template #append>
+										<el-button icon="Search" @click="handleShowDialogProcess(scope.row)" />
+									</template>
+								</el-input>
+								<span v-else>{{ scope.row.processNames }}</span>
+							</template>
+						</el-table-column>
+						<el-table-column label="备注" align="center" prop="remark">
+							<template #default="scope">
+								<el-input v-if="editStatus" v-model="scope.row.remark" placeholder="备注" />
+								<span v-else>{{ scope.row.processNames }}</span>
 							</template>
 							</template>
 						</el-table-column>
 						</el-table-column>
-						<el-table-column label="备注" align="center" prop="remark" />
 						<el-table-column
 						<el-table-column
 							v-if="editStatus"
 							v-if="editStatus"
 							label="操作"
 							label="操作"
 							align="center"
 							align="center"
 							class-name="small-padding fixed-width"
 							class-name="small-padding fixed-width"
-							width="144"
+							width="64"
 						>
 						>
 							<template #default="scope">
 							<template #default="scope">
 								<el-button
 								<el-button
-									link
+									circle
 									type="danger"
 									type="danger"
 									icon="Delete"
 									icon="Delete"
-									@click="handleDelete(scope.row)"
+									@click="handleDelete(scope.$index)"
 									v-hasPermi="['business:outsource:remove']"
 									v-hasPermi="['business:outsource:remove']"
-								>
-									删除
-								</el-button>
+								/>
 							</template>
 							</template>
 						</el-table-column>
 						</el-table-column>
 					</el-table>
 					</el-table>
@@ -201,25 +215,11 @@ const editStatus = ref(false)
 const isFullscreen = ref(false)
 const isFullscreen = ref(false)
 const webHost = import.meta.env.VITE_APP_BASE_API
 const webHost = import.meta.env.VITE_APP_BASE_API
 const form = ref({})
 const form = ref({})
-const formatDetails = ref([])
+// const formatDetails = ref([])
 const currentDetail = ref({})
 const currentDetail = ref({})
 const rules = {
 const rules = {
 	supplierName: [{ required: true, message: '外协商名称不能为空', trigger: 'blur' }]
 	supplierName: [{ required: true, message: '外协商名称不能为空', trigger: 'blur' }]
 }
 }
-const emptyDetail = ref({
-	id: null,
-	lotId: null,
-	dayworkId: null,
-	productId: null,
-	productDescription: null,
-	technologicalProcessId: null,
-	technologyVersion: null,
-	originalCarrier: null,
-	originalCarrierCount: null,
-	newCarrier: null,
-	newCarrierCount: null,
-	remark: null
-})
 
 
 /***********************  方法区  ****************************/
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 /** 打开抽屉 */
@@ -252,6 +252,10 @@ function cancel() {
 	reset()
 	reset()
 }
 }
 
 
+const handleDelete = (index) => {
+	form.value.details.splice(index, 1)
+}
+
 /** 表单重置 */
 /** 表单重置 */
 function reset() {
 function reset() {
 	form.value = {
 	form.value = {
@@ -304,12 +308,31 @@ const handleSingleSelectedSupplier = (data) => {
 /***************************** 产品对话框相关 *****************************/
 /***************************** 产品对话框相关 *****************************/
 // 打开产品选择对话框
 // 打开产品选择对话框
 const handleShowDialogProducts = () => {
 const handleShowDialogProducts = () => {
-	proxy.$refs.dialogProductsRef.open()
+	const dayworkIds = form.value.details.map((item) => item.dayworkId)
+	console.log(dayworkIds)
+	proxy.$refs.dialogProductsRef.open(dayworkIds)
 }
 }
 // 产品选择带回
 // 产品选择带回
 const handleMultipleSelectedProducts = (selection) => {
 const handleMultipleSelectedProducts = (selection) => {
+	console.log(selection)
 	selection.forEach((item) => {
 	selection.forEach((item) => {
-		const newDetail = {}
+		const newDetail = {
+			lotId: item.lotId,
+			lotCode: item.lotCode,
+			dayworkId: item.id,
+			productId: item.productId,
+			productDescription: item.productDescription,
+			technologicalProcessId: item.technologicalProcessId,
+			technologyVersion: item.technologyVersion,
+			originalCarrier: item.originalCarrier,
+			originalCarrierCount: item.originalCarrier.split(',').length,
+			newCarrier: '',
+			newCarrierCount: 0,
+			processNames: '',
+			remark: item.remark,
+			processes: []
+		}
+		console.log(newDetail)
 		form.value.details.push(newDetail)
 		form.value.details.push(newDetail)
 	})
 	})
 }
 }
@@ -325,6 +348,17 @@ const handleMultipleSelectedOutsourceCarriers = (selection) => {
 	})
 	})
 }
 }
 
 
+/***************************** 外协工序对话框相关 *****************************/
+// 打开外协工序选择对话框
+const handleShowDialogProcess = () => {}
+// 工序选择带回
+const handleMultipleSelectedProcesses = (selection) => {
+	selection.forEach((item) => {
+		const newDetail = {}
+		form.value.details.push(newDetail)
+	})
+}
+
 /** 暴露给父组件的方法 */
 /** 暴露给父组件的方法 */
 defineExpose({
 defineExpose({
 	open
 	open