auditnum.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="device">
  3. <div class="search">
  4. <el-input placeholder="输入设备编号/地址" class="search-input" clearable v-model="mixins_query.meterNo"></el-input>
  5. <el-select filterable v-model="mixins_query.approvalStatus" placeholder="请选择审核状态" clearable>
  6. <el-option label="未审核" :value="0"></el-option>
  7. <el-option label="已审核" :value="1"></el-option>
  8. </el-select>
  9. <zz-doubleInput
  10. middle="至"
  11. inputValueStart="currentReading"
  12. inputValueEnd="lastReading"
  13. :startPlaceholder="params.type == 1 ? '用水量起度' : '用电量起度'"
  14. :endPlaceholder="params.type == 1 ? '用水量止度' : '用电量止度'"
  15. :query="mixins_query"
  16. :clearable="true"
  17. >
  18. </zz-doubleInput>
  19. <el-button type="primary" class="search-btn" @click="mixins_search" icon="el-icon-search">查询 </el-button>
  20. <div class="search-icon">
  21. <el-tooltip placement="bottom" class="item" effect="light" content="批量审核">
  22. <i class="zoniot_font zoniot-icon-piliangshenhe" @click="auditSelect()"></i>
  23. </el-tooltip>
  24. <el-tooltip placement="bottom" class="item" effect="light" content="全部审核">
  25. <i class="zoniot_font zoniot-icon-quanbushenhe" @click="allAudit()"></i>
  26. </el-tooltip>
  27. <el-tooltip placement="bottom" class="item" effect="light" content="返回">
  28. <i class="zoniot_font zoniot-icon-fanhui" @click="$emit('close')"></i>
  29. </el-tooltip>
  30. </div>
  31. </div>
  32. <zz-table
  33. :cols="cols"
  34. :data="mixins_list"
  35. :loading="mixins_onQuery"
  36. :pageset="mixins_pageset"
  37. @sort-change="sortChange"
  38. @page-change="pageChange"
  39. :settings="{ showCheckbox: true, showIndex: true }"
  40. @selection-change="selectionChange"
  41. >
  42. <template slot="settletimeRange" slot-scope="scope">
  43. <span>{{ timeformat(scope.row.clearingStartDate) }} - {{ timeformat(scope.row.clearingEndDate) }}</span>
  44. </template>
  45. <template slot-scope="scope" slot="opt">
  46. <div class="opt">
  47. <el-tooltip class="item" effect="light" placement="bottom" :content="params.type == 1 ? '修改水量' : '修改电量'">
  48. <span class="zoniot_font" @click="editRow(scope.row)">&#xe689;</span>
  49. </el-tooltip>
  50. </div>
  51. </template>
  52. </zz-table>
  53. </div>
  54. </template>
  55. <script>
  56. import list from '@utils/list.js';
  57. export default {
  58. mixins: [list],
  59. props: ['params'],
  60. data() {
  61. return {
  62. auditOptions: [
  63. { id: '', name: '全部' },
  64. { id: '0', name: '未审核' },
  65. { id: '1', name: '已审核' }
  66. ],
  67. cols: [
  68. {
  69. label: '所属社区',
  70. prop: 'communityName'
  71. },
  72. {
  73. label: '地址',
  74. prop: 'location'
  75. },
  76. {
  77. label: '设备编号',
  78. prop: 'deviceNo'
  79. },
  80. {
  81. label: '用途',
  82. prop: 'useType',
  83. format(val, data) {
  84. return val == 1 ? '房间表' : '公摊表';
  85. }
  86. },
  87. {
  88. label: '计量周期',
  89. prop: 'settletimeRange',
  90. slot: 'settletimeRange',
  91. width: 300
  92. },
  93. {
  94. label: '上期读数',
  95. prop: 'lastReading'
  96. },
  97. {
  98. label: '本期读数',
  99. prop: 'currentReading'
  100. },
  101. {
  102. label: '用水量(吨)',
  103. prop: 'waterConsumption'
  104. },
  105. {
  106. label: '审核状态',
  107. prop: 'approvalStatus',
  108. format(val) {
  109. return String(val) == '1' ? '已审核' : '未审核';
  110. }
  111. },
  112. {
  113. label: '操作',
  114. slot: 'opt'
  115. }
  116. ],
  117. mixins_post: 'post',
  118. isfocus: false
  119. };
  120. },
  121. methods: {
  122. mixinsxxx() {
  123. console.log(this.mixins_query);
  124. },
  125. timeformat(val) {
  126. return this.$moment(val).format('YYYY-MM-DD HH:mm:ss');
  127. },
  128. // 多选框勾选事件
  129. selectionChange(val) {
  130. this.selectRow = val;
  131. },
  132. // 批量
  133. auditSelect() {
  134. if (!this.selectRow || !this.selectRow.length) {
  135. this.$message.error('请选择要审核的条目');
  136. return;
  137. }
  138. let ids = [];
  139. this.selectRow.forEach((v) => {
  140. ids.push({
  141. id: v.id,
  142. planId: this.params.id
  143. });
  144. });
  145. const title = '审核';
  146. let msg = '确认批量审核以上勾选的水表';
  147. this.__confirm(msg, title)
  148. .then((_) => {
  149. this.$http
  150. .post('/sc-energy/measurementRecord/audit', ids)
  151. .then(({ status, data, msg }) => {
  152. if (0 == status) {
  153. this.$message.success(msg);
  154. this.mixins_search();
  155. } else {
  156. this.$message.error(msg);
  157. }
  158. })
  159. .catch((err) => {});
  160. })
  161. .catch((_) => {});
  162. },
  163. //全部
  164. allAudit() {
  165. const title = '审核全部水表';
  166. let msg = '确认审核全部水表?';
  167. this.__confirm(msg, title)
  168. .then((_) => {
  169. console.log(this.params);
  170. this.$http
  171. .postForm('/sc-energy/measurementRecord/auditAll', { planId: this.params.id })
  172. .then(({ status, data, msg }) => {
  173. if (0 == status) {
  174. this.$message.success(msg);
  175. this.mixins_search();
  176. } else {
  177. this.$message.error(msg);
  178. }
  179. })
  180. .catch((err) => {});
  181. })
  182. .catch((_) => {});
  183. },
  184. editRow(data = {}) {
  185. new Promise((resolve) => {
  186. this.$store.dispatch('addPopup', {
  187. url: '/settlementAudit/popups/editWaterUsg',
  188. width: '520px',
  189. height: '200px',
  190. props: {
  191. data,
  192. type: this.params.type,
  193. callback: resolve
  194. },
  195. title: this.params.type == 1 ? '修改水量' : '修改电量'
  196. });
  197. }).then(() => {
  198. this.mixins_search();
  199. });
  200. }
  201. },
  202. created() {
  203. this.mixins_dataUrl = '/sc-energy/measurementRecord/page';
  204. this.mixins_query = {
  205. planId: this.params.id,
  206. lastReading:null,
  207. currentReading: null,
  208. status: ''
  209. };
  210. if (this.params.type == 2) {
  211. this.cols[7].label = '用电量(度)';
  212. }
  213. this.mixins_search();
  214. },
  215. mounted() {}
  216. };
  217. </script>