riku
2023-12-20 f58f07875461b7cc8205978cf4f0fac86564df72
新增调试下载环信码功能
已修改9个文件
已添加1个文件
331 ■■■■ 文件已修改
package-lock.json 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/fytz/creditApi.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components.d.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/form/FYForm.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/search-option/FYOptionLocation.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/enum/location.js 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fytz/user/UserInfo.vue 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fytz/user/components/CompUserInfo.vue 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -16,6 +16,7 @@
        "element-plus": "^2.4.3",
        "pinia": "^2.0.26",
        "vue": "^3.2.45",
        "vue-i18n": "^9.8.0",
        "vue-router": "^4.1.6"
      },
      "devDependencies": {
@@ -1944,6 +1945,38 @@
      "dev": true,
      "license": "BSD-3-Clause"
    },
    "node_modules/@intlify/core-base": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.8.0.tgz",
      "integrity": "sha512-UxaSZVZ1DwqC/CltUZrWZNaWNhfmKtfyV4BJSt/Zt4Or/fZs1iFj0B+OekYk1+MRHfIOe3+x00uXGQI4PbO/9g==",
      "dependencies": {
        "@intlify/message-compiler": "9.8.0",
        "@intlify/shared": "9.8.0"
      },
      "engines": {
        "node": ">= 16"
      }
    },
    "node_modules/@intlify/message-compiler": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.8.0.tgz",
      "integrity": "sha512-McnYWhcoYmDJvssVu6QGR0shqlkJuL1HHdi5lK7fNqvQqRYaQ4lSLjYmZxwc8tRNMdIe9/KUKfyPxU9M6yCtNQ==",
      "dependencies": {
        "@intlify/shared": "9.8.0",
        "source-map-js": "^1.0.2"
      },
      "engines": {
        "node": ">= 16"
      }
    },
    "node_modules/@intlify/shared": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.8.0.tgz",
      "integrity": "sha512-TmgR0RCLjzrSo+W3wT0ALf9851iFMlVI9EYNGeWvZFUQTAJx0bvfsMlPdgVtV1tDNRiAfhkFsMKu6jtUY1ZLKQ==",
      "engines": {
        "node": ">= 16"
      }
    },
    "node_modules/@jridgewell/gen-mapping": {
      "version": "0.3.2",
      "dev": true,
@@ -2411,8 +2444,9 @@
      }
    },
    "node_modules/@vue/devtools-api": {
      "version": "6.4.5",
      "license": "MIT"
      "version": "6.5.1",
      "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.1.tgz",
      "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA=="
    },
    "node_modules/@vue/reactivity": {
      "version": "3.2.45",
@@ -7304,6 +7338,22 @@
        "eslint": ">=6.0.0"
      }
    },
    "node_modules/vue-i18n": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.8.0.tgz",
      "integrity": "sha512-Izho+6PYjejsTq2mzjcRdBZ5VLRQoSuuexvR8029h5CpN03FYqiqBrShMyf2I1DKkN6kw/xmujcbvC+4QybpsQ==",
      "dependencies": {
        "@intlify/core-base": "9.8.0",
        "@intlify/shared": "9.8.0",
        "@vue/devtools-api": "^6.5.0"
      },
      "engines": {
        "node": ">= 16"
      },
      "peerDependencies": {
        "vue": "^3.0.0"
      }
    },
    "node_modules/vue-router": {
      "version": "4.1.6",
      "license": "MIT",
@@ -8765,6 +8815,29 @@
      "version": "1.2.1",
      "dev": true
    },
    "@intlify/core-base": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-9.8.0.tgz",
      "integrity": "sha512-UxaSZVZ1DwqC/CltUZrWZNaWNhfmKtfyV4BJSt/Zt4Or/fZs1iFj0B+OekYk1+MRHfIOe3+x00uXGQI4PbO/9g==",
      "requires": {
        "@intlify/message-compiler": "9.8.0",
        "@intlify/shared": "9.8.0"
      }
    },
    "@intlify/message-compiler": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-9.8.0.tgz",
      "integrity": "sha512-McnYWhcoYmDJvssVu6QGR0shqlkJuL1HHdi5lK7fNqvQqRYaQ4lSLjYmZxwc8tRNMdIe9/KUKfyPxU9M6yCtNQ==",
      "requires": {
        "@intlify/shared": "9.8.0",
        "source-map-js": "^1.0.2"
      }
    },
    "@intlify/shared": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-9.8.0.tgz",
      "integrity": "sha512-TmgR0RCLjzrSo+W3wT0ALf9851iFMlVI9EYNGeWvZFUQTAJx0bvfsMlPdgVtV1tDNRiAfhkFsMKu6jtUY1ZLKQ=="
    },
    "@jridgewell/gen-mapping": {
      "version": "0.3.2",
      "dev": true,
@@ -9099,7 +9172,9 @@
      }
    },
    "@vue/devtools-api": {
      "version": "6.4.5"
      "version": "6.5.1",
      "resolved": "https://registry.npmmirror.com/@vue/devtools-api/-/devtools-api-6.5.1.tgz",
      "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA=="
    },
    "@vue/reactivity": {
      "version": "3.2.45",
@@ -12094,6 +12169,16 @@
        "semver": "^7.3.6"
      }
    },
    "vue-i18n": {
      "version": "9.8.0",
      "resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-9.8.0.tgz",
      "integrity": "sha512-Izho+6PYjejsTq2mzjcRdBZ5VLRQoSuuexvR8029h5CpN03FYqiqBrShMyf2I1DKkN6kw/xmujcbvC+4QybpsQ==",
      "requires": {
        "@intlify/core-base": "9.8.0",
        "@intlify/shared": "9.8.0",
        "@vue/devtools-api": "^6.5.0"
      }
    },
    "vue-router": {
      "version": "4.1.6",
      "requires": {
package.json
@@ -21,6 +21,7 @@
    "element-plus": "^2.4.3",
    "pinia": "^2.0.26",
    "vue": "^3.2.45",
    "vue-i18n": "^9.8.0",
    "vue-router": "^4.1.6"
  },
  "devDependencies": {
src/api/fytz/creditApi.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
import { $fytz } from '../index';
/**
 * ä¿¡ç”¨è¯„ä¼°API接口
 */
export default {
  /**
   * ä¸‹è½½ç”¨æˆ·çŽ¯ä¿¡ç 
   * @param {*} userId
   */
  downloadCode(userId) {
    return $fytz
      .get(`credit/ecCode/download?userId=${userId}`, { responseType: 'blob' })
      .then((res) => {
        const url = window.URL.createObjectURL(new Blob([res.data]));
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', 'creditCode.png');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        window.URL.revokeObjectURL(url);
      });
  }
};
src/api/index.js
@@ -20,7 +20,7 @@
//飞羽监管
const $fysp = axios.create({
  baseURL: ip1,
  timeout: 10000
  timeout: 20000
});
$fysp.imgUrl = `${ip1_file}images/`;
$fysp.downloadUrl = `${ip1_file}files/`;
@@ -28,7 +28,7 @@
//飞羽环境
const $fytz = axios.create({
  baseURL: ip2,
  timeout: 10000
  timeout: 20000
});
$fytz.imgUrl = `${ip2_file}images/`;
src/components.d.ts
@@ -27,6 +27,9 @@
    ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
    ElDivider: typeof import('element-plus/es')['ElDivider']
    ElDrawer: typeof import('element-plus/es')['ElDrawer']
    ElDropdown: typeof import('element-plus/es')['ElDropdown']
    ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
    ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
    ElEmpty: typeof import('element-plus/es')['ElEmpty']
    ElForm: typeof import('element-plus/es')['ElForm']
    ElFormItem: typeof import('element-plus/es')['ElFormItem']
src/components/form/FYForm.vue
@@ -108,7 +108,7 @@
}
const allRules = computed(()=>{
  return {...baseRules.value, ...props.rules}
  return {...baseRules, ...props.rules}
})
//监听表单初始数据传入
src/components/search-option/FYOptionLocation.vue
@@ -6,7 +6,7 @@
      :options="locations"
      :placeholder="placeholder"
      :props="optionProps"
      style="width: 280px"
      style="width: 320px"
    />
  </el-form-item>
</template>
@@ -51,7 +51,7 @@
  },
  computed: {
    placeholder() {
      const list = '省/市/区/镇'.split('/');
      const list = '省/市/区/镇/集/物'.split('/');
      const p = [];
      for (let i = 0; i < this.level; i++) {
        p.push(list[i]);
@@ -78,7 +78,11 @@
        dCode: null,
        dName: null,
        tCode: null,
        tName: null
        tName: null,
        aCode: null,
        aName: null,
        mCode: null,
        mName: null,
      };
      if (val.length > 0) {
        res.pCode = val[0][0];
@@ -96,6 +100,14 @@
        res.tCode = val[3][0];
        res.tName = val[3][1];
      }
      if (val.length > 4) {
        res.aCode = val[4][0];
        res.aName = val[4][1];
      }
      if (val.length > 5) {
        res.mCode = val[5][0];
        res.mName = val[5][1];
      }
      return res;
    },
    optionFormatReverse(val) {
@@ -113,6 +125,12 @@
        if (val.tName) {
          res.push([val.tCode, val.tName]);
        }
        if (val.aName) {
          res.push([val.aCode, val.aName]);
        }
        if (val.mName) {
          res.push([val.mCode, val.mName]);
        }
      }
      return res;
    }
