updateSop.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. <template>
  2. <div class="app-container">
  3. <div style="margin: 30px;" v-if="handleType==1"> 修改sop任务</div>
  4. <div style="margin: 30px;" v-if="handleType==2"> 查看sop任务
  5. <div style="float: right">
  6. <!-- <el-button-->
  7. <!-- type="primary"-->
  8. <!-- @click="handleUpdateTags()"-->
  9. <!-- v-hasPermi="['qw:sop:remove']"-->
  10. <!-- >修改标签</el-button>-->
  11. <el-button
  12. type="primary"
  13. @click="handleUpdateQwUser()"
  14. v-hasPermi="['qw:sop:updateSopQwUser']"
  15. >修改员工</el-button>
  16. <el-button
  17. type="primary"
  18. @click="handleUpdateSopTemp()"
  19. v-hasPermi="['qw:sop:updateSopTemp']"
  20. >修改模板</el-button>
  21. </div>
  22. <el-divider></el-divider>
  23. <el-alert
  24. title="注意事项"
  25. type="warning"
  26. description="【持续生成记录中的状态】 的SOP任务仅能查看,不能修改(ps:可以在外面修改【过期时间】和【新客户自动创建sop】)"
  27. :closable="false"
  28. show-icon>
  29. </el-alert>
  30. </div>
  31. <div style="margin-top: 10px;margin-left: 50px;margin-right: 100px;margin-bottom: 60px;">
  32. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  33. <el-form-item label="规则名称" prop="name">
  34. <el-input v-model="form.name" placeholder="请输入规则名称" />
  35. </el-form-item>
  36. <el-form-item label="状态" prop="status">
  37. <dict-tag :options="statusOptions" :value="form.status"></dict-tag>
  38. </el-form-item>
  39. <!-- <el-form-item label="状态">-->
  40. <!-- <el-radio-group v-model="form.status">-->
  41. <!-- <el-radio-->
  42. <!-- v-for="dict in statusOptions"-->
  43. <!-- :label="dict.dictValue"-->
  44. <!-- >{{dict.dictLabel}}</el-radio>-->
  45. <!-- </el-radio-group>-->
  46. <!-- </el-form-item>-->
  47. <el-form-item label="类别" prop="type">
  48. <el-radio-group v-model="form.type">
  49. <el-radio
  50. :label="1"
  51. >个微</el-radio>
  52. <el-radio
  53. :label="2"
  54. >企微</el-radio>
  55. </el-radio-group>
  56. <Tip title="针对于企业微信平台" />
  57. </el-form-item>
  58. <el-form-item label="小转天数" prop="minConversionDay">
  59. <el-input class="el-input" v-model="form.minConversionDay" placeholder="请输入" style="width: 300px">
  60. <template slot="append">天</template>
  61. </el-input>
  62. <Tip title="第一次提醒销售,去联系客户,在【催课看板】处显示,哪些需要联系的客户" />
  63. </el-form-item>
  64. <el-form-item label="大转天数" prop="maxConversionDay">
  65. <el-input class="el-input" v-model="form.maxConversionDay" placeholder="请输入" style="width: 300px">
  66. <template slot="append">天</template>
  67. </el-input>
  68. <Tip title="第二次提醒销售,去联系客户,在【催课看板】处显示,哪些需要联系的客户" />
  69. </el-form-item>
  70. <div v-if="form.type==2">
  71. <el-form-item label="推送方式 ">
  72. <el-radio-group v-model="form.sendType" @input="handleSendTypeChange">
  73. <el-radio
  74. v-for="dict in sysQwSopType"
  75. :key="dict.dictValue"
  76. :label="parseInt(dict.dictValue)"
  77. >{{dict.dictLabel}}</el-radio>
  78. </el-radio-group>
  79. <Tip title="选择模板类型" />
  80. </el-form-item>
  81. <el-form-item label="选择员工" prop="qwUserIds" style="margin-top: 2%">
  82. <div>
  83. <el-button
  84. size="medium"
  85. icon="el-icon-circle-plus-outline"
  86. plain
  87. @click="handlelistUser(form.type,form.sendType)">请选择使用员工</el-button>
  88. </div>
  89. <div>
  90. <el-tag
  91. style="margin-left: 5px"
  92. size="medium"
  93. :key="id"
  94. v-for="id in userSelectList"
  95. :disable-transitions="false"
  96. @close="handleClosegroupUser(id)">
  97. <span v-for="list in companyUserList" :key="list.qwUserId" v-if="list.id==id">{{list.qwUserName}}</span>
  98. </el-tag>
  99. </div>
  100. </el-form-item>
  101. <el-form-item label="标签规则" prop="filterType">
  102. <el-radio-group v-model="form.filterType">
  103. <el-radio
  104. :label="1"
  105. >含全部标签</el-radio>
  106. <el-radio
  107. :label="2"
  108. >含任意标签</el-radio>
  109. </el-radio-group>
  110. </el-form-item>
  111. <el-form-item label="选择的标签" prop="tags">
  112. <el-select v-model="tags" remote multiple placeholder="请选择" filterable style="width: 100%;">
  113. <el-option
  114. v-for="dict in tagList"
  115. :label="dict.name"
  116. :value="dict.tagId">
  117. </el-option>
  118. </el-select>
  119. </el-form-item>
  120. <el-form-item label="排除的标签" prop="excludeTags">
  121. <el-select v-model="excludeTags" remote multiple placeholder="请选择" filterable style="width: 100%;">
  122. <el-option
  123. v-for="dict in tagList"
  124. :label="dict.name"
  125. :value="dict.tagId">
  126. </el-option>
  127. </el-select>
  128. </el-form-item>
  129. </div>
  130. <div v-if="form.type==1">
  131. <el-form-item label="推送方式 ">
  132. <el-tag type="success" v-model="form.sendType=2">AI插件</el-tag>
  133. </el-form-item>
  134. <el-form-item label="标签规则" prop="filterType">
  135. <el-radio-group v-model="form.filterType">
  136. <el-radio
  137. :label="1"
  138. >含全部分组</el-radio>
  139. <el-radio
  140. :label="2"
  141. >含任意分组</el-radio>
  142. </el-radio-group>
  143. </el-form-item>
  144. <el-form-item label="选择的分组" prop="tags">
  145. <el-select v-model="tags" remote multiple placeholder="请选择" filterable style="width: 100%;">
  146. <el-option
  147. v-for="dict in wxUserGroupList"
  148. :label="dict.groupName"
  149. :value="dict.groupId.toString()">
  150. </el-option>
  151. </el-select>
  152. </el-form-item>
  153. </div>
  154. <el-form-item label="开始时间" prop="startTime">
  155. <el-date-picker clearable size="small"
  156. v-model="form.startTime"
  157. type="date"
  158. value-format="yyyy-MM-dd"
  159. placeholder="选择开始时间">
  160. </el-date-picker>
  161. </el-form-item>
  162. <el-form-item v-if="form.sendType==2 || form.sendType==4" label="自动添加SOP" prop="autoSopTime" >
  163. <el-radio-group v-model="form.autoSopTime.autoSopType">
  164. <el-radio
  165. :label="1"
  166. >当天开始</el-radio>
  167. <el-radio
  168. :label="2"
  169. >次日开始</el-radio>
  170. </el-radio-group>
  171. <Tip :title="'这个选项仅作用于【新客户】进线时或【给客户打标签时】,是进入当日的营期 还是 次日的营期'" />
  172. </el-form-item>
  173. <div style="display: flex; align-items: center; flex-wrap: nowrap;">
  174. <div v-if="form.autoSopTime.autoSopType==1" style="display: flex; align-items: center">
  175. <el-form-item
  176. label="起始时间"
  177. prop="autoStartTime"
  178. label-width="100px"
  179. style="margin: 2% 0;align-items: center;">
  180. <el-time-select
  181. style="width: 120px;"
  182. placeholder="起始时间"
  183. v-model="form.autoSopTime.autoStartTime"
  184. :picker-options="{
  185. start: '00:00',
  186. step: '00:15',
  187. end: '24:00'
  188. }">
  189. </el-time-select>
  190. </el-form-item>
  191. <el-form-item
  192. label="结束时间"
  193. prop="autoEndTime"
  194. label-width="100px"
  195. style="margin: 2% 0; align-items: center; ">
  196. <el-time-select
  197. style="width: 120px;"
  198. placeholder="结束时间"
  199. v-model="form.autoSopTime.autoEndTime"
  200. :picker-options="{
  201. start: '00:00',
  202. step: '00:15',
  203. end: '24:00',
  204. minTime: form.autoSopTime.autoEndTime
  205. }">
  206. </el-time-select>
  207. </el-form-item>
  208. <div style="color: #999;font-size: 14px;display: flex;align-items: center;">
  209. <i class="el-icon-info"></i>
  210. 起始时间-结束时间之内的进线客户,进入【当日营期】,时间之外的,进入【次日营期】
  211. </div>
  212. </div>
  213. </div>
  214. <el-form-item label="任务过期时间" prop="expiryTime">
  215. <el-row>
  216. <el-input-number v-model="form.expiryTime" :min="1" :max="100" ></el-input-number>
  217. (小时)
  218. </el-row>
  219. <Tip title="发送sop任务消息的过期时间,超过这个时间,消息将不再发送(作废),比如:9点的消息,设置3个小时过期,12点之后还未发送 则这条消息将过期且不再发送" />
  220. </el-form-item>
  221. <el-form-item label="模板" prop="tempId">
  222. <div @click="selectListSopTemp(form.sendType,0)" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;">
  223. <el-tag type="success" style="margin: 3px;"
  224. :disable-transitions="false"
  225. v-for="list in tempList"
  226. :key="list.id"
  227. v-if="list.id === form.tempId">
  228. {{ form.tempName || list.name }}
  229. </el-tag>
  230. <!-- 如果 form.tempId 没有值,显示 '请选择模板' -->
  231. <span v-if="!form.tempId" style="margin: 3px; color: #999;">请选择模板</span>
  232. </div>
  233. <!-- <el-select v-model="form.tempId" @focus="selectListSopTemp(form.sendType)" placeholder="请选择模板" v-loading="tempListLoading" >-->
  234. <!-- <el-option-->
  235. <!-- v-for="dict in tempList"-->
  236. <!-- :label="dict.name"-->
  237. <!-- :value="dict.id">-->
  238. <!-- </el-option>-->
  239. <!-- <div v-if="tempListLoading" slot="prefix" class="select-prefix">正在查询相应模板...</div>-->
  240. <!-- </el-select>-->
  241. </el-form-item>
  242. <el-form-item label="开启评论/弹幕" prop="openCommentStatus">
  243. <el-radio-group v-model="form.openCommentStatus">
  244. <el-radio :label="1" >开启评论</el-radio>
  245. <el-radio :label="2" >开启弹幕</el-radio>
  246. <el-radio :label="3" >关闭</el-radio>
  247. </el-radio-group>
  248. </el-form-item>
  249. </el-form>
  250. <div slot="footer" class="dialog-footer" style="float: right;" >
  251. <el-button v-if="handleType==1" type="primary" @click="submitForm">确 定</el-button>
  252. <el-button v-if="handleType==1" @click="cancel">取 消</el-button>
  253. </div>
  254. <el-dialog :custom-class="'fixed-dialog'" :title="listUser.title" :visible.sync="listUser.open" width="700px" append-to-body>
  255. <qwUserList ref="QwUserList" @selectUserList="selectUserList"></qwUserList>
  256. </el-dialog>
  257. <el-dialog title="选择模板" :visible.sync="tempOpen" append-to-body >
  258. <sop-temp ref="SopTempComments" @sopTemp="sopTemp" @submitUpdateTemp="submitUpdateTemp"></sop-temp>
  259. </el-dialog>
  260. <!-- 修改模板 -->
  261. <el-dialog :title="updateQwUserDialog.title" :visible.sync="updateQwUserDialog.open" width="500px" append-to-body>
  262. <el-form ref="form" :model="form" label-width="100px">
  263. <el-form-item label="选择员工" prop="qwUserIds" style="margin-top: 2%">
  264. <div>
  265. <el-button
  266. size="medium"
  267. icon="el-icon-circle-plus-outline"
  268. plain
  269. @click="handlelistUser(form.type,form.sendType)">请选择使用员工</el-button>
  270. </div>
  271. <div>
  272. <el-tag
  273. style="margin-left: 5px"
  274. size="medium"
  275. :key="id"
  276. v-for="id in userSelectList"
  277. closable
  278. :disable-transitions="false"
  279. @close="handleClosegroupUser(id)">
  280. <span v-for="list in companyUserList" :key="list.qwUserId" v-if="list.id==id">{{list.qwUserName}}</span>
  281. </el-tag>
  282. </div>
  283. </el-form-item>
  284. </el-form>
  285. <div slot="footer" class="dialog-footer" >
  286. <el-button type="primary" @click="submitUpdateQwUser">确 定</el-button>
  287. <el-button @click="cancel">取 消</el-button>
  288. </div>
  289. </el-dialog>
  290. </div>
  291. </div>
  292. </template>
  293. <script>
  294. import { listSop, getSop, delSop, addSop, updateSop, exportSop,courseList,videoList,updateSopQwUser } from "@/api/qw/sop";
  295. import { listSopTemp, getSopTemp, delSopTemp, addSopTemp, updateSopTemp, exportSopTemp } from "@/api/qw/sopTemp";
  296. import { getQwAllUserList } from '@/api/company/companyUser'
  297. import qwUserList from '@/views/qw/user/qwUserList.vue'
  298. import ImageUpload from "@/views/qw/sop/ImageUpload";
  299. import CustomerGroupDetails from '@/views/qw/groupMsg/customerGroupDetails.vue'
  300. import sopLogsDetails from '@/views/qw/sopLogs/sopLogsList.vue'
  301. import { listTag, getTag, } from "@/api/qw/tag";
  302. import { getMyQwUserList,getMyQwCompanyList } from "@/api/qw/user";
  303. import {sopListWxUserGroup} from "@/api/wxUser/wxUserGroup";
  304. import source from "echarts/src/data/Source";
  305. import SopTemp from "@/views/qw/sopTemp/sopTemp.vue";
  306. import Tip from "../../../components/Tip/index.vue";
  307. // import { ElMessageBox } from 'element-plus';
  308. export default {
  309. name: "updateSop",
  310. components: {Tip, SopTemp, CustomerGroupDetails, qwUserList,ImageUpload,sopLogsDetails},
  311. data() {
  312. return {
  313. updateQwUserDialog:{
  314. title:"修改成员",
  315. open:false
  316. },
  317. updateQwUserForm:{},
  318. handleType:null,
  319. //模板查询
  320. tempListLoading:false,
  321. // 遮罩层
  322. loading: true,
  323. // 导出遮罩层
  324. exportLoading: false,
  325. //模板遮罩
  326. tempOpen:false,
  327. // 选中数组
  328. ids: [],
  329. courseList:[],
  330. // videoList:[],
  331. tags:[],
  332. excludeTags:null,
  333. // 非单个禁用
  334. single: true,
  335. setting:[],
  336. tagList:[],
  337. tempList:[],
  338. // 非多个禁用
  339. multiple: true,
  340. // 显示搜索条件
  341. showSearch: true,
  342. // 总条数
  343. total: 0,
  344. // 企微sop表格数据
  345. sopList: [],
  346. // 弹出层标题
  347. title: "",
  348. // 是否显示弹出层
  349. open: false,
  350. companyUserList:[],
  351. // 状态字典
  352. statusOptions: [],
  353. //企微SOP发送类型
  354. sysQwSopType: [],
  355. //个微客户的分组
  356. wxUserGroupList:[],
  357. sopLogsDialog:{
  358. title:'',
  359. open:false,
  360. sopLogsForm:[],
  361. },
  362. // 表单参数
  363. form: {
  364. status: 1,
  365. sendType:2,
  366. type: 2,
  367. filterType:2,
  368. autoSopTime:{},
  369. },
  370. userSelectList:[],
  371. listUser:{
  372. title:"",
  373. open:false
  374. },
  375. // 表单校验
  376. rules: {
  377. name:[ { required: true, message: "名称不能为空", trigger: "submit" }],
  378. type:[ { required: true, message: "不能为空", trigger: "submit" }],
  379. sendType:[ { required: true, message: "不能为空", trigger: "submit" }],
  380. startTime:[ { required: true, message: "开始时间不能为空", trigger: "submit" }],
  381. tempId:[ { required: true, message: "模板不能为空", trigger: "submit" }],
  382. }
  383. };
  384. },
  385. created() {
  386. this.getDicts("sys_sop_status").then(response => {
  387. this.statusOptions = response.data;
  388. console.log(" this.statusOptions:"+ this.statusOptions)
  389. });
  390. this.getDicts("sys_qw_sop_type").then(response => {
  391. this.sysQwSopType = response.data;
  392. });
  393. const id = this.$route.params && this.$route.params.id;
  394. this.handleType = this.$route.params && this.$route.params.type;
  395. this.handleUpdate(id);
  396. //个微客户的分组
  397. sopListWxUserGroup().then(response => {
  398. this.wxUserGroupList = response.rows;
  399. });
  400. courseList().then(response => {
  401. this.courseList = response.list;
  402. });
  403. },
  404. watch:{
  405. userSelectList(newList) {
  406. this.form.qwUserIds = newList.map(item => item.id);
  407. }
  408. },
  409. methods: {
  410. submitUpdateQwUser(){
  411. this.form.qwUserIds = this.userSelectList.join(",");
  412. const data ={
  413. id:this.form.id,
  414. qwUserIds: this.form.qwUserIds
  415. }
  416. this.$confirm(
  417. '<span style="color: red; margin-bottom: 10px">是否确认修改当前任务员工?</span>' +
  418. '<span style="color: red;">(如有删除员工,对应的【营期也会删除】且【不可恢复】,请谨慎操作)</span>',
  419. "警告",
  420. {
  421. confirmButtonText: "确定",
  422. cancelButtonText: "取消",
  423. type: "warning",
  424. dangerouslyUseHTMLString: true // 允许使用 HTML 字符串
  425. }).then(() => {
  426. this.updateQwUserDialog.open=false;
  427. return updateSopQwUser(data);
  428. }).then(response => {
  429. this.handleUpdate(data.id);
  430. this.msgSuccess("修改员工成功");
  431. this.updateQwUserDialog.open=false;
  432. }).catch(() => {
  433. });
  434. },
  435. handleUpdateTags(){
  436. },
  437. handleUpdateQwUser(){
  438. this.updateQwUserDialog.open = true
  439. },
  440. handleUpdateSopTemp(){
  441. this.selectListSopTemp(this.form.type,1)
  442. },
  443. //刷新部分数据
  444. refreshData(row){
  445. getQwAllUserList(row).then(response => {
  446. this.companyUserList = response.data;
  447. });
  448. listTag({corpId:row}).then(response => {
  449. this.tagList = response.rows;
  450. });
  451. },
  452. //查询模板
  453. selectListSopTemp(type,isUpdate){
  454. this.tempListLoading = true; // 开始查询,显示加载提示
  455. listSopTemp({sendType:type}).then(response => {
  456. this.tempList = response.rows;
  457. this.tempListLoading = false;
  458. });
  459. this.tempOpen = true;
  460. setTimeout(() => {
  461. this.$refs.SopTempComments.getList(type,isUpdate);
  462. }, 200);
  463. },
  464. //确认修改模板
  465. submitUpdateTemp(val){
  466. console.log(val)
  467. const data = {
  468. tempId : val.id,
  469. tempName : val.name,
  470. id : this.form.id
  471. }
  472. this.$confirm('是否确认修改当前任务的模板为"' + data.tempName + '"?', "警告", {
  473. confirmButtonText: "确定",
  474. cancelButtonText: "取消",
  475. type: "warning"
  476. }).then(() => {
  477. this.tempOpen=false;
  478. return updateSop(data);
  479. }).then(response => {
  480. this.handleUpdate(data.id);
  481. this.msgSuccess("修改模板成功");
  482. this.tempOpen=false;
  483. }).catch(() => {
  484. });
  485. },
  486. sopTemp(val){
  487. this.form.tempId=val.id
  488. this.form.tempName=val.name
  489. this.tempOpen=false;
  490. },
  491. handlelistUser(type,sendType){
  492. setTimeout(() => {
  493. this.$refs.QwUserList.getDetails(this.form.corpId,type,sendType);
  494. }, 1);
  495. this.listUser.title="选择企业成员"
  496. this.listUser.open=true;
  497. },
  498. selectUserList(list){
  499. this.listUser.open=false;
  500. list.forEach(obj => {
  501. if (!this.userSelectList.some(item => item == obj.id)) {
  502. this.userSelectList.push(obj.id);
  503. }
  504. });
  505. },
  506. //选择变动时的变动
  507. handleSendTypeChange(val){
  508. this.tempList=[];
  509. this.userSelectList=[];
  510. this.form.tempId=null;
  511. if (val==1) {
  512. // 遍历 this.setting 数组并清空每个对象的 content 属性
  513. this.setting.forEach(item => {
  514. if (item.content.length > 9) {
  515. item.content = item.content.slice(0, 9); // 保留前 9 个元素
  516. }
  517. });
  518. }
  519. },
  520. //删除员工
  521. handleClosegroupUser(id){
  522. // const index = this.userSelectList.findIndex(t => t === list);
  523. console.log(id)
  524. // if (index !== -1) {
  525. // this.userSelectList.splice(index, 1);
  526. // }
  527. // 找到对应的员工信息
  528. const user = this.companyUserList.find((list) => list.id == id);
  529. console.log(user)
  530. if (!user) return;
  531. // 确认删除提醒
  532. this.$confirm('确定要删除员工"'+user.qwUserName+'"吗?', '提示', {
  533. confirmButtonText: '确定',
  534. cancelButtonText: '取消',
  535. type: 'warning',
  536. })
  537. .then(() => {
  538. // 用户点击确定
  539. const index = this.userSelectList.findIndex((t) => t === id);
  540. if (index !== -1) {
  541. this.userSelectList.splice(index, 1);
  542. }
  543. this.$message({
  544. type: 'success',
  545. message: '删除成功',
  546. });
  547. })
  548. .catch(() => {
  549. // 用户点击取消
  550. this.$message({
  551. type: 'info',
  552. message: '已取消删除',
  553. });
  554. });
  555. },
  556. // 取消按钮
  557. cancel() {
  558. this.$store.dispatch("tagsView/delView", this.$route);
  559. this.$router.replace('/qw/conversion/sop')
  560. this.reset();
  561. },
  562. /** 修改按钮操作 */
  563. handleUpdate(row) {
  564. this.reset();
  565. getSop(row).then(response => {
  566. this.form = response.data;
  567. this.form.autoSopTime=JSON.parse(response.data.autoSopTime)
  568. this.open = true;
  569. this.userSelectList = this.form.qwUserIds.split(",");
  570. if (this.form.tags!==''&&this.form.tags!=null){
  571. this.tags = this.form.tags.split(",");
  572. }
  573. this.form.status = response.data.status.toString();
  574. if (this.form.excludeTags!==''&&this.form.excludeTags!=null){
  575. this.excludeTags = this.form.excludeTags.split(",");
  576. }
  577. if (this.form.setting!=null){
  578. this.setting=JSON.parse(this.form.setting);
  579. }
  580. listSopTemp({id:this.form.tempId}).then(response => {
  581. this.tempList = response.rows;
  582. });
  583. this.refreshData(this.form.corpId);
  584. this.title = "修改企微sop";
  585. });
  586. },
  587. // 表单重置
  588. reset() {
  589. this.form = {
  590. id: null,
  591. name: null,
  592. status: 1,
  593. sendType:2,
  594. type: 2,
  595. filterType:2,
  596. qwUserIds: null,
  597. corpId: null,
  598. setting: null,
  599. createBy: null,
  600. createTime: null,
  601. autoSopTime:{},
  602. };
  603. this.resetForm("form");
  604. this.tags=[];
  605. this.excludeTags = null;
  606. },
  607. /** 重置按钮操作 */
  608. resetQuery() {
  609. this.resetForm("queryForm");
  610. this.handleQuery();
  611. },
  612. // 多选框选中数据
  613. handleSelectionChange(selection) {
  614. this.ids = selection.map(item => item.id)
  615. this.single = selection.length!==1
  616. this.multiple = !selection.length
  617. },
  618. /** 新增按钮操作 */
  619. handleAdd() {
  620. this.reset();
  621. this.open = true;
  622. this.setting=[]
  623. this.userSelectList=[]
  624. this.title = "添加企微sop";
  625. },
  626. formatDateTo24HourString(date) {
  627. let year = date.getFullYear();
  628. let month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份需要加 1 并补零
  629. let day = ('0' + date.getDate()).slice(-2); // 日需要补零
  630. let hours = ('0' + date.getHours()).slice(-2); // 小时需要补零
  631. let minutes = ('0' + date.getMinutes()).slice(-2); // 分钟需要补零
  632. let seconds = ('0' + date.getSeconds()).slice(-2); // 秒需要补零
  633. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  634. },
  635. /** 提交按钮 */
  636. submitForm() {
  637. this.$refs["form"].validate(valid => {
  638. if (valid) {
  639. if(this.userSelectList.length<=0){
  640. return this.$message("请选择员工")
  641. }
  642. this.form.qwUserIds = this.userSelectList.join(",");
  643. if (this.tags!=null && this.tags.length>0 ){
  644. this.form.tags=(this.tags).toString()
  645. }else {
  646. return this.$message.error("选择得标签不能为空!!请选择筛选的标签")
  647. }
  648. if (this.excludeTags!=null){
  649. this.form.excludeTags=(this.excludeTags).toString()
  650. }
  651. this.form.setting=JSON.stringify(this.setting)
  652. this.form.autoSopTime.updateTime=this.formatDateTo24HourString(new Date());
  653. this.form.autoSopTime=JSON.stringify(this.form.autoSopTime)
  654. if (this.form.id != null) {
  655. updateSop(this.form).then(response => {
  656. this.msgSuccess("修改成功");
  657. this.$store.dispatch("tagsView/delView", this.$route);
  658. // this.$router.replace('/qw/conversion/sop')
  659. window.location.replace('/qw/conversion/sop')
  660. this.reset();
  661. });
  662. } else {
  663. addSop(this.form).then(response => {
  664. this.msgSuccess("新增成功");
  665. this.$store.dispatch("tagsView/delView", this.$route);
  666. // this.$router.replace('/qw/conversion/sop')
  667. window.location.replace('/qw/conversion/sop')
  668. this.reset();
  669. });
  670. }
  671. }
  672. });
  673. },
  674. }
  675. };
  676. </script>
  677. <style scoped>
  678. .custom-input /deep/ .el-input__inner {
  679. height: 20px;
  680. padding: 0 4px;
  681. text-align:center;
  682. display: block;
  683. }
  684. .custom-input /deep/ .el-input__icon {
  685. line-height: 20px;
  686. }
  687. /* 弹窗固定高度 */
  688. .fixed-dialog {
  689. height: 500px; /* 固定高度 */
  690. }
  691. /* 内容区域滚动 */
  692. .fixed-dialog .el-dialog__body {
  693. height: calc(100% - 110px); /* 减去标题和底部区域的高度 */
  694. overflow-y: auto; /* 垂直滚动 */
  695. }
  696. </style>