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)
},
相关推荐
任子菲阳15 小时前
学Java第五十三天——IO综合练习(1)
java·开发语言·爬虫
繁华似锦respect15 小时前
单例模式出现多个单例怎么确定初始化顺序?
java·开发语言·c++·单例模式·设计模式·哈希算法·散列表
码农很忙15 小时前
让复杂AI应用构建像搭积木:Spring AI Alibaba Graph深度指南与源码拆解
开发语言·人工智能·python
风止何安啊15 小时前
递归 VS 动态规划:从 “无限套娃计算器” 到 “积木式解题神器”
前端·javascript·算法
ohyeah15 小时前
使用 Vue 3 实现大模型流式输出:从零搭建一个简易对话 Demo
前端·vue.js·openai
GPTMirrors镜像系统15 小时前
JS 实现指定 UA 访问网站跳转弹窗提醒,解决夸克等浏览器兼容性问题
前端·javascript
渡我白衣15 小时前
计算机组成原理(1):计算机发展历程
java·运维·开发语言·网络·c++·笔记·硬件架构
霸王大陆15 小时前
《零基础学 PHP:从入门到实战》模块十:从应用到精通——掌握PHP进阶技术与现代化开发实战-4
开发语言·php
踢球的打工仔15 小时前
前端html(2)
前端·算法·html
脾气有点小暴15 小时前
JavaScript 数据存储方法全解析:从基础到进阶
开发语言·javascript·ecmascript