| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <template>
- <div id="">
- <Search
- ref="search"
- :formList="formList"
- :formData="formData"
- @onSubmit="search"
- ></Search>
- <div style="text-align: right; margin-bottom: 10px">
- <el-button :size="$store.state.defaultSize" @click="delPL" type="primary"
- >批量删除</el-button
- >
- <el-button :size="$store.state.defaultSize" @click="add" type="primary"
- >新增</el-button
- >
- </div>
- <Table
- ref="table"
- :tableData="tableData"
- :tableList="tableList"
- :rowKey="'NewPositionId'"
- :check="true"
- @selectionChange="selectionChange"
- @changeSort="changeSort"
- >
- <template #right="scope"
- ><el-button
- v-if="scope.row.status === 1"
- @click="del(scope.row, 0)"
- type="text"
- size="small"
- >停用</el-button
- >
- <el-button
- v-if="scope.row.status === 0"
- @click="del(scope.row, 1)"
- type="text"
- size="small"
- >启用</el-button
- >
- <el-button @click="del(scope.row, -1)" type="text" size="small"
- >删除</el-button
- >
- </template>
- </Table>
- <Pagination
- :pageindex="formData.pageindex"
- :pagesize="formData.pagesize"
- :total="total"
- @handleSizeChange="handleSizeChange"
- @handleCurrentChange="handleCurrentChange"
- ></Pagination>
- <Operation ref="operation"></Operation>
- </div>
- </template>
- <script>
- import Search from "@/components/search/index.vue";
- import Table from "@/components/table/index.vue";
- import Pagination from "@/components/pagination/index.vue";
- import Operation from "./operation.vue";
- export default {
- components: { Search, Operation, Table, Pagination },
- data() {
- return {
- formList: [
- {
- label: "分类:",
- prop: "Seat",
- scope: "TypeList",
- },
- ],
- formData: { pageindex: 1, pagesize: 10 },
- tableData: [],
- tableList: [
- {
- label: "编号",
- prop: "NewPositionId",
- },
- {
- label: "标题",
- prop: "Title",
- },
- {
- label: "类型",
- prop: "SeatName",
- },
- {
- label: "排序",
- prop: "SortNumber",
- scope: "input",
- width: "90",
- },
- {
- label: "状态",
- prop: "Status",
- scope: "options",
- options: [
- { label: "停用", value: 0 },
- { label: "正常", value: 1 },
- ],
- },
- ],
- total: 0,
- routerTableData: [],
- checkbox: [], //当前选中
- };
- },
- created() {
- this.$api.XfSysBussinessGetMenuList().then((res) => {
- this.routerTableData = res.Data || [];
- });
- this.search();
- },
- methods: {
- changeSort(e, item) {
- this.$api
- .XfSysBussinessUpdateSortNumber({
- List: [
- { NewPositionId: item.NewPositionId, SortNumber: parseInt(e) },
- ],
- })
- .then((res) => {
- this.search();
- this.$message.success("排序成功");
- });
- },
- selectionChange(e) {
- this.checkbox = e;
- },
- search(e) {
- if (e === "init") {
- this.formData = { pageindex: 1, pagesize: 10 };
- this.clearCheck();
- }
- this.$api.XfSysBussinessGetNewPositionList(this.formData).then((res) => {
- this.tableData = res.Data.List || [];
- this.total = res.Data.TotalCount;
- });
- },
- add() {
- this.$refs.operation.showInit();
- },
- clearCheck() {
- this.checkbox = [];
- this.$refs.table.$refs.table.clearSelection();
- },
- delPL() {
- if (this.checkbox.length > 0) {
- this.$confirm(
- `此操作将永久删除${this.checkbox.length}条数据, 是否继续?`,
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(() => {
- let array = this.checkbox.map((item) => {
- return item.NewPositionId;
- });
- this.$api
- .XfSysBussinessEditNewPositionStatus({
- idarr: array,
- type: -1,
- })
- .then((res) => {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.clearCheck();
- this.search();
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "已取消删除",
- });
- });
- } else {
- this.$message.error("请勾选需要删除的数据");
- return;
- }
- },
- del(item, k) {
- this.$api
- .XfSysBussinessEditNewPositionStatus({
- ids: item.NewPositionId,
- type: k,
- })
- .then((res) => {
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- this.clearCheck();
- this.search();
- });
- },
- handleCurrentChange(e) {
- this.formData.pageindex = e;
- this.search();
- },
- handleSizeChange(e) {
- this.formData.pageindex = 1;
- this.formData.pagesize = e;
- this.search();
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
|