|
@ -9,21 +9,21 @@ |
|
|
> |
|
|
> |
|
|
<el-row type="flex" justify="center" align="middle"> |
|
|
<el-row type="flex" justify="center" align="middle"> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<el-form-item label="密码难度" prop="passwordDifficulty" align="center"> |
|
|
<el-form-item label="密码难度" prop="ruleLevel" align="center"> |
|
|
<el-select v-model="data.passwordDifficulty" placeholder="请选择密码难度"> |
|
|
<el-select v-model="passwordConfig.ruleLevel" placeholder="请选择密码难度"> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in difficultyList" |
|
|
v-for="item in ruleList" |
|
|
:key="item.value" |
|
|
:key="item.value" |
|
|
:label="item.label" |
|
|
:label="item.ruleLevel" |
|
|
:value="item.value" |
|
|
:value="item.ruleLevel" |
|
|
/> |
|
|
/> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<el-form-item label="试错次数" prop="number"> |
|
|
<el-form-item label="试错次数" prop="tryCount"> |
|
|
<el-input-number |
|
|
<el-input-number |
|
|
v-model="data.number" |
|
|
v-model="passwordConfig.tryCount" |
|
|
:min="0" |
|
|
:min="0" |
|
|
:precision="0" |
|
|
:precision="0" |
|
|
style="margin-right: 10px" |
|
|
style="margin-right: 10px" |
|
@ -31,9 +31,9 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<el-form-item label="锁定时长" prop="minute"> |
|
|
<el-form-item label="锁定时长" prop="lockMinutes"> |
|
|
<el-input-number |
|
|
<el-input-number |
|
|
v-model="data.minute" |
|
|
v-model="passwordConfig.lockMinutes" |
|
|
:min="0" |
|
|
:min="0" |
|
|
:precision="0" |
|
|
:precision="0" |
|
|
style="margin-right: 10px" |
|
|
style="margin-right: 10px" |
|
@ -41,9 +41,9 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<el-form-item label="更新周期" prop="cycle"> |
|
|
<el-form-item label="更新周期" prop="updatePeriod"> |
|
|
<el-input-number |
|
|
<el-input-number |
|
|
v-model="data.cycle" |
|
|
v-model="passwordConfig.updatePeriod" |
|
|
:min="0" |
|
|
:min="0" |
|
|
:precision="0" |
|
|
:precision="0" |
|
|
style="margin-right: 10px" |
|
|
style="margin-right: 10px" |
|
@ -51,8 +51,8 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col> |
|
|
<el-col> |
|
|
<el-form-item label="是否开启" prop="isEnabled"> |
|
|
<el-form-item label="是否开启" prop="status"> |
|
|
<el-switch v-model="data.isEnabled" active-value="TRUE" inactive-value="'FALSE'" /> |
|
|
<el-switch v-model="passwordConfig.status" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
@ -60,7 +60,7 @@ |
|
|
<div class="dialog-footer"> |
|
|
<div class="dialog-footer"> |
|
|
<el-button |
|
|
<el-button |
|
|
type="primary" |
|
|
type="primary" |
|
|
@click="submitForm" |
|
|
@click="handleUpdate" |
|
|
style="width: 100%; height: 40px; line-height: 40px" |
|
|
style="width: 100%; height: 40px; line-height: 40px" |
|
|
>保 存</el-button |
|
|
>保 存</el-button |
|
|
> |
|
|
> |
|
@ -71,7 +71,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
|
|
import * as api from '@/api/system/password' |
|
|
|
|
|
|
|
|
defineOptions({ name: 'PasswordRule' }) |
|
|
defineOptions({ name: 'PasswordRule' }) |
|
|
|
|
|
|
|
@ -82,30 +82,61 @@ const rules = { |
|
|
password: [required], |
|
|
password: [required], |
|
|
againPassword: [required] |
|
|
againPassword: [required] |
|
|
} |
|
|
} |
|
|
const data = ref({ |
|
|
const reset = () => { |
|
|
passwordDifficulty: '', //密码难度 |
|
|
passwordConfig.value = { |
|
|
number: '', //试错次数 |
|
|
status: true, |
|
|
minute: '', //锁定时长 |
|
|
ruleLevel: "简单", |
|
|
cycle: '', //更新周期 |
|
|
ruleDesc: "", |
|
|
isEnabled: 'TRUE' //是否开启 |
|
|
tryCount: 3, |
|
|
|
|
|
lockMinutes: 1, |
|
|
|
|
|
updatePeriod: 1, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const passwordConfig = ref({ |
|
|
|
|
|
id: 0, |
|
|
|
|
|
status: true, |
|
|
|
|
|
ruleLevel: "简单", |
|
|
|
|
|
ruleDesc: "", |
|
|
|
|
|
tryCount: 3, |
|
|
|
|
|
lockMinutes: 1, |
|
|
|
|
|
updatePeriod: 1, |
|
|
}) |
|
|
}) |
|
|
const difficultyList = ref([ |
|
|
/** 查询配置 */ |
|
|
{ |
|
|
const getConfig = async () => { |
|
|
value: '11', |
|
|
loading.value = true |
|
|
label: '11' |
|
|
try { |
|
|
|
|
|
passwordConfig.value = await api.getConfig() |
|
|
|
|
|
} finally { |
|
|
|
|
|
loading.value = false |
|
|
} |
|
|
} |
|
|
]) |
|
|
} |
|
|
const reset = () => { |
|
|
const ruleList = ref([]) |
|
|
data.value = { |
|
|
/** 获取规则等级 */ |
|
|
passwordDifficulty: '', //密码难度 |
|
|
const getRuleList = async () => { |
|
|
number: '', //试错次数 |
|
|
loading.value = true |
|
|
minute: '', //锁定时长 |
|
|
try { |
|
|
cycle: '', //更新周期 |
|
|
ruleList.value = await api.getRuleList() |
|
|
isEnabled: 'TRUE' //是否开启 |
|
|
} finally { |
|
|
|
|
|
loading.value = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
/** 保存 */ |
|
|
|
|
|
const handleUpdate = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
loading.value = true |
|
|
|
|
|
await api.setConfig(passwordConfig.value) |
|
|
|
|
|
message.success(t('common.save')) |
|
|
|
|
|
} catch { |
|
|
|
|
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
loading.value = false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/** 初始化 **/ |
|
|
/** 初始化 **/ |
|
|
onMounted(async () => {}) |
|
|
onMounted(async () => { |
|
|
|
|
|
getConfig() |
|
|
|
|
|
getRuleList() |
|
|
|
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
.box { |
|
|
.box { |
|
|