ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { onMounted, reactive, toRefs } from 'vue';
 
import { ScrollContainer } from '@jnpf/ui';
import { useModal } from '@jnpf/ui/modal';
 
import { getCustomerList } from '#/api/extend/order';
import GoodsModal from '#/views/workFlow/workFlowForm/crmOrder/GoodsModal.vue';
 
defineOptions({ name: 'ExtendFormDemoFieldForm5' });
 
const state = reactive({
  dataForm: {
    CustomerName: '',
    CustomerCode: '',
    Goods: '',
    GoodsCode: '',
    Specifications: '',
    Unit: '',
    Price: '',
  },
  options: [],
});
const { dataForm, options } = toRefs(state);
const [registerGoodsModal, { openModal: openGoodsModal }] = useModal();
 
function init() {
  getCustomerList().then((res) => {
    state.options = res.data.list.map((o) => ({ fullName: o.text, ...o, id: o.code }));
  });
}
function handleSelectGoods() {
  openGoodsModal(true, {});
}
function onGoodsSelect(list) {
  const GoodsList: any[] = [];
  const GoodsCodeList: any[] = [];
  const SpecificationsList: any[] = [];
  const UnitList: any[] = [];
  const Price: any[] = [];
  for (const e of list) {
    GoodsList.push(e.text);
    GoodsCodeList.push(e.code);
    SpecificationsList.push(e.specifications);
    UnitList.push(e.unit);
    Price.push(e.price);
  }
  state.dataForm.Goods = GoodsList.join(',');
  state.dataForm.GoodsCode = GoodsCodeList.join(',');
  state.dataForm.Specifications = SpecificationsList.join(',');
  state.dataForm.Unit = UnitList.join(',');
  state.dataForm.Price = Price.join(',');
}
 
onMounted(() => {
  init();
});
</script>
<template>
  <div class="jnpf-content-wrapper jnpf-content-wrapper-form">
    <div class="jnpf-content-wrapper-form-body px-[10px]">
      <ScrollContainer>
        <div class="my-[10px]">
          <a-alert message="查询选择、客户选择、商品选择器" type="warning" :show-icon="false" />
        </div>
        <a-form :colon="false" :label-col="{ style: { width: '110px' } }">
          <a-form-item label="客户名称">
            <jnpf-select v-model:value="dataForm.CustomerCode" :options="options" show-search />
          </a-form-item>
          <a-form-item label="客户编码">
            <a-input v-model:value="dataForm.CustomerCode" placeholder="客户编码" readonly />
          </a-form-item>
          <a-form-item label="选择商品">
            <a-input v-model:value="dataForm.Goods" placeholder="选择商品">
              <template #addonAfter>
                <span @click="handleSelectGoods" class="cursor-pointer">选择</span>
              </template>
            </a-input>
          </a-form-item>
          <a-form-item label="商品编码">
            <a-input v-model:value="dataForm.GoodsCode" placeholder="商品编码" readonly />
          </a-form-item>
          <a-form-item label="规格型号">
            <a-input v-model:value="dataForm.Specifications" placeholder="规格型号" readonly />
          </a-form-item>
          <a-form-item label="单位">
            <a-input v-model:value="dataForm.Unit" placeholder="单位" readonly />
          </a-form-item>
          <a-form-item label="单价">
            <a-input v-model:value="dataForm.Price" placeholder="单价" readonly />
          </a-form-item>
        </a-form>
      </ScrollContainer>
    </div>
    <GoodsModal @register="registerGoodsModal" @select="onGoodsSelect" />
  </div>
</template>
 
<style lang="scss" scoped>
.ant-input,
.ant-select,
.ant-input-group-wrapper {
  width: 300px !important;
}
</style>