fix: 修改bug
This commit is contained in:
parent
e0c9fa623a
commit
439ac44e7e
|
@ -74,6 +74,7 @@
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div>运行结果</div>
|
<div>运行结果</div>
|
||||||
|
<div v-if="virtualRule?.script && !isBeginning">正在运行......</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<div v-if="virtualRule?.script">
|
<div v-if="virtualRule?.script">
|
||||||
|
@ -127,6 +128,7 @@ type propertyType = {
|
||||||
last?: string;
|
last?: string;
|
||||||
};
|
};
|
||||||
const property = ref<propertyType[]>([]);
|
const property = ref<propertyType[]>([]);
|
||||||
|
// virtualRule?.rule?.windowType === 'undefined' ? moment(item.time).format('HH:mm:ss')
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -613,6 +613,7 @@ const onPlatError = (val: any) => {
|
||||||
_errorSet.value.add(val)
|
_errorSet.value.add(val)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const _validator = (_rule: any, value: string): Promise<any> =>
|
const _validator = (_rule: any, value: string): Promise<any> =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
const _item = productList.value.find((item) => item.id === value);
|
const _item = productList.value.find((item) => item.id === value);
|
||||||
|
@ -657,7 +658,7 @@ watch(
|
||||||
async (newId) => {
|
async (newId) => {
|
||||||
if (newId) {
|
if (newId) {
|
||||||
queryRegionsList();
|
queryRegionsList();
|
||||||
getProduct();
|
await getProduct();
|
||||||
if (newId === ':id' || !newId) return;
|
if (newId === ':id' || !newId) return;
|
||||||
const resp = await detail(newId as string);
|
const resp = await detail(newId as string);
|
||||||
const _data: any = resp.result;
|
const _data: any = resp.result;
|
||||||
|
|
|
@ -17,60 +17,66 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PropType } from "vue";
|
import { PropType } from 'vue';
|
||||||
import { Form } from 'jetlinks-ui-components';
|
import { Form } from 'jetlinks-ui-components';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Array as PropType<any[]>,
|
type: Array as PropType<any[]>,
|
||||||
default: () => []
|
default: () => [],
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
default: undefined
|
default: undefined,
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'product'
|
default: 'product',
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const emits = defineEmits(['update:value', 'change', 'error']);
|
const emits = defineEmits(['update:value', 'change', 'error']);
|
||||||
|
|
||||||
const formItemContext = Form.useInjectFormItemContext()
|
const formItemContext = Form.useInjectFormItemContext();
|
||||||
|
|
||||||
const _value = ref<any>(undefined)
|
const _value = ref<any>(undefined);
|
||||||
|
|
||||||
const formTouchOff = () => {
|
const formTouchOff = () => {
|
||||||
formItemContext.onFieldChange()
|
formItemContext.onFieldChange();
|
||||||
}
|
};
|
||||||
|
|
||||||
const _options = computed(() => {
|
const _options = computed(() => {
|
||||||
if(props.type === 'product') {
|
if (props.type === 'product') {
|
||||||
return props.options.filter(i => i?.state || i.id === props.value)
|
return props.options.filter((i) => i?.state || i.id === props.value);
|
||||||
} else {
|
} else {
|
||||||
return props.options
|
return props.options;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
watchEffect(() => {
|
watch(
|
||||||
_value.value = props.value
|
() => props.value,
|
||||||
if(props.type !== 'product') {
|
() => {
|
||||||
formTouchOff()
|
_value.value = props.value;
|
||||||
|
if (props.type !== 'product') {
|
||||||
|
formTouchOff();
|
||||||
} else {
|
} else {
|
||||||
if(props.value){
|
if (props.value) {
|
||||||
formTouchOff()
|
formTouchOff();
|
||||||
}
|
}
|
||||||
emits('error', props.value)
|
emits('error', props.value);
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const productChange = (val: any) => {
|
const productChange = (val: any) => {
|
||||||
emits('update:value', val)
|
emits('update:value', val);
|
||||||
emits('change', val)
|
emits('change', val);
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
|
@ -12,8 +12,9 @@
|
||||||
:request="(e) => handleData(e)"
|
:request="(e) => handleData(e)"
|
||||||
model="CARD"
|
model="CARD"
|
||||||
:bodyStyle="{
|
:bodyStyle="{
|
||||||
padding: 0
|
padding: 0,
|
||||||
}"
|
}"
|
||||||
|
ref="tableRef"
|
||||||
:params="params"
|
:params="params"
|
||||||
:gridColumn="2"
|
:gridColumn="2"
|
||||||
:noPagination="true"
|
:noPagination="true"
|
||||||
|
@ -83,6 +84,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
notifyType: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:value', 'change', 'update:detail']);
|
const emit = defineEmits(['update:value', 'change', 'update:detail']);
|
||||||
|
@ -97,6 +102,7 @@ const getMethodTxt = (type: string) => {
|
||||||
|
|
||||||
const params = ref<Record<string, any>>({});
|
const params = ref<Record<string, any>>({});
|
||||||
const _selectedRowKeys = ref<string[]>([]);
|
const _selectedRowKeys = ref<string[]>([]);
|
||||||
|
const tableRef = ref<any>();
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -129,19 +135,70 @@ const handleSearch = (_params: any) => {
|
||||||
params.value = _params;
|
params.value = _params;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = (dt: any) => {
|
const typeObj = {
|
||||||
|
weixin: 'wechat',
|
||||||
|
dingTalk: 'dingtalk',
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryUserList = async (id: string) => {
|
||||||
|
if (!(props.notifyType && props.notifierId)) return '';
|
||||||
|
const resp = await TemplateApi.getUser(
|
||||||
|
typeObj[props.notifyType],
|
||||||
|
props.notifierId,
|
||||||
|
);
|
||||||
|
if (resp.status === 200) {
|
||||||
|
return resp.result?.find((item: any) => item.id === id)?.name;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryOrgList = async (id: string) => {
|
||||||
|
if (!(props.notifyType && props.notifierId)) return '';
|
||||||
|
const resp = await TemplateApi.getDept(
|
||||||
|
typeObj[props.notifyType],
|
||||||
|
props.notifierId,
|
||||||
|
);
|
||||||
|
if (resp.status === 200) {
|
||||||
|
return resp.result?.find((item: any) => item.id === id)?.name;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getOptions = async (dt: any) => {
|
||||||
|
const obj = {};
|
||||||
|
// 钉钉,微信
|
||||||
|
if (props.notifyType === 'weixin') {
|
||||||
|
if (dt?.template?.toParty) {
|
||||||
|
obj['orgName'] = await queryOrgList(dt?.template?.toParty);
|
||||||
|
}
|
||||||
|
if (dt?.template?.toUser) {
|
||||||
|
obj['sendTo'] = await queryUserList(dt?.template?.toUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (props.notifyType === 'dingTalk') {
|
||||||
|
if (dt?.template?.departmentIdList) {
|
||||||
|
obj['orgName'] = await queryOrgList(dt?.template?.departmentIdList);
|
||||||
|
}
|
||||||
|
if (dt?.template?.userIdList) {
|
||||||
|
obj['sendTo'] = await queryUserList(dt?.template?.userIdList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClick = async (dt: any) => {
|
||||||
if (_selectedRowKeys.value.includes(dt.id)) {
|
if (_selectedRowKeys.value.includes(dt.id)) {
|
||||||
_selectedRowKeys.value = [];
|
_selectedRowKeys.value = [];
|
||||||
emit('update:value', undefined);
|
emit('update:value', undefined);
|
||||||
// emit('change', { templateName: undefined, orgName: undefined, sendTo: undefined });
|
emit('change', { templateName: undefined, orgName: undefined, sendTo: undefined });
|
||||||
emit('change', { templateName: undefined });
|
|
||||||
emit('update:detail', undefined);
|
emit('update:detail', undefined);
|
||||||
} else {
|
} else {
|
||||||
// console.log(dt)
|
const obj = await getOptions(dt)
|
||||||
_selectedRowKeys.value = [dt.id];
|
_selectedRowKeys.value = [dt.id];
|
||||||
|
emit('change', { templateName: dt?.name, ...obj });
|
||||||
emit('update:value', dt.id);
|
emit('update:value', dt.id);
|
||||||
// emit('change', { templateName: dt?.name, orgName: dt.template?.departmentIdList, sendTo: dt.template?.userIdList });
|
|
||||||
emit('change', { templateName: dt?.name });
|
|
||||||
emit('update:detail', dt);
|
emit('update:detail', dt);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -176,6 +233,7 @@ watch(
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
_selectedRowKeys.value = [newValue];
|
_selectedRowKeys.value = [newValue];
|
||||||
|
// (tableRef.value?._dataSource || []).find()
|
||||||
} else {
|
} else {
|
||||||
_selectedRowKeys.value = [];
|
_selectedRowKeys.value = [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<NotifyTemplate
|
<NotifyTemplate
|
||||||
v-model:value="formModel.templateId"
|
v-model:value="formModel.templateId"
|
||||||
v-model:detail="template"
|
v-model:detail="template"
|
||||||
|
:notifyType="formModel.notifyType"
|
||||||
:notifierId="formModel.notifierId"
|
:notifierId="formModel.notifierId"
|
||||||
@change="(val) => onValChange(val, 'templateId')"
|
@change="(val) => onValChange(val, 'templateId')"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
style="width: calc(100% - 40px)"
|
style="width: calc(100% - 40px)"
|
||||||
placeholder="请选择角色"
|
placeholder="请选择角色"
|
||||||
:options="form.roleOptions"
|
:options="_roleOptions"
|
||||||
:disabled="form.data.username === 'admin'"
|
:disabled="form.data.username === 'admin'"
|
||||||
></j-select>
|
></j-select>
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
show-search
|
show-search
|
||||||
style="width: calc(100% - 40px)"
|
style="width: calc(100% - 40px)"
|
||||||
placeholder="请选择组织"
|
placeholder="请选择组织"
|
||||||
:tree-data="form.departmentOptions"
|
:tree-data="_departmentOptions"
|
||||||
:fieldNames="{ label: 'name', value: 'id' }"
|
:fieldNames="{ label: 'name', value: 'id' }"
|
||||||
multiple
|
multiple
|
||||||
:filterTreeNode="
|
:filterTreeNode="
|
||||||
|
@ -205,6 +205,7 @@ import { DefaultOptionType } from 'ant-design-vue/es/vc-tree-select/TreeSelect';
|
||||||
import { AxiosResponse } from 'axios';
|
import { AxiosResponse } from 'axios';
|
||||||
import { passwordRegEx } from '@/utils/validate';
|
import { passwordRegEx } from '@/utils/validate';
|
||||||
import { filterSelectNode, onlyMessage } from '@/utils/comm';
|
import { filterSelectNode, onlyMessage } from '@/utils/comm';
|
||||||
|
import { uniqBy } from 'lodash-es';
|
||||||
|
|
||||||
const deptPermission = 'system/Department';
|
const deptPermission = 'system/Department';
|
||||||
const rolePermission = 'system/Role';
|
const rolePermission = 'system/Role';
|
||||||
|
@ -279,6 +280,9 @@ const form = reactive({
|
||||||
roleOptions: [] as optionType[],
|
roleOptions: [] as optionType[],
|
||||||
departmentOptions: [] as DefaultOptionType[],
|
departmentOptions: [] as DefaultOptionType[],
|
||||||
|
|
||||||
|
_roleOptions: [] as optionType[],
|
||||||
|
_departmentOptions: [] as DefaultOptionType[],
|
||||||
|
|
||||||
init: () => {
|
init: () => {
|
||||||
form.getDepartmentList();
|
form.getDepartmentList();
|
||||||
form.getRoleList();
|
form.getRoleList();
|
||||||
|
@ -286,7 +290,6 @@ const form = reactive({
|
||||||
},
|
},
|
||||||
getUserInfo: () => {
|
getUserInfo: () => {
|
||||||
const id = props.data.id || '';
|
const id = props.data.id || '';
|
||||||
console.log(111);
|
|
||||||
|
|
||||||
if (props.type === 'add') form.data = {} as formType;
|
if (props.type === 'add') form.data = {} as formType;
|
||||||
else if (props.type === 'reset') form.data = { id } as formType;
|
else if (props.type === 'reset') form.data = { id } as formType;
|
||||||
|
@ -301,6 +304,10 @@ const form = reactive({
|
||||||
(item: dictType) => item.id,
|
(item: dictType) => item.id,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
form._roleOptions = resp.result?.roleList?.map((i: any) => {
|
||||||
|
return {label: i.name, value: i.id}
|
||||||
|
});
|
||||||
|
form._departmentOptions = resp.result?.orgList
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
formRef.value?.clearValidate();
|
formRef.value?.clearValidate();
|
||||||
});
|
});
|
||||||
|
@ -358,6 +365,15 @@ const form = reactive({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const _roleOptions = computed(() => {
|
||||||
|
return uniqBy([...form.roleOptions, ...form._roleOptions], 'value')
|
||||||
|
})
|
||||||
|
|
||||||
|
const _departmentOptions = computed(() => {
|
||||||
|
return uniqBy([...form.departmentOptions, ...form._departmentOptions], 'id')
|
||||||
|
})
|
||||||
|
|
||||||
form.init();
|
form.init();
|
||||||
|
|
||||||
interface AxiosResponseRewrite<T = any[]> extends AxiosResponse<T, any> {
|
interface AxiosResponseRewrite<T = any[]> extends AxiosResponse<T, any> {
|
||||||
|
|
Loading…
Reference in New Issue