您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

1217 行
38 KiB

  1. <template>
  2. <div class="box-center">
  3. <!-- 头 -->
  4. <div class="app-top">
  5. <div class="app-titel" style="margin-top: 10px">
  6. <!-- <div v-if="orgType != 0" class="div-lab">
  7. <div class="label">服务到期:</div>
  8. <div class="toptimeqhuan">
  9. <div
  10. :class="{ tophove: searchForm.residueTime == 7 }"
  11. @click="tabtimetap(7)"
  12. >
  13. 7天内
  14. </div>
  15. <div
  16. :class="{ tophove: searchForm.residueTime == 15 }"
  17. @click="tabtimetap(15)"
  18. >
  19. 15天内
  20. </div>
  21. <div
  22. :class="{ tophove: searchForm.residueTime == 30 }"
  23. @click="tabtimetap(30)"
  24. >
  25. 30天内
  26. </div>
  27. </div>
  28. </div>
  29. <div v-if="orgType == 0" class="div-lab">
  30. <div class="label">合同结束日期:</div>
  31. <el-date-picker
  32. v-model="starTime"
  33. class="div-inp"
  34. @change="timeChange1"
  35. type="daterange"
  36. range-separator="-"
  37. :default-time="['00:00:00', '23:59:59']"
  38. value-format="yyyy-MM-dd"
  39. start-placeholder="开始日期"
  40. end-placeholder="结束日期"
  41. >
  42. </el-date-picker>
  43. </div> -->
  44. <div class="div-lab">
  45. <div class="label">合同结束日期:</div>
  46. <el-date-picker
  47. v-model="starTime"
  48. class="div-inp"
  49. @change="timeChange1"
  50. type="daterange"
  51. range-separator="-"
  52. :default-time="['00:00:00', '23:59:59']"
  53. value-format="yyyy-MM-dd"
  54. start-placeholder="开始日期"
  55. end-placeholder="结束日期"
  56. >
  57. </el-date-picker>
  58. </div>
  59. <div v-if="orgType == 0" class="div-lab">
  60. <div class="label">楼盘类型:</div>
  61. <el-select
  62. v-model="searchForm.houseType"
  63. placeholder="请选择"
  64. class="div-inp"
  65. >
  66. <el-option
  67. v-for="item in options"
  68. :key="item.value"
  69. :label="item.label"
  70. :value="item.value"
  71. >
  72. </el-option>
  73. </el-select>
  74. </div>
  75. <div class="div-lab">
  76. <div class="label">使用状态:</div>
  77. <el-select
  78. v-model="searchForm.serviceStatus"
  79. placeholder="请选择"
  80. class="div-inp"
  81. >
  82. <el-option
  83. v-for="item in options1"
  84. :key="item.value"
  85. :label="item.label"
  86. :value="item.value"
  87. >
  88. </el-option>
  89. </el-select>
  90. </div>
  91. <div v-if="orgType == 0" class="div-lab">
  92. <div class="label">运营人员:</div>
  93. <el-input
  94. v-model="searchForm.operationalPeople"
  95. class="div-inp"
  96. placeholder="请输入内容"
  97. ></el-input>
  98. </div>
  99. <div v-if="orgType == 0" class="div-lab">
  100. <div class="label">代理商名称:</div>
  101. <el-input
  102. class="div-inp"
  103. v-model="searchForm.agentName"
  104. placeholder="请输入内容"
  105. ></el-input>
  106. </div>
  107. <div v-if="orgType != 2" class="div-lab">
  108. <div class="label">公司名称:</div>
  109. <el-input
  110. class="div-inp"
  111. v-model="searchForm.corporateName"
  112. placeholder="请输入内容"
  113. ></el-input>
  114. </div>
  115. <div class="div-lab">
  116. <div class="label">楼盘名称:</div>
  117. <el-input
  118. class="div-inp"
  119. v-model="searchForm.propertyName"
  120. placeholder="请输入内容"
  121. ></el-input>
  122. </div>
  123. </div>
  124. <!-- <div class="app-titel" style="margin-top: 10px">
  125. </div> -->
  126. <div class="app-titel" style="margin-top: 10px">
  127. <div class="label" style="color: #ffffff">筛选相关:</div>
  128. <div>
  129. <el-button
  130. @click="zkhousePage"
  131. style="background: #2671e2; color: #ffffff"
  132. >筛选</el-button
  133. >
  134. </div>
  135. <div style="margin-left: 20px">
  136. <el-button @click="empty">清空筛选条件</el-button>
  137. </div>
  138. <div style="margin-left: auto; margin-right: 20px" v-if="orgType != 2">
  139. <el-button
  140. v-if="cus_build_index_add"
  141. style="background: #2671e2; color: #ffffff"
  142. @click="addHouse"
  143. >新增</el-button
  144. >
  145. </div>
  146. </div>
  147. </div>
  148. <!-- 表格 -->
  149. <div class="cen-tab">
  150. <el-table :data="tableData" stripe style="width: 100%" border>
  151. <el-table-column prop="propertyName" label="楼盘名称" align="center">
  152. </el-table-column>
  153. <el-table-column
  154. prop="agentName"
  155. label="代理商"
  156. align="center"
  157. v-if="orgType == 0"
  158. >
  159. <template slot-scope="{ row }">
  160. {{ row.agentName || "-" }}
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. prop="corporateName"
  165. label="公司"
  166. align="center"
  167. v-if="orgType != 2"
  168. >
  169. </el-table-column>
  170. <el-table-column prop="address" label="楼盘地址" align="center">
  171. </el-table-column>
  172. <el-table-column prop="address" label="联系人信息" align="center">
  173. <template slot-scope="{ row }">
  174. {{ row.linkman || "-" }}-{{ row.linkmanPhone || "-" }}
  175. </template>
  176. </el-table-column>
  177. <el-table-column prop="managerPhone" label="管理员账号" align="center">
  178. <template slot-scope="{ row }">
  179. {{ row.managerPhone || "-" }}
  180. </template>
  181. </el-table-column>
  182. <el-table-column prop="createTime" label="添加日期" align="center">
  183. </el-table-column>
  184. <el-table-column
  185. prop="address"
  186. label="楼盘类型"
  187. align="center"
  188. v-if="orgType != 2"
  189. >
  190. <template slot-scope="{ row }">
  191. {{
  192. row.houseType == 0 ? "正式" : row.houseType == 1 ? "试用" : "演示"
  193. }}
  194. </template>
  195. </el-table-column>
  196. <el-table-column
  197. prop="startWorking"
  198. label="合同开始日期"
  199. align="center"
  200. >
  201. </el-table-column>
  202. <el-table-column prop="endWorking" label="合同结束日期" align="center">
  203. </el-table-column>
  204. <el-table-column prop="residueTime" label="剩余天数" align="center">
  205. </el-table-column>
  206. <el-table-column prop="address" label="服务状态" align="center">
  207. <template slot-scope="{ row }">
  208. {{ row.serviceStatus == 0 ? "在服务期内" : "已过期" }}
  209. </template>
  210. </el-table-column>
  211. <el-table-column prop="lockFlag" label="状态" align="center">
  212. <template slot-scope="{ row }">
  213. {{row.lockFlag==1?'禁用':'启用'}}
  214. </template>
  215. </el-table-column>
  216. <!-- scope -->
  217. <el-table-column label="操作" align="center" fixed="right" width="200">
  218. <template slot-scope="{ row }">
  219. <el-button type="text" v-if="cus_build_index_edit" @click="edit(row)">编辑</el-button>
  220. <el-button
  221. type="text"
  222. v-if="orgType != 2&&cus_build_index_change"
  223. @click="changeAccount(row)"
  224. >更换账号</el-button
  225. >
  226. <!-- <el-button type="text" v-if="orgType == 2">添加员工</el-button> -->
  227. <el-button type="text" size="small" v-if="cus_build_index_sys" @click="editOpera(row,0)">管理系统运营人员</el-button>
  228. <el-button type="text" size="small" v-if="cus_build_index_agent" @click="editOpera(row,1)">管理代理商运营</el-button>
  229. <!-- <el-button type="text">添加员工</el-button> -->
  230. <el-button type="text" size="small" v-if="cus_build_index_bindAgent" @click="bindAgent(row)">绑定代理商</el-button>
  231. <el-button type="text" v-if="cus_build_index_del" @click="del(row)">删除</el-button>
  232. <el-button type="text" v-if="cus_build_index_open" size="small" @click="toDisable(row)">{{row.lockFlag==0?'禁用':'启用'}}</el-button>
  233. </template>
  234. </el-table-column>
  235. </el-table>
  236. <div style="display: flex; justify-content: flex-end; margin-top: 10px">
  237. <el-pagination
  238. @size-change="handleSizeChange"
  239. @current-change="handleCurrentChange"
  240. :current-page="currentPage"
  241. :page-sizes="[10, 20, 30, 40]"
  242. :page-size="10"
  243. layout="total, sizes, prev, pager, next, jumper"
  244. :total="total"
  245. >
  246. </el-pagination>
  247. </div>
  248. </div>
  249. <el-dialog
  250. :title="editFlag ? '编辑楼盘' : '新增楼盘'"
  251. :visible.sync="dialogVisible"
  252. @close="dialogClose"
  253. >
  254. <el-form
  255. :model="ruleForm"
  256. label-position="labelPosition"
  257. ref="ruleForm"
  258. label-width="150px"
  259. style="width: 60%"
  260. :rules="rules"
  261. >
  262. <el-form-item label="公司" prop="orgCode" v-if="orgType != 2">
  263. <el-select v-model="ruleForm.orgCode" placeholder="请选择公司">
  264. <el-option
  265. v-for="item in orgList"
  266. :key="item.id"
  267. :label="item.name"
  268. :value="item.orgCode"
  269. >
  270. </el-option>
  271. </el-select>
  272. </el-form-item>
  273. <el-form-item label="楼盘类型" prop="houseType" v-if="orgType != 2">
  274. <el-radio-group v-model="ruleForm.houseType">
  275. <el-radio :label="0">正式</el-radio>
  276. <el-radio :label="1">试用</el-radio>
  277. <el-radio :label="2">演示</el-radio>
  278. <el-radio :label="3">测试</el-radio>
  279. </el-radio-group>
  280. </el-form-item>
  281. <el-form-item label="楼盘名称" prop="propertyName">
  282. <el-input v-model="ruleForm.propertyName"></el-input>
  283. </el-form-item>
  284. <el-form-item
  285. label="合同起止日期"
  286. prop="startWorking"
  287. v-if="orgType != 2"
  288. >
  289. <el-date-picker
  290. v-model="time"
  291. @change="timeChange"
  292. type="daterange"
  293. range-separator="-"
  294. :default-time="['00:00:00', '23:59:59']"
  295. value-format="yyyy-MM-dd"
  296. start-placeholder="开始日期"
  297. end-placeholder="结束日期"
  298. >
  299. </el-date-picker>
  300. </el-form-item>
  301. <el-form-item label="联系人" prop="linkman">
  302. <el-input v-model="ruleForm.linkman"></el-input>
  303. </el-form-item>
  304. <el-form-item label="联系手机" prop="linkmanPhone">
  305. <el-input
  306. v-model="ruleForm.linkmanPhone"
  307. type="tel"
  308. maxlength="11"
  309. onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)));"
  310. ></el-input>
  311. </el-form-item>
  312. <el-form-item label="楼盘地区" prop="provinceId">
  313. <el-cascader
  314. :props="props"
  315. @change="locationsChange"
  316. :options="addressOptions"
  317. placeholder="省/市"
  318. size="small"
  319. separator="/"
  320. v-model="ruleForm.area"
  321. clearable
  322. ></el-cascader>
  323. </el-form-item>
  324. <el-form-item label="详细地址" prop="address">
  325. <el-input v-model="ruleForm.address"></el-input>
  326. </el-form-item>
  327. <!-- <el-form-item
  328. label="运营人员"
  329. prop="operationalPeople"
  330. v-if="orgType == 0"
  331. >
  332. <el-select
  333. v-model="ruleForm.operationalPeople"
  334. placeholder="请选择运营人员"
  335. >
  336. <el-option
  337. v-for="item in operationList"
  338. :key="item.accountId"
  339. :label="item.name"
  340. :value="item.accountId"
  341. >
  342. </el-option>
  343. </el-select>
  344. </el-form-item> -->
  345. <el-form-item label="管理员账号" prop="managerPhone" v-if="!editFlag">
  346. <el-input maxlength="11" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)));" v-model="ruleForm.managerPhone"></el-input>
  347. </el-form-item>
  348. <el-form-item
  349. label="管理员密码"
  350. prop="managerPassword"
  351. v-if="!editFlag"
  352. >
  353. <el-input
  354. v-model="ruleForm.managerPassword"
  355. type="passsword"
  356. show-password
  357. :disabled='passFlag'
  358. ></el-input>
  359. </el-form-item>
  360. </el-form>
  361. <div slot="footer" class="dialog-footer">
  362. <el-button @click="addSurequxiao()">取 消</el-button>
  363. <el-button type="primary" @click="addSure">{{
  364. editFlag ? "编辑" : "保存"
  365. }}</el-button>
  366. </div>
  367. </el-dialog>
  368. <el-dialog
  369. title="更换账号"
  370. :visible.sync="changeFlag"
  371. @close="$refs.accountForm.resetFields()"
  372. width="400px"
  373. >
  374. <el-form
  375. :model="accountForm"
  376. label-width="100px"
  377. ref="accountForm"
  378. :rules="accountRules"
  379. >
  380. <el-form-item label="管理员账号:" prop="managerPhone">
  381. <el-input
  382. style="width: 200px"
  383. maxlength="11"
  384. v-model.number="accountForm.managerPhone"
  385. onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)));"
  386. ></el-input>
  387. </el-form-item>
  388. <el-form-item label="管理员密码:" prop="managerPassword">
  389. <el-input
  390. style="width: 200px"
  391. :disabled='passFlag'
  392. show-password
  393. v-model.number="accountForm.managerPassword"
  394. ></el-input>
  395. </el-form-item>
  396. </el-form>
  397. <div style="display: flex; justify-content: space-around">
  398. <el-button @click="changeFlag = false">取 消</el-button>
  399. <el-button type="primary" @click="changeSure">确 定</el-button>
  400. </div>
  401. </el-dialog>
  402. <!-- <el-dialog title="新增用户" :visible.sync="dialogVisible1">
  403. <el-form
  404. :model="ruleForm1"
  405. label-position="labelPosition"
  406. ref="ruleForm1"
  407. label-width="100px"
  408. style="width: 60%; margin: 0 auto"
  409. >
  410. <el-form-item label="用户名:" prop="areaName">
  411. <el-input v-model="ruleForm1.areaName"></el-input>
  412. </el-form-item>
  413. <el-form-item label="性别:" prop="areaName">
  414. <el-radio-group v-model="ruleForm1.resource">
  415. <el-radio label="男"></el-radio>
  416. <el-radio label="女"></el-radio>
  417. </el-radio-group>
  418. </el-form-item>
  419. <el-form-item label="登录手机:" prop="areaName">
  420. <el-input v-model="ruleForm1.areaName"></el-input>
  421. </el-form-item>
  422. <el-form-item label="登录密码:" prop="areaName">
  423. <el-input v-model="ruleForm1.areaName"></el-input>
  424. </el-form-item>
  425. <el-form-item label="角色:" prop="areaName">
  426. <el-select v-model="ruleForm1.region" placeholder="请选择角色">
  427. <el-option label="区域一" value="shanghai"></el-option>
  428. <el-option label="区域二" value="beijing"></el-option>
  429. </el-select>
  430. </el-form-item>
  431. <el-form-item label="部门:" prop="areaName">
  432. <el-select v-model="ruleForm1.region" placeholder="请选择部门">
  433. <el-option label="区域一" value="shanghai"></el-option>
  434. <el-option label="区域二" value="beijing"></el-option>
  435. </el-select>
  436. </el-form-item>
  437. </el-form>
  438. <div slot="footer" class="dialog-footer">
  439. <el-button @click="dialogVisible2 = false">取 消</el-button>
  440. <el-button type="primary">保存</el-button>
  441. </div>
  442. </el-dialog> -->
  443. <el-dialog :title="sysFlag==0?'绑定系统运营':'绑定代理商运营'" :visible.sync="operaVisible">
  444. <el-form
  445. :model="operaForm"
  446. label-position="labelPosition"
  447. :rules="operaRules"
  448. ref="operaForm"
  449. label-width="140px"
  450. >
  451. <el-form-item label="运营人员:" prop="operationalPeople">
  452. <el-select
  453. v-model="operaForm.operationalPeople"
  454. filterable
  455. multiple
  456. style="width: 80%"
  457. placeholder="请选择"
  458. >
  459. <el-option
  460. v-for="item in optionsoperationalPeople"
  461. :key="item.value"
  462. :label="item.name"
  463. :value="item.accountId"
  464. >
  465. </el-option>
  466. </el-select>
  467. </el-form-item>
  468. </el-form>
  469. <div slot="footer" class="dialog-footer">
  470. <el-button @click="operaVisible = false">取 消</el-button>
  471. <el-button type="primary" @click="saveOpera()">保存</el-button>
  472. </div>
  473. </el-dialog>
  474. <el-dialog title="管理代理商" :visible.sync="agentVisible">
  475. <el-form
  476. :model="agentForm"
  477. label-position="labelPosition"
  478. :rules="agentRule"
  479. ref="agentForm"
  480. label-width="140px"
  481. >
  482. <el-form-item label="代理商:" prop="agentId">
  483. <el-select
  484. v-model="agentForm.agentId"
  485. style="width: 80%"
  486. filterable
  487. clearable
  488. placeholder="请选择"
  489. >
  490. <el-option
  491. v-for="item in optionsagentId"
  492. :key="item.id"
  493. :label="item.agentName"
  494. :value="item.id"
  495. >
  496. </el-option>
  497. </el-select>
  498. </el-form-item>
  499. </el-form>
  500. <div slot="footer" class="dialog-footer">
  501. <el-button @click="agentVisible = false">取 消</el-button>
  502. <el-button type="primary" @click="saveAgent()">保存</el-button>
  503. </div>
  504. </el-dialog>
  505. </div>
  506. </template>
  507. <script>
  508. import { mapGetters } from "vuex";
  509. import { getAreaList } from "@/api/modules/api";
  510. export default {
  511. data() {
  512. var validatePass = (rule, value, callback) => {
  513. if (value === "") {
  514. callback(new Error("请输入手机号"));
  515. } else {
  516. if (value) {
  517. if (!/^1[3456789]\d{9}$/.test(value)) {
  518. // alert("手机号码不合法,请重新输入");
  519. callback(new Error("手机号码不合法,请重新输入"));
  520. }
  521. }
  522. callback();
  523. }
  524. };
  525. var validatePass1 = (rule, value, callback) => {
  526. if (value === "") {
  527. callback(new Error("请输入管理员账号"));
  528. } else {
  529. if (value) {
  530. this.passFlag=false
  531. if (!/^1[3456789]\d{9}$/.test(value)) {
  532. // alert("手机号码不合法,请重新输入");
  533. callback(new Error("手机号码不合法,请重新输入"));
  534. }else{
  535. // 验证电话号码
  536. this.$api.api.verPhone(value).then((res) => {
  537. // console.log(res);
  538. // 判断数据是否已经有了
  539. if (res.data) {
  540. // 由用户
  541. this.$api.api.userVerify({
  542. orgType:localStorage.getItem('orgType'),
  543. accountId:res.data.sysUser.accountId,
  544. username:res.data.sysUser.username,
  545. agentId:localStorage.getItem('agentId'),
  546. orgCode:localStorage.getItem('orgCode'),
  547. })
  548. .then(res1=>{
  549. callback();
  550. this.passFlag=true
  551. if(this.changeFlag){
  552. this.accountForm.managerPassword=res.data.sysUser.resultPwd
  553. }else{
  554. this.ruleForm.managerPassword=res.data.sysUser.resultPwd
  555. }
  556. })
  557. .catch(err=>{
  558. console.log(err)
  559. callback(new Error(err));
  560. })
  561. } else {
  562. // 没有用户
  563. // console.log("没有用户");
  564. // callback(new Error("没有管理员账号"));
  565. if(this.changeFlag){
  566. this.accountForm.managerPassword=''
  567. }else{
  568. this.ruleForm.managerPassword=''
  569. }
  570. this.passFlag=false
  571. callback();
  572. }
  573. });
  574. }
  575. }
  576. callback();
  577. }
  578. };
  579. return {
  580. props: {
  581. lazy: true,
  582. async lazyLoad(node, resolve) {
  583. console.log(node, 123);
  584. const { level } = node;
  585. if (level == 0) {
  586. console.log(23);
  587. const { data } = await getAreaList({ parentId: 0 }); //获取省接口
  588. var nodes = data.map((item) => {
  589. return {
  590. value: item.id,
  591. label: item.name,
  592. leaf: false,
  593. };
  594. });
  595. resolve(nodes);
  596. } else if (level == 1) {
  597. const { data } = await getAreaList({ parentId: node.data.value }); //获取市接口
  598. var nodes = data.map((item) => {
  599. return {
  600. value: item.id,
  601. label: item.name,
  602. leaf: true,
  603. };
  604. });
  605. resolve(nodes);
  606. }
  607. },
  608. },
  609. editFlag: false,
  610. changeFlag: false,
  611. operaVisible: false,
  612. passFlag:false,
  613. starTime: [],
  614. searchForm: {
  615. corporateName: "",
  616. propertyName: "",
  617. serviceStatus: "",
  618. houseType: "",
  619. // residueTime: 7,
  620. startWorking: "",
  621. endWorking: "",
  622. agentName: "",
  623. operationalPeople: "",
  624. },
  625. options1: [
  626. {
  627. value: "0",
  628. label: "服务器内",
  629. },
  630. {
  631. value: "1",
  632. label: "已失效",
  633. },
  634. ],
  635. options: [
  636. {
  637. value: "0",
  638. label: "正式",
  639. },
  640. {
  641. value: "1",
  642. label: "试用",
  643. },
  644. {
  645. value: "2",
  646. label: "演示",
  647. },
  648. ],
  649. currentPage: 1,
  650. size: 10,
  651. total: 10,
  652. value: "",
  653. input: "",
  654. sysFlag:'0',
  655. idx:'0',
  656. tableData: [],
  657. optionsoperationalPeople: [],
  658. orgType: "",
  659. orgList: [],
  660. operationList: [],
  661. dialogVisible: false,
  662. dialogVisible1: false,
  663. agentVisible:false,
  664. time: [],
  665. addressOptions: [],
  666. accountForm: {
  667. managerPassword: "",
  668. managerPhone: "",
  669. },
  670. accountRules: {
  671. managerPhone: [{ validator: validatePass1, trigger: "change" }],
  672. },
  673. ruleForm: {
  674. orgCode: "", //公司标识
  675. houseType: 0, //楼盘类型
  676. propertyName: "", //楼盘名称
  677. startWorking: "", //活动开始时间
  678. endWorking: "", //活动结束时间
  679. linkman: "", //联系人
  680. linkmanPhone: "", //联系手机
  681. area: [], //楼盘地区
  682. address: "", //详细地址
  683. operationalPeople: "", //运营人员
  684. managerPhone: "", //管理员账号
  685. managerPassword: "", //密码
  686. provinceId: "", //省id
  687. cityId: "", //市id
  688. agentId:localStorage.getItem('agentId')
  689. },
  690. ruleForm1: {},
  691. optionsagentId:[],
  692. rules: {
  693. orgCode: [{ required: true, message: "请选择公司", trigger: "blur" }],
  694. propertyName: [
  695. { required: true, message: "请填写楼盘名称", trigger: "change" },
  696. ],
  697. startWorking: [
  698. { required: true, message: "请选择时间", trigger: "change" },
  699. ],
  700. managerPhone: [{ validator: validatePass1, trigger: "blur" }],
  701. linkmanPhone: [{ validator: validatePass, trigger: "blur" }],
  702. },
  703. operaForm: {
  704. operationalPeople: "",
  705. },
  706. operaRules: {
  707. operationalPeople: [
  708. { required: true, message: "请选择运营人员", trigger: "blur" },
  709. ],
  710. },
  711. agentRule: {
  712. agentId: [{ required: true, message: "请选择代理商", trigger: "blur" }],
  713. },
  714. agentForm: {
  715. agentId:'',
  716. },
  717. };
  718. },
  719. computed: {
  720. ...mapGetters(["permissions"]),
  721. },
  722. created() {
  723. this.cus_build_index_add = this.permissions["cus_build_index_add"];
  724. this.cus_build_index_edit = this.permissions["cus_build_index_edit"];
  725. this.cus_build_index_change = this.permissions["cus_build_index_change"];
  726. this.cus_build_index_sys = this.permissions["cus_build_index_sys"];
  727. this.cus_build_index_agent = this.permissions["cus_build_index_agent"];
  728. this.cus_build_index_bindAgent = this.permissions["cus_build_index_bindAgent"];
  729. this.cus_build_index_del = this.permissions["cus_build_index_del"];
  730. this.cus_build_index_open = this.permissions["cus_build_index_open"];
  731. },
  732. mounted() {
  733. this.orgType = localStorage.getItem("orgType");
  734. // 获取公司列表数据
  735. this.getOrgList();
  736. // 获取运营人员
  737. // this.getAllOperationsStaff();
  738. // 获取列表数据
  739. this.zkhousePage();
  740. },
  741. methods: {
  742. bindAgent(row) {
  743. // console.log(row);
  744. this.findMyAgent(row);
  745. this.agentVisible = true;
  746. },
  747. saveAgent() {
  748. this.$refs.agentForm.validate((valid) => {
  749. if (valid) {
  750. console.log(this.agentForm);
  751. this.$api.api
  752. .saveAgent({
  753. agentId: this.agentForm.agentId,
  754. id: this.agentForm.houseId,
  755. })
  756. .then((res) => {
  757. this.$message.success("操作成功");
  758. this.zkhousePage();
  759. this.agentVisible = false;
  760. });
  761. }
  762. });
  763. },
  764. findMyAgent(row) {
  765. this.$api.http.findMyAgent({ orgType: this.orgType }).then((res) => {
  766. console.log(res.data);
  767. this.optionsagentId = res.data;
  768. this.agentForm.orgCode = row.orgCode;
  769. this.agentForm.houseId = row.id;
  770. this.agentForm.agentId=row.agentId
  771. });
  772. },
  773. saveOpera() {
  774. this.$refs.operaForm.validate((valid) => {
  775. if (valid) {
  776. // console.log(valid,this.operaForm);
  777. this.$api.api
  778. .zkoperationrecordSaveHouse({
  779. orgType: 3,
  780. accountIds: this.operaForm.operationalPeople.join(","),
  781. orgId: this.operaForm.orgId,
  782. orgCode: this.operaForm.orgCode,
  783. operationType:this.idx==0?'1':'2'
  784. })
  785. .then((res) => {
  786. console.log(res);
  787. this.$message.success("操作成功");
  788. this.operaVisible = false;
  789. });
  790. }
  791. });
  792. },
  793. editOpera(row,idx) {
  794. // console.log(row,idx);
  795. // 获取运营人员列表
  796. this.operaForm.orgId = row.id;
  797. this.operaForm.orgCode = row.orgCode;
  798. this.sysFlag=idx
  799. this.idx=idx
  800. this.AllOperationsStaff(idx,row);
  801. this.zkoperationrecordFindByOrg(row.id,idx);
  802. },
  803. zkoperationrecordFindByOrg(orgId,idx) {
  804. this.$api.api
  805. .zkoperationrecordFindByOrg({
  806. orgType:3,
  807. orgId,
  808. operationType:this.idx==0?'1':'2'
  809. })
  810. .then((res) => {
  811. // console.log(res);
  812. if (res.data.length == 0) {
  813. // 没有运营人员
  814. this.operaForm.operationalPeople = [];
  815. } else {
  816. let arr = [];
  817. // 有运营
  818. res.data.map((item) => {
  819. arr.push(item.accountId);
  820. });
  821. this.operaForm.operationalPeople = arr;
  822. }
  823. });
  824. },
  825. //获取运营人员
  826. AllOperationsStaff(idx,row) {
  827. console.log(idx);
  828. this.optionsoperationalPeople = [];
  829. if(idx==1){
  830. this.$api.http.getAllOperationsStaffByAgent({
  831. agentId:row.agentId
  832. }).then((res) => {
  833. this.optionsoperationalPeople= res.data
  834. this.operaVisible = true;
  835. });
  836. }else{
  837. this.$api.http.getAllOperationsStaff().then((res) => {
  838. this.optionsoperationalPeople= res.data
  839. this.operaVisible = true;
  840. });
  841. }
  842. // this.$api.api.getAllOperationsStaffByAgent({agentId}).then((res) => {
  843. // this.optionsoperationalPeople = res.data;
  844. // });
  845. },
  846. addSurequxiao() {
  847. this.dialogVisible = false;
  848. },
  849. // 添加楼盘
  850. addSure() {
  851. // console.log(this.addressOptions)
  852. this.$refs.ruleForm.validate((valid) => {
  853. if (valid) {
  854. console.log(this.ruleForm);
  855. // 编辑
  856. if (this.editFlag) {
  857. console.log("编辑");
  858. this.$api.api.editZkhouse(this.ruleForm).then((res) => {
  859. console.log(res);
  860. if (res.code == 0) {
  861. this.dialogVisible = false;
  862. this.$message.success("编辑成功");
  863. this.zkhousePage();
  864. }
  865. });
  866. } else {
  867. // 添加
  868. console.log("添加");
  869. this.$api.api.addZkhouse(this.ruleForm).then((res) => {
  870. console.log(res);
  871. if (res.code == 0) {
  872. this.dialogVisible = false;
  873. this.$message.success("新增楼盘成功");
  874. this.zkhousePage();
  875. }
  876. });
  877. }
  878. }
  879. });
  880. },
  881. toDisable(row){
  882. this.$confirm(`确定${row.lockFlag==0?'禁用':'启用'}此代理商么?`, '提示', {
  883. confirmButtonText: '确定',
  884. cancelButtonText: '取消',
  885. type: 'warning'
  886. }).then(() => {
  887. // return
  888. // console.log(123);
  889. this.$api.api.editZkhouse({id:row.id,lockFlag:row.lockFlag==0?1:0}).then((res) => {
  890. if(res.code==0){
  891. this.$message({
  892. type: 'success',
  893. message: '操作成功!'
  894. });
  895. this.zkhousePage();
  896. }else{
  897. this.$message.error(res.message);
  898. }
  899. })
  900. })
  901. .catch(err=>{
  902. // console.log('关闭');
  903. // console.log(err);
  904. })
  905. },
  906. dialogClose() {
  907. this.restFrom();
  908. },
  909. restFrom() {
  910. this.$refs.ruleForm.resetFields();
  911. this.time = [];
  912. this.ruleForm = {
  913. orgCode: "", //公司标识
  914. houseType: 0, //楼盘类型
  915. propertyName: "", //楼盘名称
  916. startWorking: "", //活动开始时间
  917. endWorking: "", //活动结束时间
  918. linkman: "", //联系人
  919. linkmanPhone: "", //联系手机
  920. area: [], //楼盘地区
  921. address: "", //详细地址
  922. operationalPeople: "", //运营人员
  923. managerPhone: "", //管理员账号
  924. managerPassword: "", //密码
  925. provinceId: "", //省id
  926. cityId: "", //市id
  927. };
  928. },
  929. // 新增楼盘,弹框显示
  930. addHouse() {
  931. this.editFlag = false;
  932. this.dialogVisible = true;
  933. this.passFlag=false
  934. },
  935. edit(row) {
  936. console.log(row);
  937. this.time = [
  938. row.startWorking.substring(0, 10),
  939. row.endWorking.substring(0, 10),
  940. ];
  941. // console.log(this.time)
  942. this.ruleForm = Object.assign({}, row);
  943. this.ruleForm.area = [this.ruleForm.provinceId, this.ruleForm.cityId];
  944. this.dialogVisible = true;
  945. // 获取地区选择数据,在这里对回显的时候进行操作,首先先获取一级省的数据
  946. // this.getProvinceList();
  947. // 级联选择器回显问题
  948. this.editFlag = true;
  949. },
  950. // 更换账号
  951. changeAccount(row) {
  952. this.changeFlag = true;
  953. this.passFlag=false
  954. this.accountForm.id = row.id;
  955. },
  956. changeSure() {
  957. this.$refs.accountForm.validate((valid) => {
  958. if (valid) {
  959. this.$api.api.updateManagerPhone(this.accountForm).then((res) => {
  960. if (res.code == 0) {
  961. this.changeFlag = false;
  962. this.$message.success("编辑成功");
  963. this.zkhousePage();
  964. }
  965. });
  966. }
  967. });
  968. },
  969. del(row) {
  970. console.log(row, "删除");
  971. this.$confirm(`是否删除区域?`, "提示", {
  972. confirmButtonText: "确定",
  973. cancelButtonText: "取消",
  974. distinguishCancelAndClose: true,
  975. type: "warning",
  976. }).then(() => {
  977. axios({
  978. url: `/autoSR/zkhouse/${row.id}`,
  979. method: "delete",
  980. // params: {
  981. // id: row.id,
  982. // },
  983. }).then((res) => {
  984. if (res.code == 0) {
  985. this.$message.success("删除成功");
  986. this.zkhousePage();
  987. } else {
  988. this.$message.warning(res.resMsg);
  989. }
  990. });
  991. });
  992. },
  993. // 时间改变
  994. timeChange(e) {
  995. console.log(e);
  996. this.ruleForm.startWorking = e[0];
  997. this.ruleForm.endWorking = e[1];
  998. },
  999. // 获取公司列表
  1000. getOrgList() {
  1001. this.$api.api
  1002. .getCompanyList({
  1003. orgType: this.orgType,
  1004. agentId:localStorage.getItem('agentId')
  1005. })
  1006. .then((res) => {
  1007. if (res.code == 0) {
  1008. this.orgList = res.data;
  1009. }
  1010. });
  1011. },
  1012. // 获取运营人员地址
  1013. getAllOperationsStaff() {
  1014. this.$api.api.getAllOperationsStaff().then((res) => {
  1015. console.log(res);
  1016. if (res.code == 0) {
  1017. this.operationList = res.data;
  1018. }
  1019. });
  1020. },
  1021. // 获取楼盘列表
  1022. zkhousePage() {
  1023. let obj = {
  1024. current: this.currentPage,
  1025. size: this.size,
  1026. orgType: localStorage.getItem("orgType"),
  1027. agentId: localStorage.getItem("agentId"),
  1028. orgCode: localStorage.getItem("orgCode"),
  1029. ...this.searchForm,
  1030. };
  1031. if (this.orgType == 0) {
  1032. obj.residueTime = null;
  1033. }
  1034. this.$api.api.zkhousePage(obj).then((res) => {
  1035. // console.log(res)
  1036. this.tableData = res.data.records;
  1037. this.total = res.data.total;
  1038. });
  1039. },
  1040. async getProvinceList(parentId = 0) {
  1041. let _this = this;
  1042. this.addressOptions = [];
  1043. let res = await getAreaList({ parentId });
  1044. // console.log(res);
  1045. // 当他没有值时给addressOptions赋值,这是第一个数组
  1046. if (res.code == 0) {
  1047. // _this.$set(_this, 'addressOptions',_this.ruleForm.cityIds&&_this.ruleForm.provinceId ? this.loadOptions(res.data||[] ):res.data)
  1048. let arr = [];
  1049. res.data.map((item) => {
  1050. let obj = {};
  1051. obj.value = item.id;
  1052. obj.label = item.name;
  1053. obj.leaf = false;
  1054. obj.children = [];
  1055. arr.push(obj);
  1056. });
  1057. this.addressOptions = arr;
  1058. this.loadOptions();
  1059. }
  1060. },
  1061. loadOptions() {
  1062. // console.log(this.addressOptions);
  1063. this.addressOptions.map((item, idx) => {
  1064. if (item.value == this.ruleForm.provinceId) {
  1065. console.log("有匹配项");
  1066. getAreaList({ parentId: this.ruleForm.provinceId }).then((res) => {
  1067. if (res.code == 0) {
  1068. let arr = [];
  1069. res.data.map((item1) => {
  1070. let obj = {};
  1071. obj.value = item1.id;
  1072. obj.label = item1.name;
  1073. obj.leaf = true;
  1074. arr.push(obj);
  1075. });
  1076. this.$set(this.addressOptions[idx], "children", arr);
  1077. // console.log(this.addressOptions[idx], "123");
  1078. this.addressOptions = Object.assign([], this.addressOptions);
  1079. this.area = null;
  1080. setTimeout(() => {
  1081. this.ruleForm.area = [
  1082. this.ruleForm.provinceId,
  1083. this.ruleForm.cityId,
  1084. ];
  1085. // console.log(1);
  1086. // console.log(this.addressOptions);
  1087. // console.log(this.area);
  1088. this.$forceUpdate();
  1089. }, 50);
  1090. }
  1091. });
  1092. }
  1093. this.dialogVisible = true;
  1094. });
  1095. },
  1096. empty() {
  1097. this.starTime = [];
  1098. this.searchForm = {
  1099. corporateName: "",
  1100. propertyName: "",
  1101. serviceStatus: "",
  1102. houseType: "",
  1103. // residueTime: 7,
  1104. startWorking: "",
  1105. endWorking: "",
  1106. agentName: "",
  1107. operationalPeople: "",
  1108. };
  1109. },
  1110. timeChange1(e) {
  1111. this.searchForm.startWorking = e[0];
  1112. this.searchForm.endWorking = e[1];
  1113. },
  1114. tabtimetap(idx) {
  1115. this.searchForm.residueTime = idx;
  1116. },
  1117. handleSizeChange(val) {
  1118. console.log(`每页 ${val} 条`);
  1119. this.size = val;
  1120. this.zkhousePage();
  1121. },
  1122. handleCurrentChange(val) {
  1123. console.log(`当前页: ${val}`);
  1124. this.currentPage = val;
  1125. this.zkhousePage();
  1126. },
  1127. locationsChange(e) {
  1128. console.log(e);
  1129. if (!e) return;
  1130. this.ruleForm.provinceId = e[0];
  1131. this.ruleForm.cityId = e[1];
  1132. },
  1133. },
  1134. };
  1135. </script>
  1136. <style scoped="scoped" lang="scss" >
  1137. .box-center {
  1138. width: 100%;
  1139. padding: 15px;
  1140. min-width: 1200px;
  1141. padding-bottom: 100px;
  1142. }
  1143. .cen-tab {
  1144. width: 100%;
  1145. padding: 15px;
  1146. background: #ffffff;
  1147. margin-top: 15px;
  1148. }
  1149. .tophove {
  1150. color: #ffffff;
  1151. background: #2671e2;
  1152. }
  1153. .app-top {
  1154. width: 100%;
  1155. background: #ffffff;
  1156. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
  1157. border-radius: 4px;
  1158. padding-top: 15px;
  1159. padding-bottom: 15px;
  1160. .app-titel {
  1161. width: 100%;
  1162. display: flex;
  1163. align-items: center;
  1164. flex-wrap: wrap;
  1165. .label {
  1166. font-size: 14px;
  1167. font-weight: 400;
  1168. color: #32363d;
  1169. line-height: 32px;
  1170. margin-left: 15px;
  1171. min-width: 100px;
  1172. }
  1173. .toptimeqhuan {
  1174. height: 30px;
  1175. background: #ffffff;
  1176. display: flex;
  1177. align-items: center;
  1178. }
  1179. .toptimeqhuan div {
  1180. padding-left: 20px;
  1181. padding-right: 20px;
  1182. text-align: center;
  1183. line-height: 30px;
  1184. font-size: 14px;
  1185. margin-right: 15px;
  1186. border-radius: 4px;
  1187. border: 1px solid #e0e0e0;
  1188. }
  1189. }
  1190. }
  1191. .div-lab {
  1192. display: flex;
  1193. margin: 5px;
  1194. }
  1195. .div-inp {
  1196. width: 250px;
  1197. }
  1198. </style>