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")]
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 =>
u.Name.Contains(input.SearchKey.Trim())
|| u.CodeNum.Contains(input.SearchKey.Trim())

View File

@ -84,7 +84,7 @@
<el-tab-pane label="单位信息" name="单位信息">
<el-row>
<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-option v-for="item in state.unitGroupData" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
@ -123,10 +123,9 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="销售单位">
<el-select v-model="state.matterFrom.saleUnit" placeholder="请选择" clearable>
<el-option label="袋" value="袋" />
<el-option label="箱" value="箱" />
<el-form-item label="销售单位" prop="saleUnit" :rules="[{ required: true, message: '销售单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.saleUnit" 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-col>
@ -134,10 +133,9 @@
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="分销单位">
<el-select v-model="state.matterFrom.retailStoreUnit" placeholder="请选择" clearable>
<el-option label="袋" value="袋" />
<el-option label="箱" value="箱" />
<el-form-item label="分销单位" prop="retailStoreUnit" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-select v-model="state.matterFrom.retailStoreUnit" 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-col>
@ -243,6 +241,8 @@ const openDialog = async (row: any) => {
state.matterFrom=row;
//var resRole = await getAPI(MaterialsApi).apiMaterialsDetailGet(row.id);
//state.ruleForm.roleIdList = resRole.data.result;
}else{
state.matterFrom.isEnable=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[])
const getPackageInfoApi = async (id: number) => {

View File

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

View File

@ -1,13 +1,12 @@
<template>
<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-row>
<el-col :span="8">
<el-form-item label="打印模板">
<el-select v-model="printInfoFrom.printData" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item" v-for="item, index in state.printData"
:key="index" />
<el-form-item label="打印模板" prop="unit" :rules="[{ required: true, message: '打印模板不能为空', trigger: 'blur' }]">
<el-select v-model="printInfoFrom.printData" placeholder="打印模板" filterable default-first-option style="width: 100%">
<el-option v-for="item in state.printData" :key="item.id" :label="item.name" :value="item" />
</el-select>
</el-form-item>
</el-col>
@ -17,24 +16,25 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位">
<el-select v-model="printInfoFrom.unit" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in unitListData"
:key="index" />
<el-form-item label="单位" prop="unit" :rules="[{ required: true, message: '基本单位不能为空', trigger: 'blur' }]">
<el-select v-model="printInfoFrom.unit" 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-col>
</el-row>
<el-row>
<el-col :span="8">
<!-- <el-col :span="8">
<el-form-item label="包装单位">
<el-input v-model="printInfoFrom.packageUnit" placeholder="请输入" clearable />
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="8">
<el-form-item label="包装">
<el-input v-model="printInfoFrom.package" placeholder="请输入" clearable />
<el-form-item label="包装" prop="package" :rules="[{ required: true, message: '包装不能为空', trigger: 'blur' }]">
<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-col>
</el-row>
@ -59,7 +59,7 @@
</el-form>
<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-row>
</el-dialog>
@ -72,11 +72,24 @@ import { getAPI } from '/@/utils/axios-utils';
import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api';
import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models';
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
const printInfoFrom = reactive({
name: '',
@ -85,14 +98,17 @@ const printInfoFrom = reactive({
unit: '',
packageUnit: 1,
package: '',
productDate: Date,
loseDate: Date,
productDate: {} as Date,
loseDate: {} as Date,
batch:1,
})
const state = reactive({
loading: false,
isShowDialog:false,
matterFrom: {} as MaterialsOutput,
printData: [] as Array<SysPrint>,
unitData: [] as Array<SysUnitOutput>,
queryParams: {
name: undefined,
},
@ -101,7 +117,10 @@ const state = reactive({
pageSize: 10,
total: 0 as any,
},
waitShowPrinter: false,
width: 0, // mm
editPrintTitle: '',
hiprintTemplate: {} as any,
});
//
@ -112,23 +131,22 @@ const handleQuery = async () => {
state.printData = res.data.result?.items ?? [];
state.tableParams.total = res.data.result?.total;
state.loading = false;
//console.log(state.printData)
};
//
const queryUnitByGroupId = async (groupId:number|null|undefined) => {
const queryUnitByGroupId = async (groupId:number) => {
state.loading = true;
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
const units = res.data.result ?? [];
unitListData.value=units
console.log(units)
state.unitData = units
//console.log(units)
};
//matterSubmit
const printSubmit = () => {
console.log(printInfoFrom)
}
const formInline = reactive({
@ -141,36 +159,34 @@ const onSubmit = () => {
console.log('submit!')
}
const pageVO1 = reactive({
currentPage: 1,
pageSize: 30,
total: 8
})
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!;
//
const openDialog = async (row: any) => {
if (row.id != undefined) {
state.matterFrom=row;
printLabel(row);
}
}
state.isShowDialog = true;
};
//
const closeDialog = () => {
state.isShowDialog = false;
};
//printLabel
const printLabel = (data:MaterialsOutput) => {
const unitGroupId = data.unitgroupid
const printLabel = (data:any) => {
const unitGroupId = data.unitGroupId
queryUnitByGroupId(unitGroupId)
dialogTableVisible.value = true;
}
onMounted(() => {
MaterialsPage({});
handleQuery();
})
//
defineExpose({ openDialog });
</script>
<style lang="scss" scoped>

View File

@ -20,7 +20,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-row>
<el-col :span="8">
<el-form-item label="品牌">
@ -29,7 +29,7 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-form-item>
@ -62,23 +62,21 @@
</div>
</div>
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" @handleQuery="handleQuery" />
<EditAccess ref="editOpenAccessRef" :title="state.editOpenAccessTitle" />
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="materialPrinting">
import { onMounted, reactive,ref } from 'vue'
import { getAPI } from '/@/utils/axios-utils';
import { SysUnitApi, MaterialsApi, SysPrintApi } from '/@/api-services/api';
import { SysUnitOutput, MaterialsOutput, SysPrint } from '/@/api-services/models';
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>>();
let dialogTableVisible = ref(false);
const mTitle='标签打印'
const fyListData=ref([]);
const unitListData=ref<SysUnitOutput[]>([]);
const tableData = ref<MaterialsOutput[]>([]);
//printInfoFrom
const printInfoFrom = reactive({
name: '',
@ -87,8 +85,8 @@ const printInfoFrom = reactive({
unit: '',
packageUnit: 1,
package: '',
productDate: Date,
loseDate: Date,
productDate: {} as Date,
loseDate: {} as Date,
batch:1,
})
@ -107,6 +105,14 @@ const state = reactive({
editPrintTitle: '',
});
//printLabel
const printLabel = (row:any) => {
const unitGroupId = row.unitGroupId
queryUnitByGroupId(unitGroupId)
state.editOpenAccessTitle = '打印信息';
editOpenAccessRef.value?.openDialog(row);
}
//
const handleQuery = async () => {
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;
var res = await getAPI(SysUnitApi).apiSysUnitListUnitGroupIdGet(groupId);
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({
user: '',
region: '',
@ -151,9 +150,8 @@ const pageVO1 = reactive({
total: 8
})
const tableData = ref<MaterialsOutput[]>([]);
const MaterialsPage = async (data) => {
const MaterialsPage = async () => {
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
if (res.data.code === 200) {
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(() => {
MaterialsPage({});
MaterialsPage();
handleQuery();
})