No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

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