Compare commits

..

No commits in common. "755dba17cf6dcd688d44ffc1abeefae5ecdfa66e" and "3a62efa2640bae6e56ee0b49cd83a7db700e5aaa" have entirely different histories.

13 changed files with 800 additions and 990 deletions

View File

@ -259,34 +259,3 @@ public class QueryByIdMaterialsInput : DeleteMaterialsInput
{ {
} }
/// <summary>
///
/// </summary>
public class MaterialsUnitInput : MaterialsBaseInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
}
/// <summary>
///
/// </summary>
public class MaterialsUnitGetInput
{
/// <summary>
/// 单位组ID
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public virtual long UnitGroupId { get; set; }
/// <summary>
/// 基本单位
/// </summary>
public virtual string Unit { get; set; }
}

View File

@ -166,15 +166,5 @@ public class MaterialsService : IDynamicApiController, ITransient
return model!=null?true:false; return model!=null?true:false;
} }
[HttpPost]
[ApiDescriptionSettings(Name = "GetMaterialsList")]
public async Task<List<Materials>> GetMaterialsList(MaterialsUnitGetInput input)
{
var list = await _rep.AsQueryable().Where(a => !a.IsDelete)
.WhereIF(input.UnitGroupId>0, u => u.UnitGroupId == input.UnitGroupId)
.WhereIF(!string.IsNullOrWhiteSpace(input.Unit), u => u.Unit.Equals(input.Unit))
.ToListAsync();
return list;
}
} }

View File

@ -224,21 +224,3 @@ public class QueryByIdSysUnitInput : DeleteSysUnitInput
{ {
} }
/// <summary>
/// 更新单位状态
/// </summary>
public class UpdateSysUnitEnableInput
{
/// <summary>
/// 主键Id
/// </summary>
[Required(ErrorMessage = "主键Id不能为空")]
public string Ids { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; }
}

View File

@ -4,7 +4,6 @@ using Admin.NET.Application.Entity;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Mvc.ViewFeatures;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Nest;
namespace Admin.NET.Application; namespace Admin.NET.Application;
/// <summary> /// <summary>
/// 单位服务 /// 单位服务
@ -13,8 +12,6 @@ namespace Admin.NET.Application;
public class SysUnitService : IDynamicApiController, ITransient public class SysUnitService : IDynamicApiController, ITransient
{ {
private readonly SqlSugarRepository<SysUnit> _rep; private readonly SqlSugarRepository<SysUnit> _rep;
public SysUnitService(SqlSugarRepository<SysUnit> rep) public SysUnitService(SqlSugarRepository<SysUnit> rep)
{ {
_rep = rep; _rep = rep;
@ -194,19 +191,41 @@ public class SysUnitService : IDynamicApiController, ITransient
} }
/// <summary> /// <summary>
/// 修改单位启用禁用状态 /// 生成编码
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpGet]
[ApiDescriptionSettings(Name = "updateBaseUnitEnable")] [ApiDescriptionSettings(Name = "createCodeNum")]
public async Task UpdateBaseUnitEnable(UpdateSysUnitEnableInput input) public async Task<string> CreateCodeNum()
{ {
foreach (var id in input.Ids.Split(",")) string dt = DateTime.Now.ToString("yyyyMMdd");
var unit = await _rep.AsQueryable()
.Where(a => !a.IsDelete)
.Where(a => a.CodeNum.Contains(dt))
.OrderByDescending(t => t.CodeNum)
.FirstAsync();
if (unit != null)
{ {
var entity = _rep.GetById(id); Match match = Regex.Match(unit.CodeNum, @"\d+");
entity.IsEnable = input.IsEnable; if (match.Success)
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); {
string numberStr = match.Value; // 获取匹配到的数字字符串
int number = int.Parse(numberStr); // 将数字字符串转换为整数
number++; // 对数字进行加1操作
// 将结果转换回字符串,并保持与原数字相同的长度
string paddedNumber = number.ToString().PadLeft(match.Value.Length, '0');
return paddedNumber;
}
else
{
return dt + "001";
}
}
else
{
return dt + "001";
} }
} }
} }

View File

@ -25,7 +25,6 @@ import { AdminResultSysUnit } from '../models';
import { DeleteSysUnitInput } from '../models'; import { DeleteSysUnitInput } from '../models';
import { SysUnitInput } from '../models'; import { SysUnitInput } from '../models';
import { UpdateSysUnitInput } from '../models'; import { UpdateSysUnitInput } from '../models';
import {UpdateSysUnitEnableInput} from "/@/api-services/models/update-sys-unit-enable-input";
/** /**
* SysUnitApi - axios parameter creator * SysUnitApi - axios parameter creator
* @export * @export
@ -411,54 +410,6 @@ export const SysUnitApiAxiosParamCreator = function (configuration?: Configurati
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
*
* @summary
* @param {UpdateSysUnitInput} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
apiSysUnitUpdateEnablePost: async (body?: UpdateSysUnitEnableInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/sysUnit/updateBaseUnitEnable`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication Bearer required
// http bearer authentication required
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
}
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
return { return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions, options: localVarRequestOptions,
@ -583,19 +534,6 @@ export const SysUnitApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
}; };
}, },
/**
*
* @summary
* @param body
* @param options
*/
async apiSysUnitUpdateEnablePost(body?: UpdateSysUnitEnableInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
const localVarAxiosArgs = await SysUnitApiAxiosParamCreator(configuration).apiSysUnitUpdateEnablePost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
} }
}; };
@ -779,14 +717,4 @@ export class SysUnitApi extends BaseAPI {
async apiSysUnitCheckPost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> { async apiSysUnitCheckPost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
return SysUnitApiFp(this.configuration).apiSysUnitCheckPost(body, options).then((request) => request(this.axios, this.basePath)); return SysUnitApiFp(this.configuration).apiSysUnitCheckPost(body, options).then((request) => request(this.axios, this.basePath));
} }
/**
*
* @param body
* @param options
*/
async apiSysUnitUpdateEnablePost(body?: UpdateSysUnitEnableInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
return SysUnitApiFp(this.configuration).apiSysUnitUpdateEnablePost(body, options).then((request) => request(this.axios, this.basePath));
}
} }

View File

@ -1,38 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* .NET (.NET6/Vue3)沿
*
* 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 UpdateSysUnitInput
*/
export interface UpdateSysUnitEnableInput {
/**
* ID
*
* @type {number}
* @memberof UpdateSysUnitInput
*/
isEnable: boolean;
/**
* Id
*
* @type {number}
* @memberof UpdateSysUnitInput
*/
ids: string;
}

View File

@ -8,7 +8,6 @@ enum Api {
ListMaterials = '/api/materials/list', ListMaterials = '/api/materials/list',
MtListBySourceId = '/api/materialList/listBySourceId', MtListBySourceId = '/api/materialList/listBySourceId',
CheckMaterials = '/api/materials/CheckById', CheckMaterials = '/api/materials/CheckById',
GetMaterialsList = '/api/materials/GetMaterialsList',
} }
// 增加物料 // 增加物料
@ -73,12 +72,4 @@ export const materialListBySourceId = (sourceId: any) =>
url: Api.MtListBySourceId, url: Api.MtListBySourceId,
method: 'get', method: 'get',
data: { sourceId }, data: { sourceId },
}); });
// 获取物料集合
export const listMaterialByUnit = (unitGroupId: any,unit:any) =>
request({
url: Api.GetMaterialsList,
method: 'post',
data: { UnitGroupId:unitGroupId,Unit:unit },
});

