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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<template>
  <div class="app-container stock-container">
    <el-container>
      <el-card class="box-card" style="width: 100%" shadow="never">
        <!--搜索条件-->
        <div class="filter-container">
          <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
        </div>
        <el-row style="margin-top: 15px">
          <el-col>
            <!--列表-->
            <div class="table-tool-bar" style="margin-bottom: 15px">
              <my-button name="新增" @click="handleAdd" site="tools" size="medium"/>
              <my-button name="导入" @click="openImport()" site="tools" size="medium" />
            </div>
            <div :style="{ 'overflow-y': 'auto', height: `calc(100vh - 320px)` }" v-loading="loading">
              <el-row v-if="list.length" class="card" :gutter="5">
                <el-col v-for="(item, index) in list" :key="index" class="cm-item">
                  <el-card class="card-data">
                    <div class="card-container">
                      <div class="card-header">
                        <div class="card-header-left">
                          <span>分发单号:</span>
                          <span class="value">{{ item.businessFormCode }}</span>
 
<!--                          <span style="padding-left: 30px">分发状态:</span>-->
<!--                          <span style="color: red" v-if="item.states === 0"  class="value">未分发</span>-->
<!--                          <span v-if="item.states === 2"  class="value">已分发</span>-->
                        </div>
                        <div class="card-header-right">
                          <!-- 导出单子 -->
<!--                          <el-button v-if="item.states === 0" name="下载" site="form" type="primary" size="mini" @click="handleDetail(item)">-->
<!--                            下载-->
<!--                          </el-button>-->
 
<!--                          <el-button v-if="item.states === 0" name="上传" site="form" type="primary" size="mini" @click="handleUploadPage(item)">-->
<!--                            上传-->
<!--                          </el-button>-->
 
                          <el-button name="查看详情" site="form" type="primary" size="mini" @click="handleDetail(item)">
                            查看详情
                          </el-button>
                        </div>
                      </div>
                      <div class="one-hed">
                        <div class="box"><span class="span-two">部门:</span>{{ item.inWarehouseName }}</div>
                        <div class="box"><span class="span-two">分发人:</span>{{ item.outOperatorName }}</div>
                        <div class="box">
                          <span class="span-two">分发时间:</span>{{ item.createTime | formatTime }}
                        </div>
                      </div>
                      <div class="card-end">
                        <div v-for="(just, index) in item.fromTransferTemplateInfoList" :key="index" class="item">
                          <div class="name">{{ just.goodsName }}</div>
                          <div class="value-box">
                            <div class="value-box-item">
                              <span class="label">数量:</span>
                              <span class="value">{{ just.count }}</span>
                              <span class="unit">{{ just.unit }}</span>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </el-card>
                </el-col>
              </el-row>
              <el-empty v-else description="暂无数据"></el-empty>
            </div>
            <el-pagination
                :small="false"
                :current-page="pageNum"
                :page-sizes="[5, 10, 20, 50, 100, 200, 300, 400, 500]"
                :page-size="pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
            />
          </el-col>
        </el-row>
      </el-card>
    </el-container>
 
    <!-- 上传分发单文件-->
    <uploadPage
      v-if="uploadPageSetting.show"
      :setting="uploadPageSetting"
      ref="uploadRef"
      @close="uploadPageSetting.show = false"
      @search="refreshData"
    ></uploadPage>
 
    <!--添加/编辑弹窗-->
    <edit
        v-if="editSetting.show"
        :setting="editSetting"
        ref="editRef"
        @close="editSetting.show = false"
        @search="refreshData"
    ></edit>
    <detail
        v-if="detailSetting.show"
        :setting="detailSetting"
        @close="detailSetting.show = false"
        ref="detailRef"
    ></detail>
 
    <my-import
      :import-setting="importSetting"
      :dialog-show="importSetting.dialogShow"
      :dialog-title="importSetting.dialogTitle"
    />
 
  </div>
</template>
 
<script>
import {transferList} from '@/api/stock/transfer';
import MyButton from '@/components/myButton/myButton';
import SettingIplatform from '@/utils/settingIplatform';
import myImport from '@/views/components/myImport';
import edit from './edit';
import detail from './detail';
import uploadPage from './uploadPage';
import listPage from '@/views/mixins/listPage';
import {getUserDetail} from "@/utils/auth";
import {getBaseUrl} from '@/utils/base';
 
export default {
  name: 'index',
  mixins: [listPage],
  components: {MyButton, myImport, edit, detail,uploadPage},
  data() {
    return {
      loading: false,
      adddialog: false,
      list: [],
 
      // 导入
      importSetting: {
        dialogTitle: '导入',
        dialogShow: false,
        fileSettings: {
          data: {},
          uploadUrl: getBaseUrl() + '/pc/l/wh/form/transfer/import2', // 上传地址
          accept: '.xls', // 格式
          type: 'text', // 回显形式
          loading: true, // 导入效果
        },
        /* 模板下载 */
        templateSettings: {
          templateName: '导入模板.xls', // 名称
          templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate?type=distribute', // 下载地址
        },
        onSuccess: null,
      },
 
      // 搜索框
      items: [
        {
          type: 'text',
          dataIndex: 'businessFormCode',
          label: '分发单号',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'select',
          dataIndex: 'departmentId',
          label: '分发部门',
          placeholder: '请选择',
          optionsConfig: {
            url: `/pc/fin/sys/tenant/department/list/all?tenantId=${getUserDetail().tenantId}`,
            label: 'name',
            value: 'id',
          },
          defaultValue: '',
          options: [],
        },
        {
          type: 'select',
          dataIndex: 'goodsTemplateId',
          label: '物品名称',
          placeholder: '请输入',
          defaultValue: '',
          options: [],
          optionsConfig: {
            label: 'goodsName',
            value: 'id',
            url: SettingIplatform.apiBaseURL + `/pc/base/goods/template/query/goodsTemplate?tenantId=${getUserDetail().tenantId}`,
          },
        },
        {
          type: 'text',
          dataIndex: 'operatorName',
          label: '领取人',
          placeholder: '请输入',
          defaultValue: '',
        },
        {
          type: 'date-picker',
          dataIndex: 'startTime',
          label: '领取时间',
          defaultValue: '',
        },
        {
          type: 'date-picker',
          dataIndex: 'endTime',
          label: '至',
          defaultValue: '',
        },
      ],
      // 树数据
      treeDataList: []
    };
  },
  created() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.loading = true;
      transferList({
        qryType: 1,
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        outAgencyId: this.userInfo.tenantId,
        ...this.filterFrom,
      }).then((res) => {
        this.list = res.datas;
        this.total = res.totalRows;
        this.loading = false;
      });
    },
    openImport(){
      this.importOrg();
    },
    //导入
    importOrg() {
      this.importSetting.dialogShow = true;
      this.importSetting.onSuccess = (response, callBack) => {
        if (response.code === 1) {
          this.$message.success(response.msg);
          this.search(1);
        } else {
          this.$message.warning(response.msg);
        }
        callBack();
      };
    },
  },
};
</script>
 
<style scoped lang="scss">
//@import url(../../../../styles/index.scss);
</style>