Przeglądaj źródła

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

ezhizao_zx 1 rok temu
rodzic
commit
d8825915d6

+ 163 - 0
src/views/business/outsource/DialogProcesses.vue

@@ -0,0 +1,163 @@
+<template>
+	<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-item label="工序名称:" prop="processAlias" label-width="104">
+				<el-input
+					v-model.trim="queryParams.productDescription"
+					type="text"
+					@keydown.enter.prevent
+					style="width: 160px"
+					placeholder="请输入关键字"
+					:clearable="true"
+					@keyup.enter="handleSearch"
+				/>
+			</el-form-item>
+			<el-form-item label-width="20px">
+				<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+			</el-form-item>
+		</el-form>
+
+		<el-table
+			ref="dialogTable"
+			:data="productList"
+			size="small"
+			v-loading="loading"
+			border
+			height="370px"
+			@selection-change="handleSelectionChange"
+		>
+			<el-table-column type="selection" width="40" align="center" />
+			<el-table-column label="序号" width="56" align="center" prop="processStepNumber" />
+			<el-table-column label="工序名称" align="center" prop="lotCode" width="96" />
+		</el-table>
+		<!-- 分页 -->
+		<pagination
+			v-show="total > 0"
+			:total="total"
+			v-model:page="queryParams.pageNum"
+			v-model:limit="queryParams.pageSize"
+			@pagination="getList"
+		/>
+		<template #footer>
+			<div class="dialog-footer">
+				<el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">
+					确 定
+				</el-button>
+				<el-button type="danger" icon="Close" @click="close">取 消</el-button>
+			</div>
+		</template>
+	</el-dialog>
+</template>
+<script setup>
+/**
+ * 需要多选,确定后带回至发货明细中,并且会组合成一个英文逗号分割的字符串
+ * 逻辑
+ * 0、数据来源:根据当前明细对应的daywork_id,找到这个daywork尚未完成的工序。
+ * 		思路:
+ * 		1)先找到这个daywork对应的daywork_item,查找status >= 4,并且是外协的那一条记录
+ * 		2)这条记录中,记录了process_id,这个工序就是外协之前完成的工序,需要到当前daywork对应的标准工艺中查询所有工序
+ *    3)将未完成的工序找出来,可以根据process_id对应的工序的【工序序号】,比这个序号大的,就是未完成的工序。
+ * 		4)这里要注意的是:废品回用、单批单改的工艺,不是标准工艺,要从另外一个表中获得。需要将工序查询分在2个私有方法中实现。避免混淆。
+ *
+ * 1、发货明细每条都对应一个从表,记录该外协产品需要外协的工序,这个从表是不在前端展示的,但要保存到数据库中
+ * 2、选择的工序,在对应的发货明细中,以英文逗号分割的形式存储在当前明细的processNames字段中,
+ *    在form页面中的ref=【dialogProcessesRef】的对话框:multiple-selected="handleMultipleSelectedProcesses"
+ *    中查看
+ * 3、后端 BizOutsourcedOrderController,要保存的数据:
+ * 	 【biz_outsourced_order】
+ *   【biz_outsourced_order_detail】
+ *   【biz_outsourced_order_detail_process】
+ * 4、外协单做完后,需要做外协报工,这个部分的功能是给外协商使用,是一个新的前端工程,需要用到的数据:
+ * 	 【biz_outsourced_order】
+ *   【biz_outsourced_order_detail】
+ *   【biz_outsourced_order_detail_process】
+ * 		外协商要看到,是什么产品,什么工序,多少数量
+ */
+import { listForOutsource } from '@/api/business/daywork'
+const { proxy } = getCurrentInstance()
+/** 字典数组区 */
+const { process_status } = proxy.useDict('process_status')
+/** 工序变量 */
+const total = ref(0)
+const props = defineProps({
+	multipleSelected: {
+		type: Function,
+		default: null
+	},
+	supplierId: {
+		type: String,
+		default: ''
+	}
+})
+
+const { multipleSelected, supplierId } = toRefs(props)
+const productList = ref([])
+const visible = ref(false)
+const loading = ref(false)
+const queryParams = ref({
+	existingDayworkIds: [],
+	deptCode: '170000',
+	// 是否看所有产品【0:看全部产品,1:只看该外协商配置的产品】
+	isSupplierProducts: 0,
+	supplierId: '',
+	productDescription: '',
+	pageNum: 1,
+	pageSize: 10
+})
+const selections = ref([])
+
+/**
+ * 对话框打开 事件
+ */
+function open(existingDayworkIds) {
+	visible.value = true
+	queryParams.value.existingDayworkIds = existingDayworkIds
+	getList()
+}
+
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+	proxy.$refs.dialogForm.resetFields()
+	proxy.$refs.dialogTable.clearSelection()
+	queryParams.value.pageNum = 1
+	visible.value = false
+}
+
+/**
+ * 加载数据
+ */
+function getList() {
+	loading.value = true
+	queryParams.value.supplierId = props.supplierId
+	listForOutsource(queryParams.value).then((res) => {
+		productList.value = res.rows
+		total.value = res.total
+		loading.value = false
+	})
+}
+
+/**
+ * 列表checkbox列选择 事件
+ */
+function handleSelectionChange(selection) {
+	selections.value = selection
+}
+
+/**  搜索 事件 */
+function handleSearch() {
+	getList()
+}
+/** 多选事件 */
+function handleMultipleSelected() {
+	if (multipleSelected.value) {
+		multipleSelected.value(selections.value)
+	}
+	close()
+}
+
+defineExpose({
+	open
+})
+</script>

