Commit 4dcb9915 by 周海峰

no message

parent 9ffc9508
...@@ -313,12 +313,12 @@ export default { ...@@ -313,12 +313,12 @@ export default {
async platformapplicationslistall(){ async platformapplicationslistall(){
let dataRes = await platformapplicationslistall(); let dataRes = await platformapplicationslistall();
// 只显示pc端地址有值的 // 只显示pc端地址有值的
this.itemList = dataRes.data.data.filter(item=> item.href); this.itemList = dataRes.data.data.filter(item=> item.href && item.qyflag=='1');
}, },
async platformapplicationslistallApp(){ async platformapplicationslistallApp(){
let dataRes = await platformapplicationslistallApp(); let dataRes = await platformapplicationslistallApp();
// 只显示app端地址有值的 // 只显示app端地址有值的
this.itemListApp = dataRes.data.data.filter(item=> item.wechatUrl); this.itemListApp = dataRes.data.data.filter(item=> item.wechatUrl && item.qyflag=='1');
}, },
}, },
mounted() { mounted() {
......
...@@ -23,8 +23,12 @@ ...@@ -23,8 +23,12 @@
</q-field> </q-field>
<div class="row"> <div class="row">
<div class="col-6 q-pr-sm"> <div class="col-6 q-pr-sm">
<q-field :count="64"> <q-field :count="30" :error="appidError" :error-message="appidErrorMessage">
<q-input v-model="localTemp.appid" float-label="应用唯一标识" @blur="getsecret" :disable="appidflag" /> <q-input
v-model="localTemp.appid"
float-label="应用唯一标识"
:disable="appidflag"
/>
</q-field> </q-field>
</div> </div>
<div class="col-6 q-pl-sm"> <div class="col-6 q-pl-sm">
...@@ -40,8 +44,11 @@ ...@@ -40,8 +44,11 @@
</q-field> </q-field>
</div> </div>
<div class="col-6 q-pr-sm"> <div class="col-6 q-pr-sm">
<q-field :count="200"> <q-field :count="10" :error="mailtypeError" :error-message="mailtypeErrorMessage">
<q-input v-model="localTemp.mailtype" float-label="待办标识" /> <q-input
v-model="localTemp.mailtype"
float-label="待办标识"
/>
</q-field> </q-field>
</div> </div>
</div> </div>
...@@ -82,7 +89,7 @@ ...@@ -82,7 +89,7 @@
</div> </div>
</q-field> </q-field>
<q-field> <q-field>
<q-select v-model="localTemp.qyflag" float-label="启用/停用" radio :options="selectOptions"/> <q-select v-model="localTemp.qyflag" float-label="应用启用/停用" radio :options="selectOptions"/>
</q-field> </q-field>
</q-card-section> </q-card-section>
</q-card> </q-card>
...@@ -120,7 +127,7 @@ ...@@ -120,7 +127,7 @@
</template> </template>
<script> <script>
import { saveapp } from "@/service/permission/platformapplications"; import { saveapp, checkAppidUnique, checkMailtypeUnique } from "@/service/permission/platformapplications";
import { getApplicationsGroupList, addApplicationsGroup } from "@/service/permission/platformapplicationsGroup"; import { getApplicationsGroupList, addApplicationsGroup } from "@/service/permission/platformapplicationsGroup";
export default { export default {
name: "EditApplication", name: "EditApplication",
...@@ -137,9 +144,15 @@ export default { ...@@ -137,9 +144,15 @@ export default {
return { return {
visible: this.value, visible: this.value,
localTemp: JSON.parse(JSON.stringify(this.temp || {})), localTemp: JSON.parse(JSON.stringify(this.temp || {})),
fileCount: 0 fileCount: 0,
,applicationsGroupOptions: [] applicationsGroupOptions: [],
,imageLoadError: false imageLoadError: false,
appidError: false,
appidErrorMessage: "",
mailtypeError: false,
mailtypeErrorMessage: "",
appidTimer: null,
mailtypeTimer: null
} }
}, },
watch: { watch: {
...@@ -148,6 +161,8 @@ export default { ...@@ -148,6 +161,8 @@ export default {
if (v) { if (v) {
this.localTemp = JSON.parse(JSON.stringify(this.temp || {})); this.localTemp = JSON.parse(JSON.stringify(this.temp || {}));
this.fetchApplicationsGroupOptions(); this.fetchApplicationsGroupOptions();
this.resetValidation();
this.clearTimers();
if (this.localTemp.img === undefined) { if (this.localTemp.img === undefined) {
this.$set(this.localTemp, 'img', ''); this.$set(this.localTemp, 'img', '');
...@@ -169,8 +184,44 @@ export default { ...@@ -169,8 +184,44 @@ export default {
}, },
methods: { methods: {
close() { close() {
this.clearTimers();
this.visible = false; this.visible = false;
}, },
clearTimers() {
if (this.appidTimer) {
clearTimeout(this.appidTimer);
this.appidTimer = null;
}
if (this.mailtypeTimer) {
clearTimeout(this.mailtypeTimer);
this.mailtypeTimer = null;
}
},
resetValidation() {
this.appidError = false;
this.appidErrorMessage = "";
this.mailtypeError = false;
this.mailtypeErrorMessage = "";
},
async validateAppid() {
try {
const excludeId = this.subtype === 'edit' ? this.localTemp.id : null;
const response = await checkAppidUnique(this.localTemp.appid, excludeId);
return response.data.data;
} catch (e) {
return true;
}
},
async validateMailtype() {
try {
const excludeId = this.subtype === 'edit' ? this.localTemp.id : null;
const response = await checkMailtypeUnique(this.localTemp.mailtype, excludeId);
return response.data.data;
} catch (e) {
console.error("验证待办标识失败", e);
return true;
}
},
async onSave() { async onSave() {
// 表单验证 // 表单验证
if (!this.localTemp.title || this.localTemp.title.trim() === '') { if (!this.localTemp.title || this.localTemp.title.trim() === '') {
...@@ -191,6 +242,49 @@ export default { ...@@ -191,6 +242,49 @@ export default {
return; return;
} }
// 验证应用唯一标识长度
if (this.localTemp.appid.length > 30) {
this.appidError = true;
this.appidErrorMessage = "应用唯一标识不能超过30个字符";
return;
}
// 验证应用唯一标识唯一性
const isAppidUnique = await this.validateAppid();
if (!isAppidUnique) {
this.$q.notify({
type: "negative",
message: "应用唯一标识重复",
position: "bottom-right"
});
return;
}
// 验证待办标识长度(如果有值)
if (this.localTemp.mailtype && this.localTemp.mailtype.length > 10) {
this.mailtypeError = true;
this.mailtypeErrorMessage = "待办标识不能超过10个字符";
this.$q.notify({
type: "negative",
message: "待办标识不能超过10个字符",
position: "bottom-right"
});
return;
}
// 验证待办标识唯一性(如果有值)
if (this.localTemp.mailtype && this.localTemp.mailtype.trim() !== '') {
const isMailtypeUnique = await this.validateMailtype();
if (!isMailtypeUnique) {
this.$q.notify({
type: "negative",
message: "待办标识标识重复",
position: "bottom-right"
});
return;
}
}
try { try {
await saveapp(JSON.parse(JSON.stringify(this.localTemp))); await saveapp(JSON.parse(JSON.stringify(this.localTemp)));
this.$q.notify({ this.$q.notify({
...@@ -210,6 +304,8 @@ export default { ...@@ -210,6 +304,8 @@ export default {
}, },
getsecret() { getsecret() {
this.localTemp.secret = window.btoa(this.localTemp.appid || ''); this.localTemp.secret = window.btoa(this.localTemp.appid || '');
this.appidError = false;
this.appidErrorMessage = "";
}, },
onImgError() { onImgError() {
this.imageLoadError = true; this.imageLoadError = true;
......
...@@ -128,10 +128,10 @@ ...@@ -128,10 +128,10 @@
</div> </div>
</div> </div>
<div class="text-left text-caption text-grey-7"> <div class="text-left text-caption text-grey-7">
<div class="row items-center q-gutter-sm"> <div class="row items-center q-gutter-sm ellipsis">
<span v-if="app.wechatUrl"> <span v-if="app.wechatUrl" class="ellipsis">
<q-icon name="smartphone" size="14px" /> <q-icon name="smartphone" size="14px" />
{{ app.wechatUrl }} <span class="ellipsis" :title="app.wechatUrl" style="max-width: 240px;">{{ app.wechatUrl }}</span>
</span> </span>
</div> </div>
</div> </div>
...@@ -235,6 +235,8 @@ ...@@ -235,6 +235,8 @@
:loading="loadingApplications" :loading="loadingApplications"
:no-data-label="$t('No data')" :no-data-label="$t('No data')"
separator="cell" separator="cell"
:pagination.sync="tablePagination"
rows-per-page-label="每页显示"
> >
<template slot="body-cell-title" slot-scope="props"> <template slot="body-cell-title" slot-scope="props">
<q-td :props="props"> <q-td :props="props">
...@@ -294,6 +296,9 @@ export default { ...@@ -294,6 +296,9 @@ export default {
addApplicationDialog: false, addApplicationDialog: false,
applicationFilter: "", applicationFilter: "",
selectedApplications: [], selectedApplications: [],
tablePagination: {
rowsPerPage: 10,
},
applicationColumns: [ applicationColumns: [
{ {
......
...@@ -49,4 +49,22 @@ export function updateWechatNum(list) { ...@@ -49,4 +49,22 @@ export function updateWechatNum(list) {
data: list, data: list,
loading: "hourglass" loading: "hourglass"
}) })
}
// 验证应用唯一标识是否唯一
export function checkAppidUnique(appid, excludeId = null) {
return request({
url: '/PlatformApplicationsController/platformapplications/checkAppidUnique',
method: 'get',
params: { appid, excludeId }
})
}
// 验证待办标识是否唯一
export function checkMailtypeUnique(mailtype, excludeId = null) {
return request({
url: '/PlatformApplicationsController/platformapplications/checkMailtypeUnique',
method: 'get',
params: { mailtype, excludeId }
})
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论