Browse Source

2022.3.23计时器、甘特图

17613754660 3 years ago
parent
commit
7894c96366

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/gantt.vue

@@ -91,7 +91,7 @@ export default {
     gantt.config.xml_date = "%Y-%m-%d";
     gantt.config.xml_date = "%Y-%m-%d";
     gantt.config.columns=[
     gantt.config.columns=[
         {name:"text",label:(this.stafforpro == "人员" ? "员工名称" : "项目名称"), align: "left" },
         {name:"text",label:(this.stafforpro == "人员" ? "员工名称" : "项目名称"), align: "left" },
-        {name:"duration",label:"计划工时(h)", align: "center" }
+        {name:"duration",label:"计划工时(h)", align: "center" }
         // {name:"start_date", label:"开始时间", width:'*' , align: "center" },
         // {name:"start_date", label:"开始时间", width:'*' , align: "center" },
         // {name:"duration",   label:"工时(天)", width:'*' ,   align: "center" }
         // {name:"duration",   label:"工时(天)", width:'*' ,   align: "center" }
     ];
     ];

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -48,7 +48,7 @@
                 </el-form-item>
                 </el-form-item>
                 <el-form-item style="float:right;" v-if="user.company.packageProject==1">
                 <el-form-item style="float:right;" v-if="user.company.packageProject==1">
                     <!-- <router-link to="/projectGantt"> -->
                     <!-- <router-link to="/projectGantt"> -->
-                        <el-link type="primary" :underline="false" @click="isganttshow = true">甘特图</el-link>
+                        <el-link type="primary" :underline="false" @click="isganttshow = true">资源分配</el-link>
                     <!-- </router-link> -->
                     <!-- </router-link> -->
                     <el-dialog v-if="isganttshow" :visible.sync="isganttshow" width="1480px" top="3vh" style="height:96%" class="ganttdialog">
                     <el-dialog v-if="isganttshow" :visible.sync="isganttshow" width="1480px" top="3vh" style="height:96%" class="ganttdialog">
                         <projectgantt></projectgantt>
                         <projectgantt></projectgantt>

+ 10 - 23
fhKeeper/formulahousekeeper/timesheet/src/views/project/project_gantt.vue

@@ -26,28 +26,15 @@
       </div>
       </div>
       <div class="head_select">
       <div class="head_select">
         <span>{{(this.radio1 == "按人员查看" ? "人员" : "项目")}}</span>
         <span>{{(this.radio1 == "按人员查看" ? "人员" : "项目")}}</span>
-        <span v-if="!reqpar1">
-      <el-select ref="screenchg1" v-model="valuex" placeholder="请选择" size="small" style="margin-left:9px;width:200px" @change="optupdata()">
+      <el-select v-model="valuex" placeholder="请选择" size="small" style="margin-left:9px;width:200px" @change="optupdata()">
         <el-option
         <el-option
           v-for="item in screenList"
           v-for="item in screenList"
           :key="item.id"
           :key="item.id"
-          :label="item.name"
+          :label="reqpar1 ? item.projectName : item.name"
           :value="item.id"
           :value="item.id"
           >
           >
         </el-option>
         </el-option>
       </el-select>
       </el-select>
-      </span>
-      <span v-if="reqpar1">
-      <el-select ref="screenchg2" v-model="valuex" placeholder="请选择" size="small" style="margin-left:9px;width:200px" @change="optupdata()">
-        <el-option
-          v-for="item in screenList"
-          :key="item.id"
-          :label="item.projectName"
-          :value="item.id"
-          >
-        </el-option>
-      </el-select>
-      </span>
       </div>
       </div>
     </div>
     </div>
     <gantt v-if="isDataLoaded" ref="ganttTable1" class="left-container" :tasks="tasks" 
     <gantt v-if="isDataLoaded" ref="ganttTable1" class="left-container" :tasks="tasks" 
@@ -85,13 +72,13 @@ export default {
       radio1:"按人员查看",
       radio1:"按人员查看",
       valueDate:[],
       valueDate:[],
       options:[{value:"选项1",label:"全部"},{value:"选项2",label:"人员1"}],
       options:[{value:"选项1",label:"全部"},{value:"选项2",label:"人员1"}],
-      valuex:'',
+      valuex:null,
       screenList:[],
       screenList:[],
 
 
       // 请求参数
       // 请求参数
       reqpar1:0,
       reqpar1:0,
       reqpar2:[],
       reqpar2:[],
-      reqpar3:"人员范围/项目范围",
+      // reqpar3:"人员范围/项目范围",
 
 
     }
     }
   },
   },
