mvc之验证IEnumerable<T> 类型

本文讨论了在ASP.NET MVC中改进表单验证的方法,特别是如何在多个输入框中进行验证,以及如何使用jQuery.validate插件进行个性化验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

假设我们有这么一种需求,我们要同时添加年级和年级下面的多个班级,我们一般会像下面这种做法。

Action中我们这样接收:

[HttpPost]
public ActionResult CreateGrade(string gradeName, IEnumerable<string> classNames)
{

    return View();
}

View中我们一般会这样做:

 

 

@using (Ajax.BeginForm("index", "home", new AjaxOptions { OnBegin="onBegin", OnSuccess = "onSuccess" }))
{
    <p>
        若要了解有关 ASP.NET MVC 的更多信息,请访问 @Html.ActionLink("link me", "about", "home", new { plugin="dialog"})。
    </p>
    <input type="text" class="required" style="width:90px;" name="gradeName" />
    <input type="text" class="required" style="width:90px;" name="classNmae" />
    <input type="text" class="required" style="width:90px;" name="classNmae" />
    <input type="text" class="required" style="width:90px;" name="classNmae" />
    <button class="tn-button-primary" type="submit">
        <span class="tn-button-text">提交</span></button>
}

这种做法会有什么问题呢? 问题在于jquery.validate验证不支持验证多个相同的name,默认只验证第一个,所以只要第一个验证了,表单就可以提交了。我们要怎么改进呢?其实很简单,改一下班级的input的name就可以了。如下:

@using (Ajax.BeginForm("index", "home", new AjaxOptions { OnBegin="onBegin", OnSuccess = "onSuccess" }))
{
    <p>
        若要了解有关 ASP.NET MVC 的更多信息,请访问 @Html.ActionLink("link me", "about", "home", new { plugin="dialog"})。
    </p>
    <input type="text" class="required" style="width:90px;" name="gradeName" />
    <input type="text" class="required" style="width:90px;" name="classNmae[0]" />
    <input type="text" class="required" style="width:90px;" name="classNmae[1]" />
    <input type="text" class="required" style="width:90px;" name="classNmae[2]" />
    <button class="tn-button-primary " type="submit">
        <span class="tn-button-text">提交</span></button>
}

这样子就可以每一个都验证了,类似这样子验证的还有IEnumerable<Grade>,可以这样子写grade.Name[0],grade.Name[1]。但是这样子还是有问题,就是我们只能通过class样式来验证,如必填项class="required"。改成这样之后我们要怎么实现通过类似$("form").validate({options})来配置验证呢? 不用急下面来介绍怎么实现吧。

@using (Ajax.BeginForm("index", "home", new AjaxOptions { OnBegin="onBegin", OnSuccess = "onSuccess" }))
{
    <p>
        若要了解有关 ASP.NET MVC 的更多信息,请访问 @Html.ActionLink("link me", "about", "home", new { plugin="dialog"})。
    </p>
    <input type="text" style="width:90px;" name="gradeName" />
    <input type="text" style="width:90px;" name="classNmae[0]" class="classname" />
    <input type="text" style="width:90px;" name="classNmae[1]" class="classname" />
    <input type="text" style="width:90px;" name="classNmae[2]" class="classname" />
    <button class="tn-button-primary " type="submit">
        <span class="tn-button-text">提交</span></button>
}
<script type="text/javascript">
    $(function () {
        $("form").validate();//这句是必须的。
        $("input.classname").each(function () {
            $(this).rules("add", {
                required: true,
                number: true,
                messages: {
                    required: "不能为空",
                    number: "只能是数字"
                }
            });
        });
    })
</script>

这样子就是现实了。
来一个完整的:

@using (Html.BeginForm("index", "home", FormMethod.Post, new { id="createForm"}))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>创建年级</legend>
        <div class="editor-label">
            年级名称
        </div>
        <div class="editor-field">
            <input type="text" class="required" style="width:90px;" name="gradeName" />
        </div>

        <div class="editor-label">
            班级1
        </div>
        <div class="editor-field">
            <input type="text" style="width:90px;" name="classNmae[0]" class="classname" />
        </div>
        <div class="editor-label">
            班级2
        </div>
        <div class="editor-field">
            <input type="text" style="width:90px;" name="classNmae[1]" class="classname" />
        </div>
        <div class="editor-label">
            班级3
        </div>
        <div class="editor-field">
            <input type="text" style="width:90px;" name="classNmae[2]" class="classname" />
        </div>
        <p>
            <button class="tn-button-primary " type="submit">
                <span class="tn-button-text">提交</span></button>
        </p>
    </fieldset>
}

