index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <div>
  3. <div class="custom-tree-container">
  4. <div class="block-l">
  5. <el-card shadow="hover">
  6. <el-tag class="full space-vertical">当前所选:{{ selectDeptNode.name }}</el-tag>
  7. <!-- @node-click="handleDeptNodeClick" -->
  8. <el-tree
  9. ref="selectTree"
  10. default-expand-all
  11. :data="DeptTree"
  12. node-key="id"
  13. :indent="deptTreeIndent"
  14. accordion
  15. :expand-on-click-node="expandDeptClick"
  16. :default-expanded-keys="expandedDeptKey"
  17. >
  18. <span slot-scope="{ node, data }" class="custom-tree-node">
  19. <span>
  20. <i v-if="data.level == 0" class="el-icon-s-home" />
  21. <i v-else-if="data.level == 1" class="el-icon-menu" />
  22. <i v-else class="el-icon-link" />
  23. {{ node.label }}
  24. </span>
  25. <span v-if="data.level == 0">
  26. <el-link class="space" type="primary" @click="() => unFoldAll()">展开</el-link>
  27. <el-link class="space" type="primary" @click="() => collapseAll()">折叠</el-link>
  28. </span>
  29. </span>
  30. </el-tree>
  31. </el-card>
  32. </div>
  33. <div class="block-r">
  34. <el-row class="handle-box" style="margin-bottom: 10px">
  35. <el-col :span="24">
  36. <el-input v-model="queryParam.groupName" size="small" placeholder="园区名称" class="ch-input-size" @keyup.enter.native="handleSearch()" />
  37. <el-button size="small" class="ch-button" style="float: right; margin-right: 10px; margin-top: 4px" @click="handleAddWY()"><i class="el-icon-menu" />&nbsp;物业团队绑定</el-button>
  38. <el-button size="small" class="ch-button" style="float: right; margin-right: 10px; margin-top: 4px" @click="handleAddYY()"><i class="el-icon-menu" />&nbsp;运营团队绑定</el-button>
  39. <el-button size="small" class="ch-button-add" style="float: right; margin-top: 4px" @click="handleAddLP()"><i class="el-icon-menu" />&nbsp;新增楼盘</el-button>
  40. <el-button size="small" class="ch-button-add" style="float: right; margin-top: 4px" @click="handleAdd()"><i class="el-icon-menu" />&nbsp;新增园区</el-button>
  41. <el-button size="small" class="ch-button" style="float: right;margin-top: 4px" @click="handleSearch()"><i class="el-icon-menu" />&nbsp;查询</el-button>
  42. <el-button size="small" class="ch-button-warning" style="float: right;margin-top: 4px" @click="handleReset()"><i class="el-icon-menu" />&nbsp;重置</el-button>
  43. </el-col>
  44. </el-row>
  45. <el-row class="handle-box">
  46. <el-col :span="24">
  47. <el-table ref="singleTable" v-loading="loading" :data="AllData" highlight-current-row @current-change="handleRowSelectChange">
  48. <el-table-column label="编号" type="index" width="60" />
  49. <el-table-column label="园区名称" prop="groupName" />
  50. <!-- <el-table-column label="类型" prop="parkType" /> -->
  51. <el-table-column label="类型">
  52. <template scope="scope">
  53. {{ scope.row.parkType == 1 ? "商铺": scope.row.parkType == 2 ? "写字楼":"场地" }}
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="面积(㎡)" prop="size" />
  57. <!-- <el-table-column label="楼盘" prop="discName" /> -->
  58. <el-table-column label="楼盘" header-align="center" width="160">
  59. <template scope="scope">
  60. {{ tableLouDetial(scope.row.id) }}
  61. </template>
  62. </el-table-column>
  63. <!-- <el-table-column label="对应运营人员" prop="size" header-align="center" align="center" width="80" />-->
  64. <!-- <el-table-column label="对应物业人员" prop="size" header-align="center" align="center" width="80" />-->
  65. <el-table-column label="操作" header-align="center" width="160">
  66. <template scope="scope">
  67. <el-button size="mini" type="primary" @click="handleEdit(scope.row)" class="editButton">编辑</el-button>
  68. <el-button v-if="scope.row.id != '1'" size="mini" type="info" @click="handleDel(scope.row)" class="deleButton">删除</el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <div class="table-page">
  73. <el-pagination
  74. :current-page.sync="currentPage"
  75. :page-size="pageSize"
  76. background
  77. layout="total, prev, pager, next"
  78. :total="allpage"
  79. @size-change="handleSizeChange"
  80. @current-change="handleCurrentChange"
  81. />
  82. </div>
  83. </el-col>
  84. </el-row>
  85. </div>
  86. </div>
  87. <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" :model="groupfrom" width="950px" top="50px">
  88. <el-form ref="commitForm" style="width: 100%;padding: 5px" :rules="commitRules">
  89. <el-row>
  90. <el-col style="padding-bottom: 10px">
  91. <span class="card_title">基本信息</span>
  92. <el-card shadow="always" style="padding-top: 10px">
  93. <el-row>
  94. <el-col :span="4" class="col-txt"><span>园区名称</span></el-col>
  95. <el-col :span="20" class="col-input">
  96. <el-form-item>
  97. <el-input v-model="groupfrom.groupName" style="width: 95%;" />
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="4" class="col-txt"><span>面积(㎡)</span></el-col>
  103. <el-col :span="7" class="col-input">
  104. <el-form-item prop="size">
  105. <el-input v-model="groupfrom.size" />
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="4" class="col-txt"><span>类型</span></el-col>
  109. <el-col :span="8" class="col-input">
  110. <el-form-item>
  111. <el-select v-model="groupfrom.parkType" placeholder="" filterable>
  112. <el-option
  113. v-for="item in dc_data.parkType"
  114. :key="item.value"
  115. :label="item.label"
  116. :value="item.value"
  117. />
  118. </el-select>
  119. </el-form-item>
  120. </el-col>
  121. </el-row>
  122. <el-row>
  123. <el-col :span="4" class="col-txt"><span>详细地址</span></el-col>
  124. <el-col :span="20" class="col-input">
  125. <el-form-item>
  126. <el-input v-model="groupfrom.address" style="width: 95%;" type="textarea" :autosize="{ minRows: 2, maxRows: 100}" placeholder="请输入内容" />
  127. </el-form-item>
  128. </el-col>
  129. </el-row>
  130. </el-card>
  131. </el-col>
  132. </el-row>
  133. </el-form>
  134. <div slot="footer">
  135. <el-button @click="dialogVisible = false">取 消</el-button>
  136. <el-button type="primary" @click="confirmSubmit()">确 定</el-button>
  137. </div>
  138. </el-dialog>
  139. <el-dialog :title="dialogTitle" :visible.sync="dialogVisibleLP" width="950px" top="50px" append-to-body>
  140. <el-form ref="commitForm" :model="formLP" style="width: 100%;padding: 5px" :rules="commitRules">
  141. <el-row>
  142. <el-col style="padding-bottom: 10px">
  143. <span class="card_title">基本信息</span>
  144. <el-card shadow="always" style="padding-top: 10px">
  145. <el-row>
  146. <el-col :span="4" class="col-txt"><span>园区名称</span></el-col>
  147. <el-col :span="20" class="col-input">
  148. <el-form-item>
  149. <el-select v-model="formLP.groupId" placeholder="" filterable>
  150. <el-option
  151. v-for="item in groupList"
  152. :key="item.id"
  153. :label="item.groupName"
  154. :value="item.id"
  155. />
  156. </el-select>
  157. </el-form-item>
  158. </el-col>
  159. </el-row>
  160. <el-row>
  161. <el-col :span="4" class="col-txt"><span>楼盘名称</span></el-col>
  162. <el-col :span="20" class="col-input">
  163. <el-form-item>
  164. <el-input v-model="formLP.name" style="width: 95%;" />
  165. </el-form-item>
  166. </el-col>
  167. </el-row>
  168. </el-card>
  169. </el-col>
  170. </el-row>
  171. </el-form>
  172. <div slot="footer">
  173. <el-button @click="dialogVisibleLP = false">取 消</el-button>
  174. <el-button type="primary" @click="confirmLPSubmit()">确 定</el-button>
  175. </div>
  176. </el-dialog>
  177. </div>
  178. </template>
  179. <script>
  180. import Base from '@/views/base/base'
  181. import BaseData from '@/views/base/baseData'
  182. import BaseDept from '@/views/base/baseDept'
  183. import Constant from '@/static/utils/constant'
  184. import common from '@/static/utils/common'
  185. export default {
  186. name: 'User',
  187. mixins: [Base, BaseData, BaseDept],
  188. data() {
  189. return {
  190. dc_key: ['parkType'],
  191. // 查询参数
  192. queryParam: {
  193. groupName: ''
  194. },
  195. louDetial: {},
  196. formLP: {},
  197. groupfrom: {},
  198. groupList: [],
  199. DeptTree: [],
  200. typeList: [
  201. {
  202. lable: '商铺',
  203. value: 1
  204. },
  205. {
  206. lable: '写字楼',
  207. value: 2
  208. },
  209. {
  210. lable: '场地',
  211. value: 3
  212. }
  213. ],
  214. // 字典项
  215. dc_gender: [],
  216. dc_map: {},
  217. // 列表相关
  218. username: '',
  219. truename: '',
  220. dataRoleId: '',
  221. postId: '',
  222. AllData: [],
  223. loading: false,
  224. currentRow: null,
  225. isAdminSelect: false,
  226. isGroupUser: false,
  227. // 用户维护相关
  228. dialogVisible: false,
  229. dialogVisibleLP: false,
  230. dialogTitle: '新增用户',
  231. isAdd: true,
  232. selectDepartment: [],
  233. form: this.getBaseForm(),
  234. LeaderData: [],
  235. commitRules: {
  236. size: [{ required: true, trigger: 'change', message: '请输入面积' }]
  237. },
  238. // 角色维护相关
  239. dialogRoleVisible: false,
  240. dialogRoleTitle: '角色选择',
  241. selectUserId: '',
  242. selectUserName: '',
  243. SelectMenuRole: [],
  244. SelectDataRoleId: '',
  245. MenuRole: [],
  246. RawUserData: [],
  247. selectedIds: [],
  248. }
  249. },
  250. mounted() {
  251. this.getTreeData()
  252. this.getGroupList()
  253. this.initDict(this.dc_key).then((res) => {
  254. this.getList()
  255. })
  256. },
  257. methods: {
  258. handleSearch: function() {
  259. this.getList()
  260. },
  261. handleReset: function() {
  262. this.queryParam = {}
  263. this.getList()
  264. },
  265. getGroupList: function() {
  266. this.baseRequest('listAll', {}).then((res) => {
  267. if (res.data) {
  268. this.groupList = res.data
  269. }
  270. _this.loading = false
  271. }).catch(() => {
  272. })
  273. },
  274. getTreeData: function() {
  275. this.baseRequest('getTreeData3', {}).then((res) => {
  276. this.DeptTree = res.data.data
  277. }).catch(() => {
  278. })
  279. },
  280. getList: function() {
  281. const _this = this
  282. _this.queryParam.pageNum = _this.currentPage
  283. _this.queryParam.pageSize = _this.pageSize
  284. _this.baseRequest('list', _this.queryParam).then((res) => {
  285. // console.log("列表——:", res)
  286. if (res.data.rows) {
  287. _this.AllData = []
  288. _this.AllData = res.data.rows
  289. // res.data.rows.forEach(function(item) {
  290. // console.log("~~~~~~~~~~~~:", item);
  291. // _this.$set(item, "discName" , _this.getlouDetial(item.id))
  292. // console.log("~~~~~~~~~~~~:", item);
  293. // _this.AllData.push(item)
  294. // })
  295. _this.allpage = res.data.total
  296. this.getlouDetial()
  297. }
  298. _this.loading = false
  299. }).catch(() => {
  300. })
  301. },
  302. handleAdd: function() {
  303. this.dialogVisible = true
  304. this.dialogTitle = '新增园区'
  305. },
  306. handleEdit: function(val) {
  307. this.groupfrom = val
  308. this.dialogVisible = true
  309. this.dialogTitle = '编辑园区'
  310. },
  311. handleAddLP: function() {
  312. this.dialogVisibleLP = true
  313. this.dialogTitle = '新增楼盘'
  314. },
  315. confirmSubmit: function() {
  316. this.$refs.groupfrom.validate(valid => {
  317. if (valid) {
  318. this.baseRequest('addModel', this.groupfrom).then((res) => {
  319. if (res.data.code == 200) {
  320. this.dialogVisible = false
  321. this.groupfrom = {}
  322. this.getList()
  323. this.getTreeData()
  324. alert('提交成功')
  325. }
  326. }).catch(() => {
  327. })
  328. }else {
  329. return false
  330. }
  331. })
  332. },
  333. confirmLPSubmit: function() {
  334. this.baseLPRequest('add', this.formLP).then((res) => {
  335. if (res.data.code == 200) {
  336. this.dialogVisibleLP = false
  337. this.getList()
  338. this.getTreeData()
  339. alert('提交成功')
  340. }
  341. }).catch(() => {
  342. })
  343. },
  344. // 获取楼盘信息
  345. getlouDetial: function() {
  346. let ids = ''
  347. this.AllData.forEach(element => {
  348. ids += element.id + ','
  349. })
  350. if (ids != '') {
  351. ids = ids.substr(0, ids.length - 1)
  352. }
  353. const reqData = {
  354. ids: ids
  355. }
  356. this.baseRequest('getlouDetial', reqData).then((res) => {
  357. // this.loading = true;
  358. this.louDetial = res.data.data
  359. // this.loading = false;
  360. }).catch(() => {
  361. })
  362. },
  363. tableLouDetial(id) {
  364. return this.louDetial[id]
  365. },
  366. getItemJson: function(item) {
  367. const posts = item.posts ? item.posts.split(',') : []
  368. if (posts.length > 0) {
  369. const postStr = []
  370. posts.forEach(post => {
  371. postStr.push(this.PostMap[post])
  372. })
  373. item.postStr = postStr.join(',')
  374. }
  375. item.dataRoleStr = this.DataRoleMap[item.dataRole]
  376. item.statusStr = item.status === '0' ? '禁用' : '启用'
  377. item.department = item.department ? this.DeptMap[item.department] : ''
  378. item.loginAt = common.transDate(item.loginAt, Constant.DATE_PATTERN.DATE_TIME_s_h)
  379. return item
  380. },
  381. handleRowSelectChange(val) {
  382. this.currentRow = val
  383. if (this.currentRow) {
  384. if (this.currentRow.id === '1') {
  385. this.isAdminSelect = true
  386. } else {
  387. this.isAdminSelect = false
  388. }
  389. }
  390. },
  391. getBaseForm: function() {
  392. const baseForm = {
  393. id: '',
  394. groupId: '',
  395. username: '',
  396. password: null,
  397. truename: '',
  398. leader: '',
  399. department: [],
  400. posts: [],
  401. gender: '',
  402. phone: '',
  403. sequenceNo: '',
  404. secretKey: '',
  405. comment: ''
  406. }
  407. if (this.$common.currUser().groupId) {
  408. baseForm.groupId = this.$common.currUser().groupId
  409. }
  410. return baseForm
  411. },
  412. // 字典项
  413. generateDcMap: function() {
  414. this.dc_map['dc_gender'] = this.$common.transDcMap(this.dc_gender)
  415. },
  416. // 请求封装,继承类中调用,必须存在
  417. baseRequest: function(opUrl, postData) {
  418. return this.$channel.baseRequest('ParkInfoController', opUrl, postData, 'User')
  419. },
  420. baseLPRequest: function(opUrl, postData) {
  421. return this.$channel.baseRequest('ParkFloorDiscController', opUrl, postData, 'User')
  422. },
  423. postRequest: function(opUrl, postData) {
  424. return this.$channel.baseRequest('PostController', opUrl, postData, 'Post')
  425. },
  426. handleDeptNodeClick(data) {
  427. // console.log("@@@@@@@@@@@@@@@@@@", data);
  428. }
  429. }
  430. }
  431. </script>
  432. <style scoped>
  433. .custom-tree-node {
  434. flex: 1;
  435. display: flex;
  436. align-items: center;
  437. justify-content: space-between;
  438. font-size: 16px;
  439. padding-right: 8px;
  440. }
  441. .custom-tree-container{
  442. display: flex;
  443. }
  444. .custom-tree-container .block-l {
  445. /*flex-grow: 2 ;*/
  446. //float: left;
  447. width: 20%;
  448. padding: 0 8px 0 0;
  449. }
  450. .custom-tree-container .block-r {
  451. /*flex-grow: 10;*/
  452. //float: left;
  453. width: 80%;
  454. /*padding: 0 0 0 8px;*/
  455. }
  456. </style>
  457. <style scoped>
  458. .ch-input .el-input__inner {
  459. border-color: #32323A;
  460. }
  461. .ch-input-size {
  462. width: 150px;
  463. }
  464. .ch-button {
  465. border-color: #32323A;
  466. background-color: #32323A;
  467. color: #fff;
  468. }
  469. .ch-button-warning {
  470. margin-left: 10px;
  471. border-color: #E6A23C;
  472. background-color: #E6A23C;
  473. color: #fff;
  474. }
  475. .ch-button-export {
  476. margin-left: 10px;
  477. border-color: #98CC1F;
  478. background-color: #98CC1F;
  479. color: #fff;
  480. }
  481. </style>