src/enum/location.js
@@ -39,7 +39,12 @@
                { label: '高新区', value: ['310116503', '高新区'] },
                { label: '金山卫镇', value: ['310116109', '金山卫镇'] },
                { label: '漕泾镇', value: ['310116112', '漕泾镇'] },
                { label: '山阳镇', value: ['310116113', '山阳镇'] },
                { label: '山阳镇', value: ['310116113', '山阳镇'] , children:[
                  {
                    label: '万达广场',
                    value: ['31011611301', '万达广场'],
                  },
                ]},
                { label: '石化街道', value: ['310116001', '石化街道'] },
                { label: '朱泾镇', value: ['310116101', '朱泾镇'] },
                { label: '枫泾镇', value: ['310116102', '枫泾镇'] },
@@ -60,9 +65,19 @@
                { label: '枫林路街道', value: ['310104008', '枫林路街道'] },
                { label: '斜土路街道', value: ['310104007', '斜土路街道'] },
                { label: '长桥街道', value: ['310104010', '长桥街道'] },
                { label: '田林街道', value: ['310104011', '田林街道'] },
                { label: '田林街道', value: ['310104011', '田林街道'] , children:[
                  {
                    label: '田尚坊',
                    value: ['31010401101', '田尚坊'],
                  },
                ]},
                { label: '康健新村街道', value: ['310104013', '康健新村街道'] },
                { label: '徐家汇街道', value: ['310104014', '徐家汇街道'] },
                { label: '徐家汇街道', value: ['310104014', '徐家汇街道'] , children:[
                  {
                    label: '天钥桥',
                    value: ['31010401401', '天钥桥'],
                  },
                ]},
                { label: '凌云路街道', value: ['310104015', '凌云路街道'] },
                { label: '龙华街道', value: ['310104016', '龙华街道'] },
                { label: '漕河泾街道', value: ['310104017', '漕河泾街道'] },
