Quellcode durchsuchen

添加收回审核

ezhizao vor 1 Jahr
Ursprung
Commit
103fafa314

+ 46 - 0
src/api/business/returnReceipt.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+
+// 查询收回单
+export function listReceipt(query) {
+	return request({
+		url: baseUrl + '/business/returnReceipt/list',
+		method: 'get',
+		params: query
+	})
+}
+
+// 查询收回单
+export function getReceipt(id) {
+	return request({
+		url: baseUrl + '/business/returnReceipt/' + id,
+		method: 'get'
+	})
+}
+
+// 新增收回单
+export function addReceipt(data) {
+	return request({
+		url: baseUrl + '/business/outsource',
+		method: 'post',
+		data: data
+	})
+}
+
+// 修改收回单
+export function updateReceipt(data) {
+	return request({
+		url: baseUrl + '/business/outsource',
+		method: 'put',
+		data: data
+	})
+}
+
+// 删除收回单
+export function delReceipt(id) {
+	return request({
+		url: baseUrl + '/business/returnReceipt/' + id,
+		method: 'delete'
+	})
+}

+ 20 - 0
src/api/business/returnReceiptDetail.js

@@ -0,0 +1,20 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+
+// 查询外协单从列表
+export function listDetail(query) {
+	return request({
+		url: baseUrl + '/business/returnReceiptDetail/list',
+		method: 'get',
+		params: query
+	})
+}
+
+// 查询外协单从详细
+export function getDetail(id) {
+	return request({
+		url: baseUrl + '/business/returnReceiptDetail/' + id,
+		method: 'get'
+	})
+}

+ 138 - 0
src/views/business/returnReceipt/DialogOutsourceDetails.vue

