whj преди 7 месеца
родител
ревизия
09a7c884d1
променени са 2 файла, в които са добавени 54 реда и са изтрити 38 реда
  1. 1 0
      src/components/Upload/CUpload.vue
  2. 53 38
      src/views/store/store/modules/BaseForm.vue

+ 1 - 0
src/components/Upload/CUpload.vue

@@ -47,6 +47,7 @@ export default {
   },
   watch: {
     files (newVal) {
+      console.log('newVal', newVal)
       this.fileList = this.BaseTool.UPLOAD.transImg2(newVal)
     }
   },

+ 53 - 38
src/views/store/store/modules/BaseForm.vue

@@ -84,6 +84,7 @@
               :treeData="storeTreeDate"
               :treeNodeFilterProp="'title'"
               :showSearch="true"
+              @change="handleAreaChange"
               v-decorator="['parentId', {rules: [{required: true, message: '上层仓库不能为空'}]}]"
               placeholder="请选择"
             >
@@ -224,26 +225,28 @@
               v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
           </a-form-item>
         </row-item>
-        <row-item>
-          <a-form-item
-            label="是否存在库位"
-            :labelCol="BaseTool.Constant.labelCol"
-            :wrapperCol="BaseTool.Constant.wrapperCol"
-          >
-            <a-switch
-              @change="val=>existPosition=val"
-              v-decorator="['existPosition', {initialValue: true,valuePropName: 'checked',rules: [{required: false, message: '备注不能为空'}]}]"/>
-          </a-form-item>
-        </row-item>
-        <row-item v-if="existPosition">
-          <a-form-item
-            label="库位图"
-            :labelCol="BaseTool.Constant.labelCol"
-            :wrapperCol="BaseTool.Constant.wrapperCol"
-          >
-            <Upload :files="fileList" :maxSize="1" @catchFile="catchFile"/>
-          </a-form-item>
-        </row-item>
+        <template v-if="level===1">
+          <row-item>
+            <a-form-item
+              label="是否存在库位"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <a-switch
+                @change="val=>existPosition=val"
+                v-decorator="['existPosition', {initialValue: true,valuePropName: 'checked',rules: [{required: false, message: '备注不能为空'}]}]"/>
+            </a-form-item>
+          </row-item>
+          <row-item v-if="existPosition">
+            <a-form-item
+              label="库位图"
+              :labelCol="BaseTool.Constant.labelCol"
+              :wrapperCol="BaseTool.Constant.wrapperCol"
+            >
+              <Upload :files="fileList" :maxSize="1" @catchFile="catchFile"/>
+            </a-form-item>
+          </row-item>
+        </template>
       </row-list>
 
     </a-form>
@@ -256,7 +259,7 @@
 
 <script>
 import pick from 'lodash.pick'
-import { addStore, updateStore, fetchStoreTree } from '@/api/store/store'
+import { addStore, updateStore, fetchStoreTree, fetchStore } from '@/api/store/store'
 import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
 import { queryUser, queryUsersByParentDeptNatureAll } from '@/api/upms/user'
 import { querySbPosition, fetchSbPosition } from '@/api/sb/position'
@@ -314,25 +317,30 @@ export default {
         this.modalTitle = '复制'
       }
       this.modal = record
-      const params = { includeMy: true }
-      params.deptId = record.useCompany
-      this.level = record.level
-      params.nature = this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI
+      // const params = { includeMy: true }
+      // params.deptId = record.useCompany
+      // params.nature = this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI
       // params.code = this.DictCache.VALUE.SYS_DEPT_CODE.CANG_KU
-      queryUsersByParentDeptNatureAll(params).then(res => {
-        this.userList = res.data
-      })
+      // queryUsersByParentDeptNatureAll(params).then(res => {
+      //   this.userList = res.data
+      // })
       const { form: { setFieldsValue } } = this
       record.existPosition = Boolean(record.existPosition)
       this.existPosition = record.existPosition
-      this.fileList = [{
-        uid: '-1',
-        name: record.no,
-        status: 'done',
-        url: record.backGroundMap
-      }]
+      this.level = record.level
+      if (this.level === 1) {
+        this.handleAreaChange(record.factoryArea)
+      } else {
+        this.handleAreaChange(record.parentId)
+      }
       // 日期处理
       this.$nextTick(() => {
+        this.fileList = [{
+          uid: '-1',
+          name: record.name,
+          status: 'done',
+          url: record.backGroundMap
+        }]
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'useCompany',
@@ -389,6 +397,7 @@ export default {
       this.level = null
       this.fileList = []
       this.existPosition = true
+      this.opcImg = ''
       this.form.resetFields()
       if (this.BaseTool.Object.isNotBlank(values)) {
         this.$emit('ok', values)
@@ -422,7 +431,7 @@ export default {
       getDeptsAllByParentId({ deptId: record.useCompany, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
         this.projectList = res.data
       })
-      queryUser({ deptId: record.useProject }).then(res => {
+      queryUser().then(res => {
         this.userList = res.data
       })
     },
@@ -455,9 +464,15 @@ export default {
       // })
     },
     handleAreaChange (id) {
-      fetchSbPosition({ id }).then(res => {
-        this.opcImg = res.data.opcImg
-      })
+      if (this.level === 1) {
+        fetchSbPosition({ id }).then(res => {
+          this.opcImg = res.data.opcImg
+        })
+      } else {
+        fetchStore({ id }).then(res => {
+          this.opcImg = res.data.backGroundMap
+        })
+      }
     }
 
   }