zhengnaiwen_citu před 3 měsíci
rodič
revize
979389b185

+ 1 - 1
src/components/AutoComponents/MForm/index.vue

@@ -101,7 +101,7 @@
             v-on="item.handles"
           ></el-cascader>
         </template>
-        <template v-if="item.slotAfter">
+        <template v-if="$scopedSlots[`${item.prop}.after`]">
           <slot :name="`${item.prop}.after`"></slot>
         </template>
       </el-form-item>

+ 1 - 1
src/views/salary/solution/components/solutionDetails.vue

@@ -21,7 +21,7 @@
             v-for="(item, index) in rules"
             :key="item.category"
             :label="item.category"
-            :name="index"
+            :name="index.toString()"
           >
             <!-- <template> -->
               <!-- <m-card shadow="never" > -->

+ 5 - 20
src/views/sandbox/sandboxCalculate.vue

@@ -1,16 +1,5 @@
 <template>
   <m-dialog title="绩效测算" v-bind="$attrs" ref="dialog">
-    <div v-if="!isSuccess" style="height: 200px;" class="d-flex flex-column justify-center align-center">
-      <el-date-picker
-        v-model="month"
-        type="month"
-        placeholder="请选择数据月份">
-      </el-date-picker>
-      <div>* 请选择数据所在月份进行测算</div>
-      <m-button :disabled="loading" type="success" class="mt-3" @click="onStart">
-        {{ loading ? '正在测算中,请稍后...' : '开始测算'}}
-      </m-button>
-    </div>
     <div v-if="loading" style="height: 200px;" v-loading="loading"></div>
     <el-result v-if="isSuccess" icon="success" title="测算完成" subTitle="点击查看测算结果">
       <template slot="extra">
@@ -37,22 +26,17 @@ export default {
     return {
       loading: false,
       isSuccess: false,
-      month: null,
       itemData: {}
     }
   },
   methods: {
-    async open (item) {
-      this.month = null
+    async open (item, month) {
       this.itemData = item
       this.isSuccess = false
       this.$refs.dialog.open()
+      this.onStart(month)
     },
-    onStart () {
-      if (!this.month) {
-        this.$message.error('请选择月份')
-        return
-      }
+    onStart (month) {
       this.loading = true
       setTimeout(() => {
         this.loading = false
@@ -60,7 +44,8 @@ export default {
       }, 3000)
     },
     onReset () {
-      this.isSuccess = false
+      // this.isSuccess = false
+      this.$refs.dialog.close()
     },
     onDetails () {
       this.$refs.sandboxResultRefs.open()

+ 43 - 10
src/views/sandbox/sandboxParam.vue

@@ -1,13 +1,14 @@
 <template>
   <m-dialog ref="dialog" title="系数管理" v-bind="$attrs">
     <template #button-after>
-      <m-button type="success" @click="onOpen('sandboxCalculateRefs')">选择数据开始测算</m-button>
+      <m-button type="success" @click="onStart">开始测算</m-button>
     </template>
-    <el-form v-loading="loading" label-width="100px">
-      <el-form-item label="名称">
+    <m-form ref="form" v-loading="loading" label-width="100px" :items="formItems" v-model="formValues">
+      <template #name>
         <el-tag color="primary">{{ itemData.title }}</el-tag>
-      </el-form-item>
-      <el-form-item label="系数管理">
+      </template>
+      <template #[`month.after`]>* 请选择数据所在月份进行测算</template>
+      <template #param>
         <m-card shadow="never">
           <template v-if="items.length" v-slot:default>
             <el-tabs v-model="activeNames" >
@@ -60,8 +61,9 @@
             <m-empty description="尚未配置系数"></m-empty>
           </template>
         </m-card>
-      </el-form-item>
-    </el-form>
+      </template>
+    </m-form>
+
     <SandboxCalculate ref="sandboxCalculateRefs" append-to-body @issue="$emit('issue', $event)"></SandboxCalculate>
   </m-dialog>
 </template>
@@ -83,7 +85,33 @@ export default {
       activeNames: null,
       loading: false,
       itemData: {},
-      items: []
+      items: [],
+      formItems: [
+        {
+          label: '名称',
+          prop: 'name'
+        },
+        {
+          label: '数据月份',
+          prop: 'month',
+          type: 'datePicker',
+          options: {
+            clearable: false,
+            type: 'month',
+            format: 'yyyy-MM',
+            valueFormat: 'yyyy-MM',
+            placeholder: '选择查询月份'
+          },
+          rules: [
+            { required: true, message: '请选择数据月份', trigger: 'change' }
+          ]
+        },
+        {
+          label: '系数管理',
+          prop: 'param'
+        }
+      ],
+      formValues: {}
     }
   },
   methods: {
@@ -121,8 +149,13 @@ export default {
         this.loading = false
       }
     },
-    onOpen (ref) {
-      this.$refs[ref]?.open && this.$refs[ref].open(this.itemData)
+    onStart () {
+      this.$refs.form.validate(valid => {
+        if (!valid) {
+          return
+        }
+        this.$refs.sandboxCalculateRefs.open(this.itemData, this.formValues.month)
+      })
     }
     // async onSure () {
     //   const query = {