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)
},
相关推荐
ysdysyn6 分钟前
C# 进程管理实战:检查与启动EXE程序的完整指南
开发语言·c#
IDOlaoluo22 分钟前
PHP-5.2.1.tar.gz 离线安装教程:从源码编译到配置的详细步骤(附安装包)
开发语言·php
wangjialelele1 小时前
Qt中的常用组件:QWidget篇
开发语言·前端·c++·qt
乔冠宇1 小时前
vue需要学习的点
前端·vue.js·学习
用户47949283569151 小时前
同样是 #,锚点和路由有什么区别
前端·javascript
Hero_11271 小时前
在pycharm中install不上需要的包
服务器·前端·pycharm
爱上妖精的尾巴2 小时前
5-26 WPS JS宏数组元素添加删除应用
开发语言·前端·javascript·wps·js宏
是谁眉眼2 小时前
wpsapi
前端·javascript·html
谅望者2 小时前
Flexbox vs Grid:先学哪一个?CSS 布局完全指南(附可视化示例)
前端·css·html·css3·css布局·css flexbox·css grid
_OP_CHEN2 小时前
C++进阶:(三)深度解析二叉搜索树原理及实现
开发语言·数据结构·c++·二叉树·二叉搜索树·键值对