ljm 6 år sedan
förälder
incheckning
8a12ba3ea8

+ 3 - 2
src/dashoo.cn/backend/api/business/documentmanage/documentmanageService.go

@@ -1,6 +1,7 @@
 package documentmanage
 
 import (
+	"fmt"
 	"strconv"
 
 	. "dashoo.cn/backend/api/mydb"
@@ -20,11 +21,11 @@ func GetDocumentmanageService(xormEngine *xorm.Engine) *DocumentmanageService {
 }
 
 //获取文档名与创建时间
-func (s *DocumentmanageService) GetDocumentNameAndTime(table string) []DocumentNameTimeInfo {
+func (s *DocumentmanageService) GetDocumentNameAndTime(table string, colName string) []DocumentNameTimeInfo {
 	var err error
 	var sql string
 
-	sql = `select Name, CreateOn from ` + table + ` ORDER BY CreateOn DESC `
+	sql = "select Name, CreateOn from " + table + " WHERE " + colName + " = 1 " + " ORDER BY CreateOn DESC "
 
 	List := make([]DocumentNameTimeInfo, 0)
 	err = utils.DBE.Sql(sql).Find(&List)

+ 7 - 3
src/dashoo.cn/backend/api/controllers/document/document.go

@@ -19,8 +19,9 @@ type DocumentController struct {
 // @router /getdocumentlist [get]
 func (this *DocumentController) GetDocumentList() {
 	page := this.GetPageInfoForm()
-	where := " 1=1 "
 	DirectoryId := this.GetString("DirectoryId")
+
+	where := " 1=1 "
 	if DirectoryId != "" {
 		where = where + " and DirectoryId = " + DirectoryId
 	}
@@ -28,9 +29,11 @@ func (this *DocumentController) GetDocumentList() {
 	if Name != "" {
 		where = where + " and Name like '%" + Name + "%' "
 	}
+
 	svc := documentmanage.GetDocumentmanageService(utils.DBE)
 	var list []documentmanage.DocumentInfo
 	total, list := svc.GetDocumentInfoByWhere(page.CurrentPage, page.Size, "Id desc", this.User.AccCode+DocumentInfoName, where)
+
 	var datainfo DataInfo
 	datainfo.Items = list
 	datainfo.CurrentItemCount = total
@@ -40,16 +43,17 @@ func (this *DocumentController) GetDocumentList() {
 	this.ServeJSON()
 }
 
-// @Title 获取文档名与创建时间
+// @Title 获取文件名和创建时间
 // @Description get Name,CreateOn
 // @Success 200 {object} models.Userblood
 // @router /getdocumentnameandtime [get]
 func (this *DocumentController) GetDocumentNameAndTime() {
+	colName := this.GetString("colName")
 
 	svc := documentmanage.GetDocumentmanageService(utils.DBE)
 	var list []documentmanage.DocumentNameTimeInfo
 	tableName := "s5OVE" + DocumentInfoName
-	list = svc.GetDocumentNameAndTime(tableName)
+	list = svc.GetDocumentNameAndTime(tableName, colName)
 
 	this.Data["json"] = &list
 	this.ServeJSON()

+ 48 - 15
src/dashoo.cn/frontend_web/src/pages/documentmanage/_opera/edit.vue

@@ -30,16 +30,24 @@
               <el-input v-model="uploadform.Name" placeholder="请输入文档名称" ></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+         <el-col :span="6">
+            <el-form-item label="有效期至" prop="ValidityTime">
+              <el-date-picker type="datetime" placeholder="请选择有效期" v-model="uploadform.ValidityTime" style="width: 100%;"></el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
             <el-form-item label="版本信息" prop="VersionInfo">
-              <el-input v-model="uploadform.VersionInfo" placeholder="请输入版本信息" ></el-input>
+              <el-input v-model="uploadform.VersionInfo" placeholder="请输入版本信息"></el-input>
             </el-form-item>
           </el-col>
-          <!-- <el-col :span="12">
-            <el-form-item label="编辑人" prop="CreateBy">
-              <el-input v-model="uploadform.CreateBy" placeholder="请输入编辑人"></el-input>
+          <el-col :span="12">
+            <el-form-item label="文档类别">
+              <el-checkbox-group v-model="typeList">
+                <el-checkbox label="通知公告" border></el-checkbox>
+                <el-checkbox label="文件资料" border></el-checkbox>
+              </el-checkbox-group>
             </el-form-item>
-          </el-col> -->
+          </el-col>
           <el-col :span="24">
             <el-form-item label="备注">
               <el-input type="textarea" :rows="2" v-model="uploadform.Remark" placeholder="请输入备注信息" ></el-input>
@@ -133,6 +141,7 @@
         orgtreelist: [],
         JLDirectoryIds: [], //文档结构
         list: [],
+        typeList: [], //文档类别列表
         uploadform: {
           DirectoryId: '', //目录结构Id
           Name: '', //文档名称
@@ -140,7 +149,7 @@
           NoticeTab: '', //通知公告标签
           DocTab: '', //文件资料标签
           FileURL: '', //文档地址
-          ValidityTime: new Date(), //有效期至
+          ValidityTime: '', //有效期至
           Remark: '', //备注
         },
         AuthorUser: '',
@@ -161,16 +170,16 @@
             message: '请填写文档名称',
             trigger: 'blur'
           }],
+          ValidityTime: [{
+            required: true,
+            message: '请选择有效期至',
+            trigger: 'blur'
+          }],
           VersionInfo: [{
             required: true,
             message: '请填写版本信息',
             trigger: 'blur'
           }],
-          // CreateBy: [{
-          //   required: true,
-          //   message: '请输入编辑人',
-          //   trigger: 'blur'
-          // }],
         },
       }
     },
@@ -184,6 +193,15 @@
         this.$axios.get('/document/geteditinitinfo/' + this.documentId, {})
           .then(res => {
             _this.uploadform = res.data.items
+            let list = new Array()
+            // 设置文档类别的对应标签值
+            if (_this.uploadform.NoticeTab) {
+              list.push("通知公告")
+            }
+            if (_this.uploadform.DocTab) {
+              list.push("文件资料")
+            }
+            _this.typeList = list
             _this.gettreelist(218)
             _this.getwendanginfo(res.data.items.FileURL)
 
@@ -211,7 +229,7 @@
           })
           .then(res => {
             _this.orgtreelist = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,ItemName')
-            _this.getfinaljiedian(_this.uploadform.DirectoryId)
+            // _this.getfinaljiedian(_this.uploadform.DirectoryId)
           })
           .catch(err => {
             // handle error
@@ -229,7 +247,6 @@
             if (res.data.code === 0) {
               // 选中状态
               _this.JLDirectoryIds = []
-              let pidarr = res.data.message.split(',')
               for (var i = pidarr.length - 1; i >= 0; i--) {
                 if (pidarr[i] !== '0') {
                   _this.JLDirectoryIds.push(parseInt(pidarr[i]))
@@ -277,6 +294,7 @@
               } else {
                 _this.getattachissuccess()
                 _this.editdocumentinfo() //保存编辑信息
+                _this.getwendanginfo(_this.uploadform.FileURL) //更新已有文档列表
                 // 清空上传数据
                 if (_this.$refs.refuploadattach) {
                   _this.$refs.refuploadattach.clearFiles()
@@ -303,6 +321,21 @@
       editdocumentinfo() {
         let _this = this
         _this.uploadform.DirectoryId = parseInt(_this.JLDirectoryIds[_this.JLDirectoryIds.length - 1])
+        // 设置文档类别的对应标签值
+        for (let i = 0; i < _this.typeList.length; i++) {
+          //首先清0
+          _this.uploadform.NoticeTab = 0
+          _this.uploadform.DocTab = 0
+          //再设置
+          let v = _this.typeList[i]
+          switch (v) {
+            case "通知公告": _this.uploadform.NoticeTab = 1 
+            break;
+            case "文件资料": _this.uploadform.DocTab = 1
+            break;
+            default: _this.uploadform.DocTab = 1
+          }
+        }
         this.$axios.put('/document/editdocumentinfo/' + _this.documentId, _this.uploadform)
           .then(function (response) {
             if (response.data.code === 0) {
@@ -457,7 +490,7 @@
   }
 
   .attach-uploader .el-upload:hover {
-    border-color: #228B22;
+    border-color: #25ff25;
   }
 
   .attach-uploader-icon {

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/documentmanage/add.vue

@@ -200,7 +200,7 @@
     created() {
       let parentId = this.$route.query.exid
       this.gettreelist(218)
-      this.getfinaljiedian(parentId)
+      // this.getfinaljiedian(parentId)
     },
     methods: {
       gettreelist(pid) {

+ 11 - 0
src/dashoo.cn/frontend_web/src/pages/documentmanage/index.vue

@@ -52,6 +52,12 @@
               </template>
             </el-table-column>
             <el-table-column prop="Name" label="文档名称" align="center" header-align="center" show-overflow-tooltip></el-table-column>
+            <el-table-column prop="NoticeTab" label="文档类型" align="center" header-align="center" show-overflow-tooltip>
+              <template slot-scope="scope">
+                <el-tag v-if="scope.row.NoticeTab">通知公告</el-tag>
+                <el-tag v-if="scope.row.DocTab">文件资料</el-tag>
+              </template>
+            </el-table-column>
             <el-table-column prop="VersionInfo" label="文档版本" align="center" header-align="center" show-overflow-tooltip></el-table-column>
             <el-table-column prop="CreateBy" label="编辑人" align="center" header-align="center" show-overflow-tooltip></el-table-column>
             <el-table-column prop="CreateOn" label="编辑时间" align="center" header-align="center" show-overflow-tooltip>
@@ -59,6 +65,11 @@
                 {{ jstimehandle(scope.row.CreateOn+'') }}
               </template>
             </el-table-column>
+            <el-table-column prop="ValidityTime" label="有效期至" align="center" header-align="center" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{ jstimehandle(scope.row.ValidityTime+'') }}
+              </template>
+            </el-table-column>
           </el-table>
           <el-pagination style="float:right;margin:10px 0 10px 0;" @size-change="handleSizeChange" @current-change="handleCurrentChange"
             :current-page="currentPage" :page-size="size" :page-sizes="[10, 15, 20 ]" layout="total, sizes, prev, pager, next, jumper"

+ 64 - 18
src/dashoo.cn/frontend_web/src/pages/login.vue

@@ -8,32 +8,56 @@
       </el-header>
       <el-main style="height:700px;">
         <el-container>
-          <el-main style="height:700px; padding:5px 20px 0 15px; background-color: #D3DCE6;">
+          <el-main style="height:650px; padding:5px 20px 0 15px; background-color: #D3DCE6;">
             <div>
-              <div style="height:200px; background-color: white;">
+              <div style="height:250px; background-color: white;">
                 <div style="padding: 10px 0 0 15px;"><img src="../assets/img/tongzhigonggao.jpg" alt="通知公告" style="height: 40px; width: 100px;"></div>
                 <div>
-                  <ul type="circle">
-                    <li>苹果</li>
-                    <li>香蕉</li>
-                    <li>柠檬</li>
-                    <li>桔子</li>
-                  </ul>
+                  <template>
+                    <el-table :data="noticeList" show-header="false" style="width: 100%" max-height="200" >
+                      <el-table-column prop="Name" label="通知标题" width="450">
+                        <template slot-scope="scope">
+                          <i class="el-icon-caret-right"></i>
+                          <span style="margin-left: 5px">{{ scope.row.Name }}</span>
+                        </template>
+                      </el-table-column>
+                      <el-table-column prop="CreateOn" label="时间" width="141">
+                        <template slot-scope="scope">
+                          {{ jstimehandle(scope.row.CreateOn+'') }}
+                        </template>
+                      </el-table-column>
+                    </el-table>
+                  </template>
                 </div>
               </div>
-              <div style="height:200px; background-color: white; margin: 20px 0 0 0;">
+              <div style="height:250px; background-color: white; margin: 20px 0 0 0;">
                 <div style="padding: 10px 0 0 15px;"><img src="../assets/img/ziliaoxiazai.jpg" alt="资料下载" style="height: 40px; width: 100px;"></div>
                 <div>
-                  <ul type="circle">
-                    <li v-for="item in list">
+                  <!-- <ul type="circle">
+                    <li v-for="item in fileList" :key="item">
                       {{ item.Name }} <a style="font-weight: 400; font-size: 10px;">({{ jstimehandle(item.CreateOn) }})</a>
                     </li>
-                  </ul>
+                  </ul> -->
+                  <template>
+                    <el-table :data="fileList" show-header="false" style="width: 100%" max-height="200" >
+                      <el-table-column prop="Name" label="文件名" width="450">
+                        <template slot-scope="scope">
+                          <i class="el-icon-caret-right"></i>
+                          <span style="margin-left: 5px">{{ scope.row.Name }}</span>
+                        </template>
+                      </el-table-column>
+                      <el-table-column prop="CreateOn" label="时间" width="141">
+                        <template slot-scope="scope">
+                          {{ jstimehandle(scope.row.CreateOn+'') }}
+                        </template>
+                      </el-table-column>
+                    </el-table>
+                  </template>
                 </div>
               </div>
             </div>
           </el-main>
-          <el-aside style="height:760px; width:300px;">
+          <el-aside style="height:650px; width:300px;">
             <div style="padding: 5px 10px 0 0;">
               <el-form auto-complete="off" :model="model" :rules="rules" ref="user" label-position="top">
                 <p style="font-size: 20px; margin: 15px 0 5px 0; font-weight: 500;">登录</p>
@@ -82,7 +106,8 @@
       }
 
       return {
-        list: [], //文档列表
+        noticeList: [], //通知列表
+        fileList: [], //文档列表
         loginMode: 1,
         model: model,
         rules: rules,
@@ -91,14 +116,35 @@
       }
     },
     created() {
-      this.initData()
+      this.initNoticeListData()
+      this.initFileListData()
     },
     methods: {
-      initData() {
+      //获取通知列表
+      initNoticeListData() {
         let _this = this
-        _this.$axios.get("/document/getdocumentnameandtime", {})
+        //传递列名
+        const params = {
+          colName: "NoticeTab"
+        }
+        _this.$axios.get("/document/getdocumentnameandtime", {params})
+          .then(function (response) {
+            _this.noticeList = response.data
+          })
+          .catch(function (error) {
+            console.log(error);
+          });
+      },
+      //获取文件列表
+      initFileListData() {
+        let _this = this
+        //传递列名
+        const params = {
+          colName: "DocTab"
+        }
+        _this.$axios.get("/document/getdocumentnameandtime", {params})
           .then(function (response) {
-            _this.list = response.data
+            _this.fileList = response.data
           })
           .catch(function (error) {
             console.log(error);