|
@@ -9,12 +9,10 @@
|
|
|
placeholder="企业名称" clearable />
|
|
placeholder="企业名称" clearable />
|
|
|
<el-select class="form-input" v-model="baTable.table.filter!.status" @change="onSearchInput"
|
|
<el-select class="form-input" v-model="baTable.table.filter!.status" @change="onSearchInput"
|
|
|
placeholder="状态" clearable>
|
|
placeholder="状态" clearable>
|
|
|
- <el-option label="正常" value="1" />
|
|
|
|
|
- <el-option label="禁用" value="0" />
|
|
|
|
|
|
|
+ <el-option label="正常" :value="1" />
|
|
|
|
|
+ <el-option label="禁用" :value="0" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
- <template #quickSearchPrepend>
|
|
|
|
|
- <el-button type="primary" @click="onAdd">添加</el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <!-- <el-button type="primary" @click="onAdd" v-auth="'edit'">添加</el-button> -->
|
|
|
</TableHeader>
|
|
</TableHeader>
|
|
|
|
|
|
|
|
<!-- 表格 -->
|
|
<!-- 表格 -->
|
|
@@ -23,27 +21,27 @@
|
|
|
<template #status>
|
|
<template #status>
|
|
|
<el-table-column prop="status" align="center" label="状态" min-width="150">
|
|
<el-table-column prop="status" align="center" label="状态" min-width="150">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <el-switch v-model="scope.row.status" active-value="1" inactive-value="0" />
|
|
|
|
|
|
|
+ <el-switch @change="changeStatus(scope.row)" v-model="scope.row.status" :active-value="1" :inactive-value="0" />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</template>
|
|
</template>
|
|
|
<template #operate>
|
|
<template #operate>
|
|
|
<el-table-column prop="operate" align="center" label="操作" min-width="150">
|
|
<el-table-column prop="operate" align="center" label="操作" min-width="150">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <el-button type="primary" size="small" @click="onEdit(scope.row)">编辑</el-button>
|
|
|
|
|
- <el-button type="danger" size="small" @click="del(scope.row)">删除</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click="onEdit(scope.row)" v-auth="'edit'">编辑</el-button>
|
|
|
|
|
+ <el-button type="danger" size="small" @click="handleDel(scope.row)" v-auth="'delete'">删除</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</template>
|
|
</template>
|
|
|
</Table>
|
|
</Table>
|
|
|
|
|
|
|
|
<!-- 表单 -->
|
|
<!-- 表单 -->
|
|
|
- <PopupForm />
|
|
|
|
|
|
|
+ <PopupForm @success="baTable.getIndex()" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, provide, } from 'vue'
|
|
|
|
|
|
|
+import { provide, } from 'vue'
|
|
|
import { cloneDeep } from 'lodash-es'
|
|
import { cloneDeep } from 'lodash-es'
|
|
|
import baTableClass from '/@/utils/baTable'
|
|
import baTableClass from '/@/utils/baTable'
|
|
|
import Table from '/@/components/table/index.vue'
|
|
import Table from '/@/components/table/index.vue'
|
|
@@ -51,6 +49,8 @@ import TableHeader from '/@/components/table/header/index.vue'
|
|
|
import PopupForm from './popupForm.vue'
|
|
import PopupForm from './popupForm.vue'
|
|
|
import { baTableApi } from '/@/api/common'
|
|
import { baTableApi } from '/@/api/common'
|
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
+import { toggleStatus,del } from '/@/api/backend/userCenter/index'
|
|
|
|
|
+import { ElMessageBox } from 'element-plus'
|
|
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
|
name: 'company/index',
|
|
name: 'company/index',
|
|
@@ -89,21 +89,27 @@ const baTable = new baTableClass(
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
minWidth: 160
|
|
minWidth: 160
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- label: '操作',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- render: 'slot',
|
|
|
|
|
- slotName: 'operate',
|
|
|
|
|
- operator: false,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // label: '操作',
|
|
|
|
|
+ // align: 'center',
|
|
|
|
|
+ // render: 'slot',
|
|
|
|
|
+ // slotName: 'operate',
|
|
|
|
|
+ // operator: false,
|
|
|
|
|
+ // },
|
|
|
],
|
|
],
|
|
|
dblClickNotEditColumn: [undefined,],
|
|
dblClickNotEditColumn: [undefined,],
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
defaultItems: {
|
|
defaultItems: {
|
|
|
status: '1',
|
|
status: '1',
|
|
|
|
|
+ id: null,
|
|
|
},
|
|
},
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ onTableDblclick: () => {
|
|
|
|
|
+ return false
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@@ -117,9 +123,27 @@ const onSearchInput = () => {
|
|
|
baTable.getData()
|
|
baTable.getData()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 改变企业状态
|
|
|
|
|
+const changeStatus = (row:TableRow)=>{
|
|
|
|
|
+ baTable.table.loading = true
|
|
|
|
|
+ toggleStatus({id:row.id}).then(()=>{
|
|
|
|
|
+ baTable.getIndex()
|
|
|
|
|
+ }).finally(()=>{
|
|
|
|
|
+ baTable.table.loading = false
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 删除
|
|
// 删除
|
|
|
-const del = (row: TableRow) => {
|
|
|
|
|
- baTable.onTableAction('delete', { row })
|
|
|
|
|
|
|
+const handleDel = (row: TableRow) => {
|
|
|
|
|
+ ElMessageBox.confirm(`确定删除企业"${row.name}"吗?`, '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ del({ id: row.id }).then(() => {
|
|
|
|
|
+ baTable.getIndex()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const openForm = (type: 'Add' | 'Edit', row?: TableRow) => {
|
|
const openForm = (type: 'Add' | 'Edit', row?: TableRow) => {
|