hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
  <el-dialog
    title="修改"
    :visible="value"
    width="30%"
    :modal='false'
    :before-close="handleClose">
     <div class='authentication_show'>
    <div class="clearfix">
      <section class="sec">
        <p class="label-t">标题:</p>
        <article>
          <el-input
            placeholder="请输入"
            size="small"
            maxlength="50"
            v-model="name"
          ></el-input>
        </article>
      </section>
      <p class="w_col_24 color-text">
        <span class="text">文本颜色:</span>
        <public-input-color-picker
          class='picker'
          placeholder="请输入标签颜色"
          v-model="color"
          @change="(val)=>{color=val}"
        />
      </p>
    </div>
  </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="onCancel">取 消</el-button>
      <el-button type="primary" @click="onOk" :loading="okLoading">确 定</el-button>
    </span>
  </el-dialog>
</template>
 
<script>
import publicInputColorPicker from "../../../../components/inputpicker/index.vue"
export default {
  props: {
    value: {type: Boolean},
    // show: { type: Boolean, default: false }, // 弹框可见标志
    item: { type: Object}
  },
  components: {publicInputColorPicker},
  data() {
    return {
      visible: this.show,
      name: '',
      color: '',
      okLoading: false
    }
  },
  watch: {
    item (val) {
      if (val) {
        this.name = val.name;
        this.color = val.color
      }
    }
  },
  methods: {
    handleClose(done) {
      this.$emit('change', false);
    },
    onOk() {
      let parmas = {
        color: this.color,
        id: this.item.id,
        name: this.name
      };
 
      this.okLoading = true;
      this.$api.post("dyn/type/edit", parmas,
        e => {
          demo.toast("编辑成功");
          this.$emit('success');
          this.onCancel();
          // this.$nextTick(() => {
          //   this.$store.dispatch("setFixed", {
          //     event: "del",
          //     type: type,
          //     time: Date.now(),
          //   });
          // });
        },
        err=> {
          demo.toast(err.msg)
        }
      )
      this.okLoading = false;
    },
    onCancel () {
      this.$emit('change', false);
    }
  }
};
</script>
 
<style lang="less" scoped>
.authentication_show {
  p {
    font-size: 15px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
  }
  .sec {
    width: 500px;
  }
  /deep/.el-input__inner {
    width: 250px;
  }
  .color-text {
    /deep/.el-input__inner {
      width: 150px;
    }
    .text {
      float: left;
      display: block;
      line-height: 40px;
      padding-right: 5px;
    }
    .picker {
      float: left;
    }
    .color {
      width: 20px;
      height: 20px;
      display: block;
      float: left;
      margin-left: 15px;
    }
  }
}
</style>