Browse Source

拆解工单优化

wyh 2 years ago
parent
commit
e5240ff296

+ 0 - 139
itdmWeb/src/views/module-iTDM/itdmGongdanMaster/itdmGongdanMasterList.vue

@@ -245,145 +245,6 @@ export default {
         focus: function (node) {
           $(node.firstChild).focus();
         }};
-      // 单击获取当前行信息
-      // gantt.attachEvent("onTaskRowClick", function (id, e){
-      //   let that = this
-      //   console.log("单击当前行",id,e)
-      //   gantt.getTask(id);
-      //     //any custom logic here
-      //     return true;
-      // });
-      // 给灯箱赋默认值(将父任务的参数赋给灯箱)
-      gantt.attachEvent("onTaskCreated", function(task){
-        console.log("给灯箱赋默认值",task,gantt.getTask(task.parent))
-        // 灯箱部分
-        task.shebeiId = gantt.getTask(task.parent).shebeiId
-        // task.reportNo = gantt.getTask(task.parent).reportNo
-        task.chuanganqiArray = gantt.getTask(task.parent).chuanganqiArray
-        // 灯箱虽不展示,但也要赋值
-        task.deviceName = gantt.getTask(task.parent).deviceName
-        task.yangpinId = gantt.getTask(task.parent).yangpinId
-        task.sampleName = gantt.getTask(task.parent).sampleName
-        task.shijiStartDate = gantt.getTask(task.parent).shijiStartDate
-        task.testItems = gantt.getTask(task.parent).testItems
-        task.testItemsId = gantt.getTask(task.parent).testItemsId
-        task.testPlanId = gantt.getTask(task.parent).testPlanId
-        task.weituoId = gantt.getTask(task.parent).weituoId
-        task.weituoNo = gantt.getTask(task.parent).weituoNo
-        console.log("第二个",task)
-        return true;
-      });
-      //弹出层(灯箱)
-      // gantt.config.lightbox.sections = [
-      // ];
-      // 根据判断不同级别任务弹不同的灯框(并展示不同的按钮)
-      var full_lightbox =[
-        {
-          name: "time", height: 40, map_to: "auto", type: "duration",
-          time_format: ["%Y", "%m", "%d"],
-        },
-        // { name: "reportNo", height: 30, map_to: "reportNo", type: "textarea", },
-        { name: "device", height: 30, map_to: "shebeiId", type: "select", options: gantt.serverList('staff2',[]), },
-        { name: "sensor", height: 30, map_to: "chuanganqiArray", type: "multiselect", options: gantt.serverList('chuanganqi2',[]), },
-        { name: "shiiyanType", height: 30, map_to: "shiiyanTypeArray", type: "multiselect", options: gantt.serverList('testTypeOptions',[]), },
-        { name: "worker", height: 30, map_to: "worker", type: "select", options: gantt.serverList('worker',[]), },
-        { name: "yangpinCount", height: 30, map_to: "yangpinCount", type: "textarea", width: 60 },
-        { name: "neirong", height: 45, map_to: "neirong", type: "textarea", focus: true, width: "*", },
-      ];
-      var restricted_lightbox = [
-        {
-          name: "time", height: 40, map_to: "auto", type: "duration",
-          time_format: ["%Y", "%m", "%d"],
-        },
-        { name: "reportNo", height: 30, map_to: "reportNo", type: "textarea" },
-        { name: "device", height: 30, map_to: "shebeiId", type: "select", options: gantt.serverList('staff',[]), },
-        { name: "sensor", height: 30, map_to: "chuanganqiArray", type: "multiselect", options: gantt.serverList('chuanganqi',[]), },
-      ];
-      gantt.attachEvent("onBeforeLightbox", function(task_id) {
-        gantt.resetLightbox();
-        var task = gantt.getTask(task_id);
-        // console.log("重置灯箱",task)
-        if (task.$level == 0){
-          gantt.config.lightbox.sections = restricted_lightbox;
-          gantt.config.buttons_left = ["gantt_cancel_btn"];
-          gantt.config.buttons_right = [];
-        } else {
-          gantt.config.lightbox.sections = full_lightbox;
-          gantt.config.buttons_left = ["gantt_save_btn", "gantt_cancel_btn"];
-          gantt.config.buttons_right = ["gantt_delete_btn"];
-        };
-        return true;
-      });
-      // 展示灯箱里的删除按钮
-      // gantt.config.buttons_right = ["gantt_delete_btn"];
-      // 点击灯箱的保存按钮触发
-      let that = this
-      gantt.attachEvent("onLightboxSave", function(id, task, is_new){
-        console.log(id, task, is_new)
-        let y = task.start_date.getFullYear()
-        let m = task.start_date.getMonth() + 1
-        m = m < 10 ? ('0' + m) : m
-        let d = task.start_date.getDate()
-        d = d < 10 ? ('0' + d) : d
-        task.jihuaStartDate = y + '-' + m + '-' + d ;
-        // task.jihuaStartDate = task.start_date
-        task.lastTime = task.duration
-        console.log("提交",task)
-        saveProjectJl(task).then((res) => {
-          console.log("提交返回",task,res)
-          gantt.clearAll();
-          gantt.init(that.$refs.gantt);
-          gantt.parse(that.tasks);
-          // that.getHjlist(that.tasks.queryParam)
-        })
-        return true;
-      })
-      // 点击灯箱删除按钮触发
-      gantt.attachEvent("onLightboxDelete", function(id){
-        const task = gantt.getTask(id);
-        console.log(task)
-        if (task.statusC == "不可修改"){
-          // alert("该项已进行,不可修改");
-          notification.open({
-            message: '注意',
-            description: "该项已进行,不可修改",
-          });
-          gantt.hideLightbox();
-          return false;
-        }else{
-          return true;
-        }
-      })
-      // 在删除任务之前触发
-      gantt.attachEvent("onBeforeTaskDelete", function(id,item){
-        var select={id:id}
-        delProjectJl(select).then((res) => {
-          console.log("删除",res)
-          if (res.success) {
-            return true;
-          } else {
-            return false;
-          }
-        })
-        //any custom logic here
-        // return true;
-      });
-      // 隐藏某行的添加按钮
-      gantt.templates.grid_row_class = function( start, end, task ){
-        // console.log("隐藏",task)
-        if ( task.$level > 0 ){
-          return "nested_task"
-        }
-        return "";
-      };
-      // // 自定义弹框
-      // let that = this
-      // gantt.attachEvent("onTaskDblClick", function (id, e){
-      //   console.log(111,id, e);
-      //   that.id = id
-      //   gantt.getTask(that.id);
-      //   console.log("双击获取当前行信息",gantt.getTask(that.id),gantt.getTask(that.id).parent);
-      //   if (gantt.getTask(that.id).parent  == 0) {
         // 单击获取当前行信息
         // gantt.attachEvent("onTaskRowClick", function (id, e){
         //   let that = this