schangxiang@126.com
2025-09-19 9be9c3784b2881a3fa25e93ae2033dc2803c0ed0
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
<template>
  <div ref="container" class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
      <!-- 字段插槽 -->
      <template slot="common-column-slot" slot-scope="{ row, col }">
        <template v-if="col.prop == 'msgStatus'">
          <el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])">
            {{ row[col.prop] }}
          </el-tag>
        </template>
        <template v-else-if="col.prop==dataOptions.linkColumn">
          <el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link>
        </template>
        <template v-else-if="col.dropdown_Id>0">
          {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
        </template>
        <template v-else>
          <template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
            {{ common.formatDate(row[col.prop], col.formatter) }}
          </template>
          <template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
            {{ common.formatNumber(row[col.prop], col.formatter) }}
          </template>
          <template v-else>
            {{ row[col.prop] }}
          </template>
        </template>
      </template>
    </yrt-data-list>
 
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes"></yrt-editor>
  </div>
</template>
 
<script>
import baseLayout from "@/components/common/base-layout.vue";
 
export default {
  name: "",
  components: {},
  mixins: [baseLayout],
  data() {
    return {
      // 状态值
      statusValueList: [
        {
          status: "已发送",
          bgColor: "#00ff99",
          color: "black"
        },
        {
          status: "未发送",
          bgColor: "#cc6633",
          color: "#fff"
        }
      ]
    };
  },
  methods: {
    // 状态背景颜色
    setStatusBgColor(status) {
      var colorItem = this.statusValueList.find(item => {
        return item.status === status;
      });
      var bgColor = "#fffff";
      if (colorItem) bgColor = colorItem.bgColor;
 
      return bgColor;
    },
    // 状态字体颜色
    setStatusColor(status) {
      var colorItem = this.statusValueList.find(item => {
        return item.status === status;
      });
      var color = "#fffff";
      if (colorItem) color = colorItem.color;
 
      return {
        border: 0,
        color: color
      };
    },
    // 列表页面按钮点击事件
    buttonClick(authNode) {
      switch (authNode) {
        case "send":
          // 发送
          return this.send();
      }
    },
    send() {
      const selectIDs = this.dataListSelections.map((item, index, Array) => {
        return item.commonMessage_Id;
      });
      if (!selectIDs) {
        this.$message({
          message: "至少选中一行!",
          type: "warning"
        });
        return false;
      }
 
      const url = "/api/oa/sms/send";
      const params = {
        ids: selectIDs
      };
      this.common.ajax(
        url,
        params,
        res => {
          this.common.showMsg(res);
          if (res.result) {
            this.dataList.reload();
          }
        },
        true
      );
    }
  }
};
</script>