Sanakey
3 天以前 b5c1614fe473330ceca8b7cff0f1802e19bd5039
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
<template>
  <BasicModal
    v-bind="$attrs"
    @register="register"
    @visible-change="handleVisibleChange"
    class="schedule-detail-modal"
  >
    <template #title></template>
    <template #closeIcon></template>
    <Tabs v-model:activeKey="activeKey" @change="onTabsChange">
      <TabPane key="1" tab="详情">
        <div>
          <div>
            <Row class="mb-10px">
              <Col span="12" class="font-bold">2024-09</Col>
              <Col span="12" class="c-gray text-right">
                <ClockCircleOutlined />
                2024-09-09 09:00:00
              </Col>
            </Row>
            <Row>
              <Col span="20" class="">
                <Checkbox v-model:checked="checked">
                  <Avatar class="align-inherit" :size="10" :style="'background-color:'+ '#ddd'"></Avatar>
                  <span class="pl-10px">测试1</span>
                </Checkbox>
                <Row class="c-gray ml-22px">今天</Row>
              </Col>
              <Col span="4" class="font-bold text-right">
                <div class="cursor-pointer">
                  <HeartFilled v-if="isFollow" @click="handleCancelFollow" class="font-size-18px c-red-5" />
                  <HeartOutlined v-else @click="handleFollow" class="font-size-18px "/>
                </div>
              </Col>
            </Row>
          </div>
          <Divider />
          <div>
            <div class="mb-10px">
              <div class="c-gray">关联线索:</div>
              <a href="javascript:void(0)">测试1</a>
            </div>
            <div class="mb-10px">
              <div class="c-gray">参与人:</div>
              <span >测试1</span>
            </div>
            <div class="mb-10px">
              <div class="c-gray">创建人:</div>
              <span >测试1</span>
            </div>
 
          </div>
          <Divider />
 
        </div>
      </TabPane>
      <TabPane key="2" tab="评论">
        <div class="mb-10px scroll-wrap">
          <ScrollContainer class="">
            <Empty></Empty>
            <div>
              <Row>
                <Col span="12" class="font-size-18px">
                  Tuku
                </Col>
                <Col span="12" class="text-right">
                  <span class="c-gray pr-10px">2024-09-09 09:00:00</span>
                  <EditOutlined class="font-size-18px cursor-pointer c-blue-5 mr-10px"/>
                  <CloseOutlined class="font-size-18px cursor-pointer c-red-5"/>
                </Col>
              </Row>
              <Row>
                <Col span="24">测试评论2</Col>
              </Row>
<!--              <Flex >-->
<!--                <div-->
<!--                  v-for="(item, index) in new Array(4)"-->
<!--                  :key="item"-->
<!--                  :style="{ ...baseStyle, background: `${index % 2 ? '#1677ff' : '#1677ffbf'}` }"-->
<!--                />-->
<!--              </Flex>-->
              <ImagePreviewGroup>
                <Image :width="120" src="https://aliyuncdn.antdv.com/vue.png"></Image>
              </ImagePreviewGroup>
              <Upload
                v-model:file-list="fileList"
                action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
                list-type="picture"
                @remove="removeFile"
                class="upload-list-inline"
                :showUploadList="{ showDownloadIcon: true,showRemoveIcon: false }"
              >
 
              </Upload>
            </div>
          </ScrollContainer>
        </div>
        <div class="scroll-wrap">
          <Divider />
          <ScrollContainer>
            <BasicForm @register="registerForm">
 
            </BasicForm>
          </ScrollContainer>
 
        </div>
      </TabPane>
    </Tabs>
    <template #footer>
      <Row class="text-center" v-if="activeKey==='1'">
        <Col span="8">
          <a-button type="link">编辑</a-button>
        </Col>
        <Col span="8">
          <a-button type="text" danger>删除</a-button>
        </Col>
        <Col span="8">
          <a-button type="link" >完成</a-button>
        </Col>
      </Row>
      <Row class="" v-if="activeKey==='2'" justify="end">
        <Col>
          <a-button type="default">取消</a-button>
          <a-button type="primary">保存</a-button>
        </Col>
      </Row>
    </template>
  </BasicModal>