@@ -73,18 +88,43 @@
              label: '静安区',
              value: ['310106', '静安区'],
              children: [
                { label: '大宁路街道', value: ['310106019', '大宁路街道'] },
                { label: '大宁路街道', value: ['310106019', '大宁路街道'] , children:[
                  {
                    label: '久光中心',
                    value: ['31010601901', '久光中心'],
                  },
                ]},
                { label: '彭浦新村街道', value: ['310106020', '彭浦新村街道'] },
                { label: '临汾路街道', value: ['310106021', '临汾路街道'] },
                { label: '芷江西路街道', value: ['310106022', '芷江西路街道'] },
                { label: '彭浦镇', value: ['310106101', '彭浦镇'] },
                { label: '彭浦镇', value: ['310106101', '彭浦镇'] , children:[
                  {
                    label: '大融城',
                    value: ['31010610101', '大融城'],
                  },
                ]},
                { label: '江宁路街道', value: ['310106006', '江宁路街道'] },
                { label: '石门二路街道', value: ['310106011', '石门二路街道'] },
                { label: '南京西路街道', value: ['310106012', '南京西路街道'] },
                { label: '南京西路街道', value: ['310106012', '南京西路街道'] , children:[
                  {
                    label: 'X88',
                    value: ['31010601201', 'X88'],
                  },
                ]},
                { label: '静安寺街道', value: ['310106013', '静安寺街道'] },
                { label: '曹家渡街道', value: ['310106014', '曹家渡街道'] },
                { label: '曹家渡街道', value: ['310106014', '曹家渡街道'] , children:[
                  {
                    label: '889',
                    value: ['31010601401', '889'],
                  },
                ]},
                { label: '天目西路街道', value: ['310106015', '天目西路街道'] },
                { label: '北站街道', value: ['310106016', '北站街道'] },
                { label: '北站街道', value: ['310106016', '北站街道'] , children:[
                  {
                    label: '大悦城',
                    value: ['31010601601', '大悦城'],
                  },
                ]},
                { label: '宝山路街道', value: ['310106017', '宝山路街道'] },
                { label: '共和新路街道', value: ['310106018', '共和新路街道'] },
              ],
