qinzhipeng_v@didiglobal.com 4 years ago
parent
commit
1609d965a7

+ 9 - 0
src/api/monthly/index.js

@@ -17,3 +17,12 @@ export function materialDeleteMaterial(id) {
     method: 'get'
   })
 }
+
+// 新增素材
+export function materialAddMaterial(data) {
+  return request({
+    url: TeamManagement + `/material/addMaterial`,
+    method: 'post',
+    data
+  })
+}

+ 5 - 2
src/views/monthly/components/createdMonthly.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :title="title" :show="show" :visible.sync="monthly_show" width="30%" class="public_task" @close="$emit('update:show', false)">
+  <el-dialog :title="title" :show="show" :visible.sync="monthly_show" width="60%" class="public_task" @close="$emit('update:show', false)">
     <div class="blueStripe" />
     <el-form ref="monthly_form" :model="monthly_form" label-position="left" label-width="80px">
       <el-form-item label="标题">
@@ -20,7 +20,7 @@
     </el-form>
     <span slot="footer" class="dialog-footer">
       <el-button @click="monthly_show = false">取 消</el-button>
-      <el-button type="primary" @click="monthly_show = false">创 建</el-button>
+      <el-button type="primary" @click="monthly_dialog">创 建</el-button>
     </span>
   </el-dialog>
 </template>
@@ -46,6 +46,9 @@ export default {
     }
   },
   methods: {
+    monthly_dialog() {
+      this.$emit('monthly_created', this.monthly_form)
+    },
     handleClose(done) {
       this.monthly_show = false
     },

+ 10 - 2
src/views/monthly/index.vue

@@ -33,14 +33,14 @@
         </div>
       </el-main>
     </el-container>
-    <addMonthly :show.sync="show" :title="title" />
+    <addMonthly :show.sync="show" :title="title" @monthly_created="monthly_created" />
   </el-container>
 </template>
 
 <script>
 import logoUrl from '@/assets/内页logo2@2x.png'
 import addMonthly from './components/createdMonthly.vue'
-import { materialGetMaterialList, materialDeleteMaterial } from '@/api/monthly/index.js'
+import { materialGetMaterialList, materialDeleteMaterial, materialAddMaterial } from '@/api/monthly/index.js'
 export default {
   components: {
     addMonthly
@@ -102,6 +102,14 @@ export default {
         this.$message({ type: 'info', message: '已取消删除' })
       })
     },
+    async monthly_created(data) {
+      console.log(data, 'cdbjksbkj')
+      const res = await materialAddMaterial()
+      if (res.code === 200) {
+        this.materialGetMaterialList()
+        this.$message({ type: 'success', message: '创建成功!' })
+      }
+    },
     addMonthly() {
       this.title = '新建'
       this.show = true