|
|
@@ -0,0 +1,164 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div class="filter-container">
|
|
|
+ <el-input @keyup.enter="handleSearch" class="w200px mr5px" v-model="queryForm.keyWord" placeholder="关键字搜索"/>
|
|
|
+ <el-button type="primary" @click="handleSearch">
|
|
|
+ <i-ep-search/>
|
|
|
+ 搜索
|
|
|
+ </el-button>
|
|
|
+ <div class="w100px ml10px" style="display: inline-block;">
|
|
|
+ <el-checkbox style="position: absolute;top: 11px" v-model="disableLock" label="已禁用"
|
|
|
+ border></el-checkbox>
|
|
|
+ </div>
|
|
|
+ <el-button @click="openDialog()" color="#11a983">
|
|
|
+ <i-ep-plus/>
|
|
|
+ 增加门店品牌
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" @click="refreshTableInfo">
|
|
|
+ <i-ep-refresh/>
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="table-con">
|
|
|
+ <el-table
|
|
|
+ :max-height="tableHeight"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData"
|
|
|
+ highlight-current-row
|
|
|
+ border
|
|
|
+ >
|
|
|
+ <el-table-column label="操作" width="140">
|
|
|
+ <template #default="{row}">
|
|
|
+ <el-button link @click="openDialog(row.id)" type="primary">
|
|
|
+ <i-ep-edit/>
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="row.enable==1" link @click="handleDisable(row.id,0)" type="warning">禁用</el-button>
|
|
|
+ <el-button v-if="row.enable==0" type="success" link @click="handleDisable(row.id,1)">启用</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label="#"
|
|
|
+ width="50">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.$index + 1 }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="industryCode" width="150" label="客户行业代码"/>
|
|
|
+ <el-table-column prop="industryName" width="350" label="客户行业名称"/>
|
|
|
+ <el-table-column
|
|
|
+ prop="status"
|
|
|
+ label="状态">
|
|
|
+ <template #default="{row}">
|
|
|
+ <el-tag v-if="row.voidFlag==0" type="success">
|
|
|
+ 正常
|
|
|
+ </el-tag>
|
|
|
+ <el-tag v-else="row.voidFlag==1" type="danger">
|
|
|
+ 停用
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="createTime"
|
|
|
+ label="创建时间"
|
|
|
+ width="155">
|
|
|
+ <template #default="{row}">
|
|
|
+ <span v-if="row.createTime">
|
|
|
+ {{ $filters.getTime(row.createTime)}}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-if="total > 0"
|
|
|
+ v-model:total="total"
|
|
|
+ v-model:page="queryPage.pageIndex"
|
|
|
+ v-model:limit="queryPage.pageSize"
|
|
|
+ @pagination="getTableData"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <child-dialog ref="childDialog" @dialogChange="dialogChange"></child-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup lang="ts">
|
|
|
+import {queryStoreBrandList,voidStoreBrand} from "@/api/store";
|
|
|
+import ChildDialog from './compt/childDialog.vue'
|
|
|
+import {useTable} from '@/hooks/useTable'
|
|
|
+
|
|
|
+let disableLock = ref('')
|
|
|
+const childDialog = ref<any>()
|
|
|
+
|
|
|
+//增加编辑
|
|
|
+function openDialog(item?: any) {
|
|
|
+ childDialog.value.dialogVisible = true;
|
|
|
+ if (item) {
|
|
|
+ childDialog.value.dialogTitle = "编辑";
|
|
|
+ nextTick(() => {
|
|
|
+ childDialog.value.getItemData(item)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ nextTick(() => {
|
|
|
+ childDialog.value.dialogTitle = "增加";
|
|
|
+ childDialog.value.resetForm()
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//禁用删除
|
|
|
+function handleDisable(id, status) {
|
|
|
+ ElMessageBox.confirm("确认操作?", "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ const postData = {
|
|
|
+ id: id,
|
|
|
+ voidFlag: status
|
|
|
+ }
|
|
|
+ const params = {
|
|
|
+ "industryInfo": JSON.stringify(postData)
|
|
|
+ }
|
|
|
+ voidStoreBrand(params).then((response) => {
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ ElMessage.success("操作成功");
|
|
|
+ getTableData();
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+//修改成功后传递事件
|
|
|
+function dialogChange() {
|
|
|
+ getTableData()
|
|
|
+}
|
|
|
+
|
|
|
+const queryForm = reactive({
|
|
|
+ keyWord: '',
|
|
|
+ voidFlag: 0
|
|
|
+})
|
|
|
+watch(
|
|
|
+ () => disableLock.value,
|
|
|
+ (disableLock) => {
|
|
|
+ if (disableLock) {
|
|
|
+ queryForm.enable = 0
|
|
|
+ getTableData()
|
|
|
+ } else {
|
|
|
+ queryForm.enable = 1
|
|
|
+ getTableData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+);
|
|
|
+const {
|
|
|
+ tableData,
|
|
|
+ queryPage,
|
|
|
+ total,
|
|
|
+ loading,
|
|
|
+ getTableData,
|
|
|
+ tableHeight,
|
|
|
+ handleSearch,//搜索
|
|
|
+ refreshTableInfo,//刷新
|
|
|
+} = useTable(queryStoreBrandList, queryForm);
|
|
|
+</script>
|