wuhongyu 5 vuotta sitten
vanhempi
commit
23e312ef5f
2 muutettua tiedostoa jossa 32 lisäystä ja 10 poistoa
  1. 7 9
      src/layout/demand/fabuList.vue
  2. 25 1
      src/views/demand/demand.vue

+ 7 - 9
src/layout/demand/fabuList.vue

@@ -57,15 +57,10 @@
                 <el-radio label="1">否</el-radio>
               </el-radio-group>
             </el-form-item>
-            <el-form-item label="状态" prop="status">
-              <el-radio-group :disabled="disabled" v-model="form.status">
-                <el-radio label="0">保存草稿</el-radio>
-                <el-radio label="1">提交审核</el-radio>
-                <el-radio label="2" v-if="user.type === '0' || user.type === '1'">审核通过</el-radio>
-                <el-radio label="3" v-if="user.type === '0' || user.type === '1'">审核拒绝</el-radio>
-              </el-radio-group>
-            </el-form-item>
-            <el-form-item>
+
+            <el-form-item
+              >、
+              <el-button type="primary" @click="caogao()">保存草稿</el-button>
               <el-button type="primary" @click="onSubmit()">需求发布</el-button>
             </el-form-item>
           </el-form>
@@ -98,6 +93,9 @@ export default {
     onSubmit() {
       this.$emit('submit', this.form);
     },
+    caogao() {
+      this.$emit('caogao', this.form);
+    },
   },
   computed: {
     ...mapState(['user']),

+ 25 - 1
src/views/demand/demand.vue

@@ -13,7 +13,7 @@
         <el-col :span="24" class="main">
           <div class="w_1200">
             <el-col :span="24" class="info">
-              <fabuList @submit="submit" :form="form"></fabuList>
+              <fabuList @submit="submit" :form="form" @caogao="caogao"></fabuList>
             </el-col>
           </div>
         </el-col>
@@ -53,6 +53,8 @@ export default {
     ...demand(['update', 'fetch', 'query', 'create', 'delete']),
     async submit() {
       let res = {};
+
+      this.form.status = '1';
       let data = JSON.parse(JSON.stringify(this.form));
       if (data.id) {
         res = await this.update(data);
@@ -70,6 +72,28 @@ export default {
         this.$message.error('信息创建失败');
       }
     },
+
+    async caogao() {
+      let res = {};
+
+      this.form.status = '0';
+      let data = JSON.parse(JSON.stringify(this.form));
+      if (data.id) {
+        res = await this.update(data);
+      } else {
+        data.uid = this.user.uid;
+        res = await this.create(data);
+      }
+      if (res.errcode === 0) {
+        this.$message({
+          message: '保存草稿成功',
+          type: 'success',
+        });
+        this.display = true;
+      } else {
+        this.$message.error('信息创建失败');
+      }
+    },
   },
   computed: {
     ...mapState(['user']),