zhengnaiwen_citu 7 miesięcy temu
rodzic
commit
df3ce011e6

+ 5 - 2
src/components/AutoComponents/MSearch/index.vue

@@ -18,6 +18,8 @@
         <el-input
           v-if="item.type === 'input'"
           v-model="form[item.prop]"
+          @keydown.enter.native="onSubmit"
+          :clearable="item.option.clearable ?? true"
           v-bind="item.option"
           v-on="item.handles"
         ></el-input>
@@ -26,14 +28,15 @@
         <el-select
           v-if="item.type === 'select'"
           v-model="form[item.prop]"
+          :clearable="item.option.clearable ?? true"
           v-bind="item.option"
           v-on="item.handles"
         >
           <el-option
             v-for="option in item.option.items"
             :key="option.value"
-            :label="option.label"
-            :value="option.value"
+            :label="option[item.option.labelText ?? option.label]"
+            :value="option[item.option.labelValue ?? option.value]"
           ></el-option>
         </el-select>
 

+ 16 - 5
src/views/humanResources/welfare/welfareList.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <m-search :items="searchItems" v-model="searchValues" @search="onSearch" class="mb-3">
+    <m-search ref="search" :items="searchItems" v-model="searchValues" @search="onSearch" class="mb-3">
       <template #button>
         <m-button type="primary" icon="el-icon-plus" @click="onAdd">新增</m-button>
       </template>
@@ -22,7 +22,7 @@
         <m-button text type="danger" size="small" @click="onDelete(row)">删除</m-button>
       </template>
     </m-table>
-    <welfareListEdit ref="welfareListEditRefs" :title="title"></welfareListEdit>
+    <welfareListEdit ref="welfareListEditRefs" :title="title" @refresh="init"></welfareListEdit>
   </div>
 </template>
 
@@ -47,7 +47,7 @@ export default {
       headers: [
         {
           label: '福利名称',
-          prop: 'name'
+          prop: 'subsidyName'
         },
         {
           label: '福利类别',
@@ -92,8 +92,19 @@ export default {
           label: '福利类别',
           prop: 'subsidyPersonnelCategoryId',
           type: 'select',
+          handles: {
+            focus: (v) => {
+              if (!this.searchValues.subsidyPersonnelCategoryId) {
+                this.$refs.search.$refs.select.remoteMethod(null)
+              }
+            }
+          },
           option: {
+            ref: 'select',
             placeholder: '请输入福利类别',
+            labelText: 'title',
+            labelValue: 'subsidyPersonnelCategoryId',
+            valueKey: 'subsidyPersonnelCategoryId',
             filterable: true,
             remote: true,
             remoteMethod: this.remoteMethod,
@@ -113,7 +124,7 @@ export default {
       this.loading = true
       try {
         const { data } = await getWelfarePage({
-          entity: this.searchValues,
+          subsidyCategory: this.searchValues,
           page: {
             ...this.pageInfo,
             orders: this.orders
@@ -168,7 +179,7 @@ export default {
     async onEdit (item) {
       this.title = '编辑福利'
       try {
-        const { data } = await getWelfareDetail({ id: item.subsidyCategoryId })
+        const { data } = await getWelfareDetail({ subsidyCategoryId: item.subsidyCategoryId })
         this.$refs.welfareListEditRefs.open({
           subsidyCategoryId: data.subsidyCategoryId,
           subsidyPersonnelCategoryId: data.subsidyPersonnelCategoryId,

+ 10 - 2
src/views/humanResources/welfare/welfareListEdit.vue

@@ -24,7 +24,7 @@ export default {
       return [
         {
           label: '福利名称',
-          prop: 'name',
+          prop: 'subsidyName',
           type: 'input',
           options: {
             placeholder: '请输入福利名称'
@@ -37,7 +37,15 @@ export default {
           label: '福利类型',
           prop: 'subsidyPersonnelCategoryId',
           type: 'select',
+          handles: {
+            focus: () => {
+              if (!this.values.subsidyPersonnelCategoryId) {
+                this.remoteMethod(null)
+              }
+            }
+          },
           options: {
+            ref: 'select',
             placeholder: '请选择福利类型',
             filterable: true,
             remote: true,
@@ -128,7 +136,7 @@ export default {
       this.$refs.form.validate(async valid => {
         if (!valid) return
         try {
-          await saveWelfare(this.values)
+          await saveWelfare({ subsidyCategory: this.values })
           this.$message.success('操作成功')
           this.$refs.dialog.close()
           this.$emit('refresh')

+ 2 - 1
src/views/humanResources/welfare/welfareType.vue

@@ -56,7 +56,8 @@ export default {
         }
       ],
       searchValues: {
-        welfareType: ''
+        title: null,
+        tag: null
       },
       headers: [
         {