打印模板加入复制功能
This commit is contained in:
parent
c4839bfaf6
commit
1a0740e49a
@ -29,7 +29,7 @@ public class SysPrintService : IDynamicApiController, ITransient
|
|||||||
{
|
{
|
||||||
return await _sysPrintRep.AsQueryable()
|
return await _sysPrintRep.AsQueryable()
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
|
||||||
.OrderBy(u => new { u.OrderNo, u.Id })
|
.OrderBy(u => new { u.OrderNo, u.Name })
|
||||||
.ToPagedListAsync(input.Page, input.PageSize);
|
.ToPagedListAsync(input.Page, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +73,23 @@ public class SysPrintService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
await _sysPrintRep.AsUpdateable(input.Adapt<SysPrint>()).IgnoreColumns(true).ExecuteCommandAsync();
|
await _sysPrintRep.AsUpdateable(input.Adapt<SysPrint>()).IgnoreColumns(true).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复制打印模板
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[ApiDescriptionSettings(Name = "Copy"), HttpPost]
|
||||||
|
[DisplayName("复制打印模板")]
|
||||||
|
public async Task CopyPrint(DeletePrintInput input)
|
||||||
|
{
|
||||||
|
var print = await _sysPrintRep.AsQueryable().Where(u => u.Id == input.Id).FirstAsync();
|
||||||
|
if (print == null)
|
||||||
|
throw Oops.Bah("模板不存在");
|
||||||
|
print.Name = print.Name + "_Copy_" + DateTime.Now.ToString("ddHHmmss");
|
||||||
|
print.Id = 0;
|
||||||
|
await AddPrint(print.Adapt<AddPrintInput>());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除打印模板 🖨️
|
/// 删除打印模板 🖨️
|
||||||
|
|||||||
@ -77,6 +77,54 @@ export const SysPrintApiAxiosParamCreator = function (configuration?: Configurat
|
|||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 复制打印模板
|
||||||
|
* @param {DeletePrintInput} [body]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiSysPrintCopyPost: async (body?: DeletePrintInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
const localVarPath = `/api/sysPrint/copy`;
|
||||||
|
// 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,
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 删除打印模板 🖨️
|
* @summary 删除打印模板 🖨️
|
||||||
@ -293,6 +341,20 @@ export const SysPrintApiFp = function(configuration?: Configuration) {
|
|||||||
return axios.request(axiosRequestArgs);
|
return axios.request(axiosRequestArgs);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 复制打印模板
|
||||||
|
* @param {DeletePrintInput} [body]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysPrintCopyPost(body?: DeletePrintInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||||
|
const localVarAxiosArgs = await SysPrintApiAxiosParamCreator(configuration).apiSysPrintCopyPost(body, options);
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 删除打印模板 🖨️
|
* @summary 删除打印模板 🖨️
|
||||||
@ -368,6 +430,16 @@ export const SysPrintApiFactory = function (configuration?: Configuration, baseP
|
|||||||
async apiSysPrintAddPost(body?: AddPrintInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
async apiSysPrintAddPost(body?: AddPrintInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||||
return SysPrintApiFp(configuration).apiSysPrintAddPost(body, options).then((request) => request(axios, basePath));
|
return SysPrintApiFp(configuration).apiSysPrintAddPost(body, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 复制打印模板
|
||||||
|
* @param {DeletePrintInput} [body]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysPrintCopyPost(body?: DeletePrintInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||||
|
return SysPrintApiFp(configuration).apiSysPrintCopyPost(body, options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 删除打印模板 🖨️
|
* @summary 删除打印模板 🖨️
|
||||||
@ -429,6 +501,17 @@ export class SysPrintApi extends BaseAPI {
|
|||||||
public async apiSysPrintAddPost(body?: AddPrintInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
public async apiSysPrintAddPost(body?: AddPrintInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||||
return SysPrintApiFp(this.configuration).apiSysPrintAddPost(body, options).then((request) => request(this.axios, this.basePath));
|
return SysPrintApiFp(this.configuration).apiSysPrintAddPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 复制打印模板
|
||||||
|
* @param {DeletePrintInput} [body]
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof SysPrintApi
|
||||||
|
*/
|
||||||
|
public async apiSysPrintCopyPost(body?: DeletePrintInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||||
|
return SysPrintApiFp(this.configuration).apiSysPrintCopyPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 删除打印模板 🖨️
|
* @summary 删除打印模板 🖨️
|
||||||
|
|||||||
@ -43,6 +43,9 @@
|
|||||||
<el-tooltip content="编辑" placement="top">
|
<el-tooltip content="编辑" placement="top">
|
||||||
<el-button icon="ele-Edit" text type="primary" v-auth="'sysPrint/update'" @click="handleEdit(row)"> </el-button>
|
<el-button icon="ele-Edit" text type="primary" v-auth="'sysPrint/update'" @click="handleEdit(row)"> </el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<el-tooltip content="复制" placement="top">
|
||||||
|
<el-button icon="ele-DocumentCopy" text type="primary" v-auth="'sysPrint/add'" @click="handleCopy(row)"> </el-button>
|
||||||
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top">
|
<el-tooltip content="删除" placement="top">
|
||||||
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPrint/delete'" @click="handleDelete(row)"> </el-button>
|
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPrint/delete'" @click="handleDelete(row)"> </el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -151,6 +154,14 @@ const handleEdit = (row: any) => {
|
|||||||
editPrintRef.value?.openDialog(row);
|
editPrintRef.value?.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 复制
|
||||||
|
const handleCopy = async (row: any) => {
|
||||||
|
var res = await getAPI(SysPrintApi).apiSysPrintCopyPost({ id: row.id });
|
||||||
|
handleQuery();
|
||||||
|
ElMessage.success('复制成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = (row: any) => {
|
const handleDelete = (row: any) => {
|
||||||
ElMessageBox.confirm(`确定删除打印模板:【${row.name}】?`, '提示', {
|
ElMessageBox.confirm(`确定删除打印模板:【${row.name}】?`, '提示', {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user