AddressBook.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <a-modal v-model:visible="modelValue" v-bind="dialogSetting" width="65%" :title="title" :footer="false"
  3. modal-class="add_pick_up_model" :mask-closable="false" @cancel="cancel">
  4. <a-form :model="form">
  5. <a-row :gutter="0">
  6. <a-col :span="24">
  7. <div class="header">
  8. <div>
  9. <a-input v-model="form.value1" style="width: 400px;margin-right: 20px;" />
  10. <a-button type="primary" @click="search()">查询</a-button>
  11. </div>
  12. <div>
  13. <a-button type="primary">
  14. <template #default>新增地址</template>
  15. <template #icon>
  16. <icon-plus />
  17. </template>
  18. </a-button>
  19. </div>
  20. </div>
  21. </a-col>
  22. </a-row>
  23. <a-row :gutter="16">
  24. <a-col :span="24">
  25. <!-- <a-table :columns="columns" :data="tableData" :pagination="true" class="table_box">
  26. <template #cz="{ record }">
  27. <a-button @click="">view</a-button>
  28. </template>
  29. </a-table> -->
  30. <a-table :columns="columns" :data="tableData">
  31. <template #operations="{ record }">
  32. <a-space size="5">
  33. <a-button type="text" @click="search()">
  34. 编辑
  35. </a-button>
  36. <a-button type="text" @click="search()">
  37. 删除
  38. </a-button>
  39. </a-space>
  40. </template>
  41. </a-table>
  42. </a-col>
  43. </a-row>
  44. </a-form>
  45. </a-modal>
  46. <addAddress v-model="showDialog" :type="modelType"></addAddress>
  47. </template>
  48. <script lang="ts" setup>
  49. import Select from '@/components/select/index.vue';
  50. import RoleApi from '@/views/background/role/api/RoleApi';
  51. import { PropType, computed } from 'vue';
  52. import useTableIndex from '@/hooks/tableIndex';
  53. import { Empty } from '@arco-design/web-vue';
  54. import addAddress from '../components/addAddress.vue';
  55. const modelType = ref(1); // 1、详情 2、确认,3、打印
  56. const showDialog = ref<boolean>(true);
  57. const props = defineProps({
  58. modelValue: {
  59. type: Boolean,
  60. default: false,
  61. },
  62. dialogSetting: {
  63. type: Object,
  64. default: () => ({}),
  65. },
  66. type: {
  67. type: Number,
  68. default: 1,
  69. },
  70. title: {
  71. type: String,
  72. default: "收货人地址簿",
  73. }
  74. });
  75. const search = function () {
  76. }
  77. const { modelValue, dialogSetting, type,title } = toRefs(props);
  78. // watch(
  79. // () => type,
  80. // (newVal) => {
  81. // },
  82. // {
  83. // immediate: true,
  84. // deep: true,
  85. // }
  86. // );
  87. // 表格
  88. const columns = computed(() => {
  89. return useTableIndex([
  90. {
  91. title: '名称',
  92. dataIndex: 'a',
  93. },
  94. {
  95. title: '地址街道',
  96. dataIndex: 'b',
  97. },
  98. {
  99. title: '国家二字码',
  100. dataIndex: 'b',
  101. },
  102. {
  103. title: '城市',
  104. dataIndex: 'b',
  105. },
  106. {
  107. title: '电话号码',
  108. dataIndex: 'b',
  109. },
  110. {
  111. title: '邮政编码',
  112. dataIndex: 'b',
  113. },
  114. {
  115. title: '操作',
  116. dataIndex: '',
  117. }
  118. ]);
  119. });
  120. const labelWidth = ref('0');
  121. const emit = defineEmits(['ok', 'cancel', 'okAndDown', 'update:modelValue']);
  122. const cancel = () => {
  123. emit('update:modelValue', false);
  124. };
  125. const form = reactive({
  126. value1: '',
  127. value2: '',
  128. value3: '',
  129. value4: '',
  130. value5: '',
  131. });
  132. const tableData = ref([{ a: 1, b: 2 }]);
  133. </script>
  134. <style lang="less">
  135. .add_pick_up_model {
  136. .header {
  137. padding-bottom: 20px;
  138. display: flex;
  139. flex-direction: row;
  140. justify-content: space-between;
  141. }
  142. .arco-modal-body {
  143. padding: 24px 40px;
  144. }
  145. .add_btn {
  146. margin-left: 12px;
  147. }
  148. .table_box {
  149. margin-bottom: 24px;
  150. }
  151. .footer_box_btn {
  152. .btn_f {
  153. text-align: center;
  154. }
  155. .arco-btn {
  156. margin-left: 24px;
  157. }
  158. }
  159. }
  160. </style>