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)
},
相关推荐
麦兜*1 小时前
Swift + Xcode 开发环境搭建终极指南
开发语言·ios·swiftui·xcode·swift·苹果vision pro·swift5.6.3
专注API从业者1 小时前
Python + 淘宝 API 开发:自动化采集商品数据的完整流程
大数据·运维·前端·数据挖掘·自动化
你的人类朋友2 小时前
【Node&Vue】JS是编译型语言还是解释型语言?
javascript·node.js·编程语言
萧鼎2 小时前
Python pyzmq 库详解:从入门到高性能分布式通信
开发语言·分布式·python
烛阴2 小时前
TypeScript高手密技:解密类型断言、非空断言与 `const` 断言
前端·javascript·typescript
艾伦~耶格尔3 小时前
【集合框架LinkedList底层添加元素机制】
java·开发语言·学习·面试
样子20183 小时前
Uniapp 之renderjs解决swiper+多个video卡顿问题
前端·javascript·css·uni-app·html
yujkss3 小时前
Python脚本每天爬取微博热搜-终版
开发语言·python
yzx9910133 小时前
小程序开发APP
开发语言·人工智能·python·yolo
Nicholas683 小时前
flutterAppBar之SystemUiOverlayStyle源码解析(一)
前端