zhengnaiwen_citu 5 місяців тому
батько
коміт
e9f4ae75be

+ 21 - 0
src/api/accumulatePoint.js

@@ -0,0 +1,21 @@
+import http from '@/utils/request'
+
+// 积分 列表
+export function getAccumulatePointList (data) {
+  return http.post('', data)
+}
+
+// 积分 保存
+export function saveAccumulatePoint (data) {
+  return http.post('', data)
+}
+
+// 积分 查询
+export function getAccumulatePoint (data) {
+  return http.post('', data)
+}
+
+// 积分 删除
+export function deleteAccumulatePoint (data) {
+  return http.post('', data)
+}

+ 97 - 3
src/views/humanResources/accumulatePoints/accumulatePointsEntering/index.vue

@@ -1,15 +1,109 @@
 <template>
   <div class="pa-3 white">
-
+    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
+    <m-table
+      v-loading="loading"
+      :items="items"
+      :headers="headers"
+      :page-size="pageInfo.size"
+      :page-current="pageInfo.current"
+      :total="total"
+      @page-change="onPageChange"
+    >
+      <template #card-tools>
+        <m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
+      </template>
+      <template #actions="{ row }">
+        <m-button type="primary" text @click="onEdit(row)">编辑</m-button>
+        <m-button type="danger" text @click="onDelete(row)">删除</m-button>
+      </template>
+    </m-table>
   </div>
 </template>
 
 <script>
+import {
+  // getAccumulatePointList,
+  deleteAccumulatePoint
+} from '@/api/accumulatePoint'
 export default {
-  name: 'accumulatePointsEntering'
+  name: 'accumulatePointsEntering',
+  data () {
+    return {
+      searchItems: [
+        {
+          label: '名称',
+          prop: 'name',
+          type: 'input',
+          options: {
+            placeholder: '请输入名称'
+          }
+        }
+      ],
+      searchValues: {
+        name: null
+      },
+      headers: [
+        { label: '名称', prop: 'name' },
+        { label: '状态', prop: 'status' },
+        { label: '操作', prop: 'actions', fixed: 'right', width: 300 }
+      ],
+      items: [],
+      total: 0,
+      pageInfo: {
+        current: 1,
+        size: 10
+      },
+      loading: false
+    }
+  },
+  created () {
+    this.onInit()
+  },
+  methods: {
+    async onInit () {
+      this.loading = true
+      try {
+        // const { data } = await getAccumulatePointList()
+        // this.items = data.records
+        // this.total = data.total
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onAdd () {
+      this.$refs.accumulatePointRefs.open()
+    },
+    onEdit (item) {
+      this.$refs.accumulatePointRefs.open(item)
+    },
+    onDelete (row) {
+      this.$confirm('确定删除吗?', '提示')
+        .then(async () => {
+          try {
+            await deleteAccumulatePoint({ id: row.id })
+            this.$message.success('删除成功')
+            this.onInit()
+          } catch (error) {
+            this.$message.error(error)
+          }
+        })
+        .catch(_ => {})
+    },
+    onSearch () {
+      this.pageInfo.current = 1
+      this.onInit()
+    },
+    onPageChange (index) {
+      this.pageInfo.current = index
+      this.onInit()
+    }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
-
+  /* 自定义样式 */
 </style>

+ 97 - 3
src/views/humanResources/accumulatePoints/accumulatePointsRules/index.vue

@@ -1,15 +1,109 @@
 <template>
   <div class="pa-3 white">
-
+    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
+    <m-table
+      v-loading="loading"
+      :items="items"
+      :headers="headers"
+      :page-size="pageInfo.size"
+      :page-current="pageInfo.current"
+      :total="total"
+      @page-change="onPageChange"
+    >
+      <template #card-tools>
+        <m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
+      </template>
+      <template #actions="{ row }">
+        <m-button type="primary" text @click="onEdit(row)">编辑</m-button>
+        <m-button type="danger" text @click="onDelete(row)">删除</m-button>
+      </template>
+    </m-table>
   </div>
 </template>
 
 <script>
+import {
+  // getAccumulatePointList,
+  deleteAccumulatePoint
+} from '@/api/accumulatePoint'
 export default {
-  name: 'accumulatePointsRules'
+  name: 'AccumulatePointRules',
+  data () {
+    return {
+      searchItems: [
+        {
+          label: '名称',
+          prop: 'name',
+          type: 'input',
+          options: {
+            placeholder: '请输入名称'
+          }
+        }
+      ],
+      searchValues: {
+        name: null
+      },
+      headers: [
+        { label: '名称', prop: 'name' },
+        { label: '状态', prop: 'status' },
+        { label: '操作', prop: 'actions', fixed: 'right', width: 300 }
+      ],
+      items: [],
+      total: 0,
+      pageInfo: {
+        current: 1,
+        size: 10
+      },
+      loading: false
+    }
+  },
+  created () {
+    this.onInit()
+  },
+  methods: {
+    async onInit () {
+      this.loading = true
+      try {
+        // const { data } = await getAccumulatePointList()
+        // this.items = data.records
+        // this.total = data.total
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onAdd () {
+      this.$refs.accumulatePointRefs.open()
+    },
+    onEdit (item) {
+      this.$refs.accumulatePointRefs.open(item)
+    },
+    onDelete (row) {
+      this.$confirm('确定删除吗?', '提示')
+        .then(async () => {
+          try {
+            await deleteAccumulatePoint({ id: row.id })
+            this.$message.success('删除成功')
+            this.onInit()
+          } catch (error) {
+            this.$message.error(error)
+          }
+        })
+        .catch(_ => {})
+    },
+    onSearch () {
+      this.pageInfo.current = 1
+      this.onInit()
+    },
+    onPageChange (index) {
+      this.pageInfo.current = index
+      this.onInit()
+    }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
-
+  /* 自定义样式 */
 </style>