haoxuan
2024-04-24 5d36d46434a7f4d23844dc94c34e7716eae172a8
src/views/employeeSalary/salaryPlan/index.vue
@@ -17,9 +17,8 @@
          <template slot="tableButton">
            <el-table-column label="操作" width="180">
              <template slot-scope="scope">
                <el-button @click.stop="handleClick(scope.row, '查看')" type="text" size="small">查看</el-button>
                <el-button @click.stop="handleClick(scope.row, '修改')" type="text" size="small">修改</el-button>
                <el-button @click.stop="handleClick(scope.row, '删除')" type="text" size="small">删除</el-button>
                <el-button @click.stop="handleClick(scope.row)" type="text" size="small">修改</el-button>
                <el-button @click.stop="delClick(scope.row)" type="text" size="small">删除</el-button>
                
              </template>
            </el-table-column>
@@ -27,7 +26,7 @@
        </TableCommonView>
      </div>
      <AddDialog 
        :editDiaConfig="editConfig"
      ref="add" :editRow="editRow"  @refresh="refresh"
      />
      <div class="btn-pager">
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -39,6 +38,7 @@
<script>
import AddDialog from "@/views/employeeSalary/salaryPlan/components/addDialog.vue"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getSalaryPlanList, deleteSalaryPlanInfo } from  "@/api/employeeSalary/salaryPlan.js"
export default {
  name: "salaryPlan",
  props: {},
@@ -55,24 +55,17 @@
        { label: "工种", prop: "groupNumber",min:100 },
        { label: "薪资类型", prop: "startCarNumber",min:110 },
        { label: "计费周期", prop: "endCarNumber",min:110 },
        { label: "计费公式定义", prop: "carFlag", },
        { label: "计费公式定义", prop: "carFlag",min:140  },
        { label: "添加时间", prop: "notes",min:130 },
        { label: "添加人", prop: "notes",min:110 },
      ],
      editConfig:{
        visible:false,
        infomitton:{
          TabsIndex:0,
          workshopId:null,
        }
      },
      getDataParams: {
        keyWord: '',
      },
      keyword: '',
      editRow:{},
    }
  },
  created() {
    this.setTable()
    this.getData(this.keyword)
  },
  methods: {
    setTable() {
@@ -107,6 +100,34 @@
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getSalaryPlanList({
        keyword: this.keyword,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          if (res.code === 200) {
            if (res.data) {
              const list = res.data
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.total
            } else {
              this.tableList.tableInfomation = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // 新增
    addBtnClick() {
      this.editConfig.infomitton={}
@@ -115,13 +136,52 @@
    },
    // 搜索
    onFilterSearch(searchText) {
      this.getDataParams.keyWord = searchText,
        this.getData()
      this.keyword= searchText,
      this.pagerOptions.currPage = 1
      this.getData()
    },
    refresh(){
      this.getData()
    },
    // 表格行点击
    tableRowClick(row) {
      console.log(row, "row")
    },
    // 编辑
    handleClick(row) {
      let config=JSON.parse(JSON.stringify(row));
      this.editRow = { ...config,
        title:'编辑',
        type:'edit',
        shopNameObj:{
          value:config.shopId,
          label:config.shopName,
        },
        workTypeObj:{
          value:config.workTypeId,
          label:config.workType,
        }
      }
      this.$refs.add.islook = true;
    },
    // 删除
    delClick(row) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          deleteSalaryPlanInfo({ id: row.id }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()
            }
          })
        })
        .catch(() => {})
    },
  }
}
</script>