Sfoglia il codice sorgente

添加路由跳转产品修改,产品删除功能

shaun-sheep 4 anni fa
parent
commit
4fa2fcf860

+ 1 - 5
src/api/brand/index.js

@@ -1,13 +1,8 @@
 /*
  * @Author: zhangyu
  * @Date: 2020-05-13 11:18:18
-<<<<<<< HEAD
- * @Info: 
- * @LastEditTime: 2020-05-19 18:35:59
-=======
  * @Info:
  * @LastEditTime: 2020-05-18 11:27:42
->>>>>>> 06f9b739cb5fb8d671644170fe9a8470610e85a0
  */
 import {baseUrl} from '@/api/scan/config'
 import http from '@/api/scan/httpUtil'
@@ -72,3 +67,4 @@ export function brandQueryByClass(param, success) {
   let url = `${baseUrl}/prod/prodType/brandQueryByClass`
   http.postJson(url, param, success)
 }
+

+ 10 - 2
src/components/brand/detail/sagaBrandDetail.vue

@@ -40,7 +40,7 @@
 
     </div>
     <div class="saga-brand-box mt20">
-      <detailTable :table="table"/>
+      <detailTable :table="table" @deleteProdType="deleteProdType"/>
     </div>
   </div>
 
@@ -49,7 +49,7 @@
 <script>
   import detailTable from "../../public/detailTable";
   import {mapGetters} from "vuex"
-  import { prodTypeQuery, classQueryByBrand } from "@/api/product"
+  import {classQueryByBrand, prodTypeDelete, prodTypeQuery} from "@/api/product"
 
   export default {
     components: {detailTable},
@@ -103,6 +103,14 @@
           this.table = res.Content.map(i => ({...i, brandName: this.$route.query.BrandCname}))
         })
       },
+      deleteProdType(val) {
+        let {brandName, ...params} = val
+        prodTypeDelete([params], res => {
+          this.$message.success('删除成功')
+          this.getProductList()
+          this.getDate()
+        })
+      },
       allData() {
         this.isShow = !this.isShow
         if (this.isShow) {

+ 10 - 2
src/components/product/detail/sagaProductDetail.vue

@@ -80,7 +80,7 @@
       </div>
     </div>
     <div class="saga-brand-box mt20">
-      <detailTable :table="table"/>
+      <detailTable :table="table" @deleteProdType="deleteProdType"/>
     </div>
   </div>
 
@@ -88,7 +88,7 @@
 
 <script>
   import detailTable from "../../public/detailTable";
-  import {prodTypeQuery} from "@/api/product"
+  import {prodTypeDelete, prodTypeQuery} from "@/api/product"
   import {brandQueryByClass} from "@/api/brand"
   import {mapGetters} from "vuex"
 
@@ -167,6 +167,14 @@
           this.table = res.Content.map(i => ({...i, brandName: i.Brand.BrandCname}))
         })
       },
