shuishen
2024-04-18 4522ab3fe8bd45ee753ef187448c1e884bbc601f
src/views/property/propertyCompanyDistrict.vue
@@ -10,6 +10,11 @@
          @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="{row, size}" slot="principalPhone">
        <el-button :size="size" type="text" @click="showStringDispose(row, 'principalPhoneflag')"
          v-text="textDispose(row, 'principalPhoneflag', 'principalPhone')">
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
@@ -20,7 +25,8 @@
    remove,
    update,
    add,
    getPropertyCompanyDistrict
    getPropertyCompanyDistrict,
    getPropertyCompanyList
  } from "@/api/property/propertyCompanyDistrict"
  import {
    mapGetters
@@ -58,7 +64,7 @@
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 210,
          dialogMenuPosition: 'center',
          height: "auto",
          calcHeight: 54,
          dialogWidth: 1150,
@@ -78,6 +84,7 @@
              prop: "districtName",
              search: true,
              searchSpan: 4,
              searchLabelWidth: 76,
              rules: [{
                required: true,
                message: "请输入小区名称",
@@ -92,7 +99,7 @@
              prop: "districtId",
              search: false,
              type: 'tree',
              dicUrl: `/api/blade-district/district/getDistrictTree`,
              dicUrl: `/api/blade-district/district/getDistrictTree?filterFlag=0`,
              props: {
                label: "name",
                value: "id"
@@ -124,13 +131,17 @@
            },
            {
              disabled: true,
              hide: true,
              label: '物业公司',
              prop: 'propertyCompanyId',
              type: 'tree',
              span: 12,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getPropertyCompanyList`,
              dicData: [],
              cascader: ['userId', 'principal'],
              nodeClick: (data, node, nodeComp) => {
                // this.$message.success(JSON.stringify(data))
              },
              props: {
                label: "name",
                value: "id"
@@ -144,17 +155,30 @@
            {
              width: 110,
              label: '项目经理',
              prop: 'principal',
              prop: 'principalName',
              span: 12,
              type: "tree",
              multiple: true,
              remote: true,
              // multiple: true,
              // remote: true,
              props: {
                label: 'name',
                value: 'id'
              },
              hide: true,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getUserByPropertyCompany?id={{propertyCompanyId}}`,
              // dicData: [],
              // hide: true,
              // dicUrl: `/api/blade-system/user/getUserInfoByPropertyCompanyId?propertyCompanyId={{propertyCompanyId}}&roleId=1747504028253229058`,
              change: ({
                value,
                column,
                item,
                dic
              }) => {
                this.form.principalPhone = ''
                if (value) {
                  this.form.principalPhone = item.phone
                }
              },
              rules: [{
                required: true,
                message: "请输入项目经理",
@@ -176,6 +200,7 @@
                  trigger: 'blur'
                }
              ],
              slot: true
            },
            {
              label: "物业成员",
@@ -189,7 +214,8 @@
                value: 'id'
              },
              hide: true,
              dicUrl: `/api/blade-propertyCompany/propertyCompany/getUserByPropertyCompany?id={{propertyCompanyId}}`,
              // dicData: [],
              dicUrl: `/api/blade-system/user/getUserInfoByPropertyCompanyId?propertyCompanyId={{propertyCompanyId}}&roleId=1750763073214984194`,
            },
            {
              width: 100,
@@ -234,12 +260,31 @@
                trigger: "blur",
              }, ],
            },
            {
              label: '电子合同',
              type: 'upload',
              listType: 'picture-img',
              propsHttp: {
                res: 'data',
                url: 'link',
              },
              canvasOption: {
                text: ' ',
                ratio: 0.1
              },
              action: '/api/blade-resource/oss/endpoint/put-file',
              tip: '只能上传jpg/png图片,且不超过500kb',
              span: 12,
              row: true,
              prop: 'electronicContract'
            }
          ],
        },
        data: [],
        curRoleDetails: {}
      }
    },
    watch: {},
    computed: {
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
@@ -257,8 +302,35 @@
        })
        return ids.join(",")
      },
      textDispose() {
        return (row, flag, type) => {
          if (row[flag] || row[type] == null) {
            return row[type]
          } else {
            if (type == 'principalIdCard') {
              return row[type].replace(/^(.{6})(?:\d+)(.{4})$/, "$1******$2")
            } else {
              return row[type].replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
            }
          }
        }
      }
    },
    methods: {
      showStringDispose(row, type) {
        row[type] = !row[type]
      },
      initData() {
        getPropertyCompanyList().then(res => {
          const column = this.findObject(this.option.column, "propertyCompanyId")
          column.dicData = res.data.data
          this.form.propertyCompanyId = res.data.data[0].id
        })
      },
      rowSave(row, done, loading) {
        row.userId = func.join(row.userId)
        add(row).then(
@@ -276,6 +348,7 @@
          }
        )
      },
      rowUpdate(row, index, done, loading) {
        row.userId = func.join(row.userId)
        update(row).then(
@@ -350,6 +423,10 @@
          })
      },
      beforeOpen(done, type) {
        if (["add", "edit"].includes(type)) {
          this.initData()
        }
        if (["edit", "view"].includes(type)) {
          getPropertyCompanyDistrict(this.form.id).then((res) => {
            this.form = res.data.data
@@ -385,7 +462,15 @@
        }
        this.loading = true
        getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data
          const data = {
            ...res.data.data,
            records: res.data.data.records.map(item => {
              return {
                ...item,
                'principalPhoneflag': false
              }
            })
          }
          this.page.total = data.total
          this.data = data.records
          this.loading = false
@@ -400,4 +485,4 @@
  .avue-upload__icon {
    line-height: 6;
  }
</style>
</style>