apply-list.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="main">
  3. <div class="main-body">
  4. <el-card class="box-card">
  5. <div slot="header" class="clearfix" >
  6. <el-form :inline="true" :model="searchInfo" class="demo-form-inline">
  7. <el-form-item label="选择部门">
  8. <el-select v-model="searchInfo.department" collapse-tags placeholder="请选择" clearable>
  9. <div class="el-input" style="width:90%;margin-left:5%;">
  10. <input type="text" placeholder="请输入" class="el-input__inner" v-model="dropDownValue">
  11. </div>
  12. <el-option
  13. v-for="(item,index) in userDepartments"
  14. :value="item.departmentId"
  15. v-show="item.isLeader>1"
  16. @click.native="selectDepartment(item)"
  17. :key="index"
  18. :label="item.department"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="选择分类">
  22. <el-select v-model="searchInfo.category" collapse-tags placeholder="请选择" clearable>
  23. <el-option v-for="(item,index) in categorys"
  24. :value="index" :key="index" :label="item"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="文件标题">
  28. <el-input placeholder="" v-model="searchInfo.keyword" clearable></el-input>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button @click="getApplyArticalList" type="primary">搜索</el-button>
  32. </el-form-item>
  33. </el-form>
  34. </div>
  35. <el-table :data="restaurants" border stripe>
  36. <el-table-column label="序号" width="50" prop="id" align="center">
  37. </el-table-column>
  38. <el-table-column label="下载文件" min-width="300" prop="title">
  39. </el-table-column>
  40. <el-table-column label="申请人" width="80" prop="username">
  41. </el-table-column>
  42. <el-table-column label="申请时间" min-width="110" prop="createAt">
  43. <template slot-scope="{row}">
  44. <span> {{row.createAt|toDatetime}}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="申请原因" min-width="80" prop="applyInfo">
  48. </el-table-column>
  49. <el-table-column
  50. align="center"
  51. min-width="80"
  52. label="操作"
  53. class-name="small-padding fixed-width"
  54. >
  55. <template slot-scope="{row, $index}">
  56. <el-button
  57. v-if="!row.isSend"
  58. type="success"
  59. size="small"
  60. icon="el-icon-circle-check"
  61. @click="applyDoc(row, $index)"
  62. >审核</el-button>
  63. <el-button
  64. v-else-if="row.isSend==1"
  65. type="text"
  66. size="small"
  67. icon="el-icon-circle-check"
  68. @click="applyDoc(row, $index)"
  69. >允许下载</el-button>
  70. <el-button
  71. v-else-if="row.isSend==2"
  72. type="text"
  73. size="small"
  74. icon="el-icon-circle-close"
  75. @click="applyDoc(row, $index)"
  76. >拒绝下载</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <el-pagination
  81. :current-page="page"
  82. :page-size="pageSize"
  83. :page-sizes="[10, 30, 50, 100]"
  84. @size-change="handleSizeChange"
  85. @current-change="handleCurrentChange"
  86. :style="{float:'center',padding:'20px'}"
  87. :total="total"
  88. layout="total, sizes, prev, pager, next, jumper"
  89. ></el-pagination>
  90. </el-card>
  91. </div>
  92. <el-dialog title="[办公室]XX 申请下载资料" center :visible.sync="dialogFormVisible" >
  93. <h3> 【{{form.username}}】需要下载文件 【{{form.title}}】 </h3>
  94. <div class="dialog-footer" slot="footer">
  95. <el-button type="warning" size="medium" style="width: 100px; padding: 10px; margin: 20px;"
  96. @click="forbitDownload(form)" >拒绝下载</el-button>
  97. <el-button type="primary" size="medium" style="width: 100px; padding: 10px; margin: 20px;"
  98. @click="allowDownload( form)">允许下载</el-button>
  99. </div>
  100. </el-dialog>
  101. </div>
  102. </template>
  103. <script>
  104. import IHeader from "./components/IHeader";
  105. import IFooter from "./components/IFooter";
  106. import glIcon from '@/icons/img/2016smyjj_gl_icon.jpg'
  107. import data from '../data/data.js'
  108. import {replyArtical,getApplyArticalList} from '@/api/article'
  109. import { mapGetters } from "vuex";
  110. import {toDatetime} from '@/utils/date.js'
  111. export default {
  112. name: 'application',
  113. components: {
  114. IHeader,
  115. IFooter
  116. },
  117. data() {
  118. return {
  119. categorys: data.categorys,
  120. dialogFormVisible: false,
  121. glIcon: glIcon,
  122. list: data.departs,
  123. total: 0,
  124. page:1,
  125. pageSize: 10,
  126. searchInfo:{},
  127. dropDownValue:'',
  128. departmentId: 0,
  129. restaurants: [],
  130. state3: '',
  131. form:{},
  132. selectDepartId:1,
  133. selectDepartName: '',
  134. category:'',
  135. isShowMore: false
  136. }
  137. },
  138. watch:{
  139. "searchInfo.category"(val){
  140. this.page = 1
  141. this.getApplyArticalList()
  142. }
  143. },
  144. computed: {
  145. ...mapGetters("user", ["userDepartments"])
  146. },
  147. mounted() {
  148. this.getApplyArticalList();
  149. },
  150. filters:{
  151. filterTitle(val){
  152. if( val.length > 35) {
  153. return val.substr(0,32)+"..."
  154. }else{
  155. return val
  156. }
  157. },
  158. toDatetime
  159. },
  160. methods: {
  161. selectDepartment(item){
  162. this.departmentId = item.departmentId
  163. this.page = 1
  164. this.getApplyArticalList()
  165. },
  166. handleSizeChange(size){
  167. this.pageSize = size
  168. this.getApplyArticalList()
  169. },
  170. handleCurrentChange(page){
  171. this.page = page
  172. this.getApplyArticalList()
  173. },
  174. applyDoc( row, index ){
  175. this.dialogFormVisible = true
  176. row.index = index
  177. this.form = row
  178. },
  179. forbitDownload(item){
  180. let param = {articalId: item.articalId, id:item.id, action:2}
  181. replyArtical( param ).then( res=>{
  182. if( res.code == 200){
  183. item.isSend = 2
  184. this.dialogFormVisible = false;
  185. this.$message.successMsg("处理完成", 2)
  186. }
  187. })
  188. },
  189. allowDownload(item){
  190. let param = {articalId: item.articalId,id:item.id, action:1}
  191. replyArtical( param ).then( res=>{
  192. if( res.code == 200){
  193. item.isSend = 1
  194. this.dialogFormVisible = false;
  195. this.$message.successMsg("处理完成", 2)
  196. }
  197. })
  198. },
  199. getApplyArticalList() {
  200. let {page,pageSize, departmentId} = this
  201. let param = {page,pageSize, departmentId}
  202. Object.assign( param , this.searchInfo)
  203. getApplyArticalList( param ).then( res=>{
  204. this.restaurants = res.data.list
  205. this.total = res.data.total
  206. console.log("getHotArticalList", res)
  207. })
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .el-breadcrumb{
  214. display: inline-block;
  215. padding-left: 10px;
  216. }
  217. .box-card{
  218. margin-bottom: 20px;
  219. }
  220. .my-autocomplete {
  221. li {
  222. line-height: normal;
  223. padding: 7px;
  224. .name {
  225. text-overflow: ellipsis;
  226. overflow: hidden;
  227. }
  228. .addr {
  229. font-size: 12px;
  230. color: #b4b4b4;
  231. }
  232. .highlighted .addr {
  233. color: #ddd;
  234. }
  235. }
  236. }
  237. .el-card__body .text{
  238. margin: 5px 0;
  239. }
  240. .el-card{
  241. color: #1890ff;
  242. }
  243. .el-card__header{
  244. padding: 15px 20px;
  245. }
  246. .el-menu-vertical-demo:not(.el-menu--collapse) {
  247. width: 200px;
  248. min-height: 400px;
  249. }
  250. .oneline {
  251. line-height: 30px;
  252. white-space: nowrap;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. }
  256. </style>