auditnum.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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="lastReading"
  12. inputValueEnd="currentReading"
  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. return String(val) == '1' ? '已审核' : '未审核';
  49. <span class="zoniot_font" @click="editRow(scope.row)" v-if="String(scope.row.approvalStatus) !== '1'">&#xe689;</span>
  50. <span class="zoniot_font ashText" v-else>&#xe689;</span>
  51. </el-tooltip>
  52. </div>
  53. </template>
  54. </zz-table>
  55. </div>
  56. </template>
  57. <script>
  58. import list from '@utils/list.js';
  59. export default {
  60. mixins: [list],
  61. props: ['params'],
  62. data() {
  63. return {
  64. auditOptions: [
  65. { id: '', name: '全部' },
  66. { id: '0', name: '未审核' },
  67. { id: '1', name: '已审核' }
  68. ],
  69. cols: [
  70. {
  71. label: '所属社区',
  72. prop: 'communityName'
  73. },
  74. {
  75. label: '地址',
  76. prop: 'location'
  77. },
  78. {
  79. label: '设备编号',
  80. prop: 'deviceNo'
  81. },
  82. {
  83. label: '用途',
  84. prop: 'useType',
  85. format(val, data) {
  86. return val == 1 ? '房间表' : '公摊表';
  87. }
  88. },
  89. {
  90. label: '计量周期',
  91. prop: 'settletimeRange',
  92. slot: 'settletimeRange',
  93. width: 300
  94. },
  95. {
  96. label: '上期读数',
  97. prop: 'lastReading'
  98. },
  99. {
  100. label: '本期读数',
  101. prop: 'currentReading'
  102. },
  103. {
  104. label: '用水量(吨)',
  105. prop: 'waterConsumption'
  106. },
  107. {
  108. label: '审核状态',
  109. prop: 'approvalStatus',
  110. format(val) {
  111. return String(val) == '1' ? '已审核' : '未审核';
  112. }
  113. },
  114. {
  115. label: '操作',
  116. slot: 'opt'
  117. }
  118. ],
  119. mixins_post: 'post',
  120. isfocus: false
  121. };
  122. },
  123. methods: {
  124. mixinsxxx() {
  125. console.log(this.mixins_query);
  126. },
  127. timeformat(val) {
  128. return this.$moment(val).format('YYYY-MM-DD HH:mm:ss');
  129. },
  130. // 多选框勾选事件
  131. selectionChange(val) {
  132. this.selectRow = val;
  133. },
  134. // 批量
  135. auditSelect() {
  136. if (!this.selectRow || !this.selectRow.length) {
  137. this.$message.error('请选择要审核的条目');
  138. return;
  139. }
  140. let ids = [];
  141. this.selectRow.forEach((v) => {
  142. ids.push({
  143. id: v.id,
  144. planId: this.params.id
  145. });
  146. });
  147. const title = '审核';
  148. let msg = '确认批量审核以上勾选的水表';
  149. this.__confirm(msg, title)
  150. .then((_) => {
  151. this.$http
  152. .post('/sc-energy/measurementRecord/audit', ids)
  153. .then(({ status, data, msg }) => {
  154. if (0 == status) {
  155. this.$message.success(msg);
  156. this.mixins_search();
  157. } else {
  158. this.$message.error(msg);
  159. }
  160. })
  161. .catch((err) => {});
  162. })
  163. .catch((_) => {});
  164. },
  165. //全部
  166. allAudit() {
  167. const title = '审核全部水表';
  168. let msg = '确认审核全部水表?';
  169. this.__confirm(msg, title)
  170. .then((_) => {
  171. console.log(this.params);
  172. this.$http
  173. .postForm('/sc-energy/measurementRecord/auditAll', { planId: this.params.id })
  174. .then(({ status, data, msg }) => {
  175. if (0 == status) {
  176. this.$message.success(msg);
  177. this.mixins_search();
  178. } else {
  179. this.$message.error(msg);
  180. }
  181. })
  182. .catch((err) => {});
  183. })
  184. .catch((_) => {});
  185. },
  186. editRow(data = {}) {
  187. new Promise((resolve) => {
  188. this.$store.dispatch('addPopup', {
  189. url: '/settlementAudit/popups/editWaterUsg',
  190. width: '520px',
  191. height: '200px',
  192. props: {
  193. data,
  194. type: this.params.type,
  195. callback: resolve
  196. },
  197. title: this.params.type == 1 ? '修改水量' : '修改电量'
  198. });
  199. }).then(() => {
  200. this.mixins_search();
  201. });
  202. }
  203. },
  204. created() {
  205. this.mixins_dataUrl = '/sc-energy/measurementRecord/page';
  206. this.mixins_query = {
  207. planId: this.params.id,
  208. lastReading: null,
  209. currentReading: null,
  210. status: ''
  211. };
  212. if (this.params.type == 2) {
  213. this.cols[7].label = '用电量(度)';
  214. }
  215. this.mixins_search();
  216. },
  217. mounted() {}
  218. };
  219. </script>