分支自 SuZhouGuanHong/TaiYuanTaiZhong

WMS
dengjunjie
2023-12-13 d772a6cddc8ed656a2cb5604fc02f6e891db546e
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
  <div>
    <div class="layout-content">
      <div class="layout-right">
        <h5>其他组件</h5>
        <el-alert show-icon
          >table+表单数据/测试完整示例/表单布局/其他组件,都是对element-plus二次封装,
          只需要按现的方式进行配置json数据及实现方法即可使用</el-alert
        >
        <div class="com">
          <div>
            <h3>手动打开tabs,详细使用见:框架文档->前端开发->手动打开tabs</h3>
            <el-button type="info" size="small" @click="openUserInfo"
              >打开个人中心</el-button
            >
            <el-button
              type="error"
              size="small"
              @click="$tabs.close('/userinfo')"
              >关闭个人中心</el-button
            >
          </div>
          <div>
            <h3>弹出框/post/get请求(http请求代码位置:api->http.js)</h3>
            <el-button type="error" size="small" @click="httpTest1"
              >post/get请求不带提示</el-button
            >
            <el-button type="success" size="small" @click="httpTest2"
              >post/get请求带默认提示</el-button
            >
            <el-button type="info" size="small" @click="httpTest3"
              >post/get请求带自定义提示</el-button
            >
          </div>
          <div>
            <h3>vuex状态管理,vuex代码路径:store->index.js</h3>
            <div style="padding: 10px; max-width: 800px; word-break: break-all">
              {{ userText }}
            </div>
            <el-button type="info" size="small" @click="getUserInfo"
              >获取本地用户信息</el-button
            >
            <el-button type="info" size="small" @click="getPermission"
              >获取本地用户菜单及权限</el-button
            >
            <el-button type="info" size="small" @click="getToken"
              >获取本地用户Token</el-button
            >
          </div>
 
          <!-- 文件操作 -->
          <div class="d-group" style="margin-top: 30px">
            <div>
              <h3>上传excel文件</h3>
              <UploadExcel
                @importExcelAfter="importAfter"
                :url="url"
              ></UploadExcel>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import UploadExcel from "@/components/basic/UploadExcel.vue";
import Icons from "@/components/basic/Icons.vue";
export default {
  components: { UploadExcel, Icons },
  methods: {
    openUserInfo() {
      this.$tabs.open({
        text: "个人中心",
        path: "/userinfo",
        query: { x: 2221 },
      });
    },
    //每次刷新页面后会重新加载用户的最新信息
    getUserInfo() {
      let userInfo = this.$store.getters.getUserInfo();
      this.userText = JSON.stringify(userInfo);
    },
    getPermission() {
      let permission = this.$store.state.permission;
      this.userText = JSON.stringify(permission);
    },
    getToken() {
      let token = this.$store.getters.getToken();
      this.userText = token;
    },
    importAfter() {
      //上传完成后处理
    },
    onOpenChange(id) {
      this.$essage.error("打开菜单" + id);
    },
    onSelect(id) {
      this.$message.error("菜单点击" + id);
    },
    httpTest1() {
      //不带提示
      let url = "/api/test2019/GetMsg",
        param = {};
      this.http.post(url, param).then((result) => {
        this.$message.error(result);
      });
    },
    httpTest2() {
      //带默认提示
      let url = "/api/test2019/delay",
        param = {};
      this.http.post(url, param, true).then((result) => {
        this.$message.error(result);
      });
    },
    httpTest3() {
      //自定义提示
      //第三个参数loadText为是否显示加载提示,默认为false,不显示任何提示,如果设置为true默认加载提示文字为[正在处理中],也可以自下定义显示的文字,http请求的代码位置:src->api->http.js
      //demo上
      let url = "/api/test2019/delay",
        param = {},
        loadText = "这里参数可以自定文字";
      this.http.post(url, param, loadText).then((result) => {
        this.$message.error(result);
      });
    },
  },
  created() {},
  data() {
    return {
      userText: "",
      viewModel: false,
      iconModel: false,
      icon: "ivu-icon ivu-icon-logo-android",
      url: "", //上传的url
      template: {
        //下载模板的路径及模板的文件名,如果url为空,则不会显示下载模板
        url: "/api/App_TransactionAvgPrice/DownLoadTemplate",
        fileName: "测试模板下载",
      },
      comSrc1: "",
      comSrc:
        "https://imgs-1256993465.cos.ap-chengdu.myqcloud.com/h5pic/x2.jpg",
    };
  },
};
</script>
<style lang="less" scoped>
.layout-content {
  position: relative;
  width: 1000px;
  left: 0;
  margin: 0;
  margin: auto;
  display: flex;
  .layout-left {
    width: 200px;
    margin-right: 10px;
  }
  .layout-right {
    flex: 1;
  }
}
.com > div {
  margin-top: 30px;
}
.d-group {
  display: inline-block;
  width: 100%;
  > div {
    float: left;
    width: 49%;
  }
  > div:first-child {
    margin-right: 2%;
  }
}
.on-icon {
  line-height: 20px;
  position: relative;
  .remove {
    display: none;
    color: red;
    right: 7px;
    position: absolute;
    top: -14px;
    font-size: 13px;
  }
}
</style>