d8b11c9bb4e7aa2f62103ae1f288a6c27ebe2e7d.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-input v-model="table.getdataListParm.parammaps.rolename" placeholder="标题" style="width: 180px;" class="filter-item" clearable />
  5. <el-input v-model="table.getdataListParm.parammaps.rolename" placeholder="创建人" style="width: 180px;" class="filter-item" clearable />
  6. <el-date-picker ref="inputDatetime" v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  7. <el-button class="successBorder" @click="handleSearch('table')">查询</el-button>
  8. <el-button class="successBorder" @click="handleRefresh('table')">重置</el-button>
  9. </div>
  10. <div class="operation">
  11. <el-button class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
  12. <el-button class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
  13. </div>
  14. <div class="table">
  15. <el-table
  16. :key="table.tableKey"
  17. v-loading="table.listLoading"
  18. element-loading-text="给我一点时间"
  19. :data="table.list"
  20. border
  21. fit
  22. highlight-current-row
  23. style="width: 100%;"
  24. :row-style="rowStyle"
  25. :cell-style="cellStyle"
  26. class="elTable table-fixed"
  27. @selection-change="handleSelectionChange"
  28. >
  29. <el-table-column type="selection" align="center" width="50" />
  30. <el-table-column label="序号" align="center" type="index" width="50px">
  31. <template slot-scope="scope">
  32. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="标题" min-width="100px" align="center" prop="rolename" />
  36. <el-table-column label="时间范围" min-width="100px" align="center" prop="rolename" />
  37. <el-table-column label="创建时间" min-width="100px" align="center" prop="createdtime" />
  38. <el-table-column label="创建人" min-width="100px" align="center" prop="createmp" />
  39. <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
  40. <template slot-scope="{row}">
  41. <el-button class="miniSuccess" icon="el-icon-search" @click="handleSee(row)" />
  42. <span class="centerSpan">|</span>
  43. <el-button class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  44. <span class="centerSpan">|</span>
  45. <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  46. <span class="centerSpan">|</span>
  47. <a class="correcting" @click="handleStatisticsRead(row)">已读统计</a>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  52. </div>
  53. <el-dialog :title="textMap[statisticsRead.dialogStatus]" :visible.sync="statisticsRead.dialogFormVisible" :close-on-click-modal="false" width="70%">
  54. <div class="search">
  55. <el-select v-model="statisticsRead.getdataListParm.parammaps.enable" placeholder="牧场" class="filter-item" style="width: 120px;" clearable>
  56. <el-option v-for="item in pastureList" :key="item.id" :label="item.name" :value="item.id" />
  57. </el-select>
  58. <el-input v-model="statisticsRead.getdataListParm.parammaps.rolename" placeholder="用户" style="width: 180px;" class="filter-item" clearable />
  59. <el-date-picker ref="inputDatetime" v-model="statisticsRead.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  60. <el-button class="successBorder" @click="handleSearch('statisticsRead')">查询</el-button>
  61. <el-button class="successBorder" @click="handleRefresh('statisticsRead')">重置</el-button>
  62. </div>
  63. <div class="table">
  64. <el-table
  65. :key="statisticsRead.tableKey"
  66. v-loading="statisticsRead.listLoading"
  67. element-loading-text="给我一点时间"
  68. :data="statisticsRead.list"
  69. border
  70. fit
  71. highlight-current-row
  72. style="width: 100%;"
  73. :row-style="rowStyle"
  74. :cell-style="cellStyle"
  75. class="elTable table-fixed"
  76. >
  77. <el-table-column label="序号" align="center" type="index" width="50px">
  78. <template slot-scope="scope">
  79. <span>{{ scope.$index + (statisticsRead.pageNum-1) * statisticsRead.pageSize + 1 }}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="牧场" min-width="100px" align="center" prop="rolename" />
  83. <el-table-column label="用户" min-width="100px" align="center" prop="rolename" />
  84. <el-table-column label="已读时间" min-width="100px" align="center" prop="createdtime" />
  85. </el-table>
  86. <pagination v-show="statisticsRead.total>=0" :total="statisticsRead.total" :page.sync="statisticsRead.getdataListParm.offset" :limit.sync="statisticsRead.getdataListParm.pagecount" @pagination="getStatisticsReadList" />
  87. <div slot="footer" class="dialog-footer">
  88. <el-button class="cancelClose cancelClose1" @click="statisticsRead.dialogFormVisible = false;getList(); ">关闭</el-button>
  89. </div>
  90. </div>
  91. </el-dialog>
  92. </div>
  93. </template>
  94. <script>
  95. import { GetDataByName, GetDataByNames, ExecDataByConfig } from '@/api/common'
  96. import Cookies from 'js-cookie'
  97. import { parseTime } from '@/utils/index.js'
  98. import { MessageBox } from 'element-ui'
  99. import Pagination from '@/components/Pagination'
  100. export default {
  101. name: 'NotificationManagement',
  102. components: { Pagination },
  103. data() {
  104. return {
  105. requestParams: [
  106. { name: 'getPastureListJT', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), pasturename: '' }}
  107. ],
  108. pastureList: [], // 牧场
  109. table: {
  110. getdataListParm: {
  111. name: 'getRoleList',
  112. page: 1,
  113. offset: 1,
  114. pagecount: parseInt(Cookies.get('pageCount')),
  115. returntype: 'Map',
  116. parammaps: {
  117. pastureid: Cookies.get('pastureid'),
  118. rolename: '',
  119. createmp: '',
  120. enable: '',
  121. startTime: '',
  122. stopTime: '',
  123. inputDatetime: ''
  124. }
  125. },
  126. tableKey: 0,
  127. list: [],
  128. total: 0,
  129. listLoading: true,
  130. temp: {}
  131. },
  132. statisticsRead: {
  133. getdataListParm: {
  134. name: 'getRoleList',
  135. page: 1,
  136. offset: 1,
  137. pagecount: 10,
  138. returntype: 'Map',
  139. parammaps: {
  140. pastureid: Cookies.get('pastureid'),
  141. rolename: '',
  142. createmp: '',
  143. enable: '',
  144. startTime: '',
  145. stopTime: '',
  146. inputDatetime: ''
  147. }
  148. },
  149. tableKey: 0,
  150. list: [],
  151. total: 0,
  152. listLoading: true,
  153. temp: {},
  154. dialogFormVisible: false
  155. },
  156. dialogStatus: '',
  157. isokDisable: false,
  158. textMap: {
  159. statisticsRead: '已读统计'
  160. },
  161. selectList: {},
  162. requestParam: {},
  163. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  164. cellStyle: { padding: 0 + 'px' }
  165. }
  166. },
  167. created() {
  168. this.getDownList()
  169. this.getList()
  170. },
  171. methods: {
  172. getDownList() {
  173. GetDataByNames(this.requestParams).then(response => {
  174. this.pastureList = response.data.getPastureListJT.list
  175. })
  176. },
  177. getList() {
  178. this.table.listLoading = true
  179. GetDataByName(this.table.getdataListParm).then(response => {
  180. console.log('table数据', response.data.list)
  181. if (response.data.list !== null) {
  182. this.table.list = response.data.list
  183. this.table.pageNum = response.data.pageNum
  184. this.table.pageSize = response.data.pageSize
  185. this.table.total = response.data.total
  186. } else {
  187. this.table.list = []
  188. }
  189. setTimeout(() => {
  190. this.table.listLoading = false
  191. }, 100)
  192. })
  193. },
  194. handleSearch(item) {
  195. if (item == 'table') {
  196. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  197. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  198. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  199. } else {
  200. this.table.getdataListParm.parammaps.inputDatetime = ''
  201. this.table.getdataListParm.parammaps.startTime = ''
  202. this.table.getdataListParm.parammaps.stopTime = ''
  203. }
  204. this.table.getdataListParm.offset = 1
  205. this.getList()
  206. } else if (item == 'statisticsRead') {
  207. if (this.statisticsRead.getdataListParm.parammaps.inputDatetime !== '' && this.statisticsRead.getdataListParm.parammaps.inputDatetime !== null) {
  208. this.statisticsRead.getdataListParm.parammaps.startTime = parseTime(this.statisticsRead.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  209. this.statisticsRead.getdataListParm.parammaps.stopTime = parseTime(this.statisticsRead.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  210. } else {
  211. this.statisticsRead.getdataListParm.parammaps.inputDatetime = ''
  212. this.statisticsRead.getdataListParm.parammaps.startTime = ''
  213. this.statisticsRead.getdataListParm.parammaps.stopTime = ''
  214. }
  215. this.statisticsRead.getdataListParm.offset = 1
  216. this.getList()
  217. }
  218. },
  219. handleRefresh(item) {
  220. console.log('点击了重置')
  221. if (item == 'table') {
  222. // table
  223. } else if (item == 'statisticsRead') {
  224. // 已读统计
  225. }
  226. },
  227. handleCreate() {},
  228. handleSee(row) {},
  229. handleUpdate(row) {},
  230. handleRowDelete(row) {},
  231. handleStatisticsRead(row) {
  232. this.statisticsRead.temp = Object.assign({}, row)
  233. this.statisticsRead.dialogStatus = 'statisticsRead'
  234. this.statisticsRead.dialogFormVisible = true
  235. this.getStatisticsReadList()
  236. },
  237. getStatisticsReadList() {
  238. this.statisticsRead.listLoading = true
  239. GetDataByName(this.statisticsRead.getdataListParm).then(response => {
  240. if (response.data.list !== null) {
  241. this.statisticsRead.list = response.data.list
  242. this.statisticsRead.pageNum = response.data.pageNum
  243. this.statisticsRead.pageSize = response.data.pageSize
  244. this.statisticsRead.total = response.data.total
  245. } else {
  246. this.statisticsRead.list = []
  247. }
  248. setTimeout(() => {
  249. this.statisticsRead.listLoading = false
  250. }, 100)
  251. })
  252. },
  253. handleSelectionChange(val) {
  254. console.log('勾选数据', val)
  255. this.selectList = val
  256. },
  257. handleDelete() {
  258. console.log('点击了删除')
  259. if (this.selectList.length == 0) {
  260. this.$message({ type: 'error', message: '请选择角色信息', duration: 2000 })
  261. } else {
  262. MessageBox.confirm('是否确认删除此信息?', {
  263. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  264. }).then(() => {
  265. console.log(this.selectList)
  266. this.requestParam.common = { 'returnmap': '0' }
  267. this.requestParam.data = []
  268. for (let i = 0; i < this.selectList.length; i++) {
  269. this.requestParam.data[i] = { 'name': 'checkDeleteRole', 'type': 'v', 'parammaps': {
  270. 'pastureid': this.selectList[i].pastureid,
  271. 'id': this.selectList[i].id
  272. }}
  273. }
  274. this.requestParam.data[this.selectList.length] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  275. this.requestParam.data[this.selectList.length].children = []
  276. this.requestParam.data[this.selectList.length].children[0] = { 'name': 'deleteRole', 'type': 'e', 'parammaps': {
  277. 'pastureid': '@insertSpotList.pastureid',
  278. 'id': '@insertSpotList.id'
  279. }}
  280. ExecDataByConfig(this.requestParam).then(response => {
  281. console.log('删除保存发送参数', this.requestParam)
  282. if (response.msg === 'fail') {
  283. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  284. } else {
  285. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  286. this.getList()
  287. }
  288. })
  289. })
  290. }
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. .search{margin-top:10px;}
  297. .table{margin-top:10px;}
  298. </style>