wjli
2024-04-09 542dcd62fa061525a00339011ff24246f03b820e
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<style lang="less">
@import "@/styles/table-common.less";
@import "@/styles/drawer-common.less";
@import "src/views/your/sign-compar/index.less";
</style>
<template>
  <div class="search">
    <Card>
      <Row class="operation">
        <Date-picker clearable @on-change="time1" format="yyyy-MM-dd" type="date" placement="bottom-end"
                     placeholder="请选择发送开始日期(必选)" style="width: 240px;margin-left: 20px">
        </Date-picker>
        <Date-picker clearable @on-change="time2" format="yyyy-MM-dd" type="date" placement="bottom-end"
                     placeholder="请选择发送结束日期(必选)" style="width: 240px;margin-left: 20px">
        </Date-picker>
        <Input v-model="searchForm2.userName" suffix="ios-search"
               placeholder="请输入配送员名字" clearable style="width: 250px;margin-left: 20px"/>
               <Input v-model="searchForm2.carNo" suffix="ios-search"
               placeholder="请输入车牌号" clearable style="width: 250px;margin-left: 20px"/>
        <Input v-model="searchForm2.customerName" suffix="ios-search"
               placeholder="请输入店铺名称" clearable style="width: 250px;margin-left: 20px"/>
        
        <Button @click="init2" icon="md-search" style="margin-left: 20px">查询</Button>
      </Row>
      <Modal
      :title="modalTitle"
      v-model="roleModalVisible"
      :mask-closable="false"
      draggable 
      scrollable
      :width="1200"
    >
    <div style="display:flex;justify-content: space-between;">
      <div style="border:1px solid #000;">
        <img :src="firstimg"
                alt="暂无图片"
                mode="contain" style="width: 400px;"/>
      </div>          
      <div style="border:1px solid #000;">
        <img :src="secondimg"
                alt="暂无图片"
                mode="contain" style="width: 400px;"/>
      </div>       
    </div>
     
      <template #footer>
        <div></div>
      </template>
    </Modal>
      <Table
          :loading="loading"
          border
          :columns="columns"
          :data="data"
          ref="table"
      >
        <template #img="{ row, index }">
          <div v-for="(fit,index) in getImg(row.img)" :key="index">
            <img
                :src="fit"
                alt="暂无图片"
                style="width: 100px;height: 100px"
                @click="handleImageClick"/>
          </div>
        </template>
        <template #action="{ row, index }">
          <div >
            <Button @click="handleEdit(row, index)">查看</Button>
          </div>
        </template>
      </Table>
      <Row type="flex" justify="end" class="page">
        <Page
            :current="searchForm2.pageNum"
            :total="total"
            :page-size="searchForm2.pageSize"
            @on-change="changePage"
            @on-page-size-change="changePageSize"
            :page-size-opts="[10, 20, 50]"
            size="small"
            show-total
            show-elevator
            show-sizer
        ></Page>
      </Row>
    </Card>
 
    <!-- 编辑 -->
  </div>
</template>
 
