index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div>
  3. <basicLayout
  4. ref="list"
  5. :oldFormPath="{add:'HManagement/notice/list/modules'}"
  6. tableName="noticeTable"
  7. idName="sat_noticeid"
  8. :apiId="{query:20221101094903,del:20221101095103}"
  9. :options="options"
  10. @listData="list"
  11. >
  12. >
  13. <div slot="titleRight">
  14. <el-button type="primary" size="small" @click="$store.dispatch('DrawerShowChange',true);$router.push('/noticeclass')">设置版块</el-button>
  15. </div>
  16. <div slot="custom" style="display:flex">
  17. <div class="label_center">
  18. <p class="search__label">状态:</p>
  19. <el-select
  20. class="inline-16"
  21. size="small"
  22. v-model="status"
  23. placeholder="请选择"
  24. @change="handleSelectChange"
  25. clearable
  26. >
  27. <el-option
  28. v-for="(item,index) in statusList"
  29. :label="item.label"
  30. :value="item.value"
  31. :key="index"
  32. ></el-option>
  33. </el-select>
  34. </div>
  35. <div class="label_center">
  36. <p class="search__label">版块:</p>
  37. <el-select
  38. class="inline-16"
  39. size="small"
  40. v-model="classname"
  41. placeholder="请选择版块"
  42. @change="classChange"
  43. clearable
  44. >
  45. <el-option
  46. v-for="(item,index) in classList"
  47. :label="item.classname"
  48. :value="item.sat_notice_classid"
  49. :key="index"
  50. ></el-option>
  51. </el-select>
  52. </div>
  53. <div class="label_center">
  54. <p class="search__label">发布时间:</p>
  55. <time-select class="inline-16" @clearSelect="clearTime" @timeChange="timeChange"></time-select>
  56. </div>
  57. </div>
  58. <template v-slot:tbList="scope">
  59. <div v-if="scope.data.column.columnname === 'status'">
  60. <span v-if="scope.data.column.data.isontop === 1" >
  61. <span v-if="scope.data.column.data[scope.data.column.columnname] === '发布'" style="color:#52C41A">{{scope.data.column.data[scope.data.column.columnname]}}</span>
  62. <span v-else>{{scope.data.column.data[scope.data.column.columnname]}}</span>
  63. <span style="color:#FF3B30;margin-left: 10px">置顶</span>
  64. </span>
  65. <div v-else>
  66. <span v-if="scope.data.column.data[scope.data.column.columnname] === '发布'" style="color:#52C41A">{{scope.data.column.data[scope.data.column.columnname]}}</span>
  67. <span v-else>{{scope.data.column.data[scope.data.column.columnname]}}</span>
  68. </div>
  69. </div>
  70. <div v-else>{{scope.data.column.data[scope.data.column.columnname]}}</div>
  71. </template>
  72. <template v-slot:tbOpreation="scope">
  73. <!-- <edit :id="scope.data.data.sat_noticeid" @updateSuccess="onSuccess"></edit>-->
  74. <el-button class="inline-16" type="text" size="small" @click="$store.dispatch('DrawerShowChange',true),$router.push({path:'/notice_edit',query:{id:scope.data.data.sat_noticeid}})">详情</el-button>
  75. <el-button class="inline-16" v-if="tool.checkAuth($route.name,'data_analysis')" type="text" size="small" @click="$store.dispatch('DrawerShowChange',true),$router.push({path:'/notice_analysis',query:{id:scope.data.data.sat_noticeid}})">数据分析</el-button>
  76. <message class="inline-16" v-if="tool.checkAuth($route.name,'read')" :data="scope.data.data.sat_noticeid" @onSuccess="onSuccess"></message>
  77. </template>
  78. </basicLayout>
  79. <el-drawer
  80. title="我是标题"
  81. :visible.sync="drawer"
  82. :with-header="false"
  83. direction="rtl"
  84. size="90%"
  85. append-to-body
  86. @close="closeDrawer">
  87. <div class="detail__panel">
  88. <router-view/>
  89. </div>
  90. </el-drawer>
  91. </div>
  92. </template>
  93. <script>
  94. import {mapGetters} from 'vuex'
  95. import message from './list/modules/message.vue'
  96. import edit from './list/modules/edit'
  97. import TimeSelect from '@/HDrpManagement/projectChange/components/TimeSelect'
  98. export default {
  99. data(){
  100. return {
  101. status:'',
  102. classname:'',
  103. options:[],
  104. accountType:'',
  105. statusList:[
  106. {label:'全部',value:''},
  107. {label:'新建',value:'新建'},
  108. {label:'发布',value:'发布'},
  109. ],
  110. classList:[],
  111. drawer:false
  112. }
  113. },
  114. components:{
  115. message,
  116. edit,
  117. TimeSelect
  118. },
  119. provide () {
  120. return {
  121. accountType: () => this.accountType
  122. }
  123. },
  124. computed: {
  125. ...mapGetters({
  126. DrawerShow:'DrawerShow'
  127. })
  128. },
  129. watch: {
  130. $route (val) {
  131. if (val.path == '/notice_mag_list') {
  132. this.$refs.list.listData()
  133. }
  134. },
  135. DrawerShow (val) {
  136. val ? this.drawer = true : this.drawer = false
  137. }
  138. },
  139. created () {
  140. this.getClassList()
  141. this.getAccountType()
  142. },
  143. methods:{
  144. /* 删除新建产生的无效通告 */
  145. async list (data) {
  146. let initID = '9999' + JSON.parse(window.sessionStorage.getItem("active_account")).userid;
  147. let deleteList = [];
  148. data.forEach(v => (initID == v.sat_notice_classid && v.title == '') ? deleteList.push(v.sat_noticeid) : '');
  149. if (deleteList.length != 0) this.handleDelete(deleteList);
  150. },
  151. /* 处理批量删除 */
  152. handleDelete(list) {
  153. this.$api.requested({
  154. "id":20221101095103,
  155. "content": {
  156. "sat_noticeids": list
  157. }
  158. }).then(res => {
  159. if (res.msg == '成功') this.$refs.list.listData();
  160. })
  161. },
  162. closeDrawer () {
  163. this.$store.dispatch('DrawerShowChange',false)
  164. this.$router.push({path:"notice_mag_list"})
  165. },
  166. onSuccess () {
  167. this.$refs.list.listData()
  168. },
  169. handleSelectChange () {
  170. this.$refs.list.param.content.where.status = this.status
  171. this.$refs.list.listData()
  172. },
  173. /* 用户类型 */
  174. async getAccountType () {
  175. let res = await this.$store.dispatch('optiontypeselect','usertype')
  176. this.accountType = res.data
  177. console.log(this.accountType,'eeee');
  178. },
  179. async getClassList () {
  180. let res = await this.$api.requested({
  181. 'id':20221101094603,
  182. 'content': {
  183. 'where': {
  184. }
  185. }
  186. })
  187. res.data.unshift({'classname':'全部','sat_notice_classid':''})
  188. this.classList = res.data
  189. console.log(res);
  190. },
  191. classChange () {
  192. this.$refs['list'].param.content.where.sat_notice_classid = this.classname
  193. this.$refs['list'].listData()
  194. },
  195. clearTime () {
  196. this.$refs['list'].param.content.where.startdate = ''
  197. this.$refs['list'].param.content.where.enddate = ''
  198. this.$refs['list'].listData()
  199. },
  200. timeChange (time) {
  201. this.$refs['list'].param.content.where.startdate = time[0]
  202. this.$refs['list'].param.content.where.enddate = time[1]
  203. this.$refs['list'].listData()
  204. }
  205. }
  206. }
  207. </script>
  208. <style>
  209. </style>
  210. <style scoped>
  211. </style>