cloudroam
2025-01-09 04be125365bfd254166072f75da87e406f633ba3
pages/supplier/list.vue
@@ -26,11 +26,12 @@
          }
        },
        columns: [
          { label: '供应商ID', prop: 'id', minWidth: '120px' },
          {
            label: '供应商名称',
            prop: 'name',
            minWidth: '120px',
            fixed: 'left',
            // fixed: 'left',
          },
          { label: '供应商类型', prop: 'typeName', minWidth: '100px' },
          {
@@ -43,6 +44,7 @@
          },
          { label: '联系人', prop: 'contactName', minWidth: '100px' },
          { label: '联系方式', prop: 'contactTel', minWidth: '120px' },
          { label: '注册手机号', prop: 'registerTel', minWidth: '120px' },
          { label: '注册时间', prop: 'createTime', minWidth: '180px' },
          { label: '审核通过时间', prop: 'passTime', minWidth: '180px' },
          { label: '所属集货站', prop: 'stationName', minWidth: '120px' },
@@ -58,11 +60,31 @@
            minWidth: 120,
            fixed: 'right',
          },
          {
            label: '启用/禁用',
            formatter: (row) => (
              <el-switch
                value={row.isEnabled}
                onChange={this.onEnabledChange.bind(this, row)}
              ></el-switch>
            ),
            minWidth: 120,
            fixed: 'right',
          },
        ],
        searchForm: [
          {
            type: 'row',
            items: [
              {
                label: '供应商ID', id: 'id', type: 'input',
                rules: {
                  required: false,
                  pattern: /^\d*$/,
                  message: '请输入合法的供应商ID',
                  trigger: 'blur',
                },
              },
              { label: '供应商名称', id: 'name', type: 'input' },
              { label: '手机号', id: 'tel', type: 'input' },
              {
@@ -86,6 +108,17 @@
              {
                ...getStationListConfig(),
                label: '所属集货站',
              },
              {
                label: '启用/禁用',
                id: 'isEnabled',
                type: 'bus-select-dict',
                default: '1',
                el: {
                  code: 'USER_ENABLED_OR_DISABLED',
                  clearable: true,
                  style: 'width:100%',
                },
              },
            ],
          },
@@ -337,6 +370,24 @@
        })
        .catch(() => {})
    },
    onEnabledChange(row, e) {
      const url = 'flower/api/supplier/page/isEnable'
      const text = e ? '启用' : '禁用'
      this.$elBusUtil
        .confirm(`确定要${text}这个供应商吗?`)
        .then(async () => {
          const { code } = await this.$elBusHttp.request(url, {
            params: {
              id: row.id,
            },
          })
          if (code === 0) {
            this.$message.success(`${text}成功`)
            this.$refs.crud.getList()
          }
        })
        .catch(() => {})
    },
  },
}
</script>