| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="模板编号" prop="id">
- <el-input
- v-model="queryParams.id"
- placeholder="请输入模板编号"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="名称" prop="name">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入名称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="课程" prop="courseId">
- <el-select v-model="queryParams.courseId" clearable placeholder="请选择课程" style=" margin-right: 10px;" size="mini">
- <el-option
- v-for="dict in courseList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['course:courseFinishTempParent:deptAdd']"
- >新增</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['course:courseFinishTempParent:deptEdit']"
- >修改</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['course:courseFinishTempParent:deptRemove']"
- >删除</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- :loading="exportLoading"
- @click="handleExport"
- v-hasPermi="['course:courseFinishTempParent:deptExport']"
- >导出</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table border v-loading="loading" :data="courseFinishTempParentList" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="模板编号" align="center" prop="id" />
- <el-table-column label="名称" align="center" prop="name" />
- <el-table-column label="课程" align="center" prop="courseId">
- <template slot-scope="scope">
- <el-tag v-for="dict in courseList" v-if="dict.dictValue == scope.row.courseId">{{dict.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['course:courseFinishTempParent:deptEdit']"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- @click="jump(scope.row.id)"
- >模板列表</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['course:courseFinishTempParent:deptRemove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改完课模板对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="名称" prop="name">
- <el-input v-model="form.name" placeholder="请输入名称" />
- </el-form-item>
- <el-form-item label="状态" v-if="!form.id">
- <el-radio-group v-model="form.status">
- <el-radio
- v-for="dict in statusOptions"
- :key="dict.dictValue"
- :label="parseInt(dict.dictValue)"
- >{{ dict.dictLabel }}
- </el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="课程" prop="courseId">
- <el-select v-model="form.courseId" :disabled="form.id != null" placeholder="请选择课程" style=" margin-right: 10px;" size="mini">
- <el-option
- v-for="dict in courseList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- </el-form-item>
- <el-form-item prop="setting">
- <span slot="label" class="finish-rule-label finish-rule-label--watch">
- <el-tag type="primary" size="mini" effect="dark">私聊</el-tag>
- <span>看课规则</span>
- </span>
- <div class="finish-rule-panel finish-rule-panel--watch">
- <div class="finish-rule-panel__tip">发给客户本人(私聊),与下方「群聊恭喜」完全独立,请勿混用</div>
- <div v-for="(item, index) in setting" :key="index"
- class="finish-rule-item finish-rule-item--watch">
- <el-row>
- <el-col :span="22">
- <el-form :model="item" label-width="70px">
- <el-form-item label="内容类别" style="margin: 2%">
- <el-radio-group v-model="item.contentType">
- <el-radio :label="item.dictValue" v-for="item in sysQwSopAiContentType">{{ item.dictLabel }}
- </el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="内容" style="margin-bottom: 2%">
- <el-input v-if="item.contentType == 1 || item.contentType == 15" v-model="item.value" type="textarea" :rows="3"
- placeholder="内容" style="width: 90%;margin-top: 10px;"/>
- <ImageUpload v-if="item.contentType == 2 " v-model="item.imgUrl" type="image" :num="1" :width="150"
- :height="150"/>
- <div v-if="item.contentType == 3 || item.contentType ==9">
- <el-card class="box-card">
- <el-form-item label="链接标题:" label-width="100px">
- <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
- </el-form-item>
- <el-form-item label="链接描述:" label-width="100px">
- <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入链接描述"
- style="width: 90%;margin-top: 1%;"/>
- </el-form-item>
- <el-form-item label="链接封面:" label-width="100px">
- <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150"
- :height="150" style="margin-top: 1%;"/>
- </el-form-item>
- <el-form-item label="链接地址:" label-width="100px">
- <el-input v-model="item.linkUrl" placeholder="请输入链接地址" style="width: 90%;"/>
- </el-form-item>
- </el-card>
- </div>
- <div v-if="item.contentType == 4">
- <el-card class="box-card">
- <el-form-item label="选择课程">
- <el-select
- v-model="item.courseId"
- placeholder="请选择课程"
- style="margin-right: 10px"
- size="mini"
- @change="handleRuleCourseChange(item)"
- >
- <el-option
- v-for="dict in courseList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- <el-select
- v-model="item.videoId"
- placeholder="请选择小节"
- size="mini"
- style="margin-right: 10px"
- filterable
- remote
- :remote-method="(query) => remoteMethodRuleVideo(query, item)"
- :loading="videoOptionsLoading"
- @change="handleRuleVideoChange(item)"
- >
- <el-option
- v-for="dict in videoOptions || []"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- </el-form-item>
- <el-card class="box-card" style="margin-top: 10px">
- <el-form-item label="标题" prop="miniprogramTitle">
- <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
- </el-form-item>
- <el-form-item label="封面" prop="miniprogramPicUrl">
- <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
- </el-form-item>
- </el-card>
- </el-card>
- </div>
- <div v-if="item.contentType == 5 ">
- <el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
- <el-upload
- v-model="item.fileUrl"
- class="avatar-uploader"
- :action="uploadUrl"
- :show-file-list="false"
- :on-success="(res, file) => handleAvatarSuccessFile(res, file, item)"
- :before-upload="beforeAvatarUploadFile">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
- {{ item.fileUrl }}
- </el-link>
- </el-form-item>
- </div>
- <div v-if="item.contentType == 6 ">
- <el-form-item label="上传视频:" prop="videoUrl" label-width="100px">
- <el-upload
- v-model="item.videoUrl"
- class="avatar-uploader"
- :action="uploadUrl"
- :show-file-list="false"
- :on-success="(res, file) => handleAvatarSuccessVideo(res, file, item)"
- :before-upload="beforeAvatarUploadVideo">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- <video v-if="item.videoUrl"
- :src="item.videoUrl"
- controls style="width: 200px;height: 100px">
- </video>
- </el-form-item>
- </div>
- <div v-if="item.contentType == 7 ">
- <el-input
- v-model="item.value"
- type="textarea" :rows="3" maxlength="66" show-word-limit
- placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
- @input="handleInputVideoText(item.value,item)"/>
- </div>
- <div v-if="item.contentType == 8">
- <el-button type="primary"
- style="margin-bottom: 1%"
- @click="hanldeSelectVideoNum(setting,index)">
- 选择视频号
- </el-button>
- <el-card class="box-card" v-if="item.coverUrl">
- <el-form-item label="封面标题:" label-width="100px">
- <el-input v-model="item.nickname"
- style="width: 90%;margin-bottom: 1%" disabled/>
- </el-form-item>
- <el-form-item label="头像:" label-width="100px">
- <el-image
- v-if="item.avatar != null"
- :src="item.avatar"
- :preview-src-list="[item.avatar]"
- :style="{ width: '50px', height: '50px' }"
- ></el-image>
- </el-form-item>
- <el-form-item label="封面:" label-width="100px">
- <el-image
- v-if="item.coverUrl != null"
- :src="item.coverUrl"
- :preview-src-list="[item.coverUrl]"
- :style="{ width: '200px', height: '200px' }"
- ></el-image>
- </el-form-item>
- <el-form-item label="简介:" label-width="100px">
- <el-input type="textarea" :rows="3"
- v-model="item.desc"
- style="width: 90%;margin-top: 1%;" disabled/>
- </el-form-item>
- <el-form-item label="视频地址:" label-width="100px"
- style="margin-top: 1%">
- <el-input v-model="item.url"
- style="width: 90%;" disabled/>
- </el-form-item>
- </el-card>
- </div>
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="1" :offset="1">
- <i class="el-icon-delete" @click="delSetList(index, 0)" style="margin-top: 20px;"
- v-if="setting.length>1"></i>
- </el-col>
- </el-row>
- </div>
- <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetList(0)'>
- 添加私聊内容
- </el-link>
- </div>
- </el-form-item>
- <el-form-item prop="chatSetting">
- <span slot="label" class="finish-rule-label finish-rule-label--chat">
- <el-tag type="warning" size="mini" effect="dark">群聊</el-tag>
- <span>群聊恭喜规则</span>
- </span>
- <div class="finish-rule-panel finish-rule-panel--chat">
- <div class="finish-rule-panel__tip">发到客户群(群聊恭喜),与上方「看课私聊」完全独立,请勿混用</div>
- <div v-for="(item, index) in chatSetting" :key="index"
- class="finish-rule-item finish-rule-item--chat">
- <el-row>
- <el-col :span="22">
- <el-form :model="item" label-width="70px">
- <el-form-item label="内容类别" style="margin: 2%">
- <el-radio-group v-model="item.contentType">
- <el-radio :label="item.dictValue" v-for="item in sysQwSopAiContentType">{{ item.dictLabel }}
- </el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="内容" style="margin-bottom: 2%">
- <el-input v-if="item.contentType == 1 || item.contentType == 15" v-model="item.value" type="textarea" :rows="3"
- placeholder="内容" style="width: 90%;margin-top: 10px;"/>
- <ImageUpload v-if="item.contentType == 2 " v-model="item.imgUrl" type="image" :num="1" :width="150"
- :height="150"/>
- <div v-if="item.contentType == 3 || item.contentType ==9">
- <el-card class="box-card">
- <el-form-item label="链接标题:" label-width="100px">
- <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
- </el-form-item>
- <el-form-item label="链接描述:" label-width="100px">
- <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入链接描述"
- style="width: 90%;margin-top: 1%;"/>
- </el-form-item>
- <el-form-item label="链接封面:" label-width="100px">
- <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150"
- :height="150" style="margin-top: 1%;"/>
- </el-form-item>
- <el-form-item label="链接地址:" label-width="100px">
- <el-input v-model="item.linkUrl" placeholder="请输入链接地址" style="width: 90%;"/>
- </el-form-item>
- </el-card>
- </div>
- <div v-if="item.contentType == 4">
- <el-card class="box-card">
- <el-form-item label="选择课程">
- <el-select
- v-model="item.courseId"
- placeholder="请选择课程"
- style="margin-right: 10px"
- size="mini"
- @change="handleRuleCourseChange(item)"
- >
- <el-option
- v-for="dict in courseList"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- <el-select
- v-model="item.videoId"
- placeholder="请选择小节"
- size="mini"
- style="margin-right: 10px"
- filterable
- remote
- :remote-method="(query) => remoteMethodRuleVideo(query, item)"
- :loading="videoOptionsLoading"
- @change="handleRuleVideoChange(item)"
- >
- <el-option
- v-for="dict in videoOptions || []"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="parseInt(dict.dictValue)"
- />
- </el-select>
- </el-form-item>
- <el-card class="box-card" style="margin-top: 10px">
- <el-form-item label="标题" prop="miniprogramTitle">
- <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
- </el-form-item>
- <el-form-item label="封面" prop="miniprogramPicUrl">
- <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
- </el-form-item>
- </el-card>
- </el-card>
- </div>
- <div v-if="item.contentType == 5 ">
- <el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
- <el-upload
- v-model="item.fileUrl"
- class="avatar-uploader"
- :action="uploadUrl"
- :show-file-list="false"
- :on-success="(res, file) => handleAvatarSuccessFile(res, file, item)"
- :before-upload="beforeAvatarUploadFile">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
- {{ item.fileUrl }}
- </el-link>
- </el-form-item>
- </div>
- <div v-if="item.contentType == 6 ">
- <el-form-item label="上传视频:" prop="videoUrl" label-width="100px">
- <el-upload
- v-model="item.videoUrl"
- class="avatar-uploader"
- :action="uploadUrl"
- :show-file-list="false"
- :on-success="(res, file) => handleAvatarSuccessVideo(res, file, item)"
- :before-upload="beforeAvatarUploadVideo">
- <i class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- <video v-if="item.videoUrl"
- :src="item.videoUrl"
- controls style="width: 200px;height: 100px">
- </video>
- </el-form-item>
- </div>
- <div v-if="item.contentType == 7 || item.contentType == 16">
- <el-input
- v-model="item.value"
- type="textarea" :rows="3" maxlength="66" show-word-limit
- placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
- @input="handleInputVideoText(item.value,item)"/>
- </div>
- <div v-if="item.contentType == 8">
- <el-button type="primary"
- style="margin-bottom: 1%"
- @click="hanldeSelectVideoNum(setting,index)">
- 选择视频号
- </el-button>
- <el-card class="box-card" v-if="item.coverUrl">
- <el-form-item label="封面标题:" label-width="100px">
- <el-input v-model="item.nickname"
- style="width: 90%;margin-bottom: 1%" disabled/>
- </el-form-item>
- <el-form-item label="头像:" label-width="100px">
- <el-image
- v-if="item.avatar != null"
- :src="item.avatar"
- :preview-src-list="[item.avatar]"
- :style="{ width: '50px', height: '50px' }"
- ></el-image>
- </el-form-item>
- <el-form-item label="封面:" label-width="100px">
- <el-image
- v-if="item.coverUrl != null"
- :src="item.coverUrl"
- :preview-src-list="[item.coverUrl]"
- :style="{ width: '200px', height: '200px' }"
- ></el-image>
- </el-form-item>
- <el-form-item label="简介:" label-width="100px">
- <el-input type="textarea" :rows="3"
- v-model="item.desc"
- style="width: 90%;margin-top: 1%;" disabled/>
- </el-form-item>
- <el-form-item label="视频地址:" label-width="100px"
- style="margin-top: 1%">
- <el-input v-model="item.url"
- style="width: 90%;" disabled/>
- </el-form-item>
- </el-card>
- </div>
- </el-form-item>
- </el-form>
- </el-col>
- <el-col :span="1" :offset="1">
- <i class="el-icon-delete" @click="delSetList(index,1)" style="margin-top: 20px;"
- v-if="setting.length>1"></i>
- </el-col>
- </el-row>
- </div>
- <el-link type="warning" class="el-icon-plus" :underline="false" @click='addSetList(1)'>
- 添加群聊内容
- </el-link>
- </div>
- </el-form-item>
- <el-form-item label="全选销售" prop="isAllCompanyUser" v-if="!form.id">
- <el-switch
- v-model="form.isAllCompanyUser"
- active-color="#13ce66"
- inactive-color="#ff4949"
- :active-value="1"
- :inactive-value="2">
- </el-switch>
- <span v-if="form.isAllCompanyUser == '1'" style="margin-left: 10px;color: #13ce66">是</span>
- <span v-else style="margin-left: 10px;color: #ff4949">否</span>
- </el-form-item>
- <el-form-item label="所属销售" prop="companyUserIds" v-if="!form.id && form.isAllCompanyUser == '2'">
- <el-select v-model="companyUserIds" remote multiple placeholder="请选择" filterable style="width: 100%;">
- <el-option
- v-for="dict in userList"
- :key="dict.userId"
- :label="dict.nickName"
- :value="dict.userId.toString()">
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="videoNumOptions.title" :visible.sync="videoNumOptions.open" width="1500px" append-to-body>
- <userVideo ref="QwUserVideo" @videoResult="qwUserVideoResult"></userVideo>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listCourseFinishTempParent, getCourseFinishTempParent, delCourseFinishTempParent, addCourseFinishTempParent, updateCourseFinishTempParent, exportCourseFinishTempParent } from "@/api/course/courseFinishTempParent";
- import {courseList, videoList} from '@/api/qw/sop'
- import ImageUpload from '@/views/qw/sop/ImageUpload.vue'
- import { getUserList } from '@/api/company/companyUser'
- import userVideo from "@/views/qw/userVideo/userVideo.vue";
- import {
- deptExportCourseFinishTempParent,
- deptListCourseFinishTempParent
- } from "../../../api/course/courseFinishTempParent";
- export default {
- name: "CourseFinishTempParent",
- components: { ImageUpload ,userVideo},
- data() {
- return {
- videoOptionsLoading: false,
- videoOptions: [],
- videoLoading: false,
- videoNumOptions: {
- title: '选择视频号',
- open: false,
- content: null,
- contentIndex: null,
- },
- voiceLoading: false,
- uploadUrl: process.env.VUE_APP_BASE_API + "/common/uploadOSS2",
- uploadUrlByVoice: process.env.VUE_APP_BASE_API + "/common/uploadOSSByHOOKVoice",
- // 遮罩层
- loading: true,
- // 导出遮罩层
- exportLoading: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 完课模板表格数据
- courseFinishTempParentList: [],
- companyUserIds: [],
- courseList: [],
- userList: [],
- // 状态字典
- statusOptions: [],
- allowSelect: [],
- sysFsSopWatchStatus: [],
- sysQwSopAiContentType: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 模板表格数据
- setting: [],
- chatSetting: [],
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- id: null,
- name: null,
- courseId: null,
- },
- // 表单参数
- form: {companyUserIds: [],},
- // 表单校验
- rules: {
- name:[
- { required: true, message: "名称不能为空", trigger: "blur" }
- ],
- courseId:[
- { required: true, message: "课程不能为空", trigger: "blur" }
- ],
- }
- };
- },
- created() {
- this.getDicts("sys_company_status").then(response => {
- this.statusOptions = response.data;
- });//复用一下
- this.getDicts("sys_qw_allow_select").then(response => {
- this.allowSelect = response.data;
- });
- this.getDicts("sys_fs_sop_watch_status").then(response => {
- this.sysFsSopWatchStatus = response.data;
- });
- this.getDicts("sys_qwSopAi_contentType").then(response => {
- this.sysQwSopAiContentType = response.data;
- });
- getUserList().then(response => {
- this.userList = response.data;
- });
- courseList().then(response => {
- this.courseList = response.list;
- });
- this.getList();
- },
- methods: {
- // 处理规则中课程变化
- handleRuleCourseChange(item) {
- // 为当前规则项单独加载视频列表
- videoList(item.courseId).then((response) => {
- // 只保存视频列表,不保存整个响应对象
- this.videoOptions = response.list;
- this.$set(item, 'videoId', null); // Reset video selection when course changes
- // 自动设置封面为课程封面
- const selectedCourse = this.courseList.find(
- course => parseInt(course.dictValue) === item.courseId
- );
- if (selectedCourse) {
- this.$set(item, 'miniprogramPicUrl', selectedCourse.dictImgUrl);
- }
- });
- },
- // 处理规则中视频变化
- handleRuleVideoChange(item) {
- if (!item.videoId) return;
- // 自动设置标题为视频标题
- const selectedVideo = (this.videoOptions || []).find(
- video => parseInt(video.dictValue) === item.videoId
- );
- if (selectedVideo) {
- this.$set(item, 'miniprogramTitle', selectedVideo.dictLabel);
- }
- },
- // 远程搜索规则中的视频
- remoteMethodRuleVideo(query, item) {
- if (!item.courseId) {
- this.$message.warning('请先选择课程');
- this.videoOptions = [];
- reject();
- return;
- }
- this.videoOptionsLoading = true;
- const data = query ? { title: query } : {};
- videoList(item.courseId, data).then((response) => {
- this.videoOptions = response.list;
- this.videoOptionsLoading = false;
- resolve(response);
- }).catch((error) => {
- this.videoOptionsLoading = false;
- reject(error);
- });
- },
- remoteMethodVideo(query) {
- if (!this.form.courseId) {
- this.$message.warning('请先选择课程');
- this.videoList = []; // 清空小节列表
- return;
- }
- if (query !== '') {
- this.videoLoading = true;
- // 这里调用接口搜索小节,假设 videoList 方法支持搜索参数
- var data = {
- title:query
- }
- videoList(this.form.courseId, data).then((response) => {
- this.videoList = response.list;
- this.videoLoading = false;
- });
- } else {
- // 如果查询为空,则加载全部
- videoList(this.form.courseId).then((response) => {
- this.videoList = response.list;
- });
- }
- },
- /** 查询完课模板列表 */
- getList() {
- this.loading = true;
- deptListCourseFinishTempParent(this.queryParams).then(response => {
- this.courseFinishTempParentList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- status: 1,
- name: null,
- setting: [],
- chatSetting: [],
- courseId: null,
- createTime: null,
- createBy: null,
- updateBy: null,
- updateTime: null,
- companyUserIds: null,
- remark: null,
- isAllCompanyUser: 2
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加完课模板";
- },
- //选择视频号
- hanldeSelectVideoNum(content, index) {
- this.videoNumOptions.content = content;
- this.videoNumOptions.contentIndex = index;
- this.videoNumOptions.open = true;
- },
- qwUserVideoResult(val) {
- // 根据选中的内容,将返回的数据更新到相应的表单项
- const content = this.videoNumOptions.content;
- const setList = content[this.videoNumOptions.contentIndex];
- setList.nickname = val.nickname;
- setList.avatar = val.avatar;
- setList.coverUrl = val.coverUrl;
- setList.thumbUrl = val.thumbUrl;
- setList.desc = val.desc;
- setList.url = val.url;
- setList.extras = val.extras;
- setList.videoId = val.id;
- console.info(setList)
- this.videoNumOptions.open = false;
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getCourseFinishTempParent(id).then(response => {
- this.form = response.data;
- try {
- this.setting = response.data.setting ? JSON.parse(response.data.setting) : [];
- } catch (e) {
- this.setting = [];
- }
- try {
- this.chatSetting = response.data.chatSetting ? JSON.parse(response.data.chatSetting) : [];
- } catch (e) {
- this.chatSetting = [];
- }
- if (response.data.companyUserIds != null && response.data.companyUserIds !== '') {
- this.companyUserIds = String(this.form.companyUserIds).split(",");
- } else {
- this.companyUserIds = [];
- }
- const allRuleItems = [].concat(this.setting || [], this.chatSetting || []);
- allRuleItems.forEach(item => {
- if (item && (item.contentType == 4 || item.contentType == '4') && item.courseId) {
- this.videoOptions = [];
- this.videoOptionsLoading = false;
- videoList(item.courseId).then((videoResponse) => {
- this.videoOptions = videoResponse.list;
- });
- }
- });
- this.open = true;
- this.title = "修改完课模板";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.isAllCompanyUser == null) {
- this.form.isAllCompanyUser = 2;
- }
- if (this.companyUserIds != null) {
- this.form.companyUserIds = this.companyUserIds.toString();
- }
- const processedSetting = this.setting.map(item => {
- const newItem = {...item};
- if (newItem.videoOptions) {
- delete newItem.videoOptions;
- }
- if (newItem.videoLoading !== undefined) {
- delete newItem.videoLoading;
- }
- return newItem;
- });
- this.form.setting = JSON.stringify(processedSetting);
- this.form.chatSetting = JSON.stringify(this.chatSetting);
- if (this.setting.length <= 0) {
- return this.$message("请添加看课规则")
- }
- for (let i = 0; i < this.setting.length; i++) {
- if (this.setting[i].contentType == 1 && (this.setting[i].value == null || this.setting[i].value == "")) {
- return this.$message.error("看课规则:内容不能为空")
- }
- if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
- return this.$message.error("看课规则:图片不能为空")
- }
- if (this.setting[i].contentType == 3 && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
- return this.$message.error("看课规则:链接标题不能为空")
- }
- if (this.setting[i].contentType == 3 && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
- return this.$message.error("看课规则:链接描述不能为空")
- }
- if (this.setting[i].contentType == 3 && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
- return this.$message.error("看课规则:链接图片不能为空")
- }
- if (this.setting[i].contentType == 3 && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
- return this.$message.error("看课规则:链接地址不能为空")
- }
- if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
- return this.$message.error("看课规则:文件不能为空")
- }
- if (this.setting[i].contentType == 6 && (this.setting[i].videoUrl == null || this.setting[i].videoUrl == "")) {
- return this.$message.error("看课规则:视频不能为空")
- }
- if (this.setting[i].contentType == 7 && (this.setting[i].value == null || this.setting[i].value == "")) {
- return this.$message.error("看课规则:语音不能为空")
- }
- }
- for (let i = 0; i < this.chatSetting.length; i++) {
- if (this.chatSetting[i].contentType == 1 && (this.chatSetting[i].value == null || this.chatSetting[i].value == "")) {
- return this.$message.error("群聊恭喜规则:内容不能为空")
- }
- if (this.chatSetting[i].contentType == 2 && (this.chatSetting[i].imgUrl == null || this.chatSetting[i].imgUrl == "")) {
- return this.$message.error("群聊恭喜规则:图片不能为空")
- }
- if (this.chatSetting[i].contentType == 3 && (this.chatSetting[i].linkTitle == null || this.chatSetting[i].linkTitle == "")) {
- return this.$message.error("群聊恭喜规则:链接标题不能为空")
- }
- if (this.chatSetting[i].contentType == 3 && (this.chatSetting[i].linkDescribe == null || this.chatSetting[i].linkDescribe == "")) {
- return this.$message.error("群聊恭喜规则:链接描述不能为空")
- }
- if (this.chatSetting[i].contentType == 3 && (this.chatSetting[i].linkImageUrl == null || this.chatSetting[i].linkImageUrl == "")) {
- return this.$message.error("群聊恭喜规则:链接图片不能为空")
- }
- if (this.chatSetting[i].contentType == 3 && this.chatSetting[i].type == 1 && (this.chatSetting[i].linkUrl == null || this.chatSetting[i].linkUrl == "")) {
- return this.$message.error("群聊恭喜规则:链接地址不能为空")
- }
- if (this.chatSetting[i].contentType == 5 && (this.chatSetting[i].fileUrl == null || this.chatSetting[i].fileUrl == "")) {
- return this.$message.error("群聊恭喜规则:文件不能为空")
- }
- if (this.chatSetting[i].contentType == 6 && (this.chatSetting[i].videoUrl == null || this.chatSetting[i].videoUrl == "")) {
- return this.$message.error("群聊恭喜规则:视频不能为空")
- }
- if (this.chatSetting[i].contentType == 7 && (this.chatSetting[i].value == null || this.chatSetting[i].value == "")) {
- return this.$message.error("群聊恭喜规则:语音不能为空")
- }
- }
- if (this.form.id != null) {
- updateCourseFinishTempParent(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addCourseFinishTempParent(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除完课模板编号为"' + ids + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delCourseFinishTempParent(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('是否确认导出所有完课模板数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.exportLoading = true;
- return deptExportCourseFinishTempParent(queryParams);
- }).then(response => {
- this.download(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
- },
- handleAvatarSuccessFile(res, file, item) {
- if (res.code === 200) {
- // 使用 $set 确保响应式更新
- this.$set(item, 'fileUrl', res.url);
- } else {
- this.msgError(res.msg);
- }
- },
- beforeAvatarUploadFile(file) {
- const isLt1M = file.size / 1024 / 1024 < 10;
- if (!isLt1M) {
- this.$message.error('上传大小不能超过 10MB!');
- }
- return isLt1M;
- },
- //下载文件
- downloadUrl(materialUrl) {
- // 直接返回文件 URL
- return materialUrl;
- },
- handleInputVideoText(value, content) {
- // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
- const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
- // 删除不符合条件的字符
- const filteredValue = value.split('').filter(char => regex.test(char)).join('');
- this.$set(content, 'value', filteredValue);
- },
- handleAvatarSuccessVideo(res, file, item) {
- if (res.code == 200) {
- // 使用 $set 确保响应式更新
- this.$set(item, 'videoUrl', res.url);
- } else {
- this.msgError(res.msg);
- }
- },
- beforeAvatarUploadVideo(file) {
- const isLt30M = file.size / 1024 / 1024 < 10;
- const isMP4 = file.type === 'video/mp4';
- if (!isMP4) {
- this.$message.error('仅支持上传 MP4 格式的视频文件!');
- return false;
- }
- if (!isLt30M) {
- this.$message.error('上传大小不能超过 10MB!');
- return false;
- }
- return true;
- },
- delSetList(index, type) {
- if (type == 0) {
- this.setting.splice(index, 1)
- } else {
- this.chatSetting.splice(index, 1)
- }
- },
- addSetList(type) {
- const newSetting = {
- contentType: '1',
- value: '',
- };
- // 将新设置项添加到 content.setting 数组中
- if (type == 0) {
- this.setting.push(newSetting);
- } else {
- this.chatSetting.push(newSetting);
- }
- },
- jump(id){
- this.$router.push('/qw/conversion/courseFinishTemp/' + id)
- },
- },
- };
- </script>
- <style scoped>
- .finish-rule-label {
- display: inline-flex;
- flex-direction: column;
- align-items: flex-start;
- line-height: 1.4;
- gap: 4px;
- }
- .finish-rule-label span:last-child {
- font-weight: 600;
- }
- .finish-rule-panel {
- width: 100%;
- box-sizing: border-box;
- border-radius: 4px;
- padding: 12px;
- }
- .finish-rule-panel--watch {
- background: #ecf5ff;
- border: 1px solid #b3d8ff;
- border-left: 4px solid #409eff;
- }
- .finish-rule-panel--chat {
- background: #fdf6ec;
- border: 1px solid #f5dab1;
- border-left: 4px solid #e6a23c;
- }
- .finish-rule-panel__tip {
- font-size: 12px;
- margin-bottom: 10px;
- line-height: 1.5;
- }
- .finish-rule-panel--watch .finish-rule-panel__tip {
- color: #337ecc;
- }
- .finish-rule-panel--chat .finish-rule-panel__tip {
- color: #b88230;
- }
- .finish-rule-item {
- margin-bottom: 16px;
- border-radius: 4px;
- background: #fff;
- }
- .finish-rule-item--watch {
- border: 1px solid #b3d8ff;
- }
- .finish-rule-item--chat {
- border: 1px solid #f5dab1;
- }
- </style>
|