shaogen1995 4 лет назад
Родитель
Сommit
53a214bc09

+ 1 - 1
src/router/index.js

@@ -166,7 +166,7 @@ const router = new VueRouter({
           component: () => import('@/views/collect/collect2.vue')
         },
 
-        // 馆藏统计
+        // 库房管理
         {
           name: 'statistics0',
           path: 'statistics0',

+ 2 - 2
src/views/layout/index.vue

@@ -28,7 +28,7 @@
         </ul>
         </router-link>
         <router-link to="/layout/collect0" :class='{active:$route.meta.myInd===2}'>征集品管理</router-link>
-        <router-link to="/layout/statistics0" :class='{active:$route.meta.myInd===3}'>馆藏统计</router-link>
+        <router-link to="/layout/statistics0" :class='{active:$route.meta.myInd===3}'>库房管理</router-link>
         <router-link to="/layout/system0" :class='{active:$route.meta.myInd===4}'>系统管理</router-link> -->
       </div>
       <div class="right">
@@ -80,7 +80,7 @@ export default {
           son: [{ name: '征集品总账', id: 0 }, { name: '征集品提用', id: 1 }, { name: '征集品注销', id: 2 }]
         },
         {
-          name: '馆藏统计',
+          name: '库房管理',
           push: '/layout/statistics',
           son: [{ name: '库房设置', id: 0 }, { name: '统计报表', id: 1 }]
         },

+ 92 - 13
src/views/statistics/statistics0.vue

@@ -6,7 +6,7 @@
       <div class="top">
         <el-breadcrumb separator="/">
           <el-breadcrumb-item to="">首页</el-breadcrumb-item>
-          <el-breadcrumb-item to="">馆藏统计</el-breadcrumb-item>
+          <el-breadcrumb-item to="">库房管理</el-breadcrumb-item>
           <el-breadcrumb-item id="mytitle">库房设置</el-breadcrumb-item>
         </el-breadcrumb>
       </div>
@@ -28,7 +28,7 @@
               ></i>
               <span @click="arrowsShowClick(index)">{{ item.name }}</span>
               <i class="el-icon-plus tiny" @click="addTow(item.id)"></i>
-              <i class="el-icon-edit tiny"></i>
+              <i class="el-icon-edit tiny" @click="editOne(item)"></i>
             </div>
             <ul class="area" v-show="arrowsShow === index">
               <li
@@ -46,9 +46,9 @@
           <div class="title">
             <b>{{ towList.name }}</b>
             <span>仓库编号:{{ towList.num }}</span>
-            <i class="el-icon-plus" @click="addThree()"></i>
-            <i class="el-icon-edit"></i>
-            <i class="el-icon-delete"></i>
+            <i class="el-icon-plus" @click="addThree"></i>
+            <i class="el-icon-edit" @click="editTow"></i>
+            <i class="el-icon-delete" @click="delTow"></i>
           </div>
           <!-- 表格 -->
           <div class="table">
@@ -73,9 +73,9 @@
                 label="备注"
               ></el-table-column>
               <el-table-column label="操作" width="150">
-                <template #default>
-                  <i class="el-icon-edit"></i>
-                  <i class="el-icon-delete"></i>
+                <template #default='{row}'>
+                  <i class="el-icon-edit" @click="editThree(row)"></i>
+                  <i class="el-icon-delete" @click="delThree(row.id)"></i>
                 </template>
               </el-table-column>
             </el-table>
@@ -134,6 +134,7 @@ export default {
   data () {
     // 这里存放数据
     return {
+      myId: null,
       // 第一层:箭头的显示隐藏
       arrowsShow: 0,
       popupOneName: '',
@@ -186,15 +187,20 @@ export default {
   // 方法集合
   methods: {
     // 点击新增库区--第一层
+    editOne (val) {
+      this.popupOneName = val.name
+      this.myId = val.id
+      this.popupOne = true
+    },
     delOne () {
-      if (!this.arrowsShow || !this.allList[this.arrowsShow]) return this.$message.error('未选中库区')
+      if (!this.arrowsShow) return this.$message.error('未选中库区')
       this.$confirm('确定删除吗?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        this.getTreeList()
         remove(this.allList[this.arrowsShow].id)
+        this.arrowsShow = null
         this.$nextTick(() => {
           setTimeout(() => {
             this.getTreeList()
@@ -212,6 +218,7 @@ export default {
       })
     },
     addOne () {
+      this.myId = null
       this.popupOne = true
     },
     popupOneX () {
@@ -223,15 +230,50 @@ export default {
       await addEntrepot({
         level: 1,
         name: this.popupOneName,
-        parentId: null
+        parentId: null,
+        id: this.myId
       })
       this.popupOne = false
       this.popupOneName = ''
       this.getTreeList()
+      this.myId = null
       this.$message.success('新增库区成功')
     },
     // 点击第二层+号
+    delTow () {
+      this.$confirm('确定删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        // console.log(666, this.allList[this.arrowsShow].children[this.entrepotShow].id)
+        remove(this.allList[this.arrowsShow].children[this.entrepotShow].id)
+        this.entrepotShow = 0
+        this.$nextTick(() => {
+          setTimeout(() => {
+            this.getTreeList()
+          }, 100)
+        })
+        this.$message({
+          type: 'success',
+          message: '删除成功!'
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        })
+      })
+    },
+    editTow () {
+      // console.log(666, this.towList.name)
+      this.popupTowName = this.towList.name
+      this.popupTowNum = this.towList.num
+      this.myId = this.towList.id
+      this.popupTow = true
+    },
     addTow (id) {
+      this.myId = null
       this.popupTowId = id
       this.popupTow = true
     },
@@ -247,16 +289,51 @@ export default {
         level: 2,
         name: this.popupTowName,
         num: this.popupTowNum,
-        parentId: this.popupTowId
+        parentId: this.popupTowId,
+        id: this.myId
       })
       this.popupTow = false
       this.popupTowName = ''
       this.popupTowNum = ''
       this.getTreeList()
+      this.myId = null
       this.$message.success('新增仓库成功')
     },
     // 点击第三层
+    delThree (id) {
+      this.$confirm('确定删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        remove(id)
+        // 刷新页面
+        this.$nextTick(() => {
+          setTimeout(() => {
+            this.getTreeList()
+            this.tableData = this.tableData.filter(v => v.id !== id)
+          }, 100)
+        })
+        this.$message({
+          type: 'success',
+          message: '删除成功!'
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        })
+      })
+    },
+    editThree (val) {
+      this.popupThreeName = val.name
+      this.popupThreeNum = val.num
+      this.popupThreeTxt = val.description
+      this.myId = val.id
+      this.popupThree = true
+    },
     addThree () {
+      this.myId = null
       this.popupThree = true
     },
     popupThreeX () {
@@ -274,13 +351,15 @@ export default {
         name: this.popupThreeName,
         num: this.popupThreeNum,
         parentId: this.towList.id,
-        description: this.popupThreeTxt
+        description: this.popupThreeTxt,
+        id: this.myId
       })
       this.popupThree = false
       this.popupThreeName = ''
       this.popupThreeNum = ''
       this.popupThreeTxt = ''
       this.getTreeList()
+      this.myId = null
       this.$message.success('新增货架成功')
       // 刷新页面
       this.$nextTick(() => {

+ 1 - 1
src/views/statistics/statistics1.vue

@@ -6,7 +6,7 @@
       <div class="top">
         <el-breadcrumb separator="/">
           <el-breadcrumb-item to="">首页</el-breadcrumb-item>
-          <el-breadcrumb-item to="">馆藏统计</el-breadcrumb-item>
+          <el-breadcrumb-item to="">库房管理</el-breadcrumb-item>
           <el-breadcrumb-item id="mytitle">统计报表</el-breadcrumb-item>
         </el-breadcrumb>
       </div>