<script>
import {
  getByPageImgs,
} from "@/api/open";
 
 
export default {
  name: "car-manage",
  data() {
    return {
      previewModal: false,
      maxHeight: 510,
      openTip: true,
      openLevel: "0",
      loading: false,
      modalTitle: "",
      modalVisible: false,
      roleModalVisible:false,
      firstimg:"",
      secondimg:"",
      searchForm2: {
        pageNum: 1, // 当前页数
        pageSize: 10, // 页面大小
        customerName: '',
        userName:"",       
        carNo:"冀BD27580",        
        sendDateStart:"",
        sendDateEnd:"",
      },
      submitLoading: false,
      selectList: [],
      columns: [
        {
          type: "index",
          width: 60,
          align: "center",
        },
        {
          title: "区域名称",
          key: "areaName",
          width: 100,
        },
        {
          title: "分段名称",
          key: "areaSectionName",
          width: 100,
        },
        {
          title: "车牌号",
          key: "carNo",
          width: 100,
        },
        {
          title: "送货人",
          key: "userName",
          width: 100,
        },
        {
          title: "客户名称",
          key: "customerName",
          width: 100,
        },
        {
          title: "收货人姓名",
          key: "customerReceiveName",
          width: 100,
        },
        {
          title: "收货时间",
          key: "receiveTime",
          render: (h, params) => {
            let data=params.row.receiveTime
            return h('span', data.substring(0,19))
          }
        },
        {
          title: '接收人原图',
          align: "center",
          width: 200,
          slot: "img",
          render: (h, params) => {
          
            return h('div', {
              attrs: {
                style: 'width: 100px;'
              }
            }, [
              h('img', {
                attrs: {
                  src: params.row.receiveImg || null,
                  style: 'width: 100px;'
                },
                props: {
                  type: 'primary',
                  size: 'large'
                }
              })
            ])
          }
        },
        {
          title: '货物图,接收人图',
          align: "center",
          width: 250,
          slot: "img",
          render: (h, params) => {
            let data=params.row.imgs.split(",")
            let datas=[]
            for(let i=0;i<data.length;i++){
              datas.push(h('div', {
              attrs: {
                style: 'float:left'
              }
            }, [
              h('img', {
                attrs: {
                  src: data[i] || null,
                  style: 'width: 100px;'
                },
                props: {
                  type: 'primary',
                  size: 'large'
                }
              })
            ]))
            }
            return datas
          }
        },
        {
          title: "发货日期",
          key: "sendDate",
          render: (h, params) => {
            let data=params.row.sendDate
            return h('span', data.substring(0,10))
          }
        },
        {
          title: "订单日期",
          key: "orderDate",
          render: (h, params) => {
            let data=params.row.orderDate
            return h('span', data.substring(0,10))
          }
        },
        {
            title: '操作',
            slot: 'action'
          }
      ],
      data: [],
      total: 0,
    };
  },
  methods: {
    handleImageClick(e) {
      console.log(e.target.src);
    },
    getImg(html) {
      let newHtml = [];
      if (html.indexOf('http') === -1) {
        if (typeof html == 'string' && html.indexOf(',') !== -1) {
          newHtml = html.split(',').slice(0, 2);
          return newHtml;
        }
        newHtml.push(html);
        return newHtml;
      } else {
        if (typeof html == 'string' && html.indexOf(',') !== -1) {
          newHtml = html.split(',').slice(0, 2).map(v => '/xboot' + v.split('/xboot')[1])
          return newHtml;
        }
        let result = '/xboot' + html.split('/xboot')[1]
        newHtml.push(result);
        return newHtml;
      }
    },
 
    init() {
    },
    init2() {
      
      this.getDataList2();
    },
    time1(e) {
      this.searchForm2.sendDateStart = e;
    },
    time2(e){
      this.searchForm2.sendDateEnd=e
    },
    changePage(v) {
      this.searchForm2.pageNum = v;
      this.getDataList2();
      this.clearSelectAll();
    },
    changePageSize(v) {
      this.searchForm2.pageSize = v;
      this.getDataList2();
    },
    getDataList2() {
      this.loading = true;
      console.log(this.searchForm2);
      getByPageImgs(this.searchForm2).then((res) => {
        this.loading = false;
        console.log(res);
        if (res.success) {
          this.data = res.result.records;
          
          this.total = res.result.total;
        }
      });
    },
    handleEdit(data,index){
      console.log(data,index)
      this.modalTitle = "查看图片";
      this.roleModalVisible = true;
      this.firstimg=data.receiveImg
      this.secondimg=data.imgs.split(",")[1]
    },
    edit(v) {
      this.modalType = 1;
      this.modalTitle = "电子签收单";
      this.$refs.carForm.resetFields();
      // 转换null为""
      for (let attr in v) {
        if (v[attr] == null) {
          v[attr] = "";
        }
      }
      let str = JSON.stringify(v);
      let roleInfo = JSON.parse(str);
      this.carForm = roleInfo;
      this.modalVisible = true;
    },
  },
  mounted() {
    this.maxHeight = Number(document.documentElement.clientHeight - 121) + "px";
    this.init();
  },
};
</script>