|
@@ -51,27 +51,36 @@
|
|
<!-- @remove="emit('remove')" @moveUp="emit('moveUp')" @moveDown="emit('moveDown')":length="length" -->
|
|
<!-- @remove="emit('remove')" @moveUp="emit('moveUp')" @moveDown="emit('moveDown')":length="length" -->
|
|
<CustomIcons :index="index" :iconDisable="msgDisabled" />
|
|
<CustomIcons :index="index" :iconDisable="msgDisabled" />
|
|
<span v-show="area.content == ''" class="warning-style">请输入文本内容</span>
|
|
<span v-show="area.content == ''" class="warning-style">请输入文本内容</span>
|
|
- <div style="margin-bottom:5px">
|
|
|
|
- <span style="margin-right: 10px;">变量:</span>
|
|
|
|
- <a-button style="margin-right: 10px;" :disabled="msgDisabled" @click="insertVariable('${客户名称}', index)">客户名称</a-button>
|
|
|
|
- <a-button style="margin-right: 10px;" :disabled="msgDisabled" @click="insertVariable('${客户称谓}', index)">客户称谓</a-button>
|
|
|
|
- <a-button @click="insertVariable('${客户手机号}', index)" :disabled="msgDisabled">客户手机号</a-button>
|
|
|
|
|
|
+ <div style="margin-bottom: 5px">
|
|
|
|
+ <span style="margin-right: 10px">
|
|
|
|
+ 变量:
|
|
|
|
+ </span>
|
|
|
|
+ <a-button
|
|
|
|
+ v-for="(item,id) in messageVar" :key="id"
|
|
|
|
+ style="margin-right: 10px"
|
|
|
|
+ :disabled="msgDisabled"
|
|
|
|
+ @click="insertVariable(item.value, index)"
|
|
|
|
+ >
|
|
|
|
+ {{item.label}}
|
|
|
|
+ </a-button>
|
|
|
|
+ <!-- <a-button style="margin-right: 10px;" :disabled="msgDisabled" @click="insertVariable('${客户称谓}', index)">客户称谓</a-button>
|
|
|
|
+ <a-button @click="insertVariable(`${item.value}`, index)" :disabled="msgDisabled">客户手机号</a-button> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a-form-item>
|
|
</a-form-item>
|
|
<a-form-item v-else-if="area.type === 2" label="" name="content" class="message-content">
|
|
<a-form-item v-else-if="area.type === 2" label="" name="content" class="message-content">
|
|
<!-- class="upload-contant" -->
|
|
<!-- class="upload-contant" -->
|
|
<div :class="msgDisabled ? 'disabled-upload upload-contant' : 'upload-contant'">
|
|
<div :class="msgDisabled ? 'disabled-upload upload-contant' : 'upload-contant'">
|
|
- <BasicUpload
|
|
|
|
- :maxSize="10"
|
|
|
|
- :maxNumber="1"
|
|
|
|
- @change="handleChange"
|
|
|
|
- :api="uploadApi"
|
|
|
|
- v-model:value="area.content"
|
|
|
|
- :showPreviewNumber=false
|
|
|
|
- emptyHidePreview
|
|
|
|
- />
|
|
|
|
- <!-- <div class="upload-file-style" v-if="area.content">{{String(area.content).split('/').pop()}}</div> -->
|
|
|
|
|
|
+ <BasicUpload
|
|
|
|
+ :maxSize="10"
|
|
|
|
+ :maxNumber="1"
|
|
|
|
+ @change="handleChange"
|
|
|
|
+ :api="uploadApi"
|
|
|
|
+ v-model:value="area.content"
|
|
|
|
+ :showPreviewNumber="false"
|
|
|
|
+ emptyHidePreview
|
|
|
|
+ />
|
|
|
|
+ <!-- <div class="upload-file-style" v-if="area.content">{{String(area.content).split('/').pop()}}</div> -->
|
|
<CustomIcons :index="index" :length="length" :iconDisable="msgDisabled" />
|
|
<CustomIcons :index="index" :length="length" :iconDisable="msgDisabled" />
|
|
</div>
|
|
</div>
|
|
</a-form-item>
|
|
</a-form-item>
|
|
@@ -112,19 +121,16 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
- import { defineComponent, ref, reactive, provide, props, watch ,nextTick} from 'vue';
|
|
|
|
|
|
+ import { defineComponent, ref, reactive, provide, props, watch, nextTick, onMounted } from 'vue';
|
|
import { Form, Button, Dropdown, Menu, message, Input, SubMenu, Upload } from 'ant-design-vue';
|
|
import { Form, Button, Dropdown, Menu, message, Input, SubMenu, Upload } from 'ant-design-vue';
|
|
- import {
|
|
|
|
- CloudUploadOutlined,
|
|
|
|
- PlusCircleOutlined,
|
|
|
|
- UserOutlined,
|
|
|
|
- } from '@ant-design/icons-vue';
|
|
|
|
|
|
+ import { CloudUploadOutlined, PlusCircleOutlined, UserOutlined } from '@ant-design/icons-vue';
|
|
import CustomIcons from './customIcons.vue';
|
|
import CustomIcons from './customIcons.vue';
|
|
import ProductNote from './productNote.vue';
|
|
import ProductNote from './productNote.vue';
|
|
import { BasicUpload } from '@/components/Upload';
|
|
import { BasicUpload } from '@/components/Upload';
|
|
import { deleteFile, downloadFile, getFileList, uploadApi } from '@/api/fms/file';
|
|
import { deleteFile, downloadFile, getFileList, uploadApi } from '@/api/fms/file';
|
|
import ProductContant from './productContant.vue';
|
|
import ProductContant from './productContant.vue';
|
|
- import type { UploadChangeParam, UploadProps } from 'ant-design-vue'
|
|
|
|
|
|
+ import { sopMsgVar } from '@/api/wechat/sopTask';
|
|
|
|
+ import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'MsgContant',
|
|
name: 'MsgContant',
|
|
components: {
|
|
components: {
|
|
@@ -163,23 +169,33 @@
|
|
// const internalValue = ref([...props.value]);
|
|
// const internalValue = ref([...props.value]);
|
|
const internalValue = ref(addCanMoveProperties(props.value));
|
|
const internalValue = ref(addCanMoveProperties(props.value));
|
|
const msgDisabled = ref(props.msgDisabled);
|
|
const msgDisabled = ref(props.msgDisabled);
|
|
- // 用于存储每个 textarea 的光标位置
|
|
|
|
|
|
+ // 用于存储每个 textarea 的光标位置
|
|
const cursorPositions = ref<Record<number, number>>({});
|
|
const cursorPositions = ref<Record<number, number>>({});
|
|
|
|
+
|
|
// 更新光标位置
|
|
// 更新光标位置
|
|
const updateCursorPosition = (event: Event, index: number) => {
|
|
const updateCursorPosition = (event: Event, index: number) => {
|
|
const textarea = event.target as HTMLTextAreaElement;
|
|
const textarea = event.target as HTMLTextAreaElement;
|
|
cursorPositions.value[index] = textarea.selectionStart;
|
|
cursorPositions.value[index] = textarea.selectionStart;
|
|
};
|
|
};
|
|
|
|
+
|
|
const taskForm = reactive({
|
|
const taskForm = reactive({
|
|
fileContent: '',
|
|
fileContent: '',
|
|
});
|
|
});
|
|
|
|
+ const messageVar = ref([]);
|
|
|
|
+ onMounted(async () => {
|
|
|
|
+ // let res = sopMsgVar();
|
|
|
|
+ // console.log(res);
|
|
|
|
+ // messageVar.value = res.data.messageVar || [];
|
|
|
|
+ // messageVar.value = [{ name: '客户名称', value: 'wang' }];
|
|
|
|
+ });
|
|
|
|
+
|
|
function handleChange(list: string[]) {
|
|
function handleChange(list: string[]) {
|
|
if (msgDisabled.value) {
|
|
if (msgDisabled.value) {
|
|
- return
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- // createMessage.info(`已上传文件${JSON.stringify(list)}`);
|
|
|
|
- // console.log(list);
|
|
|
|
- };
|
|
|
|
|
|
+ // createMessage.info(`已上传文件${JSON.stringify(list)}`);
|
|
|
|
+ // console.log(list);
|
|
|
|
+ }
|
|
watch(
|
|
watch(
|
|
internalValue,
|
|
internalValue,
|
|
(newValue) => {
|
|
(newValue) => {
|
|
@@ -199,8 +215,8 @@
|
|
const content = area.content || '';
|
|
const content = area.content || '';
|
|
|
|
|
|
// 在光标位置插入变量
|
|
// 在光标位置插入变量
|
|
- internalValue.value[index].content =
|
|
|
|
- content.slice(0, cursorPosition) + variable + content.slice(cursorPosition);
|
|
|
|
|
|
+ internalValue.value[index].content =
|
|
|
|
+ content.slice(0, cursorPosition) + '${' + variable + '}' + content.slice(cursorPosition);
|
|
|
|
|
|
// 更新光标位置为插入变量之后
|
|
// 更新光标位置为插入变量之后
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -212,6 +228,7 @@
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+
|
|
function addCanMoveProperties(items) {
|
|
function addCanMoveProperties(items) {
|
|
return items.map((item, index, array) => ({
|
|
return items.map((item, index, array) => ({
|
|
...item,
|
|
...item,
|
|
@@ -355,6 +372,8 @@
|
|
cursorPositions,
|
|
cursorPositions,
|
|
updateCursorPosition,
|
|
updateCursorPosition,
|
|
insertVariable,
|
|
insertVariable,
|
|
|
|
+ sopMsgVar,
|
|
|
|
+ messageVar,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
});
|
|
});
|
|
@@ -461,7 +480,7 @@
|
|
.upload:hover {
|
|
.upload:hover {
|
|
border-color: #1890ff;
|
|
border-color: #1890ff;
|
|
}
|
|
}
|
|
- .upload-file-style{
|
|
|
|
|
|
+ .upload-file-style {
|
|
min-width: 400px;
|
|
min-width: 400px;
|
|
padding: 5px;
|
|
padding: 5px;
|
|
display: inline-block;
|
|
display: inline-block;
|