Browse Source

外协商端Vue

ezhizao 1 year ago
parent
commit
96820d16b0

+ 9 - 0
src/api/business/outsourcedOrderDetail.js

@@ -18,3 +18,12 @@ export function getDetail(id) {
 		method: 'get'
 	})
 }
+
+// 获取已完成的外协单从表
+export function listDetailForReceipt(data) {
+	return request({
+		url: baseUrl + '/business/outsourceDetail/listDetailForReceipt',
+		method: 'post',
+		data: data
+	})
+}

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

@@ -0,0 +1,20 @@
+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'
+	})
+}

+ 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'
+	})
+}

+ 16 - 0
src/router/index.js

@@ -106,6 +106,22 @@ export const constantRoutes = [
 			}
 		]
 	},
+	{
+		path: '/returnReceipt',
+		component: Layout,
+		//permissions: ['business:outsourcedOrderDetails:query'],
+		children: [
+			{
+				path: 'returnReceipt/index',
+				component: () => import('@/views/business/returnReceipt/index'),
+				name: 'ReturnReceipt',
+				meta: {
+					title: '收回单',
+					icon: 'list'
+				}
+			}
+		]
+	},
 	{
 		path: '/user',
 		component: Layout,

+ 1 - 3
src/views/business/outsourcedOrder/index.vue

@@ -118,8 +118,6 @@ const { packaging_method } = proxy.useDict('packaging_method')
 const orderList = ref([])
 const loading = ref(true)
 const ids = ref([])
-const single = ref(true)
-const multiple = ref(true)
 const total = ref(0)
 /** 查询对象 */
 const queryParams = ref({
@@ -166,7 +164,7 @@ function handleShowFormDialog(row) {
 /** 导出按钮操作 */
 function handleExport() {
 	proxy.download(
-		'business/order/export',
+		'business/outsourcedOrder/export',
 		{
 			...queryParams.value
 		},

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

@@ -0,0 +1,156 @@
+<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
+				v-if="supplierId !== '' && supplierId !== '0'"
+				label="只看外协商配置的产品:"
+				prop="isSupplierProducts"
+			>
+				<el-switch
+					v-model="queryParams.isSupplierProducts"
+					active-text="是"
+					:active-value="1"
+					inactive-text="否"
+					:inactive-value="0"
+				/>
+			</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 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 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>

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

@@ -0,0 +1,159 @@
+<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>
+				<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
+								readonly
+								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="12">
+						<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"
+					v-hasPermi="['business:outsource:add']"
+				>
+					添加收回明细
+				</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="form.packagingMethod === '0' ? '箱号' : '原箱号'"
+							align="center"
+							prop="originalCarrier"
+							width="320"
+						/>
+						<el-table-column
+							v-if="form.packagingMethod === '1'"
+							label="新箱号"
+							align="center"
+							prop="new_carrier"
+							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 v-model="scope.row.receiptNum" controls-position="right" />
+							</template>
+						</el-table-column>
+						<el-table-column label="备注" align="center" prop="remark" />
+					</el-table>
+				</div>
+			</div>
+		</div>
+
+		<!-- 外协商选择 -->
+		<dialog-outsource-details
+			ref="dialogOutsourceDetailsRef"
+			:multiple-selected="handleMultipleSelectedOutsourceDetails"
+		/>
+	</el-drawer>
+</template>
+<script setup>
+import { getReceipt } from '@/api/business/returnReceipt'
+import dialogOutsourceDetails from './DialogOutsourceDetails'
+const { proxy } = getCurrentInstance()
+/** 表单抽屉 页变量 */
+const loading = ref(false)
+const visible = ref(false)
+const webHost = import.meta.env.VITE_APP_BASE_API
+const form = ref({})
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (id) => {
+	reset()
+	loading.value = true
+	visible.value = true
+	getReceipt(id).then((response) => {
+		form.value = response.data
+		loading.value = false
+	})
+}
+
+/** 取消按钮 */
+const cancel = () => {
+	visible.value = false
+	reset()
+}
+
+/** 表单重置 */
+const reset = () => {
+	form.value = {
+		id: null,
+		tenantId: '0',
+		formCode: '',
+		formDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
+		supplierId: '0',
+		supplierName: '',
+		remark: '',
+		details: []
+	}
+	proxy.resetForm('formRef')
+}
+/***************************** 外协明细对话框相关 *****************************/
+// 打开外协明细选择对话框
+const handleShowDialogOutSourceDetails = () => {
+	const dayworkIds = form.value.details.map((item) => item.dayworkId)
+	proxy.$refs.dialogProductsRef.open(dayworkIds)
+}
+// 外协明细选择带回
+const handleMultipleSelectedOutsourceDetails = (selection) => {
+	selection.forEach((item) => {
+		const newDetail = {
+			lotId: item.lotId,
+			lotCode: item.lotCode,
+			dayworkId: item.id,
+			productId: item.productId,
+			productDescription: item.productDescription,
+			productNum: 0,
+			receiptNum: 0,
+			processNames: '',
+			remark: item.remark
+		}
+		form.value.details.push(newDetail)
+	})
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+	open
+})
+</script>

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

@@ -0,0 +1,133 @@
+<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="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="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 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.id)
+}
+
+/** 导出按钮操作 */
+function handleExport() {
+	proxy.download(
+		'business/returnReceipt/export',
+		{
+			...queryParams.value
+		},
+		`order_${new Date().getTime()}.xlsx`
+	)
+}
+
+getList()
+</script>