13404089107
2025-03-17 6e9a093b38788aa3ea93095ed0b33e8fc443d307
management/src/pages/party/manage/components/addAndEdit.jsx
@@ -52,12 +52,10 @@
    setAdminLevel(() => adminInfo.accountLevel)//角色权限1市级2区县3街道4社区5党员
    regionTree({}).then(res => {
      console.log('社区列表', res)
      setItems(() => res.data)
    })
    if (searchParams.get('id')) {
      getDetail(searchParams.get('id')).then(res => {
        console.log('党员详情', res)
        setUserInfo(() => res.data)
        res.data.community = [res.data.districtsCode, res.data.streetId, res.data.communityId.toString()]
        setCommunity(() => res.data.community)
@@ -75,14 +73,12 @@
        message.warning('上传图片名字不能包含英文逗号(,)');
        return Upload.LIST_IGNORE;
      }
      console.log('============================================')
      setLoading(false)
      resolve(file);
    });
  };
  const handleChange = ({ file: file, fileList: newFileList }, type) => {
    console.log(file, 'newfilelist', newFileList, 'type', type)
    if (file.status == 'error' || (file.status == 'done' && file.response.code != 200)) {
      setLoading(false)
      message.error('上传失败')
@@ -100,13 +96,11 @@
      }
      return item.url
    });
    console.log('newFileList', newFileList, 'list', list)
    setFileList(() => newFileList)
  };
  const submit = () => {
    form.validateFields().then(async (values) => {
      console.log('values', values)
      if (fileList.length == 0) {
        message.warning('请上传头像')
        return
@@ -118,7 +112,6 @@
      params.districtsCode = params.community.length == 3 ? params.community[0] : adminInfo.districtsCode
      delete params.community
      params.avatar = fileList[0].url
      console.log('params', params)
      if (searchParams.get('id')) {
        params.id = searchParams.get('id')
        let res = await Edit(params)
@@ -201,7 +194,6 @@
                    fieldNames={{ value: 'id', label: 'name' }}
                    placeholder="请选择"
                    onChange={(value, label) => {
                      console.log('value', value, '1', label)
                      setCommunity(() => label)
                    }}
                  // displayRender={(label) => label[label.length - 1]}