basicinfo.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. :page.sync="page"
  7. :permission="permissionList"
  8. :before-open="beforeOpen"
  9. v-model="form"
  10. ref="crud"
  11. @row-update="rowUpdate"
  12. @row-save="rowSave"
  13. @row-del="rowDel"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @refresh-change="refreshChange"
  20. @on-load="onLoad">
  21. <template slot="menuLeft">
  22. <el-button type="danger"
  23. size="small"
  24. icon="el-icon-delete"
  25. plain
  26. v-if="permission.basicinfo_delete"
  27. @click="handleDelete">删 除
  28. </el-button>
  29. <el-button type="warning"
  30. size="small"
  31. icon="el-icon-delete"
  32. plain
  33. v-if="permission.basicinfo_delete"
  34. @click="handleDelFace">人脸删除
  35. </el-button>
  36. </template>
  37. <template slot="residentialIdForm" slot-scope="scope">
  38. <select-dialog-residential :name="form.residentialName" :id="form.residentialId" :disabled="residentialDisabled" :callback="selectCallback"></select-dialog-residential>
  39. </template>
  40. <!-- <template slot="buildingId" slot-scope="scope">
  41. <span v-if="scope.row.buildingId!==-1">
  42. {{scope.row.buildingName}}
  43. </span>
  44. </template>
  45. <template slot="floorId" slot-scope="scope">
  46. <span v-if="scope.row.floorId!==-1">
  47. {{scope.row.floorName}}
  48. </span>
  49. </template>
  50. <template slot="unitId" slot-scope="scope">
  51. <span v-if="scope.row.unitId!==-1">
  52. {{scope.row.unitName}}
  53. </span>
  54. </template>
  55. <template slot="roomId" slot-scope="scope">
  56. <span v-if="scope.row.roomId!==-1">
  57. {{scope.row.roomName}}
  58. </span>
  59. </template>
  60. <template slot="menu" slot-scope="scope">
  61. <el-button icon="el-icon-setting" size="mini" type="text">
  62. <el-dropdown>
  63. <span class="el-dropdown-link" style="font-size: xx-small; color: #4babfe">设置标签<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i></span>
  64. <el-dropdown-menu slot="dropdown">
  65. <el-dropdown-item type="text" @click.native="tagsFormOpen('elder', scope.row)">高龄老人</el-dropdown-item>
  66. <el-dropdown-item type="text" @click.native="tagsFormOpen('keyPerson', scope.row)">重点人员</el-dropdown-item>
  67. <el-dropdown-item type="text" @click.native="tagsFormOpen('disabler', scope.row)">残障人士</el-dropdown-item>
  68. &lt;!&ndash; <el-dropdown-item type="text" @click.native="tagsFormOpen('household', scope.row)">常住人员</el-dropdown-item>&ndash;&gt;
  69. &lt;!&ndash; <el-dropdown-item type="text" @click.native="tagsFormOpen('enterpriseStaff', scope.row)">企业员工</el-dropdown-item>&ndash;&gt;
  70. </el-dropdown-menu>
  71. </el-dropdown>
  72. </el-button>
  73. </template>
  74. 标签点击事件
  75. <template slot="tags" slot-scope="scope" style="display: flex">
  76. <div v-if="scope.row.tags!== null">
  77. <el-button style="margin: auto" class="el-icon-collection-tag" v-for="item in scope.row.tags.split(',')" @click.native="tagsDetail(item,scope.row)" size="mini" type="text">
  78. {{item}}
  79. </el-button>
  80. </div>
  81. </template>-->
  82. </avue-crud>
  83. <!-- 显示标签详情组件
  84. <el-dialog title="残障人士【标签详情】" :visible.sync="disablerTagsdetail" :modal-append-to-body="false">
  85. <DisablerTagsDetail v-if="disablerTagsdetail" :basic-data="basicData"></DisablerTagsDetail>
  86. </el-dialog>
  87. <el-dialog title="高龄老人【标签详情】" :visible.sync="elderTagsdetail" :modal-append-to-body="false">
  88. <ElderTagsDetail v-if="elderTagsdetail" :basic-data="basicData"></ElderTagsDetail>
  89. </el-dialog>
  90. <el-dialog title="重点人员【标签详情】" :visible.sync="keyPersonTagsdetail" :modal-append-to-body="false">
  91. <KeypeopleTagsDetail v-if="keyPersonTagsdetail" :basic-data="basicData"></KeypeopleTagsDetail>
  92. </el-dialog>
  93. <el-dialog title="常住人员【标签详情】" :visible.sync="householdTagsdetail" :modal-append-to-body="false">
  94. <HouseholdTagsDetail v-if="householdTagsdetail" :basic-data="basicData"></HouseholdTagsDetail>
  95. </el-dialog>
  96. <el-dialog title="企业员工【标签详情】" :visible.sync="enterpriseStaffTagsdetail" :modal-append-to-body="false">
  97. <EnterpriseStaffTagsDetail v-if="enterpriseStaffTagsdetail" :basic-data="basicData"></EnterpriseStaffTagsDetail>
  98. </el-dialog>
  99. 标签添加信息组件
  100. <el-dialog title="高龄老人【添加标签信息】" :visible.sync="elderTags" :modal-append-to-body="false">
  101. <ElderTagsForm v-if="elderTags" :basic-data="basicData" :close-fn="() => {elderTags = false}"></ElderTagsForm>
  102. </el-dialog>
  103. <el-dialog title="残障人士【添加标签信息】" :visible.sync="disablerTags" :modal-append-to-body="false">
  104. <DisablerTagsForm v-if="disablerTags" :basic-data="basicData" :close-fn="() => {disablerTags = false}"></DisablerTagsForm>
  105. </el-dialog>
  106. <el-dialog title="重点人员【添加标签信息】" :visible.sync="keyPersonTags" :modal-append-to-body="false">
  107. <KeyPersonTagsForm v-if="keyPersonTags" :basic-data="basicData" :close-fn="() => {keyPersonTags = false}"></KeyPersonTagsForm>
  108. </el-dialog>
  109. <el-dialog title="常住人员【添加标签信息】" :visible.sync="householdTags" :modal-append-to-body="false">
  110. <HouseholdTagsForm v-if="householdTags" :basic-data="basicData" :close-fn="() => {householdTags = false}"></HouseholdTagsForm>
  111. </el-dialog>
  112. <el-dialog title="企业人员【添加标签信息】" :visible.sync="enterpriseStaffTags" :modal-append-to-body="false">
  113. <EnterpriseStaffTagsForm v-if="enterpriseStaffTags" :basic-data="basicData" :close-fn="() => {enterpriseStaffTags = false}"></EnterpriseStaffTagsForm>
  114. </el-dialog>-->
  115. </basic-container>
  116. </template>
  117. <script>
  118. import {getList, getDetail, add, update, remove} from "@/api/person/basicinfo";
  119. import {mapGetters} from "vuex";
  120. /*import ElderTagsForm from "@/components/person-tags/elderTags-form";
  121. import DisablerTagsForm from "@/components/person-tags/disablerTags-form";
  122. import KeyPersonTagsForm from "@/components/person-tags/keyPersonTags-form";
  123. import EnterpriseStaffTagsForm from "@/components/person-tags/enterpriseStaffTags-form";
  124. import HouseholdTagsForm from "@/components/person-tags/householdTags-form";
  125. import ElderTagsDetail from "@/components/person-tags/elderTags-detail";
  126. import DisablerTagsDetail from "@/components/person-tags/disablerTags-detail";
  127. import KeypeopleTagsDetail from "@/components/person-tags/keyPersonTags-detail";
  128. import HouseholdTagsDetail from "@/components/person-tags/householdTags-detail";
  129. import EnterpriseStaffTagsDetail from "@/components/person-tags/enterpriseStaffTags-detail";*/
  130. import {DIC} from "@/api/util/nation"
  131. import {validatePhone} from "../../util/validator";
  132. import SelectDialogResidential from "../../components/select-dialog/select-dialog-residential";
  133. export default {
  134. components: {SelectDialogResidential},
  135. // components: {ElderTagsForm, DisablerTagsForm,KeyPersonTagsForm,DisablerTagsDetail,ElderTagsDetail,KeypeopleTagsDetail},
  136. data() {
  137. return {
  138. elderTags: false,
  139. disablerTags: false,
  140. keyPersonTags: false,
  141. householdTags:false,
  142. enterpriseStaffTags:false,
  143. elderTagsdetail:false,
  144. disablerTagsdetail:false,
  145. keyPersonTagsdetail:false,
  146. // householdTagsdetail:false,
  147. // enterpriseStaffTagsdetail:false,
  148. basicData: {},
  149. form: {},
  150. oldForm: {},
  151. delTags:[],
  152. confirmInfo:'',
  153. query: {},
  154. loading: true,
  155. residentialDisabled: false,
  156. page: {
  157. pageSize: 10,
  158. currentPage: 1,
  159. total: 0
  160. },
  161. selectionList: [],
  162. option: {
  163. // excelBtn:true,
  164. height:'auto',
  165. calcHeight: 30,
  166. labelWidth: 120,
  167. tip: false,
  168. searchShow: true,
  169. searchMenuSpan: 6,
  170. border: true,
  171. index: true,
  172. viewBtn: true,
  173. selection: true,
  174. dialogClickModal: false,
  175. // menuWidth:500,
  176. column: [
  177. {
  178. label: "身份证号",
  179. labelWidth: 150,
  180. prop: "idCard",
  181. search:true,
  182. hide: true,
  183. rules: [{
  184. required: false,
  185. message: "请输入身份证号码",
  186. trigger: "blur"
  187. }]
  188. },
  189. {
  190. label: "姓名",
  191. prop: "name",
  192. search:true,
  193. rules: [{
  194. required: true,
  195. message: "请输入姓名",
  196. trigger: "blur"
  197. }]
  198. },
  199. {
  200. label: "性别",
  201. prop: "sex",
  202. type: 'select',
  203. dataType:"number",
  204. search:true,
  205. dicUrl: "/api/blade-system/dict-biz/dictionary?code=sex",
  206. props: {
  207. label: "dictValue",
  208. value: "dictKey"
  209. },
  210. rules: [{
  211. required: true,
  212. message: "请选择性别",
  213. trigger: "blur"
  214. }]
  215. },
  216. {
  217. label: "住户类型",
  218. prop: "type",
  219. type: 'select',
  220. dataType:"number",
  221. dicUrl: "/api/blade-system/dict-biz/dictionary?code=household-type",
  222. props: {
  223. label: "dictValue",
  224. value: "dictKey"
  225. },
  226. rules: [{
  227. required: true,
  228. message: "请选择住户类型",
  229. trigger: "blur"
  230. }],
  231. },
  232. {
  233. label: "照片",
  234. prop: "imageUri",
  235. type: 'upload',
  236. hide:true,
  237. listType: 'picture-img',
  238. propsHttp: {
  239. res: "data",
  240. url: "link"
  241. },
  242. action: "/api/blade-resource/oss/endpoint/put-file",
  243. tip: '只能生产jpg/png图片,且不超过500kb',
  244. rules: [{
  245. required: false,
  246. message: "请上传入境证明url",
  247. trigger: "blur"
  248. }]
  249. },
  250. /*{
  251. label: "所属社区",
  252. prop: "agencyId",
  253. search: true,
  254. cascaderItem: ['residentialId'],
  255. type: "select",
  256. // remote: true,
  257. dicUrl: "/api/cyzh-community/agency/list?size=500",
  258. dicFormatter:(res)=>{
  259. return res.data.records;//返回字典的层级结构
  260. },
  261. props: {
  262. label: "name",
  263. value: "id"
  264. },
  265. rules: [{
  266. required: true,
  267. message: "请选择所属社区",
  268. trigger: "blur"
  269. }]
  270. },*/
  271. {
  272. label: "所属小区",
  273. prop: "residentialName",
  274. addDisplay: false,
  275. editDisplay: false,
  276. },
  277. {
  278. label: "所属小区",
  279. prop: "residentialId",
  280. type: "select",
  281. search: true,
  282. searchFilterable: true,
  283. // cascaderItem: ['buildingId'],
  284. remote: true,
  285. dicUrl: "/api/cyzh-community/residential/list?name={{key}}",
  286. dicFormatter:(res)=>{
  287. return res.data.records;//返回字典的层级结构
  288. },
  289. // dicFlag: false,
  290. filterable: true,
  291. formslot: true,
  292. props: {
  293. label: "name",
  294. value: "id"
  295. },
  296. rules: [{
  297. required: true,
  298. message: "请选择所属小区",
  299. trigger: "blur"
  300. }],
  301. hide: true,
  302. viewDisplay: false
  303. },
  304. {
  305. label: "所属楼栋",
  306. prop: "buildingName",
  307. addDisplay: false,
  308. editDisplay: false,
  309. },
  310. {
  311. label: "所属楼栋",
  312. prop: "buildingId",
  313. type: "select",
  314. // slot:true,
  315. search: true,
  316. cascaderItem: ['unitId'],
  317. // dicUrl: "/api/cyzh-community/building/list?residentialId={{key}}&size=100",
  318. dicUrl: "/api/cyzh-community/building/list",
  319. dicFormatter:(res)=>{
  320. return res.data.records;//返回字典的层级结构
  321. },
  322. // dicFlag: true,
  323. // filterable: true,
  324. props: {
  325. label: "name",
  326. value: "id"
  327. },
  328. rules: [{
  329. required: true,
  330. message: "请选择楼栋",
  331. trigger: "blur"
  332. }],
  333. hide: true,
  334. viewDisplay: false
  335. },
  336. {
  337. label: "所属单元",
  338. prop: "unitName",
  339. addDisplay: false,
  340. editDisplay: false,
  341. },
  342. {
  343. label: "所属单元",
  344. prop: "unitId",
  345. type: "select",
  346. // slot:true,
  347. search: true,
  348. cascaderItem: ['floorId'],
  349. dicUrl: "/api/cyzh-community/unit/list?buildingId={{key}}&size=500",
  350. dicFormatter:(res)=>{
  351. return res.data.records;//返回字典的层级结构
  352. },
  353. // dicFlag: false,
  354. // filterable: true,
  355. props: {
  356. label: "name",
  357. value: "id"
  358. },
  359. rules: [{
  360. required: true,
  361. message: "请选择单元",
  362. trigger: "blur"
  363. }],
  364. hide: true,
  365. viewDisplay: false
  366. },
  367. {
  368. label: "所属楼层",
  369. prop: "floorName",
  370. addDisplay: false,
  371. editDisplay: false,
  372. },
  373. {
  374. label: "所属楼层",
  375. prop: "floorId",
  376. type: "select",
  377. // slot:true,
  378. search: true,
  379. cascaderItem: ['roomId'],
  380. dicUrl: "/api/cyzh-community/floor/list?unitId={{key}}&size=100",
  381. dicFormatter:(res)=>{
  382. return res.data.records;//返回字典的层级结构
  383. },
  384. // dicFlag: false,
  385. filterable: true,
  386. props: {
  387. label: "name",
  388. value: "id"
  389. },
  390. rules: [{
  391. required: true,
  392. message: "请选择楼层d",
  393. trigger: "blur"
  394. }],
  395. hide: true,
  396. viewDisplay: false
  397. },
  398. {
  399. label: "所属房间",
  400. prop: "roomName",
  401. addDisplay: false,
  402. editDisplay: false,
  403. },
  404. {
  405. label: "所属房间",
  406. prop: "roomId",
  407. type: "select",
  408. // slot:true,
  409. search: true,
  410. dicUrl: "/api/cyzh-community/room/list?floorId={{key}}&size=500&current=1",
  411. dicFormatter:(res)=>{
  412. return res.data.records;//返回字典的层级结构
  413. },
  414. // dicFlag: false,
  415. filterable: true,
  416. props: {
  417. label: "name",
  418. value: "id"
  419. },
  420. rules: [{
  421. required: true,
  422. message: "请选择房间",
  423. trigger: "blur"
  424. }],
  425. hide: true,
  426. viewDisplay: false
  427. },
  428. {
  429. label:'手机号码',
  430. prop:'phone',
  431. width:120,
  432. rules: [{
  433. required: true,
  434. message: "请输入手机号码",
  435. trigger: "blur"
  436. },{
  437. validator: validatePhone,
  438. trigger: "blur"
  439. }]
  440. },
  441. {
  442. label: "生日",
  443. prop: "birthday",
  444. type:'date',
  445. valueFormat:"yyyy-MM-dd",
  446. hide: true,
  447. rules: [{
  448. required: false,
  449. message: "请输入生日",
  450. trigger: "blur"
  451. }]
  452. },
  453. // {
  454. // label: "民族",
  455. // prop: "nation",
  456. // hide:true,
  457. // rules: [{
  458. // required: true,
  459. // message: "请输入民族",
  460. // trigger: "blur"
  461. // }]
  462. // },
  463. {
  464. label: "民族",
  465. prop: "nation",
  466. type:'select',
  467. dicData:DIC.VALUE,
  468. filterable:true,
  469. // searchFilterable:true,
  470. hide:true,
  471. rules: [{
  472. required: true,
  473. message: "请输入民族",
  474. trigger: "blur"
  475. }]
  476. },
  477. {
  478. label: "籍贯",
  479. prop: "nativePlace",
  480. hide:true,
  481. rules: [{
  482. required: false,
  483. message: "请输入籍贯",
  484. trigger: "blur"
  485. }]
  486. },
  487. {
  488. label: "国籍",
  489. prop: "nationality",
  490. hide:true,
  491. type:'select',
  492. dataType:'number',
  493. dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationality",
  494. props: {
  495. label: "dictValue",
  496. value: "dictKey"
  497. },
  498. rules: [{
  499. required: false,
  500. message: "请输入国籍",
  501. trigger: "blur"
  502. }]
  503. },
  504. {
  505. label: "政治面貌",
  506. prop: "political",
  507. hide:true,
  508. type: 'select',
  509. dataType:"number",
  510. dicUrl: "/api/blade-system/dict-biz/dictionary?code=political",
  511. props: {
  512. label: "dictValue",
  513. value: "dictKey"
  514. },
  515. rules: [{
  516. required: false,
  517. message: "请选择政治面貌",
  518. trigger: "blur"
  519. }]
  520. },
  521. {
  522. label: "婚姻状况",
  523. prop: "maritalStatus",
  524. type: 'select',
  525. dataType:"number",
  526. hide:true,
  527. dicUrl: "/api/blade-system/dict-biz/dictionary?code=marital-status",
  528. props: {
  529. label: "dictValue",
  530. value: "dictKey"
  531. },
  532. rules: [{
  533. required: false,
  534. message: "请选择婚姻状况",
  535. trigger: "blur"
  536. }]
  537. },
  538. {
  539. label: "教育水平",
  540. prop: "educationalLevel",
  541. hide:true,
  542. type: 'select',
  543. dataType:"number",
  544. dicUrl: "/api/blade-system/dict-biz/dictionary?code=educational-level",
  545. props: {
  546. label: "dictValue",
  547. value: "dictKey"
  548. },
  549. rules: [{
  550. required: false,
  551. message: "请选择教育水平",
  552. trigger: "blur"
  553. }]
  554. },
  555. {
  556. label: "工作单位",
  557. prop: "workplace",
  558. hide:true,
  559. rules: [{
  560. required: false,
  561. message: "请输入工作单位",
  562. trigger: "blur"
  563. }]
  564. },
  565. {
  566. label: "小程序openId",
  567. prop: "openId",
  568. hide: true,
  569. display: false,
  570. rules: [{
  571. required: false,
  572. message: "请输入小程序openId",
  573. trigger: "blur"
  574. }]
  575. },
  576. {
  577. label: "邮箱",
  578. prop: "email",
  579. hide:true,
  580. rules: [{
  581. required: false,
  582. message: "请输入邮箱",
  583. trigger: "blur"
  584. }]
  585. },
  586. {
  587. label:"是否会员",
  588. prop:'isMember',
  589. type:"select",
  590. hide:true,
  591. dataType:'number',
  592. dicData:[
  593. {
  594. label:'是',
  595. value:1
  596. },{
  597. label:'否',
  598. value:0
  599. },{
  600. label:'暂无',
  601. value:-1
  602. }
  603. ],
  604. },
  605. {
  606. label: "人员标签",
  607. prop: "tags",
  608. type:'checkbox',
  609. search:true,
  610. multiple:true,
  611. span: 24,
  612. dataType:'string',
  613. dicUrl: "/api/blade-system/dict-biz/dictionary?code=person-tag",
  614. props: {
  615. label: "dictValue",
  616. value: "dictKey"
  617. },
  618. rules: [{
  619. required: false,
  620. message: "请输入标签",
  621. trigger: "blur"
  622. }]
  623. },
  624. {
  625. label: "审核状态",
  626. prop: "remark",
  627. hide:true,
  628. rules: [{
  629. required: false,
  630. message: "请输入备注",
  631. trigger: "blur"
  632. }]
  633. },
  634. {
  635. label: "备注",
  636. prop: "remark",
  637. hide:true,
  638. rules: [{
  639. required: false,
  640. message: "请输入备注",
  641. trigger: "blur"
  642. }]
  643. },
  644. /*{
  645. label:'创建时间',
  646. prop:'createTime',
  647. type:"datetime",
  648. span:12,
  649. search:true,
  650. valueFormat: 'yyyy-MM-dd HH:mm:ss',
  651. format: 'yyyy-MM-dd HH:mm:ss',
  652. defaultTime:['2020-1-1 00:00:00','2021-6-30 23:59:59'],
  653. // dateDefault: true,
  654. // searchValue:['2020-1-1 00:00:00','2021-6-30 23:59:59'],
  655. searchRange:true,
  656. searchClearable: false,
  657. rules: [{
  658. required: false,
  659. message: "请输入创建时间",
  660. trigger: "blur"
  661. }]
  662. }*/
  663. ]
  664. },
  665. data: []
  666. };
  667. },
  668. watch:{
  669. 'form.type'(value){
  670. if(value == 0){
  671. this.findObject(this.option.column, "idCard").rules[0].required = true;
  672. }else{
  673. this.findObject(this.option.column, "idCard").rules[0].required = false;
  674. }
  675. }
  676. },
  677. computed: {
  678. ...mapGetters(["permission"]),
  679. permissionList() {
  680. return {
  681. addBtn: this.vaildData(this.permission.basicinfo_add, false),
  682. viewBtn: this.vaildData(this.permission.basicinfo_view, false),
  683. delBtn: this.vaildData(this.permission.basicinfo_delete, false),
  684. editBtn: this.vaildData(this.permission.basicinfo_edit, false)
  685. };
  686. },
  687. ids() {
  688. let ids = [];
  689. this.selectionList.forEach(ele => {
  690. ids.push(ele.id);
  691. });
  692. return ids.join(",");
  693. }
  694. },
  695. methods: {
  696. selectCallback(row){
  697. this.form.residentialId = row.id;
  698. this.form.residentialName = row.name;
  699. let buildingProp = this.findObject(this.option.column, "buildingId");
  700. if (buildingProp.prop == 'buildingId' && buildingProp.dicUrl.indexOf('residentialId') == -1){
  701. buildingProp.dicUrl += '?residentialId=' + this.form.residentialId + '&size=100';
  702. }
  703. },
  704. tagsFormOpen(type,row) {
  705. this.basicData = row;
  706. switch (type) {
  707. case 'elder':
  708. this.elderTags = true;
  709. break;
  710. case 'disabler':
  711. this.disablerTags = true;
  712. break;
  713. case 'keyPerson':
  714. this.keyPersonTags = true;
  715. break;
  716. // case 'household':
  717. // this.householdTags = true;
  718. // break;
  719. // case 'enterpriseStaff':
  720. // this.enterpriseStaffTags = true;
  721. // break;
  722. }
  723. },
  724. tagsDetail(type,row){
  725. this.basicData = row;
  726. switch (type) {
  727. case '高龄老人':
  728. this.elderTagsdetail = true;
  729. break;
  730. case '残障人士':
  731. this.disablerTagsdetail = true;
  732. break;
  733. case '重点人员':
  734. this.keyPersonTagsdetail = true;
  735. break;
  736. // case '常住人员':
  737. // this.householdTagsdetail = true;
  738. // break;
  739. // case '企业员工':
  740. // this.enterpriseStaffTagsdetail = true;
  741. // break;
  742. }
  743. },
  744. rowSave(row, done, loading) {
  745. row.agencyName = row.$agencyId;
  746. // row.residentialName = row.$residentialId;
  747. row.buildingName = row.$buildingId;
  748. row.unitName = row.$unitId;
  749. row.floorName = row.$floorId;
  750. row.roomName = row.$roomId;
  751. if (row.tags.length == 0) {
  752. row.tags = '';
  753. }
  754. add(row).then(() => {
  755. this.onLoad(this.page);
  756. this.$message({
  757. type: "success",
  758. message: "操作成功!"
  759. });
  760. done();
  761. }, error => {
  762. loading();
  763. window.console.log(error);
  764. });
  765. },
  766. exist(num, arr1) {
  767. for (var j = 0; j < arr1.length; j++) {
  768. if (num === arr1[j]) {
  769. return false; //如果传过来的元素在arr1中能找到相匹配的元素,我们返回fasle
  770. }
  771. }
  772. return true; //如果不能找到相匹配的元素,返回true
  773. },
  774. rowUpdate(row, index, done, loading) {
  775. row.agencyName = row.$agencyId;
  776. // row.residentialName = row.$residentialId;
  777. row.buildingName = row.$buildingId;
  778. row.unitName = row.$unitId;
  779. row.floorName = row.$floorId;
  780. row.roomName = row.$roomId;
  781. if (row.tags.length == 0) {
  782. row.tags = '';
  783. }
  784. if (this.oldForm.tags!=null){
  785. let oldtags = this.oldForm.tags.split(",");
  786. let utags = row.tags.split(",");
  787. let len = oldtags.length;
  788. for(let i = 0;i < len;i++){
  789. if (this.exist(oldtags[i],utags)){
  790. this.delTags.push(oldtags[i]);
  791. }
  792. }
  793. }
  794. if (this.delTags.length!=0){
  795. this.confirmInfo = "修改将删除"+this.delTags.toString()+"标签,确认修改?";
  796. }else {
  797. this.confirmInfo = "确认修改?";
  798. }
  799. this.$confirm(this.confirmInfo, {
  800. confirmButtonText: "确定",
  801. cancelButtonText: "取消",
  802. type: "warning"
  803. }).then(()=> {
  804. update(row).then(() => {
  805. this.onLoad(this.page);
  806. this.$message({
  807. type: "success",
  808. message: "操作成功!"
  809. });
  810. done();
  811. }, error => {
  812. loading();
  813. console.log(error);
  814. })});
  815. },
  816. rowDel(row) {
  817. this.$confirm("确定将选择数据删除?", {
  818. confirmButtonText: "确定",
  819. cancelButtonText: "取消",
  820. type: "warning"
  821. })
  822. .then(() => {
  823. return remove(row.id);
  824. })
  825. .then(() => {
  826. this.onLoad(this.page);
  827. this.$message({
  828. type: "success",
  829. message: "操作成功!"
  830. });
  831. });
  832. },
  833. handleDelFace(row) {
  834. if (this.selectionList.length === 0) {
  835. this.$message.warning("请选择至少一条数据");
  836. return;
  837. }
  838. this.$confirm("确定要删除选择的人脸?", {
  839. confirmButtonText: "确定",
  840. cancelButtonText: "取消",
  841. type: "warning"
  842. })
  843. .then(() => {
  844. return delFace(this.ids);
  845. })
  846. .then(() => {
  847. this.onLoad(this.page);
  848. this.$message({
  849. type: "success",
  850. message: "操作成功!"
  851. });
  852. });
  853. },
  854. handleDelete() {
  855. if (this.selectionList.length === 0) {
  856. this.$message.warning("请选择至少一条数据");
  857. return;
  858. }
  859. this.$confirm("确定将选择数据删除?", {
  860. confirmButtonText: "确定",
  861. cancelButtonText: "取消",
  862. type: "warning"
  863. })
  864. .then(() => {
  865. return remove(this.ids);
  866. })
  867. .then(() => {
  868. this.onLoad(this.page);
  869. this.$message({
  870. type: "success",
  871. message: "操作成功!"
  872. });
  873. this.$refs.crud.toggleSelection();
  874. });
  875. },
  876. beforeOpen(done, type) {
  877. this.residentialDisabled = false;
  878. if (["edit", "view"].includes(type)) {
  879. this.residentialDisabled = true;
  880. getDetail(this.form.id).then(res => {
  881. this.form = res.data.data;
  882. this.oldForm = res.data.data;
  883. });
  884. }
  885. done();
  886. },
  887. searchReset() {
  888. this.query = {};
  889. this.onLoad(this.page);
  890. },
  891. searchChange(params, done) {
  892. this.query = params;
  893. this.page.currentPage = 1;
  894. console.log(params,"搜索条件参数");
  895. this.onLoad(this.page, params);
  896. done();
  897. },
  898. selectionChange(list) {
  899. this.selectionList = list;
  900. },
  901. selectionClear() {
  902. this.selectionList = [];
  903. this.$refs.crud.toggleSelection();
  904. },
  905. currentChange(currentPage){
  906. this.page.currentPage = currentPage;
  907. },
  908. sizeChange(pageSize){
  909. this.page.pageSize = pageSize;
  910. },
  911. refreshChange() {
  912. this.onLoad(this.page, this.query);
  913. },
  914. onLoad(page, params = {}) {
  915. this.loading = true;
  916. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  917. const data = res.data.data;
  918. this.page.total = data.total;
  919. this.data = data.records;
  920. this.loading = false;
  921. this.selectionClear();
  922. });
  923. }
  924. }
  925. };
  926. </script>
  927. <style>
  928. </style>