Browse Source

refactor: 更新需求部分逻辑

master
wangxiang 2 years ago
parent
commit
0984f0d74d
  1. 17
      src/views/common/push/pushConcern/concern.data.ts
  2. 2
      src/views/common/push/pushFriend/friend.data.ts
  3. 4
      src/views/system/user/user.data.ts

17
src/views/common/push/pushConcern/concern.data.ts

@ -4,7 +4,7 @@ import { h } from 'vue'; @@ -4,7 +4,7 @@ import { h } from 'vue';
import { Tag, Switch } from 'ant-design-vue';
import { setDefaultType } from '/@/api/platform/common/controller/pushConcernFanType';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
const { createConfirm, createMessage } = useMessage();
/** 表格列配置 */
export const columns: BasicColumn[] = [
@ -153,27 +153,24 @@ export const pushTypeColumns = (refreshPushType: Function) => [ @@ -153,27 +153,24 @@ export const pushTypeColumns = (refreshPushType: Function) => [
unCheckedChildren: '已禁用',
loading: record.pendingStatus,
onChange(checked: boolean) {
const text = checked ? '启用' : '禁用';
createConfirm({
checked ? createConfirm({
iconType: 'warning',
title: '警告',
content: `确认要"${text}${record.name}推送类型吗?`,
content: `确认要启用${record.name}推送类型吗?`,
onOk: async () => {
record.pendingStatus = true;
const { createMessage } = useMessage();
const defaultType = checked ? '1' : '0';
setDefaultType({
id: record.id,
concernFanId: record.concernFanId,
defaultType
defaultType: '1'
}).then(() => {
refreshPushType();
createMessage.success(`${text}成功`);
createMessage.success('启用成功!');
}).catch(() => {
createMessage.error(`${text}失败`);
createMessage.error('启用失败!');
}).finally(() => record.pendingStatus = false);
}
});
}) : createMessage.error('不允许禁用!');
}
});
}

2
src/views/common/push/pushFriend/friend.data.ts

@ -17,7 +17,7 @@ export const columns: BasicColumn[] = [ @@ -17,7 +17,7 @@ export const columns: BasicColumn[] = [
customRender: ({ record }) => {
const sex = record.sex;
const enable = ~~sex === 0;
const color = enable ? 'green' : 'red';
const color = enable ? '#6AB5F9' : '#F087BD';
const text = enable ? '男' : '女';
return h(Tag, { color: color }, () => text);
}

4
src/views/system/user/user.data.ts

@ -285,7 +285,7 @@ export const userFormSchema: FormSchema[] = [ @@ -285,7 +285,7 @@ export const userFormSchema: FormSchema[] = [
colProps: {
span: 12
},
ifShow: ({values}) => values.userType == '2'
ifShow: ({values}) => values.userType == '4'
},
{
field: 'mapOrientation',
@ -299,7 +299,7 @@ export const userFormSchema: FormSchema[] = [ @@ -299,7 +299,7 @@ export const userFormSchema: FormSchema[] = [
colProps: {
span: 12
},
ifShow: ({ values }) => values.userType == '1',
ifShow: ({ values }) => values.userType == '3',
required: true,
},
{

Loading…
Cancel
Save