index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="app-container">
  3. <div class="table1">
  4. <div class="search">
  5. <el-input v-model="table1.parammaps.code" placeholder="脖环号" style="width: 180px;" class="filter-item" clearable />
  6. <el-input v-model="table1.parammaps.cownum" placeholder="牛号" style="width: 180px;" class="filter-item" clearable />
  7. <el-date-picker v-model="table1.parammaps.inputDatetime" type="daterange" class="filter-item" range-separator="至" start-placeholder="最后接收时间" end-placeholder="最后接收时间" />
  8. <el-button class="successBorder" @click="handleSearch1">查询</el-button>
  9. <el-button class="successBorder" @click="handleRefresh1">重置</el-button>
  10. </div>
  11. <div class="table">
  12. <el-table
  13. :key="table1.tableKey"
  14. v-loading="table1.listLoading"
  15. element-loading-text="给我一点时间"
  16. :data="table1.list"
  17. border
  18. fit
  19. highlight-current-row
  20. style="width: 100%;"
  21. :row-style="rowStyle"
  22. :cell-style="cellStyle"
  23. class="elTable table-fixed"
  24. >
  25. <el-table-column label="序号" align="center" type="index" width="50px">
  26. <template slot-scope="scope">
  27. <span v-if="table1.pageNum">{{ scope.$index + (table1.pageNum-1) * table1.pageSize + 1 }}</span>
  28. <span v-else>1</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="脖环号" min-width="60px" align="center" prop="REGIST_NUM_2" />
  32. <el-table-column label="牛号" min-width="60px" align="center" prop="COW_NUM" />
  33. <el-table-column label="牛舍名称" min-width="60px" align="center" prop="HOUSE_NAME" />
  34. <el-table-column label="最后接收时间" min-width="60px" align="center" prop="createtime" />
  35. <el-table-column label="最后定位" min-width="60px" align="center">
  36. <template slot-scope="{row}">
  37. <a @click="clickFind(row)" style="text-decoration: underline;color: #0000FF;">查找</a>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="处理时间" min-width="60px" align="center" prop="measuretime" />
  41. <el-table-column label="处理措施" min-width="60px" align="center" prop="measure" />
  42. <el-table-column label="操作" min-width="60px" align="center">
  43. <template slot-scope="{row}">
  44. <a @click="clickHandle(row)" style="text-decoration: underline;color: #0000FF;">处理</a>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. <pagination v-show="table1.total>0" :total="table1.total" :page.sync="table1.offset" :limit.sync="table1.pagecount" @pagination="getList1()" />
  49. </div>
  50. </div>
  51. <!-- 查找 -->
  52. <el-dialog :title="textMap[find.dialogStatus]" :visible.sync="find.dialogFormVisible" :close-on-click-modal="false" width="50%">
  53. <div class="find">
  54. 查找
  55. </div>
  56. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  57. <el-button class="cancelClose1" @click="find.dialogFormVisible = false; ">关闭</el-button>
  58. </div>
  59. </el-dialog>
  60. <!-- 处理 -->
  61. <el-dialog :title="textMap[handle.dialogStatus]" :visible.sync="handle.dialogFormVisible" :close-on-click-modal="false" width="40%">
  62. <div class="handle">
  63. <el-form ref="handleTemp" :rules="handle.rules" :model="handle.temp" label-position="right" label-width="150px" style="width: 100%;margin:0 auto 50px">
  64. <el-row>
  65. <el-col :span="20">
  66. <el-form-item label="脖环号:" prop="REGIST_NUM_2">
  67. <span>{{handle.temp.REGIST_NUM_2}}</span>
  68. </el-form-item>
  69. </el-col>
  70. </el-row>
  71. <el-row>
  72. <el-col :span="20">
  73. <el-form-item label="牛号:" prop="COW_NUM">
  74. <span>{{handle.temp.COW_NUM}}</span>
  75. </el-form-item>
  76. </el-col>
  77. </el-row>
  78. <el-row>
  79. <el-col :span="20">
  80. <el-form-item label="牛舍:" prop="HOUSE_NAME">
  81. <span>{{handle.temp.HOUSE_NAME}}</span>
  82. </el-form-item>
  83. </el-col>
  84. </el-row>
  85. <el-row>
  86. <el-col :span="20">
  87. <el-form-item label="最后接收时间:" prop="createtime">
  88. <span>{{handle.temp.createtime}}</span>
  89. </el-form-item>
  90. </el-col>
  91. </el-row>
  92. <el-row>
  93. <el-col :span="20">
  94. <el-form-item label="处理措施:" prop="measure">
  95. <el-select ref="measure" v-model="handle.temp.measureid" filterable placeholder="处理措施" class="filter-item" style="width: 100%;">
  96. <el-option v-for="item in handle.treatmentMeasuresList" :key="item.id" :label="item.name" :value="item.id" />
  97. </el-select>
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. </el-form>
  102. </div>
  103. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  104. <el-button class="save" :disabled="isokDisable" @click="clickhandleData()">确认</el-button>
  105. <el-button class="cancelClose" @click="handle.dialogFormVisible = false; ">取消</el-button>
  106. </div>
  107. </el-dialog>
  108. </div>
  109. </template>
  110. <script>
  111. import Pagination from '@/components/Pagination'
  112. import { postJson } from '@/api/common'
  113. import { parseTime } from '@/utils/index.js'
  114. import Cookies from 'js-cookie'
  115. export default {
  116. name: 'AbnormalNeckRing',
  117. components: { Pagination },
  118. data() {
  119. return {
  120. table1:{
  121. page: 1, offset: 1, pagecount: parseInt(Cookies.get('pageCount')),
  122. parammaps: { cownum:'',code:'',inputDatetime:'',startdate:'',enddate:'' },
  123. tableKey: 0, list: [], total: 0, listLoading: false
  124. },
  125. // 查找
  126. find:{
  127. dialogStatus: '',
  128. dialogFormVisible: false,
  129. },
  130. // 处理
  131. handle:{
  132. dialogStatus: '',
  133. dialogFormVisible: false,
  134. rules:{
  135. measureid: [{ type: 'String', required: true, message: '必填', trigger: 'change' }],
  136. },
  137. temp:{},
  138. treatmentMeasuresList:[{id:'0',name:'信号范围之外'},{id:'1',name:'更换'}]
  139. },
  140. isokDisable:false,
  141. textMap: {
  142. handleTxt: '处理',
  143. findTxt: '查找'
  144. },
  145. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  146. cellStyle: { padding: 0 + 'px' }
  147. }
  148. },
  149. created() {
  150. this.getList1()
  151. },
  152. methods: {
  153. getList1() {
  154. this.table1.listLoading = true
  155. if(this.table1.parammaps.inputDatetime !== '' && this.table1.parammaps.inputDatetime !== null){
  156. this.table1.parammaps.startdate = parseTime(this.table1.parammaps.inputDatetime[0],'{y}-{m}-{d}')
  157. this.table1.parammaps.enddate = parseTime(this.table1.parammaps.inputDatetime[1],'{y}-{m}-{d}')
  158. }else{
  159. this.table1.parammaps.startdate = ''
  160. this.table1.parammaps.enddate = ''
  161. this.table1.parammaps.inputDatetime = ''
  162. }
  163. let data = {
  164. name:'getAbnormalStatistics',
  165. page: this.table1.page, offset: this.table1.offset, pagecount: this.table1.pagecount, returntype: 'Map',
  166. parammaps: this.table1.parammaps
  167. }
  168. let url = 'authdata/GetDataByName'
  169. postJson(url,data).then(response => {
  170. if (response.data.list !== null) {
  171. console.log('table数据', response.data.list)
  172. this.table1.list = response.data.list
  173. this.table1.pageNum = response.data.pageNum
  174. this.table1.pageSize = response.data.pageSize
  175. } else {
  176. this.table1.list = []
  177. }
  178. this.table1.total = response.data.total
  179. setTimeout(() => {
  180. this.table1.listLoading = false
  181. }, 100)
  182. })
  183. },
  184. handleSearch1(){
  185. this.table1.offset = 1
  186. this.getList1()
  187. },
  188. handleRefresh1(){
  189. this.table1.offset = 1
  190. this.table1.parammaps= {
  191. cownum:'',
  192. code:'',
  193. startdate:'',
  194. enddate:'',
  195. inputDatetime:''
  196. }
  197. this.getList1()
  198. },
  199. clickFind(row){
  200. console.log('查找')
  201. this.find.dialogFormVisible = true
  202. this.find.dialogStatus = 'findTxt'
  203. },
  204. clickHandle(row){
  205. console.log('处理')
  206. this.handle.temp = Object.assign({}, row)
  207. this.handle.dialogFormVisible = true
  208. this.handle.dialogStatus = 'handleTxt'
  209. },
  210. clickhandleData(){
  211. console.log('处理确认')
  212. this.isokDisable = true
  213. setTimeout(() => {
  214. this.isokDisable = false
  215. }, 3000)
  216. this.$refs['handleTemp'].validate(valid => {
  217. if (valid) {
  218. let data = {
  219. name:'updatejbqerr',
  220. parammaps:{
  221. measureid:this.handle.temp.measureid,
  222. id:this.handle.temp.id,
  223. }
  224. }
  225. let url = 'authdata/PostDataByName'
  226. postJson(url,data).then(response => {
  227. if (response.code == 200) {
  228. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  229. this.$refs.handleTemp.resetFields();
  230. this.handle.dialogFormVisible = false
  231. this.getList1()
  232. }else{
  233. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  234. }
  235. })
  236. }
  237. })
  238. }
  239. }
  240. }
  241. </script>
  242. <style>
  243. </style>