</template>
<script lang="ts" setup>
  import { ref, nextTick } from 'vue';
  import {BasicModal, useModal, useModalInner} from '@/components/Modal';
  import { BasicForm, FormSchema, useForm } from '@/components/Form';
  import {TabPane, Tabs, Row, Col, Divider, Checkbox, Avatar,Empty,Flex,ImagePreviewGroup,Image,Upload} from 'ant-design-vue';
  import type { UploadProps } from 'ant-design-vue';
  import { ClockCircleOutlined,HeartOutlined,HeartFilled,EditOutlined,CloseOutlined } from '@ant-design/icons-vue';
  import ScrollContainer from "@/components/Container/src/ScrollContainer.vue";
  import { schemas } from './scheduleCommentFormData';
 
  const activeKey = ref('1');
  const checked = ref(false);
 
  const props = defineProps({
    userData: { type: Object },
  });
  const modelRef = ref({});
  const [
    registerForm,
    // {
    //   // setFieldsValue,
    //   // setProps
    // },
  ] = useForm({
    // labelWidth: 120,
    layout: 'vertical',
    schemas,
    showActionButtonGroup: false,
    actionColOptions: {
      span: 24,
    },
  });
 
  const fileList = ref<UploadProps['fileList']>([
    {
      uid: '-1',
      name: 'xxx.png',
      status: 'done',
      url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
      thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
    },
    {
      uid: '-2',
      name: 'yyy.png',
      status: 'done',
      url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
      thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
    },
  ]);
  const removeFile = (file) => {
    Logger.log('点击删除',file);
    return false;
  }
 
  const [register,{setModalProps}] = useModalInner((data) => {
    setModalProps({
      canFullscreen: false,
      showCancelBtn: false,
      showOkBtn: false,
      useWrapper: false,
      wrapperFooterOffset: 0,
      // draggable: false,
      minHeight: 400,
    });
    data && onDataReceive(data);
  });
 
  function onTabsChange(key:string) {
    Logger.log('点击切换',key);
    if (key === '1') {
      setModalProps({
        minHeight: 400,
      });
    }
    if (key === '2') {
      setModalProps({
        minHeight: 600,
      });
    }
 
  }
 
  function onDataReceive(data) {
    console.log('Data Received', data);
    // 方式1;
    // setFieldsValue({
    //   field2: data.data,
    //   field1: data.info,
    // });
 
    // // 方式2
    modelRef.value = { field2: data.data, field1: data.info };
 
    // setProps({
    //   model:{ field2: data.data, field1: data.info }
    // })
  }
 
  function handleVisibleChange(v) {
    v && props.userData && nextTick(() => onDataReceive(props.userData));
  }
 
  const isFollow = ref(false);
  function handleFollow() {
    Logger.log('关注');
    isFollow.value = true;
  }
  function handleCancelFollow() {
    Logger.log('取消关注');
    isFollow.value = false;
  }
</script>
<style lang="less">
.schedule-detail-modal {
  .scroll-wrap{
    height: 240px;
  }
  .ant-modal-body,.ant-modal-header {
    padding: 0;
    margin: 0;
  }
  .ant-modal-footer{
    margin: 0;
  }
  .ant-modal-header,.ant-modal-footer{
    border: none;
  }
  .ant-tabs {
    margin: -16px;
    padding: 0 24px;
  }
  .scroll-container{
    padding-bottom: 0 !important;
  }
  .comment-card{
    border-bottom: 5px solid #ccc;
  }
 
  .upload-list-inline {
    .ant-upload-list-picture{
      display:flex;
      .ant-upload-list-item{
        margin-right: 8px;
      }
      .ant-upload-list-item-container{
        width: 50%;
      }
    }
  }
}
</style>