<script type="text/javascript">
    $(function () {
        $("#createForm").validate();//这句是必须的。
        $("input.classname").each(function () {
            $(this).rules("add", {
                required: true,
                number: true,
                messages: {
                    required: "不能为空",
                    number: "只能是数字"
                }
            });
        });
    })
</script>





 

 

Microsoft.Data.SqlClient.SqlException (0x80131904): 对象名 'Receive' 无效。 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__195_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434 at Finance.Infrastructure.DapperDb.Query[T](String sql, Object parameters) in D:\2211A实训一\项目\erp\财务管理\Finance.Infrastructure\DapperDb.cs:line 23 at Finance.Api.Read.Applications.CommandHands.ReceiveQueryCommandHandlers.Handle(ReceiveQueryCommand request, CancellationToken cancellationToken) in D:\2211A实训一\项目\erp\财务管理\Finance.Api.Read\Applications\CommandHands\ReceiveQueryCommandHandlers.cs:line 32 at Finance.Api.Read.Controllers.ManagementController.ReceiveQuery(ReceiveQueryCommand request) in D:\2211A实训一\项目\erp\财务管理\Finance.Api.Read\Controllers\ManagementController.cs:line 26 at lambda_method5(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) ClientConnectionId:2a4e1948-5a2d-453c-a4b3-616d63e0b80c Error Number:208,State:1,Class:16 HEADERS ======= Accept: text/plain Connection: keep-alive Host: localhost:5047 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Accept-Encoding: gzip, deflate, br, zstd Accept-Language: zh-CN,zh;q=0.9 Referer: http://localhost:5047/swagger/index.html sec-ch-ua-platform: "Windows" sec-ch-ua: "Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138" sec-ch-ua-mobile: ?0 Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty
最新发布
07-23
这是前端<template> <div class="historyData_page" style="display: flex; margin-bottom: 0px; width: 100%"> <div style="width: 100%"> <div class="content"> <label><strong>工序号</strong></label> <el-select placeholder="请选择工序号" v-model="processColumnParams.process_no" clearable style="width: 250px"> <el-option v-for="item in this.$store.state.commonProcessList" :key="item.process_no" :label="item.process_no + item.details" :value="item.process_no"> </el-option> </el-select> <label><strong>主条形码</strong></label> <el-input placeholder="请输入主条形码" v-model="selectParams.bar_no" clearable style="width: 300px"> </el-input> <label><strong>结果</strong></label> <el-select placeholder="请选择查询结果" v-model="selectParams.ok_flag" clearable style="width: 150px"> <el-option v-for="item in $t('histortData.flag_options')" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> <label><strong>选择时间范围</strong></label> <el-date-picker type="datetime" placeholder="选择开始时间" v-model="selectParams.startTime" default-time="12:00:00"> </el-date-picker> <el-date-picker type="datetime" placeholder="选择结束时间" v-model="selectParams.endTime" default-time="12:00:00"> </el-date-picker> <el-button style="margin: 0 0 0 10px" type="primary" icon="el-icon-search" @click="SearchTable">搜索</el-button> <el-button style="margin: 0 10px 0 10px" type="primary" icon="el-icon-refresh" @click="resetInput">重置</el-button> </div> <div style="margin: 5px 0 10px 10px"> <el-button type="primary" plain icon="el-icon-plus" @click="dialogFormVisible = true">{{ "新增" }} </el-button> <el-button type="danger" plain icon="el-icon-delete">{{ "删除" }} </el-button> <el-button type="warning" plain icon="el-icon-download" @click="handleDownload">{{ "导出" }} </el-button> </div> <div class="tab_Data"> <el-table :data="tableData.slice((currentPage - 1) * PageSize, currentPage * PageSize)" style="width: 100%" height="1115" border :cell-style="cellStyle" :header-cell-style="{ background: '#f5f7fa', color: '#000000', }" v-loading="loading" ref="tableRef" @selection-change="selectionLineChangeHandle" > <af-table-column type="selection"></af-table-column> <template v-for="(item, index) in processTableColumnName"> <af-table-column v-if="item.type == 'bar'" :key="index" :label="item.label" :prop="item.name" fixed> </af-table-column> <af-table-column v-else-if="item.type == 'img'" :key="index" :label="item.label" :prop="item.name"> <template slot-scope="scope"> <el-button type="text" @click="SearchProcessFile(scope.row.bar_no, processColumnParams.process_no, item.label, scope.row.do_time)"> {{ item.label }} </el-button> </template> </af-table-column> <af-table-column v-else-if="item.type == 'csv'" :key="index" :label="item.label" :prop="item.name"> <template slot-scope="scope"> <el-button type="text" @click="SearchCsvFile(scope.row.bar_no, processColumnParams.process_no, item.label, scope.row.do_time)"> {{ item.label }} </el-button> </template> </af-table-column> <af-table-column v-else :key="index" :prop="item.name" :label="item.label"> </af-table-column> </template> </el-table> <div class="tabListPage"> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="pageSizes" :page-size="PageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalCount"> </el-pagination> </div> </div> </div> <!-- 照片弹框 --> <el-dialog :visible.sync="imageDialogVisible" width="40%"> <div> <span class="demonstration">{{ ProcessFile.name }}</span ><br /> <span class="demonstration">{{ ProcessFile.bar_no }}</span ><br /> <span class="demonstration">{{ image.picPath }}</span> </div> <div> <el-image :src="image.path" :preview-src-list="srcList"></el-image> </div> </el-dialog> <!-- csv弹框 --> <el-dialog :visible.sync="csvDialogVisible" width="60%"> <!-- <div> <el-button type="primary" icon="el-icon-download" @click="csvDownload">{{ 111 }}</el-button> </div> --> <div> <span class="demonstration">{{ csvFile.bar_no }}</span> </div> <div class="main" ref="chartDom" style="widows: 1200px; height: 400px"></div> </el-dialog> </div> </template> <script> import api from "@/api"; import { saveJsonToExcel } from "@/utils/xlsx"; export default { data() { return { processColumnParams: { process_no: "", eqpt_status: "1", }, routerValue: {}, selectParams: { process_no: "", bar_no: "", ok_flag: "All", startTime: "", endTime: "", }, image: { name: "", path: "", picPath: "", }, imageDialogVisible: false, csvDialogVisible: false, searchedImage: false, ProcessFile: { bar_no: "", process_no: "", name: "", lang: "zh", do_time: "" }, plcadress: "", interactionvalue: "", tableData: [], totalCount: 1, currentPage: 1, PageSize: 15, pageSizes: [5, 15, 30, 40], dialogFormVisible: false, modifyDialogFormVisible: false, formDialog: { Process_no: "", Details: "", }, labelPosition: "left", selectedRows: [], processTableColumnName: [], srcList: [], loading: true, // 查询csv文件参数 csvFile: { bar_no: "", process_no: "", name: "", lang: "", do_time: "" }, //曲线数据 csvChart: [], }; }, computed: { change() { this.selectParams = this.$route.params.value == null ? this.selectParams : this.$route.params.value; } }, watch: { change(val) { console.log(val) } }, created() { console.log(this.$route.params.value); console.log(this.selectParams); this.selectParams = this.$store.state.historyData; this.processColumnParams.process_no = this.selectParams.process_no; console.log("this.selectParams"); this.SearchTable(); }, methods: { setinfor() { //console.log(this.selectParams); this.$store.dispatch("historyData", this.selectParams); }, SearchTable() { // console.log(this.selectParams); this.loading = true; this.selectParams.process_no = this.processColumnParams.process_no; console.log(this.selectParams.process_no); if (this.processColumnParams.process_no == "") { this.$message.warning("请先选择要查询的工序号!"); } else if (this.processColumnParams.startTime == "") { this.$message.warning("请先选择要查询的起始时间!"); } else if (this.processColumnParams.endTime == "") { this.$message.warning("请先选择要查询的截止时间!"); } else { this.processTableColumnName = []; for (let index = 0; index < this.$t("histortData.processFixedTableColumnName").length; index++) { const element = this.$t("histortData.processFixedTableColumnName")[index]; this.processTableColumnName.push(element); } api.getProcessTableColumnName("/ProcessTableColumnName", this.processColumnParams).then((data) => { for (let index = 0; index < data.data.length; index++) { const element = data.data[index]; this.processTableColumnName.push(element); } console.log(data.data); }); api.getProcessProperties("/ProcessProperties", this.selectParams).then((data) => { console.log(data.data); this.loading = false; this.totalCount = data.data.length; this.tableData = data.data; console.log(data.data); this.setinfor(); //数据存储 }); } }, //获取工序图片 产品码、工序、图片名 SearchProcessFile(val, val2, val3, val4) { console.log(val, val2, val3, val4); this.ProcessFile.bar_no = val; this.ProcessFile.process_no = val2; this.ProcessFile.name = val3; this.ProcessFile.do_time = val4; this.ProcessFile.lang = "zh"; // 显示指定产品的指定图片 api.getProcessFileSingle("/ProcessFileSingle", this.ProcessFile).then((data) => { // 清空image数据 this.image = []; // 清空 this.srcList = []; this.imageDialogVisible = true; if (data.data[0].path == "") { this.searchedImage = false; } else { this.image = data.data[0]; for (let index = 0; index < data.data.length; index++) { const element = data.data[index].path; this.srcList.push(element); } this.searchedImage = true; } }); }, //获取csv SearchCsvFile(val, val2, val3, val4) { this.csvFile.bar_no = val; this.csvFile.process_no = val2; this.csvFile.name = val3; this.csvFile.do_time = val4; this.csvFile.lang = "zh"; // 获取最新图片 //this.csvColumnName = this.$t("PointInspectionResult.VibrationCsvColumnName"); api.getReadCurves("/ReadCurves", this.csvFile).then((data) => { //this.csvChart = data.data; this.csvDialogVisible = true; console.log(this.csvFile); console.log(data.data); this.initChart(data.data); }); }, initChart(data) { this.$nextTick(() => { this.csvChart = data; var chartDom = this.$refs.chartDom; // 检查 DOM 元素是否存在 if (!chartDom) { console.error("chartDom is not found"); return; } // 检查 DOM 元素的宽度和高度 console.log("chartDom width:", chartDom.offsetWidth, "height:", chartDom.offsetHeight); var myChart = this.$echarts.init(chartDom); var xAxis = []; var yAxis = []; this.csvChart.forEach((el) => { xAxis.push(el.x_Absolute); yAxis.push(el.y); }); yAxis = data.map((el) => parseFloat(el.y)); console.log("xAxis:", xAxis); console.log("yAxis:", yAxis); var option = { tooltip: { trigger: "axis", formatter: (params) => { const xValue = params[0].axisValue; const yValue = params[0].data; return `${xValue}:${yValue}`; }, axisPointer: { type: "cross", label: { backgroundColor: "#6a7985", }, }, }, xAxis: { type: "category", data: xAxis, name: "单位(s)", axisLabel: { show: true, showMaxLabel: true, showMinLabel: true, }, }, yAxis: { type: "value", name: "单位(N)", //max: 2, }, series: [ { data: yAxis, type: "line", }, ], }; myChart.setOption(option); }); }, selectionLineChangeHandle(val) { // console.log(this.selectedRows); this.selectedRows = val; }, resetInput() { (this.fieldname = ""), (this.plcadress = ""), (this.interactionvalue = ""); }, modifyData(val) { this.modifyDialogFormVisible = true; }, cellStyle({ row, column, rowIndex, columnIndex }) { // NG字样红色显示 // for (let index = 0; index < this.$t("ShowResult.tableColumnName").length; index++) { // const element = this.$t("ShowResult.tableColumnName")[index].name; // if (row[element] == "NG" && column.property == element) { // return "color:red"; // } // } // 数据超限红色显示 // for (let i = 0; i < this.ParamatesLimit.length; i++) { // const element = this.ParamatesLimit[i].name; // if ((Number(this.ParamatesLimit[i].up_limit) < Number(row[element]) || Number(row[element]) < Number(this.ParamatesLimit[i].down_limit)) && column.property == element) { // return "color:red"; // } // } for (let index = 0; index < this.processTableColumnName.length; index++) { const element = this.processTableColumnName[index].name; if (row[element] == "NG" && column.property == element) { return "color:red"; } } }, // 导出数据 handleDownload() { var tabHandle = []; //导出表头 for (let index = 0; index < this.processTableColumnName.length; index++) { const element = this.processTableColumnName[index]; if (element.type != "img" && element.type != "csv") { tabHandle.push(element.label); } } saveJsonToExcel(this.tableData, tabHandle, "OP" + this.processColumnParams.process_no + ".xlsx"); }, // 每页显示的条数 handleSizeChange(val) { // 改变每页显示的条数 this.PageSize = val; // 注意:在改变每页显示的条数时,要将页码显示到第一页 this.currentPage = 1; }, // 显示第几页 handleCurrentChange(val) { // 改变默认的页数 this.currentPage = val; }, }, updated() { // tableRef是表格的ref属性值 if (this.$refs.tableRef && this.$refs.tableRef.doLayout) { this.$refs.tableRef.doLayout(); } }, }; </script> <style scoped lang="less"> .el-menu { width: 200px; } .tab_Data { // width: 100%; /* margin-top: 30px; margin-left: 10px; margin-right: 10px; */ } .content { // justify-content: flex-start; // display: flex; } </style> 这是后端using SanHuaMesApiServer.Models; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.VisualBasic.FileIO; using System.Data; using System.Globalization; using System.Text; using SanHuaMesApiServer.Helps; namespace SanHuaMesApiServer.Controllers { [Route("api/[controller]")] [ApiController] public class ProcessCheckColumnNameController : ControllerBase { [HttpGet] public async Task<IEnumerable<ProcessTableColumnName>> Get([FromQuery] string process_no,string inspection_type,string eqpt_status,string? file_type) { return await Task.Factory.StartNew(() => { StringBuilder sb = new StringBuilder(); sb.Append($"select field_name,field_name_cn from SHProcessInspectionPropertyParse where process_no = '{process_no}' and inspection_type = '{inspection_type}' ORDER BY field_name "); DataSet data = SqlHelper.GetTable(CommandType.Text, sb.ToString(), null); StringBuilder sbImag = new StringBuilder(); sbImag.Append($"select name,name_en from GTProcessFileConfig where process_no = '{process_no}' and eqpt_status = '{eqpt_status}' and file_type = '{file_type}'"); DataSet dataImag = SqlHelper.GetTable(CommandType.Text, sbImag.ToString(), null); List<ProcessTableColumnName> temp = new List<ProcessTableColumnName>(); foreach (DataRow row in dataImag.Tables[0].Rows) { temp.Add(new ProcessTableColumnName() { Name = row[1].ToString(), Label = row[0].ToString(), Type = file_type, }); ; ; } foreach (DataRow row in data.Tables[0].Rows) { temp.Add(new ProcessTableColumnName() { Name = row[0].ToString(), Label = row[1].ToString(), Type = "", }); ; ; } return temp.AsEnumerable(); }); } } [Route("api/[controller]")] [ApiController] public class ProcessCheckColumnNameEnController : ControllerBase { [HttpGet] public async Task<IEnumerable<ProcessTableColumnName>> Get([FromQuery] string process_no, string inspection_type, string eqpt_status, string? file_type) { return await Task.Factory.StartNew(() => { StringBuilder sb = new StringBuilder(); sb.Append($"select field_name,field_name_en from SHProcessInspectionPropertyParse where process_no = '{process_no}' and inspection_type = '{inspection_type}' "); DataSet data = SqlHelper.GetTable(CommandType.Text, sb.ToString(), null); StringBuilder sbImag = new StringBuilder(); sbImag.Append($"select name,name_en,file_type from GTProcessFileConfig where process_no = '{process_no}' and eqpt_status = '{eqpt_status}' and file_type = '{file_type}'"); DataSet dataImag = SqlHelper.GetTable(CommandType.Text, sbImag.ToString(), null); List<ProcessTableColumnName> temp = new List<ProcessTableColumnName>(); foreach (DataRow row in dataImag.Tables[0].Rows) { temp.Add(new ProcessTableColumnName() { Name = row[1].ToString(), Label = row[1].ToString(), Type = row[2].ToString(), }); ; ; } foreach (DataRow row in data.Tables[0].Rows) { temp.Add(new ProcessTableColumnName() { Name = row[0].ToString(), Label = row[1].ToString(), Type = "", }); ; ; } return temp.AsEnumerable(); }); } } }报错这个index.js:116 GET https://127.0.0.1:7053/api/ProcessProperties?process_no=20&bar_no=&ok_flag= 400 (Bad Request) settle.js:19 Uncaught (in promise) AxiosError {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …} code : "ERR_BAD_REQUEST" config : {transitional: {…}, adapter: Array(3), transformRequest: Array(1), transformResponse: Array(1), timeout: 10000, …} message : "Request failed with status code 400" name : "AxiosError" request : XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 10000, withCredentials: false, upload: XMLHttpRequestUpload, …} response : {data: {…}, status: 400, statusText: '', headers: AxiosHeaders, config: {…}, …} status : 400 stack : "AxiosError: Request failed with status code 400\n at settle (webpack-internal:///./node_modules/axios/lib/core/settle.js:24:12)\n at XMLHttpRequest.onloadend (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:63:66)\n at Axios.request (webpack-internal:///./node_modules/axios/lib/core/Axios.js:54:41)" [[Prototype]] : Error XMLHttpRequest.send getProcessProperties @ index.js:116 SearchTable @ historyData.vue:197
05-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值