Sfoglia il codice sorgente

page 增加时间选择

scorpio 2 anni fa
parent
commit
700922da37
2 ha cambiato i file con 86 aggiunte e 20 eliminazioni
  1. 1 1
      src/components/uploads.vue
  2. 85 19
      src/views/home/component/owner_serach.vue

+ 1 - 1
src/components/uploads.vue

@@ -189,7 +189,7 @@ export default {
 </script>
 <style lang='scss' scoped>
 .custom-upload {
-  ::v-deep .el-upload-list__item-name {
+  :deep(.el-upload-list__item-name) {
     white-space: pre-wrap;
     width: 100%;
   }

+ 85 - 19
src/views/home/component/owner_serach.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="flex flex-center padding white-bg ">
-    <el-form v-model="form" class="lab mt-20 full-width" label-width="120px">
+    <el-form v-model="form" class="lab mt-20 full-width" label-width="160px">
       <div class="flex">
         <div class="flex flex-col mr-15">
           <el-form-item class="full-width" label="项目名称">
@@ -36,6 +36,20 @@
               </el-select>
             </el-form-item>
           </div>
+          <div>
+            <el-form-item class="full-width" label="计划(实际)开工时间">
+              <el-date-picker
+                  v-model="time1"
+                  type="daterange"
+                  @visible-change="visibleTime($event,1)"
+                  range-separator="至"
+                  start-placeholder="开始时间"
+                  end-placeholder="结束时间"
+                  value-format='YYYY-MM-DD'
+                  format='YYYY-MM-DD'
+              />
+            </el-form-item>
+          </div>
         </div>
         <div class="flex flex-col ml-20 mr-15">
           <!--          <el-form-item class="full-width" label="分类筛选">-->
@@ -101,6 +115,20 @@
           </div>
           <div class="flex flex-center flex-justify-end">
           </div>
+          <div>
+            <el-form-item class="full-width" label="计划(实际)入库时间">
+              <el-date-picker
+                  v-model="time2"
+                  type="daterange"
+                  @visible-change="visibleTime($event,2)"
+                  range-separator="至"
+                  start-placeholder="开始时间"
+                  end-placeholder="结束时间"
+                  value-format='YYYY-MM-DD'
+                  format='YYYY-MM-DD'
+              />
+            </el-form-item>
+          </div>
         </div>
         <div class="flex flex-col flex-justify-between">
           <div></div>
@@ -152,14 +180,14 @@
 
 <script>
 import baseButton from '../../../components/base-button.vue'
-import { useStore } from '@/store/user.js'
+import {useStore} from '@/store/user.js'
 
 export default {
   name: 'owner_serach',
-  components: { baseButton },
+  components: {baseButton},
   watch: {
     keyWords: {
-      handler (val) {
+      handler(val) {
         setTimeout(() => {
           this.change()
         }, 500)
@@ -167,11 +195,11 @@ export default {
       immediate: true
     }
   },
-  setup () {
+  setup() {
     const user = useStore()
-    return { user }
+    return {user}
   },
-  data () {
+  data() {
     return {
       deptList: [],
       form: {
@@ -242,24 +270,62 @@ export default {
       typeList: [],
       showOrg: false,
       keyWords: '',
-      checked: false
+      checked: false,
+      time1: null, // 计划 实际开工时间
+      time2: null // 计划 实际入库时间
     }
   },
-  created () {
+  created() {
     this.getTypeList()
   },
   methods: {
-    getTypeList () {
+    getTypeList() {
       this.$api.project.typeList().then(res => {
         this.typeList = res.data.records
       })
     },
-    sure () {
+    sure() {
       this.form.type = true
-      console.log(this.form)
+      if (this.form.isStart === 0 && this.time1 !== null) {
+        this.form.planCommencementTime = this.time1
+        this.form.startTime = ''
+      } else if (this.form.isStart === 1 && this.time1 !== null) {
+        this.form.planCommencementTime = ''
+        this.form.startTime = this.time1
+      } else {
+        this.form.planCommencementTime = ''
+        this.form.startTime = ''
+      }
+
+      if (this.form.isStorage === 0 && this.time2 !== null) {
+        this.form.planStorageTime = this.time2
+        this.form.storageTime = ''
+      } else if (this.form.isStorage === 1 && this.time2 !== null) {
+        this.form.planStorageTime = ''
+        this.form.storageTime = this.time2
+      } else {
+        this.form.planStorageTime = ''
+        this.form.storageTime = ''
+      }
       this.$bus.emit('serach', this.form)
     },
-    clear () {
+    visibleTime(event, type) {
+      if (event) {
+        console.log(this.form.isStart)
+        if (type === 1) {
+          if (this.form.isStart.length === 0) {
+            this.$message.error('请先选择是否开工')
+            return
+          }
+        }
+        if (type === 2) {
+          if (this.form.isStorage.length === 0) {
+            this.$message.error('请先选择是否入库')
+          }
+        }
+      }
+    },
+    clear() {
       this.form.projectName = ''
       this.form.typeId = ''
       this.form.isStorage = ''
@@ -271,15 +337,15 @@ export default {
       this.form.type = false
       this.$bus.emit('serach', this.form)
     },
-    changeAmount () {
+    changeAmount() {
       const tmps = this.form.amount.split(',')
       console.log(tmps)
       this.form.totalAmountMin = tmps[0] === '-' ? '' : tmps[0]
       this.form.totalAmountMax = tmps[1] === '-' ? '' : tmps[1]
     },
-    getOrg () {
+    getOrg() {
       const parentId = [0, 2].includes(this.user.info.viewStage) ? this.user.info.parentDeptId : this.user.info.deptId
-      this.$api.system.getDeptLazy({ parentId }).then(res => {
+      this.$api.system.getDeptLazy({parentId}).then(res => {
         if (res.code === 200) {
           this.showOrg = true
           this.deptList = res.data.map(e => {
@@ -291,15 +357,15 @@ export default {
         }
       })
     },
-    changeChecked (index) {
+    changeChecked(index) {
       this.deptList[index].checked = !this.deptList[index].checked
     },
-    orgCheck () {
+    orgCheck() {
       const checked = this.deptList.filter(sub => sub.checked)
       this.form.deptIds = checked.map(sub => sub.id).join(',')
       this.showOrg = false
     },
-    change () {
+    change() {
       if (this.keyWords.length === 0) {
         this.deptList.forEach(sub => sub.search = false)
         return