Changes
parent
57f0699959
commit
6c94077b93
|
@ -362,6 +362,54 @@ export const SysUnitApiAxiosParamCreator = function (configuration?: Configurati
|
|||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
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}
|
||||
*/
|
||||
apiSysUnitCheckPost: async (body?: UpdateSysUnitInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/sysUnit/checkBaseUnit`;
|
||||
// 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 {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
|
@ -473,6 +521,19 @@ export const SysUnitApiFp = function(configuration?: Configuration) {
|
|||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 校验基本单位是否唯一
|
||||
* @param body
|
||||
* @param options
|
||||
*/
|
||||
async apiSysUnitCheckPost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysUnitApiAxiosParamCreator(configuration).apiSysUnitCheckPost(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -551,6 +612,15 @@ export const SysUnitApiFactory = function (configuration?: Configuration, basePa
|
|||
async apiSysUnitUpdatePost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysUnitApiFp(configuration).apiSysUnitUpdatePost(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 校验基本单位是否唯一
|
||||
* @param body
|
||||
* @param options
|
||||
*/
|
||||
async apiSysUnitCheckPost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysUnitApiFp(configuration).apiSysUnitCheckPost(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -637,4 +707,14 @@ export class SysUnitApi extends BaseAPI {
|
|||
public async apiSysUnitUpdatePost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysUnitApiFp(this.configuration).apiSysUnitUpdatePost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary 校验基本单位是否唯一
|
||||
* @param body
|
||||
* @param options
|
||||
*/
|
||||
async apiSysUnitCheckPost(body?: UpdateSysUnitInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysUnitApiFp(this.configuration).apiSysUnitCheckPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import { AdminResultSysUnitGroup } from '../models';
|
|||
import { DeleteSysUnitGroupInput } from '../models';
|
||||
import { SysUnitGroupInput } from '../models';
|
||||
import { UpdateSysUnitGroupInput } from '../models';
|
||||
import {CheckSysUnitGroupInput} from "/@/api-services/models/check-sys-unit-group-input";
|
||||
/**
|
||||
* SysUnitGroupApi - axios parameter creator
|
||||
* @export
|
||||
|
@ -313,6 +314,54 @@ export const SysUnitGroupApiAxiosParamCreator = function (configuration?: Config
|
|||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 检查单位组
|
||||
* @param {CheckSysUnitGroupInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiSysUnitGroupCheckPost: async (body?: CheckSysUnitGroupInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/sysUnitGroup/CheckUnitList`;
|
||||
// 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 {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
options: localVarRequestOptions,
|
||||
|
@ -410,6 +459,20 @@ export const SysUnitGroupApiFp = function(configuration?: Configuration) {
|
|||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 检查单位组
|
||||
* @param {CheckSysUnitGroupInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysUnitGroupCheckPost(body?: CheckSysUnitGroupInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysUnitGroupApiAxiosParamCreator(configuration).apiSysUnitGroupCheckPost(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -553,4 +616,15 @@ export class SysUnitGroupApi extends BaseAPI {
|
|||
public async apiSysUnitGroupUpdatePost(body?: UpdateSysUnitGroupInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysUnitGroupApiFp(this.configuration).apiSysUnitGroupUpdatePost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 检查单位是否存在数据
|
||||
* @param {UpdateSysUnitGroupInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysUnitGroupApi
|
||||
*/
|
||||
public async apiSysUnitGroupCheckPost(body?: CheckSysUnitGroupInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysUnitGroupApiFp(this.configuration).apiSysUnitGroupCheckPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* 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 CheckSysUnitGroupInput
|
||||
*/
|
||||
export interface CheckSysUnitGroupInput {
|
||||
/**
|
||||
* 主键Id
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof UpdateSysUnitGroupInput
|
||||
*/
|
||||
id: number;
|
||||
}
|
|
@ -62,6 +62,46 @@
|
|||
</div>
|
||||
<div class="tab">
|
||||
<div>
|
||||
<!-- <el-table-->
|
||||
<!-- :data="data.unit"-->
|
||||
<!-- style="width: 40%"-->
|
||||
<!-- v-loading="loading"-->
|
||||
<!-- tooltip-effect="light"-->
|
||||
<!-- row-key="id"-->
|
||||
<!-- @sort-change="sortChange"-->
|
||||
<!-- border="">-->
|
||||
<!-- <el-table-column type="index" label="序号" width="55" align="center"/>-->
|
||||
<!-- <el-table-column prop="name" label="名称" width="140" show-overflow-tooltip="" />-->
|
||||
<!-- <el-table-column prop="codeNum" label="编码" width="140" show-overflow-tooltip="" />-->
|
||||
<!-- <el-table-column prop="aliasName" label="别名" width="140" show-overflow-tooltip="" />-->
|
||||
<!-- <el-table-column prop="simpleNumber" label="助记码" width="140" show-overflow-tooltip="" />-->
|
||||
<!-- <el-table-column prop="specifications" label="规格型号" width="140" show-overflow-tooltip="" />-->
|
||||
<!-- <el-table-column prop="isEnable" label="可用状态" width="120" show-overflow-tooltip="">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <el-tag v-if="scope.row.isEnable"> 是 </el-tag>-->
|
||||
<!-- <el-tag type="danger" v-else> 否 </el-tag>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column prop="remarks" label="备注" width="200" show-overflow-tooltip="" />-->
|
||||
<!-- <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('materials:update') || auth('materials:delete')">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- <el-button icon="ele-Edit" size="small" text="" type="primary" @click="editUnit(scope.row)"> 编辑 </el-button>-->
|
||||
<!-- <el-button icon="ele-Delete" size="small" text="" type="primary" @click="deleteUnit(scope.row)" > 删除 </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- <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"-->
|
||||
<!-- />-->
|
||||
|
||||
<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>
|
||||
|
@ -216,10 +256,12 @@ import { SysUnitApi, SysUnitGroupApi } from '/@/api-services/api';
|
|||
import { AddSysUnitInput, SqlSugarPagedListSysUnitOutput, SysUnitGroupOutput, SysUnitInput} from '/@/api-services/models';
|
||||
import type { FormRules } from "element-plus";
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import {auth} from "/@/utils/authFunction";
|
||||
|
||||
let data = reactive({
|
||||
unit: [] as SqlSugarPagedListSysUnitOutput[],//单位数据
|
||||
unitGroup: [] as SysUnitGroupOutput[],//单位组数据
|
||||
selectUnitGroupId:0,
|
||||
});
|
||||
|
||||
const ruleFormRef = ref();
|
||||
|
@ -268,6 +310,7 @@ const unitGroup = async () => {
|
|||
//单选
|
||||
|
||||
const radioChangeEvent = ({ row }) => {
|
||||
data.selectUnitGroupId = row.id;
|
||||
unitPage({groupUnitId:row.id})
|
||||
}
|
||||
const formInline = reactive({} as SysUnitInput)
|
||||
|
@ -289,20 +332,35 @@ const addUnit= ()=>{
|
|||
|
||||
//提交
|
||||
const unitSubmit = async () => {
|
||||
//校验基本单位是否唯一
|
||||
let checkRes = await getAPI(SysUnitApi).apiSysUnitCheckPost(unitFrom.value);
|
||||
if(checkRes.data.code === 200){
|
||||
const item = checkRes.data.result;
|
||||
if(mTitle.value=='新增'){
|
||||
if(unitFrom.value.isBaseUnit && item!=null){
|
||||
ElMessage({ message: '基本单位必须唯一', type: 'error', });
|
||||
unitFrom.value.isBaseUnit = false;
|
||||
return;
|
||||
}
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitAddPost(unitFrom.value);
|
||||
if (res.data.code===200) {
|
||||
dialogTableVisible.value = false;
|
||||
unitPage();
|
||||
unitPage({groupUnitId:data.selectUnitGroupId});
|
||||
}
|
||||
}else{
|
||||
if(unitFrom.value.isBaseUnit && item!=null && item.id!=unitFrom.value.id)
|
||||
{
|
||||
ElMessage({ message: '基本单位必须唯一', type: 'error', });
|
||||
unitFrom.value.isBaseUnit = false;
|
||||
return;
|
||||
}
|
||||
let res = await getAPI(SysUnitApi).apiSysUnitUpdatePost(unitFrom.value);
|
||||
if (res.data.code===200) {
|
||||
dialogTableVisible.value = false;
|
||||
unitPage();
|
||||
unitPage({groupUnitId:data.selectUnitGroupId});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const editUnit=async(row:any)=>{
|
||||
|
@ -321,7 +379,7 @@ const deleteUnit=async(row:any)=>{
|
|||
let res = await getAPI(SysUnitApi).apiSysUnitDeletePost(row);
|
||||
if (res.data.code == 200) {
|
||||
ElMessage({ message: '成功', type: 'success', })
|
||||
unitPage()
|
||||
unitPage();
|
||||
//state.tableData.handleList();
|
||||
} else
|
||||
ElMessage.error(res.data.message!)
|
||||
|
@ -342,6 +400,12 @@ const editUnitGroup=async(row:any)=>{
|
|||
}
|
||||
|
||||
const deleteUnitGroup=async(row:any)=>{
|
||||
let checkRes = await getAPI(SysUnitGroupApi).apiSysUnitGroupCheckPost({Id:row.id});
|
||||
if(checkRes.data.code == 200){
|
||||
const result = checkRes.data.result;
|
||||
if(result){
|
||||
return ElMessage.error("存在单位数据,不允许删除")
|
||||
}
|
||||
ElMessageBox.confirm(`确定删除?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
@ -352,6 +416,7 @@ const deleteUnitGroup=async(row:any)=>{
|
|||
let res = await getAPI(SysUnitGroupApi).apiSysUnitGroupDeletePost(row);
|
||||
if (res.data.code == 200) {
|
||||
ElMessage({ message: '成功', type: 'success', })
|
||||
unitGroup()
|
||||
unitPage()
|
||||
//state.tableData.handleList();
|
||||
} else
|
||||
|
@ -360,6 +425,8 @@ const deleteUnitGroup=async(row:any)=>{
|
|||
.catch(() => {});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const pageVO1 = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
|
|
Loading…
Reference in New Issue