src/views/fytz/user/UserInfo.vue
@@ -3,7 +3,7 @@
    <template #options>
      <FYOptionLocation
        :allOption="true"
        :level="4"
        :level="5"
        v-model:value="formSearch._locations"
      ></FYOptionLocation>
      <FYOptionText
@@ -36,41 +36,57 @@
        </template>
      </el-table-column>
      <el-table-column prop="userInfo.acountname" label="账号" width="110" />
      <el-table-column prop="sceneTypeName" label="类型" width="130" />
      <el-table-column prop="biProvinceName" label="省" width="90" />
      <el-table-column prop="biCityName" label="市" width="90" />
      <el-table-column prop="sceneTypeName" label="类型" width="100" />
      <el-table-column prop="biProvinceName" label="省" width="80" />
      <el-table-column prop="biCityName" label="市" width="80" />
      <!-- <el-table-column prop="districtname" label="区县" width="90" /> -->
      <el-table-column prop="userInfo.extension1" label="区县" width="90" />
      <el-table-column prop="userInfo.extension1" label="区县" width="80" />
      <el-table-column prop="biTownName" label="街道" width="110" />
      <el-table-column prop="biArea" label="集中区" width="110" />
      <el-table-column prop="biManagementCompany" label="物业" min-width="110" />
      <el-table-column prop="userInfo.isenable" label="状态" width="90">
        <template #default="scope">
          {{ scope.row.userInfo.isenable ? '上线中' : '已下线' }}
        <template #default="{ row }">
          {{ row.userInfo.isenable ? '上线中' : '已下线' }}
        </template>
      </el-table-column>
      <el-table-column prop="userInfo.usertype" label="用户类型" width="90" />
      <el-table-column fixed="right" align="right" label="操作" width="160">
      <el-table-column fixed="right" align="right" label="操作" width="190">
        <template #header>
          <el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true"
            >新增用户</el-button
          >
        </template>
        <template #default="scope">
          <el-button
            :loading="scope.row.loading1"
            type="primary"
            size="small"
            @click="editRow(scope)"
        <template #default="{ row }">
          <el-space>
            <!-- <el-button :loading="row.loading1" type="primary" size="small" @click="editRow(row)"
            >查看</el-button
          >
            > -->
          <el-button
            :loading="scope.row.loading2"
            :type="scope.row.userInfo.isenable != '0' ? 'danger' : 'primary'"
              :loading="row.loading2"
              :type="row.userInfo.isenable != '0' ? 'danger' : 'primary'"
            size="small"
            @click="itemActive(scope)"
            >{{ scope.row.userInfo.isenable != '0' ? '下线' : '上线' }}</el-button
              @click="itemActive(row)"
              >{{ row.userInfo.isenable != '0' ? '下线' : '上线' }}</el-button
          >
            <el-dropdown
              split-button
              :loading="row.loading1"
              size="small"
              type="primary"
              @click="editRow(row)"
              @command="handleCommand"
              trigger="click"
            >
              æŸ¥çœ‹
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item icon="Download" :command="{ c: 1, p: row }"
                    >下载环信码</el-dropdown-item
                  >
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </el-space>
        </template>
      </el-table-column>
    </template>
