doctor-admin-components 1.0.13-beta.84 → 1.0.13-beta.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <!--
2
2
  * @Author: zhangpengwei 15038779532@163.com
3
3
  * @Date: 2023-07-24 15:11:26
4
- * @LastEditors: zhangpengwei 15038779532@163.com
5
- * @LastEditTime: 2023-08-01 10:17:01
4
+ * @LastEditors: zhangpengwei@1338418459736990.onaliyun.com zhangpengwei@1338418459736990.onaliyun.com
5
+ * @LastEditTime: 2024-06-11 12:25:48
6
6
  * @FilePath: /doctor-admin-components/README.md
7
7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE1
8
8
  -->
@@ -75,3 +75,11 @@ npm login
75
75
  ### Customize configuration
76
76
 
77
77
  See [Configuration Reference](https://cli.vuejs.org/config/).
78
+
79
+ VDistpicker
80
+ ```
81
+ <VDistpicker :hideArea="true" @selected="onSelected"></VDistpicker>
82
+ #### 重新编辑
83
+ <VDistpicker :hideArea="true" @selected="onSelected" :province="placeholders.province" :city="placeholders.city"></VDistpicker>
84
+
85
+ ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "doctor-admin-components",
3
3
  "version1": "1.0.11",
4
- "version": "1.0.13-beta.84",
4
+ "version": "1.0.13-beta.86",
5
5
  "private": false,
6
6
  "main1": "lib/index.umd.min.js",
7
7
  "main": "packages/index.js",
package/packages/index.js CHANGED
@@ -53,6 +53,7 @@ import {
53
53
  ContractChangeLog,
54
54
  EditBill,
55
55
  CompanyBanks,
56
+ VDistpicker
56
57
  } from "./src";
57
58
  // 组件列表
58
59
  const components = [
@@ -64,6 +65,7 @@ const components = [
64
65
  ContractChangeLog,
65
66
  EditBill,
66
67
  CompanyBanks,
68
+ VDistpicker
67
69
  ];
68
70
 
69
71
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,那么所有的组件都会被注册
@@ -134,4 +136,5 @@ export default {
134
136
  en_JSON,
135
137
  zh_JSON,
136
138
  CompanyBanks,
139
+ VDistpicker
137
140
  };
@@ -294,5 +294,10 @@
294
294
  "voucherOrReceipt": "Voucher/Receipt",
295
295
  "weight": "weight(MT)",
296
296
  "yes": "Yes"
297
+ },
298
+ "distpicker":{
299
+ "province": "Province",
300
+ "city": "City",
301
+ "area": "Area"
297
302
  }
298
303
  }
@@ -294,5 +294,10 @@
294
294
  "voucherOrReceipt": "凭证/条款",
295
295
  "weight": "重量(MT)",
296
296
  "yes": "Yes"
297
+ },
298
+ "distpicker":{
299
+ "province": "省",
300
+ "city": "市",
301
+ "area": "区"
297
302
  }
298
303
  }
@@ -2,7 +2,7 @@
2
2
  * @Author: error: git config user.name && git config user.email & please set dead value or install git
3
3
  * @Date: 2022-07-25 11:24:53
4
4
  * @LastEditors: zhangpengwei@1338418459736990.onaliyun.com zhangpengwei@1338418459736990.onaliyun.com
5
- * @LastEditTime: 2023-10-27 14:38:28
5
+ * @LastEditTime: 2024-06-11 11:09:20
6
6
  * @FilePath: /zpw-com-test/src/lib-components/index.js
7
7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
8
  */
@@ -20,6 +20,7 @@ import BizShipmentAdd from "./views/biz/bizShipment/add.vue";
20
20
  import ContractChangeLog from "./views/biz/contractTracing/contractChangeLog.vue";
21
21
  import EditBill from "./views/biz/contractTracing/editBill.vue";
22
22
  import CompanyBanks from "./views/biz/contractTracing/companyBanks.vue";
23
+ import VDistpicker from "./views/components/RegionPicker/Distpicker.vue";
23
24
 
24
25
  // 为组件提供 install 安装方法,供按需引入
25
26
 
@@ -51,6 +52,10 @@ CompanyBanks.install = function (Vue) {
51
52
  Vue.component(CompanyBanks.name, CompanyBanks);
52
53
  };
53
54
 
55
+ VDistpicker.install = function (Vue) {
56
+ Vue.component(CompanyBanks.name, CompanyBanks);
57
+ };
58
+
54
59
  // 导出组件
55
60
  export {
56
61
  EditBill,
@@ -60,4 +65,5 @@ export {
60
65
  BizShipmentAdd,
61
66
  ContractChangeLog,
62
67
  CompanyBanks,
68
+ VDistpicker
63
69
  };
@@ -252,7 +252,9 @@
252
252
  }}</el-form-item>
253
253
  <el-form-item v-else :label="'EXW Address' + ':'">{{ contract.exw }}</el-form-item>
254
254
 
255
- <el-form-item :label="$t('contract.terminal') + ':'">{{ form.terminal }}</el-form-item>
255
+ <el-form-item v-if="contract && contract.freightTerms && contract.freightTerms != 'EXW'" :label="$t('contract.terminal') + ':'">{{
256
+ form.terminal
257
+ }}</el-form-item>
256
258
 
257
259
  <el-form-item :label="$t('contract.shippingMarks') + ':'">{{ form.shippingMark }}</el-form-item>
258
260
 
@@ -182,7 +182,7 @@
182
182
  <el-form-item v-else :label="'EXW Address' + ':'">
183
183
  {{ this.contract && this.contract.exw ? this.contract.exw : '' }}
184
184
  </el-form-item>
185
- <el-form-item :label="$t('contract.terminal') + ':'" prop="terminal">
185
+ <el-form-item v-if="contract && contract.freightTerms && contract.freightTerms != 'EXW'" :label="$t('contract.terminal') + ':'" prop="terminal">
186
186
  <el-input v-model="form.terminal" type="textarea" autosize :placeholder="$t('contract.terminalTip')"></el-input>
187
187
  </el-form-item>
188
188
 
@@ -0,0 +1,459 @@
1
+ <template>
2
+ <div :class="wrapper">
3
+ <template v-if="type !== 'mobile'">
4
+ <label>
5
+ <select @change="getCities" v-model="currentProvince" :disabled="disabled || provinceDisabled">
6
+ <option :value="placeholders.province">{{ placeholders.province }}</option>
7
+ <option
8
+ v-for="(item, index) in provinces"
9
+ :value="item"
10
+ :key="index"
11
+ >
12
+ {{ item }}
13
+ </option>
14
+ </select>
15
+ </label>
16
+ <template v-if="!onlyProvince">
17
+ <label>
18
+ <select
19
+ @change="getAreas"
20
+ v-model="currentCity"
21
+ :disabled="disabled || cityDisabled"
22
+ >
23
+ <option :value="placeholders.city">{{ placeholders.city }}</option>
24
+ <option
25
+ v-for="(item, index) in cities"
26
+ :value="item"
27
+ :key="index"
28
+ >
29
+ {{ item }}
30
+ </option>
31
+ </select>
32
+ </label>
33
+ <label>
34
+ <select v-if="!hideArea" v-model="currentArea" :disabled="disabled || areaDisabled">
35
+ <option :value="placeholders.area">{{ placeholders.area }}</option>
36
+ <option v-for="(item, index) in areas "
37
+ :value="item"
38
+ :key="index">
39
+ {{ item }}
40
+ </option>
41
+ </select>
42
+ </label>
43
+ </template>
44
+ </template>
45
+ <template v-else>
46
+ <div :class="addressHeader">
47
+ <ul>
48
+ <li :class="{'active': tab === 1}" @click="resetProvince">{{ currentProvince && !staticPlaceholder ? currentProvince : placeholders.province }}</li>
49
+ <template v-if="!onlyProvince">
50
+ <li v-if="showCityTab" :class="{'active': tab === 2}" @click="resetCity">{{ currentCity && !staticPlaceholder ? currentCity : placeholders.city }}</li>
51
+ <li v-if="showAreaTab && !hideArea" :class="{'active': tab === 3}">{{ currentArea && !staticPlaceholder ? currentArea : placeholders.area }}</li>
52
+ </template>
53
+ </ul>
54
+ </div>
55
+ <div :class="addressContainer">
56
+ <ul v-if="tab === 1">
57
+ <li v-for="(item, index) in provinces"
58
+ :class="{'active': item === currentProvince}"
59
+ @click="chooseProvince(item)"
60
+ :key="index">
61
+ {{ item }}
62
+ </li>
63
+ </ul>
64
+ <template v-if="!onlyProvince">
65
+ <ul v-if="tab === 2">
66
+ <li v-for="(item, index) in cities"
67
+ :class="{'active': item === currentCity}"
68
+ @click="chooseCity(item)"
69
+ :key="index">
70
+ {{ item }}
71
+ </li>
72
+ </ul>
73
+ <ul v-if="tab === 3 && !hideArea">
74
+ <li v-for="(item, index) in areas"
75
+ :class="{'active': item === currentArea}"
76
+ @click="chooseArea(item)"
77
+ :key="index">
78
+ {{ item }}
79
+ </li>
80
+ </ul>
81
+ </template>
82
+ </div>
83
+ </template>
84
+ </div>
85
+ </template>
86
+
87
+ <script>
88
+ import DISTRICTS from './districts';
89
+
90
+ const DEFAULT_CODE = 100000;
91
+
92
+ export default {
93
+ name: 'VDistpicker',
94
+ props: {
95
+ province: { type: [String, Number], default: '' },
96
+ city: { type: [String, Number], default: '' },
97
+ area: { type: [String, Number], default: '' },
98
+ type: { type: String, default: '' },
99
+ hideArea: { type: Boolean, default: false },
100
+ onlyProvince: { type: Boolean, default: false },
101
+ staticPlaceholder: { type: Boolean, default: false },
102
+ placeholders: {
103
+ type: Object,
104
+ default() {
105
+ return {
106
+ province: this.$t('distpicker.province'),
107
+ city: this.$t('distpicker.city'),
108
+ area: this.$t('distpicker.area')
109
+ }
110
+ }
111
+ },
112
+ districts: {
113
+ type: [Array, Object],
114
+ default() {
115
+ return DISTRICTS
116
+ }
117
+ },
118
+ disabled: { type: Boolean, default: false },
119
+ provinceDisabled: { type: Boolean, default: false },
120
+ cityDisabled: { type: Boolean, default: false },
121
+ areaDisabled: { type: Boolean, default: false },
122
+ addressHeader: { type: String, default: 'address-header' },
123
+ addressContainer: { type: String, default: 'address-container' },
124
+ wrapper: { type: String, default: 'distpicker-address-wrapper' },
125
+ },
126
+ data() {
127
+ return {
128
+ tab: 1,
129
+ showCityTab: false,
130
+ showAreaTab: false,
131
+ provinces: [],
132
+ cities: [],
133
+ areas: [],
134
+ currentProvince: this.determineType(this.province) || this.placeholders.province,
135
+ currentCity: this.determineType(this.city) || this.placeholders.city,
136
+ currentArea: this.determineType(this.area) || this.placeholders.area,
137
+ }
138
+ },
139
+ created() {
140
+ if (this.type !== 'mobile') {
141
+ this.provinces = this.getDistricts()
142
+ this.cities = this.province ? this.getDistricts(this.getAreaCode(this.determineType(this.province))) : []
143
+ let directCity= this.isDirectCity(this.province,this.city)
144
+ this.areas = this.city ? this.getDistricts(this.getAreaCode(this.determineType(this.city), directCity ? this.determineType(this.city) : this.area, 'city')) : []
145
+ } else {
146
+ if (this.area && !this.hideArea && !this.onlyProvince) {
147
+ this.tab = 3
148
+ this.showCityTab = true
149
+ this.showAreaTab = true
150
+ let directCity= this.isDirectCity(this.province,this.city)
151
+ this.areas = this.getDistricts(this.getAreaCode(this.determineType(this.city), directCity ? this.determineType(this.city) : this.area, 'city'))
152
+ } else if (this.city && this.hideArea && !this.onlyProvince) {
153
+ this.tab = 2
154
+ this.showCityTab = true
155
+ this.cities = this.getDistricts(this.getAreaCode(this.determineType(this.province)))
156
+ } else {
157
+ this.provinces = this.getDistricts()
158
+ }
159
+ }
160
+ },
161
+ watch: {
162
+ currentProvince(vaule) {
163
+ this.$emit('province', this.setData(vaule, 'province'))
164
+
165
+ if (this.onlyProvince) {
166
+ this.emit('selected')
167
+ }
168
+ },
169
+ currentCity(value) {
170
+ this.$emit('city', this.setData(value, 'city', this.currentProvince))
171
+
172
+ if (value != this.placeholders.city && this.hideArea) {
173
+ this.emit('selected')
174
+ }
175
+ },
176
+ currentArea(value) {
177
+ this.$emit('area', this.setData(value, 'area', this.currentProvince, true))
178
+
179
+ if (value != this.placeholders.area) {
180
+ this.emit('selected')
181
+ }
182
+ },
183
+ province(value) {
184
+ this.currentProvince = this.province || this.placeholders.province
185
+ this.cities = this.determineValue('province', this.currentProvince, this.placeholders.province)
186
+ },
187
+ city(value) {
188
+ this.currentCity = this.city || this.placeholders.city
189
+ this.areas = this.determineValue('city', this.currentCity, this.placeholders.city, this.currentProvince)
190
+ },
191
+ area(value) {
192
+ this.currentArea = this.area || this.placeholders.area
193
+ },
194
+ },
195
+ methods: {
196
+ setData(value, type, check = '', isArea = false) {
197
+ let code
198
+
199
+ if (isArea) {
200
+ code = this.getCodeByArea(value)
201
+ } else {
202
+ code = this.getAreaCode(value, check, type)
203
+ }
204
+
205
+ return {
206
+ code: code,
207
+ value: value,
208
+ }
209
+ },
210
+ getCodeByArea(value) {
211
+ let areas_map = {};
212
+ let arr_keys = Object.keys(this.areas);
213
+ for (let i = 0; i < arr_keys.length; i++) {
214
+ let arr_key = arr_keys[i];
215
+ let arr_value = this.areas[arr_key];
216
+ areas_map[arr_value] = arr_key;
217
+ }
218
+ return areas_map[value];
219
+ },
220
+ emit(name) {
221
+ let data = {
222
+ province: this.setData(this.currentProvince, 'province')
223
+ }
224
+
225
+ if (!this.onlyProvince) {
226
+ this.$set(data, 'city', this.setData(this.currentCity, 'city', this.currentProvince))
227
+ }
228
+
229
+ if (!this.onlyProvince || this.hideArea) {
230
+ this.$set(data, 'area', this.setData(this.currentArea, 'area', this.currentProvince, true))
231
+ }
232
+
233
+ this.$emit(name, data)
234
+ },
235
+ getCities() {
236
+ this.currentCity = this.placeholders.city
237
+ this.currentArea = this.placeholders.area
238
+ this.cities = this.determineValue('province', this.currentProvince, this.placeholders.province)
239
+ this.cleanList('areas')
240
+ if (this.cities.length === 0) {
241
+ this.emit('selected')
242
+ this.tab = 1
243
+ this.showCityTab = false
244
+ }
245
+ },
246
+ getAreas() {
247
+ this.currentArea = this.placeholders.area
248
+ this.areas = this.determineValue('city', this.currentCity, this.placeholders.city, this.currentProvince)
249
+ if (this.areas.length === 0) {
250
+ this.emit('selected')
251
+ this.tab = 2
252
+ this.showAreaTab = false
253
+ }
254
+ },
255
+ resetProvince() {
256
+ this.tab = 1
257
+ this.provinces = this.getDistricts()
258
+ this.showCityTab = false
259
+ this.showAreaTab = false
260
+ },
261
+ resetCity() {
262
+ this.tab = 2
263
+ this.showCityTab = true
264
+ this.showAreaTab = false
265
+ this.getCities()
266
+ },
267
+ chooseProvince(name) {
268
+ this.currentProvince = name
269
+ if (this.onlyProvince) return
270
+ this.tab = 2
271
+ this.showCityTab = true
272
+ this.showAreaTab = false
273
+ this.getCities()
274
+ },
275
+ chooseCity(name) {
276
+ this.currentCity = name
277
+ if (this.hideArea) return
278
+ this.tab = 3
279
+ this.showCityTab = true
280
+ this.showAreaTab = true
281
+ this.getAreas()
282
+ },
283
+ chooseArea(name) {
284
+ this.currentArea = name
285
+ },
286
+ getAreaCodeByPreCode(name, preCode) {
287
+ let codes = []
288
+
289
+ for(let x in this.districts) {
290
+ for(let y in this.districts[x]) {
291
+ if(name === this.districts[x][y]) {
292
+ codes.push(y)
293
+ }
294
+ }
295
+ }
296
+
297
+ if (codes.length > 1) {
298
+ let index
299
+ codes.forEach((item, i) => {
300
+ if (preCode.length === 2 && item.slice(0, 2) === preCode || preCode.length === 4 && item.slice(0, 4) !== preCode) {
301
+ index = i
302
+ }
303
+ })
304
+
305
+ return codes[index]
306
+ } else {
307
+ return codes[0]
308
+ }
309
+ },
310
+ getAreaCode(name, check = '', type = '') {
311
+ for(let x in this.districts) {
312
+ for(let y in this.districts[x]) {
313
+ if(name === this.districts[x][y]) {
314
+ if (check.length > 0) {
315
+ let code = y
316
+
317
+ if (check) {
318
+ let preCode = type === 'city' ? this.getAreaCode(this.currentProvince).slice(0, 2) : y.slice(0, 2)
319
+
320
+ code = this.getAreaCodeByPreCode(name, preCode)
321
+ }
322
+
323
+ if (!code || y.slice(0, 2) !== code.slice(0, 2)) {
324
+ continue
325
+ } else {
326
+ return code
327
+ }
328
+ } else {
329
+ return y
330
+ }
331
+ }
332
+ }
333
+ }
334
+ },
335
+ getCodeValue(code) {
336
+ for(let x in this.districts) {
337
+ for(let y in this.districts[x]) {
338
+ if(code === parseInt(y)) {
339
+ return this.districts[x][y]
340
+ }
341
+ }
342
+ }
343
+ },
344
+ getDistricts(code = DEFAULT_CODE) {
345
+ return this.districts[code] || []
346
+ },
347
+ determineValue(type, currentValue, placeholderValue, check = '') {
348
+ if(currentValue === placeholderValue) {
349
+ return []
350
+ } else {
351
+ return this.getDistricts(this.getAreaCode(currentValue, check, type))
352
+ }
353
+ },
354
+ determineType(value) {
355
+ if(typeof value === 'number') {
356
+ return this.getCodeValue(value)
357
+ }
358
+
359
+ return value
360
+ },
361
+ cleanList(name) {
362
+ this[name] = []
363
+ },
364
+ isDirectCity(province,city) {
365
+ if( province && city ){
366
+ return this.determineType(this.province) === this.determineType(this.city)
367
+ }
368
+ return false
369
+ },
370
+ }
371
+ }
372
+ </script>
373
+
374
+ <style lang="scss" scoped>
375
+ .distpicker-address-wrapper {
376
+ color: #9caebf;
377
+ width: 600px;
378
+ @media screen and (max-width: 768px) {
379
+ width: 300px;
380
+ }
381
+
382
+ label {
383
+ margin-right:10px
384
+ }
385
+ select {
386
+ padding: .3rem .75rem;
387
+ height: 36px;
388
+ font-size: 1rem;
389
+ line-height: 36px;
390
+ color: #464a4c;
391
+ background-color: #fff;
392
+ background-image: none;
393
+ -webkit-background-clip: padding-box;
394
+ background-clip: padding-box;
395
+ border: 1px solid rgba(0,0,0,.15);
396
+ border-radius: .25rem;
397
+ -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
398
+ // transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
399
+ -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
400
+ // transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
401
+ transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
402
+
403
+ option {
404
+ font-weight: normal;
405
+ display: block;
406
+ white-space: pre;
407
+ min-height: 1.2em;
408
+ padding: 0 2px 1px;
409
+ }
410
+ }
411
+ ul {
412
+ margin: 0;
413
+ padding: 0;
414
+
415
+ li {
416
+ list-style: none;
417
+ }
418
+ }
419
+ .address-header {
420
+ background-color: #fff;
421
+
422
+ ul {
423
+ display: flex;
424
+ justify-content: space-around;
425
+ align-items: stretch;
426
+
427
+ li {
428
+ display: inline-block;
429
+ padding: 10px 10px 7px;
430
+
431
+ &.active {
432
+ border-bottom: #52697f solid 3px;
433
+ color: #52697f;
434
+ }
435
+ }
436
+ }
437
+ }
438
+ .address-container {
439
+ background-color: #fff;
440
+
441
+ ul {
442
+ height: 100%;
443
+ overflow: auto;
444
+
445
+ li {
446
+ padding: 8px 10px;
447
+ border-top: 1px solid #f6f6f6;
448
+
449
+ &.active {
450
+ color: #52697f;
451
+ }
452
+ }
453
+ }
454
+ }
455
+ }
456
+ .disabled-color{
457
+ background: #f8f8f8;
458
+ }
459
+ </style>