大宝管理后台代码
ne1
zzzz
2024-04-07 69ff731fbacf2f2ae16f98a355506bfeb01dd567
src/views/risksetting/productsetting.vue
@@ -104,145 +104,152 @@
                    </a-col>
                </a-row>
            </a-card> -->
    </a-form>
    <div class="bottomfixed">
      <div style="float:right">
        <a-button type="primary" @click="OkaddUserdialog" :loading="addUserDialogloading">
          保存当前设置
        </a-button>
      <div style="float: right">
        <a-button type="primary" @click="OkaddUserdialog" :loading="addUserDialogloading"> 保存当前设置 </a-button>
      </div>
    </div>
  </page-header-wrapper>
</template>
<script>
import { getProductSetting, productupdate } from '@/api/risksetting'
import pick from 'lodash.pick'
export default {
    name: 'Productsetting',
    data () {
        return {
            addUserform: this.$form.createForm(this),
            loading: false,
            fields: ['stockDisplay', 'kcStockDisplay', 'indexDisplay', 'futuresDisplay', 'realNameDisplay', 'fundsDisplay', 'delayDisplay', 'expandDisplay', 'marginDisplay', 'endDisplay'],
            labelCol: {
                xs: { span: 10 },
                sm: { span: 10 },
                md: { span: 10 }
            },
            wrapperCol: {
                xs: { span: 14 },
                sm: { span: 14 },
                md: { span: 14 }
            },
            addUserDialogloading: false,
            details: {}
        }
    },
    mounted () {
        this.getdetail()
    },
    methods: {
        OkaddUserdialog () {
            const form = this.$refs.addUserform.form
            form.validateFields((errors, values) => {
                if (!errors) {
                    this.addUserDialogloading = true
                    this.loading = true
                    values.id = this.details.id
                    productupdate(values).then(res => {
                        if (res.status == 0) {
                            this.$message.success({ content: res.msg, duration: 2 })
                            this.getdetail()
                        } else {
                            this.$message.error({ content: res.msg })
                        }
                        this.addUserDialogloading = false
                    })
                }
            })
        },
        getdetail () {
            var that = this
            this.loading = true
            getProductSetting().then(res => {
                this.details = res.data
                this.fields.forEach(v => this.addUserform.getFieldDecorator(v))
                this.addUserform.setFieldsValue(pick(res.data, this.fields))
                setTimeout(() => {
                    that.loading = false
                }, 500)
            })
        }
  name: 'Productsetting',
  data() {
    return {
      addUserform: this.$form.createForm(this),
      loading: false,
      fields: [
        'stockDisplay',
        'kcStockDisplay',
        'indexDisplay',
        'futuresDisplay',
        'realNameDisplay',
        'fundsDisplay',
        'delayDisplay',
        'expandDisplay',
        'marginDisplay',
        'endDisplay',
      ],
      labelCol: {
        xs: { span: 10 },
        sm: { span: 10 },
        md: { span: 10 },
      },
      wrapperCol: {
        xs: { span: 14 },
        sm: { span: 14 },
        md: { span: 14 },
      },
      addUserDialogloading: false,
      details: {},
    }
  },
  mounted() {
    this.getdetail()
  },
  methods: {
    OkaddUserdialog() {
      const form = this.$refs.addUserform.form
      form.validateFields((errors, values) => {
        if (!errors) {
          this.addUserDialogloading = true
          this.loading = true
          values.id = this.details.id
          productupdate(values).then((res) => {
            if (res.status == 0) {
              this.$message.success(res.msg)
              this.getdetail()
            } else {
              this.$message.error(res.msg)
            }
            this.addUserDialogloading = false
          })
        }
      })
    },
    getdetail() {
      var that = this
      this.loading = true
      getProductSetting().then((res) => {
        this.details = res.data
        this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
        this.addUserform.setFieldsValue(pick(res.data, this.fields))
        setTimeout(() => {
          that.loading = false
        }, 500)
      })
    },
  },
}
</script>
<style lang="less" scoped>
.bottomfixed {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 9;
    width: 100%;
    height: 56px;
    padding: 0 24px;
    line-height: 56px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 9;
  width: 100%;
  height: 56px;
  padding: 0 24px;
  line-height: 56px;
  background: #fff;
  border-top: 1px solid #e8e8e8;
}
.card {
    margin-bottom: 24px;
  margin-bottom: 24px;
}
/deep/ .ant-pro-global-footer {
    margin: 0 0 48px 0 !important;
  margin: 0 0 48px 0 !important;
}
.popover-wrapper {
    :deep(.antd-pro-pages-forms-style-errorPopover .ant-popover-inner-content) {
        min-width: 256px;
        max-height: 290px;
        padding: 0;
        overflow: auto;
    }
  :deep(.antd-pro-pages-forms-style-errorPopover .ant-popover-inner-content) {
    min-width: 256px;
    max-height: 290px;
    padding: 0;
    overflow: auto;
  }
}
.antd-pro-pages-forms-style-errorIcon {
    user-select: none;
    margin-right: 24px;
    color: #f5222d;
    cursor: pointer;
  user-select: none;
  margin-right: 24px;
  color: #f5222d;
  cursor: pointer;
    i {
        margin-right: 4px;
    }
  i {
    margin-right: 4px;
  }
}
.antd-pro-pages-forms-style-errorListItem {
    padding: 8px 16px;
    list-style: none;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    transition: all .3s;
  padding: 8px 16px;
  list-style: none;
  border-bottom: 1px solid #e8e8e8;
  cursor: pointer;
  transition: all 0.3s;
    &:hover {
        background: #e6f7ff;
    }
  &:hover {
    background: #e6f7ff;
  }
    .antd-pro-pages-forms-style-errorIcon {
        float: left;
        margin-top: 4px;
        margin-right: 12px;
        padding-bottom: 22px;
        color: #f5222d;
    }
  .antd-pro-pages-forms-style-errorIcon {
    float: left;
    margin-top: 4px;
    margin-right: 12px;
    padding-bottom: 22px;
    color: #f5222d;
  }
    .antd-pro-pages-forms-style-errorField {
        margin-top: 2px;
        color: rgba(0, 0, 0, .45);
        font-size: 12px;
    }
  .antd-pro-pages-forms-style-errorField {
    margin-top: 2px;
    color: rgba(0, 0, 0, 0.45);
    font-size: 12px;
  }
}
</style>