@@ -0,0 +1,138 @@
+<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="productDescription" 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="dataList"
+			size="small"
+			v-loading="loading"
+			border
+			height="370px"
+			@selection-change="handleSelectionChange"
+		>
+			<el-table-column type="selection" width="40" align="center" />
+			<el-table-column type="index" label="行号" width="50" align="center" />
+			<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>
+		<!-- 分页 -->
+		<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>
+import { listDetailForReceipt } from '@/api/business/outsourcedOrderDetail'
+const { proxy } = getCurrentInstance()
+const total = ref(0)
+const props = defineProps({
+	multipleSelected: {
+		type: Function,
+		default: null
+	}
+})
+
+const { multipleSelected } = toRefs(props)
+const dataList = ref([])
+const visible = ref(false)
+const loading = ref(false)
+const queryParams = ref({
+	existingOutsourceDetailIds: [],
+	productDescription: '',
+	pageNum: 1,
+	pageSize: 10
+})
+const selections = ref([])
+
+/**
+ * 对话框打开 事件
+ */
+function open(existingOutsourceDetailIds) {
+	visible.value = true
+	queryParams.value.existingOutsourceDetailIds = existingOutsourceDetailIds
+	getList()
+}
+
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+	proxy.$refs.dialogForm.resetFields()
+	proxy.$refs.dialogTable.clearSelection()
+	queryParams.value.pageNum = 1
+	visible.value = false
+}
+
+/**
+ * 加载数据
+ */
+function getList() {
+	loading.value = true
+	listDetailForReceipt(queryParams.value).then((res) => {
+		dataList.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>

+ 132 - 0
src/views/business/returnReceipt/DialogSuppliers.vue

@@ -0,0 +1,132 @@
+<template>
+	<el-dialog title="选择外协商" v-model="visible" width="600px" height="400px" @close="close" append-to-body draggable>
+		<el-form ref="dialogForm" class="master-container" :model="queryParams" :inline="true" style="align-items: center">
+			<div style="display: flex">
+				<el-form-item label="外协商名称:" prop="name">
+					<el-input
+						v-model.trim="queryParams.name"
+						type="text"
+						@keydown.enter.prevent
+						style="width: 120px"
+						placeholder="请输入关键字"
+						:clearable="true"
+						@keyup.enter="handleSearch"
+					/>
+				</el-form-item>
+				<el-form-item label="助记码:" prop="name">
+					<el-input
+						v-model.trim="queryParams.mnemonicCode"
+						type="text"
+						@keydown.enter.prevent
+						style="width: 120px"
+						placeholder="请输入关键字"
+						:clearable="true"
+						@keyup.enter="handleSearch"
+					/>
+				</el-form-item>
+				<el-form-item>
+					<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+				</el-form-item>
+			</div>
+		</el-form>
+
+		<el-table ref="dialogTable" :data="dataList" size="small" v-loading="loading" border height="370px">
+			<el-table-column type="index" label="行号" width="50" align="center" />
+			<el-table-column label="外协商名称" align="center" prop="name" />
+			<el-table-column label="助记码" align="center" prop="mnemonicCode" width="120" />
+			<el-table-column label="操作" width="64" align="center">
+				<template #default="scope">
+					<el-button type="success" icon="finished" circle @click="handleSingleSelected(scope.row)" />
+				</template>
+			</el-table-column>
+		</el-table>
+		<!-- 分页 -->
+		<pagination
+			v-show="total > 0"
+			:total="total"
+			v-model:page="queryParams.pageNum"
+			v-model:limit="queryParams.pageSize"
+			@pagination="getList"
+		/>
+	</el-dialog>
+</template>
+<script setup>
+import { list } from '@/api/business/supplier'
+const { proxy } = getCurrentInstance()
+/** 字典数组区 */
+const { process_status } = proxy.useDict('process_status')
+/** 工序变量 */
+const total = ref(0)
+const props = defineProps({
+	singleSelected: {
+		type: Function,
+		default: null
+	}
+})
+
+const { singleSelected } = toRefs(props)
+const dataList = ref([])
+const visible = ref(false)
+const loading = ref(false)
+const queryParams = ref({
+	name: '',
+	pageNum: 1,
+	pageSize: 10
+})
+const selections = ref([])
+
+/**
+ * 对话框打开 事件
+ */
+function open() {
+	visible.value = true
+	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
+	list(queryParams.value).then((res) => {
+		dataList.value = res.rows
+		total.value = res.total
+		loading.value = false
+	})
+}
+
+/**
+ * 列表checkbox列选择 事件
+ */
+function handleSelectionChange(selection) {
+	selections.value = selection
+}
+
+/**  搜索 事件 */
+function handleSearch() {
+	getList()
+}
+
+/** 单选事件 */
+function handleSingleSelected(row) {
+	if (singleSelected.value) {
+		singleSelected.value(row)
+	}
+	close()
+}
+
+defineExpose({
+	open
+})
+</script>

+ 199 - 0
src/views/business/returnReceipt/form.vue

@@ -0,0 +1,199 @@
+<template>
+	<el-drawer title="外协单信息" :with-header="false" v-model="visible" direction="rtl" size="100%">
+		<div class="form-container column-container">
+			<div class="form-btns-container">
+				<span class="title-label">
+					<el-icon><Document /></el-icon>
+					<span>收回单信息</span>
+				</span>
+				<el-button-group>
+					<el-button v-if="editStatus" type="primary" icon="Finished" @click="submitForm"> 保存 </el-button>
+					<el-button v-else type="warning" icon="Edit" @click="editStatus = true">编辑</el-button>
+					<el-button v-if="form.id && editStatus" type="info" icon="Close" @click="editStatus = false">
+						取消编辑
+					</el-button>
+					<el-button v-if="form.id" type="success" @click="getForm">
+						<i class="fa fa-refresh" aria-hidden="true" /> 刷新
+					</el-button>
+				</el-button-group>
+
+				<div class="close-btn" @click="cancel">
+					<i class="fa fa-times" aria-hidden="true" />
+					<!-- <span>关闭</span> -->
+				</div>
+			</div>
+			<el-form ref="formRef" class="master-container" :model="form" v-loading="loading" label-width="120px">
+				<el-row :gutter="20">
+					<el-col :span="6">
+						<el-form-item label="单据号" prop="formCode">
+							<el-input v-model="form.formCode" readonly />
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="表单日期" prop="formDate">
+							<el-date-picker v-model="form.formDate" type="date" value-format="YYYY-MM-DD" style="width: 100%">
+							</el-date-picker>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="外协商名称" prop="supplierName">
+							<el-input v-if="editStatus" v-model="form.supplierName" readonly placeholder="请输入外协商名称">
+								<template #append>
+									<el-button icon="Search" @click="handleShowDialogSuppliers" />
+								</template>
+							</el-input>
+							<span v-else>{{ form.supplierName }}</span>
+						</el-form-item>
+					</el-col>
+					<el-col :span="6">
+						<el-form-item label="备注" prop="remark">
+							<el-input v-model="form.remark" readonly />
+						</el-form-item>
+					</el-col>
+				</el-row>
+			</el-form>
+			<!-- 渲染数据区 -->
+			<div class="form-details-btns-container">
+				<el-button type="primary" icon="Plus" @click="handleShowDialogOutSourceDetails"> 添加收回明细 </el-button>
+			</div>
+			<div class="el-table-container">
+				<div class="el-table-inner-container">
+					<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 label="产品数量" align="center" prop="productNum" width="96" />
+						<el-table-column
+							:label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
+							align="center"
+							prop="originalCarrier"
+							width="320"
+						/>
+						<el-table-column
+							v-if="form.packagingMethod === '1'"
+							label="新箱号"
+							align="center"
+							prop="newCarrier"
+							width="320"
+						/>
+						<el-table-column label="外协工序" align="center" prop="processNames" width="320" />
+						<el-table-column label="收回数量" align="center" prop="receiptNum" width="104">
+							<template #default="scope">
+								<el-input-number
+									v-model="scope.row.receiptNum"
+									:min="0"
+									controls-position="right"
+									style="text-align: center"
+								/>
+							</template>
+						</el-table-column>
+						<el-table-column label="备注" align="center" prop="remark">
+							<template #default="scope">
+								<el-input v-model="scope.row.remark" />
+							</template>
+						</el-table-column>
+					</el-table>
+				</div>
+			</div>
+		</div>
+
+		<!-- 外协商选择 -->
+		<dialog-outsource-details
+			ref="dialogOutsourceDetailsRef"
+			:multiple-selected="handleMultipleSelectedOutsourceDetails"
+		/>
+	</el-drawer>
+</template>
+<script setup>
+import { getReceipt, addReceipt, updateReceipt } from '@/api/business/returnReceipt'
+import dialogOutsourceDetails from './DialogOutsourceDetails'
+const { proxy } = getCurrentInstance()
+/** 表单抽屉 页变量 */
+const loading = ref(false)
+const visible = ref(false)
+const editStatus = ref(false)
+const webHost = import.meta.env.VITE_APP_BASE_API
+const form = ref({})
+
+/****************************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (id) => {
+	reset()
+	visible.value = true
+	if (id) {
+		loading.value = true
+		getReceipt(id).then((response) => {
+			form.value = response.data
+			loading.value = false
+		})
+	} else {
+		editStatus.value = true
+	}
+}
+
+/** 取消按钮 */
+const cancel = () => {
+	visible.value = false
+	reset()
+}
+
+/** 表单重置 */
+const reset = () => {
+	form.value = {
+		id: null,
+		formCode: '',
+		formDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
+		supplierId: '0',
+		supplierName: '',
+		remark: '',
+		details: []
+	}
+	proxy.resetForm('formRef')
+}
+/***************************** 外协明细对话框相关 *****************************/
+// 打开外协明细选择对话框
+const handleShowDialogOutSourceDetails = () => {
+	const outsourceDetailIds = form.value.details.map((item) => item.outsourceDetailId)
+	proxy.$refs.dialogOutsourceDetailsRef.open(outsourceDetailIds)
+}
+// 外协明细选择带回
+const handleMultipleSelectedOutsourceDetails = (selection) => {
+	selection.forEach((item) => {
+		const newDetail = {
+			outsourceDetailId: item.id,
+			productDescription: item.productDescription,
+			productNum: item.productNum,
+			receiptNum: 0,
+			processNames: item.processNames,
+			remark: ''
+		}
+		form.value.details.push(newDetail)
+	})
+}
+
+/** 提交按钮 */
+function submitForm() {
+	proxy.$refs['formRef'].validate((valid) => {
+		if (valid) {
+			if (form.value.id != null) {
+				updateReceipt(form.value).then((response) => {
+					proxy.$modal.msgSuccess('修改成功')
+					visible.value = false
+					getList.value()
+				})
+			} else {
+				addReceipt(form.value).then((response) => {
+					proxy.$modal.msgSuccess('新增成功')
+					visible.value = false
+					getList.value()
+				})
+			}
+		}
+	})
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+	open
+})
+</script>

+ 154 - 0
src/views/business/returnReceipt/index.vue

@@ -0,0 +1,154 @@
+<template>
+	<div class="page-container column-container">
+		<!-- 搜索区 -->
+		<el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true" style="margin-right: 0px">
+			<el-form-item label="单据号:" prop="formCode">
+				<el-input
+					v-model="queryParams.formCode"
+					placeholder="请输入单据号"
+					style="width: 144px"
+					clearable
+					@keyup.enter="handleQuery"
+				/>
+			</el-form-item>
+			<el-form-item label="表单日期:" prop="formDate">
+				<el-date-picker
+					v-model="queryParams.formStartDate"
+					type="date"
+					style="width: 144px"
+					value-format="YYYY-MM-DD"
+					placeholder="选择起始日期"
+					clearable
+				/>
+				<span style="margin: 0 4px">~</span>
+				<el-date-picker
+					v-model="queryParams.formEndDate"
+					type="date"
+					style="width: 144px"
+					value-format="YYYY-MM-DD"
+					placeholder="选择结束日期"
+					clearable
+				/>
+			</el-form-item>
+			<el-form-item>
+				<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+				<el-button icon="Refresh" @click="resetQuery">重置</el-button>
+			</el-form-item>
+		</el-form>
+
+		<!-- 功能按钮区 -->
+		<div class="list-btns-container">
+			<el-button type="primary" icon="Plus" @click="handleShowFormDialog(null)"> 新增 </el-button>
+			<el-button type="danger" icon="Delete" :disabled="multiple" @click="handleDelete"> 删除 </el-button>
+		</div>
+		<!-- 渲染数据区 -->
+		<div class="el-table-container">
+			<div class="el-table-inner-container">
+				<el-table v-loading="loading" :data="dataList" size="small" border height="100%">
+					<el-table-column type="selection" width="48" align="center" />
+					<el-table-column label="收回单号" align="center" prop="formCode" width="120" />
+					<el-table-column label="外协商" align="center" prop="supplierName" width="240" />
+					<el-table-column label="收回日期" align="center" prop="formDate" width="120">
+						<template #default="scope">
+							{{ parseTime(scope.row.formDate, '{y}-{m}-{d}') }}
+						</template>
+					</el-table-column>
+					<el-table-column label="备注" align="center" prop="remark" />
+					<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="64">
+						<template #default="scope">
+							<el-button link type="warning" icon="View" @click="handleShowFormDialog(scope.row)"> 查看 </el-button>
+						</template>
+					</el-table-column>
+				</el-table>
+			</div>
+		</div>
+
+		<!-- 分页 -->
+		<pagination
+			v-show="total > 0"
+			:total="total"
+			v-model:page="queryParams.pageNum"
+			v-model:limit="queryParams.pageSize"
+			@pagination="getList"
+		/>
+
+		<!-- 表单 -->
+		<receipt-form ref="receiptRef" />
+	</div>
+</template>
+
+<script setup name="Receipt">
+import { listReceipt } from '@/api/business/returnReceipt'
+import receiptForm from './form'
+const { proxy } = getCurrentInstance()
+
+const dataList = ref([])
+const loading = ref(true)
+const multiple = ref(false)
+const ids = ref([])
+const total = ref(0)
+/** 查询对象 */
+const queryParams = ref({
+	pageNum: 1,
+	pageSize: 10,
+	formCode: null,
+	formDate: null
+})
+
+/***********************  方法区  ****************************/
+
+/** 查询外协单主
+带箱方式,是整单的。如果换新箱子,明细中,都需要更换箱子列表 */
+function getList() {
+	loading.value = true
+	listReceipt(queryParams.value).then((response) => {
+		dataList.value = response.rows
+		total.value = response.total
+		loading.value = false
+	})
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+	queryParams.value.pageNum = 1
+	getList()
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+	proxy.resetForm('queryRef')
+	handleQuery()
+}
+
+/** 修改按钮操作 */
+function handleShowFormDialog(row) {
+	proxy.$refs.receiptRef.open(row ? row.id : null)
+}
+/** 删除按钮操作 */
+function handleDelete(row) {
+	const _ids = row.id || ids.value
+	proxy.$modal
+		.confirm('是否确认删除选中的数据项?')
+		.then(function () {
+			return delOrder(_ids)
+		})
+		.then(() => {
+			getList()
+			proxy.$modal.msgSuccess('删除成功!')
+		})
+		.catch(() => {})
+}
+
+/** 导出按钮操作 */
+function handleExport() {
+	proxy.download(
+		'business/returnReceipt/export',
+		{
+			...queryParams.value
+		},
+		`order_${new Date().getTime()}.xlsx`
+	)
+}
+
+getList()
+</script>