|
@@ -0,0 +1,152 @@
|
|
|
+import { BasicColumn, FormSchema } from '@/components/Table';
|
|
|
+import { useI18n } from '@/hooks/web/useI18n';
|
|
|
+import { formatToDateTime } from '@/utils/dateUtil';
|
|
|
+import { updateSopTask } from '@/api/wechat/sopTask';
|
|
|
+import { Switch } from 'ant-design-vue';
|
|
|
+import { h } from 'vue';
|
|
|
+
|
|
|
+const { t } = useI18n();
|
|
|
+
|
|
|
+export const columns: BasicColumn[] = [
|
|
|
+ {
|
|
|
+ title: t('wechat.sopTask.name'),
|
|
|
+ dataIndex: 'name',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // title: t('wechat.sopTask.botWxidList'),
|
|
|
+ // dataIndex: 'botWxidList',
|
|
|
+ // width: 100,
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ title: t('wechat.sopTask.type'),
|
|
|
+ dataIndex: 'type',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('wechat.sopTask.planStartTime'),
|
|
|
+ dataIndex: 'planStartTime',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('wechat.sopTask.planEndTime'),
|
|
|
+ dataIndex: 'planEndTime',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // title: t('wechat.sopTask.creatorId'),
|
|
|
+ // dataIndex: 'creatorId',
|
|
|
+ // width: 100,
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ title: t('common.status'),
|
|
|
+ dataIndex: 'status',
|
|
|
+ width: 50,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ if (!Reflect.has(record, 'pendingStatus')) {
|
|
|
+ record.pendingStatus = false;
|
|
|
+ }
|
|
|
+ return h(Switch, {
|
|
|
+ checked: record.status === 1,
|
|
|
+ checkedChildren: t('common.on'),
|
|
|
+ unCheckedChildren: t('common.off'),
|
|
|
+ loading: record.pendingStatus,
|
|
|
+ onChange(checked, _) {
|
|
|
+ record.pendingStatus = true;
|
|
|
+ const newStatus = checked ? 1 : 2;
|
|
|
+ updateSopTask({ id: record.id, status: newStatus })
|
|
|
+ .then(() => {
|
|
|
+ record.status = newStatus;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ record.pendingStatus = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('common.createTime'),
|
|
|
+ dataIndex: 'createdAt',
|
|
|
+ width: 70,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ return formatToDateTime(record.createdAt);
|
|
|
+ },
|
|
|
+ },
|
|
|
+];
|
|
|
+
|
|
|
+export const searchFormSchema: FormSchema[] = [
|
|
|
+ {
|
|
|
+ field: 'name',
|
|
|
+ label: t('wechat.sopTask.name'),
|
|
|
+ component: 'Input',
|
|
|
+ colProps: { span: 8 },
|
|
|
+ },
|
|
|
+];
|
|
|
+
|
|
|
+export const formSchema: FormSchema[] = [
|
|
|
+ {
|
|
|
+ field: 'id',
|
|
|
+ label: 'ID',
|
|
|
+ component: 'Input',
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'name',
|
|
|
+ label: t('wechat.sopTask.name'),
|
|
|
+ component: 'Input',
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'botWxidList',
|
|
|
+ label: t('wechat.sopTask.botWxidList'),
|
|
|
+ component: 'Input',
|
|
|
+ required: false,
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'type',
|
|
|
+ label: t('wechat.sopTask.type'),
|
|
|
+ component: 'RadioGroup',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ { label: t(`wechat.label_type[0]`), value: 1 },
|
|
|
+ { label: t(`wechat.label_type[1]`), value: 2 },
|
|
|
+ { label: t(`wechat.label_type[2]`), value: 3 },
|
|
|
+ { label: t(`wechat.label_type[3]`), value: 4 },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'planStartTime',
|
|
|
+ label: t('wechat.sopTask.planStartTime'),
|
|
|
+ component: 'InputNumber',
|
|
|
+ required: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'planEndTime',
|
|
|
+ label: t('wechat.sopTask.planEndTime'),
|
|
|
+ component: 'InputNumber',
|
|
|
+ required: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'creatorId',
|
|
|
+ label: t('wechat.sopTask.creatorId'),
|
|
|
+ component: 'InputNumber',
|
|
|
+ required: false,
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'status',
|
|
|
+ label: t('wechat.sopTask.status'),
|
|
|
+ component: 'RadioButtonGroup',
|
|
|
+ defaultValue: 1,
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ { label: t('common.on'), value: 1 },
|
|
|
+ { label: t('common.off'), value: 2 },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+];
|