View File

@ -1,164 +1,171 @@
<!-- 物料 --> <!-- 物料 -->
<template> <template>
<div class="sys-open-access-container"> <div class="sys-open-access-container">
<el-dialog v-model="state.isShowDialog" :title="props.title" width="1000"> <el-dialog v-model="state.isShowDialog" :title="props.title" width="1000">
<el-form :inline="true" :model="ruleForm" class="demo-form-inline" label-width="90px"> <el-form ref="ruleFormRef" :inline="true" :model="ruleForm" class="demo-form-inline" label-width="90px">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="物料类型" :rules="[{ required: true, message: '物料类型不能为空', trigger: 'blur' }]"> <el-form-item label="物料类型" :rules="[{ required: true, message: '物料类型不能为空', trigger: 'blur' }]">
<el-input v-model="ruleForm.name" placeholder="请输入名称" clearable maxlength="32" /> <el-input v-model="ruleForm.name" placeholder="请输入名称" clearable maxlength="32"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-row style="display: flex; justify-content: space-around;"> <template #footer>
<el-button style="width: 100px;" type="primary" @click="matterSubmit"></el-button> <span class="dialog-footer">
<el-button style="width: 100px;" @click="closeDialog"></el-button> <el-button style="width: 100px;" type="primary" @click="matterSubmit"></el-button>
</el-row> <el-button style="width: 100px;" @click="closeDialog"></el-button>
</el-dialog> </span>
</div> </template>
</el-dialog>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
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 { BrandApi, MaterialClassifyApi, PackageInfoApi, SysUnitGroupApi,SysUnitApi } from '/@/api-services/api'; import {
import { AddMaterialsInput, BrandOutput, MaterialsOutput, PackageInfoOutput, SysUnitGroupOutput, SysUnitOutput} from '/@/api-services/models'; MaterialClassifyApi,
import { ElMessageBox, ElMessage, TabsPaneContext } from 'element-plus'; } from '/@/api-services/api';
import { addMaterials, updateMaterials,detailMaterials } from '/@/api/main/materials'; import {
import { listUnitGroup } from '/@/api/main/unit'; MaterialsOutput,
SysUnitGroupOutput,
SysUnitOutput, UpdateMaterialClassifyInput
} from '/@/api-services/models';
import {ElMessageBox, ElMessage, TabsPaneContext} from 'element-plus';
import {addMaterialsClassify, detailMaterialsClassify, updateMaterialsClassify} from "/@/api/main/materialClassify"; import {addMaterialsClassify, detailMaterialsClassify, updateMaterialsClassify} from "/@/api/main/materialClassify";
const props = defineProps({ const props = defineProps({
title: String, title: String,
orgData: Array<MaterialsOutput>, orgData: Array<MaterialsOutput>,
}); });
// //
const emit = defineEmits(["reloadTable"]); const emit = defineEmits(["reloadTable"]);
// //
let fyListData = ref(); let fyListData = ref();
const fyListGet = async () => { const fyListGet = async () => {
let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet(); let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet();
if (res.data.code === 200) { if (res.data.code === 200) {
fyListData.value = res.data.result; fyListData.value = res.data.result;
} }
} }
const ruleFormRef = ref();
const ruleForm = ref<any>({});
const state = reactive({ const state = reactive({
loading: false, loading: false,
isShowDialog:false, isShowDialog: false,
editClassifyOpenAccessTitle:'新增', editClassifyOpenAccessTitle: '新增',
tableData: [] ,//as Array<MaterialsOutput> tableData: [],//as Array<MaterialsOutput>
orgTreeData: [] ,//as Array<MaterialsOutput> orgTreeData: [],//as Array<MaterialsOutput>
//matterFrom: {} ,//as AddMaterialsInput //matterFrom: {} ,//as AddMaterialsInput
queryParams: { queryParams: {
name: undefined, name: undefined,
}, },
tableParams: { tableParams: {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0 as any, total: 0 as any,
}, },
editPrintTitle: '', editPrintTitle: '',
unitGroupData:[] as Array<SysUnitGroupOutput>, unitGroupData: [] as Array<SysUnitGroupOutput>,
unitData:[] as Array<SysUnitOutput>, unitData: [] as Array<SysUnitOutput>,
ruleForm: {} as UpdateMaterialClassifyInput,
}); });
// //
const openDialog = async (row: any) => { const openDialog = async (row: any) => {
//ruleFormRef.value?.resetFields(); ruleFormRef.value?.resetFields();
//state.selectedTabName = '0'; // tab //state.selectedTabName = '0'; // tab
let rowData = JSON.parse(JSON.stringify(row)); let rowData = JSON.parse(JSON.stringify(row));
if (rowData.id) if (rowData.id)
ruleForm.value = (await detailMaterialsClassify(rowData.id)).data.result; state.ruleForm = (await detailMaterialsClassify(rowData.id)).data.result;
else{ else {
ruleForm.value = rowData; state.ruleForm = rowData;
ruleForm.value.isEnable=true; }
} state.isShowDialog = true;
state.isShowDialog = true;
}; };
// //
const closeDialog = () => { const closeDialog = () => {
state.isShowDialog = false; state.isShowDialog = false;
}; };
onMounted(() => { onMounted(() => {
fyListGet(); fyListGet();
}); });
// //
const matterSubmit = async () => { const matterSubmit = () => {
ruleFormRef.value.validate(async (valid: boolean) => {
if (!valid) return;
let res; let res;
if (props.title=='添加物料类型'){ if (props.title == '添加物料类型') {
res = await addMaterialsClassify(ruleForm.value); res = await addMaterialsClassify(state.ruleForm);
} } else {
else { res = await updateMaterialsClassify(state.ruleForm);
res = await updateMaterialsClassify(ruleForm.value);
} }
//console.log(res) //console.log(res)
if (res.data.code == 200) { if (res.data.code == 200) {
state.isShowDialog = false; state.isShowDialog = false;
ElMessage({ ElMessage({
message: '成功', message: '成功',
type: 'success', type: 'success',
}) })
//state.tableData.handleList(); //state.tableData.handleList();
} } else
else ElMessage.error(res.message!)
ElMessage.error(res.message!)
emit("reloadTable"); emit("reloadTable");
closeDialog(); closeDialog();
});
} }
// //
defineExpose({ openDialog }); defineExpose({openDialog});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main { .main {
padding: 10px;
display: flex;
flex-direction: column;
.main-from {
// height: 300px;
width: 100%;
padding: 20px 10px;
.el-row {
width: 100%;
}
}
.main-table {
margin-top: 20px;
box-sizing: border-box;
padding: 10px; padding: 10px;
flex-grow: 1;
height: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.main-from { .tab {
// height: 300px; flex: 1;
width: 100%; overflow: scroll;
padding: 20px 10px;
.el-row {
width: 100%;
}
} }
.main-table { .tab-hed {
margin-top: 20px; display: flex;
box-sizing: border-box; justify-content: space-between;
padding: 10px; margin: 5px;
flex-grow: 1; align-items: center;
height: 0;
display: flex;
flex-direction: column;
.tab {
flex: 1;
overflow: scroll;
}
.tab-hed {
display: flex;
justify-content: space-between;
margin: 5px;
align-items: center;
}
} }
}
} }
</style> </style>

