Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_vue
This commit is contained in:
commit
d3bed9c000
|
@ -30,7 +30,7 @@
|
|||
props: {
|
||||
value: propTypes.oneOfType([propTypes.string, propTypes.array]),
|
||||
// 是否允许多选,默认 true
|
||||
multiple: propTypes.bool.def(true),
|
||||
multiple: propTypes.bool.def(false),
|
||||
},
|
||||
emits: ['options-change', 'change', 'select', 'update:value'],
|
||||
setup(props, { emit, refs }) {
|
||||
|
@ -159,7 +159,7 @@
|
|||
// update-end--author:liaozhiyang---date:20240627---for:【TV360X-1648】用户编辑界面“所属部门”与“负责部门”联动出错(同步之前丢的代码)
|
||||
};
|
||||
// update-end--author:liaozhiyang---date:20240527---for:【TV360X-414】部门设置了默认值,查询重置变成空了(同步JSelectUser组件改法)
|
||||
|
||||
|
||||
return {
|
||||
// state,
|
||||
attrs,
|
||||
|
|
|
@ -59,7 +59,7 @@ export const searchFormSchema: FormSchema[] = [
|
|||
field: 'institutionId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'nu_admin_institution_area,inst_name,id,org_category = 1 order by inst_name asc',
|
||||
dictCode: 'sys_depart,depart_name,id,org_category = 1 order by depart_name asc',
|
||||
placeholder: '请选择机构',
|
||||
},
|
||||
},
|
||||
|
@ -107,7 +107,7 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'institutionId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'nu_admin_institution_area,inst_name,id,org_category = 1 order by inst_name asc',
|
||||
dictCode: 'sys_depart,depart_name,id,org_category = 1 order by depart_name asc',
|
||||
placeholder: '请选择机构',
|
||||
},
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ enum Api {
|
|||
add = '/iot/regionInfo/add',
|
||||
edit = '/iot/regionInfo/edit',
|
||||
delete = '/iot/regionInfo/delete',
|
||||
queryChildrenByParentId = '/admin/institutionArea/queryChildrenByParentId',
|
||||
queryChildrenByParentId = '/sys/sysDepart/queryChildrenByParentId',
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<a-select v-model:value="model[field]" @change="(value,option) => handleChange(value,option,model)">
|
||||
<a-select-option :value="null">请选择…</a-select-option>
|
||||
<template v-for="item in areaOptions" :key="`${item.id}`">
|
||||
<a-select-option :value="item.id" :label="item.instName">
|
||||
{{item.instName}}
|
||||
<a-select-option :value="item.id" :label="item.departName">
|
||||
{{item.departName}}
|
||||
</a-select-option>
|
||||
</template>
|
||||
</a-select>
|
||||
|
@ -103,9 +103,9 @@
|
|||
|
||||
async function handleChange(value,option:Option,formData){
|
||||
if(value == null){
|
||||
formData["regionName"] = model.value["regionName"];
|
||||
formData["departName"] = model.value["departName"];
|
||||
}else{
|
||||
formData["regionName"] = option.label;
|
||||
formData["departName"] = option.label;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<template #areaSelect ="{model,field}">
|
||||
<a-select v-model:value="model[field]" @change="(value,option) => handleChange(value,option,model)">
|
||||
<template v-for="item in areaOptions" :key="`${item.id}`">
|
||||
<a-select-option :value="item.id" :label="item.instName">
|
||||
{{item.instName}}
|
||||
<a-select-option :value="item.id" :label="item.departName">
|
||||
{{item.departName}}
|
||||
</a-select-option>
|
||||
</template>
|
||||
</a-select>
|
||||
|
@ -98,9 +98,9 @@ const fetchArea = async (institutionId) => {
|
|||
|
||||
async function handleChange(value,option:Option,formData){
|
||||
if(value == null){
|
||||
formData["regionName"] = "";
|
||||
formData["departName"] = "";
|
||||
}else{
|
||||
formData["regionName"] = option.label;
|
||||
formData["departName"] = option.label;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #pwd="{ model, field }">
|
||||
<a-row :gutter="8">
|
||||
<a-input-password v-model:value="model[field]" placeholder="请输入密码" />
|
||||
</a-row>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<div class="j-box-bottom-button offset-20" style="margin-top: 30px">
|
||||
<div class="j-box-bottom-button-float" :class="[`${prefixCls}`]">
|
||||
<a-button preIcon="ant-design:sync-outlined" @click="onReset">重置</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:save-filled" @click="onSubmit">保存</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, computed, inject, ref, unref, onMounted } from 'vue';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { getUser,saveUser } from '../depart.api';
|
||||
import { tplinkUseFormSchema } from '../depart.data';
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
import { useMessage } from "@/hooks/web/useMessage";
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const { prefixCls } = useDesign('j-depart-form-content');
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
rootTreeData: { type: Array, default: () => [] },
|
||||
});
|
||||
const loading = ref<boolean>(false);
|
||||
// 当前的弹窗数据
|
||||
const model = ref<object>({});
|
||||
|
||||
//注册表单
|
||||
const [registerForm, { resetFields, setFieldsValue, validateFields, getFieldsValue, validate, updateSchema }] = useForm({
|
||||
schemas: tplinkUseFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
// data 变化,重填表单
|
||||
watch(
|
||||
() => props.data,
|
||||
async () => {
|
||||
let record = unref(props.data);
|
||||
if (typeof record !== 'object') {
|
||||
record = {};
|
||||
}
|
||||
model.value = record;
|
||||
await resetFields();
|
||||
//获取数据源信息
|
||||
let data = await getUser({ orgCode : model.value.orgCode });
|
||||
if(data == null){
|
||||
data = {};
|
||||
data.orgCode = record.orgCode;
|
||||
}
|
||||
await setFieldsValue({ ...data });
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
});
|
||||
|
||||
// 重置表单
|
||||
async function onReset() {
|
||||
await resetFields();
|
||||
await setFieldsValue({ ...model.value });
|
||||
}
|
||||
|
||||
// 提交事件
|
||||
async function onSubmit() {
|
||||
try {
|
||||
loading.value = true;
|
||||
let values = await validate();
|
||||
values = Object.assign({}, model.value, values);
|
||||
//提交表单
|
||||
await saveUser(values);
|
||||
let data = await getUser({ orgCode : values.orgCode });
|
||||
//刷新列表
|
||||
emit('success');
|
||||
Object.assign(model.value, data);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
// update-begin-author:liusq date:20230625 for: [issues/563]暗色主题部分失效
|
||||
|
||||
@prefix-cls: ~'@{namespace}-j-depart-form-content';
|
||||
/*begin 兼容暗夜模式*/
|
||||
.@{prefix-cls} {
|
||||
background: @component-background;
|
||||
border-top: 1px solid @border-color-base;
|
||||
}
|
||||
/*end 兼容暗夜模式*/
|
||||
// update-end-author:liusq date:20230625 for: [issues/563]暗色主题部分失效
|
||||
</style>
|
|
@ -24,6 +24,9 @@ export enum Api {
|
|||
getUpdateDepartInfo = '/sys/user/getUpdateDepartInfo',
|
||||
doUpdateDepartInfo = '/sys/user/doUpdateDepartInfo',
|
||||
changeDepartChargePerson = '/sys/user/changeDepartChargePerson',
|
||||
|
||||
getUser = '/iot/tplink/getUser',
|
||||
saveUser = '/iot/tplink/saveUser',
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,3 +123,11 @@ export const deleteDepart = (id) => defHttp.delete({ url: Api.delete, params:{ i
|
|||
* @param params
|
||||
*/
|
||||
export const changeDepartChargePerson = (params) => defHttp.put({ url: Api.changeDepartChargePerson, params });
|
||||
/**
|
||||
* 添加和编辑图门系统用户
|
||||
*/
|
||||
export const saveUser = (params) => defHttp.post({ url: Api.saveUser, params });
|
||||
/**
|
||||
* 获取图门系统用户
|
||||
*/
|
||||
export const getUser = (params?) => defHttp.get({ url: Api.getUser, params });
|
||||
|
|
|
@ -144,3 +144,98 @@ export const orgCategoryOptions = {
|
|||
{ value: '2', label: '区域' },
|
||||
],
|
||||
};
|
||||
|
||||
export const tplinkUseFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'orgCode',
|
||||
label: '所属机构',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
dynamicDisabled: true
|
||||
},
|
||||
{
|
||||
field: 'tumsProjectId',
|
||||
label: '所属项目ID',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'tumsProjectName',
|
||||
label: '所属项目',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
dynamicDisabled: true
|
||||
},
|
||||
{
|
||||
field: 'tumsUsername',
|
||||
label: '用户名',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
field: 'tumsPassword',
|
||||
label: '密码',
|
||||
required: true,
|
||||
component: 'StrengthMeter',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入登录密码',
|
||||
},
|
||||
{
|
||||
pattern: /^(?!.*(.)\1{2})(?=(?:.*[0-9].*[A-Z])|(?:.*[0-9].*[a-z])|(?:.*[0-9].*[~!@#$%^&*()_+={[}\]|\\:;'"<,>.?/ -])|(?:.*[A-Z].*[a-z])|(?:.*[A-Z].*[~!@#$%^&*()_+={[}\]|\\:;'"<,>.?/ -])|(?:.*[a-z].*[~!@#$%^&*()_+={[}\]|\\:;'"<,>.?/ -]))[0-9A-Za-z~!@#$%^&*()_+={[}\]|\\:;'"<,>.?/ -]{8,64}$/,
|
||||
message: '密码由8位数字、大小写字母和特殊符号组成!',
|
||||
},
|
||||
],
|
||||
dynamicDisabled: ({ values }) => {
|
||||
return !!values.id;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'tumsRoleId',
|
||||
label: '角色',
|
||||
required: true,
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
placeholder: '请选择类型',
|
||||
options: [
|
||||
{ label: '超级管理员', value: '1' },
|
||||
{ label: '项目管理员', value: '2' },
|
||||
{ label: '项目查看员', value: '3' },
|
||||
{ label: '视频监控员', value: '4' },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'ftpIp',
|
||||
label: 'FTP地址',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'ftpPort',
|
||||
label: 'FTP端口',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'ftpUsername',
|
||||
label: 'FTP用户',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'ftpPassword',
|
||||
label: 'FTP密码',
|
||||
component: 'InputPassword',
|
||||
},
|
||||
{
|
||||
field: 'ftpUploadpath',
|
||||
label: 'FTP上传路径',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
|
|
|
@ -11,16 +11,21 @@
|
|||
<DepartFormTab :data="departData" :rootTreeData="rootTreeData" @success="onSuccess" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="机构权限" key="role-info">
|
||||
<div style="padding: 0 20px 20px">
|
||||
<DepartRuleTab :data="departData" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<!-- <a-tab-pane tab="机构权限" key="role-info">-->
|
||||
<!-- <div style="padding: 0 20px 20px">-->
|
||||
<!-- <DepartRuleTab :data="departData" />-->
|
||||
<!-- </div>-->
|
||||
<!-- </a-tab-pane>-->
|
||||
<a-tab-pane tab="数据源管理" key="data-info" v-if="departData.orgCategory == 1">
|
||||
<div style="padding: 0 20px 20px">
|
||||
<DataSourceTab :data="departData" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="TPLINK用户" key="tplink-user-info">
|
||||
<div style="padding: 0 20px 20px">
|
||||
<TplinkUserTab :data="departData" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<div v-show="departData == null" style="padding-top: 40px">
|
||||
<a-empty description="尚未选择机构" />
|
||||
|
@ -37,6 +42,7 @@
|
|||
import DepartFormTab from './components/DepartFormTab.vue';
|
||||
import DepartRuleTab from './components/DepartRuleTab.vue';
|
||||
import DataSourceTab from './components/DataSourceTab.vue';
|
||||
import TplinkUserTab from './components/TplinkUserTab.vue';
|
||||
|
||||
const { prefixCls } = useDesign('depart-manage');
|
||||
provide('prefixCls', prefixCls);
|
||||
|
|
Loading…
Reference in New Issue