BUG 28443

This commit is contained in:
aixianling
2022-03-22 20:57:09 +08:00
parent af7e1c72a4
commit 26177d03d4
2 changed files with 123 additions and 188 deletions

View File

@@ -5,50 +5,47 @@
<ai-search-bar bottomBorder>
<template slot="left">
<el-button
:disabled="!isLevel5"
type="primary"
icon="iconfont iconAdd"
@click="onAdd">
type="primary"
icon="iconfont iconAdd"
@click="onAdd">
添加
</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
ref="aitableex"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
ref="aitableex"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column
slot="changeIntegral"
label="积分"
align="center">
slot="changeIntegral"
label="积分"
align="center">
<template slot-scope="{ row }">
<span>{{ row.doType > 0 ? "+" : ""}}{{ row.changeIntegral }}</span>
<span>{{ row.doType > 0 ? "+" : "" }}{{ row.changeIntegral }}</span>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" align="center" width="120" fixed="right">
<template slot-scope="{ row }">
<div class="table-options">
<el-button
type="text"
title="编辑"
style="margin-right: 8px;"
:disabled="!$permissions('app_appvillagerintegralshop_edit')"
@click="editItem(row)">
type="text"
title="编辑"
style="margin-right: 8px;"
:disabled="!$permissions('app_appvillagerintegralshop_edit')"
@click="editItem(row)">
编辑
</el-button>
<ai-wechat-selecter :instance="instance" v-model="dialogInfo.operators" @change="getSelect">
<el-button
<el-button
type="text"
@click="statusChage(row)"
title="授权"
v-if="$permissions('app_appvillagerintegralshop_edit')">
授权
</el-button>
</ai-wechat-selecter>
授权
</el-button>
</div>
</template>
</el-table-column>
@@ -56,45 +53,45 @@
</template>
</ai-list>
<ai-dialog
:title="dialog.title"
:visible.sync="dialog.visible"
:customFooter="true"
:destroyOnClose="true"
@close="init('ruleForm')"
width="520px"
:title="dialog.title"
:visible.sync="dialog.visible"
:customFooter="true"
:destroyOnClose="true"
@close="init('ruleForm')"
width="520px"
>
<div class="form_div">
<el-form
ref="ruleForm"
:model="dialogInfo"
:rules="formRules"
size="small"
label-suffix=""
label-width="100px"
ref="ruleForm"
:model="dialogInfo"
:rules="formRules"
size="small"
label-suffix=""
label-width="100px"
>
<el-form-item label="店铺名称" prop="shopName">
<el-input
placeholder="请输入…"
v-model="dialogInfo.shopName"
placeholder="请输入…"
v-model="dialogInfo.shopName"
></el-input>
</el-form-item>
<el-form-item label="店主" prop="shopkeeper">
<el-input
placeholder="请输入…"
v-model="dialogInfo.shopkeeper"
placeholder="请输入…"
v-model="dialogInfo.shopkeeper"
></el-input>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
placeholder="请输入…"
v-model="dialogInfo.phone"
maxlength="11"
placeholder="请输入…"
v-model="dialogInfo.phone"
maxlength="11"
></el-input>
</el-form-item>
<el-form-item label="店铺地址" prop="shopAddress">
<el-input
placeholder="请输入…"
v-model="dialogInfo.shopAddress"
placeholder="请输入…"
v-model="dialogInfo.shopAddress"
></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
@@ -107,95 +104,28 @@
</div>
<div class="dialog-footer" slot="footer">
<el-button @click="dialog.visible = false" size="medium"
>取消</el-button
>取消
</el-button
>
<el-button @click="onConfirm('ruleForm')" type="primary" size="medium"
>确认</el-button
>确认
</el-button
>
</div>
</ai-dialog>
<ai-dialog
title="操作人授权"
:visible.sync="dialog.visibleStatus"
:customFooter="true"
:destroyOnClose="true"
@close="init('ruleStatus')"
width="720px"
>
<div class="form_div">
<el-form
ref="ruleStatus"
:model="dialogInfo"
:rules="formRules"
size="small"
label-suffix=""
label-width="100px"
>
<el-form-item label="事件区域" prop="areaId">
<ai-area-select
clearable
always-show
:instance="instance"
v-model="dialogInfo.areaId"
:hide-level="2"
:disabled-level="user.info.areaList.length"
/>
</el-form-item>
<el-form-item label="操作员" required>
<el-col :span="14" style="width: 60%; margin-right: 8px">
<el-form-item prop="operators">
<div class="organ">
<span v-if="dialogInfo.operators.length">
<span
v-for="(item, i) in dialogInfo.operators"
:key="i"
class="organzation"
>{{ item.userName }}
<span
class="iconfont iconOverrule"
@click.stop="delate(i)"
></span>
</span>
</span>
<span v-else style="color: #999">请选择</span>
</div>
</el-form-item>
</el-col>
<el-col :span="7" style="width: 30%">
<ai-person-select
:instance="instance"
:url="peopleAjaxUrl"
:isMultiple="true"
v-if="$permissions('app_appvillagerintegralshopoperator_edit')"
@selectPerson="getSelect"
:chooseUserList="dialogInfo.operators"
>
<template name="option" v-slot:option="{ item }">
<span class="iconfont iconProlife">{{ item.userName }}</span>
</template>
</ai-person-select>
</el-col>
</el-form-item>
</el-form>
</div>
<div class="dialog-footer" slot="footer">
<el-button @click="dialog.visibleStatus = false" size="medium"
>取消</el-button
>
<el-button @click="onConfirm('ruleStatus')" type="primary" size="medium"
>确认</el-button
>
</div>
<ai-dialog :visible.sync="authDialog" title="授权" @onConfirm="handleAuth" @closed="form={}" width="500px">
<ai-user-picker :instance="instance" v-model="form.operators" multiple/>
</ai-dialog>
</section>
</template>
<script>
import { mapState } from "vuex";
import {mapState} from "vuex";
import AiUserPicker from "../../../components/AiUserPicker";
export default {
name: "storeManagement",
components: {AiUserPicker},
props: {
instance: Function,
dict: Object,
@@ -212,7 +142,7 @@ export default {
unitId: "",
total: 10,
colConfigs: [
{ prop: "shopName", label: "店铺名称", align: "left" },
{prop: "shopName", label: "店铺名称", align: "left"},
{
prop: "shopkeeper",
label: "店主",
@@ -240,15 +170,15 @@ export default {
align: "center",
render: (h, params) => {
return h(
"span",
{
class: "status-" + params.row.status,
},
this.$dict.getLabel("assessmentStartStatus", params.row.status)
"span",
{
class: "status-" + params.row.status,
},
this.$dict.getLabel("assessmentStartStatus", params.row.status)
);
},
},
{ slot: "options", label: "操作", align: "center" },
{slot: "options", label: "操作", align: "center"},
],
tableData: [],
dialog: {
@@ -267,25 +197,26 @@ export default {
},
formRules: {
shopName: [
{ required: true, message: "请输入店铺名称", trigger: "change" },
{required: true, message: "请输入店铺名称", trigger: "change"},
],
shopkeeper: [
{ required: true, message: "请输入店主", trigger: "blur" },
{required: true, message: "请输入店主", trigger: "blur"},
],
phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
phone: [{required: true, message: "请输入联系电话", trigger: "blur"}],
shopAddress: [
{ required: true, message: "请输入店铺地址", trigger: "blur" },
{required: true, message: "请输入店铺地址", trigger: "blur"},
],
status: [{ required: true, message: "请选择状态", trigger: "blur" }],
status: [{required: true, message: "请选择状态", trigger: "blur"}],
areaId: [
{ required: true, message: "请选择事件区域", trigger: "blur" },
{required: true, message: "请选择事件区域", trigger: "blur"},
],
operators: [
{ required: true, message: "请选择操作员", trigger: "blur" },
{required: true, message: "请选择操作员", trigger: "blur"},
],
},
peopleAjaxUrl: "/admin/user/page",
isLevel5: false,
authDialog: false,
form: {}
};
},
@@ -293,30 +224,29 @@ export default {
...mapState(["user"]),
},
mounted() {
created() {
this.unitId = this.user.info.unitId;
this.$dict.load(["assessmentStartStatus"]).then(() => {
this.$dict.load("assessmentStartStatus").then(() => {
this.getList();
});
},
methods: {
getList() {
this.isLevel5 = this.areaId.substring(this.areaId.length - 3) != "000";
this.instance
.post(`/app/appvillagerintegralshop/list`, null, {
params: {
...this.search,
areaId: this.areaId,
},
})
.then((res) => {
if (res.code == 0) {
this.tableData = res.data.records;
this.total = res.data.total;
}
});
.post(`/app/appvillagerintegralshop/list`, null, {
params: {
...this.search,
areaId: this.areaId,
},
})
.then((res) => {
if (res.code == 0) {
this.tableData = res.data.records;
this.total = res.data.total;
}
});
},
timeChange() {
@@ -332,21 +262,40 @@ export default {
},
editItem(row) {
this.dialogInfo = { ...row };
this.dialogInfo = {...row};
this.dialog.visible = true;
},
statusChage(row) {
this.dialogInfo = { ...row };
if (this.dialogInfo.operators.length) {
this.dialogInfo.operators.map((item) => {
item.userName = item.name;
});
} else {
this.dialogInfo.operators = [];
}
this.authDialog = true
this.form = JSON.parse(JSON.stringify(row))
},
handleAuth() {
this.instance.post(`/app/appvillagerintegralshop/addOrUpdate`, this.form).then((res) => {
if (res?.code == 0) {
this.$message.success("授权成功!")
this.authDialog = false
}
})
},
getSelect(e) {
this.dialogInfo.operators = e;
this.dialogInfo.operators.map((item) => {
if (!item.name) {
item.name = item.userName;
}
});
this.instance
.post(`/app/appvillagerintegralshop/addOrUpdate`, this.dialogInfo)
.then((res) => {
this.dialogInfo.operators = []
if (res.code == 0) {
this.onReset();
}
}).catch(() => {
this.dialogInfo.operators = []
})
},
onReset() {
this.search.current = 1;
this.getList();
@@ -363,13 +312,13 @@ export default {
this.$refs[formName].validate((valid) => {
if (valid) {
this.instance
.post(`/app/appvillagerintegralshop/addOrUpdate`, this.dialogInfo)
.then((res) => {
if (res.code == 0) {
this.onReset();
this.onCancel();
}
});
.post(`/app/appvillagerintegralshop/addOrUpdate`, this.dialogInfo)
.then((res) => {
if (res.code == 0) {
this.onReset();
this.onCancel();
}
});
} else {
return false;
}
@@ -390,24 +339,6 @@ export default {
this.dialogInfo.operators = [];
},
getSelect(e) {
this.dialogInfo.operators = e;
this.dialogInfo.operators.map((item) => {
if (!item.name) {
item.name = item.userName;
}
});
this.instance
.post(`/app/appvillagerintegralshop/addOrUpdate`, this.dialogInfo)
.then((res) => {
this.dialogInfo.operators = []
if (res.code == 0) {
this.onReset();
}
}).catch(() => {
this.dialogInfo.operators = []
})
},
delate(index) {
this.dialogInfo.operators.splice(index, 1);
@@ -431,6 +362,7 @@ export default {
height: 100%;
overflow: auto;
background: #f3f6f9;
.status-0 {
color: #ff4466;
}

View File

@@ -43,5 +43,8 @@ export default {
<style lang="scss" scoped>
.AiUserPicker {
.el-select{
width: 100%;
}
}
</style>