View File

@ -2,11 +2,11 @@
<template> <template>
<div class="sys-open-access-container"> <div class="sys-open-access-container">
<el-dialog v-model="state.isShowDialog" :title="props.title" width="1000"> <el-dialog v-model="state.isShowDialog" :title="props.title" width="1000">
<el-form ref="ruleFormRef" :inline="true" :model="ruleForm" class="demo-form-inline" label-width="90px"> <el-form :inline="true" :model="ruleForm" class="demo-form-inline" label-width="90px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="name" label="名称" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]"> <el-form-item label="名称" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-input v-model="ruleForm.name" placeholder="请输入名称" clearable /> <el-input v-model="ruleForm.name" placeholder="请输入名称" clearable />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -16,7 +16,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="classify" label="分类" :rules="[{ required: true, message: '分不能为空', trigger: 'blur' }]"> <el-form-item label="分类" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
<el-select v-model="ruleForm.classify" placeholder="请选择" clearable> <el-select v-model="ruleForm.classify" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData" <el-option :label="item.name" :value="item.id" v-for="item, index in fyListData"
:key="index" /> :key="index" />
@ -178,20 +178,6 @@
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="操作信息" name="操作信息">
<el-row>
<el-col :span="8">
<el-form-item label="创建人" >
<el-input v-model="ruleForm.createUserName" disabled clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="修改人" >
<el-input v-model="ruleForm.updateUserName" disabled clearable />
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-form> </el-form>
<el-row style="display: flex; justify-content: space-around;"> <el-row style="display: flex; justify-content: space-around;">
@ -229,7 +215,7 @@ const fyListGet = async () => {
} }
const ruleForm = ref<any>({}); const ruleForm = ref<any>({});
const ruleFormRef = ref();
const state = reactive({ const state = reactive({
loading: false, loading: false,
isShowDialog:false, isShowDialog:false,
@ -252,8 +238,8 @@ const state = reactive({
// //
const openDialog = async (row: any) => { const openDialog = async (row: any) => {
ruleFormRef.value?.resetFields(); //ruleFormRef.value?.resetFields();
state.selectedTabName = '0'; // tab //state.selectedTabName = '0'; // tab
let rowData = JSON.parse(JSON.stringify(row)); let rowData = JSON.parse(JSON.stringify(row));
if (rowData.id) if (rowData.id)
ruleForm.value = (await detailMaterials(rowData.id)).data.result; ruleForm.value = (await detailMaterials(rowData.id)).data.result;
@ -321,28 +307,26 @@ const handleClick = (tab: TabsPaneContext, event: Event) => {
// //
const matterSubmit = async () => { const matterSubmit = async () => {
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => { let res;
if (isValid) { if (props.title=='添加物料'){
let res;
if (props.title == '添加物料') {
res = await addMaterials(ruleForm.value); res = await addMaterials(ruleForm.value);
} else { }
else {
res = await updateMaterials(ruleForm.value); res = await updateMaterials(ruleForm.value);
} }
//console.log(res) //console.log(res)
if (res.data.code == 200) { if (res.data.code == 200) {
state.isShowDialog = false; state.isShowDialog = false;
ElMessage({ ElMessage({
message: '成功', message: '成功',
type: 'success', type: 'success',
}) })
//state.tableData.handleList(); //state.tableData.handleList();
} else
ElMessage.error(res.message!)
closeDialog();
} }
}); else
ElMessage.error(res.message!)
closeDialog();
} }

View File

@ -124,8 +124,6 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="remarks" label="备注" width="200" show-overflow-tooltip="" /> <el-table-column prop="remarks" label="备注" width="200" show-overflow-tooltip="" />
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip=""/>
<el-table-column prop="updateTime" label="修改时间" show-overflow-tooltip=""/>
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')"> <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')">
<template #default="scope"> <template #default="scope">
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditMaterials(scope.row)" v-auth="'materials:update'"> </el-button> <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditMaterials(scope.row)" v-auth="'materials:update'"> </el-button>

View File

@ -1,388 +1,402 @@
<template> <template>
<div class="main"> <div class="main">
<div class="main-from common-box"> <div class="main-from common-box">
<el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="70px"> <el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="70px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="名称"> <el-form-item label="名称">
<el-input v-model="formInline.name" placeholder="请输入名称" clearable /> <el-input v-model="formInline.name" 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="编码">
<el-input v-model="formInline.codeNum" placeholder="请输入编码" clearable /> <el-input v-model="formInline.codeNum" placeholder="请输入编码" clearable/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-form-item> <el-form-item>
<el-button type="primary" @click="unitPage({groupUnitId:data.selectUnitGroupId})"></el-button> <el-button type="primary" @click="unitPage({groupUnitId:data.selectUnitGroupId})"></el-button>
<el-button type="primary" @click="addUnit"></el-button> <el-button type="primary" @click="addUnit"></el-button>
<el-button @click="''"></el-button> <el-button @click="''"></el-button>
<el-button @click="''"></el-button> <el-button @click="''"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div>
<div class="main-table common-box">
<div class="tab-left">
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>
单位组
</div>
<div>
<el-button type="success" link
@click.prevent="addUnitGroup"
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">
新增
</el-button>
</div>
</div> </div>
<div style="height: 100%;">
<vxe-table show-overflow height="100%" :data="data.unitGroup" :border=true
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }" @radio-change="radioChangeEvent">
<vxe-column type="radio" title="单选" width="60" fixed="left">
</vxe-column>
<div class="main-table common-box"> <vxe-column field="name" sortable title="名称" width=""></vxe-column>
<div class="tab-left">
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>
单位组
</div>
<div>
<el-button type="success" link
@click.prevent="addUnitGroup"
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">新增</el-button>
</div>
</div>
<div style="height: 100%;">
<vxe-table show-overflow height="100%" :data="data.unitGroup" :border=true
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }" @radio-change="radioChangeEvent">
<vxe-column type="radio" title="单选" width="60" fixed="left">
</vxe-column>
<vxe-column field="name" sortable title="名称" width=""></vxe-column>
<vxe-column title="状态" width="" fixed="right" show-overflow>
<template #default="{ row }">
{{ row.isEnable ? '启用' : '关闭' }}
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template>
</vxe-column>
<vxe-column title="操作" width="150" fixed="right" show-overflow>
<template #default="{ row }">
<vxe-button type="text" @click="editUnitGroup(row)" icon="vxe-icon-edit">修改</vxe-button>
<vxe-button type="text" @click="deleteUnitGroup(row)" icon="vxe-icon-delete" style="color: rgb(223, 65, 65)">删除</vxe-button>
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template>
</vxe-column>
</vxe-table>
</div>
</div>
<div class="tab" style="overflow: hidden;margin-top:29px">
<div>
<el-table
ref="multipleTableRef"
:data="data.unit"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
border="">
<el-table-column type="selection" width="60" />
<el-table-column prop="codeNum" label="编码" show-overflow-tooltip="" />
<el-table-column prop="name" label="名称" show-overflow-tooltip="" />
<el-table-column prop="code" label="代码" show-overflow-tooltip="" />
<el-table-column prop="isEnable" label="可用状态" show-overflow-tooltip="">
<template #default="scope">
{{ scope.row.isEnable ? '启用' : '关闭' }}
</template>
</el-table-column>
<el-table-column prop="childUnitCount" label="子单位数" show-overflow-tooltip="" />
<el-table-column prop="rate" label="换算率" show-overflow-tooltip="" />
<el-table-column prop="isEnable" label="作为基本单位" show-overflow-tooltip="">
<template #default="scope">
{{ scope.row.isBaseUnit ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip="" />
<el-table-column prop="updateTime" label="修改时间" show-overflow-tooltip="" />
<el-table-column width="200" label="操作"align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')">
<template #default="scope">
<vxe-button type="text" @click="editUnit(scope.row)" icon="vxe-icon-edit">修改</vxe-button>
<vxe-button type="text" @click="deleteUnit(scope.row)" icon="vxe-icon-delete" style="color: rgb(223, 65, 65)">删除</vxe-button>
</template>
</el-table-column>
</el-table>
<!-- <vxe-table show-overflow height="100%" :data="data.unit" :border=true-->
<!-- :tree-config="{ transform: true }" :scroll-y="{ gt: 20 }">-->
<!-- <vxe-column type="checkbox" width="60" fixed="left"></vxe-column>-->
<!-- <vxe-column field="codeNum" sortable title="编码" width=""></vxe-column>-->
<!-- <vxe-column field="name" sortable title="名称" width=""></vxe-column>-->
<!-- <vxe-column field="code" sortable title="代码" width=""></vxe-column>-->
<!-- <vxe-column sortable title="可用状态" width="">-->
<!-- <template #default="{ row }">-->
<!-- {{ row.isEnable ? '启用' : '关闭' }}-->
<!-- &lt;!&ndash; <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> &ndash;&gt;-->
<!-- </template>-->
<!-- </vxe-column>-->
<!-- <vxe-column field="childUnitCount" sortable title="子单位数" width=""></vxe-column>-->
<!-- <vxe-column field="rate" sortable title="换算率" width=""></vxe-column>-->
<!-- <vxe-column field="isBaseUnit" sortable title="作为基本单位" width="">-->
<!-- <template #default="{ row }">-->
<!-- {{ row.isBaseUnit ? '是' : '否' }}-->
<!-- &lt;!&ndash; <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> &ndash;&gt;-->
<!-- </template>-->
<!-- </vxe-column>-->
<!-- <vxe-column title="操作" width="200" fixed="right" show-overflow>-->
<!-- <template #default="{ row }">-->
<!-- <vxe-button type="text" @click="editUnit(row)" icon="vxe-icon-edit">修改</vxe-button>-->
<!-- <vxe-button type="text" @click="deleteUnit(row)" icon="vxe-icon-delete" style="color: rgb(223, 65, 65)">删除</vxe-button>-->
<!-- &lt;!&ndash; <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> &ndash;&gt;-->
<!-- </template>-->
<!-- </vxe-column>-->
<!-- </vxe-table>-->
</div>
<div style="line-height: 35px">
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
</div>
<!-- <div>-->
<!-- <vxe-pager v-model:current-page="pageVO1.currentPage" v-model:page-size="pageVO1.pageSize"-->
<!-- :total="pageVO1.total" />-->
<!-- </div>-->
</div>
<vxe-column title="状态" width="" fixed="right" show-overflow>
<template #default="{ row }">
{{ row.isEnable ? '启用' : '关闭' }}
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template>
</vxe-column>
<vxe-column title="操作" width="150" fixed="right" show-overflow>
<template #default="{ row }">
<vxe-button type="text" @click="editUnitGroup(row)" icon="vxe-icon-edit">修改</vxe-button>
<vxe-button type="text" @click="deleteUnitGroup(row)" icon="vxe-icon-delete"
style="color: rgb(223, 65, 65)">删除
</vxe-button>
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template>
</vxe-column>
</vxe-table>
</div> </div>
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="860"> </div>
<el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="80px"> <div class="tab" style="overflow: hidden;margin-top:29px">
<el-row> <div>
<el-table
ref="multipleTableRef"
:data="data.unit"
style="width: 100%"
v-loading="loading"
tooltip-effect="light"
row-key="id"
border="">
<el-table-column type="selection" width="60"/>
<el-table-column prop="codeNum" label="编码" show-overflow-tooltip=""/>
<el-table-column prop="name" label="名称" show-overflow-tooltip=""/>
<el-table-column prop="code" label="代码" show-overflow-tooltip=""/>
<el-table-column prop="isEnable" label="可用状态" show-overflow-tooltip="">
<template #default="scope">
{{ scope.row.isEnable ? '启用' : '关闭' }}
</template>
</el-table-column>
<el-table-column prop="childUnitCount" label="子单位数" show-overflow-tooltip=""/>
<el-table-column prop="rate" label="换算率" show-overflow-tooltip=""/>
<el-table-column prop="isEnable" label="作为基本单位" show-overflow-tooltip="">
<template #default="scope">
{{ scope.row.isBaseUnit ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip=""/>
<el-table-column prop="updateTime" label="修改时间" show-overflow-tooltip=""/>
<el-table-column width="200" label="操作" align="center" fixed="right" show-overflow-tooltip=""
v-if="auth('materials:update') || auth('materials:delete')">
<template #default="scope">
<vxe-button type="text" @click="editUnit(scope.row)" icon="vxe-icon-edit">修改</vxe-button>
<vxe-button type="text" @click="deleteUnit(scope.row)" icon="vxe-icon-delete"
style="color: rgb(223, 65, 65)">删除
</vxe-button>
</template>
</el-table-column>
</el-table>
<el-col :span="8">
<el-form-item label="名称" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.name" placeholder="请输入名称" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="编码" :rules="[{ required: true, message: '编码不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.codeNum" placeholder="请输入编码" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位组" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="unitFrom.groupUnitId" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in data.unitGroup"
:key="index" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="精度">
<el-input v-model="unitFrom.accuracy" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="子单位数" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.childUnitCount" placeholder="下级单位数量" clearable />
</el-form-item>
</el-col>
<el-col :span="8"> <!-- <vxe-table show-overflow height="100%" :data="data.unit" :border=true-->
<el-form-item label="换算率" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> <!-- :tree-config="{ transform: true }" :scroll-y="{ gt: 20 }">-->
<el-input v-model="unitFrom.rate" placeholder="基本单位数量" clearable /> <!-- <vxe-column type="checkbox" width="60" fixed="left"></vxe-column>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="代码">
<el-input v-model="unitFrom.code" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="外部编码">
<el-input v-model="unitFrom.externalNumber" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注">
<el-input v-model="unitFrom.remarks" placeholder="请输入" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="基本单位">
<el-switch v-model="unitFrom.isBaseUnit" inline-prompt active-text="" inactive-text="" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用">
<el-switch v-model="unitFrom.isEnable" inline-prompt active-text="" inactive-text="" />
</el-form-item>
</el-col>
</el-row>
</el-form> <!-- <vxe-column field="codeNum" sortable title="编码" width=""></vxe-column>-->
<el-row style="display: flex; justify-content: space-around;"> <!-- <vxe-column field="name" sortable title="名称" width=""></vxe-column>-->
<el-button style="width: 100px;" type="primary" @click="unitSubmit"></el-button> <!-- <vxe-column field="code" sortable title="代码" width=""></vxe-column>-->
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
</el-row>
</el-dialog>
<el-dialog v-model="isShowDialog" :title="mGroupTitle" ref="ruleFormRef" :width="800" > <!-- <vxe-column sortable title="可用状态" width="">-->
<template #header> <!-- <template #default="{ row }">-->
<div style="color: #fff"> <!-- {{ row.isEnable ? '启用' : '关闭' }}-->
<span>单位组</span> <!-- &lt;!&ndash; <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> &ndash;&gt;-->
</div> <!-- </template>-->
</template> <!-- </vxe-column>-->
<el-form :model="unitGroupModel" label-width="auto" :rules="rules"> <!-- <vxe-column field="childUnitCount" sortable title="子单位数" width=""></vxe-column>-->
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <!-- <vxe-column field="rate" sortable title="换算率" width=""></vxe-column>-->
<el-form-item label="名称" prop="name"> <!-- <vxe-column field="isBaseUnit" sortable title="作为基本单位" width="">-->
<el-input v-model="unitGroupModel.name" placeholder="请输入名称" maxlength="32" show-word-limit clearable /> <!-- <template #default="{ row }">-->
</el-form-item> <!-- {{ row.isBaseUnit ? '是' : '否' }}-->
</el-col> <!-- &lt;!&ndash; <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> &ndash;&gt;-->
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <!-- </template>-->
<el-form-item label="是否启用" prop="isEnable"> <!-- </vxe-column>-->
<el-switch v-model="unitGroupModel.isEnable" active-text="" inactive-text="" /> <!-- <vxe-column title="操作" width="200" fixed="right" show-overflow>-->
</el-form-item> <!-- <template #default="{ row }">-->
</el-col> <!-- <vxe-button type="text" @click="editUnit(row)" icon="vxe-icon-edit">修改</vxe-button>-->
</el-form> <!-- <vxe-button type="text" @click="deleteUnit(row)" icon="vxe-icon-delete" style="color: rgb(223, 65, 65)">删除</vxe-button>-->
<template #footer> <!-- &lt;!&ndash; <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> &ndash;&gt;-->
<!-- </template>-->
<!-- </vxe-column>-->
<!-- </vxe-table>-->
</div>
<div style="line-height: 35px">
<el-pagination
v-model:currentPage="tableParams.page"
v-model:page-size="tableParams.pageSize"
:total="tableParams.total"
:page-sizes="[10, 20, 50, 100, 200, 500]"
small=""
background=""
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
/>
</div>
<!-- <div>-->
<!-- <vxe-pager v-model:current-page="pageVO1.currentPage" v-model:page-size="pageVO1.pageSize"-->
<!-- :total="pageVO1.total" />-->
<!-- </div>-->
</div>
</div>
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="860">
<el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="80px">
<el-row>
<el-col :span="8">
<el-form-item label="名称" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.name" placeholder="请输入名称" clearable/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="编码" :rules="[{ required: true, message: '编码不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.codeNum" placeholder="请输入编码" clearable/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位组" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
<el-select v-model="unitFrom.groupUnitId" placeholder="请选择" clearable>
<el-option :label="item.name" :value="item.id" v-for="item, index in data.unitGroup"
:key="index"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="精度">
<el-input v-model="unitFrom.accuracy" placeholder="请输入" clearable/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="子单位数" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.childUnitCount" placeholder="下级单位数量" clearable/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="换算率" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-input v-model="unitFrom.rate" placeholder="基本单位数量" clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="代码">
<el-input v-model="unitFrom.code" placeholder="请输入" clearable/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="外部编码">
<el-input v-model="unitFrom.externalNumber" placeholder="请输入" clearable/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注">
<el-input v-model="unitFrom.remarks" placeholder="请输入" clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="基本单位">
<el-switch v-model="unitFrom.isBaseUnit" inline-prompt active-text="" inactive-text=""/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否启用">
<el-switch v-model="unitFrom.isEnable" inline-prompt active-text="" inactive-text=""/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row style="display: flex; justify-content: space-around;">
<el-button style="width: 100px;" type="primary" @click="unitSubmit"></el-button>
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
</el-row>
</el-dialog>
<div v-if="isShowDialog">
<el-dialog v-model="isShowDialog" :title="mGroupTitle" ref="ruleFormRef" :width="800">
<template #header>
<div style="color: #fff">
<span>单位组</span>
</div>
</template>
<el-form :model="unitGroupModel" label-width="auto" :rules="rules">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="名称" prop="name">
<el-input v-model="unitGroupModel.name" 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="isEnable">
<el-switch v-model="unitGroupModel.isEnable" active-text="" inactive-text=""/>
</el-form-item>
</el-col>
</el-form>
<template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button> <el-button type="primary" @click="submit"> </el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
</div> </div>
</div>
</template> </template>
<script setup lang="ts" name="sysUnit"> <script setup lang="ts" name="sysUnit">
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, SysUnitGroupApi } from '/@/api-services/api'; import {SysUnitApi, SysUnitGroupApi} from '/@/api-services/api';
import { AddSysUnitInput, SqlSugarPagedListSysUnitOutput, SysUnitGroupOutput, SysUnitInput} from '/@/api-services/models'; import {
import type { FormRules } from "element-plus"; AddSysUnitInput,
import { ElMessageBox, ElMessage } from 'element-plus'; SqlSugarPagedListSysUnitOutput,
SysUnitGroupOutput,
SysUnitInput
} from '/@/api-services/models';
import type {FormRules} from "element-plus";
import {ElMessageBox, ElMessage} from 'element-plus';
import {auth} from "/@/utils/authFunction"; import {auth} from "/@/utils/authFunction";
let data = reactive({ let data = reactive({
unit: [] as SqlSugarPagedListSysUnitOutput[],// unit: [] as SqlSugarPagedListSysUnitOutput[],//
unitGroup: [] as SysUnitGroupOutput[],// unitGroup: [] as SysUnitGroupOutput[],//
selectUnitGroupId:0, selectUnitGroupId: 0,
}); });
const loading = ref(false); const loading = ref(false);
const ruleFormRef = ref(); const ruleFormRef = ref();
const isShowDialog=ref(false); const isShowDialog = ref(false);
const tableParams = ref({ const tableParams = ref({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
}); });
let unitGroupModel=reactive<any>({isEnable:true,isDelete:false}); let unitGroupModel = reactive<any>({isEnable: true, isDelete: false});
// //
const rules = ref<FormRules>({ const rules = ref<FormRules>({
name: [{required: true, message: '请输入名称', trigger: 'blur',},], name: [{required: true, message: '请输入名称', trigger: 'blur',},],
}); });
let mTitle = ref('新增'); let mTitle = ref('新增');
let mGroupTitle = ref('新增'); let mGroupTitle = ref('新增');
let dialogTableVisible = ref(false); let dialogTableVisible = ref(false);
const unitFrom = ref<any>({isEnable: true, isDelete: false, name: '', codeNum: ''})
const unitFrom = ref<any>({isEnable:true,isDelete:false,name:'',codeNum:''}) const cancel = () => {
isShowDialog.value = false
}
const cancel=()=>{ //submit
isShowDialog.value=false const submit = async () => {
} if (mGroupTitle.value == '新增') {
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupAddPost(unitGroupModel);
console.log(res)
if (res.data.code === 200) {
isShowDialog.value = false;
unitGroup();
}
} else {
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupUpdatePost(unitGroupModel);
if (res.data.code === 200) {
isShowDialog.value = false;
unitGroup();
}
}
//submit };
const submit = async () => {
if(mGroupTitle.value=='新增'){
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupAddPost(unitGroupModel);
console.log(res)
if (res.data.code===200) {
isShowDialog.value = false;
unitGroup();
}
}else{
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupUpdatePost(unitGroupModel);
if (res.data.code===200) {
isShowDialog.value = false;
unitGroup();
}
}
};
// //
const unitGroup = async () => { const unitGroup = async () => {
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupListGet(); let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupListGet();
data.unitGroup = res.data.result || []; data.unitGroup = res.data.result || [];
} }
// //
const radioChangeEvent = ({ row }) => { const radioChangeEvent = ({row}) => {
data.selectUnitGroupId = row.id; data.selectUnitGroupId = row.id;
unitPage({groupUnitId:row.id}) unitPage({groupUnitId: row.id})
} }
const formInline = reactive({} as SysUnitInput) const formInline = reactive({} as SysUnitInput)
// //
const unitPage = async (parameter = formInline) => { const unitPage = async (parameter = formInline) => {
let res = await getAPI(SysUnitApi).apiSysUnitPagePost({pageSize:tableParams.value.pageSize,page:tableParams.value.page, ...parameter,...formInline }); let res = await getAPI(SysUnitApi).apiSysUnitPagePost({
data.unit = res.data.result?.items as any; pageSize: tableParams.value.pageSize,
tableParams.value.total = res.data.result?.total; page: tableParams.value.page, ...parameter, ...formInline
});
data.unit = res.data.result?.items as any;
tableParams.value.total = res.data.result?.total;
} }
// //
const handleSizeChange = (val: number) => { const handleSizeChange = (val: number) => {
tableParams.value.pageSize = val; tableParams.value.pageSize = val;
unitPage({groupUnitId:data.selectUnitGroupId}); unitPage({groupUnitId: data.selectUnitGroupId});
}; };
// //
const handleCurrentChange = (val: number) => { const handleCurrentChange = (val: number) => {
tableParams.value.page = val; tableParams.value.page = val;
unitPage({groupUnitId:data.selectUnitGroupId}); unitPage({groupUnitId: data.selectUnitGroupId});
}; };
const addUnit= ()=>{ const addUnit = () => {
unitFrom.value.codeNum = 'DW'+ getCurrentDate(); unitFrom.value.codeNum = 'DW' + getCurrentDate();
dialogTableVisible.value=true; dialogTableVisible.value = true;
mTitle.value='新增' mTitle.value = '新增'
} }
// //
const unitSubmit = async () => { const unitSubmit = async () => {
// //
let checkRes = await getAPI(SysUnitApi).apiSysUnitCheckPost(unitFrom.value); let checkRes = await getAPI(SysUnitApi).apiSysUnitCheckPost(unitFrom.value);
if(checkRes.data.code === 200){ if (checkRes.data.code === 200) {
const item = checkRes.data.result; const item = checkRes.data.result;
if(mTitle.value=='新增'){ if (mTitle.value == '新增') {
if(unitFrom.value.isBaseUnit && item!=null){ if (unitFrom.value.isBaseUnit && item != null) {
ElMessage({ message: '基本单位必须唯一', type: 'error', }); ElMessage({message: '基本单位必须唯一', type: 'error',});
unitFrom.value.isBaseUnit = false; unitFrom.value.isBaseUnit = false;
return; return;
} }
let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom.value); let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom.value);
if (res.data.code===200) { if (res.data.code === 200) {
dialogTableVisible.value = false; dialogTableVisible.value = false;
unitPage({groupUnitId:data.selectUnitGroupId}); unitPage({groupUnitId: data.selectUnitGroupId});
} }
}else{ } else {
if(unitFrom.value.isBaseUnit && item!=null && item.id!=unitFrom.value.id) if (unitFrom.value.isBaseUnit && item != null && item.id != unitFrom.value.id) {
{ ElMessage({message: '基本单位必须唯一', type: 'error',});
ElMessage({ message: '基本单位必须唯一', type: 'error', }); unitFrom.value.isBaseUnit = false;
unitFrom.value.isBaseUnit = false; return;
return;
} }
let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom.value); let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom.value);
if (res.data.code===200) { if (res.data.code === 200) {
dialogTableVisible.value = false; dialogTableVisible.value = false;
unitPage({groupUnitId:data.selectUnitGroupId}); unitPage({groupUnitId: data.selectUnitGroupId});
} }
} }
} }
@ -399,47 +413,48 @@ const getCurrentDate = () => {
return `${year}${month}${day}${hours}${minutes}${seconds}`; return `${year}${month}${day}${hours}${minutes}${seconds}`;
} }
const editUnit=async(row:any)=>{ const editUnit = async (row: any) => {
unitFrom.value=row; unitFrom.value = reactive({ ...row });
mTitle.value='编辑' mTitle.value = '编辑'
dialogTableVisible.value=true; dialogTableVisible.value = true;
} }
const deleteUnit=async(row:any)=>{ const deleteUnit = async (row: any) => {
ElMessageBox.confirm(`确定删除?`, '提示', { ElMessageBox.confirm(`确定删除?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}) })
.then(async () => { .then(async () => {
let res = await getAPI(SysUnitApi).apiSysUnitDeletePost(row); let res = await getAPI(SysUnitApi).apiSysUnitDeletePost(row);
if (res.data.code == 200) { if (res.data.code == 200) {
ElMessage({ message: '成功', type: 'success', }) ElMessage({message: '成功', type: 'success',})
unitPage({groupUnitId:data.selectUnitGroupId}); unitPage({groupUnitId: data.selectUnitGroupId});
//state.tableData.handleList(); //state.tableData.handleList();
} else } else
ElMessage.error(res.data.message!) ElMessage.error(res.data.message!)
}) })
.catch(() => {}); .catch(() => {
});
} }
const addUnitGroup=()=>{ const addUnitGroup = () => {
isShowDialog.value=true isShowDialog.value = true
} }
const editUnitGroup=async(row:any)=>{ const editUnitGroup = (row: any) => {
unitGroupModel=row; mGroupTitle.value = '编辑'
mGroupTitle.value='编辑' isShowDialog.value = true;
isShowDialog.value=true; unitGroupModel = reactive({ ...row });
} }
const deleteUnitGroup=async(row:any)=>{ const deleteUnitGroup = async (row: any) => {
let checkRes = await getAPI(SysUnitGroupApi).apiSysUnitGroupCheckPost({Id:row.id}); let checkRes = await getAPI(SysUnitGroupApi).apiSysUnitGroupCheckPost({Id: row.id});
if(checkRes.data.code == 200){ if (checkRes.data.code == 200) {
const result = checkRes.data.result; const result = checkRes.data.result;
if(result){ if (result) {
return ElMessage.error("存在单位数据,不允许删除") return ElMessage.error("存在单位数据,不允许删除")
} }
ElMessageBox.confirm(`确定删除?`, '提示', { ElMessageBox.confirm(`确定删除?`, '提示', {
@ -451,82 +466,83 @@ const deleteUnitGroup=async(row:any)=>{
console.log(row) console.log(row)
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupDeletePost(row); let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupDeletePost(row);
if (res.data.code == 200) { if (res.data.code == 200) {
ElMessage({ message: '成功', type: 'success', }) ElMessage({message: '成功', type: 'success',})
unitGroup() unitGroup()
unitPage({groupUnitId:data.selectUnitGroupId}) unitPage({groupUnitId: data.selectUnitGroupId})
//state.tableData.handleList(); //state.tableData.handleList();
} else } else
ElMessage.error(res.data.message!) ElMessage.error(res.data.message!)
}) })
.catch(() => {}); .catch(() => {
});
} }
} }
const pageVO1 = reactive({ const pageVO1 = reactive({
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0 total: 0
}) })
onMounted(() => { onMounted(() => {
unitGroup() unitGroup()
unitPage({groupUnitId:data.selectUnitGroupId}) unitPage({groupUnitId: data.selectUnitGroupId})
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main { .main {
padding: 10px;
display: flex;
flex-direction: column;
.main-from {
// height: 300px;
width: 100%;
padding: 20px 10px;
.el-row {
width: 100%;
}
}
.main-table {
margin-top: 20px;
box-sizing: border-box;
padding: 10px; padding: 10px;
flex-grow: 1;
height: 0;
display: flex; display: flex;
flex-direction: column;
.main-from { // flex-direction: column;
// height: 300px; .tab-left {
width: 100%; width: 25%;
padding: 20px 10px; display: flex;
flex-direction: column;
margin-right: 20px;
// div:nth-child(1) {
// width: 50%;
// }
.el-row { // div:nth-child(2) {
width: 100%; // width: 50%;
} // }
} }
.main-table { .tab {
margin-top: 20px; width: 80%;
box-sizing: border-box; flex: 1;
padding: 10px; overflow: scroll;
flex-grow: 1; display: flex;
height: 0; flex-direction: column;
display: flex; div:nth-child(1) {
flex: 1;
// flex-direction: column; overflow: scroll;
.tab-left { }
width: 25%;
display: flex;
flex-direction: column;
margin-right: 20px;
// div:nth-child(1) {
// width: 50%;
// }
// div:nth-child(2) {
// width: 50%;
// }
}
.tab {
width: 80%;
flex: 1;
overflow: scroll;
display: flex;
flex-direction: column;
div:nth-child(1) {
flex: 1;
overflow: scroll;
}
}
} }
}
} }
</style> </style>

View File

@ -1,5 +1,12 @@
<template> <template>
<div class="reportDetailTable-container" style="height: 100vh"> <div class="reportDetailTable-container">
<el-dialog v-model="isShowDialog" :width="800" 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-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
<el-row :gutter="35"> <el-row :gutter="35">
<el-form-item v-show="false"> <el-form-item v-show="false">
@ -162,24 +169,17 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<div class="footer" align="right" >
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-form> </el-form>
<template #footer>
</div> <span class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template> </template>
<style scoped> <style scoped>
.footer {
position: fixed; /* 固定定位 */
left: 0;
bottom: 60px;
width: 100%; /* 宽度占满整个屏幕 */
color: #fff; /* 文字颜色 */
padding: 10px; /* 可根据需要添加内边距 */
text-align: right; /* 文字居中 */
}
:deep(.el-select), :deep(.el-select),
:deep(.el-input-number) { :deep(.el-input-number) {
width: 100%; width: 100%;
@ -205,10 +205,9 @@
type: String, type: String,
default: "", default: "",
}, },
row: Object
}); });
// //
const emit = defineEmits(["reloadTable","back"]); const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref(); const ruleFormRef = ref();
const isShowDialog = ref(false); const isShowDialog = ref(false);
const ruleForm = ref<any>({}); const ruleForm = ref<any>({});
@ -228,38 +227,23 @@
const teamOfGroups = ref<any>([]); const teamOfGroups = ref<any>([]);
const employees = ref<any>([]); const employees = ref<any>([]);
onMounted(async () => { //
if(props.row) { const openDialog = async (row: any) => {
let rowData = JSON.parse(JSON.stringify(props.row)); // ruleForm.value = JSON.parse(JSON.stringify(row));
if (rowData.id) // detail
ruleForm.value = (await detailReportDetailTable(rowData.id)).data.result; let rowData = JSON.parse(JSON.stringify(row));
else if (rowData.id)
ruleForm.value = rowData; ruleForm.value = (await detailReportDetailTable(rowData.id)).data.result;
else
ruleForm.value = rowData;
if (rowData.updateUserId) { if(rowData.updateUserId){
currentMaterial.value = (await detailMaterials(rowData.materialsId)).data.result; currentMaterial.value= (await detailMaterials(rowData.materialsId)).data.result;
//console.log(materials.value); //console.log(materials.value);
} }
} isShowDialog.value = true;
}); //console.log(ruleForm.value);
};
// //
// 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 detailReportDetailTable(rowData.id)).data.result;
// else
// ruleForm.value = rowData;
//
// if(rowData.updateUserId){
// currentMaterial.value= (await detailMaterials(rowData.materialsId)).data.result;
// //console.log(materials.value);
// }
// isShowDialog.value = true;
// //console.log(ruleForm.value);
// };
// //
const closeDialog = () => { const closeDialog = () => {
@ -269,8 +253,7 @@
// //
const cancel = () => { const cancel = () => {
emit("reloadTable"); isShowDialog.value = false;
emit("back");
}; };
// //
@ -283,8 +266,7 @@
} else { } else {
await updateReportDetailTable(values); await updateReportDetailTable(values);
} }
emit("reloadTable"); closeDialog();
emit("back");
} else { } else {
ElMessage({ ElMessage({
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`, message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
@ -323,7 +305,7 @@
}); });
// //
// defineExpose({ openDialog }); defineExpose({ openDialog });
</script> </script>

View File

@ -1,181 +1,181 @@
<template> <template>
<div v-if="!state.editShow" class="reportDetailTable-container"> <div class="reportDetailTable-container">
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
<el-form :model="queryParams" ref="queryForm" labelWidth="90"> <el-form :model="queryParams" ref="queryForm" labelWidth="90">
<el-row> <el-row>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
<el-form-item label="关键字"> <el-form-item label="关键字">
<el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/> <el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="产品名称"> <el-form-item label="产品名称">
<el-input v-model="queryParams.productName" clearable="" placeholder="请输入产品名称"/> <el-input v-model="queryParams.productName" clearable="" placeholder="请输入产品名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="产品编码"> <el-form-item label="产品编码">
<el-input v-model="queryParams.productCodeNum" clearable="" placeholder="请输入产品编码"/> <el-input v-model="queryParams.productCodeNum" clearable="" placeholder="请输入产品编码"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单号"> <el-form-item label="单号">
<el-input v-model="queryParams.oddNumber" clearable="" placeholder="请输入单号"/> <el-input v-model="queryParams.oddNumber" clearable="" placeholder="请输入单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="状态"> <el-form-item label="状态">
<el-input v-model="queryParams.state" clearable="" placeholder="请输入状态"/> <el-input v-model="queryParams.state" clearable="" placeholder="请输入状态"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产类型"> <el-form-item label="生产类型">
<el-input v-model="queryParams.productType" clearable="" placeholder="请输入生产类型"/> <el-input v-model="queryParams.productType" clearable="" placeholder="请输入生产类型"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产线"> <el-form-item label="生产线">
<el-input v-model="queryParams.productionLine" clearable="" placeholder="请输入生产线"/> <el-input v-model="queryParams.productionLine" clearable="" placeholder="请输入生产线"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产线编码"> <el-form-item label="生产线编码">
<el-input v-model="queryParams.codeNum" clearable="" placeholder="请输入生产线编码"/> <el-input v-model="queryParams.codeNum" clearable="" placeholder="请输入生产线编码"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="源单号"> <el-form-item label="源单号">
<el-input v-model="queryParams.sourceNumber" clearable="" placeholder="请输入源单号"/> <el-input v-model="queryParams.sourceNumber" clearable="" placeholder="请输入源单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="规格型号"> <el-form-item label="规格型号">
<el-input v-model="queryParams.specifications" clearable="" placeholder="请输入规格型号"/> <el-input v-model="queryParams.specifications" clearable="" placeholder="请输入规格型号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="完工数量"> <el-form-item label="完工数量">
<el-input-number v-model="queryParams.productCount" clearable="" placeholder="请输入完工数量"/> <el-input-number v-model="queryParams.productCount" clearable="" placeholder="请输入完工数量"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="入库数量"> <el-form-item label="入库数量">
<el-input-number v-model="queryParams.putWarehouse" clearable="" placeholder="请输入入库数量"/> <el-input-number v-model="queryParams.putWarehouse" clearable="" placeholder="请输入入库数量"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本完工数量"> <el-form-item label="基本完工数量">
<el-input-number v-model="queryParams.baseProductCount" clearable="" placeholder="请输入基本完工数量"/> <el-input-number v-model="queryParams.baseProductCount" clearable="" placeholder="请输入基本完工数量"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本入库数量"> <el-form-item label="基本入库数量">
<el-input-number v-model="queryParams.basePutWarehouse" clearable="" placeholder="请输入基本入库数量"/> <el-input-number v-model="queryParams.basePutWarehouse" clearable="" placeholder="请输入基本入库数量"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="单位"> <el-form-item label="单位">
<el-input v-model="queryParams.unit" clearable="" placeholder="请输入单位"/> <el-input v-model="queryParams.unit" clearable="" placeholder="请输入单位"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="基本单位"> <el-form-item label="基本单位">
<el-input v-model="queryParams.baseUnit" clearable="" placeholder="请输入基本单位"/> <el-input v-model="queryParams.baseUnit" clearable="" placeholder="请输入基本单位"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="批次"> <el-form-item label="批次">
<el-input v-model="queryParams.batch" clearable="" placeholder="请输入批次"/> <el-input v-model="queryParams.batch" clearable="" placeholder="请输入批次"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="包装规格"> <el-form-item label="包装规格">
<el-input v-model="queryParams.package" clearable="" placeholder="请输入包装规格"/> <el-input v-model="queryParams.package" clearable="" placeholder="请输入包装规格"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="包装数量"> <el-form-item label="包装数量">
<el-input-number v-model="queryParams.packageCount" clearable="" placeholder="请输入包装数量"/> <el-input-number v-model="queryParams.packageCount" clearable="" placeholder="请输入包装数量"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="采集失败数量"> <el-form-item label="采集失败数量">
<el-input-number v-model="queryParams.gatherFalseCount" clearable="" placeholder="请输入采集失败数量"/> <el-input-number v-model="queryParams.gatherFalseCount" clearable="" placeholder="请输入采集失败数量"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="生产日期"> <el-form-item label="生产日期">
<el-date-picker placeholder="请选择生产日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.productDateRange" /> <el-date-picker placeholder="请选择生产日期" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.productDateRange" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="班组"> <el-form-item label="班组">
<el-input v-model="queryParams.teamGroup" clearable="" placeholder="请输入班组"/> <el-input v-model="queryParams.teamGroup" clearable="" placeholder="请输入班组"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="操作工人"> <el-form-item label="操作工人">
<el-input v-model="queryParams.operator" clearable="" placeholder="请输入操作工人"/> <el-input v-model="queryParams.operator" clearable="" placeholder="请输入操作工人"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="完工时间"> <el-form-item label="完工时间">
<el-date-picker placeholder="请选择完工时间" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.endDateRange" /> <el-date-picker placeholder="请选择完工时间" value-format="YYYY/MM/DD" type="daterange" v-model="queryParams.endDateRange" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="源单号"> <el-form-item label="源单号">
<el-input v-model="queryParams.sourceOddNumber" clearable="" placeholder="请输入源单号"/> <el-input v-model="queryParams.sourceOddNumber" clearable="" placeholder="请输入源单号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/> <el-input v-model="queryParams.remarks" clearable="" placeholder="请输入备注"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10"> <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" class="mb10">
<el-form-item> <el-form-item>
<el-button-group style="display: flex; align-items: center;"> <el-button-group style="display: flex; align-items: center;">
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'reportDetailTable:page'"> </el-button> <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'reportDetailTable:page'"> </el-button>
<el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button> <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-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 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-button-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-card class="full-table" shadow="hover" style="margin-top: 5px"> <el-card class="full-table" shadow="hover" style="margin-top: 5px">
<el-table <el-table
:data="tableData" :data="tableData"
style="width: 100%" style="width: 100%"
@ -229,27 +229,21 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
/> />
<editDialog
ref="editDialogRef"
:title="editReportDetailTableTitle"
@reloadTable="handleQuery"
/>
<printDetailDialog <printDetailDialog
ref="printDetailDialogRef" ref="printDetailDialogRef"
:title="printDetailTableTitle" :title="printDetailTableTitle"
/> />
</el-card> </el-card>
</div> </div>
<div v-else class="reportDetailTable-container">
<el-card >
<editDialog
ref="editDialogRef"
:title="editReportDetailTableTitle"
:row = "state.editRow"
@reloadTable="handleQuery"
@back="closeReportDetailTable"
/>
</el-card>
</div>
</template> </template>
<script lang="ts" setup="" name="reportDetailTable"> <script lang="ts" setup="" name="reportDetailTable">
import {reactive, ref} from "vue"; import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus"; import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction'; import { auth } from '/@/utils/authFunction';
@ -264,10 +258,6 @@ import {reactive, ref} from "vue";
const loading = ref(false); const loading = ref(false);
const tableData = ref<any>([]); const tableData = ref<any>([]);
const queryParams = ref<any>({}); const queryParams = ref<any>({});
const state = reactive({
editShow: false,
editRow:{}
})
const tableParams = ref({ const tableParams = ref({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@ -292,7 +282,6 @@ import {reactive, ref} from "vue";
loading.value = false; loading.value = false;
}; };
// //
const sortChange = async (column: any) => { const sortChange = async (column: any) => {
queryParams.value.field = column.prop; queryParams.value.field = column.prop;
@ -302,22 +291,15 @@ import {reactive, ref} from "vue";
// //
const openAddReportDetailTable = () => { const openAddReportDetailTable = () => {
state.editRow = null; editReportDetailTableTitle.value = '添加汇报单详情';
state.editShow = true; editDialogRef.value.openDialog({});
};
//
const closeReportDetailTable = () => {
state.editShow = false;
}; };
// //
const openEditReportDetailTable = (row: any) => { const openEditReportDetailTable = (row: any) => {
state.editRow = row; editReportDetailTableTitle.value = '编辑汇报单详情';
state.editShow = true; editDialogRef.value.openDialog(row);
// editReportDetailTableTitle.value = '';
// editDialogRef.value.openDialog(row);
}; };