@@ -80,6 +96,7 @@
<script>
import userApi from '@/api/fytz/userApi';
import creditApi from '@/api/fytz/creditApi';
import { useLoadingStore } from '@/stores/loadingStore';
import { mapStores } from 'pinia';
import { useMessageBoxTip } from '@/composables/messageBox';
@@ -139,37 +156,49 @@
        }
      });
    },
    editRow(scope) {
      scope.row.loading1 = true;
      this.loadingStore.pushLoading(() => (scope.row.loading1 = false));
      this.$router.push(`userEdit/${scope.row.userInfo.guid}`);
    editRow(row) {
      row.loading1 = true;
      this.loadingStore.pushLoading(() => (row.loading1 = false));
      this.$router.push(`userEdit/${row.userInfo.guid}`);
    },
    itemActive(scope) {
    itemActive(row) {
      const param = {
        guid: scope.row.userInfo.guid,
        isenable: !scope.row.userInfo.isenable
        guid: row.userInfo.guid,
        isenable: !row.userInfo.isenable
      };
      const msg = scope.row.userInfo.isenable ? '下线' : '上线';
      const msg = row.userInfo.isenable ? '下线' : '上线';
      useMessageBoxTip({
        confirmMsg: `确认${msg}该场景?`,
        confirmTitle: msg,
        onConfirm: async () => {
          scope.row.loading2 = true;
          row.loading2 = true;
          return userApi
            .updateUserInfo(param)
            .then((res) => {
              if (res.success) {
                scope.row.userInfo.isenable = param.isenable;
                row.userInfo.isenable = param.isenable;
              }
            })
            .finally(() => {
              scope.row.loading2 = false;
              row.loading2 = false;
            });
        }
      });
    },
    tableRowClassName({ row }) {
      return row.userInfo.isenable ? 'online-row' : 'offline-row';
    },
    handleCommand(e){
      const userId = e.p.userInfo.guid
      switch (e.c) {
        // ä¸‹è½½çŽ¯ä¿¡ç 
        case 1:
          creditApi.downloadCode(userId)
          break;
        default:
          break;
      }
    }
  }
};
src/views/fytz/user/components/CompUserInfo.vue
@@ -68,8 +68,8 @@
        v-if="create"
        prop="_locations"
        :allOption="false"
        :level="4"
        :checkStrictly="false"
        :level="5"
        :checkStrictly="true"
        :initValue="false"
        v-model:value="formObj._locations"
      ></FYOptionLocation>
@@ -149,14 +149,7 @@
function parseUserInfoReverse(formObj) {
  // è¡Œæ”¿åŒºåˆ’信息填充
  const a = formObj.value._locations;
  formObj.value.provincecode = a.pCode;
  formObj.value.provincename = a.pName;
  formObj.value.citycode = a.cCode;
  formObj.value.cityname = a.cName;
  formObj.value.districtcode = a.dCode;
  formObj.value.extension1 = a.dName;
  formObj.value.towncode = a.tCode;
  formObj.value.townname = a.tName;
  // ç”¨æˆ·ç±»åž‹ä¿¡æ¯å¡«å……
  const b = formObj.value._usertype;
  formObj.value.usertypeid = b.value;
@@ -170,21 +163,22 @@
}
function createUser(formObj, success, fail) {
  const l = formObj.value._locations;
  const params = {
    userInfo: formObj.value,
    baseInfo: {
      biProvinceCode: formObj.value.provincecode,
      biProvinceName: formObj.value.provincename,
      biCityCode: formObj.value.citycode,
      biCityName: formObj.value.cityname,
      biDistrictCode: formObj.value.districtcode,
      biDistrictName: formObj.value.extension1,
      biTownCode: formObj.value.towncode,
      biTownName: formObj.value.townname
      // biAreaCode
      // biArea
      // biManagementCompanyId
      // biManagementCompany
      biProvinceCode: l.pCode,
      biProvinceName: l.pName,
      biCityCode: l.cCode,
      biCityName: l.cName,
      biDistrictCode: l.dCode,
      biDistrictName: l.dName,
      biTownCode: l.tCode,
      biTownName: l.tName,
      biAreaCode: l.aCode,
      biArea: l.aName,
      // biManagementCompanyId:
      // biManagementCompany:
      // biContact
      // biTelephone
      // biAddress