index.vue 13 KB

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