Browse Source

修改 添加产品,修改产品

shaun-sheep 4 years ago
parent
commit
c056f3a778

+ 1 - 1
package.json

@@ -20,7 +20,7 @@
   },
   "dependencies": {
     "axios": "^0.18.0",
-    "element-ui": "^2.11.1",
+    "element-ui": "^2.13.2",
     "font-awesome": "^4.7.0",
     "vue": "^2.5.2",
     "vue-axios": "^2.1.4",

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

@@ -330,8 +330,8 @@
           li {
             display: inline-block;
             line-height: 25px;
-            width: 230px;
-            margin-right: 20px;
+            max-width: 230px;
+            margin-right: 72px;
             text-align: left;
             overflow: hidden;
             text-overflow: ellipsis;

+ 25 - 25
src/components/product/productTool.vue

@@ -21,32 +21,32 @@
 </template>
 
 <script>
-import selectTree from "@/components/public/selectTree"
-import remoteSearch from "@/components/public/remoteSearch"
-import { dictionaryQuery } from "@/api/dictionary"
-import { mapGetters, mapMutations } from "vuex"
+  import selectTree from "@/components/public/selectTree"
+  import remoteSearch from "@/components/public/remoteSearch"
+  import {dictionaryQuery} from "@/api/dictionary"
+  import {mapGetters, mapMutations} from "vuex"
 
-export default {
-  components: {selectTree, remoteSearch},
-  props:['showSelect'],
-  created() {
-    this.getDictionaryQuery()
-  },
-  data() {
-    return {
-      options:[{
-        Code: "common",
-        Name: "标准数据字典"
-      }],
-      isClearable: false,      // 可清空(可选)
-      isAccordion: true,      // 可收起(可选)
-      props: {                // 配置项(必选)
-        value: 'Code',
-        label: 'Name',
-        children: 'Project',
-      },
-    }
-  },
+  export default {
+    components: {selectTree, remoteSearch},
+    props: ['showSelect'],
+    created() {
+      this.getDictionaryQuery()
+    },
+    data() {
+      return {
+        options: [{
+          Code: "common",
+          Name: "标准数据字典"
+        }],
+        isClearable: false,      // 可清空(可选)
+        isAccordion: true,      // 可收起(可选)
+        props: {                // 配置项(必选)
+          value: 'Code',
+          label: 'Name',
+          children: 'Project',
+        },
+      }
+    },
   computed: {
     ...mapGetters('layout', ['dictionary']),
   },

+ 41 - 3
src/components/supplement/sagaSupplement.vue

@@ -306,15 +306,30 @@
     },
     submitForm() {
       this.$refs.ruleForm.validate((valid) => {
+        let type = {
+          Type: this.dictionary.dictionaryType,
+          GroupId: this.dictionary.groupId,
+          ProjectId: this.dictionary.projectId,
+        }
         if (valid) {
-          console.log(this.ruleForm);
           if (this.$route.params.ProdID) {//修改
-            prodTypeUpdate([{ProdID:this.$route.params.ProdID, ...this.ruleForm}], res => {
+            let params = {
+              Content: [{ProdID: this.$route.params.ProdID, ...this.ruleForm}]
+            }
+            prodTypeUpdate(params, res => {
               this.$message.success('修改成功!')
               this.$router.go(-1)
             })
           } else {//添加
-            prodTypeCreate([this.ruleForm], res => {
+            let param = Object.assign(this.ruleForm, {
+              Type: this.dictionary.dictionaryType,
+              GroupId: this.dictionary.groupId,
+              ProjectId: this.dictionary.projectId,
+            })
+            let params = {
+              Content: [param]
+            }
+            prodTypeCreate(params, res => {
               this.$message.success('创建成功!')
               this.$router.push('/product')
             })
@@ -325,6 +340,29 @@
         }
       });
     },
+    resetForm() {
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          let param = Object.assign(this.ruleForm, {
+            Type: this.dictionary.dictionaryType,
+            GroupId: this.dictionary.groupId,
+            ProjectId: this.dictionary.projectId,
+          })
+          let params = {
+            Content: [param]
+          }
+          prodTypeCreate(params, res => {
+            this.$message.success('创建成功!')
+            this.ruleForm.ProdParam = {}
+            this.ruleForm.ProdFile = {}
+            this.ruleForm.Model = ''
+          })
+        } else {
+          return false;
+        }
+      });
+    },
+
     changeItem(files, code) {
       this.ruleForm.ProdFile[code] = files
     }

+ 4 - 1
src/components/supplement/supplementTool.vue

@@ -5,7 +5,7 @@
       <span class="fr">
       <el-button @click="handleClickCancel">取消</el-button>
       <el-button type="primary" @click="addProduct">{{isUpdate?'保存':'创建'}}</el-button>
-      <el-button v-show="!isUpdate" type="primary">创建并继续</el-button>
+      <el-button v-show="!isUpdate" type="primary" @click="resetForm">创建并继续</el-button>
       </span>
     </div>
   </div>
@@ -26,6 +26,9 @@ export default {
     addProduct() {
       this.$emit('addProduct')
     },
+    resetForm() {
+      this.$emit('resetForm')
+    },
     handleClickCancel() {//取消
       this.$router.go(-1)
     },

+ 4 - 1
src/framework/layout/PageHeader.vue

@@ -114,4 +114,7 @@ export default {
     height: 48px;
     line-height: 48px;
 	}
-</style>
+  /deep/ .el-menu--horizontal .el-menu-item:not(.is-disabled):focus, .el-menu--horizontal .el-menu-item:not(.is-disabled):hover{
+    color: #ffffff !important;
+  }
+</style>

+ 5 - 1
src/views/supplement/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="supplement">
-    <supplementTool @addProduct="addProduct"/>
+    <supplementTool @addProduct="addProduct" @resetForm="resetForm"/>
     <sagaSupplement ref="supplement"/>
   </div>
 </template>
@@ -15,6 +15,10 @@
     methods: {
       addProduct() {
         this.$refs.supplement.submitForm()
+      },
+      resetForm() {
+        this.$refs.supplement.resetForm()
+
       }
     }
   }