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)
},
相关推荐
慧一居士19 分钟前
flex 布局完整功能介绍和示例演示
前端
DoraBigHead21 分钟前
小哆啦解题记——两数失踪事件
前端·算法·面试
AI+程序员在路上26 分钟前
Qt6中模态与非模态对话框区别
开发语言·c++·qt
nbsaas-boot5 小时前
Java 正则表达式白皮书:语法详解、工程实践与常用表达式库
开发语言·python·mysql
chao_7895 小时前
二分查找篇——搜索旋转排序数组【LeetCode】两次二分查找
开发语言·数据结构·python·算法·leetcode
一斤代码6 小时前
vue3 下载图片(标签内容可转图)
前端·javascript·vue
风无雨6 小时前
GO 启动 简单服务
开发语言·后端·golang
中微子6 小时前
React Router 源码深度剖析解决面试中的深层次问题
前端·react.js
光影少年6 小时前
从前端转go开发的学习路线
前端·学习·golang
斯普信专业组6 小时前
Go语言包管理完全指南:从基础到最佳实践
开发语言·后端·golang