updateSopTemp.vue 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744
  1. <template>
  2. <div class="app-container">
  3. <div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==1 "> sop规则【修改企微接口】模板</div>
  4. <div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==2 "> sop规则【复制企微接口】模板</div>
  5. <div style="margin: 30px;" v-if="this.form.sendType == 1 && formType==3 "> sop规则【查看企微接口】模板</div>
  6. <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==1 "> sop规则【修改群发助手】模板</div>
  7. <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==2 "> sop规则【复制群发助手】模板</div>
  8. <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==3 "> sop规则【查看群发助手】模板</div>
  9. <div style="margin: 30px;">模板编号:【{{ this.form.id }}】</div>
  10. <div style="margin-top: 10px;margin-left: 50px;margin-right: 100px;margin-bottom: 60px;">
  11. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  12. <el-form-item label="名称" prop="name">
  13. {{ form.name }}
  14. </el-form-item>
  15. <el-form-item label="状态">
  16. <el-tag v-for="dict in statusOptions" v-if="dict.dictValue == form.status">{{ dict.dictLabel }}</el-tag>
  17. </el-form-item>
  18. <el-form-item label="间隔天数" prop="gap">
  19. {{ form.gap }}天
  20. </el-form-item>
  21. <el-form-item label="规则" prop="setting">
  22. <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetting()'
  23. v-if="form.sendType != 4 && formType != 3">添加天数
  24. </el-link>
  25. <el-link type="primary" class="el-icon-sort" :underline="false" @click='openUpdateDaySorts()'
  26. style="margin-left: 20px"
  27. v-if="form.sendType != 4 && formType != 3">修改天数排序
  28. </el-link>
  29. <el-link type="primary" class="el-icon-sort" :underline="false" @click='openUpdateSorts()'
  30. style="margin-left: 20px"
  31. v-if="form.sendType != 4 && formType != 3">修改规则排序
  32. </el-link>
  33. <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetting()'
  34. v-if="form.sendType == 4 && (formType != 3 && setting.length < 1)">添加天数
  35. </el-link>
  36. <el-tabs v-model="tabIndex" type="card" @tab-remove="delSetting" v-if="setting && setting.length > 0"
  37. :before-leave="leave" @tab-click="tabClick">
  38. <el-tab-pane v-for="(item, index) in setting" :closable="formType != 3" :key="index" :name="index + ''">
  39. <el-badge slot="label" :is-dot="!item.id" class="item" style="display: inline-block">
  40. <span>{{ '第' + item.dayNum + '天' }}</span>
  41. </el-badge>
  42. <el-row v-loading="loading">
  43. <el-col :span="22">
  44. <div
  45. style="background-color: #fbfbfb;padding: 15px; border: 1px solid #e6e6e6; margin-bottom: 20px;">
  46. <el-form :model="item" label-width="80px">
  47. <el-form-item v-if="form.sendType != 4" label="内容名称" style="height: 50px;">
  48. <el-input :disabled="formType == 3" v-model="item.name"
  49. placeholder="内容名称,仅内部可见"/>
  50. </el-form-item>
  51. <el-form-item label="课程" v-if="form.sendType == 11 && item.content && item.content.length > 0" required>
  52. <el-select :disabled="(formType == 3 || form.sendType == 11) && item.id != null" v-model="item.content[0].courseId"
  53. placeholder="请选择课程" style=" margin-right: 10px;" size="mini" remote
  54. filterable
  55. @change="courseChangeUpdate(item.content[0], index, 0)">
  56. <el-option
  57. v-for="dict in courseList"
  58. :key="dict.dictValue"
  59. :label="dict.dictLabel"
  60. :value="parseInt(dict.dictValue)"
  61. />
  62. </el-select>
  63. <el-select :disabled="(formType == 3 || form.sendType == 11) && item.id != null" v-model="item.content[0].videoId"
  64. placeholder="请选择小节" size="mini" style=" margin-right: 10px;" remote
  65. filterable
  66. @change="videoIdChange(item.content[0],index,0)">
  67. <el-option
  68. v-for="dict in videoList[0]"
  69. :key="dict.dictValue"
  70. :label="dict.dictLabel"
  71. :value="parseInt(dict.dictValue)"
  72. />
  73. </el-select>
  74. </el-form-item>
  75. <el-form-item label="规则">
  76. <div v-for="(content, contentIndex) in item.content" :key="contentIndex"
  77. style="background-color: #fdfdfd;padding: 15px; border: 1px solid #e6e6e6; margin-bottom: 20px;">
  78. <el-row>
  79. <el-col el-col :span="22">
  80. <el-form :model="content" label-width="70px">
  81. <div v-if="item.dayNum==1">
  82. <el-form-item label="时间" v-if="form.sendType != 4">
  83. <el-time-picker
  84. :disabled="formType == 3"
  85. class="custom-input"
  86. v-model="content.time"
  87. value-format="HH:mm"
  88. format="HH:mm"
  89. :picker-options="{ selectableRange: startTimeRange }"
  90. placeholder="时间"
  91. style="width: 100px;height: 20px;">
  92. </el-time-picker>
  93. </el-form-item>
  94. </div>
  95. <div v-else>
  96. <el-form-item label="时间" v-if="form.sendType != 4">
  97. <el-time-picker
  98. :disabled="formType == 3"
  99. class="custom-input"
  100. v-model="content.time"
  101. value-format="HH:mm"
  102. format="HH:mm"
  103. placeholder="时间"
  104. style="width: 100px;height: 20px;">
  105. </el-time-picker>
  106. </el-form-item>
  107. </div>
  108. <el-form-item label="官方群发" v-if="contentIndex==0 && content.type==2">
  109. <el-switch
  110. v-model="content.isOfficial"
  111. active-color="#13ce66"
  112. inactive-color="#DCDFE6"
  113. active-value="1"
  114. inactive-value="0">
  115. </el-switch>
  116. </el-form-item>
  117. <el-form-item label="消息类型" v-if="form.sendType != 4">
  118. <el-select :disabled="formType == 3" v-model="content.courseType"
  119. placeholder="请选择消息类型" size="mini"
  120. style=" margin-right: 10px;" v-if="content.type != 4 ">
  121. <el-option
  122. v-for="dict in sysFsSopWatchStatus"
  123. :key="dict.dictValue"
  124. :label="dict.dictLabel"
  125. :value="Number(dict.dictValue)"
  126. />
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item label="消息类别" v-if="form.sendType != 4 && form.sendType != 5">
  130. <el-radio-group v-model="content.type"
  131. :disabled="formType == 3 || content.isOfficial === '1'"
  132. @change="updateHtml(() => content.contentType = '1')">
  133. <el-radio :label="1">普通</el-radio>
  134. <el-radio :label="2">课程</el-radio>
  135. <el-radio :label="4">AI触达</el-radio>
  136. <el-radio :label="5">打标签</el-radio>
  137. </el-radio-group>
  138. </el-form-item>
  139. <el-form-item label="课程" v-if="content.type == 2 && form.sendType != 5" required>
  140. <el-select :disabled="formType == 3 || form.sendType == 11" v-model="content.courseId"
  141. placeholder="请选择课程" style=" margin-right: 10px;" size="mini" remote
  142. filterable
  143. @change="courseChangeUpdate(content,index,contentIndex)">
  144. <el-option
  145. v-for="dict in courseList"
  146. :key="dict.dictValue"
  147. :label="dict.dictLabel"
  148. :value="parseInt(dict.dictValue)"
  149. />
  150. </el-select>
  151. <el-select :disabled="formType == 3 || form.sendType == 11" v-model="content.videoId"
  152. placeholder="请选择小节" size="mini" style=" margin-right: 10px;" remote
  153. filterable
  154. @change="videoIdChange(content,index,contentIndex)">
  155. <el-option
  156. v-for="dict in videoList[contentIndex]"
  157. :key="dict.dictValue"
  158. :label="dict.dictLabel"
  159. :value="parseInt(dict.dictValue)"
  160. />
  161. </el-select>
  162. <el-select :disabled="formType == 3" v-model="content.courseType"
  163. placeholder="请选择消息类型" size="mini"
  164. style=" margin-right: 10px;" v-if="content.type != 4 ">
  165. <el-option
  166. v-for="dict in sysFsSopWatchStatus"
  167. :key="dict.dictValue"
  168. :label="dict.dictLabel"
  169. :value="Number(dict.dictValue)"
  170. />
  171. </el-select>
  172. </el-form-item>
  173. <el-form-item label="Ai触达" v-if="content.type == 4 ">
  174. <el-select :disabled="formType == 3" v-model="content.aiTouch"
  175. placeholder="请选择Ai触达类型" size="mini"
  176. style=" margin-right: 10px;" v-if="content.type == 4 ">
  177. <el-option label="非首次交流" value="非首次交流"></el-option>
  178. <el-option label="首次交流1" value="首次交流1"></el-option>
  179. <el-option label="首次交流2" value="首次交流2"></el-option>
  180. <el-option label="交流状态1" value="交流状态1"></el-option>
  181. <el-option label="交流状态2" value="交流状态2"></el-option>
  182. <el-option label="交流状态3" value="交流状态3"></el-option>
  183. </el-select>
  184. </el-form-item>
  185. <el-form-item label="添加标签" prop="addTag" v-if="content.type == 5 "
  186. v-model="content.addTag">
  187. <el-tag
  188. :key="tag"
  189. v-for="tag in content.addTag"
  190. closable
  191. :disable-transitions="false"
  192. @close="handleClose(contentIndex,tag,content)">
  193. {{ tag }}
  194. </el-tag>
  195. <el-input
  196. style="width:110px"
  197. class="input-new-tag"
  198. v-if="addTag[contentIndex].inputVisible"
  199. v-model="addTag[contentIndex].inputValue"
  200. ref="saveTagInput"
  201. size="small"
  202. @keyup.enter.native="handleInputConfirm(contentIndex,content)"
  203. @blur="handleInputConfirm(contentIndex,content)"
  204. >
  205. </el-input>
  206. <el-button v-else class="button-new-tag" size="small" style="width: 110px"
  207. @click="showInput(contentIndex)">新增标签
  208. </el-button>
  209. </el-form-item>
  210. <el-form-item label="移除标签" prop="remarkMobiles" v-if="content.type == 5 ">
  211. <el-tag
  212. :key="tag"
  213. v-for="tag in content.delTag"
  214. closable
  215. :disable-transitions="false"
  216. @close="handleCloseDel(contentIndex,tag,content)">
  217. {{ tag }}
  218. </el-tag>
  219. <el-input
  220. style="width:110px"
  221. class="input-new-tag"
  222. v-if="addTag[contentIndex].delTagVisible"
  223. v-model="addTag[contentIndex].delTagValue"
  224. ref="saveTagInputDel"
  225. size="small"
  226. @keyup.enter.native="handleInputConfirmDel(contentIndex,content)"
  227. @blur="handleInputConfirmDel(contentIndex,content)"
  228. >
  229. </el-input>
  230. <el-button v-else class="button-new-tag" size="small" style="width: 110px"
  231. @click="showInputDel(contentIndex)">新增标签
  232. </el-button>
  233. </el-form-item>
  234. <div v-for="(setList, setIndex) in content.setting" :key="setIndex"
  235. style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;"
  236. v-if="content.type != 4 && content.type != 5">
  237. <el-row style="padding-bottom: 20px">
  238. <el-col :span="22">
  239. <el-form v-if="form.sendType != 4" :model="setList" label-width="70px">
  240. <el-form-item label="内容类别" style="margin: 2%">
  241. <div v-if="form.sendType == 1 ">
  242. <el-radio-group v-model="setList.contentType" :disabled="formType == 3">
  243. <!-- <el-radio :label="item.dictValue" v-for="item in sysQwSopContentType">{{item.dictLabel}}</el-radio>-->
  244. <el-radio
  245. v-for="item in sysQwSopContentType"
  246. :key="item.dictValue"
  247. :label="item.dictValue"
  248. :disabled="item.dictValue === '1' && content.setting.some(s => s.contentType == '1') ">
  249. {{ item.dictLabel }}
  250. </el-radio>
  251. </el-radio-group>
  252. </div>
  253. <div v-if="form.sendType == 2">
  254. <el-radio-group v-model="setList.contentType"
  255. :disabled="formType == 3"
  256. @change="handleContentTypeChange(content,index,contentIndex,setIndex, item, 'contentType', $event)">
  257. <el-radio
  258. :key="item.dictValue"
  259. :label="item.dictValue"
  260. :disabled="(content.type!=2 && item.dictValue === '9') || (content.isOfficial==1 && ['5','6','7','8','9'].includes(item.dictValue))"
  261. v-for="item in sysQwSopAiContentType">{{ item.dictLabel }}
  262. </el-radio>
  263. </el-radio-group>
  264. </div>
  265. <div v-if="form.sendType == 11">
  266. <el-radio-group v-model="setList.contentType"
  267. :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)"
  268. @change="handleContentTypeChange(content,index,contentIndex,setIndex, item, 'contentType', $event)">
  269. <el-radio
  270. :key="item.dictValue"
  271. :label="item.dictValue"
  272. :disabled="(content.type!=2 && item.dictValue === '9') || (content.isOfficial==1 && ['5','6','7','8','9'].includes(item.dictValue))"
  273. v-for="item in sysQwSopAiContentType" v-if="setIndex == 0 ? courseTypeList.includes(item.dictValue) : !courseTypeList.includes(item.dictValue)">{{ item.dictLabel }}
  274. </el-radio>
  275. </el-radio-group>
  276. </div>
  277. </el-form-item>
  278. <el-form-item label="内容">
  279. <el-input :disabled="formType == 3" v-if="setList.contentType == 1 "
  280. v-model="setList.value"
  281. type="textarea" :rows="3" placeholder="内容"
  282. style="width: 90%;margin-top: 10px;"
  283. @keydown.native="handleKeydown($event, index, contentIndex, setIndex)"
  284. :ref="`textarea-${index}-${contentIndex}-${setIndex}`"
  285. />
  286. <!-- 修改按钮部分 -->
  287. <el-link
  288. v-if="setList.contentType == 1"
  289. type="primary"
  290. @click="toggleSalesCall(index, contentIndex, setIndex)"
  291. style="margin-top: 10px;"
  292. >
  293. {{ setList.isSalesCallAdded ? '移除#销售称呼#' : '添加#销售称呼#' }}
  294. </el-link>
  295. <ImageUpload :disabled="formType == 3" v-if="setList.contentType == 2 "
  296. v-model="setList.imgUrl"
  297. type="image" :num="1" :width="150" :height="150"/>
  298. <div
  299. v-if="setList.contentType == 3 || (setList.contentType == 9 && content.type==2 )">
  300. <el-card class="box-card">
  301. <el-form-item label="链接标题:" label-width="100px" required>
  302. <el-input :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)" v-model="setList.linkTitle"
  303. @change="updateAll(setIndex, item, 'linkTitle', $event)"
  304. placeholder="请输入链接标题"
  305. style="width: 90%;"/>
  306. </el-form-item>
  307. <el-form-item label="链接描述:" label-width="100px" required>
  308. <el-input :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)" type="textarea" :rows="3"
  309. v-model="setList.linkDescribe"
  310. @change="updateAll(setIndex, item, 'linkDescribe', $event)"
  311. placeholder="请输入链接描述"
  312. style="width: 90%;margin-top: 1%;"/>
  313. </el-form-item>
  314. <el-form-item label="链接封面:" label-width="100px" required>
  315. <ImageUpload :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)" v-model="setList.linkImageUrl"
  316. type="image" :num="1"
  317. @input="updateAll(setIndex, item, 'linkImageUrl', $event)"
  318. :file-size="2" :width="150" :height="150"
  319. style="margin-top: 1%;"/>
  320. </el-form-item>
  321. <div v-if="content.type != 2 " style="margin-top: 1%">
  322. <el-form-item label="链接地址:" label-width="100px" required>
  323. <el-input :disabled="formType == 3" v-model="setList.linkUrl"
  324. placeholder="请输入链接地址"
  325. style="width: 90%;"/>
  326. </el-form-item>
  327. </div>
  328. <div v-if="content.type == 2 ">
  329. <el-form-item label="链接地址:" label-width="100px">
  330. <el-tag type="warning" v-model="setList.isBindUrl = 1 ">选择的课程小节
  331. 即为卡片链接地址
  332. </el-tag>
  333. </el-form-item>
  334. </div>
  335. </el-card>
  336. </div>
  337. <div v-if="setList.contentType == 4">
  338. <el-card class="box-card">
  339. <el-form-item label="标题" prop="miniprogramTitle">
  340. <el-input v-model="setList.miniprogramTitle"
  341. :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)"
  342. @change="updateAll(setIndex, item, 'miniprogramTitle', $event)"
  343. placeholder="请输入小程序消息标题,最长为64字节" :rows="2"
  344. maxlength="64" type="textarea"
  345. @input="checkByteLength(content,setList.contentType,content.isOfficial)"/>
  346. </el-form-item>
  347. <el-form-item label="封面" prop="miniprogramPicUrl">
  348. <ImageUpload v-if="content.isOfficial !== '1'"
  349. @change="updateAll(setIndex, item, 'miniprogramPicUrl', $event)"
  350. :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)"
  351. v-model="setList.miniprogramPicUrl" type="image" :num="10"
  352. :width="150" :height="150"/>
  353. </el-form-item>
  354. <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
  355. <el-input v-model="setList.miniprogramAppid='wx73f85f8d62769119' "
  356. disabled/>
  357. </el-form-item>
  358. <el-form-item label="page路径" prop="miniprogramPage" v-show="false"
  359. label-width="100px" style="margin-left: -30px">
  360. <el-input v-model="setList.miniprogramPage"
  361. placeholder="小程序消息打开后的路径" disabled/>
  362. </el-form-item>
  363. </el-card>
  364. </div>
  365. <div v-if="setList.contentType == 5 ">
  366. <el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
  367. <el-upload
  368. :disabled="formType == 3"
  369. v-model="setList.fileUrl"
  370. class="avatar-uploader"
  371. :action="uploadUrl"
  372. :show-file-list="false"
  373. :on-success="(res, file) => handleAvatarSuccessFile(res, file, setList)"
  374. :before-upload="beforeAvatarUploadFile">
  375. <i class="el-icon-plus avatar-uploader-icon"></i>
  376. </el-upload>
  377. <el-link v-if="setList.fileUrl" type="primary"
  378. :href="downloadUrl(setList.fileUrl)" download>
  379. {{ setList.fileUrl }}
  380. </el-link>
  381. </el-form-item>
  382. </div>
  383. <div v-if="setList.contentType == 6 ">
  384. <el-form-item label="上传视频:" prop="videoUrl" label-width="100px">
  385. <el-upload
  386. :disabled="formType == 3"
  387. v-model="setList.videoUrl"
  388. class="avatar-uploader"
  389. :action="uploadUrl"
  390. :show-file-list="false"
  391. :on-success="(res, file) => handleAvatarSuccessVideo(res, file, setList)"
  392. :before-upload="beforeAvatarUploadVideo">
  393. <i class="el-icon-plus avatar-uploader-icon"></i>
  394. </el-upload>
  395. <video v-if="setList.videoUrl"
  396. :src="setList.videoUrl"
  397. controls style="width: 200px;height: 100px">
  398. </video>
  399. </el-form-item>
  400. </div>
  401. <div v-if="setList.contentType == 7 ">
  402. <el-input
  403. :disabled="formType == 3"
  404. v-model="setList.value"
  405. type="textarea" :rows="3" maxlength="66" show-word-limit
  406. placeholder="输入要转为语音的内容"
  407. style="width: 90%;margin-top: 10px;"
  408. @input="handleInputVideoText(setList.value,setList)"/>
  409. </div>
  410. <div v-if="setList.contentType == 8 ">
  411. <el-button :disabled="formType == 3" type="primary"
  412. style="margin-bottom: 1%"
  413. @click="hanldeSelectVideoNum(content,index,contentIndex,setIndex)">
  414. 选择视频号
  415. </el-button>
  416. <el-card class="box-card" v-if="setList.coverUrl">
  417. <el-form-item label="封面标题:" label-width="100px">
  418. <el-input :disabled="formType == 3" v-model="setList.nickname"
  419. style="width: 90%;margin-bottom: 1%" disabled/>
  420. </el-form-item>
  421. <el-form-item label="头像:" label-width="100px">
  422. <el-image
  423. v-if="setList.avatar != null"
  424. :src="setList.avatar"
  425. :preview-src-list="[setList.avatar]"
  426. :style="{ width: '50px', height: '50px' }"
  427. ></el-image>
  428. </el-form-item>
  429. <el-form-item label="封面:" label-width="100px">
  430. <el-image
  431. v-if="setList.coverUrl != null"
  432. :src="setList.coverUrl"
  433. :preview-src-list="[setList.coverUrl]"
  434. :style="{ width: '200px', height: '200px' }"
  435. ></el-image>
  436. </el-form-item>
  437. <el-form-item label="简介:" label-width="100px">
  438. <el-input :disabled="formType == 3" type="textarea" :rows="3"
  439. v-model="setList.desc"
  440. style="width: 90%;margin-top: 1%;" disabled/>
  441. </el-form-item>
  442. <el-form-item label="视频地址:" label-width="100px"
  443. style="margin-top: 1%">
  444. <el-input :disabled="formType == 3" v-model="setList.url"
  445. style="width: 90%;" disabled/>
  446. </el-form-item>
  447. </el-card>
  448. </div>
  449. <div v-if="setList.contentType == 10 ">
  450. <el-card class="box-card">
  451. <el-form-item label="链接标题:" label-width="100px" required>
  452. <el-input :disabled="formType == 3" v-model="setList.linkTitle"
  453. placeholder="请输入链接标题"
  454. style="width: 90%;"/>
  455. </el-form-item>
  456. <el-form-item label="链接描述:" label-width="100px" required>
  457. <el-input :disabled="formType == 3" type="textarea" :rows="3"
  458. v-model="setList.linkDescribe"
  459. placeholder="请输入链接描述"
  460. style="width: 90%;margin-top: 1%;"/>
  461. </el-form-item>
  462. <el-form-item label="链接封面:" label-width="100px" required>
  463. <ImageUpload :disabled="formType == 3" v-model="setList.linkImageUrl"
  464. type="image" :num="1"
  465. :file-size="2" :width="150" :height="150"
  466. style="margin-top: 1%;"/>
  467. </el-form-item>
  468. <el-form-item label="链接地址:" label-width="100px">
  469. <el-tag type="warning"> 链接地址自动生成
  470. </el-tag>
  471. </el-form-item>
  472. </el-card>
  473. </div>
  474. </el-form-item>
  475. <el-form-item label="添加短链"
  476. v-if="content.type == 2 && setList.contentType == 1 ">
  477. <el-tooltip content="请先根据课程选定课程小节之后再添加" effect="dark"
  478. :disabled="!content.videoId">
  479. <el-switch
  480. @change="updateHtml"
  481. v-model="setList.isBindUrl"
  482. :disabled="!content.videoId && formType == 3"
  483. active-color="#13ce66"
  484. inactive-color="#DCDFE6"
  485. active-value="1"
  486. inactive-value="2">
  487. </el-switch>
  488. </el-tooltip>
  489. <span v-if="setList.isBindUrl == '1'"
  490. style="margin-left: 10px; color: #13ce66">添加URL</span>
  491. <span v-if="setList.isBindUrl == '2'"
  492. style="margin-left: 10px; color: #b1b4ba">不加URL</span>
  493. </el-form-item>
  494. <el-form-item label="课节过期时间"
  495. v-if="content.type == 2 && setList.isBindUrl == '1' && setList.contentType != 2 && setList.contentType != 5 && setList.contentType != 6 && setList.contentType != 8 && setList.contentType != 9 && setList.contentType != 10 ">
  496. <el-row>
  497. <el-input type="number" v-model="setList.expiresDays"
  498. :disabled="formType == 3 || (form.sendType == 11 && contentIndex != 0 && setIndex == 0)"
  499. @change="updateAll(setIndex, item, 'expiresDays', $event)"
  500. style="width: 200px">
  501. <template slot="append">天</template>
  502. </el-input>
  503. </el-row>
  504. <el-row>
  505. <span class="tip">填写0或不填时,默认为系统配置的默认时间</span>
  506. </el-row>
  507. </el-form-item>
  508. </el-form>
  509. <el-form v-if="form.sendType == 4" :model="setList" label-width="70px">
  510. <el-form-item label="添加客服" prop="intervalTime" style="margin: 2%">
  511. <el-input-number
  512. v-model="setList.intervalTime"
  513. :min="1"
  514. :max="1440"
  515. style="width:100px;margin-top: 10px;"
  516. >
  517. </el-input-number>
  518. <span class="tip">单位:分钟,最大1440分钟(24小时)</span>
  519. </el-form-item>
  520. <el-form-item label="内容" style="margin: 2%">
  521. <el-input
  522. v-model="setList.value"
  523. type="textarea"
  524. :rows="3"
  525. placeholder="内容"
  526. style="width: 90%;margin-top: 10px;"/>
  527. </el-form-item>
  528. <el-form-item label="交流状态" style="margin: 2%">
  529. <el-select v-model="setList.talkType" placeholder="更改交流状态" size="mini"
  530. style=" margin-right: 10px;" clearable>
  531. <el-option label="非首次交流" value="非首次交流"></el-option>
  532. <el-option label="首次交流1" value="首次交流1"></el-option>
  533. <el-option label="首次交流2" value="首次交流2"></el-option>
  534. <el-option label="交流状态1" value="交流状态1"></el-option>
  535. <el-option label="交流状态2" value="交流状态2"></el-option>
  536. <el-option label="交流状态3" value="交流状态3"></el-option>
  537. </el-select>
  538. </el-form-item>
  539. </el-form>
  540. </el-col>
  541. <el-col :span="1" :offset="1">
  542. <i class="el-icon-delete" @click="delSetList(index,contentIndex,setIndex)"
  543. style="margin-top: 20px;"
  544. v-if="content.setting.length>1 && formType != 3 && !(form.sendType == 11 && setIndex == 0)"></i>
  545. </el-col>
  546. </el-row>
  547. </div>
  548. <el-link type="primary" class="el-icon-plus" :underline="false"
  549. @click='addSetList(contentIndex,item.content)'
  550. v-if="content.type != 4 && formType != 3">添加内容
  551. </el-link>
  552. </el-form>
  553. </el-col>
  554. <el-col :span="1" :offset="1">
  555. <i class="el-icon-delete" @click="delContent(index,contentIndex)"
  556. style="margin-top: 20px;"
  557. v-if="item.content.length>1 && formType != 3"></i>
  558. </el-col>
  559. </el-row>
  560. </div>
  561. <el-link type="primary" class="el-icon-plus" :underline="false" @click='addContent(index)'
  562. v-if="formType != 3 && form.sendType != 4">添加规则
  563. </el-link>
  564. </el-form-item>
  565. </el-form>
  566. </div>
  567. <div style="float: right;" v-if="formType != 3">
  568. <el-button type="primary" @click="save" v-if="!item.voice || item.voice == 0">
  569. 保存({{ '第' + (1 + (form.gap * index)) + '天' }})
  570. </el-button>
  571. <el-button type="primary" disabled v-if="item.voice == 1">语言生成中</el-button>
  572. <el-button type="primary" @click="leave(tabIndex)" v-if="item.voice == 1">刷新状态</el-button>
  573. </div>
  574. </el-col>
  575. </el-row>
  576. </el-tab-pane>
  577. </el-tabs>
  578. </el-form-item>
  579. </el-form>
  580. </div>
  581. <el-dialog :title="videoNumOptions.title" :visible.sync="videoNumOptions.open" style="width: 1500px;height: 100%"
  582. append-to-body>
  583. <userVideo ref="QwUserVideo" @videoResult="qwUserVideoResult"></userVideo>
  584. </el-dialog>
  585. <el-dialog title="修改天数排序" :visible.sync="openSort" style="width: 1500px" append-to-body>
  586. <draggable v-model="dayList" @end="onDragEndDay" style="padding: 20px">
  587. <el-button v-for="(item, index) in dayList" :class="item.newDay != item.dayNum ? 'red':''">第{{
  588. item.newDay
  589. }}天(第{{ item.dayNum }}天)
  590. </el-button>
  591. </draggable>
  592. <div style="float: right;">
  593. <el-button type="primary" @click="saveSorts">保存</el-button>
  594. </div>
  595. </el-dialog>
  596. <el-dialog title="修改规则排序" :visible.sync="openSort2" style="width: 1500px" append-to-body>
  597. <draggable v-model="ruleList" @end="onDragEnd" style="padding: 20px">
  598. <el-button v-for="(item, index) in ruleList">{{ item.time }}</el-button>
  599. </draggable>
  600. <div style="float: right;">
  601. <el-button @click="autoSortsRules">自动排序</el-button>
  602. <el-button type="primary" @click="saveSortsRules">保存</el-button>
  603. </div>
  604. </el-dialog>
  605. </div>
  606. </template>
  607. <style scoped>
  608. .el-button {
  609. margin-left: 10px;
  610. }
  611. .red:hover {
  612. color: #dbdbdb !important;
  613. }
  614. .red {
  615. background-color: #F56C6C !important;
  616. color: #fff !important;
  617. }
  618. .custom-input /deep/ .el-input__inner {
  619. height: 20px;
  620. text-align: center;
  621. }
  622. .custom-input /deep/ .el-input__icon {
  623. line-height: 10px;
  624. }
  625. .el-icon-delete {
  626. cursor: pointer;
  627. }
  628. /deep/ .el-badge__content.is-fixed {
  629. top: 10px !important;
  630. right: 0 !important;
  631. width: 8px;
  632. }
  633. .tip {
  634. color: #909399;
  635. font-size: 12px;
  636. margin-left: 10px;
  637. }
  638. .sortable-ghost {
  639. background: rgb(26, 164, 255) !important;
  640. color: #FFF !important;
  641. }
  642. </style>
  643. <script>
  644. import draggable from 'vuedraggable';
  645. import {
  646. listSopTemp,
  647. getSopTemp,
  648. delSopTemp,
  649. addSopTemp,
  650. sortDay,
  651. dayListFun,
  652. updateSopTemp,
  653. getSelectableRange,
  654. exportSopTemp,
  655. addOrUpdateSetting,
  656. selectRulesInfo,
  657. delRules
  658. } from "@/api/qw/sopTemp";
  659. import {courseList, videoList} from "@/api/qw/sop";
  660. import ImageUpload from "@/views/qw/sop/ImageUpload";
  661. import userVideo from "@/views/qw/userVideo/userVideo.vue";
  662. export default {
  663. name: "updateSopTemp",
  664. components: {ImageUpload, userVideo, draggable},
  665. data() {
  666. return {
  667. addTag: [{
  668. addTag: [],
  669. inputVisible: false,
  670. inputValue: '',
  671. delTag: [],
  672. delTagVisible: false,
  673. delTagValue: ''
  674. }],
  675. uploadUrl: process.env.VUE_APP_BASE_API + "/common/uploadOSS",
  676. uploadUrlByVoice: process.env.VUE_APP_BASE_API + "/common/uploadOSSByHOOKVoice",
  677. //上传语音的遮罩层
  678. voiceLoading: false,
  679. openSort: false,
  680. openSort2: false,
  681. // 遮罩层
  682. loading: false,
  683. loading2: false,
  684. loading3: false,
  685. // 导出遮罩层
  686. exportLoading: false,
  687. // 选中数组
  688. dayList: [],
  689. ruleList: [],
  690. ids: [],
  691. courseTypeList: ['3', '4', '9'],
  692. sysFsSopWatchStatus: [],
  693. //消息内容类型 企微版
  694. sysQwSopContentType: [],
  695. //插件版
  696. sysQwSopAiContentType: [],
  697. //类别
  698. sysQwSopSettingType: [],
  699. courseList: [],
  700. videoList: [],
  701. // 非单个禁用
  702. single: true,
  703. // 非多个禁用
  704. multiple: true,
  705. defaultContentType: 1,
  706. // 显示搜索条件
  707. showSearch: true,
  708. // 总条数
  709. id: "",
  710. total: 0,
  711. tabIndex: null,
  712. // sop模板表格数据
  713. setting: [],
  714. data: [],
  715. // 弹出层标题
  716. title: "",
  717. // 是否显示弹出层
  718. open: false,
  719. // 状态字典
  720. statusOptions: [],
  721. startTimeRange: [],
  722. videoNumOptions: {
  723. title: '选择视频号',
  724. open: false,
  725. content: null,
  726. contentIndex: null,
  727. setIndex: null,
  728. },
  729. //1 修改 2 复制 3 查看
  730. formType: null,
  731. // 查询参数
  732. form: {
  733. name: null,
  734. setting: null,
  735. status: "1",
  736. sort: 1,
  737. companyId: null,
  738. gap: 1,
  739. },
  740. // 表单校验
  741. rules: {
  742. name: [
  743. {required: true, message: '名称不能为空', trigger: 'blur'}
  744. ],
  745. status: [
  746. {required: true, message: '状态不能为空', trigger: 'blur'}
  747. ],
  748. sort: [
  749. {required: true, message: '排序不能为空', trigger: 'blur'}
  750. ],
  751. gap: [
  752. {required: true, message: '间隔天数不能为空', trigger: 'blur'}
  753. ],
  754. }
  755. };
  756. },
  757. created() {
  758. this.getDicts("sys_qwSopAi_contentType").then(response => {
  759. this.sysQwSopAiContentType = response.data;
  760. });
  761. this.getDicts("sys_fs_sop_watch_status").then(response => {
  762. this.sysFsSopWatchStatus = response.data;
  763. });
  764. this.getDicts("sys_qwSop_contentType").then(response => {
  765. this.sysQwSopContentType = response.data;
  766. });
  767. this.getDicts("sys_company_status").then(response => {
  768. this.statusOptions = response.data;
  769. });
  770. this.getDicts("sys_qwSop_settingType").then(response => {
  771. this.sysQwSopSettingType = response.data;
  772. });
  773. courseList().then(response => {
  774. this.courseList = response.list;
  775. });
  776. getSelectableRange().then(e => {
  777. this.startTimeRange = e.data;
  778. })
  779. const id = this.$route.params && this.$route.params.id;
  780. this.id = id;
  781. this.formType = this.$route.params && this.$route.params.type;
  782. this.handleUpdate(id);
  783. },
  784. methods: {
  785. handleClose(index, tag, content) {
  786. content.addTag.splice(content.addTag.indexOf(tag), 1);
  787. },
  788. showInput(index) {
  789. this.addTag[index].inputVisible = true;
  790. },
  791. handleInputConfirm(index, content) {
  792. let inputValue = this.addTag[index].inputValue;
  793. if (inputValue) {
  794. if (!content.hasOwnProperty('addTag')) {
  795. this.$set(content, 'addTag', []);
  796. }
  797. content.addTag.push(inputValue);
  798. }
  799. this.addTag[index].inputVisible = false;
  800. this.addTag[index].inputValue = '';
  801. },
  802. // 检查字节长度
  803. checkByteLength(content, type, isOfficial) {
  804. if (type == 4 && isOfficial == '1')
  805. for (let i = 0; i < content.setting.length; i++) {
  806. const text = content.setting[i].miniprogramTitle;
  807. const byteLength = this.getByteLength(text); // 获取当前字节数
  808. // 如果字节数超过64,截断输入内容
  809. if (byteLength > 64) {
  810. this.$set(content.setting[i], 'miniprogramTitle', this.truncateTextByByteLength(text, 60));
  811. }
  812. }
  813. },
  814. // 计算字符串的字节数
  815. getByteLength(text) {
  816. return new Blob([text]).size; // 使用 Blob 计算字节数
  817. },
  818. // 根据字节数截断字符串
  819. truncateTextByByteLength(text, maxByteLength) {
  820. let byteLength = 0;
  821. let result = "";
  822. for (let i = 0; i < text.length; i++) {
  823. const char = text[i];
  824. const charByteLength = this.getByteLength(char); // 获取当前字符的字节数
  825. // 如果加上当前字符的字节数后不超过限制,则添加到结果中
  826. if (byteLength + charByteLength <= maxByteLength) {
  827. result += char;
  828. byteLength += charByteLength;
  829. } else {
  830. break; // 超过限制时停止
  831. }
  832. }
  833. return result;
  834. },
  835. handleCloseDel(index, tag, content) {
  836. content.delTag.splice(content.delTag.indexOf(tag), 1);
  837. },
  838. showInputDel(index) {
  839. this.addTag[index].delTagVisible = true;
  840. },
  841. handleInputConfirmDel(index, content) {
  842. let delTagValue = this.addTag[index].delTagValue;
  843. if (delTagValue) {
  844. if (!content.hasOwnProperty('delTag')) {
  845. this.$set(content, 'delTag', []);
  846. }
  847. content.delTag.push(delTagValue);
  848. }
  849. this.addTag[index].delTagVisible = false;
  850. this.addTag[index].delTagValue = '';
  851. },
  852. saveSorts() {
  853. let list = this.dayList.filter(e => e.dayNum != e.newDay).map(e => {
  854. return {dayNum: e.newDay, id: e.id}
  855. })
  856. this.loading3 = true;
  857. sortDay(list).then(e => {
  858. window.location.reload();
  859. })
  860. },
  861. saveSortsRules() {
  862. this.$set(this.setting[this.tabIndex], 'content', this.ruleList);
  863. this.openSort2 = false;
  864. },
  865. autoSortsRules() {
  866. this.ruleList = this.ruleList.sort((a, b) => {
  867. // 将 time 字段转换为 Date 对象进行比较
  868. const timeA = new Date(`1970-01-01T${a.time}Z`);
  869. const timeB = new Date(`1970-01-01T${b.time}Z`);
  870. // 比较时间顺序
  871. return timeA - timeB; // 升序排序
  872. });
  873. },
  874. openUpdateDaySorts() {
  875. dayListFun(this.id).then(response => {
  876. response.data.forEach((item) => item.newDay = item.dayNum);
  877. this.dayList = response.data;
  878. if (this.dayList == null || this.dayList.length == 0) {
  879. this.$message.error("暂无天数")
  880. } else {
  881. this.openSort = true;
  882. }
  883. })
  884. },
  885. openUpdateSorts() {
  886. this.ruleList = JSON.parse(JSON.stringify(this.setting[this.tabIndex].content));
  887. if (this.ruleList == null || this.ruleList.length == 0) {
  888. this.$message.error("暂无规则")
  889. } else {
  890. this.openSort2 = true;
  891. }
  892. },
  893. onDragEndDay() {
  894. this.dayList.forEach((item, index) => {
  895. item.newDay = (this.form.gap * index) + 1;
  896. })
  897. this.$forceUpdate()
  898. },
  899. onDragEnd() {
  900. // 更新排序值
  901. // this.setting[this.tabIndex].content.forEach((item, index) => {
  902. // item.sorts = index;
  903. // });
  904. },
  905. // 切换标签保存数据
  906. leave(index, oldIndex) {
  907. const newData = this.setting[index]
  908. if (newData.dayNum && newData.id) {
  909. this.loading = true;
  910. selectRulesInfo(newData.id).then(res => {
  911. this.$nextTick(() => {
  912. this.loading = false;
  913. this.videoList = [];
  914. this.addTag = [];
  915. this.$set(this.setting, index, {
  916. ...newData,
  917. voice: res.data.voice,
  918. content: res.data.list || [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: ""}]}]
  919. });
  920. for (let j = 0; j < this.setting[index].content.length; j++) {
  921. if (this.setting[index].content[j].addTag != null) {
  922. this.setting[index].content[j].addTag = JSON.parse(this.setting[index].content[j].addTag)
  923. }
  924. if (this.setting[index].content[j].delTag != null) {
  925. this.setting[index].content[j].delTag = JSON.parse(this.setting[index].content[j].delTag)
  926. }
  927. this.videoList.push([])
  928. this.addTag.push({
  929. addTag: [],
  930. inputVisible: false,
  931. inputValue: '',
  932. delTag: [],
  933. delTagVisible: false,
  934. delTagValue: ''
  935. })
  936. if (this.setting[index].content[j].type == 2) {
  937. if (this.setting[index].content[j].hasOwnProperty('courseId')) {
  938. this.courseChange(this.setting[index].content[j], index, j);
  939. }
  940. }
  941. }
  942. })
  943. });
  944. }
  945. },
  946. save() {
  947. let data = this.setting[this.tabIndex];
  948. let check = this.checkData(data);
  949. if (!check) {
  950. return;
  951. }
  952. for (let j = 0; j < data.content.length; j++) {
  953. if (data.content[j].type != 4 && data.content[j].type != 5) {
  954. for (let k = 0; k < data.content[j].setting.length; k++) {
  955. if (data.content[j].setting[k].contentType == 4 && (data.content[j].setting[k].miniprogramTitle != null || data.content[j].setting[k].miniprogramTitle != "")) {
  956. data.content[j].setting[k].miniprogramTitle = this.truncateTextByByteLength(data.content[j].setting[k].miniprogramTitle, 60)
  957. }
  958. }
  959. }
  960. }
  961. let index = 0;
  962. const dataList = data.content.map(e => {
  963. e.name = data.name;
  964. e.tempId = this.id;
  965. e.sorts = Number(this.tabIndex);
  966. e.dayNum = (this.form.gap * e.sorts) + 1;
  967. e.sorts = index++;
  968. data.dayNum = e.dayNum;
  969. e.contentType = e.type;
  970. e.settingList = e.setting;
  971. e.settingList.forEach(e => e.content = JSON.stringify(e));
  972. if (e.addTag != null) {
  973. e.addTag = JSON.stringify(e.addTag);
  974. }
  975. if (e.delTag != null) {
  976. e.delTag = JSON.stringify(e.delTag);
  977. }
  978. return e;
  979. })
  980. data.tempId = this.id;
  981. data.list = dataList;
  982. this.loading = true;
  983. addOrUpdateSetting(data).then(e => {
  984. this.$message.success(e.msg)
  985. let content = this.setting[this.tabIndex].content;
  986. for (let j = 0; j < content.length; j++) {
  987. if (content[j].addTag != null) {
  988. content[j].addTag = JSON.parse(content[j].addTag);
  989. }
  990. if (content[j].delTag != null) {
  991. content[j].delTag = JSON.parse(content[j].delTag);
  992. }
  993. }
  994. this.loading = false;
  995. // 使用Vue.set确保响应式更新
  996. this.$set(this.setting, this.tabIndex, {
  997. ...this.setting[this.tabIndex],
  998. id: e.data.id,
  999. });
  1000. }).catch(() => {
  1001. this.loading = false;
  1002. });
  1003. },
  1004. checkData(data) {
  1005. if (this.form.sendType != 4) {
  1006. for (let j = 0; j < data.content.length; j++) {
  1007. if (data.name == null || data.name == "") {
  1008. this.$message.error("内容名称不能为空")
  1009. return false;
  1010. }
  1011. if (data.content[j].time == null || data.content[j].time == "") {
  1012. this.$message.error("时间不能为空")
  1013. return false;
  1014. }
  1015. if (data.content[j].type == 2) {
  1016. if (data.content[j].courseId == null || data.content[j].courseId == "") {
  1017. this.$message.error("请选择课程")
  1018. return false;
  1019. }
  1020. if (data.content[j].videoId == null || data.content[j].videoId == "") {
  1021. this.$message.error("请选择课节")
  1022. return false;
  1023. }
  1024. if (data.content[j].courseType == null || data.content[j].courseType === "") {
  1025. this.$message.error("请选择消息类型")
  1026. return false;
  1027. }
  1028. }
  1029. if (data.content[j].type != 4 && data.content[j].type != 5) {
  1030. for (let k = 0; k < data.content[j].setting.length; k++) {
  1031. if (data.content[j].setting[k].contentType == 1 && (data.content[j].setting[k].value == null || data.content[j].setting[k].value == "")) {
  1032. this.$message.error("内容不能为空")
  1033. return false;
  1034. }
  1035. if (data.content[j].setting[k].contentType == 2 && (data.content[j].setting[k].imgUrl == null || data.content[j].setting[k].imgUrl == "")) {
  1036. this.$message.error("图片不能为空")
  1037. return false;
  1038. }
  1039. if ((data.content[j].setting[k].contentType == 3 || data.content[j].setting[k].contentType == 9 || data.content[j].setting[k].contentType == 10) && (data.content[j].setting[k].linkTitle == null || data.content[j].setting[k].linkTitle == "")) {
  1040. this.$message.error("链接标题不能为空")
  1041. return false;
  1042. }
  1043. if ((data.content[j].setting[k].contentType == 3 || data.content[j].setting[k].contentType == 9 || data.content[j].setting[k].contentType == 10) && (data.content[j].setting[k].linkDescribe == null || data.content[j].setting[k].linkDescribe == "")) {
  1044. this.$message.error("链接描述不能为空")
  1045. return false;
  1046. }
  1047. if ((data.content[j].setting[k].contentType == 3 || data.content[j].setting[k].contentType == 9 || data.content[j].setting[k].contentType == 10) && (data.content[j].setting[k].linkImageUrl == null || data.content[j].setting[k].linkImageUrl == "")) {
  1048. this.$message.error("链接图片不能为空")
  1049. return false;
  1050. }
  1051. if (data.content[j].setting[k].contentType == 3 && data.content[j].setting[k].type == 1 && (data.content[j].setting[k].linkUrl == null || data.content[j].setting[k].linkUrl == "")) {
  1052. this.$message.error("链接地址不能为空")
  1053. return false;
  1054. }
  1055. if (data.content[j].setting[k].contentType == 4 && (data.content[j].setting[k].miniprogramTitle == null || data.content[j].setting[k].miniprogramTitle == "")) {
  1056. this.$message.error("小程序消息标题不能为空")
  1057. return false;
  1058. }
  1059. if (data.content[j].setting[k].contentType == 4 && data.content[j].isOfficial !== '1' && (data.content[j].setting[k].miniprogramPicUrl == null || data.content[j].setting[k].miniprogramPicUrl == "")) {
  1060. this.$message.error("小程序封面地址不能为空")
  1061. return false;
  1062. }
  1063. if (data.content[j].setting[k].contentType == 5 && (data.content[j].setting[k].fileUrl == null || data.content[j].setting[k].fileUrl == "")) {
  1064. this.$message.error("文件不能为空")
  1065. return false;
  1066. }
  1067. if (data.content[j].setting[k].contentType == 6 && (data.content[j].setting[k].videoUrl == null || data.content[j].setting[k].videoUrl == "")) {
  1068. this.$message.error("视频不能为空")
  1069. return false;
  1070. }
  1071. if (data.content[j].setting[k].contentType == 7 && (data.content[j].setting[k].value == null || data.content[j].setting[k].value == "")) {
  1072. this.$message.error("语音文本不能为空")
  1073. return false;
  1074. }
  1075. if (data.content[j].setting[k].contentType == 8 && (data.content[j].setting[k].url == null || data.content[j].setting[k].url == "")) {
  1076. this.$message.error("视频号信息不能为空")
  1077. return false;
  1078. }
  1079. }
  1080. } else if (data.content[j].type == 4) {
  1081. if (data.content[j].aiTouch == null || data.content[j].aiTouch == '') {
  1082. this.$message.error("AI触达不能为空")
  1083. return false;
  1084. }
  1085. }
  1086. }
  1087. } else {
  1088. for (let day of this.setting) {
  1089. for (let content of day.content) {
  1090. for (let set of content.setting) {
  1091. if (!set.intervalTime) {
  1092. this.$message.error("客服数量不能为空");
  1093. return false;
  1094. }
  1095. if (!set.value) {
  1096. this.$message.error("内容不能为空");
  1097. return false;
  1098. }
  1099. }
  1100. }
  1101. }
  1102. }
  1103. return true;
  1104. },
  1105. tabClick(obj) {
  1106. },
  1107. addSetList(contentIndex, content) {
  1108. if (this.form.sendType == 1) {
  1109. for (let i = 0; i < content.length; i++) {
  1110. if (content[i].setting.length > 9) {
  1111. return this.$message.error("因为企微接口限制,企微模板一条消息只能设置最多~9个内容!!")
  1112. } else {
  1113. // 动态生成新的设置项
  1114. const newSetting = content[i].setting.some(item => item.contentType === '1')
  1115. ? {contentType: '2', imgUrl: ''} // 如果存在 contentType = '1',添加 contentType = '2'
  1116. : {contentType: '1', value: ''}; // 如果不存在 contentType = '1',添加 contentType = '1'
  1117. // 将新设置项添加到 content[i].setting 数组中
  1118. content[i].setting.push(newSetting);
  1119. }
  1120. }
  1121. } else {
  1122. const newSetting = {
  1123. contentType: '1',
  1124. value: '',
  1125. };
  1126. if (this.form.sendType == 4) {
  1127. newSetting.intervalTime = 5;
  1128. }
  1129. // 将新设置项添加到 content.setting 数组中
  1130. content[contentIndex].setting.push(newSetting);
  1131. }
  1132. },
  1133. delSetList(index, contentIndex, setIndex) {
  1134. this.setting[index].content[contentIndex].setting.splice(setIndex, 1)
  1135. },
  1136. addContent(index) {
  1137. if (this.setting[index].content.length > 0 && this.form.sendType == 1) {
  1138. return this.$message.error("因为企微接口限制,企微模板一天只能设置一条消息~")
  1139. } else {
  1140. this.setting[index].content.push({type: this.defaultContentType, contentType: 1, setting: [{contentType: '1', value: "",}]})
  1141. this.videoList.push([])
  1142. this.addTag.push({
  1143. addTag: [],
  1144. inputVisible: false,
  1145. inputValue: '',
  1146. delTag: [],
  1147. delTagVisible: false,
  1148. delTagValue: ''
  1149. })
  1150. }
  1151. },
  1152. delContent(index, contentIndex) {
  1153. this.setting[index].content.splice(contentIndex, 1)
  1154. this.videoList.splice(contentIndex, 1)
  1155. this.addTag.splice(contentIndex, 1)
  1156. },
  1157. addSetting() {
  1158. let content = [{type: this.defaultContentType, contentType: '1', setting: [{contentType: '1', value: "",}]}];
  1159. if (this.form.sendType == 4) {
  1160. content[0].setting[0].intervalTime = 5;
  1161. }
  1162. this.setting.push({
  1163. name: null,
  1164. dayNum: (this.form.gap * this.setting.length) + 1,
  1165. content
  1166. })
  1167. },
  1168. delSetting(index) {
  1169. const newData = this.setting[index]
  1170. if (newData.id && newData.dayNum) {
  1171. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  1172. confirmButtonText: '确定',
  1173. cancelButtonText: '取消',
  1174. type: 'warning'
  1175. }).then(() => {
  1176. delRules(newData.id, newData.name, newData.dayNum).then(res => {
  1177. this.del(index);
  1178. });
  1179. });
  1180. } else {
  1181. this.del(index);
  1182. }
  1183. },
  1184. del(index) {
  1185. if (index == 0) {
  1186. this.tabIndex = "0";
  1187. } else {
  1188. this.tabIndex = (index - 1) + "";
  1189. }
  1190. this.setting.splice(index, 1)
  1191. },
  1192. handleClosegroupUser(list) {
  1193. const index = this.userSelectList.findIndex(t => t === list);
  1194. if (index !== -1) {
  1195. this.userSelectList.splice(index, 1);
  1196. }
  1197. },
  1198. //选择视频号
  1199. hanldeSelectVideoNum(content, index, contentIndex, setIndex) {
  1200. this.videoNumOptions.content = content;
  1201. this.videoNumOptions.contentIndex = contentIndex;
  1202. this.videoNumOptions.setIndex = setIndex;
  1203. this.videoNumOptions.open = true;
  1204. },
  1205. qwUserVideoResult(val) {
  1206. // 根据选中的内容,将返回的数据更新到相应的表单项
  1207. const content = this.videoNumOptions.content;
  1208. const setList = content.setting[this.videoNumOptions.setIndex];
  1209. setList.nickname = val.nickname;
  1210. setList.avatar = val.avatar;
  1211. setList.coverUrl = val.coverUrl;
  1212. setList.thumbUrl = val.thumbUrl;
  1213. setList.desc = val.desc;
  1214. setList.url = val.url;
  1215. setList.extras = val.extras;
  1216. this.videoNumOptions.open = false;
  1217. },
  1218. //首次刷新
  1219. courseChange(content, index, countIndex) {
  1220. this.courseUpdate(content, index, countIndex);
  1221. },
  1222. //修改
  1223. courseChangeUpdate(content, index, countIndex) {
  1224. this.$set(content, 'videoId', null);
  1225. // 查找选中的课程对应的 label
  1226. const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === content.courseId);
  1227. for (let i = 0; i < content.setting.length; i++) {
  1228. this.$set(content.setting[i], 'linkTitle', null);
  1229. this.$set(content.setting[i], 'linkDescribe', null);
  1230. this.$set(content.setting[i], 'linkImageUrl', null);
  1231. //如果是链接的才上
  1232. if (selectedCourse && content.type == 2 && content.courseId != null) {
  1233. //响应式直接给链接的标题/封面上值
  1234. if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9) {
  1235. this.$set(content.setting[i], 'linkTitle', selectedCourse.dictLabel);
  1236. this.$set(content.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
  1237. }
  1238. if (content.setting[i].contentType == 4) {
  1239. this.$set(content.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
  1240. }
  1241. }
  1242. }
  1243. this.courseUpdate(content, index, countIndex);
  1244. },
  1245. handleInputVideoText(value, content) {
  1246. // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
  1247. const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
  1248. // 删除不符合条件的字符
  1249. const filteredValue = value.split('').filter(char => regex.test(char)).join('');
  1250. this.$set(content, 'value', filteredValue);
  1251. },
  1252. courseUpdate(content, index, countIndex) {
  1253. videoList(content.courseId).then(response => {
  1254. // this.$set(this.videoList, countIndex, response.list); // 响应式设置videoList
  1255. this.videoList.splice(countIndex, 1, response.list);
  1256. });
  1257. },
  1258. toggleSalesCall(itemIndex, contentIndex, setIndex) {
  1259. // 获取目标对象
  1260. const setItem = this.setting[itemIndex].content[contentIndex].setting[setIndex];
  1261. const salesCall = '#销售称呼#';
  1262. const refKey = `textarea-${itemIndex}-${contentIndex}-${setIndex}`;
  1263. const textarea = this.$refs[refKey][0]?.$refs?.textarea;
  1264. if (!textarea) return;
  1265. // 获取光标位置
  1266. const cursorPosition = textarea.selectionStart;
  1267. if (setItem.isSalesCallAdded) {
  1268. // 移除所有标签
  1269. setItem.value = setItem.value.replace(new RegExp(salesCall, 'g'), '');
  1270. } else {
  1271. // 插入到光标位置
  1272. setItem.value =
  1273. setItem.value.slice(0, cursorPosition) +
  1274. salesCall +
  1275. setItem.value.slice(cursorPosition);
  1276. }
  1277. // 切换状态
  1278. setItem.isSalesCallAdded = !setItem.isSalesCallAdded;
  1279. // 保持光标位置
  1280. this.$nextTick(() => {
  1281. const newCursorPos = cursorPosition + (setItem.isSalesCallAdded ? salesCall.length : 0);
  1282. textarea.setSelectionRange(newCursorPos, newCursorPos);
  1283. });
  1284. },
  1285. handleKeydown(event, itemIndex, contentIndex, setIndex) {
  1286. const setItem = this.setting[itemIndex].content[contentIndex].setting[setIndex];
  1287. const refKey = `textarea-${itemIndex}-${contentIndex}-${setIndex}`;
  1288. const textarea = this.$refs[refKey][0]?.$refs?.textarea;
  1289. if (!textarea) return;
  1290. const tags = ['#销售称呼#', '#客户称呼#'];
  1291. const key = event.key;
  1292. const value = setItem.value;
  1293. const cursorPosition = textarea.selectionStart;
  1294. if (key === 'Backspace' || key === 'Delete') {
  1295. tags.forEach(tag => {
  1296. let start, end;
  1297. // Backspace 处理
  1298. if (key === 'Backspace' && cursorPosition >= tag.length) {
  1299. start = cursorPosition - tag.length;
  1300. if (value.slice(start, cursorPosition) === tag) {
  1301. event.preventDefault();
  1302. setItem.value = value.slice(0, start) + value.slice(cursorPosition);
  1303. if (tag === '#销售称呼#') setItem.isSalesCallAdded = false;
  1304. this.$nextTick(() => textarea.setSelectionRange(start, start));
  1305. }
  1306. }
  1307. // Delete 处理
  1308. if (key === 'Delete') {
  1309. end = cursorPosition + tag.length;
  1310. if (value.slice(cursorPosition, end) === tag) {
  1311. event.preventDefault();
  1312. setItem.value = value.slice(0, cursorPosition) + value.slice(end);
  1313. if (tag === '#销售称呼#') setItem.isSalesCallAdded = false;
  1314. }
  1315. }
  1316. });
  1317. }
  1318. },
  1319. handleContentTypeChange(content, index, countIndex, setIndex, item, fieldName, val) {
  1320. //如果是链接的才上
  1321. if (content.courseId != null && content.type == 2) {
  1322. const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === content.courseId);
  1323. for (let i = 0; i < content.setting.length; i++) {
  1324. //响应式直接给链接的标题/封面上值
  1325. if (selectedCourse && content.type == 2 && content.courseId != null) {
  1326. if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9) {
  1327. this.$set(content.setting[i], 'linkTitle', selectedCourse.dictLabel);
  1328. this.$set(content.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
  1329. }
  1330. if (content.setting[i].contentType == 4 && (content.isOfficial == '0' || content.isOfficial == null)) {
  1331. console.log(content.isOfficial);
  1332. this.$set(content.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
  1333. }
  1334. }
  1335. }
  1336. }
  1337. if (content.videoId != null && content.type == 2) {
  1338. // 查找选中的课节对应的 label
  1339. const selectedVideo = this.videoList[countIndex].find(course => parseInt(course.dictValue) === content.videoId);
  1340. for (let i = 0; i < content.setting.length; i++) {
  1341. //响应式直接给链接的描述上值
  1342. if (selectedVideo && content.type == 2 && content.videoId != null) {
  1343. if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9) {
  1344. this.$set(content.setting[i], 'linkDescribe', selectedVideo.dictLabel);
  1345. }
  1346. if (content.setting[i].contentType == 4) {
  1347. this.$set(content.setting[i], 'miniprogramTitle', this.truncateTextByByteLength(selectedVideo.dictLabel, 60));
  1348. }
  1349. }
  1350. }
  1351. }
  1352. if(countIndex == 0 && setIndex == 0){
  1353. this.updateAll(setIndex, item, fieldName, val);
  1354. for (let index in item.content) {
  1355. if(index != 0){
  1356. this.handleContentTypeChange(item.content[index], 0, index, 0, item, fieldName, val);
  1357. }
  1358. }
  1359. }
  1360. },
  1361. videoIdChange(content, index, countIndex) {
  1362. //选择了课程小节则 默认绑上
  1363. let selectedVideo;
  1364. // 查找选中的课程对应的 label
  1365. if (content.videoId != null) {
  1366. selectedVideo = this.videoList[countIndex].find(course => parseInt(course.dictValue) === content.videoId);
  1367. }
  1368. for (let i = 0; i < content.setting.length; i++) {
  1369. //课程消息-文本内容
  1370. if (content.setting[i].contentType == 1 && content.type == 2) {
  1371. this.$set(content.setting[i], 'isBindUrl', '1');
  1372. }
  1373. //如果是链接的才上
  1374. if (selectedVideo && content.type == 2 && content.videoId != null) {
  1375. if (content.setting[i].contentType == 3 || content.setting[i].contentType == 9) {
  1376. this.$set(content.setting[i], 'linkDescribe', selectedVideo.dictLabel);
  1377. }
  1378. if (content.setting[i].contentType == 4) {
  1379. this.$set(content.setting[i], 'miniprogramTitle', this.truncateTextByByteLength(selectedVideo.dictLabel, 60));
  1380. }
  1381. }
  1382. }
  1383. },
  1384. //上传文件
  1385. handleAvatarSuccessFile(res, file, content) {
  1386. if (res.code === 200) {
  1387. // 使用 $set 确保响应式更新
  1388. this.$set(content, 'fileUrl', res.url);
  1389. } else {
  1390. this.msgError(res.msg);
  1391. }
  1392. },
  1393. beforeAvatarUploadFile(file) {
  1394. const isLt1M = file.size / 1024 / 1024 < 10;
  1395. if (!isLt1M) {
  1396. this.$message.error('上传大小不能超过 10MB!');
  1397. }
  1398. return isLt1M;
  1399. },
  1400. //下载文件
  1401. downloadUrl(materialUrl) {
  1402. // 直接返回文件 URL
  1403. return materialUrl;
  1404. },
  1405. handleAvatarSuccessVideo(res, file, content) {
  1406. if (res.code == 200) {
  1407. // 使用 $set 确保响应式更新
  1408. this.$set(content, 'videoUrl', res.url);
  1409. } else {
  1410. this.msgError(res.msg);
  1411. }
  1412. },
  1413. beforeAvatarUploadVideo(file) {
  1414. const isLt30M = file.size / 1024 / 1024 < 10;
  1415. const isMP4 = file.type === 'video/mp4';
  1416. if (!isMP4) {
  1417. this.$message.error('仅支持上传 MP4 格式的视频文件!');
  1418. return false;
  1419. }
  1420. if (!isLt30M) {
  1421. this.$message.error('上传大小不能超过 10MB!');
  1422. return false;
  1423. }
  1424. return true;
  1425. },
  1426. handleAvatarSuccessVoice(res, file, content) {
  1427. if (res.code == 200) {
  1428. // 创建 Audio 对象加载音频
  1429. const audio = new Audio(res.mp3Url);
  1430. audio.addEventListener('loadedmetadata', () => {
  1431. // 获取音频时长
  1432. this.$set(content, 'voiceDuration', Math.ceil(audio.duration));
  1433. });
  1434. // 使用 $set 确保响应式更新
  1435. this.$set(content, 'voiceUrl', res.silkUrl);
  1436. this.$set(content, 'mp3Url', res.mp3Url);
  1437. } else {
  1438. this.msgError(res.msg);
  1439. }
  1440. this.voiceLoading = false;
  1441. },
  1442. beforeAvatarUploadVoice(file) {
  1443. return new Promise((resolve, reject) => {
  1444. const isLt10M = file.size / 1024 / 1024 < 10; // 假设语音文件大小限制为10MB
  1445. const isVoiceType = ['audio/mp3', 'audio/mpeg', 'audio/wav', 'audio/x-wav'].includes(file.type);
  1446. if (!isVoiceType) {
  1447. this.$message.error('仅支持上传 MP3, WAV, X-WAV 格式的语音文件!');
  1448. return reject(false); // 不允许继续上传
  1449. }
  1450. if (!isLt10M) {
  1451. this.$message.error('上传大小不能超过 10MB!');
  1452. return reject(false); // 不允许继续上传
  1453. }
  1454. // 使用 FileReader 读取文件
  1455. const reader = new FileReader();
  1456. reader.onload = (event) => {
  1457. const audio = new Audio(event.target.result);
  1458. audio.addEventListener('loadedmetadata', () => {
  1459. // 获取时长并保存
  1460. if (Math.ceil(audio.duration) > 30) {
  1461. this.$message.error('音频时长不能超过30秒!');
  1462. this.voiceLoading = false;
  1463. return reject(false); // 不允许继续上传
  1464. }
  1465. resolve(true); // 允许上传
  1466. });
  1467. };
  1468. reader.onerror = () => {
  1469. this.$message.error('无法读取音频文件!请上传正确的音频文件');
  1470. reject(false); // 不允许继续上传
  1471. };
  1472. this.voiceLoading = true;
  1473. reader.readAsDataURL(file); // 开始读取文件
  1474. });
  1475. },
  1476. /** 查询sop模板列表 */
  1477. getList() {
  1478. this.loading = true;
  1479. listSopTemp(this.queryParams).then(response => {
  1480. this.sopTempList = response.rows;
  1481. this.total = response.total;
  1482. this.loading = false;
  1483. });
  1484. },
  1485. // 取消按钮
  1486. cancel() {
  1487. this.$store.dispatch("tagsView/delView", this.$route);
  1488. this.$router.replace('/qw/conversion/sopTemp')
  1489. // this.reset();
  1490. },
  1491. // 表单重置
  1492. reset() {
  1493. this.form = {
  1494. id: null,
  1495. name: null,
  1496. setting: null,
  1497. status: "0",
  1498. sort: null,
  1499. createTime: null,
  1500. createBy: null,
  1501. companyId: null
  1502. };
  1503. this.resetForm("form");
  1504. },
  1505. /** 修改按钮操作 */
  1506. handleUpdate(id) {
  1507. getSopTemp(id).then(response => {
  1508. this.videoList = []
  1509. this.form = response.data;
  1510. this.setting = this.form.list || [];
  1511. if (Array.isArray(this.setting)) {
  1512. this.setting.forEach(item => {
  1513. if (item && Array.isArray(item.content)) {
  1514. item.content.forEach(content => {
  1515. if (content && Array.isArray(content.setting)) {
  1516. content.setting.forEach(setList => {
  1517. if (setList && !Object.hasOwn(setList, 'isSalesCallAdded')) {
  1518. this.$set(setList, 'isSalesCallAdded', false);
  1519. }
  1520. });
  1521. }
  1522. });
  1523. }
  1524. });
  1525. }
  1526. this.form.list.forEach(e => e.newDay = e.dayNum)
  1527. this.dayList = JSON.parse(JSON.stringify(this.form.list));
  1528. this.videoList.push([]);
  1529. this.addTag.push({
  1530. addTag: [],
  1531. inputVisible: false,
  1532. inputValue: '',
  1533. delTag: [],
  1534. delTagVisible: false,
  1535. delTagValue: ''
  1536. })
  1537. });
  1538. },
  1539. /** 提交按钮 */
  1540. submitForm() {
  1541. },
  1542. /** 删除按钮操作 */
  1543. handleDelete(row) {
  1544. const ids = row.id || this.ids;
  1545. this.$confirm('是否确认删除sop模板编号为"' + ids + '"的数据项?', "警告", {
  1546. confirmButtonText: "确定",
  1547. cancelButtonText: "取消",
  1548. type: "warning"
  1549. }).then(function () {
  1550. return delSopTemp(ids);
  1551. }).then(() => {
  1552. this.getList();
  1553. this.msgSuccess("删除成功");
  1554. }).catch(() => {
  1555. });
  1556. },
  1557. /** 导出按钮操作 */
  1558. handleExport() {
  1559. const queryParams = this.queryParams;
  1560. this.$confirm('是否确认导出所有sop模板数据项?', "警告", {
  1561. confirmButtonText: "确定",
  1562. cancelButtonText: "取消",
  1563. type: "warning"
  1564. }).then(() => {
  1565. this.exportLoading = true;
  1566. return exportSopTemp(queryParams);
  1567. }).then(response => {
  1568. this.download(response.msg);
  1569. this.exportLoading = false;
  1570. }).catch(() => {
  1571. });
  1572. },
  1573. updateHtml(val) {
  1574. val || val();
  1575. },
  1576. updateAll(setIndex, list, fieldName, newVal) {
  1577. if(this.form.sendType == 11 && setIndex == 0) {
  1578. console.info("更新数据", newVal)
  1579. for (let index in list.content) {
  1580. this.$set(list.content[index].setting[0], fieldName, newVal);
  1581. }
  1582. }
  1583. }
  1584. }
  1585. };
  1586. </script>