index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <div class="content main">
  3. <organ-tree @organId="currentOrganId" v-if="!ownerStatus"></organ-tree>
  4. <div class="content-right" v-if="!ownerStatus">
  5. <div class="search">
  6. <el-input
  7. clearable
  8. placeholder="输入姓名或身份证号"
  9. class="search-input"
  10. v-trim
  11. v-model.trim="mixins_query.name"
  12. ></el-input>
  13. <el-select v-model="mixins_query.householdType" clearable placeholder="住户类型">
  14. <el-option v-for="(item, index) in householdType" :key="index" :label="item.label" :value="item.status">{{
  15. item.label
  16. }}</el-option>
  17. </el-select>
  18. <el-select v-model="mixins_query.residentStatus" clearable placeholder="住户状态">
  19. <el-option v-for="(item, index) in residentStatus" :key="index" :label="item.label" :value="item.status">{{
  20. item.label
  21. }}</el-option>
  22. </el-select>
  23. <el-button
  24. class="search-btn"
  25. type="primary"
  26. @click="mixins_search()"
  27. :disabled="mixins_onQuery"
  28. :loading="mixins_onQuery"
  29. icon="el-icon-search"
  30. >搜索</el-button
  31. >
  32. <div class="search-icon">
  33. <template>
  34. <el-dropdown type="primary" @command="addCommand">
  35. <span class="iconfont">&#xe641;</span>
  36. <el-dropdown-menu slot="dropdown" hide-on-click="false" class="device-search-dropdown">
  37. <el-dropdown-item command="add">单个添加</el-dropdown-item>
  38. <el-dropdown-item command="batchAdd">
  39. <div class="upload_div">
  40. <xk-upload class="upload_class" @callback="mixins_search" :params="{ importType: 'RESIDENT' }">
  41. <span slot="content">批量添加</span>
  42. </xk-upload>
  43. </div>
  44. </el-dropdown-item>
  45. <el-dropdown-item command="template">下载模板</el-dropdown-item>
  46. </el-dropdown-menu>
  47. </el-dropdown>
  48. </template>
  49. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  50. <i class="iconfont" @click="deluserbyidsFn">&#xe63b;</i>
  51. </el-tooltip>
  52. <el-tooltip class="item" effect="light" placement="bottom" content="导出">
  53. <i class="zoniot_font zoniot-icon-daochu2" @click="exportExcel"></i>
  54. </el-tooltip>
  55. </div>
  56. </div>
  57. <zz-table
  58. :settings="{ showCheckbox: true, showIndex: true, stripe: true }"
  59. :cols="cols"
  60. :loading="mixins_onQuery"
  61. :data="mixins_list"
  62. :pageset="mixins_pageset"
  63. @page-change="pageChange"
  64. @selection-change="selectionChange"
  65. >
  66. <template slot-scope="scope" slot="transactionsNumber">
  67. <span v-if="scope.row.transactionsNumber" class="el-link" @click="toTransactionDetails(scope.row)">{{
  68. scope.row.transactionsNumber
  69. }}</span>
  70. <span v-else>{{ scope.row.transactionsNumber }}</span>
  71. </template>
  72. <template slot-scope="scope" slot="opt">
  73. <div class="opt">
  74. <el-tooltip class="item" effect="light" placement="bottom" content="编辑">
  75. <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.row)"></i>
  76. </el-tooltip>
  77. <el-tooltip
  78. class="item"
  79. effect="light"
  80. placement="bottom"
  81. :content="scope.row.residentStatus === 1 ? '注销' : '启用'"
  82. >
  83. <i
  84. class="zoniot_font zoniot-icon-zhuxiao"
  85. @click="cancellation(scope.row)"
  86. :class="scope.row.residentStatus === 1 ? 'redText' : 'greenText'"
  87. ></i>
  88. </el-tooltip>
  89. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  90. <i class="zoniot_font zoniot-icon-shanchu redText" @click="deleteRow(scope.row)"></i>
  91. </el-tooltip>
  92. <el-tooltip class="item" effect="light" placement="bottom" content="查看">
  93. <i class="zoniot_font zoniot-icon-xiangqing" @click="lookPage(scope.row)"></i>
  94. </el-tooltip>
  95. </div>
  96. </template>
  97. </zz-table>
  98. </div>
  99. <add-owner v-else :params="activeData" @clerOwnerStatus="clerOwnerStatus" :isAdd="isAdd"></add-owner>
  100. </div>
  101. </template>
  102. <script>
  103. import list from '@/js/list.js';
  104. import addOwner from './stepPage/add.vue';
  105. export default {
  106. mixins: [list],
  107. components: { addOwner },
  108. data() {
  109. return {
  110. ownerStatus: '',
  111. statusOptions: [],
  112. currentId: '',
  113. cols: [
  114. {
  115. label: '姓名',
  116. prop: 'name'
  117. },
  118. {
  119. label: '住户类型',
  120. prop: 'householdType',
  121. format(val) {
  122. if (val == 1) {
  123. return '业主';
  124. } else if (val == 2) {
  125. return '亲属';
  126. } else if (val == 3) {
  127. return '租客';
  128. }
  129. }
  130. },
  131. {
  132. label: '社区名称',
  133. prop: 'communityName'
  134. },
  135. {
  136. label: '房屋地址',
  137. prop: 'roomNumber'
  138. },
  139. {
  140. label: '手机号',
  141. prop: 'phone'
  142. },
  143. {
  144. label: '身份证号',
  145. prop: 'idNumber'
  146. },
  147. {
  148. label: '状态',
  149. prop: 'residentStatus',
  150. format(val) {
  151. if (val == 1) {
  152. return '在住';
  153. } else {
  154. return '已注销';
  155. }
  156. }
  157. },
  158. {
  159. label: '入住时间',
  160. prop: 'checkInDate'
  161. },
  162. {
  163. label: '操作',
  164. prop: 'id',
  165. slot: 'opt',
  166. width: '200'
  167. }
  168. ],
  169. householdType: [
  170. {
  171. status: 1,
  172. label: '业主'
  173. },
  174. {
  175. status: 2,
  176. label: '亲属'
  177. },
  178. {
  179. status: 3,
  180. label: '租客'
  181. }
  182. ],
  183. residentStatus: [
  184. {
  185. status: 0,
  186. label: '已注销'
  187. },
  188. {
  189. status: 1,
  190. label: '在住'
  191. }
  192. ],
  193. activeData: {},
  194. isAdd: true,
  195. selectRow: []
  196. };
  197. },
  198. methods: {
  199. toTransactionDetails(row) {
  200. const { id, type } = row;
  201. this.$router.push({
  202. name: 'main',
  203. query: {
  204. url: '/BillingManage/FinancialManage/ReconciliationManage/TransactionDetails',
  205. agentbranchId: id,
  206. payType: type,
  207. prevName: '支付管理'
  208. }
  209. });
  210. },
  211. clerOwnerStatus() {
  212. this.ownerStatus = '';
  213. this.activeData = {};
  214. this.isAdd = true;
  215. this.mixins_search();
  216. },
  217. addOrEdit(todo, row) {
  218. if (todo == 'edit') {
  219. this.activeData = row;
  220. this.isAdd = false;
  221. }
  222. this.ownerStatus = todo;
  223. },
  224. deleteRow(row) {
  225. const { name } = row;
  226. let title = `您确定要删除住户“${name}”`;
  227. this.$msgBox(title)
  228. .then(() => {
  229. this.$http
  230. .postForm('/scResident/delete', { id: row.id })
  231. .then(({ status, msg }) => {
  232. this.$delete(row, 'onDelete');
  233. if (0 === status) {
  234. this.$message.success(msg);
  235. this.mixins_search('del');
  236. } else {
  237. this.$message.error(msg);
  238. }
  239. })
  240. .catch(() => {
  241. this.$delete(row, 'onDelete');
  242. });
  243. })
  244. .catch(() => {});
  245. },
  246. lookPage(row) {
  247. this.$router.push({
  248. path: '/ownerManagement/details',
  249. query: {
  250. id: row.id
  251. }
  252. });
  253. },
  254. cancellation(row) {
  255. const { name } = row;
  256. let status = 0;
  257. if (row.residentStatus === 0) {
  258. status = 1;
  259. }
  260. let title = `您确定要修改状态住户“${name}”`;
  261. this.$msgBox('确认提示', title)
  262. .then(() => {
  263. this.$http
  264. .postForm('/scResident/operationResident', { type: status, id: row.id })
  265. .then(({ status, msg }) => {
  266. if (0 === status) {
  267. this.$message.success(msg);
  268. this.mixins_search('del');
  269. } else {
  270. this.$message.error(msg);
  271. }
  272. })
  273. .catch(() => {});
  274. })
  275. .catch(() => {});
  276. },
  277. currentOrganId(data) {
  278. this.currentId = data || '';
  279. },
  280. selectionChange(val) {
  281. this.selectRow = val;
  282. },
  283. deluserbyidsFn() {
  284. //获取选中列表的ids
  285. let ids = [];
  286. if (!this.selectRow.length) {
  287. this.$message.error('您尚未选择要删除的记录,请选择后再操作批量删除');
  288. return;
  289. }
  290. this.selectRow.forEach((v) => {
  291. ids.push(v.id);
  292. });
  293. this.$msgBox(`删除`, '删除后将无法恢复,请问是否继续?')
  294. .then(() => {
  295. this.$http.post('/scResident/batchDelete', ids).then(({ status, data, msg }) => {
  296. if (0 === status) {
  297. this.$message({
  298. type: 'success',
  299. message: '删除成功!'
  300. });
  301. this.mixins_search();
  302. }
  303. });
  304. })
  305. .catch(() => {});
  306. },
  307. addCommand(command) {
  308. if (command === 'add') {
  309. this.addOrEdit('add');
  310. return;
  311. }
  312. if (command === 'template') {
  313. this.__exportExcel('/scResident/downTemplate');
  314. return;
  315. }
  316. },
  317. exportExcel() {
  318. this.__exportExcel('/scResident/getDataExcel', this.mixins_query);
  319. }
  320. },
  321. watch: {
  322. currentId(newValue, oldValue) {
  323. this.mixins_query.communityId = '';
  324. this.mixins_query.buildingId = '';
  325. this.mixins_query.unitName = '';
  326. this.mixins_query.roomNumber = '';
  327. if (newValue.type) {
  328. if (newValue.type === 'community') {
  329. this.mixins_query.communityId = newValue.value;
  330. } else if (newValue.type === 'building') {
  331. this.mixins_query.buildingId = newValue.value;
  332. } else if (newValue.type === 'unit') {
  333. this.mixins_query.buildingId = newValue.parentValue;
  334. this.mixins_query.unitName = newValue.value;
  335. } else if (newValue.type === 'room') {
  336. this.mixins_query.roomNumber = newValue.value;
  337. }
  338. }
  339. this.mixins_search();
  340. }
  341. },
  342. created() {
  343. this.mix_path = ''; // 权限
  344. this.mixins_dataUrl = '/scResident/page'; // 分页查询接口
  345. this.mixins_query = {
  346. questParams: ''
  347. };
  348. this.mixins_search('search');
  349. }
  350. };
  351. </script>
  352. <style lang='scss' scoped >
  353. @import './style.scss';
  354. </style>