+      deleteProdType(val) {
+        let {brandName, ...params} = val
+        prodTypeDelete([params], res => {
+          this.$message.success('删除成功')
+          this.getDate()
+          this.getProductList()
+        })
+      },
       handleCommand(command) {// 切换排序方式
         this.sortName = this.sortMap[command]
         this.sort = command

+ 5 - 18
src/components/product/sagaProduct.vue

@@ -18,11 +18,11 @@
             </div>
           </div>
           <div v-for="system in major.DefMajor" :key="system.Code" v-show="major.DefMajor && major.DefMajor.length">
-            <div style="margin-bottom: 10px">
+            <div style="padding-bottom: 12px">
               <i class="iconfont iconjuxing" style="color:#3A8DDE;"></i>
               <span>{{system.Name}}</span>
             </div>
-            <div class="sys" v-show="system.DefClass && system.DefClass.length">
+            <div class="sys" v-show="system.DefClass && system.DefClass.length" >
               <span
                 v-for="equip in system.DefClass"
                 :key="equip.Code"
@@ -87,12 +87,9 @@
 <style scoped lang="less">
 @bgc: #fff;
 .saga-product {
-  /*width: 1200px;*/
-  /*margin: 20px auto 0 auto;*/
   margin-top: 90px;
   display: flex;
   .sidebar {
-    /*margin-top: 20px;*/
     width: 200px;
     background: @bgc;
     display: inline-block;
@@ -105,7 +102,6 @@
     }
     .product-classification {
       background: @bgc;
-      /*margin-top: -19px;*/
       .classification {
         cursor: pointer;
         .major-content{
@@ -135,14 +131,6 @@
           color: #3A8DDE;
         }
       }
-      .sys {
-        padding: 10px;
-        span {
-          margin: 0 20px;
-          color: #8D9399;
-          display: inline-block;
-        }
-      }
     }
   }
   .brand {
@@ -156,18 +144,17 @@
 <style lang="less">
 .el-popover {
   p:first-child {
-    /*border-left: 4px solid #3A8DDE;*/
     color: #1F2329;
     text-indent: 8px;
   }
   .sys {
-    margin-left: 6px;
+    margin-left: 20px;
+    margin-bottom: 12px;
     span {
-      /*text-indent: 6px;*/
       display: inline-block;
       cursor: pointer;
       color: #8D9399;
-      line-height: 25px;
+      line-height: 30px;
       margin-right: 40px;
       b {
         display: inline-block;

+ 47 - 37
src/components/public/detailTable.vue

@@ -1,23 +1,37 @@
 <template>
-  <el-table :data="table" style="width: 100%" :header-cell-style="{background:'#F6F6F6',color:'#646A73'}">
-    <el-table-column prop="ProdCname" label="产品类型" align="center"/>
-    <el-table-column prop="brandName" label="品牌" align="center"/>
-    <el-table-column prop="Model" label="型号" align="center"/>
-    <el-table-column label="管理" align="center">
-      <template slot-scope="scope">
-        <el-button
-          type="text"
-          @click="handleEdit(scope.$index,scope.row)"
-        >修改
-        </el-button>
-        <el-button
-          type="text"
-          @click="handleDelete(scope.$index,scope.row)"
-        >删除
-        </el-button>
-      </template>
-    </el-table-column>
-  </el-table>
+  <div>
+    <el-table :data="table" style="width: 100%" :header-cell-style="{background:'#F6F6F6',color:'#646A73'}">
+      <el-table-column prop="ProdCname" label="产品类型" align="center"/>
+      <el-table-column prop="brandName" label="品牌" align="center"/>
+      <el-table-column prop="Model" label="型号" align="center"/>
+      <el-table-column label="管理" align="center">
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            @click="handleEdit(scope.$index,scope.row)"
+          >修改
+          </el-button>
+          <el-button
+            type="text"
+            @click="handleDelete(scope.$index,scope.row)"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+
+    </el-table>
+    <el-dialog
+      title="提示"
+      :visible.sync="dialogVisible"
+      width="30%"
+    >
+      <p>确定要删除吗?</p>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible=false">取消</el-button>
+        <el-button @click="confirmDelete" type="primary">确认</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
@@ -26,30 +40,26 @@
     props:['table'],
     data() {
       return {
-        tableData: [{
-          date: '2016-05-02',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-04',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1517 弄'
-        }, {
-          date: '2016-05-01',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1519 弄'
-        }, {
-          date: '2016-05-03',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1516 弄'
-        }]
+        dialogVisible: false,
+        deleteDate: {}
       }
     },
     methods: {
       handleEdit(index, row) {
-
+        let {brandName, ...params} = row
+        this.$router.push({
+          path: '/supplement',
+          query: params
+        })
       },
       handleDelete(index, row) {
+        this.deleteDate = row
+        this.dialogVisible = true
+
+      },
+      confirmDelete() {
+        this.$emit('deleteProdType', this.deleteDate)
+        this.dialogVisible = false
 
       }
     }

+ 16 - 19
src/components/supplement/sagaSupplement.vue

@@ -73,24 +73,21 @@
 </template>
 
 <script>
-import uploadFiles from "@/components/public/uploadFiles"
-import { prodRecordQuery } from "@/api/product"
-import { mapGetters } from "vuex"
+  import uploadFiles from "@/components/public/uploadFiles"
+  import {prodRecordQuery} from "@/api/product"
+  import {mapGetters} from "vuex"
 
-export default {
-  components: { uploadFiles },
-  created() {
-    this.getProdType()
-  },
-  mounted() {
-    // this.$refs.ruleForm.validate(valid => {
-    //   console.log(valid)
-    // })
-
-    let listener = document.querySelector('.saga-brand-box')
-    listener.addEventListener('scroll', this.onScroll)
-    //  option
-    this.list = this.states.map(item => {
+  export default {
+    components: {uploadFiles},
+    created() {
+      this.getProdType()
+    },
+    mounted() {
+      console.log(this.$route.query)
+      let listener = document.querySelector('.saga-brand-box')
+      listener.addEventListener('scroll', this.onScroll)
+      //  option
+      this.list = this.states.map(item => {
       return { value: `value:${item}`, label: `label:${item}` }
     })
 
@@ -195,7 +192,7 @@ export default {
       tabPosition: 'left',
       ruleForm: {
         product: '',
-        brand: '',
+        brand: [],
         type: '',
 
       },
@@ -204,7 +201,7 @@ export default {
           { required: true, message: '请选择产品类型', trigger: 'change' }
         ],
         brand: [
-          { required: true, validator: checkBrand, trigger: 'focus,blur' }
+          { required: true, validator: checkBrand, trigger: 'change' }
         ],
         type: [
           { required: true, message: '请输入型号', trigger: 'blur' }