浏览代码

完善需求form

reedliuqing_i 5 年之前
父节点
当前提交
1f7824b3ee
共有 1 个文件被更改,包括 8 次插入11 次删除
  1. 8 11
      src/views/projectManage/requirement/list/create.vue

+ 8 - 11
src/views/projectManage/requirement/list/create.vue

@@ -37,8 +37,8 @@
               style="width:20vw"
             >
               <el-option
-                v-for="item in options"
-                :key="item.idap"
+                v-for="(item,index) in options"
+                :key="index"
                 :label="item.name"
                 :value="item.idap"
               >
@@ -94,7 +94,6 @@
         </div>
       </div>
     </el-form>
-    {{ form }}
     <template v-slot:footer>
       <el-button @click="cancel">取 消</el-button>
       <el-button type="primary" @click="confirm">确 认</el-button>
@@ -176,9 +175,14 @@ export default {
   watch: {
     visible: function(newVisible, oldVisible) {
       this.isVisible = newVisible
+      if (newVisible && this.title === '编辑需求') {
+        this.form = JSON.parse(JSON.stringify(this.data))
+        this.form.pm = this.form.pm[0].idap
+        this.init()
+      }
     },
     isVisible: function(newIsVisible, oldIsVisible) {
-      if (newIsVisible === false) {
+      if (!newIsVisible) {
         if (this.title === '新建需求') {
           for (const i in this.form) {
             this.form[i] = null
@@ -186,13 +190,6 @@ export default {
         }
         this.$emit('cancel', false)
       }
-    },
-    data: function(newData, oldData) {
-      if (newData) {
-        this.form = JSON.parse(JSON.stringify(this.data))
-        this.form.pm = this.form.pm[0].idap
-        this.init()
-      }
     }
   },
   methods: {