+ 18 - 5
src/views/business/outsource/form.vue

@@ -141,7 +141,7 @@
 							<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)" />
+										<el-button icon="Search" @click="handleShowDialogProcesses(scope.row)" />
 									</template>
 								</el-input>
 								<span v-else>{{ scope.row.processNames }}</span>
@@ -182,12 +182,15 @@
 			:supplier-id="form.supplierId"
 			:multiple-selected="handleMultipleSelectedProducts"
 		/>
+		<!-- 工序选择 -->
+		<dialog-processes ref="dialogProcessesRef" :multiple-selected="handleMultipleSelectedProcesses" />
 	</el-drawer>
 </template>
 <script setup>
 import { getOrder, addOrder, updateOrder } from '@/api/business/outsourcedOrder'
 import dialogSuppliers from './DialogSuppliers'
 import dialogProducts from './DialogProducts'
+import dialogProcesses from './DialogProcesses'
 const { proxy } = getCurrentInstance()
 /** 父组件传参 */
 const props = defineProps({
@@ -301,8 +304,10 @@ const handleShowDialogSuppliers = () => {
 }
 // 外协商选择带回
 const handleSingleSelectedSupplier = (data) => {
+	console.log(data)
 	form.value.supplierId = data.id
 	form.value.supplierName = data.name
+	form.value.deliveryMethod = data.deliveryMethod.toString()
 }
 
 /***************************** 产品对话框相关 *****************************/
@@ -314,7 +319,6 @@ const handleShowDialogProducts = () => {
 }
 // 产品选择带回
 const handleMultipleSelectedProducts = (selection) => {
-	console.log(selection)
 	selection.forEach((item) => {
 		const newDetail = {
 			lotId: item.lotId,
@@ -350,12 +354,21 @@ const handleMultipleSelectedOutsourceCarriers = (selection) => {
 
 /***************************** 外协工序对话框相关 *****************************/
 // 打开外协工序选择对话框
-const handleShowDialogProcess = () => {}
+const handleShowDialogProcesses = (row) => {
+	currentDetail.value = row
+	proxy.$refs.dialogProcessesRef.open()
+}
 // 工序选择带回
 const handleMultipleSelectedProcesses = (selection) => {
+	const processNames = selection.map((item) => item.processAlias)
+	currentDetail.value.processNames = processNames
 	selection.forEach((item) => {
-		const newDetail = {}
-		form.value.details.push(newDetail)
+		const newProcess = {
+			processId: item.processId,
+			processAlias: item.processAlias,
+			processStepNumber: item.processStepNumber
+		}
+		currentDetail.value.processes.push(newProcess)
 	})
 }
 

+ 3 - 10
src/views/business/outsource/index.vue

@@ -52,15 +52,6 @@
 			<el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['business:outsource:add']">
 				新增
 			</el-button>
-			<el-button
-				type="success"
-				icon="Edit"
-				:disabled="single"
-				@click="handleUpdate"
-				v-hasPermi="['business:outsource:edit']"
-			>
-				修改
-			</el-button>
 			<el-button
 				type="danger"
 				icon="Delete"
@@ -70,10 +61,12 @@
 			>
 				删除
 			</el-button>
+			<!--
 			<el-button type="warning" icon="Download" @click="handleExport" v-hasPermi="['business:outsource:export']">
 				导出
 			</el-button>
-			<!--<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>-->
+			<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+			-->
 		</div>
 
 		<!-- 渲染数据区 -->

+ 1 - 1
src/views/business/supplier/form.vue

@@ -76,7 +76,7 @@ function reset() {
 		id: null,
 		mnemonicCode: '',
 		deliveryMethod: '',
-		lossLimit: '',
+		lossLimit: 0.0,
 		remark: ''
 	}
 	proxy.resetForm('formRef')