zangkai 5 лет назад
Родитель
Сommit
5ce6e94b84

+ 39 - 0
frontend_web/src/api/information.js

@@ -0,0 +1,39 @@
+import request from '@/plugin/axios'
+
+export default {
+   // 产品方案 ----获取产品信息列表
+  getList(params) {
+    return request({
+      url: process.env.VUE_APP_API + 'information/getpagelist',
+      method: 'get', 
+      params: params
+    })
+  },
+
+  getById(params) {
+    return request({
+      url: process.env.VUE_APP_API + 'information/getdetailbyid',
+      method: 'get', 
+      params: params
+    })
+  },
+
+  //删除产品信息
+   delete(params) {
+    return request({
+      url: process.env.VUE_APP_API + 'information/deletebyid',
+      method: 'delete',
+      params: params
+    })
+  },
+  
+   // 保存产品方案
+  save(data) {
+    return request({
+      url: process.env.VUE_APP_API + 'information/save',
+      method: 'post',
+      data: data
+    })
+  }
+  
+}

+ 11 - 1
frontend_web/src/router/routes.js

@@ -77,7 +77,17 @@ const frameIn = [
       },
       component: _import('class')
     },
-      
+    // 信息发布
+    {
+      path: 'information',
+      name: 'information',
+      meta: {
+        title: '信息发布',
+        auth: true
+      },
+      component: _import('information')
+    },
+
       // 系统 前端日志
       {
         path: 'log',

+ 137 - 0
frontend_web/src/views/information/components/informationInfoDialog.vue

@@ -0,0 +1,137 @@
+<template>
+  <el-dialog title="信息发布"
+             :visible.sync="dialogvisible"
+             @opened="dialogOpen"
+             @closed="dialogClose"
+             width="65%">
+    <el-form size="mini"
+             :model="information"
+             :rules="rulesinformationForm"
+             label-width="100px"
+             ref="informationForm">
+      <el-row :gutter="24"
+              class="donorsaddformcss">
+        <el-col :span="10">
+          <el-form-item label="信息标题"
+                        prop="title"
+                        label-width="120px">
+            <el-input v-model="information.title"
+                      placeholder="请输入信息标题"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="信息内容"
+                        prop="content"
+                        label-width="120px">
+            <el-input v-model="information.content"
+                      type="textarea"
+                      :rows=3
+                      placeholder="请输入备注信息"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+      </el-row>
+    </el-form>
+    <span slot="footer">
+      <el-button size="mini"
+                 @click="save(0)">保存草稿</el-button>
+      <el-button size="mini"
+                 type="primary"
+                 @click="save(1)">发布</el-button>
+
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+
+import InformationApi from '@/api/information'
+export default {
+  name: 'informationDialog',
+  props: {
+    informationId: Number
+  },
+  data () {
+    return {
+      dialogvisible: false,
+      information: {},
+      rulesinformationForm: {
+        title: [{
+          required: true,
+          message: '请输入信息标题',
+          trigger: 'blur'
+        }],
+        content: [{
+          required: true,
+          message: '请输入信息内容',
+          trigger: 'blur'
+        }]
+      }
+    }
+  },
+  created () {
+    this.getData()
+  },
+  methods: {
+    dialogOpen () {
+      this.information = {}
+      console.log("informationId:" + this.informationId)
+      this.$refs.informationForm.resetFields()
+      this.getData()
+    },
+    dialogClose () {
+      this.information = {}
+      console.log("informationId:" + this.informationId)
+      this.$refs.informationForm.resetFields()
+      this.$emit('handleClose')
+      this.dialogVisible = false
+    },
+    save (flag) {
+      this.$refs.informationForm.validate(valid => {
+        if (valid) {
+          this.information.status = flag
+          InformationApi.save(this.information, {})
+            .then(res => {
+              this.$emit('handleClose')
+              this.dialogvisible = false
+            })
+            .catch(err => {
+              // handle error
+              console.error(err)
+            })
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+
+    },
+    getData () {
+      if (this.informationId > 0) {
+        var id = {
+          id: this.informationId
+        }
+        InformationApi.getById(id)
+          .then(res => {
+            this.information = res
+          })
+      }
+    }
+  }
+}
+
+</script>
+
+<style lang="scss">
+.button {
+  padding: 0;
+  float: right;
+}
+
+.donorsaddformcss .el-col-8 {
+  height: 58px;
+}
+</style>

+ 297 - 0
frontend_web/src/views/information/index.vue

@@ -0,0 +1,297 @@
+<template>
+  <d2-container>
+    <template slot="header"
+              style="padding: 5px;">
+      <el-form size="mini"
+               ref="form"
+               :inline="true"
+               class="sbutton_padding"
+               style="margin-top: -7px;text-align:right;">
+        <el-form-item label="信息标题"
+                      class="sbutton_margin">
+          <el-input style="width: 140px;"
+                    v-model="search.title"
+                    placeholder="请输入信息标题"></el-input>
+        </el-form-item>
+        <el-form-item label="信息内容"
+                      class="sbutton_margin">
+          <el-input style="width: 140px;"
+                    v-model="search.content"
+                    placeholder="请输入信息内容"></el-input>
+        </el-form-item>
+        <el-form-item label="信息状态">
+          <el-select v-model="search.status"
+                     style="width: 140px;">
+            <el-option v-for="item in status"
+                       :key="item.key"
+                       :label="item.key"
+                       :value="item.value">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-button size="mini"
+                   type="primary"
+                   @click="initDatas()"
+                   style="margin-left:10px"
+                   @command="searchCommand"
+                   class="sbutton_margin">查 询</el-button>
+        <el-button size="mini"
+                   type="primary"
+                   @click="clearSearch"
+                   class="sbutton_margin">重 置</el-button>
+        <el-button size="mini"
+                   type="primary"
+                   style="margin-right:6px"
+                   @click="openinformationadd()"
+                   class="sbutton_margin">添加</el-button>
+      </el-form>
+    </template>
+    <el-table ref="multipleTable"
+              :data="activities"
+              border
+              fit
+              tooltip-effect="dark"
+              style="width: 100%"
+              @sort-change="orderby"
+              height="100%">
+      <el-table-column label="操作"
+                       width="160px"
+                       align="center"
+                       fixed='right'>
+        <template slot-scope="scope">
+          <el-button size="mini"
+                     title="编辑"
+                     type="primary"
+                     @click="informationedit(scope.row.id)"
+                     icon="el-icon-edit"
+                     circle></el-button>
+          <el-button size="mini"
+                     type="primary"
+                     title="发布"
+                     @click="publish(scope.row)"
+                     style="margin-left:5px;"
+                     icon="el-icon-s-promotion"
+                     circle></el-button>
+          <el-button size="mini"
+                     type="danger"
+                     title="删除"
+                     @click="deleteinformation(scope.row)"
+                     style="margin-left:5px;"
+                     icon="el-icon-delete"
+                     circle></el-button>
+
+        </template>
+      </el-table-column>
+      <el-table-column prop="title"
+                       fit
+                       min-width="80px"
+                       label="信息标题"
+                       align="center"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="content"
+                       label="信息内容"
+                       align="center"
+                       min-width="160px"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="status"
+                       align="center"
+                       min-width="40px"
+                       label="状态"
+                       show-overflow-tooltip
+                       :formatter="formatStatus"></el-table-column>
+      <el-table-column prop="createdtime"
+                       align="center"
+                       min-width="120px"
+                       label="发布时间"
+                       show-overflow-tooltip></el-table-column>
+    </el-table>
+    <!-- </el-card> -->
+    <informationInfoDialog ref="informationDialog"
+                           @handleClose="handleClose"
+                           :informationId="informationId"
+                           width="75"></informationInfoDialog>
+    <!-- </div> -->
+    <template slot="footer">
+      <el-pagination style="margin: -10px;"
+                     @size-change="handleSizeChange"
+                     @current-change="handleCurrentChange"
+                     :current-page="search.page.current"
+                     :page-sizes="[10, 15, 20]"
+                     :page-size="search.page.size"
+                     layout="total, sizes, prev, pager, next, jumper"
+                     :total="search.page.total">
+      </el-pagination>
+    </template>
+  </d2-container>
+</template>
+
+<script>
+
+import InformationApi from '@/api/information'
+import informationInfoDialog from './components/informationInfoDialog'
+export default {
+  name: 'informationIndex',
+  components: {
+    informationInfoDialog
+  },
+  data () {
+    return {
+      dialogvisible: false,
+      details: false,
+      activities: [],
+      informationId: -1,
+      search: {
+        title: '',
+        status: -1,
+        content: '',
+        page: {
+          total: 0,
+          current: 1,
+          size: 10
+        }
+      },
+      status: [{
+        key: '全部',
+        value: -1
+      },
+      {
+        key: '草稿',
+        value: 0
+      },
+      {
+        key: '已发布',
+        value: 1
+      }
+      ],
+      // 列表排序
+      Column: {
+        Order: '',
+        Prop: ''
+      }
+    }
+  },
+  mounted () {
+    this.initDatas()
+  },
+  methods: {
+    formatStatus (row, column) {
+      for (var i = 0; i < this.status.length; i++) {
+        if (this.status[i].value == row.status) {
+          return this.status[i].key;
+        }
+      }
+    },
+    initSearchInfo () {
+      this.search = {
+        Title: '',
+        Status: -1,
+        Content: '',
+      }
+    },
+    //初始化分页分页对象
+    initPageInfo () {
+      this.search.page = {
+        total: 0,
+        current: 1,
+        size: 10
+      }
+    },
+    // 打开 添加弹窗
+    openinformationadd () {
+      this.$refs.informationDialog.dialogvisible = true
+    },
+    // 打开 编辑弹窗
+    informationedit (informationId) {
+      this.informationId = informationId
+      this.$refs.informationDialog.dialogvisible = true
+    },
+    // 新增修改弹窗关闭 返回页面
+    handleClose () {
+      this.informationId = -1
+      this.$refs.informationDialog.dialogvisible = false
+      this.initPageInfo()
+      this.initDatas()
+      console.log("handleClose informationId" + this.informationId)
+    },
+    publish (information) {
+      information.status = 1
+      InformationApi.save(information)
+    },
+    // 初始化列表数据
+    initDatas () {
+      InformationApi.getList(this.search)
+        .then(res => {
+          this.activities = res.records
+          this.search.page = res
+        })
+    },
+    handleSizeChange (val) {
+      this.search.page.size = val
+      this.search.page.current = 1
+      this.initDatas()
+    },
+    handleCurrentChange (val) {
+      this.search.page.current = val
+      this.initDatas()
+    },
+
+
+    deleteinformation (val) {
+      let _this = this
+      let params = {
+        id: val.id
+      }
+      _this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '关闭',
+        type: 'warning'
+      }).then(() => {
+        console.log(JSON.stringify(params))
+        InformationApi.delete(params)
+          .then(data => {
+            _this.initDatas()
+          })
+          .catch(function (error) {
+            console.log(error)
+          })
+      })
+        .catch(() => { })
+    },
+    // 列表排序功能
+    orderby (column) {
+      if (column.order === 'ascending') {
+        this.Column.Order = 'asc'
+      } else if (column.order === 'descending') {
+        this.Column.Order = 'desc'
+      }
+      this.Column.Prop = column.prop
+      this.initDatas()
+    },
+    searchCommand (command) {
+      if (command === 'search') {
+        this.dialogvisible = true
+      } else if (command === 'clear') {
+        this.clearSearch()
+      }
+    },
+    clearSearch () {
+      this.initSearchInfo()
+      this.initPageInfo()
+      this.initDatas()
+    }
+
+  }
+}
+</script>
+
+<style lang="scss">
+.el-pagination {
+  margin: 1rem 0 2rem;
+  text-align: right;
+}
+
+.plab {
+  font-size: 13px;
+  color: #999;
+}
+</style>