@@ -121,7 +108,7 @@ export default {
           // this.isDataLoaded = false
           // this.isDataLoaded = false
         }
         }
         // console.log(this.valuex1);
         // console.log(this.valuex1);
-        this.valuex == ''
+        this.valuex = ''
         
         
         
         
       },
       },
@@ -141,8 +128,8 @@ export default {
       },
       },
       // 人员/项目筛选改变
       // 人员/项目筛选改变
       optupdata(){
       optupdata(){
-        this.reqpar3 = this.valuex
-        console.log("reqpar3",this.valuex);
+        // this.reqpar3 = this.valuex
+        // console.log("reqpar3",this.valuex);
         this.getList()
         this.getList()
         // if (this.reqpar1 = 0) {
         // if (this.reqpar1 = 0) {
         //   console.log(this.valuex);
         //   console.log(this.valuex);
@@ -198,11 +185,11 @@ export default {
 
 
       getList() {
       getList() {
         let getlistcs = {}
         let getlistcs = {}
-        if (this.valuex != ''){
+        if (this.valuex != null){
           if (!this.reqpar1) {
           if (!this.reqpar1) {
-            getlistcs = {type : 0 , startDate : this.reqpar2[0] , endDate : this.reqpar2[1], userId : this.reqpar3}
+            getlistcs = {type : 0 , startDate : this.reqpar2[0] , endDate : this.reqpar2[1], userId : this.valuex}
           }else{
           }else{
-            getlistcs = {type : 1 , startDate : this.reqpar2[0] , endDate : this.reqpar2[1], projectId : this.reqpar3}
+            getlistcs = {type : 1 , startDate : this.reqpar2[0] , endDate : this.reqpar2[1], projectId : this.valuex}
           }
           }
         }else{
         }else{
           getlistcs = {type : this.reqpar1 , startDate : this.reqpar2[0] , endDate : this.reqpar2[1]}
           getlistcs = {type : this.reqpar1 , startDate : this.reqpar2[0] , endDate : this.reqpar2[1]}

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet_h5/src/main.js

@@ -15,13 +15,13 @@ import { Form , Toast , Grid, GridItem , DatetimePicker ,
 Picker , Dialog , NumberKeyboard , Sticky , Skeleton ,
 Picker , Dialog , NumberKeyboard , Sticky , Skeleton ,
 Panel , Divider , List , pullRefresh , SwipeCell, Checkbox, 
 Panel , Divider , List , pullRefresh , SwipeCell, Checkbox, 
 Search, Slider,Stepper,Tag, Calendar, Row, Col, RadioGroup, Radio, 
 Search, Slider,Stepper,Tag, Calendar, Row, Col, RadioGroup, Radio, 
-Loading ,DropdownMenu, DropdownItem,Button} from 'vant';
+Loading ,DropdownMenu, DropdownItem,Button,ActionSheet} from 'vant';
 
 
 Vue.use(Form).use(Toast).use(Grid).use(GridItem).use(DatetimePicker)
 Vue.use(Form).use(Toast).use(Grid).use(GridItem).use(DatetimePicker)
 .use(Picker).use(Dialog).use(NumberKeyboard).use(Sticky).use(Skeleton)
 .use(Picker).use(Dialog).use(NumberKeyboard).use(Sticky).use(Skeleton)
 .use(Panel).use(Divider).use(List).use(pullRefresh).use(SwipeCell)
 .use(Panel).use(Divider).use(List).use(pullRefresh).use(SwipeCell)
 .use(Checkbox).use(Search).use(Slider).use(Stepper).use(Tag).use(Calendar).use(RadioGroup).use(Radio)
 .use(Checkbox).use(Search).use(Slider).use(Stepper).use(Tag).use(Calendar).use(RadioGroup).use(Radio)
-.use(Row).use(Col).use(Loading).use(DropdownMenu).use(DropdownItem).use(Button);
+.use(Row).use(Col).use(Loading).use(DropdownMenu).use(DropdownItem).use(Button).use(ActionSheet);
 
 
 // rem
 // rem
 import "amfe-flexible";
 import "amfe-flexible";

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
     <div>
     <div>
-        <van-nav-bar title="填写日报" left-text="返回" @click-left="back" fixed left-arrow/>
+        <van-nav-bar title="填写日报1" left-text="返回" @click-left="back" fixed left-arrow/>
 
 
         <van-form class="login_form" @submit="submitReport">
         <van-form class="login_form" @submit="submitReport">
             <van-field readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择" placeholder="点击选择时间" 
             <van-field readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择" placeholder="点击选择时间" 

+ 112 - 32
fhKeeper/formulahousekeeper/timesheet_h5/src/views/timetool/timetool.vue

@@ -9,18 +9,30 @@
     />
     />
 
 
     <div class="content">
     <div class="content">
+      <!-- <van-field
+        readonly
+        name="projectId"
+        clickable
+        :value="item.projectName"
+        label="投入项目"
+        placeholder="请选择投入项目"
+        @click="clickPicker(index, item)"
+        :rules="[{ required: true, message: '请选择项目' }]"
+      /> -->
       <div class="select">
       <div class="select">
-        <span>选择项目</span>
-        <van-dropdown-menu>
+        <van-cell title="选择项目" :value="selectValue" @click="selectXshow = true" :value-class="valueclass"/>
+        <!-- <span>选择项目</span> -->
+
+        <!-- <van-dropdown-menu>
           <van-dropdown-item
           <van-dropdown-item
             v-model="selectValue"
             v-model="selectValue"
             :options="selectOpt"
             :options="selectOpt"
             @change="selectX()"
             @change="selectX()"
           />
           />
-        </van-dropdown-menu>
+        </van-dropdown-menu> -->
       </div>
       </div>
       <div class="selectgx">
       <div class="selectgx">
-        <div>选择工序</div>
+        <div>选择工序<span v-show="selectgxshow" style="color:#c03131;">请选择工序</span></div>
         <van-grid :border="false" :column-num="3">
         <van-grid :border="false" :column-num="3">
           <van-grid-item v-for="(item, index) in selectG" :key="index">
           <van-grid-item v-for="(item, index) in selectG" :key="index">
             <van-button
             <van-button
@@ -67,6 +79,18 @@
         </li>
         </li>
       </ul>
       </ul>
     </div>
     </div>
+    <van-action-sheet v-model="selectXshow">
+        <van-search v-model="searchText" placeholder="请输入项目名称" @clear="sea()" @blur="sea()" @search="sea()"/>
+        <div style="minHeight:300px;">
+            <div v-for="(item, index) in selectOptS" :key="item.id" class="ryuan" @click="selectX(item, index)">{{item.projectName}}</div>
+        </div>
+    </van-action-sheet>
+    <!-- <van-popup v-model="showPickerUserddp" position="bottom" style="height: 80%">
+            <van-search v-model="userName" placeholder="请输入项目名称" @clear="sea()" @blur="sea()" @search="sea()"/>
+            <div style="minHeight:300px;">
+                <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">{{item.projectName}}</div>
+            </div>
+        </van-popup>  -->
   </div>
   </div>
 </template>
 </template>
 
 
@@ -74,13 +98,14 @@
 export default {
 export default {
   data() {
   data() {
     return {
     return {
-      selectValue: "项目1",
+      selectValue: "请选择项目",
+      searchText:'',
+      selectXshow: false,
+      selectgxshow: false,
+      valueclass:null,
       // 条目选择
       // 条目选择
-      selectOpt: [
-        { text: "项目1", value: "项目1" },
-        { text: "项目2", value: "项目2" },
-        { text: "项目3", value: "项目3" },
-      ],
+      selectOpt: [],
+      selectOptS:[],
       // 工序数据
       // 工序数据
       selectG: [
       selectG: [
         { name: "工序1", index: "99" },
         { name: "工序1", index: "99" },
@@ -113,9 +138,9 @@ export default {
           data5: "计时时长",
           data5: "计时时长",
         },
         },
       ],
       ],
-      loadata1: "",
-      startime:"",
-      endtime:""
+      loadata1: null,
+      startime: "",
+      endtime: "",
     };
     };
   },
   },
 
 
@@ -124,23 +149,48 @@ export default {
       history.back();
       history.back();
     },
     },
     // 选择项目
     // 选择项目
-    selectX() {
-      console.log(this.selectValue);
+    selectX(item,index) {
+      console.log("selectX",item,index);
+      this.selectXshow = false
+      this.selectValue = item.projectName
+      this.valueclass = null
     },
     },
+    sea() {
+                // console.log(this.searchText.length)
+                if(this.searchText.length > 0) {
+                    let text = this.searchText
+                    let reg = new RegExp(text)
+                    let data = this.selectOptS.filter(item => reg.test(item.projectName)) //返回
+                    this.selectOptS = data
+                } else {
+                    this.selectOptS = this.selectOpt
+                }
+            },
     // 选择工序
     // 选择工序
     selectGx(e) {
     selectGx(e) {
       console.log(e);
       console.log(e);
       this.loadata1 = e;
       this.loadata1 = e;
-      
+      this.selectgxshow = false
     },
     },
     // 计时器
     // 计时器
     startTiming() {
     startTiming() {
-        let date = new Date()
-        let nowH = date.getHours()
-        let nowM = date.getMinutes()
+        if(this.selectValue == "请选择项目"){
+            this.valueclass = "valuecolor"
+            if(this.loadata1 == null){
+                this.selectgxshow = true
+            }
+            return
+        }
+        
+      let date = new Date();
+      let nowH = date.getHours();
+      let nowM = date.getMinutes();
       if (!this.tBtnText) {
       if (!this.tBtnText) {
         this.tBtnText = 1;
         this.tBtnText = 1;
-        this.startime = (nowH < 10 ? "0" + nowH : nowH) + ":" + (nowM < 10 ? "0" + nowM : nowM)
+        this.startime =
+          (nowH < 10 ? "0" + nowH : nowH) +
+          ":" +
+          (nowM < 10 ? "0" + nowM : nowM);
         this.timingFun = setInterval(() => {
         this.timingFun = setInterval(() => {
           this.timingS += 1;
           this.timingS += 1;
           if (this.timingS == 60) {
           if (this.timingS == 60) {
@@ -154,32 +204,56 @@ export default {
         }, 1000);
         }, 1000);
       } else {
       } else {
         this.tBtnText = 0;
         this.tBtnText = 0;
-        this.endtime = (nowH < 10 ? "0" + nowH : nowH) + ":" + (nowM < 10 ? "0" + nowM : nowM)
+        this.endtime =
+          (nowH < 10 ? "0" + nowH : nowH) +
+          ":" +
+          (nowM < 10 ? "0" + nowM : nowM);
         clearInterval(this.timingFun);
         clearInterval(this.timingFun);
         this.timingFun = null;
         this.timingFun = null;
         this.timingH = 0;
         this.timingH = 0;
         this.timingM = 0;
         this.timingM = 0;
         this.timingS = 0;
         this.timingS = 0;
-        this.setRecord()
+        this.setRecord();
       }
       }
     },
     },
     // 添加计时记录
     // 添加计时记录
     setRecord() {
     setRecord() {
-        let date = new Date();
-        let nmon = date.getMonth() + 1;
-        let today =
+      let date = new Date();
+      let nmon = date.getMonth() + 1;
+      let today =
         date.getFullYear() +
         date.getFullYear() +
         "-" +
         "-" +
         (nmon < 10 ? "0" + nmon : nmon) +
         (nmon < 10 ? "0" + nmon : nmon) +
         "-" +
         "-" +
         (date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
         (date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
-        console.log("today", today);
-      let addR = {data1:this.selectValue,data2:this.loadata1,data3:today,data4:this.startime + "-" + this.endtime,data5:"timingbtn"}
-        this.record.push(addR)
-        console.log(this.record);
+      console.log("today", today);
+      let addR = {
+        data1: this.selectValue,
+        data2: this.loadata1,
+        data3: today,
+        data4: this.startime + "-" + this.endtime,
+        data5: "timingbtn",
+      };
+      this.record.push(addR);
+      console.log(this.record);
     },
     },
+    // 获取项目列表
+    getseachvalue(){
+        this.$axios.post("/project/getProjectList", {})
+                .then(res => {
+                    if(res.code == "ok") {
+                        this.selectOpt = res.data
+                        this.selectOptS = res.data
+                        console.log("res.data",res.data);
+                    } else {
+                        this.$toast.fail('获取失败:'+res.msg);
+                    }
+                }).catch(err=> {toast.clear();});
+    }
+  },
+  mounted() {
+      this.getseachvalue()
   },
   },
-  mounted() {},
 };
 };
 </script>
 </script>
 
 
@@ -187,10 +261,13 @@ export default {
 .content {
 .content {
   margin-top: 46px;
   margin-top: 46px;
 }
 }
+.valuecolor{
+    color: #c03131;
+}
 .select {
 .select {
   span {
   span {
     float: left;
     float: left;
-    width: 30%;
+    width: 50%;
     height: 50px;
     height: 50px;
     line-height: 50px;
     line-height: 50px;
     text-align: center;
     text-align: center;
@@ -202,7 +279,10 @@ export default {
 }
 }
 .van-dropdown-menu {
 .van-dropdown-menu {
   float: right;
   float: right;
-  width: 70%;
+  width: 50%;
+}
+.van-cell__title {
+  text-align: right !important;
 }
 }
 .recordList {
 .recordList {
   padding-left: 2%;
   padding-left: 2%;