index.vue 18 KB

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