element表格双击修改时间

bash 复制代码
<el-table
                class="mt-15"
                v-loading="listLoading"
                @cell-click="tableDbEdit" @cell-dblclick="tableDbEdit"
                stripe 
                :data="dataList"
                style="width: 100%">
                    <el-table-column align="center"  prop="orderNumber" label="订单编号"  width="180"></el-table-column>
                    <el-table-column align="center"  prop="customerName" label="客户名称"  width="120"></el-table-column>
                    <el-table-column align="center"  prop="productDate" label="生产时间"  width="200">
                        <template slot-scope="scope">
                            <div  v-if="showdatetime == `productDate${scope.row.id}`">
                                <el-date-picker
                                    value-format="yyyy-MM-dd"
                                    style="width: 135px;"
                                    size="mini"
                                    v-model="scope.row.productDate"
                                     @blur='blurdate(scope.row, "productDate", scope.row.productDate)'
                                    :clearable="false"
                                    type="date"
                                    placeholder="请选择生产时间">
                                </el-date-picker>
                                <el-button  @click="subtimeBtn(scope.row)" type="text"  size="small" class="ml-10">提交</el-button>
                            </div>
                            <div v-else>{{ scope.row.productDate }}</div>
                        </template>
                    </el-table-column>
                    <el-table-column align="center"  prop="shipDate" label="船期时间"  width="100"></el-table-column>
                    <el-table-column align="center"  label="产品型号/客户要求"  width="150">
                        <template slot-scope="scope">
                            <el-button  @click="opendetail(scope.row)" type="text"   size="small" class="mr-10">详情</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column align="center"  prop="totalRequireQuantity" width="70" label="总需求量T/吨"></el-table-column>
                    <el-table-column align="center"  prop="remark"  label="备注"></el-table-column>
                    <el-table-column fixed="right" align="center" label="操作" width="200">
                        <template slot-scope="scope">
                            <el-button  @click="toorderEdit(scope.row)"  type="text"   size="small" class="mr-10">修改</el-button>
                            <el-button  @click="deleteBtn(scope.row)" type="text"  size="small">取消</el-button>
                        </template>
                    </el-table-column>
            </el-table>
bash 复制代码
 return {
                showdatetime: "",
                oldData: {},
                currentData: {} ,
      }
bash 复制代码
 blurdate(row, name, value) {
    // 判断数据是否有所改变,如果数据有改变则调用修改接口
    if (this.oldData[name] != value) {
    row[name] = value
    if (value === true) {
        row[name] = 1
    } else if (value === false) {
        row[name] = 0
    }
    }
    this.currentData = row
},
tableDbEdit(row, column, event) {
    this.showdatetime = column.property + row.id;
    this.oldData[column.property] = row[column.property];
},      
subtimeBtn(row){
    this.showdatetime = ""
    console.log("ssss",row)
},
相关推荐
ghost1431 分钟前
C#学习第15天:泛型
开发语言·学习·c#
碎梦归途3 分钟前
23种设计模式-创建型模式之单例模式(Java版本)
java·开发语言·jvm·单例模式·设计模式
满怀10158 分钟前
【Python进阶】元组:不可变序列的十大核心应用
开发语言·python
忧郁的蛋~9 分钟前
小程序页面传值的多种方式
前端·小程序
萌萌哒草头将军16 分钟前
✈️ Colipot Agent + 🔥 MCP Tools = 让你的编程体验直接起飞🚀
javascript·visual studio code·mcp
程序猿John18 分钟前
Python入门安装和语法基础
开发语言·python
一键三联啊21 分钟前
ArrayList的subList的数据仍是集合
java·开发语言
liuyang___23 分钟前
分享一下这几天在公司学到的东西
前端
rocky19125 分钟前
谷歌浏览器插件 录制菜单路由跳转行为 事件重复解决方案
前端·javascript
佳腾_28 分钟前
【web服务_负载均衡Nginx】一、Nginx 基础与核心概念解析
前端·nginx·负载均衡