main
liangzongpeng 2024-05-14 10:04:48 +08:00
parent c347d7eed8
commit 1c1d92dfe8
5 changed files with 95 additions and 96 deletions

View File

@ -33,7 +33,7 @@ public class MaterialsService : IDynamicApiController, ITransient
[ApiDescriptionSettings(Name = "Page")] [ApiDescriptionSettings(Name = "Page")]
public async Task<SqlSugarPagedList<MaterialsOutput>> Page(MaterialsInput input) public async Task<SqlSugarPagedList<MaterialsOutput>> Page(MaterialsInput input)
{ {
var query = _rep.AsQueryable() var query = _rep.AsQueryable().Where(a => !a.IsDelete)
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u => .WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
u.Name.Contains(input.SearchKey.Trim()) u.Name.Contains(input.SearchKey.Trim())
|| u.CodeNum.Contains(input.SearchKey.Trim()) || u.CodeNum.Contains(input.SearchKey.Trim())

View File

@ -84,7 +84,7 @@
<el-tab-pane label="单位信息" name="单位信息"> <el-tab-pane label="单位信息" name="单位信息">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="单位组" prop="unitgroupid" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]"> <el-form-item label="单位组" prop="unitGroupId" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange"> <el-select v-model="state.matterFrom.unitGroupId" placeholder="单位组" filterable default-first-option style="width: 100%" @change="unitGroupChange">
<el-option v-for="item in state.unitGroupData" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in state.unitGroupData" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
@ -123,10 +123,9 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="销售单位"> <el-form-item label="销售单位" prop="saleUnit" :rules="[{ required: true, message: '销售单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.saleUnit" placeholder="请选择" clearable> <el-select v-model="state.matterFrom.saleUnit" placeholder="销售单位" filterable default-first-option style="width: 100%">
<el-option label="袋" value="袋" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
<el-option label="箱" value="箱" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -134,10 +133,9 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="分销单位"> <el-form-item label="分销单位" prop="retailStoreUnit" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.retailStoreUnit" placeholder="请选择" clearable> <el-select v-model="state.matterFrom.retailStoreUnit" placeholder="分销单位" filterable default-first-option style="width: 100%">
<el-option label="袋" value="袋" /> <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
<el-option label="箱" value="箱" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -243,6 +241,8 @@ const openDialog = async (row: any) => {
state.matterFrom=row; state.matterFrom=row;
//var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id); //var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
//state.ruleForm.roleIdList = resRole.data.result; //state.ruleForm.roleIdList = resRole.data.result;
}else{
state.matterFrom.isEnable=true;
} }
state.isShowDialog = true; state.isShowDialog = true;
}; };
@ -346,13 +346,6 @@ const matterSubmit = async () => {
} }
const pageVO1 = reactive({
currentPage: 1,
pageSize: 10,
total: 0
})
// //
let infoDate = reactive([] as PackageInfoOutput[]) let infoDate = reactive([] as PackageInfoOutput[])
const getPackageInfoApi = async (id: number) => { const getPackageInfoApi = async (id: number) => {

View File

@ -154,9 +154,6 @@ const state = reactive({
tableData: [] as Array<MaterialsOutput>, tableData: [] as Array<MaterialsOutput>,
orgTreeData: [] as Array<MaterialsOutput>, orgTreeData: [] as Array<MaterialsOutput>,
brandDate:[] as Array<BrandOutput>, brandDate:[] as Array<BrandOutput>,
queryParams: {
name: undefined,
},
tableParams: { tableParams: {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@ -262,8 +259,8 @@ const matterDelete = async (row: any) => {
let deleteRow = {} as DeleteMaterialsInput let deleteRow = {} as DeleteMaterialsInput
deleteRow.id=row.id deleteRow.id=row.id
let res = await getAPI(MaterialsApi).apiMaterialsDeletePost(deleteRow); let res = await getAPI(MaterialsApi).apiMaterialsDeletePost(deleteRow);
console.log(res) //console.log(res)
if (res.data.code === 200) { if (res.data.code == 200) {
ElMessage({ message: '成功', type: 'success', }) ElMessage({ message: '成功', type: 'success', })
handleQuery() handleQuery()
//state.tableData.handleList(); //state.tableData.handleList();

View File

@ -1,13 +1,12 @@
<template> <template>
<div class="sys-open-access-container"> <div class="sys-open-access-container">
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="1000"> <el-dialog v-model="state.isShowDialog" :title="props.title" width="1000">
<el-form :inline="true" :model="printInfoFrom" class="demo-form-inline" label-width="90px"> <el-form :inline="true" :model="printInfoFrom" class="demo-form-inline" label-width="90px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="打印模板"> <el-form-item label="打印模板" prop="unit" :rules="[{ required: true, message: '打印模板不能为空', trigger: 'blur' }]">
<el-select v-model="printInfoFrom.printData" placeholder="请选择" clearable> <el-select v-model="printInfoFrom.printData" placeholder="打印模板" filterable default-first-option style="width: 100%">
<el-option :label="item.name" :value="item" v-for="item, index in state.printData" <el-option v-for="item in state.printData" :key="item.id" :label="item.name" :value="item" />
:key="index" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -17,24 +16,25 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="单位"> <el-form-item label="单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]">
<el-select v-model="printInfoFrom.unit" placeholder="请选择" clearable> <el-select v-model="printInfoFrom.unit" placeholder="基本单位" filterable default-first-option style="width: 100%">
<el-option :label="item.name" :value="item.id" v-for="item, index in unitListData" <el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
:key="index" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8"> <!-- <el-col :span="8">
<el-form-item label="包装单位"> <el-form-item label="包装单位">
<el-input v-model="printInfoFrom.packageUnit" placeholder="请输入" clearable /> <el-input v-model="printInfoFrom.packageUnit" placeholder="请输入" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<el-col :span="8"> <el-col :span="8">
<el-form-item label="包装"> <el-form-item label="包装" prop="package" :rules="[{ required: true, message: '包装不能为空', trigger: 'blur' }]">
<el-input v-model="printInfoFrom.package" placeholder="请输入" clearable /> <el-select v-model="printInfoFrom.package" placeholder="包装" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.unitData" :key="item.id" :label="item.name" :value="item.name" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -59,7 +59,7 @@
</el-form> </el-form>
<el-row style="display: flex; justify-content: space-around;"> <el-row style="display: flex; justify-content: space-around;">
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button> <el-button style="width: 100px;" @click="state.isShowDialog = false">取消</el-button>
<el-button style="width: 100px;" type="primary" @click="printSubmit"></el-button> <el-button style="width: 100px;" type="primary" @click="printSubmit"></el-button>
</el-row> </el-row>
</el-dialog> </el-dialog>
@ -72,11 +72,24 @@ import { getAPI } from '/@/utils/axios-utils';
import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api'; import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api';
import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models'; import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models';
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus'; import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
import { hiprint } from 'vue-plugin-hiprint';
import providers from './providers';
import PrintPreview from './preview.vue';
import printData from './print-data';
const props = defineProps({
title: String,
orgData: Array<MaterialsOutput>,
});
let hiprintTemplate = ref();
const preViewRef = ref();
let dialogTableVisible = ref(false);
const mTitle='标签打印'
const fyListData=ref([]);
const unitListData=ref<SysUnitOutput[]>([]);
//printInfoFrom //printInfoFrom
const printInfoFrom = reactive({ const printInfoFrom = reactive({
name: '', name: '',
@ -85,14 +98,17 @@ const printInfoFrom = reactive({
unit: '', unit: '',
packageUnit: 1, packageUnit: 1,
package: '', package: '',
productDate: Date, productDate: {} as Date,
loseDate: Date, loseDate: {} as Date,
batch:1, batch:1,
}) })
const state = reactive({ const state = reactive({
loading: false, loading: false,
isShowDialog:false,
matterFrom: {} as MaterialsOutput,
printData: [] as Array<SysPrint>, printData: [] as Array<SysPrint>,
unitData: [] as Array<SysUnitOutput>,
queryParams: { queryParams: {
name: undefined, name: undefined,
}, },
@ -101,7 +117,10 @@ const state = reactive({
pageSize: 10, pageSize: 10,
total: 0 as any, total: 0 as any,
}, },
waitShowPrinter: false,
width: 0, // mm
editPrintTitle: '', editPrintTitle: '',
hiprintTemplate: {} as any,
}); });
// //
@ -112,23 +131,22 @@ const handleQuery = async () => {
state.printData = res.data.result?.items ?? []; state.printData = res.data.result?.items ?? [];
state.tableParams.total = res.data.result?.total; state.tableParams.total = res.data.result?.total;
state.loading = false; state.loading = false;
//console.log(state.printData)
}; };
// //
const queryUnitByGroupId = async (groupId:number|null|undefined) => { const queryUnitByGroupId = async (groupId:number) => {
state.loading = true; state.loading = true;
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId); var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
const units = res.data.result ?? []; const units = res.data.result ?? [];
unitListData.value=units state.unitData = units
console.log(units) //console.log(units)
}; };
//matterSubmit //matterSubmit
const printSubmit = () => { const printSubmit = () => {
console.log(printInfoFrom) console.log(printInfoFrom)
} }
const formInline = reactive({ const formInline = reactive({
@ -141,36 +159,34 @@ const onSubmit = () => {
console.log('submit!') console.log('submit!')
} }
//
const pageVO1 = reactive({ const openDialog = async (row: any) => {
currentPage: 1, if (row.id != undefined) {
pageSize: 30, state.matterFrom=row;
total: 8 printLabel(row);
})
const tableData = ref<MaterialsOutput[]>([]);
const MaterialsPage = async (data) => {
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
if (res.data.code === 200) {
pageVO1.total = res.data.result?.total!;
tableData.value = res.data.result?.items!;
} }
} state.isShowDialog = true;
};
//
const closeDialog = () => {
state.isShowDialog = false;
};
//printLabel //printLabel
const printLabel = (data:MaterialsOutput) => { const printLabel = (data:any) => {
const unitGroupId = data.unitgroupid const unitGroupId = data.unitGroupId
queryUnitByGroupId(unitGroupId) queryUnitByGroupId(unitGroupId)
dialogTableVisible.value = true;
} }
onMounted(() => { onMounted(() => {
MaterialsPage({});
handleQuery(); handleQuery();
}) })
//
defineExpose({ openDialog });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -20,7 +20,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <!-- <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="品牌"> <el-form-item label="品牌">
@ -29,7 +29,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row> -->
<el-form-item> <el-form-item>
@ -62,23 +62,21 @@
</div> </div>
</div> </div>
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" @handleQuery="handleQuery" /> <EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts" name="materialPrinting">
import { onMounted, reactive,ref } from 'vue' import { onMounted, reactive,ref } from 'vue'
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api'; import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api';
import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models'; import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models';
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus'; import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus';
import EditAccess from '/@/views/labelPrinting/materialPrinting/index.vue'; import EditAccess from '/@/views/labelPrinting/materialPrinting/component/editAccess.vue';
const editOpenAccessRef = ref<InstanceType<typeof EditAccess>>(); const editOpenAccessRef = ref<InstanceType<typeof EditAccess>>();
let dialogTableVisible = ref(false);
const mTitle='标签打印'
const fyListData=ref([]);
const unitListData=ref<SysUnitOutput[]>([]); const unitListData=ref<SysUnitOutput[]>([]);
const tableData = ref<MaterialsOutput[]>([]);
//printInfoFrom //printInfoFrom
const printInfoFrom = reactive({ const printInfoFrom = reactive({
name: '', name: '',
@ -87,8 +85,8 @@ const printInfoFrom = reactive({
unit: '', unit: '',
packageUnit: 1, packageUnit: 1,
package: '', package: '',
productDate: Date, productDate: {} as Date,
loseDate: Date, loseDate: {} as Date,
batch:1, batch:1,
}) })
@ -107,6 +105,14 @@ const state = reactive({
editPrintTitle: '', editPrintTitle: '',
}); });
//printLabel
const printLabel = (row:any) => {
const unitGroupId = row.unitGroupId
queryUnitByGroupId(unitGroupId)
state.editOpenAccessTitle = '打印信息';
editOpenAccessRef.value?.openDialog(row);
}
// //
const handleQuery = async () => { const handleQuery = async () => {
state.loading = true; state.loading = true;
@ -118,7 +124,7 @@ const handleQuery = async () => {
}; };
// //
const queryUnitByGroupId = async (groupId:number|null|undefined) => { const queryUnitByGroupId = async (groupId:number) => {
state.loading = true; state.loading = true;
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId); var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
const units = res.data.result ?? []; const units = res.data.result ?? [];
@ -127,13 +133,6 @@ const queryUnitByGroupId = async (groupId:number|null|undefined) => {
}; };
//matterSubmit
const printSubmit = () => {
console.log(printInfoFrom)
}
const formInline = reactive({ const formInline = reactive({
user: '', user: '',
region: '', region: '',
@ -151,9 +150,8 @@ const pageVO1 = reactive({
total: 8 total: 8
}) })
const tableData = ref<MaterialsOutput[]>([]);
const MaterialsPage = async (data) => { const MaterialsPage = async () => {
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline }); let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
if (res.data.code === 200) { if (res.data.code === 200) {
pageVO1.total = res.data.result?.total!; pageVO1.total = res.data.result?.total!;
@ -161,15 +159,10 @@ const MaterialsPage = async (data) => {
} }
} }
//printLabel
const printLabel = (data:MaterialsOutput) => {
const unitGroupId = data.unitgroupid
queryUnitByGroupId(unitGroupId)
dialogTableVisible.value = true;
}
onMounted(() => { onMounted(() => {
MaterialsPage({}); MaterialsPage();
handleQuery(); handleQuery();
}) })