tInformationDeliveryList.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div id="tInformationDeliveryList">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="search">
  6. <el-col :span="5">
  7. <span>筛选条件:</span>
  8. <el-select v-model="search.publish_state" placeholder="请选择发布状态">
  9. <el-option label="未发布" value="0"></el-option>
  10. <el-option label="已发布" value="1"></el-option>
  11. </el-select>
  12. </el-col>
  13. <el-col :span="4">
  14. <span>输入条件:</span>
  15. <el-input v-model="search.title" :placeholder="placeholder" class="input"></el-input>
  16. </el-col>
  17. <!--<el-col :span="7">
  18. <span>时间选择:</span>
  19. <el-date-picker v-model="search.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
  20. </el-col>-->
  21. <el-col :span="8">
  22. <el-button class="btnSearch" @click="toQuery">查询</el-button>
  23. <el-button class="btnSearch qing" @click="toClear">清空</el-button>
  24. </el-col>
  25. </el-col>
  26. <el-col :span="24">
  27. <el-table
  28. ref="tableData"
  29. :data="tableData"
  30. tooltip-effect="dark"
  31. :default-sort="{ prop: 'date', order: 'descending' }"
  32. style="width: 100%"
  33. @selection-change="handleSelectionChange"
  34. >
  35. <!--<el-table-column type="selection" align="center"> </el-table-column>-->
  36. <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
  37. <el-table-column property="title" label="标题" align="center"> </el-table-column>
  38. <el-table-column property="issuing_organ" label="发文机关" align="center"> </el-table-column>
  39. <el-table-column property="index_number" label="索引号" align="center"> </el-table-column>
  40. <el-table-column property="subject_classification" label="政策等级" align="center"> </el-table-column>
  41. <el-table-column property="issued_number" label="发文字号" align="center"> </el-table-column>
  42. <el-table-column property="subject_headings" label="主题词" align="center"> </el-table-column>
  43. <el-table-column label="发布日期" align="center">
  44. <template slot-scope="scope">
  45. <span>{{ getDate(scope.row.publish_time) }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="发布状态" align="center">
  49. <template slot-scope="scope">
  50. <span>{{ scope.row.publish_state === '1' ? '已发布' : '未发布'}}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column property="source" label="来源" align="center"> </el-table-column>
  54. <el-table-column label="操作" align="center" width="300px">
  55. <template slot-scope="scope">
  56. <el-button size="mini" type="text" class="other" @click="publish(scope.row)">发布</el-button>
  57. <el-button size="mini" type="text" class="edit" icon="el-icon-edit"
  58. @click="$router.push({ path: '/tInformationDelivery/detail', query: { id: scope.row.id } })"></el-button>
  59. <el-button size="mini" type="text" class="delete" icon="el-icon-delete"
  60. @click.prevent="deleteRow(scope.row.id)"></el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <el-row>
  65. <el-pagination
  66. @size-change="handleSizeChange"
  67. @current-change="handleCurrentChange"
  68. :current-page.sync="currentPage"
  69. :page-sizes="[10, 20, 30, 40]"
  70. :page-size.sync="limit"
  71. background
  72. layout="total, sizes, prev, pager, next, jumper"
  73. :total="total"
  74. >
  75. </el-pagination>
  76. </el-row>
  77. </el-col>
  78. </el-col>
  79. </el-row>
  80. <el-dialog
  81. :visible.sync="dialogVisible"
  82. width="30%"
  83. >
  84. <el-image :src="elImage" style="height:100%;width:100% "></el-image>
  85. </el-dialog>
  86. </div>
  87. </template>
  88. <script>
  89. export default {
  90. name: 'tInformationDeliveryList',
  91. props: {
  92. tableData: null,
  93. total: null,
  94. },
  95. components: {},
  96. data: () => ({
  97. placeholder: '请输入标题',
  98. search: {},
  99. currentPage: 1,
  100. limit: 10,
  101. dialogVisible: false,
  102. elImage: '',
  103. }),
  104. created() {
  105. },
  106. computed: {
  107. },
  108. methods: {
  109. handleSelectionChange(val) {
  110. this.multipleSelection = val;
  111. },
  112. deleteRow(id) {
  113. this.$confirm('确定删除吗?', '提示', {
  114. confirmButtonText: '确定',
  115. cancelButtonText: '取消',
  116. type: 'warning'
  117. }).then(() => {
  118. this.$set(this, `currentPage`, 1);
  119. this.$emit('deleteRow', {id: id, skip: 0, limit: this.limit, ...this.search});
  120. }).catch(() => {
  121. this.$message({
  122. type: 'info',
  123. message: '已取消删除'
  124. });
  125. });
  126. },
  127. handleSizeChange(val) {
  128. this.$set(this, `currentPage`, 1);
  129. this.$emit('select', {skip: 0, limit: val, ...this.search});
  130. },
  131. handleCurrentChange(val) {
  132. this.$emit('select', {skip: (val - 1) * this.limit, limit: this.limit, ...this.search});
  133. },
  134. toQuery() {
  135. this.$set(this, `currentPage`, 1);
  136. this.$emit('select', {skip: 0, limit: this.limit, ...this.search});
  137. },
  138. toClear() {
  139. let keys = Object.keys(this.search);
  140. for (const key of keys) {
  141. this.$set(this.search, `${key}`, '');
  142. }
  143. },
  144. showImage(image) {
  145. if(image){
  146. this.$set(this, `elImage`, image);
  147. this.$set(this, `dialogVisible`, true);
  148. }else{
  149. this.$set(this, `dialogVisible`, false);
  150. }
  151. },
  152. getDate(val) {
  153. if(val){
  154. return this.format(new Date(Number(val)),'yyyy年MM月dd');
  155. }
  156. return '';
  157. },
  158. format(date,formatStr){
  159. formatStr=formatStr.replace(/yyyy|YYYY/,date.getFullYear());
  160. formatStr=formatStr.replace(/MM/,(date.getMonth()+1)>9?(date.getMonth()+1).toString():'0' + (date.getMonth()+1));
  161. formatStr=formatStr.replace(/dd|DD/,date.getDate()>9?date.getDate().toString():'0' + date.getDate());
  162. return formatStr;
  163. },
  164. publish(row){
  165. if(row.publish_state === '1'){
  166. this.$message.error('已发布');
  167. return ;
  168. }
  169. this.$emit('publish', {row:row,skip: (this.currentPage - 1) * this.limit, limit: this.limit, ...this.search});
  170. },
  171. },
  172. };
  173. </script>
  174. <style lang="less" scoped>
  175. /deep/ .el-checkbox__input.is-checked .el-checkbox__inner {
  176. background-color: red;
  177. border-color: red;
  178. }
  179. /deep/ .el-checkbox__input.is-indeterminate .el-checkbox__inner {
  180. background-color: red;
  181. border-color: red;
  182. }
  183. /deep/ .el-table th {
  184. background-color: #f5f6fa;
  185. padding: 8px 0;
  186. }
  187. /deep/ .el-table td {
  188. padding: 11px 0;
  189. }
  190. .other {
  191. color: #f36302;
  192. }
  193. .view {
  194. color: #f36302;
  195. }
  196. .edit {
  197. color: #2ccc02;
  198. }
  199. .delete {
  200. color: #e9021d;
  201. }
  202. /deep/ .el-pagination {
  203. padding: 26px 20px;
  204. }
  205. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  206. background-color: red;
  207. }
  208. .input {
  209. width: 150px;
  210. }
  211. /deep/ .el-input__inner {
  212. height: 35px;
  213. line-height: 35px;
  214. }
  215. .btnSearch {
  216. width: 80px;
  217. height: 34px;
  218. background: rgba(233, 2, 29, 1);
  219. border-radius: 4px;
  220. padding: 0;
  221. color: #fff;
  222. }
  223. .qing {
  224. background: rgba(185, 185, 185, 1);
  225. }
  226. .top {
  227. height: 50px;
  228. margin: 0 0 10px 0;
  229. }
  230. .search {
  231. background: #ffffff;
  232. width: 97%;
  233. height: 35px;
  234. margin: 20px;
  235. margin-left: 0px;
  236. }
  237. .list {
  238. padding: 0 20px;
  239. }
  240. </style>