浏览代码

国别基准双击修改日期

zhouxingyu 1 天之前
父节点
当前提交
2b4d2b9df0
共有 1 个文件被更改,包括 367 次插入16 次删除
  1. 367 16
      src/views/lg/RegionRule/RegionRuleList.vue

+ 367 - 16
src/views/lg/RegionRule/RegionRuleList.vue

@@ -65,7 +65,9 @@
         :loading="loading"
         :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         class="j-table-force-nowrap"
-        @change="handleTableChange">
+        @change="handleTableChange"
+        >
+
 
         <template slot="htmlSlot" slot-scope="text">
           <div v-html="text"></div>
@@ -119,6 +121,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import RegionRuleModal from './modules/RegionRuleModal'
+  import { httpAction } from '@/api/manage'
 
   export default {
     name: 'RegionRuleList',
@@ -153,73 +156,395 @@
           },
           {
             title:'Last MON',
+            key: 'Last MON',
             align:"center",
-            dataIndex: 'lastMon'
+            width: "60px",
+            dataIndex: 'lastMon',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Last TUE',
+            key:'Last TUE',
             align:"center",
-            dataIndex: 'lastTue'
+            width:"60px",
+            dataIndex: 'lastTue',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Last WED',
+            key:'Last WED',
             align:"center",
-            dataIndex: 'lastWed'
+            width: "60px",
+            dataIndex: 'lastWed',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Last THU',
+            key:'Last THU',
             align:"center",
-            dataIndex: 'lastThu'
+            width: "60px",
+            dataIndex: 'lastThu',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Last FRI',
+            key:'Last FRI',
             align:"center",
-            dataIndex: 'lastFri'
+            width: "60px",
+            dataIndex: 'lastFri',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Last SAT',
+            key:'Last SAT',
             align:"center",
-            dataIndex: 'lastFri'
+            width: "60px",
+            dataIndex: 'lastSat',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Last SUN',
+            key:'Last SUN',
             align:"center",
-            dataIndex: 'lastFri'
+            width: "60px",
+            dataIndex: 'lastSun',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'MON',
+            key:'MON',
             align:"center",
-            dataIndex: 'mon'
+            width: "60px",
+            dataIndex: 'mon',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'TUE',
+            key:'TUE',
             align:"center",
-            dataIndex: 'tue'
+            width: "60px",
+            dataIndex: 'tue',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'WED',
+            key:'WED',
             align:"center",
-            dataIndex: 'wed'
+            width: "60px",
+            dataIndex: 'wed',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'THU',
+            key:'THU',
             align:"center",
-            dataIndex: 'thu'
+            width: "60px",
+            dataIndex: 'thu',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'FRI',
+            key:'FRI',
             align:"center",
-            dataIndex: 'fri'
+            width: "60px",
+            dataIndex: 'fri',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'SAT',
+            key:'SAT',
             align:"center",
-            dataIndex: 'fri'
+            width: "60px",
+            dataIndex: 'sat',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'SUN',
+            key:'SUN',
             align:"center",
-            dataIndex: 'fri'
+            width: "60px",
+            dataIndex: 'sun',
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('div', {
+                style: {
+                  width: "60px"
+                },
+                domProps: {
+                  innerHTML: t == null ? '&nbsp' : t
+                },
+                on: {
+                  dblclick: function() {
+                    that.handleDoubleClick(r, t, column);
+                  }
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
+            }
           },
           {
             title:'Schedule',
@@ -272,7 +597,33 @@
         fieldList.push({type:'string',value:'thu',text:'thu',dictCode:''})
         fieldList.push({type:'string',value:'fri',text:'fri',dictCode:''})
         this.superFieldList = fieldList
-      }
+      },
+
+      handleDoubleClick(record, text, column) {
+        //选中的日期打勾,其余日期置空,并赋值给schedule
+        Object.keys(record).forEach(key => {
+          if(record[key] === "√") {
+            record[key] = null;
+          }
+          if(key == column.dataIndex) {
+            record[key] = "√";
+            record.schedule = column.key;
+          }
+        })
+        httpAction("/regionRule/edit", record, 'post')
+          .then((res) => {
+            if (res.success) {
+              console.log("yes");
+              //this.loadData()
+            } else {
+              this.$message.error(res.message)
+            }
+          })
+          .finally(() => {
+            this.loading = false
+          })
+      },
+
     }
   }
 </script>