| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <div id="app" v-cloak>
- <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1500px;"
- body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div>
- <span>基础设置</span>
- </div>
- </div>
- <div class="form_box">
- <el-form :model="ruleForm" size="small" ref="ruleForm" label-width="150px">
- <el-card shadow="never">
- <div>
- <el-row>
- <el-col :span="16">
- <el-form-item label="启用" style="margin-bottom: 0">
- <div>
- <el-switch v-model="ruleForm.is_enable" :active-value="1" :inactive-value="0"></el-switch>
- </div>
- </el-form-item>
- </el-col>
- </el-row>
- </div>
- </el-card>
- </el-form>
- <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 24px;"
- @click="store('ruleForm')" size="small">保存
- </el-button>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- loading: false,
- btnLoading: false,
- ruleForm: {
- is_enable: 0,
- },
- }
- },
- mounted: function () {
- this.loadData();
- },
- methods: {
- loadData() {
- this.loading = true;
- request({
- params: {
- r: 'clerk/setting/index',
- },
- method: 'get'
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0 && !isEmpty(e.data.data)) {
- this.ruleForm = e.data.data;
- }
- }).catch(e => {
- this.loading = false;
- })
- },
- store(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.btnLoading = true;
- request({
- params: {
- r: 'clerk/setting/index',
- },
- method: 'post',
- data: this.ruleForm
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code == 0) {
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.$message.error(e);
- this.btnLoading = false;
- })
- } else {
- this.btnLoading = false;
- console.log('error submit!!');
- return false;
- }
- });
- },
- }
- });
- </script>
- <style>
- .form_box {
- background-color: #f3f3f3;
- padding: 0 0 20px;
- }
- .button-item {
- margin-top: 12px;
- padding: 9px 25px;
- }
- .el-input-group__append {
- background-color: #fff;
- color: #353535;
- }
- </style>
|