index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="content">
  3. <building-tree @buildingInformation="buildingInformation" :buildingType="2"></building-tree>
  4. <div class="content-right">
  5. <div class="search">
  6. <el-input clearable placeholder="房屋号" class="search-input" v-trim v-model="mixins_query.roomNumber"></el-input>
  7. <el-select v-model="mixins_query.useStatus" clearable placeholder="请选择社区名称">
  8. <el-option v-for="item in statusOptions" :label="item.label" :value="item.val" :key="item">{{ item.label }}</el-option>
  9. </el-select>
  10. <el-button
  11. class="search-btn"
  12. type="primary"
  13. @click="mixins_search"
  14. :disabled="mixins_onQuery"
  15. :loading="mixins_onQuery"
  16. icon="el-icon-search"
  17. >搜索
  18. </el-button>
  19. <div class="search-icon">
  20. <template>
  21. <el-dropdown type="primary" @command="addCommand">
  22. <span class="iconfont">&#xe641;</span>
  23. <el-dropdown-menu slot="dropdown" hide-on-click="false" class="device-search-dropdown">
  24. <el-dropdown-item command="add">单个添加</el-dropdown-item>
  25. <el-dropdown-item command="batchAdd">
  26. <div class="upload_div">
  27. <xk-upload class="upload_class" @callback="mixins_search" :params="{ importType: 'HOUSE' }">
  28. <span class="upload_text" slot="content">批量添加</span>
  29. </xk-upload>
  30. </div>
  31. </el-dropdown-item>
  32. <el-dropdown-item command="template">下载模板</el-dropdown-item>
  33. </el-dropdown-menu>
  34. </el-dropdown>
  35. </template>
  36. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  37. <i class="iconfont" @click="deluserbyidsFn">&#xe63b;</i>
  38. </el-tooltip>
  39. <el-tooltip class="item" effect="light" placement="bottom" content="导出">
  40. <i class="zoniot_font zoniot-icon-daochu2" @click="exportExcel()"></i>
  41. </el-tooltip>
  42. </div>
  43. </div>
  44. <zz-table
  45. :settings="{ showCheckbox: true, showIndex: true, stripe: true }"
  46. :cols="cols"
  47. :loading="mixins_onQuery"
  48. :data="mixins_list"
  49. :pageset="mixins_pageset"
  50. @page-change="pageChange"
  51. @selection-change="selectionChange"
  52. >
  53. <template slot-scope="scope" slot="useStatus">
  54. <span v-if="scope.row.useStatus == 0">空置</span>
  55. <span v-if="scope.row.useStatus == 1">居住</span>
  56. </template>
  57. <template slot-scope="scope" slot="opt" class="opt">
  58. <div class="opt">
  59. <el-tooltip effect="light" placement="bottom" content="编辑">
  60. <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.row)"></i>
  61. </el-tooltip>
  62. <el-tooltip effect="light" placement="bottom" content="删除">
  63. <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteRow(scope.row)"></i>
  64. </el-tooltip>
  65. <el-tooltip class="item" effect="light" placement="bottom" content="查看">
  66. <i class="zoniot_font zoniot-icon-xiangqing" @click="lookPage(scope.row)"></i>
  67. </el-tooltip>
  68. </div>
  69. </template>
  70. </zz-table>
  71. </div>
  72. <!-- <save-edits v-else :params="activeData" @clerOwnerStatus="clerOwnerStatus" :isAdd="isAdd"></save-edits> -->
  73. </div>
  74. </template>
  75. <script>
  76. import list from '@utils/list.js';
  77. import saveEdits from './saveEdits.vue';
  78. export default {
  79. mixins: [list],
  80. data() {
  81. return {
  82. statusOptions: [
  83. { label: '空置', val: 0 },
  84. { label: '居住', val: 1 }
  85. ],
  86. cols: [
  87. {
  88. label: '所属社区',
  89. prop: 'communityName',
  90. width: 120
  91. },
  92. {
  93. label: '楼栋名称',
  94. prop: 'buildingName'
  95. },
  96. {
  97. label: '单元',
  98. prop: 'unitName'
  99. },
  100. {
  101. label: '房屋号',
  102. prop: 'roomNumber'
  103. },
  104. {
  105. label: '建筑面积',
  106. prop: 'buildingArea',
  107. format(val) {
  108. if (!!val) {
  109. return val + '㎡';
  110. } else {
  111. return '--';
  112. }
  113. }
  114. },
  115. {
  116. label: '使用面积',
  117. prop: 'useArea',
  118. format(val) {
  119. if (!!val) {
  120. return val + '㎡';
  121. } else {
  122. return '--';
  123. }
  124. }
  125. },
  126. {
  127. label: '房屋类型',
  128. prop: 'buildingType',
  129. format(val) {
  130. if (val == 1) {
  131. return '住宅';
  132. } else if (val == 2) {
  133. return '商用';
  134. } else {
  135. return '--';
  136. }
  137. }
  138. },
  139. {
  140. label: '使用状态',
  141. slot: 'useStatus'
  142. },
  143. {
  144. label: '操作',
  145. slot: 'opt',
  146. width: 150
  147. }
  148. ],
  149. showaddDialog: '',
  150. selectRow: [],
  151. mixins_post: 'post',
  152. isAdd: true,
  153. activeData: {}
  154. };
  155. },
  156. components: {
  157. saveEdits
  158. },
  159. methods: {
  160. lookPage(row) {
  161. this.$router.push({
  162. path: '/shopManagement/details',
  163. query: {
  164. id: row.id
  165. }
  166. });
  167. },
  168. addCommand(command) {
  169. if (command === 'add') {
  170. this.addOrEdit('add');
  171. }
  172. if (command === 'template') {
  173. this.__exportExcel('/sc-community/excel/download/template', { importType: 'HOUSE' });
  174. return;
  175. }
  176. },
  177. clerOwnerStatus() {
  178. this.showaddDialog = '';
  179. this.activeData = {};
  180. this.isAdd = true;
  181. this.mixins_search();
  182. },
  183. addOrEdit(todo, data = {}) {
  184. new Promise((resolve) => {
  185. let title = '新增商铺';
  186. if (todo !== 'add') {
  187. title = '修改商铺';
  188. }
  189. this.$store.dispatch('addPopup', {
  190. url: '/assetManagement/shopManagement/saveEdits.vue',
  191. width: '850px',
  192. height: '500px',
  193. props: {
  194. data,
  195. todo,
  196. productOptions: this.productOptions,
  197. callback: resolve
  198. },
  199. title: title
  200. });
  201. }).then(() => {
  202. this.mixins_search();
  203. });
  204. // addPopup;
  205. // if (todo == 'edit') {
  206. // this.activeData = row;
  207. // this.isAdd = false;
  208. // }
  209. // this.showaddDialog = todo;
  210. },
  211. deleteRow(row) {
  212. const { communityName, buildingName, unitName, roomNumber } = row;
  213. let title = `您确定要删除“${communityName}${buildingName}${unitName}${roomNumber}”号房间`;
  214. this.$msgBox(title)
  215. .then(() => {
  216. this.$http
  217. .post('/sc-community/assets/house/delete', [row.id])
  218. .then(({ status, msg }) => {
  219. if (0 === status) {
  220. this.$message.success(msg);
  221. this.mixins_search();
  222. } else {
  223. this.$message.error(msg);
  224. }
  225. })
  226. .catch(() => {});
  227. })
  228. .catch(() => {});
  229. },
  230. selectionChange(val) {
  231. this.selectRow = val;
  232. },
  233. deluserbyidsFn() {
  234. //获取选中列表的ids
  235. let ids = [];
  236. if (!this.selectRow.length) {
  237. this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
  238. return;
  239. }
  240. this.selectRow.forEach((v) => {
  241. ids.push(v.id);
  242. });
  243. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  244. .then(() => {
  245. this.$http.post('/sc-community/assets/house/delete', ids).then(({ status, data, msg }) => {
  246. if (0 === status) {
  247. this.$message({
  248. type: 'success',
  249. message: '删除成功!'
  250. });
  251. this.mixins_search();
  252. } else {
  253. this.$message.error(msg);
  254. }
  255. });
  256. })
  257. .catch(() => {});
  258. },
  259. buildingInformation(data) {
  260. if (!!data.type && data.type == 'community') {
  261. this.mixins_query.communityId = data.val;
  262. } else {
  263. this.mixins_query.communityId = data.communityId;
  264. this.mixins_query.id = data.roomId;
  265. this.mixins_query.buildingId = data.buildingId;
  266. this.mixins_query.unitName = data.unitId;
  267. }
  268. this.mixins_search();
  269. },
  270. //导出
  271. exportExcel() {
  272. this.__exportExcel('/sc-community/assets/house/export/excel', this.mixins_query);
  273. },
  274. communityNameList() {
  275. this.$http.get('/sc-community/assets/community/list', {}).then((res) => {
  276. this.$store.commit('setCommunityArray', res.data);
  277. });
  278. }
  279. },
  280. created() {
  281. this.mixins_dataUrl = '/sc-community/assets/house/page'; // 分页查询接口
  282. this.mixins_query = {
  283. buildingType: 2
  284. };
  285. this.communityNameList();
  286. this.mixins_search('search');
  287. }
  288. };
  289. </script>
  290. <style lang="scss" scoped>
  291. .content {
  292. .content-right {
  293. width: calc(100% - 280px);
  294. float: right;
  295. }
  296. }
  297. </style>