basicinfo.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  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: "residentialId",
  274. type: "select",
  275. search: true,
  276. searchFilterable: true,
  277. // cascaderItem: ['buildingId'],
  278. dicUrl: "/api/cyzh-community/residential/list",
  279. dicFormatter:(res)=>{
  280. return res.data.records;//返回字典的层级结构
  281. },
  282. // dicFlag: false,
  283. filterable: true,
  284. formslot: true,
  285. props: {
  286. label: "name",
  287. value: "id"
  288. },
  289. rules: [{
  290. required: true,
  291. message: "请选择所属小区",
  292. trigger: "blur"
  293. }],
  294. hide: true,
  295. viewDisplay: false
  296. },
  297. {
  298. label: "所属楼栋",
  299. prop: "buildingName",
  300. addDisplay: false,
  301. editDisplay: false,
  302. },
  303. {
  304. label: "所属楼栋",
  305. prop: "buildingId",
  306. type: "select",
  307. // slot:true,
  308. search: true,
  309. cascaderItem: ['unitId'],
  310. // dicUrl: "/api/cyzh-community/building/list?residentialId={{key}}&size=100",
  311. dicUrl: "/api/cyzh-community/building/list",
  312. dicFormatter:(res)=>{
  313. return res.data.records;//返回字典的层级结构
  314. },
  315. // dicFlag: true,
  316. // filterable: true,
  317. props: {
  318. label: "name",
  319. value: "id"
  320. },
  321. rules: [{
  322. required: true,
  323. message: "请选择楼栋",
  324. trigger: "blur"
  325. }],
  326. hide: true,
  327. viewDisplay: false
  328. },
  329. {
  330. label: "所属单元",
  331. prop: "unitName",
  332. addDisplay: false,
  333. editDisplay: false,
  334. },
  335. {
  336. label: "所属单元",
  337. prop: "unitId",
  338. type: "select",
  339. // slot:true,
  340. search: true,
  341. cascaderItem: ['floorId'],
  342. dicUrl: "/api/cyzh-community/unit/list?buildingId={{key}}&size=500",
  343. dicFormatter:(res)=>{
  344. return res.data.records;//返回字典的层级结构
  345. },
  346. // dicFlag: false,
  347. // filterable: true,
  348. props: {
  349. label: "name",
  350. value: "id"
  351. },
  352. rules: [{
  353. required: true,
  354. message: "请选择单元",
  355. trigger: "blur"
  356. }],
  357. hide: true,
  358. viewDisplay: false
  359. },
  360. {
  361. label: "所属楼层",
  362. prop: "floorName",
  363. addDisplay: false,
  364. editDisplay: false,
  365. },
  366. {
  367. label: "所属楼层",
  368. prop: "floorId",
  369. type: "select",
  370. // slot:true,
  371. search: true,
  372. cascaderItem: ['roomId'],
  373. dicUrl: "/api/cyzh-community/floor/list?unitId={{key}}&size=100",
  374. dicFormatter:(res)=>{
  375. return res.data.records;//返回字典的层级结构
  376. },
  377. // dicFlag: false,
  378. filterable: true,
  379. props: {
  380. label: "name",
  381. value: "id"
  382. },
  383. rules: [{
  384. required: true,
  385. message: "请选择楼层d",
  386. trigger: "blur"
  387. }],
  388. hide: true,
  389. viewDisplay: false
  390. },
  391. {
  392. label: "所属房间",
  393. prop: "roomName",
  394. addDisplay: false,
  395. editDisplay: false,
  396. },
  397. {
  398. label: "所属房间",
  399. prop: "roomId",
  400. type: "select",
  401. // slot:true,
  402. search: true,
  403. dicUrl: "/api/cyzh-community/room/list?floorId={{key}}&size=500&current=1",
  404. dicFormatter:(res)=>{
  405. return res.data.records;//返回字典的层级结构
  406. },
  407. // dicFlag: false,
  408. filterable: true,
  409. props: {
  410. label: "name",
  411. value: "id"
  412. },
  413. rules: [{
  414. required: true,
  415. message: "请选择房间",
  416. trigger: "blur"
  417. }],
  418. hide: true,
  419. viewDisplay: false
  420. },
  421. {
  422. label:'手机号码',
  423. prop:'phone',
  424. width:120,
  425. rules: [{
  426. required: true,
  427. message: "请输入手机号码",
  428. trigger: "blur"
  429. },{
  430. validator: validatePhone,
  431. trigger: "blur"
  432. }]
  433. },
  434. {
  435. label: "生日",
  436. prop: "birthday",
  437. type:'date',
  438. valueFormat:"yyyy-MM-dd",
  439. hide: true,
  440. rules: [{
  441. required: false,
  442. message: "请输入生日",
  443. trigger: "blur"
  444. }]
  445. },
  446. // {
  447. // label: "民族",
  448. // prop: "nation",
  449. // hide:true,
  450. // rules: [{
  451. // required: true,
  452. // message: "请输入民族",
  453. // trigger: "blur"
  454. // }]
  455. // },
  456. {
  457. label: "民族",
  458. prop: "nation",
  459. type:'select',
  460. dicData:DIC.VALUE,
  461. filterable:true,
  462. // searchFilterable:true,
  463. hide:true,
  464. rules: [{
  465. required: true,
  466. message: "请输入民族",
  467. trigger: "blur"
  468. }]
  469. },
  470. {
  471. label: "籍贯",
  472. prop: "nativePlace",
  473. hide:true,
  474. rules: [{
  475. required: false,
  476. message: "请输入籍贯",
  477. trigger: "blur"
  478. }]
  479. },
  480. {
  481. label: "国籍",
  482. prop: "nationality",
  483. hide:true,
  484. type:'select',
  485. dataType:'number',
  486. dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationality",
  487. props: {
  488. label: "dictValue",
  489. value: "dictKey"
  490. },
  491. rules: [{
  492. required: false,
  493. message: "请输入国籍",
  494. trigger: "blur"
  495. }]
  496. },
  497. {
  498. label: "政治面貌",
  499. prop: "political",
  500. hide:true,
  501. type: 'select',
  502. dataType:"number",
  503. dicUrl: "/api/blade-system/dict-biz/dictionary?code=political",
  504. props: {
  505. label: "dictValue",
  506. value: "dictKey"
  507. },
  508. rules: [{
  509. required: false,
  510. message: "请选择政治面貌",
  511. trigger: "blur"
  512. }]
  513. },
  514. {
  515. label: "婚姻状况",
  516. prop: "maritalStatus",
  517. type: 'select',
  518. dataType:"number",
  519. hide:true,
  520. dicUrl: "/api/blade-system/dict-biz/dictionary?code=marital-status",
  521. props: {
  522. label: "dictValue",
  523. value: "dictKey"
  524. },
  525. rules: [{
  526. required: false,
  527. message: "请选择婚姻状况",
  528. trigger: "blur"
  529. }]
  530. },
  531. {
  532. label: "教育水平",
  533. prop: "educationalLevel",
  534. hide:true,
  535. type: 'select',
  536. dataType:"number",
  537. dicUrl: "/api/blade-system/dict-biz/dictionary?code=educational-level",
  538. props: {
  539. label: "dictValue",
  540. value: "dictKey"
  541. },
  542. rules: [{
  543. required: false,
  544. message: "请选择教育水平",
  545. trigger: "blur"
  546. }]
  547. },
  548. {
  549. label: "工作单位",
  550. prop: "workplace",
  551. hide:true,
  552. rules: [{
  553. required: false,
  554. message: "请输入工作单位",
  555. trigger: "blur"
  556. }]
  557. },
  558. {
  559. label: "小程序openId",
  560. prop: "openId",
  561. hide: true,
  562. display: false,
  563. rules: [{
  564. required: false,
  565. message: "请输入小程序openId",
  566. trigger: "blur"
  567. }]
  568. },
  569. {
  570. label: "邮箱",
  571. prop: "email",
  572. hide:true,
  573. rules: [{
  574. required: false,
  575. message: "请输入邮箱",
  576. trigger: "blur"
  577. }]
  578. },
  579. {
  580. label:"是否会员",
  581. prop:'isMember',
  582. type:"select",
  583. hide:true,
  584. dataType:'number',
  585. dicData:[
  586. {
  587. label:'是',
  588. value:1
  589. },{
  590. label:'否',
  591. value:0
  592. },{
  593. label:'暂无',
  594. value:-1
  595. }
  596. ],
  597. },
  598. {
  599. label: "人员标签",
  600. prop: "tags",
  601. type:'checkbox',
  602. search:true,
  603. multiple:true,
  604. span: 24,
  605. dataType:'string',
  606. dicUrl: "/api/blade-system/dict-biz/dictionary?code=person-tag",
  607. props: {
  608. label: "dictValue",
  609. value: "dictKey"
  610. },
  611. rules: [{
  612. required: false,
  613. message: "请输入标签",
  614. trigger: "blur"
  615. }]
  616. },
  617. {
  618. label: "备注",
  619. prop: "remark",
  620. hide:true,
  621. rules: [{
  622. required: false,
  623. message: "请输入备注",
  624. trigger: "blur"
  625. }]
  626. },
  627. /*{
  628. label:'创建时间',
  629. prop:'createTime',
  630. type:"datetime",
  631. span:12,
  632. search:true,
  633. valueFormat: 'yyyy-MM-dd HH:mm:ss',
  634. format: 'yyyy-MM-dd HH:mm:ss',
  635. defaultTime:['2020-1-1 00:00:00','2021-6-30 23:59:59'],
  636. // dateDefault: true,
  637. // searchValue:['2020-1-1 00:00:00','2021-6-30 23:59:59'],
  638. searchRange:true,
  639. searchClearable: false,
  640. rules: [{
  641. required: false,
  642. message: "请输入创建时间",
  643. trigger: "blur"
  644. }]
  645. }*/
  646. ]
  647. },
  648. data: []
  649. };
  650. },
  651. watch:{
  652. 'form.type'(value){
  653. if(value == 0){
  654. this.findObject(this.option.column, "idCard").rules[0].required = true;
  655. }else{
  656. this.findObject(this.option.column, "idCard").rules[0].required = false;
  657. }
  658. }
  659. },
  660. computed: {
  661. ...mapGetters(["permission"]),
  662. permissionList() {
  663. return {
  664. addBtn: this.vaildData(this.permission.basicinfo_add, false),
  665. viewBtn: this.vaildData(this.permission.basicinfo_view, false),
  666. delBtn: this.vaildData(this.permission.basicinfo_delete, false),
  667. editBtn: this.vaildData(this.permission.basicinfo_edit, false)
  668. };
  669. },
  670. ids() {
  671. let ids = [];
  672. this.selectionList.forEach(ele => {
  673. ids.push(ele.id);
  674. });
  675. return ids.join(",");
  676. }
  677. },
  678. methods: {
  679. selectCallback(row){
  680. this.form.residentialId = row.id;
  681. this.form.residentialName = row.name;
  682. let buildingProp = this.findObject(this.option.column, "buildingId");
  683. if (buildingProp.prop == 'buildingId' && buildingProp.dicUrl.indexOf('residentialId') == -1){
  684. buildingProp.dicUrl += '?residentialId=' + this.form.residentialId + '&size=100';
  685. }
  686. },
  687. tagsFormOpen(type,row) {
  688. this.basicData = row;
  689. switch (type) {
  690. case 'elder':
  691. this.elderTags = true;
  692. break;
  693. case 'disabler':
  694. this.disablerTags = true;
  695. break;
  696. case 'keyPerson':
  697. this.keyPersonTags = true;
  698. break;
  699. // case 'household':
  700. // this.householdTags = true;
  701. // break;
  702. // case 'enterpriseStaff':
  703. // this.enterpriseStaffTags = true;
  704. // break;
  705. }
  706. },
  707. tagsDetail(type,row){
  708. this.basicData = row;
  709. switch (type) {
  710. case '高龄老人':
  711. this.elderTagsdetail = true;
  712. break;
  713. case '残障人士':
  714. this.disablerTagsdetail = true;
  715. break;
  716. case '重点人员':
  717. this.keyPersonTagsdetail = true;
  718. break;
  719. // case '常住人员':
  720. // this.householdTagsdetail = true;
  721. // break;
  722. // case '企业员工':
  723. // this.enterpriseStaffTagsdetail = true;
  724. // break;
  725. }
  726. },
  727. rowSave(row, done, loading) {
  728. row.agencyName = row.$agencyId;
  729. // row.residentialName = row.$residentialId;
  730. row.buildingName = row.$buildingId;
  731. row.unitName = row.$unitId;
  732. row.floorName = row.$floorId;
  733. row.roomName = row.$roomId;
  734. if (row.tags.length == 0) {
  735. row.tags = '';
  736. }
  737. add(row).then(() => {
  738. this.onLoad(this.page);
  739. this.$message({
  740. type: "success",
  741. message: "操作成功!"
  742. });
  743. done();
  744. }, error => {
  745. loading();
  746. window.console.log(error);
  747. });
  748. },
  749. exist(num, arr1) {
  750. for (var j = 0; j < arr1.length; j++) {
  751. if (num === arr1[j]) {
  752. return false; //如果传过来的元素在arr1中能找到相匹配的元素,我们返回fasle
  753. }
  754. }
  755. return true; //如果不能找到相匹配的元素,返回true
  756. },
  757. rowUpdate(row, index, done, loading) {
  758. row.agencyName = row.$agencyId;
  759. // row.residentialName = row.$residentialId;
  760. row.buildingName = row.$buildingId;
  761. row.unitName = row.$unitId;
  762. row.floorName = row.$floorId;
  763. row.roomName = row.$roomId;
  764. if (row.tags.length == 0) {
  765. row.tags = '';
  766. }
  767. if (this.oldForm.tags!=null){
  768. let oldtags = this.oldForm.tags.split(",");
  769. let utags = row.tags.split(",");
  770. let len = oldtags.length;
  771. for(let i = 0;i < len;i++){
  772. if (this.exist(oldtags[i],utags)){
  773. this.delTags.push(oldtags[i]);
  774. }
  775. }
  776. }
  777. if (this.delTags.length!=0){
  778. this.confirmInfo = "修改将删除"+this.delTags.toString()+"标签,确认修改?";
  779. }else {
  780. this.confirmInfo = "确认修改?";
  781. }
  782. this.$confirm(this.confirmInfo, {
  783. confirmButtonText: "确定",
  784. cancelButtonText: "取消",
  785. type: "warning"
  786. }).then(()=> {
  787. update(row).then(() => {
  788. this.onLoad(this.page);
  789. this.$message({
  790. type: "success",
  791. message: "操作成功!"
  792. });
  793. done();
  794. }, error => {
  795. loading();
  796. console.log(error);
  797. })});
  798. },
  799. rowDel(row) {
  800. this.$confirm("确定将选择数据删除?", {
  801. confirmButtonText: "确定",
  802. cancelButtonText: "取消",
  803. type: "warning"
  804. })
  805. .then(() => {
  806. return remove(row.id);
  807. })
  808. .then(() => {
  809. this.onLoad(this.page);
  810. this.$message({
  811. type: "success",
  812. message: "操作成功!"
  813. });
  814. });
  815. },
  816. handleDelFace(row) {
  817. if (this.selectionList.length === 0) {
  818. this.$message.warning("请选择至少一条数据");
  819. return;
  820. }
  821. this.$confirm("确定要删除选择的人脸?", {
  822. confirmButtonText: "确定",
  823. cancelButtonText: "取消",
  824. type: "warning"
  825. })
  826. .then(() => {
  827. return delFace(this.ids);
  828. })
  829. .then(() => {
  830. this.onLoad(this.page);
  831. this.$message({
  832. type: "success",
  833. message: "操作成功!"
  834. });
  835. });
  836. },
  837. handleDelete() {
  838. if (this.selectionList.length === 0) {
  839. this.$message.warning("请选择至少一条数据");
  840. return;
  841. }
  842. this.$confirm("确定将选择数据删除?", {
  843. confirmButtonText: "确定",
  844. cancelButtonText: "取消",
  845. type: "warning"
  846. })
  847. .then(() => {
  848. return remove(this.ids);
  849. })
  850. .then(() => {
  851. this.onLoad(this.page);
  852. this.$message({
  853. type: "success",
  854. message: "操作成功!"
  855. });
  856. this.$refs.crud.toggleSelection();
  857. });
  858. },
  859. beforeOpen(done, type) {
  860. this.residentialDisabled = false;
  861. if (["edit", "view"].includes(type)) {
  862. this.residentialDisabled = true;
  863. getDetail(this.form.id).then(res => {
  864. this.form = res.data.data;
  865. this.oldForm = res.data.data;
  866. });
  867. }
  868. done();
  869. },
  870. searchReset() {
  871. this.query = {};
  872. this.onLoad(this.page);
  873. },
  874. searchChange(params, done) {
  875. this.query = params;
  876. this.page.currentPage = 1;
  877. console.log(params,"搜索条件参数");
  878. this.onLoad(this.page, params);
  879. done();
  880. },
  881. selectionChange(list) {
  882. this.selectionList = list;
  883. },
  884. selectionClear() {
  885. this.selectionList = [];
  886. this.$refs.crud.toggleSelection();
  887. },
  888. currentChange(currentPage){
  889. this.page.currentPage = currentPage;
  890. },
  891. sizeChange(pageSize){
  892. this.page.pageSize = pageSize;
  893. },
  894. refreshChange() {
  895. this.onLoad(this.page, this.query);
  896. },
  897. onLoad(page, params = {}) {
  898. this.loading = true;
  899. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  900. const data = res.data.data;
  901. this.page.total = data.total;
  902. this.data = data.records;
  903. this.loading = false;
  904. this.selectionClear();
  905. });
  906. }
  907. }
  908. };
  909. </script>
  910. <style>
  911. </style>