|
@@ -5,21 +5,21 @@
|
|
<div class="accountPerBox flex-col">
|
|
<div class="accountPerBox flex-col">
|
|
<van-form @submit="onSubmit">
|
|
<van-form @submit="onSubmit">
|
|
<van-field v-model="username" name="username" :label="$t('accountPer.usernameLabel')" :readonly="isUserName"
|
|
<van-field v-model="username" name="username" :label="$t('accountPer.usernameLabel')" :readonly="isUserName"
|
|
- :placeholder="$t('accountPer.usernamePlaceholder')"
|
|
|
|
|
|
+ :placeholder="$t('accountPer.usernamePlaceholder')"
|
|
:rules="[{ pattern: /^[a-zA-Z][a-zA-Z0-9]*$/, message: $t('register.usernameRequired') }]" />
|
|
:rules="[{ pattern: /^[a-zA-Z][a-zA-Z0-9]*$/, message: $t('register.usernameRequired') }]" />
|
|
<van-field v-model="password" name="password" type="password" :label="$t('accountPer.passwordLabel')"
|
|
<van-field v-model="password" name="password" type="password" :label="$t('accountPer.passwordLabel')"
|
|
:placeholder="passwordPlaceholder" :rules="[
|
|
:placeholder="passwordPlaceholder" :rules="[
|
|
- { required: havePassword, message: $t('accountPer.passwordPlaceholder') },
|
|
|
|
- { pattern: passwordPattern, message: $t('register.passwordPattern') }
|
|
|
|
- ]" />
|
|
|
|
|
|
+ { required: havePassword, message: $t('accountPer.passwordPlaceholder') },
|
|
|
|
+ // { pattern: passwordPattern, message: $t('register.passwordPattern') }
|
|
|
|
+ ]" />
|
|
<van-field v-model="name" name="name" :label="$t('accountPer.nameLabel')"
|
|
<van-field v-model="name" name="name" :label="$t('accountPer.nameLabel')"
|
|
:placeholder="$t('accountPer.namePlaceholder')" :rules="[
|
|
:placeholder="$t('accountPer.namePlaceholder')" :rules="[
|
|
- { required: true, message: $t('accountPer.namePlaceholder') },
|
|
|
|
- ]" />
|
|
|
|
|
|
+ { required: true, message: $t('accountPer.namePlaceholder') },
|
|
|
|
+ ]" />
|
|
<van-field v-model="phone" name="phone" :label="$t('accountPer.phoneLabel')"
|
|
<van-field v-model="phone" name="phone" :label="$t('accountPer.phoneLabel')"
|
|
:placeholder="$t('accountPer.phonePlaceholder')" :rules="[
|
|
:placeholder="$t('accountPer.phonePlaceholder')" :rules="[
|
|
- { required: true, message: $t('accountPer.phonePlaceholder') },
|
|
|
|
- ]" />
|
|
|
|
|
|
+ { required: true, message: $t('accountPer.phonePlaceholder') },
|
|
|
|
+ ]" />
|
|
<van-field name="radio" label="类型" v-if="user.type === 0">
|
|
<van-field name="radio" label="类型" v-if="user.type === 0">
|
|
<template #input>
|
|
<template #input>
|
|
<van-radio-group v-model="type" direction="horizontal">
|
|
<van-radio-group v-model="type" direction="horizontal">
|
|
@@ -29,7 +29,8 @@
|
|
</template>
|
|
</template>
|
|
</van-field>
|
|
</van-field>
|
|
<van-field v-model="roleText" is-link readonly :label="$t('accountPer.roleLabel')"
|
|
<van-field v-model="roleText" is-link readonly :label="$t('accountPer.roleLabel')"
|
|
- :placeholder="$t('accountPer.rolePlaceholder')" @click="roleShow = true" :rules="[{ required: true, message: $t('accountPer.rolePlaceholder') }]"/>
|
|
|
|
|
|
+ :placeholder="$t('accountPer.rolePlaceholder')" @click="roleShow = true"
|
|
|
|
+ :rules="[{ required: true, message: $t('accountPer.rolePlaceholder') }]" />
|
|
<div class="van-cell van-field">
|
|
<div class="van-cell van-field">
|
|
<div class="van-cell__title van-field__label">
|
|
<div class="van-cell__title van-field__label">
|
|
<label id="van-field-4-label" for="van-field-4-input">{{ $t("accountPer.setUp") }}</label>
|
|
<label id="van-field-4-label" for="van-field-4-input">{{ $t("accountPer.setUp") }}</label>
|
|
@@ -37,19 +38,19 @@
|
|
<div class="van-cell__value">
|
|
<div class="van-cell__value">
|
|
<div class="van-field__body">
|
|
<div class="van-field__body">
|
|
<van-switch v-model="isEnabled" size="20px" class="o-mr-10" /><span>{{
|
|
<van-switch v-model="isEnabled" size="20px" class="o-mr-10" /><span>{{
|
|
- $t("accountPer.startOrNot")
|
|
|
|
- }}</span>
|
|
|
|
|
|
+ $t("accountPer.startOrNot")
|
|
|
|
+ }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<van-field :border="false" @click-input="busiEquipInpClk" readonly clearable
|
|
<van-field :border="false" @click-input="busiEquipInpClk" readonly clearable
|
|
v-model="cofficentForm.equipmentNames" :label="$t('accountPer.manageMachinesLabel')"
|
|
v-model="cofficentForm.equipmentNames" :label="$t('accountPer.manageMachinesLabel')"
|
|
- :placeholder="$t('accountPer.manageMachinesPlaceholder')" >
|
|
|
|
|
|
+ :placeholder="$t('accountPer.manageMachinesPlaceholder')">
|
|
<!-- :rules="[{ required: true, message: $t('accountPer.manageMachinesPlaceholder') }]" -->
|
|
<!-- :rules="[{ required: true, message: $t('accountPer.manageMachinesPlaceholder') }]" -->
|
|
<template #right-icon>
|
|
<template #right-icon>
|
|
<div class="l-flex-RC">
|
|
<div class="l-flex-RC">
|
|
- <van-icon v-if="cofficentForm.equipmentNames" @click="cofficentForm.equipmentNames = ''; equipmentIds = ''"
|
|
|
|
- class="o-mr-6" name="clear" />
|
|
|
|
|
|
+ <van-icon v-if="cofficentForm.equipmentNames"
|
|
|
|
+ @click="cofficentForm.equipmentNames = ''; equipmentIds = ''" class="o-mr-6" name="clear" />
|
|
<van-icon @click="busiEquipInpClk" name="arrow" />
|
|
<van-icon @click="busiEquipInpClk" name="arrow" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -57,11 +58,11 @@
|
|
<!-- 操作 -->
|
|
<!-- 操作 -->
|
|
<van-row justify="space-around" style="padding: 1em">
|
|
<van-row justify="space-around" style="padding: 1em">
|
|
<van-button span="5" round type="primary" style="height: 2em; padding: 0 2em" native-type="submit">{{
|
|
<van-button span="5" round type="primary" style="height: 2em; padding: 0 2em" native-type="submit">{{
|
|
- $t("accountPer.submit") }}</van-button>
|
|
|
|
|
|
+ $t("accountPer.submit") }}</van-button>
|
|
</van-row>
|
|
</van-row>
|
|
<van-row justify="space-around" style="padding: 1em" v-if="pageTitle === $t('accountPer.modifyAccount')">
|
|
<van-row justify="space-around" style="padding: 1em" v-if="pageTitle === $t('accountPer.modifyAccount')">
|
|
<van-button span="5" round type="danger" style="height: 2em; padding: 0 2em" @click="deleteLoginUserFun()">{{
|
|
<van-button span="5" round type="danger" style="height: 2em; padding: 0 2em" @click="deleteLoginUserFun()">{{
|
|
- $t("accountPer.delete") }}</van-button>
|
|
|
|
|
|
+ $t("accountPer.delete") }}</van-button>
|
|
</van-row>
|
|
</van-row>
|
|
</van-form>
|
|
</van-form>
|
|
</div>
|
|
</div>
|
|
@@ -70,8 +71,8 @@
|
|
@close="roleShow = false" @finish="onRoleFinish" />
|
|
@close="roleShow = false" @finish="onRoleFinish" />
|
|
</van-popup>
|
|
</van-popup>
|
|
<!-- 机器弹窗 -->
|
|
<!-- 机器弹窗 -->
|
|
- <kSelectPop @selconfirm="selEquipConfirm" ref="kSelectPopEquipRef" :selOptions="selEquipOptions" @searchData="searchEquData"
|
|
|
|
- :selTitleAndName="['name', 'id']"></kSelectPop>
|
|
|
|
|
|
+ <kSelectPop @selconfirm="selEquipConfirm" ref="kSelectPopEquipRef" :selOptions="selEquipOptions"
|
|
|
|
+ @searchData="searchEquData" :selTitleAndName="['name', 'id']"></kSelectPop>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -80,7 +81,7 @@
|
|
import kSelectPop from "../../components/commom/kSelectPop/index.vue";
|
|
import kSelectPop from "../../components/commom/kSelectPop/index.vue";
|
|
import { onMounted, reactive, toRefs, ref } from "vue";
|
|
import { onMounted, reactive, toRefs, ref } from "vue";
|
|
import sHeader from "../../components/SimpleHeader";
|
|
import sHeader from "../../components/SimpleHeader";
|
|
-import { showFailToast, showSuccessToast, showToast } from 'vant';
|
|
|
|
|
|
+import { showFailToast, showSuccessToast, showToast, showNotify } from 'vant';
|
|
import {
|
|
import {
|
|
getSysRoleList,
|
|
getSysRoleList,
|
|
getEquipmentList,
|
|
getEquipmentList,
|
|
@@ -114,7 +115,7 @@ export default {
|
|
equipmentIdText.value = selectedOptions[0].text;
|
|
equipmentIdText.value = selectedOptions[0].text;
|
|
};
|
|
};
|
|
const passwordPlaceholder = ref("");
|
|
const passwordPlaceholder = ref("");
|
|
- const passwordPattern = ref(/^$/);
|
|
|
|
|
|
+ const passwordPattern = ref(/^(?=.*[a-zA-Z])(?=.*\d).{10,}$/);
|
|
const havePassword = ref(true);
|
|
const havePassword = ref(true);
|
|
const isUserName = ref(false);
|
|
const isUserName = ref(false);
|
|
let addParams = reactive({
|
|
let addParams = reactive({
|
|
@@ -149,13 +150,12 @@ export default {
|
|
addParams.equipmentIds = accoutPerSet.equipmentIds;
|
|
addParams.equipmentIds = accoutPerSet.equipmentIds;
|
|
havePassword.value = false;
|
|
havePassword.value = false;
|
|
passwordPlaceholder.value = t('accountPer.editPasswordPlaceholder')
|
|
passwordPlaceholder.value = t('accountPer.editPasswordPlaceholder')
|
|
- passwordPattern.value = /^$/;
|
|
|
|
} else {
|
|
} else {
|
|
pageTitle.value = t("accountPer.addAccount");
|
|
pageTitle.value = t("accountPer.addAccount");
|
|
passwordPlaceholder.value = t('register.passwordPlaceholder');
|
|
passwordPlaceholder.value = t('register.passwordPlaceholder');
|
|
- passwordPattern.value = /^(?=.*[a-zA-Z])(?=.*\d).{10,}$/;
|
|
|
|
havePassword.value = true;
|
|
havePassword.value = true;
|
|
}
|
|
}
|
|
|
|
+ console.log(passwordPattern.value)
|
|
getSysRoleListFun();
|
|
getSysRoleListFun();
|
|
getEquipmentListFun();
|
|
getEquipmentListFun();
|
|
});
|
|
});
|
|
@@ -210,10 +210,16 @@ export default {
|
|
|
|
|
|
const onSubmit = async () => {
|
|
const onSubmit = async () => {
|
|
let params = { adminId: user.id };
|
|
let params = { adminId: user.id };
|
|
- if (addParams.username ==='admin') {
|
|
|
|
- showFailToast(t('register.A0201'));
|
|
|
|
|
|
+ if (addParams.username === 'admin') {
|
|
|
|
+ showNotify({ type: 'danger', message: t('register.A0201') });
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ if (addParams.password != "") {
|
|
|
|
+ if (!passwordPattern.value.test(addParams.password)) {
|
|
|
|
+ showNotify(t('register.passwordPlaceholder'));
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
params = Object.assign({ adminId: user.id }, addParams);
|
|
params = Object.assign({ adminId: user.id }, addParams);
|
|
if (params.password !== "") {
|
|
if (params.password !== "") {
|
|
params.password = md5(params.password);
|
|
params.password = md5(params.password);
|