0530
parent
1cc29a2b98
commit
fc7d38306f
|
@ -107,6 +107,11 @@ public class PrintCodeDetailService : IDynamicApiController, ITransient
|
|||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
public async Task UpdateByEntity(PrintCodeDetail entity)
|
||||
{
|
||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取打印条码详情
|
||||
/// </summary>
|
||||
|
|
|
@ -10,9 +10,11 @@ namespace Admin.NET.Application;
|
|||
public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly SqlSugarRepository<ReportDetailTable> _rep;
|
||||
public ReportDetailTableService(SqlSugarRepository<ReportDetailTable> rep)
|
||||
private readonly PrintCodeDetailService _codeDetailService;
|
||||
public ReportDetailTableService(SqlSugarRepository<ReportDetailTable> rep, PrintCodeDetailService codeDetailService)
|
||||
{
|
||||
_rep = rep;
|
||||
_codeDetailService = codeDetailService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,8 +102,26 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
|||
[ApiDescriptionSettings(Name = "Add")]
|
||||
public async Task<long> Add(AddReportDetailTableInput input)
|
||||
{
|
||||
var details = await _codeDetailService.List();
|
||||
if (details == null || details.Count < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var printDetails = details.FindAll(a => a.TempListId == input.UpdateUserId);
|
||||
if (printDetails.Count < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var entity = input.Adapt<ReportDetailTable>();
|
||||
await _rep.InsertAsync(entity);
|
||||
for (int i = 0; i < printDetails.Count; i++)
|
||||
{
|
||||
var item = printDetails[i];
|
||||
item.ReportTableId = entity.Id;
|
||||
var ent = item.Adapt<PrintCodeDetail>();
|
||||
await _codeDetailService.UpdateByEntity(ent);
|
||||
}
|
||||
|
||||
return entity.Id;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ public class AddReportContext
|
|||
/// </summary>
|
||||
public string? Batch { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public long? MaterialsId { get; set; }
|
||||
/// <summary>
|
||||
/// 打印数据
|
||||
/// </summary>
|
||||
public List<PrintData> PrintDatas { get; set; }
|
||||
|
|
|
@ -44,6 +44,11 @@ public class PrintCodeTreeData
|
|||
/// 子码数
|
||||
/// </summary>
|
||||
public int? ChildCount { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
public List<PrintCodeTreeData> Children { get; set; }
|
||||
public bool HasChildren { get; set; } = true;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ using Admin.NET.Application.Const;
|
|||
using Admin.NET.Application.Entity;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Admin.NET.Application.Service.ReportTable.Dto;
|
||||
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
|
||||
using Nest;
|
||||
|
||||
namespace Admin.NET.Application;
|
||||
/// <summary>
|
||||
|
@ -84,8 +86,25 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
[ApiDescriptionSettings(Name = "Add")]
|
||||
public async Task<long> Add(AddReportTableInput input)
|
||||
{
|
||||
//input.UpdateUserId
|
||||
var details = await _codeDetailService.List();
|
||||
if (details == null || details.Count < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var printDetails = details.FindAll(a => a.TempListId == input.UpdateUserId);
|
||||
if (printDetails.Count < 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
var entity = input.Adapt<ReportTable>();
|
||||
await _rep.InsertAsync(entity);
|
||||
for (int i = 0; i < printDetails.Count; i++)
|
||||
{
|
||||
var item = printDetails[i];
|
||||
item.ReportTableId = entity.Id;
|
||||
await _codeDetailService.Update(item.Adapt<UpdatePrintCodeDetailInput>());
|
||||
}
|
||||
return entity.Id;
|
||||
}
|
||||
|
||||
|
@ -174,13 +193,13 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增汇报单
|
||||
/// 新增打印详情单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ApiDescriptionSettings(Name = "AddPrintList")]
|
||||
public async Task<List<PrintCodeTreeData>> AddPrintList(AddReportContext input)
|
||||
[ApiDescriptionSettings(Name = "AddPrintDetail")]
|
||||
public async Task<List<PrintCodeTreeData>> AddPrintDetail(AddReportContext input)
|
||||
{
|
||||
var result = new List<PrintCodeTreeData>();
|
||||
var unitGroup = await _repUnitGroup.Detail(new QueryByIdSysUnitGroupInput() { Id = input.UnitGroupId });
|
||||
|
@ -197,7 +216,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
if (unit == null)
|
||||
throw new ArgumentNullException(nameof(unitGroup));
|
||||
|
||||
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 1 };
|
||||
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = DateTime.Now.ToString("yyyyMMddhhmmss"), State = 0,UpdateUserId = input.MaterialsId };
|
||||
var addReport = await Add(newReport);
|
||||
var others = units.FindAll(a => a.Rate < unit.Rate).OrderBy(a => a.Rate).ToList();
|
||||
others.Reverse();
|
||||
|
@ -221,7 +240,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
}
|
||||
treeData1.Children = new List<PrintCodeTreeData>();
|
||||
var currUnit = tempUnits.FirstOrDefault();
|
||||
var printDatas = await _printDataService.GetPrintDatas(currUnit.Name, codeType, currUnit.ChildUnitCount);
|
||||
var printDatas = await _printDataService.GetPrintDatas(currUnit.Name, codeType, unit.ChildUnitCount);
|
||||
foreach (var dt in printDatas)
|
||||
{
|
||||
var code2 = string.IsNullOrEmpty(dt.BarCode) ? dt.QrCode : dt.BarCode;
|
||||
|
@ -232,7 +251,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
{
|
||||
treeData2.Children = new List<PrintCodeTreeData>();
|
||||
var currUnit3 = tempUnits[1];
|
||||
var printDatas3 = await _printDataService.GetPrintDatas(currUnit3.Name, codeType, currUnit3.ChildUnitCount);
|
||||
var printDatas3 = await _printDataService.GetPrintDatas(currUnit3.Name, codeType, currUnit.ChildUnitCount);
|
||||
foreach (var dt3 in printDatas3)
|
||||
{
|
||||
var code3 = string.IsNullOrEmpty(dt3.BarCode) ? dt3.QrCode : dt3.BarCode;
|
||||
|
@ -243,7 +262,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
{
|
||||
treeData3.Children = new List<PrintCodeTreeData>();
|
||||
var currUnit4 = tempUnits[2];
|
||||
var printDatas4 = await _printDataService.GetPrintDatas(currUnit4.Name, codeType, currUnit4.ChildUnitCount);
|
||||
var printDatas4 = await _printDataService.GetPrintDatas(currUnit4.Name, codeType, currUnit3.ChildUnitCount);
|
||||
foreach (var dt4 in printDatas4)
|
||||
{
|
||||
var code4 = string.IsNullOrEmpty(dt4.BarCode) ? dt4.QrCode : dt4.BarCode;
|
||||
|
@ -261,5 +280,73 @@ public class ReportTableService : IDynamicApiController, ITransient
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取打印详情单
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ApiDescriptionSettings(Name = "GetPrintDetail")]
|
||||
public async Task<List<PrintCodeTreeData>> GetPrintDetail(long? id)
|
||||
{
|
||||
var result = new List<PrintCodeTreeData>();
|
||||
//var report = await Detail(new QueryByIdReportTableInput() { Id = id });
|
||||
//if (report==null)
|
||||
//{
|
||||
// return result;
|
||||
//}
|
||||
var details = await _codeDetailService.List();
|
||||
if (details == null || details.Count < 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var printDetails = details.FindAll(a => a.TempListId == id || a.ReportTableId == id);
|
||||
if (printDetails.Count<1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var father = printDetails.FindAll(a => a.FatherId == null || a.FatherId == 0);
|
||||
foreach (var item in father)
|
||||
{
|
||||
var treeData1 = item.Adapt<PrintCodeTreeData>();
|
||||
var list1 = printDetails.FindAll(a => a.FatherId == item.Id);
|
||||
if (list1.Count > 0)
|
||||
{
|
||||
treeData1.Children = new List<PrintCodeTreeData>();
|
||||
treeData1.HasChildren = false;
|
||||
foreach (var dt in list1)
|
||||
{
|
||||
var list2 = printDetails.FindAll(a => a.FatherId == dt.Id);
|
||||
var treeData2 = dt.Adapt<PrintCodeTreeData>();
|
||||
if (list2.Count > 0)
|
||||
{
|
||||
treeData2.Children = new List<PrintCodeTreeData>();
|
||||
treeData2.HasChildren = false;
|
||||
foreach (var dt3 in list2)
|
||||
{
|
||||
var list3 = printDetails.FindAll(a => a.FatherId == dt3.Id);
|
||||
var treeData3 = dt3.Adapt<PrintCodeTreeData>();
|
||||
if (list3.Count > 0)
|
||||
{
|
||||
treeData3.Children = new List<PrintCodeTreeData>();
|
||||
treeData3.HasChildren = false;
|
||||
foreach (var dt4 in list3)
|
||||
{
|
||||
var treeData4 = dt4.Adapt<PrintCodeTreeData>();
|
||||
treeData3.Children.Add(treeData4);
|
||||
}
|
||||
}
|
||||
treeData2.Children.Add(treeData3);
|
||||
}
|
||||
}
|
||||
treeData1.Children.Add(treeData2);
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(treeData1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* 业务应用
|
||||
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 打印信息
|
||||
*
|
||||
* @export
|
||||
* @interface PrintCodeTreeData
|
||||
*/
|
||||
export interface PrintCodeTreeData {
|
||||
|
||||
/**
|
||||
* 雪花Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
id?: number;
|
||||
|
||||
/**
|
||||
* 条码
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
code?: string | null;
|
||||
|
||||
/**
|
||||
* 上级码
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
fatherCode?: string | null;
|
||||
|
||||
/**
|
||||
* 条码类型
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
codeName?: string | null;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
unit?: string | null;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
count?: number;
|
||||
|
||||
/**
|
||||
* 基本单位
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
baseUnit?: string | null;
|
||||
|
||||
/**
|
||||
* 基本数量
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
baseCount?: number;
|
||||
|
||||
/**
|
||||
* 子码数
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
childCount?: number;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
remark?: string | null;
|
||||
|
||||
/**
|
||||
* 子项
|
||||
*
|
||||
* @type {PrintCodeTreeData[]}
|
||||
* @memberof PrintCodeTreeData
|
||||
*/
|
||||
children?: PrintCodeTreeData[] | null;
|
||||
}
|
|
@ -5,6 +5,8 @@ enum Api {
|
|||
UpdateReportTable = '/api/reportTable/update',
|
||||
PageReportTable = '/api/reportTable/page',
|
||||
DetailReportTable = '/api/reportTable/detail',
|
||||
AddPrintDetail = '/api/reportTable/addPrintDetail',
|
||||
GetPrintDetail = '/api/reportTable/getPrintDetail',
|
||||
}
|
||||
|
||||
// 增加汇报单
|
||||
|
@ -47,4 +49,18 @@ export const detailReportTable = (id: any) =>
|
|||
data: { id },
|
||||
});
|
||||
|
||||
// 新增打印详情单
|
||||
export const addPrintDetail = (params?: any) =>
|
||||
request({
|
||||
url: Api.AddPrintDetail,
|
||||
method: 'post',
|
||||
data: params,
|
||||
});
|
||||
|
||||
// 获取打印详情单
|
||||
export const getPrintDetail = (id: any) =>
|
||||
request({
|
||||
url: Api.GetPrintDetail,
|
||||
method: 'get',
|
||||
data: { id },
|
||||
});
|
|
@ -74,6 +74,11 @@
|
|||
|
||||
<!-- 预览 -->
|
||||
<PrintPreview ref="preViewRef" />
|
||||
|
||||
<detailForm
|
||||
ref="editDialogRef"
|
||||
:title="editReportTableTitle"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -86,13 +91,14 @@ import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
|
|||
import VueJsonPretty from 'vue-json-pretty';
|
||||
import 'vue-json-pretty/lib/styles.css';
|
||||
import {getCodeConfig} from "/@/api/main/codeElement";
|
||||
import { addReportTable, addPrintDetail} from "/@/api/main/reportTable";
|
||||
|
||||
import { hiprint } from 'vue-plugin-hiprint';
|
||||
import providers from '../../print/component/hiprint/providers';
|
||||
import PrintPreview from '../../print/component/hiprint/preview.vue';
|
||||
import { PrintDataApiFp } from '../../../../api-services/apis/print-data-api';
|
||||
import { async } from '../../../../router/backEnd';
|
||||
|
||||
import detailForm from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
|
@ -103,7 +109,8 @@ let hiprintTemplate = ref();
|
|||
const preViewRef = ref();
|
||||
const codeConfigData = ref<any>([]);
|
||||
const printData = ref<PrintData[]>([]);
|
||||
|
||||
const editDialogRef = ref();
|
||||
const editReportTableTitle = ref("打印详情");
|
||||
//定义printInfoFrom字段
|
||||
const printInfoFrom = reactive({
|
||||
name: '',
|
||||
|
@ -162,7 +169,7 @@ const queryUnitByGroupId = async (groupId:number) => {
|
|||
|
||||
|
||||
//定义matterSubmit方法
|
||||
const printSubmit = () => {
|
||||
const printSubmit = async () => {
|
||||
if(printInfoFrom.printDataTem=='')
|
||||
{
|
||||
ElMessage.error('请先选择打印模板');
|
||||
|
@ -179,8 +186,11 @@ const printSubmit = () => {
|
|||
printData.value,
|
||||
{},
|
||||
{
|
||||
callback: () => {
|
||||
callback: async () => {
|
||||
state.waitShowPrinter = false;
|
||||
let contexts={unitGroupId:state.matterFrom.unitGroupId, materialsId:state.matterFrom.id, name:printInfoFrom.package, productDate:printInfoFrom.productDate, loseDate:printInfoFrom.loseDate, batch:printInfoFrom.batch, printDatas:printData.value};
|
||||
let details = await addPrintDetail(contexts);
|
||||
editDialogRef.value.openDialog(details.data.result);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
@ -237,6 +247,8 @@ const closeDialog = () => {
|
|||
state.isShowDialog = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//定义printLabel方法,打开打印设置界面
|
||||
const printLabel = (data:any) => {
|
||||
const unitGroupId = data.unitGroupId
|
||||
|
|
|
@ -1,75 +1,37 @@
|
|||
<template>
|
||||
<div class="reportTable-container">
|
||||
<el-dialog v-model="isShowDialog" :width="800" draggable="">
|
||||
<el-dialog v-model="isShowDialog" :width="1000" draggable="">
|
||||
<template #header>
|
||||
<div style="color: #fff">
|
||||
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
|
||||
<span>{{ props.title }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
||||
<el-row :gutter="35">
|
||||
<el-form-item v-show="false">
|
||||
<el-input v-model="ruleForm.id" />
|
||||
</el-form-item>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="单号" prop="oddNumber">
|
||||
<el-input v-model="ruleForm.oddNumber" placeholder="请输入单号" maxlength="32" show-word-limit clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="业务日期" prop="startDate">
|
||||
<el-date-picker v-model="ruleForm.startDate" type="date" placeholder="业务日期" />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="状态" prop="state">
|
||||
<el-input-number v-model="ruleForm.state" placeholder="请输入状态" clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="生产类型" prop="productType">
|
||||
<el-input v-model="ruleForm.productType" placeholder="请输入生产类型" maxlength="32" show-word-limit clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="生产线" prop="productionLine">
|
||||
<el-input v-model="ruleForm.productionLine" placeholder="请输入生产线" maxlength="32" show-word-limit clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="生产线编码" prop="codeNum">
|
||||
<el-input v-model="ruleForm.codeNum" placeholder="请输入生产线编码" maxlength="32" show-word-limit clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="源单号" prop="sourceNumber">
|
||||
<el-input v-model="ruleForm.sourceNumber" placeholder="请输入源单号" maxlength="32" show-word-limit clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="ruleForm.remarks" placeholder="请输入备注" maxlength="64" show-word-limit clearable />
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div>
|
||||
<el-table
|
||||
:data="ruleForm"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
style="width: 100%"
|
||||
tooltip-effect="light"
|
||||
row-key="code"
|
||||
:default-expand-all="isExpandAll"
|
||||
border="">
|
||||
<el-table-column prop="code" label="条码" width="200" show-overflow-tooltip="" />
|
||||
<el-table-column prop="fatherCode" label="上级码" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="codeName" label="条码类型" width="100" show-overflow-tooltip="" />
|
||||
<el-table-column prop="count" label="数量" width="80" show-overflow-tooltip="" />
|
||||
<el-table-column prop="unit" label="单位" width="80" show-overflow-tooltip="" />
|
||||
<el-table-column prop="baseCount" label="基本数量" width="100" show-overflow-tooltip="" />
|
||||
<el-table-column prop="baseUnit" label="基本单位" width="100" show-overflow-tooltip="" />
|
||||
<el-table-column prop="childCount" label="子码数" width="80" show-overflow-tooltip="" />
|
||||
<!-- <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" >
|
||||
<template #default="scope">
|
||||
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="''" > 查看 </el-button>
|
||||
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="''" > 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
|
@ -86,11 +48,11 @@
|
|||
}
|
||||
</style>
|
||||
<script lang="ts" setup>
|
||||
import { ref,onMounted } from "vue";
|
||||
import { ref,onMounted,reactive } from "vue";
|
||||
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
|
||||
import { ElMessage } from "element-plus";
|
||||
import type { FormRules } from "element-plus";
|
||||
import { addReportTable, updateReportTable, detailReportTable } from "/@/api/main/reportTable";
|
||||
import { addReportTable, updateReportTable, detailReportTable ,getPrintDetail} from "/@/api/main/reportTable";
|
||||
|
||||
//父级传递来的参数
|
||||
var props = defineProps({
|
||||
|
@ -103,20 +65,30 @@
|
|||
const emit = defineEmits(["reloadTable"]);
|
||||
const ruleFormRef = ref();
|
||||
const isShowDialog = ref(false);
|
||||
const ruleForm = ref<any>({});
|
||||
const ruleForm = ref<any>([]);
|
||||
//自行添加其他规则
|
||||
const rules = ref<FormRules>({
|
||||
});
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
isShowCheckbox: false,
|
||||
ownOrgData: [],
|
||||
});
|
||||
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (row: any) => {
|
||||
// ruleForm.value = JSON.parse(JSON.stringify(row));
|
||||
// 改用detail获取最新数据来编辑
|
||||
let rowData = JSON.parse(JSON.stringify(row));
|
||||
if (rowData.id)
|
||||
ruleForm.value = (await detailReportTable(rowData.id)).data.result;
|
||||
else
|
||||
ruleForm.value = rowData;
|
||||
//console.log(row);
|
||||
|
||||
if(typeof(row) === 'number'){
|
||||
var res = await getPrintDetail(row);
|
||||
//console.log(res);
|
||||
ruleForm.value = res.data.result;
|
||||
}else{
|
||||
ruleForm.value=row;
|
||||
}
|
||||
//console.log(ruleForm.value);
|
||||
isShowDialog.value = true;
|
||||
};
|
||||
|
||||
|
@ -133,29 +105,11 @@
|
|||
|
||||
// 提交
|
||||
const submit = async () => {
|
||||
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
||||
if (isValid) {
|
||||
let values = ruleForm.value;
|
||||
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
|
||||
await addReportTable(values);
|
||||
} else {
|
||||
await updateReportTable(values);
|
||||
}
|
||||
closeDialog();
|
||||
} else {
|
||||
ElMessage({
|
||||
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
isShowDialog.value = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const isExpandAll = ref(false);
|
||||
|
||||
// 页面加载时
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -91,10 +91,11 @@
|
|||
<el-table-column prop="codeNum" label="生产线编码" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="sourceNumber" label="源单号" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('reportTable:update') || auth('reportTable:delete')">
|
||||
<el-table-column label="操作" width="240" align="center" fixed="right" show-overflow-tooltip="" >
|
||||
<template #default="scope">
|
||||
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditReportTable(scope.row)" v-auth="'reportTable:update'"> 编辑 </el-button>
|
||||
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delReportTable(scope.row)" v-auth="'reportTable:delete'"> 删除 </el-button>
|
||||
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportTable(scope.row.id)" > 查看 </el-button>
|
||||
<el-button icon="ele-Add" size="small" text="" type="primary" @click="addReportTable(scope.row)" > 生成汇报单 </el-button>
|
||||
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delReportTable(scope.row)" > 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -112,7 +113,10 @@
|
|||
<editDialog
|
||||
ref="editDialogRef"
|
||||
:title="editReportTableTitle"
|
||||
@reloadTable="handleQuery"
|
||||
/>
|
||||
<addReportDialog
|
||||
ref="addReportDialogRef"
|
||||
:title="addReportTitle"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
|
@ -125,13 +129,14 @@
|
|||
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
|
||||
import { formatDate } from '/@/utils/formatTime';
|
||||
|
||||
|
||||
import editDialog from '/@/views/productionCenter/reportTable/component/editDialog.vue'
|
||||
import addReportDialog from '/@/views/productionCenter/reportDetailTable/component/editDialog.vue'
|
||||
import editDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
|
||||
import { pageReportTable, deleteReportTable } from '/@/api/main/reportTable';
|
||||
|
||||
|
||||
const showAdvanceQueryUI = ref(false);
|
||||
const editDialogRef = ref();
|
||||
const addReportDialogRef = ref();
|
||||
const loading = ref(false);
|
||||
const tableData = ref<any>([]);
|
||||
const queryParams = ref<any>({});
|
||||
|
@ -142,6 +147,7 @@
|
|||
});
|
||||
|
||||
const editReportTableTitle = ref("");
|
||||
const addReportTitle = ref("");
|
||||
|
||||
// 改变高级查询的控件显示状态
|
||||
const changeAdvanceQueryUI = () => {
|
||||
|
@ -166,15 +172,20 @@
|
|||
};
|
||||
|
||||
// 打开新增页面
|
||||
const openAddReportTable = () => {
|
||||
editReportTableTitle.value = '添加汇报单';
|
||||
editDialogRef.value.openDialog({});
|
||||
// const openAddReportTable = () => {
|
||||
// editReportTableTitle.value = '添加汇报单';
|
||||
// editDialogRef.value.openDialog({});
|
||||
// };
|
||||
|
||||
// 打开新增汇报单页面
|
||||
const addReportTable = (row: any) => {
|
||||
addReportTitle.value = '添加汇报单';
|
||||
addReportDialogRef.value.openDialog({updateUserId:row.id});
|
||||
};
|
||||
|
||||
|
||||
// 打开编辑页面
|
||||
const openEditReportTable = (row: any) => {
|
||||
editReportTableTitle.value = '编辑汇报单';
|
||||
// 打开打印详情页面
|
||||
const readReportTable = (row: any) => {
|
||||
editReportTableTitle.value = '打印详情';
|
||||
editDialogRef.value.openDialog(row);
|
||||
};
|
||||
|
||||
|
@ -206,6 +217,8 @@
|
|||
};
|
||||
|
||||
handleQuery();
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
:deep(.el-ipnut),
|
||||
|
|
|
@ -223,6 +223,7 @@
|
|||
const ruleFormRef = ref();
|
||||
const isShowDialog = ref(false);
|
||||
const ruleForm = ref<any>({});
|
||||
const materials = ref<any>({});
|
||||
//自行添加其他规则
|
||||
const rules = ref<FormRules>({
|
||||
productName: [{required: true, message: '请输入产品名称!', trigger: 'blur',},],
|
||||
|
@ -238,7 +239,13 @@
|
|||
ruleForm.value = (await detailReportDetailTable(rowData.id)).data.result;
|
||||
else
|
||||
ruleForm.value = rowData;
|
||||
|
||||
if(rowData.updateUserId){
|
||||
console.log('matertails');
|
||||
|
||||
}
|
||||
isShowDialog.value = true;
|
||||
//console.log(ruleForm.value);
|
||||
};
|
||||
|
||||
// 关闭弹窗
|
|
@ -166,7 +166,7 @@
|
|||
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
|
||||
<el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> 高级查询 </el-button>
|
||||
<el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> 隐藏 </el-button>
|
||||
<el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddReportDetailTable" v-auth="'reportDetailTable:add'"> 新增 </el-button>
|
||||
<!-- <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddReportDetailTable" v-auth="'reportDetailTable:add'"> 新增 </el-button> -->
|
||||
|
||||
</el-button-group>
|
||||
</el-form-item>
|
||||
|
@ -210,9 +210,10 @@
|
|||
<el-table-column prop="endDate" label="完工时间" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="sourceOddNumber" label="源单号" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" />
|
||||
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('reportDetailTable:update') || auth('reportDetailTable:delete')">
|
||||
<el-table-column label="操作" width="200" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('reportDetailTable:update') || auth('reportDetailTable:delete')">
|
||||
<template #default="scope">
|
||||
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditReportDetailTable(scope.row)" v-auth="'reportDetailTable:update'"> 编辑 </el-button>
|
||||
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="readReportDetailTable(scope.row.id)" v-auth="'reportDetailTable:update'"> 详情 </el-button>
|
||||
<el-button icon="ele-Delete" size="small" text="" type="primary" @click="delReportDetailTable(scope.row)" v-auth="'reportDetailTable:delete'"> 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -228,15 +229,15 @@
|
|||
@current-change="handleCurrentChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
/>
|
||||
<printDialog
|
||||
ref="printDialogRef"
|
||||
:title="printReportDetailTableTitle"
|
||||
@reloadTable="handleQuery" />
|
||||
<editDialog
|
||||
ref="editDialogRef"
|
||||
:title="editReportDetailTableTitle"
|
||||
@reloadTable="handleQuery"
|
||||
/>
|
||||
<printDetailDialog
|
||||
ref="printDetailDialogRef"
|
||||
:title="printDetailTableTitle"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -248,15 +249,14 @@
|
|||
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
|
||||
import { formatDate } from '/@/utils/formatTime';
|
||||
|
||||
|
||||
import printDialog from '/@/views/labelPrinting/print/component/hiprint/preview.vue'
|
||||
import editDialog from '/@/views/main/reportDetailTable/component/editDialog.vue'
|
||||
import editDialog from '/@/views/productionCenter/reportDetailTable/component/editDialog.vue'
|
||||
import printDetailDialog from '/@/views/labelPrinting/printDataDetail/component/editDialog.vue'
|
||||
import { pageReportDetailTable, deleteReportDetailTable } from '/@/api/main/reportDetailTable';
|
||||
|
||||
|
||||
const showAdvanceQueryUI = ref(false);
|
||||
const printDialogRef = ref();
|
||||
const editDialogRef = ref();
|
||||
const printDetailDialogRef = ref();
|
||||
const loading = ref(false);
|
||||
const tableData = ref<any>([]);
|
||||
const queryParams = ref<any>({});
|
||||
|
@ -266,8 +266,8 @@
|
|||
total: 0,
|
||||
});
|
||||
|
||||
const printReportDetailTableTitle = ref("");
|
||||
const editReportDetailTableTitle = ref("");
|
||||
const printDetailTableTitle = ref("");
|
||||
|
||||
// 改变高级查询的控件显示状态
|
||||
const changeAdvanceQueryUI = () => {
|
||||
|
@ -292,15 +292,11 @@
|
|||
};
|
||||
|
||||
// 打开新增页面
|
||||
const openAddReportDetailTable = () => {
|
||||
editReportDetailTableTitle.value = '添加汇报单详情';
|
||||
editDialogRef.value.openDialog({});
|
||||
};
|
||||
// const openAddReportDetailTable = () => {
|
||||
// editReportDetailTableTitle.value = '添加汇报单详情';
|
||||
// editDialogRef.value.openDialog({});
|
||||
// };
|
||||
|
||||
// 打开打印页面
|
||||
const openPrintReportDetailTable = async (row: any) => {
|
||||
printReportDetailTableTitle.value = '打印汇报单详情';
|
||||
}
|
||||
|
||||
// 打开编辑页面
|
||||
const openEditReportDetailTable = (row: any) => {
|
||||
|
@ -308,6 +304,14 @@
|
|||
editDialogRef.value.openDialog(row);
|
||||
};
|
||||
|
||||
|
||||
// 打开查看详情页面
|
||||
const readReportDetailTable = (row: any) => {
|
||||
printDetailTableTitle.value = '打印详情';
|
||||
console.log(row);
|
||||
printDetailDialogRef.value.openDialog(row);
|
||||
};
|
||||
|
||||
// 删除
|
||||
const delReportDetailTable = (row: any) => {
|
||||
ElMessageBox.confirm(`确定要删除吗?`, "提示", {
|
Loading…
Reference in New Issue