完善单位物料功能
parent
fa659428de
commit
8e81dee033
|
@ -166,5 +166,15 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -224,3 +224,21 @@ 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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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>
|
||||||
/// 单位服务
|
/// 单位服务
|
||||||
|
@ -12,6 +13,8 @@ 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;
|
||||||
|
@ -191,41 +194,19 @@ public class SysUnitService : IDynamicApiController, ITransient
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成编码
|
/// 修改单位启用禁用状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpPost]
|
||||||
[ApiDescriptionSettings(Name = "createCodeNum")]
|
[ApiDescriptionSettings(Name = "updateBaseUnitEnable")]
|
||||||
public async Task<string> CreateCodeNum()
|
public async Task UpdateBaseUnitEnable(UpdateSysUnitEnableInput input)
|
||||||
{
|
{
|
||||||
string dt = DateTime.Now.ToString("yyyyMMdd");
|
foreach (var id in input.Ids.Split(","))
|
||||||
var unit = await _rep.AsQueryable()
|
|
||||||
.Where(a => !a.IsDelete)
|
|
||||||
.Where(a => a.CodeNum.Contains(dt))
|
|
||||||
.OrderByDescending(t => t.CodeNum)
|
|
||||||
.FirstAsync();
|
|
||||||
if (unit != null)
|
|
||||||
{
|
{
|
||||||
Match match = Regex.Match(unit.CodeNum, @"\d+");
|
var entity = _rep.GetById(id);
|
||||||
if (match.Success)
|
entity.IsEnable = input.IsEnable;
|
||||||
{
|
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";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ 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
|
||||||
|
@ -410,6 +411,54 @@ 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,
|
||||||
|
@ -534,6 +583,19 @@ 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);
|
||||||
|
};
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -717,4 +779,14 @@ 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));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* 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;
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ 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,3 +74,11 @@ export const materialListBySourceId = (sourceId: any) =>
|
||||||
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 },
|
||||||
|
});
|
|
@ -2,19 +2,22 @@
|
||||||
<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="state.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 prop="name" label="物料类型" :rules="[{ required: true, message: '物料类型不能为空', trigger: 'blur' }]">
|
||||||
<el-input v-model="ruleForm.name" placeholder="请输入名称" clearable maxlength="32" />
|
<el-input v-model="state.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>
|
||||||
|
<span class="dialog-footer">
|
||||||
<el-button style="width: 100px;" type="primary" @click="matterSubmit">提交</el-button>
|
<el-button style="width: 100px;" type="primary" @click="matterSubmit">提交</el-button>
|
||||||
<el-button style="width: 100px;" @click="closeDialog">取消</el-button>
|
<el-button style="width: 100px;" @click="closeDialog">取消</el-button>
|
||||||
</el-row>
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -22,11 +25,15 @@
|
||||||
<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,
|
||||||
|
} from '/@/api-services/api';
|
||||||
|
import {
|
||||||
|
MaterialsOutput,
|
||||||
|
SysUnitGroupOutput,
|
||||||
|
SysUnitOutput, UpdateMaterialClassifyInput
|
||||||
|
} from '/@/api-services/models';
|
||||||
import {ElMessageBox, ElMessage, TabsPaneContext} from 'element-plus';
|
import {ElMessageBox, ElMessage, TabsPaneContext} from 'element-plus';
|
||||||
import { addMaterials, updateMaterials,detailMaterials } from '/@/api/main/materials';
|
|
||||||
import { listUnitGroup } from '/@/api/main/unit';
|
|
||||||
import {addMaterialsClassify, detailMaterialsClassify, updateMaterialsClassify} from "/@/api/main/materialClassify";
|
import {addMaterialsClassify, detailMaterialsClassify, updateMaterialsClassify} from "/@/api/main/materialClassify";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -45,8 +52,7 @@ const fyListGet = async () => {
|
||||||
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,
|
||||||
|
@ -66,18 +72,18 @@ const state = reactive({
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
@ -92,13 +98,14 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
//提交
|
//提交
|
||||||
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)
|
||||||
|
|
||||||
|
@ -109,13 +116,13 @@ const matterSubmit = async () => {
|
||||||
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();
|
||||||
}
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
|
|
|
@ -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 :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="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="名称" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
|
<el-form-item prop="name" 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 label="分类" :rules="[{ required: true, message: '分销单位不能为空', trigger: 'blur' }]">
|
<el-form-item prop="classify" 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,6 +178,20 @@
|
||||||
</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;">
|
||||||
|
@ -215,7 +229,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,
|
||||||
|
@ -238,8 +252,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;
|
||||||
|
@ -307,11 +321,12 @@ const handleClick = (tab: TabsPaneContext, event: Event) => {
|
||||||
|
|
||||||
//提交
|
//提交
|
||||||
const matterSubmit = async () => {
|
const matterSubmit = async () => {
|
||||||
|
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
||||||
|
if (isValid) {
|
||||||
let res;
|
let res;
|
||||||
if (props.title == '添加物料') {
|
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)
|
||||||
|
@ -323,11 +338,12 @@ const matterSubmit = async () => {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
//state.tableData.handleList();
|
//state.tableData.handleList();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
ElMessage.error(res.message!)
|
ElMessage.error(res.message!)
|
||||||
closeDialog();
|
closeDialog();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// //获取包装关系
|
// //获取包装关系
|
||||||
|
|
|
@ -124,6 +124,8 @@
|
||||||
</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>
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
<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="unitUpdateEnable(true)">启用</el-button>
|
||||||
<el-button @click="''">禁用</el-button>
|
<el-button @click="unitUpdateEnable(false)">禁用</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +33,9 @@
|
||||||
<div>
|
<div>
|
||||||
<el-button type="success" link
|
<el-button type="success" link
|
||||||
@click.prevent="addUnitGroup"
|
@click.prevent="addUnitGroup"
|
||||||
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">新增</el-button>
|
style="border-right: 1px #515a6e solid; border-radius: 0px; margin-right: 3px; padding: 0 3px;">
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 100%;">
|
<div style="height: 100%;">
|
||||||
|
@ -53,7 +55,9 @@
|
||||||
<vxe-column title="操作" width="150" fixed="right" show-overflow>
|
<vxe-column title="操作" width="150" fixed="right" show-overflow>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<vxe-button type="text" @click="editUnitGroup(row)" icon="vxe-icon-edit">修改</vxe-button>
|
<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" @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> -->
|
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
@ -69,6 +73,7 @@
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
tooltip-effect="light"
|
tooltip-effect="light"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
border="">
|
border="">
|
||||||
<el-table-column type="selection" width="60"/>
|
<el-table-column type="selection" width="60"/>
|
||||||
<el-table-column prop="codeNum" label="编码" show-overflow-tooltip=""/>
|
<el-table-column prop="codeNum" label="编码" show-overflow-tooltip=""/>
|
||||||
|
@ -88,10 +93,13 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip=""/>
|
<el-table-column prop="updateUserName" label="修改人" show-overflow-tooltip=""/>
|
||||||
<el-table-column prop="updateTime" 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')">
|
<el-table-column width="200" label="操作" align="center" fixed="right" show-overflow-tooltip=""
|
||||||
|
v-if="auth('materials:update') || auth('materials:delete')">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<vxe-button type="text" @click="editUnit(scope.row)" icon="vxe-icon-edit">修改</vxe-button>
|
<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>
|
<vxe-button type="text" @click="deleteUnit(scope.row)" icon="vxe-icon-delete"
|
||||||
|
style="color: rgb(223, 65, 65)">删除
|
||||||
|
</vxe-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -150,21 +158,21 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="860">
|
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="860">
|
||||||
<el-form :inline="true" :model="unitFrom" class="demo-form-inline" label-width="80px">
|
<el-form :inline="true" ref="ruleFormRef" :model="unitFrom" class="demo-form-inline" label-width="80px">
|
||||||
<el-row>
|
<el-row>
|
||||||
|
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="名称" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
|
<el-form-item label="名称" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]" prop="name">
|
||||||
<el-input v-model="unitFrom.name" placeholder="请输入名称" clearable/>
|
<el-input v-model="unitFrom.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="编码" :rules="[{ required: true, message: '编码不能为空', trigger: 'blur' }]">
|
<el-form-item label="编码" :rules="[{ required: true, message: '编码不能为空', trigger: 'blur' }]" prop="codeNum">
|
||||||
<el-input v-model="unitFrom.codeNum" placeholder="请输入编码" clearable/>
|
<el-input v-model="unitFrom.codeNum" placeholder="请输入编码" clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="单位组" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]">
|
<el-form-item label="单位组" :rules="[{ required: true, message: '单位组不能为空', trigger: 'blur' }]" prop="groupUnitId">
|
||||||
<el-select v-model="unitFrom.groupUnitId" placeholder="请选择" clearable>
|
<el-select v-model="unitFrom.groupUnitId" placeholder="请选择" clearable>
|
||||||
<el-option :label="item.name" :value="item.id" v-for="item, index in data.unitGroup"
|
<el-option :label="item.name" :value="item.id" v-for="item, index in data.unitGroup"
|
||||||
:key="index"/>
|
:key="index"/>
|
||||||
|
@ -179,13 +187,13 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="子单位数" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
<el-form-item label="子单位数" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]" prop="childUnitCount">
|
||||||
<el-input v-model="unitFrom.childUnitCount" placeholder="下级单位数量" clearable/>
|
<el-input v-model="unitFrom.childUnitCount" placeholder="下级单位数量" clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="换算率" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
<el-form-item label="换算率" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]" prop="rate">
|
||||||
<el-input v-model="unitFrom.rate" placeholder="基本单位数量" clearable/>
|
<el-input v-model="unitFrom.rate" placeholder="基本单位数量" clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -219,24 +227,40 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-tabs v-model="activeName" class="demo-tabs" >
|
||||||
|
<el-tab-pane label="操作信息" name="操作信息">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="创建人" >
|
||||||
|
<el-input v-model="unitFrom.createUserName" disabled clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="修改人" >
|
||||||
|
<el-input v-model="unitFrom.updateUserName" disabled clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</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;" type="primary" @click="unitSubmit">提交</el-button>
|
<el-button style="width: 100px;" type="primary" @click="unitSubmit">提交</el-button>
|
||||||
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
|
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<div v-if="isShowDialog">
|
||||||
<el-dialog v-model="isShowDialog" :title="mGroupTitle" ref="ruleFormRef" :width="800" >
|
<el-dialog v-model="isShowDialog" :title="mGroupTitle" :width="800">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<span>单位组</span>
|
<span>单位组</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-form :model="unitGroupModel" label-width="auto" :rules="rules">
|
<el-form ref="unitGroupRuleFormRef" :model="unitGroupModel" label-width="auto" >
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name" :rules="[{ required: true, message: '名称不能为空', trigger: 'blur' }]">
|
||||||
<el-input v-model="unitGroupModel.name" placeholder="请输入名称" maxlength="32" show-word-limit clearable />
|
<el-input v-model="unitGroupModel.name" placeholder="请输入名称" maxlength="32" show-word-limit
|
||||||
|
clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
|
@ -252,7 +276,7 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -261,59 +285,78 @@
|
||||||
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 {
|
||||||
|
AddSysUnitInput,
|
||||||
|
SqlSugarPagedListSysUnitOutput,
|
||||||
|
SysUnitGroupOutput,
|
||||||
|
SysUnitInput
|
||||||
|
} from '/@/api-services/models';
|
||||||
import type {FormRules} from "element-plus";
|
import type {FormRules} from "element-plus";
|
||||||
import {ElMessageBox, ElMessage} from 'element-plus';
|
import {ElMessageBox, ElMessage} from 'element-plus';
|
||||||
import {auth} from "/@/utils/authFunction";
|
import {auth} from "/@/utils/authFunction";
|
||||||
|
import {listMaterialByUnit} from "/@/api/main/materials";
|
||||||
|
|
||||||
let data = reactive({
|
let data = reactive({
|
||||||
unit: [] as SqlSugarPagedListSysUnitOutput[],//单位数据
|
unit: [] as SqlSugarPagedListSysUnitOutput[],//单位数据
|
||||||
unitGroup: [] as SysUnitGroupOutput[],//单位组数据
|
unitGroup: [] as SysUnitGroupOutput[],//单位组数据
|
||||||
selectUnitGroupId: 0,
|
selectUnitGroupId: 0,
|
||||||
});
|
});
|
||||||
|
const activeName = ref('操作信息')
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const ruleFormRef = ref();
|
const ruleFormRef = ref();
|
||||||
const isShowDialog = ref(false);
|
const isShowDialog = ref(false);
|
||||||
|
const multipleSelection = ref([])
|
||||||
const tableParams = ref({
|
const tableParams = ref({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
});
|
});
|
||||||
|
const unitGroupRuleFormRef = ref();
|
||||||
let unitGroupModel = reactive<any>({isEnable: true, isDelete: false});
|
let unitGroupModel = reactive<any>({isEnable: true, isDelete: false});
|
||||||
//自行添加其他规则
|
|
||||||
const rules = ref<FormRules>({
|
|
||||||
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 = () => {
|
const cancel = () => {
|
||||||
isShowDialog.value = false
|
isShowDialog.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSelectionChange = (val: []) => {
|
||||||
|
multipleSelection.value = val
|
||||||
|
}
|
||||||
|
|
||||||
//定义submit方法,新增单位组
|
//定义submit方法,新增单位组
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
if(mGroupTitle.value=='新增'){
|
unitGroupRuleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
||||||
|
if (isValid) {
|
||||||
|
if (unitGroupModel.id>0){
|
||||||
|
if(!unitGroupModel.isEnable){
|
||||||
|
let wlRes = await listMaterialByUnit(unitGroupModel.id,"");
|
||||||
|
if(wlRes.data.code == 200) {
|
||||||
|
if (wlRes.data.result.length > 0) return ElMessage.error("单位已被物料使用,无法停用")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupUpdatePost(unitGroupModel);
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
isShowDialog.value = false;
|
||||||
|
await unitGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupAddPost(unitGroupModel);
|
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupAddPost(unitGroupModel);
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
isShowDialog.value = false;
|
isShowDialog.value = false;
|
||||||
unitGroup();
|
await unitGroup();
|
||||||
}
|
|
||||||
}else{
|
|
||||||
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupUpdatePost(unitGroupModel);
|
|
||||||
if (res.data.code===200) {
|
|
||||||
isShowDialog.value = false;
|
|
||||||
unitGroup();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//获取单位组数据
|
//获取单位组数据
|
||||||
|
@ -331,7 +374,10 @@ 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({
|
||||||
|
pageSize: tableParams.value.pageSize,
|
||||||
|
page: tableParams.value.page, ...parameter, ...formInline
|
||||||
|
});
|
||||||
data.unit = res.data.result?.items as any;
|
data.unit = res.data.result?.items as any;
|
||||||
tableParams.value.total = res.data.result?.total;
|
tableParams.value.total = res.data.result?.total;
|
||||||
}
|
}
|
||||||
|
@ -350,6 +396,8 @@ const handleCurrentChange = (val: number) => {
|
||||||
|
|
||||||
|
|
||||||
const addUnit = () => {
|
const addUnit = () => {
|
||||||
|
ruleFormRef.value?.resetFields();
|
||||||
|
unitFrom.value = reactive({ });
|
||||||
unitFrom.value.codeNum = 'DW' + getCurrentDate();
|
unitFrom.value.codeNum = 'DW' + getCurrentDate();
|
||||||
dialogTableVisible.value = true;
|
dialogTableVisible.value = true;
|
||||||
mTitle.value = '新增'
|
mTitle.value = '新增'
|
||||||
|
@ -357,6 +405,8 @@ const addUnit= ()=>{
|
||||||
|
|
||||||
//提交
|
//提交
|
||||||
const unitSubmit = async () => {
|
const unitSubmit = async () => {
|
||||||
|
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
||||||
|
if (isValid) {
|
||||||
//校验基本单位是否唯一
|
//校验基本单位是否唯一
|
||||||
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) {
|
||||||
|
@ -370,23 +420,47 @@ const unitSubmit = async () => {
|
||||||
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});
|
await 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;
|
||||||
}
|
}
|
||||||
|
if(!unitFrom.value.isEnable){
|
||||||
|
let wlRes = await listMaterialByUnit(unitFrom.value.unitGroupId,unitFrom.value.name);
|
||||||
|
if(wlRes.data.code == 200) {
|
||||||
|
if (wlRes.data.result.length > 0) return ElMessage.error("单位已被物料使用,无法停用")
|
||||||
|
}
|
||||||
|
}
|
||||||
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});
|
await unitPage({groupUnitId: data.selectUnitGroupId});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//启用或禁用单位
|
||||||
|
const unitUpdateEnable = async (enable:boolean) => {
|
||||||
|
if(multipleSelection.value.length === 0){ return ElMessage.error("至少选择一条单位数据")}
|
||||||
|
let ids = [] as any;
|
||||||
|
multipleSelection.value.forEach(item => {
|
||||||
|
ids.push(item.id);
|
||||||
|
})
|
||||||
|
let result = await getAPI(SysUnitApi).apiSysUnitUpdateEnablePost({ids:ids.join(","),isEnable:enable});
|
||||||
|
if (result.data.code === 200) {
|
||||||
|
ElMessage({message: '成功', type: 'success',})
|
||||||
|
await unitPage({groupUnitId: data.selectUnitGroupId});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ElMessage.error(res.data.message!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const getCurrentDate = () => {
|
const getCurrentDate = () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
@ -400,12 +474,16 @@ const getCurrentDate = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const editUnit = async (row: any) => {
|
const editUnit = async (row: any) => {
|
||||||
unitFrom.value=row;
|
ruleFormRef.value?.resetFields();
|
||||||
|
unitFrom.value = reactive({ ...row });
|
||||||
mTitle.value = '编辑'
|
mTitle.value = '编辑'
|
||||||
dialogTableVisible.value = true;
|
dialogTableVisible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteUnit = async (row: any) => {
|
const deleteUnit = async (row: any) => {
|
||||||
|
let wlRes = await listMaterialByUnit(row.unitGroupId,row.name);
|
||||||
|
if(wlRes.data.code == 200) {
|
||||||
|
if (wlRes.data.result.length > 0) return ElMessage.error("单位已被物料使用")
|
||||||
ElMessageBox.confirm(`确定删除?`, '提示', {
|
ElMessageBox.confirm(`确定删除?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
@ -420,19 +498,23 @@ const deleteUnit=async(row:any)=>{
|
||||||
} else
|
} else
|
||||||
ElMessage.error(res.data.message!)
|
ElMessage.error(res.data.message!)
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const addUnitGroup = () => {
|
const addUnitGroup = () => {
|
||||||
|
unitGroupRuleFormRef.value?.resetFields();
|
||||||
|
unitGroupModel = reactive({ });
|
||||||
isShowDialog.value = true
|
isShowDialog.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const editUnitGroup=async(row:any)=>{
|
const editUnitGroup = (row: any) => {
|
||||||
unitGroupModel=row;
|
unitGroupRuleFormRef.value?.resetFields();
|
||||||
mGroupTitle.value = '编辑'
|
mGroupTitle.value = '编辑'
|
||||||
isShowDialog.value = true;
|
isShowDialog.value = true;
|
||||||
|
unitGroupModel = reactive({ ...row });
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteUnitGroup = async (row: any) => {
|
const deleteUnitGroup = async (row: any) => {
|
||||||
|
@ -442,6 +524,9 @@ const deleteUnitGroup=async(row:any)=>{
|
||||||
if (result) {
|
if (result) {
|
||||||
return ElMessage.error("存在单位数据,不允许删除")
|
return ElMessage.error("存在单位数据,不允许删除")
|
||||||
}
|
}
|
||||||
|
let wlRes = await listMaterialByUnit(row.id,"");
|
||||||
|
if(wlRes.data.code == 200) {
|
||||||
|
if(wlRes.data.result.length>0) return ElMessage.error("单位组已被物料使用")
|
||||||
ElMessageBox.confirm(`确定删除?`, '提示', {
|
ElMessageBox.confirm(`确定删除?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
@ -458,9 +543,10 @@ const deleteUnitGroup=async(row:any)=>{
|
||||||
} else
|
} else
|
||||||
ElMessage.error(res.data.message!)
|
ElMessage.error(res.data.message!)
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageVO1 = reactive({
|
const pageVO1 = reactive({
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="reportDetailTable-container">
|
<div class="reportDetailTable-container" style="height: 100vh">
|
||||||
<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">
|
||||||
|
@ -169,17 +162,24 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
<div class="footer" align="right" >
|
||||||
<template #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>
|
</div>
|
||||||
</template>
|
</el-form>
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</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,9 +205,10 @@
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
row: Object
|
||||||
});
|
});
|
||||||
//父级传递来的函数,用于回调
|
//父级传递来的函数,用于回调
|
||||||
const emit = defineEmits(["reloadTable"]);
|
const emit = defineEmits(["reloadTable","back"]);
|
||||||
const ruleFormRef = ref();
|
const ruleFormRef = ref();
|
||||||
const isShowDialog = ref(false);
|
const isShowDialog = ref(false);
|
||||||
const ruleForm = ref<any>({});
|
const ruleForm = ref<any>({});
|
||||||
|
@ -227,11 +228,9 @@
|
||||||
const teamOfGroups = ref<any>([]);
|
const teamOfGroups = ref<any>([]);
|
||||||
const employees = ref<any>([]);
|
const employees = ref<any>([]);
|
||||||
|
|
||||||
// 打开弹窗
|
onMounted(async () => {
|
||||||
const openDialog = async (row: any) => {
|
if(props.row) {
|
||||||
// ruleForm.value = JSON.parse(JSON.stringify(row));
|
let rowData = JSON.parse(JSON.stringify(props.row));
|
||||||
// 改用detail获取最新数据来编辑
|
|
||||||
let rowData = JSON.parse(JSON.stringify(row));
|
|
||||||
if (rowData.id)
|
if (rowData.id)
|
||||||
ruleForm.value = (await detailReportDetailTable(rowData.id)).data.result;
|
ruleForm.value = (await detailReportDetailTable(rowData.id)).data.result;
|
||||||
else
|
else
|
||||||
|
@ -241,9 +240,26 @@
|
||||||
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 = () => {
|
||||||
|
@ -253,7 +269,8 @@
|
||||||
|
|
||||||
// 取消
|
// 取消
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
isShowDialog.value = false;
|
emit("reloadTable");
|
||||||
|
emit("back");
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
|
@ -266,7 +283,8 @@
|
||||||
} else {
|
} else {
|
||||||
await updateReportDetailTable(values);
|
await updateReportDetailTable(values);
|
||||||
}
|
}
|
||||||
closeDialog();
|
emit("reloadTable");
|
||||||
|
emit("back");
|
||||||
} else {
|
} else {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
||||||
|
@ -305,7 +323,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
//将属性或者函数暴露给父组件
|
//将属性或者函数暴露给父组件
|
||||||
defineExpose({ openDialog });
|
// defineExpose({ openDialog });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="reportDetailTable-container">
|
<div v-if="!state.editShow" 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>
|
||||||
|
@ -229,21 +229,27 @@
|
||||||
@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 { ref } from "vue";
|
import {reactive, 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';
|
||||||
|
|
||||||
|
@ -258,6 +264,10 @@
|
||||||
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,
|
||||||
|
@ -282,6 +292,7 @@
|
||||||
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;
|
||||||
|
@ -291,15 +302,22 @@
|
||||||
|
|
||||||
// 打开新增页面
|
// 打开新增页面
|
||||||
const openAddReportDetailTable = () => {
|
const openAddReportDetailTable = () => {
|
||||||
editReportDetailTableTitle.value = '添加汇报单详情';
|
state.editRow = null;
|
||||||
editDialogRef.value.openDialog({});
|
state.editShow = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 关闭页面
|
||||||
|
const closeReportDetailTable = () => {
|
||||||
|
state.editShow = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 打开编辑页面
|
// 打开编辑页面
|
||||||
const openEditReportDetailTable = (row: any) => {
|
const openEditReportDetailTable = (row: any) => {
|
||||||
editReportDetailTableTitle.value = '编辑汇报单详情';
|
state.editRow = row;
|
||||||
editDialogRef.value.openDialog(row);
|
state.editShow = true;
|
||||||
|
// editReportDetailTableTitle.value = '编辑汇报单详情';
|
||||||
|
// editDialogRef.value.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue