updateTemp.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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规则【修改AI插件】模板</div>
  7. <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==2 "> sop规则【复制AI插件】模板</div>
  8. <div style="margin: 30px;" v-if="this.form.sendType == 2 && formType==3 "> sop规则【查看AI插件】模板</div>
  9. <div style="margin-top: 10px;margin-left: 50px;margin-right: 100px;margin-bottom: 60px;">
  10. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  11. <el-form-item label="名称" prop="name">
  12. <el-input v-model="form.name" placeholder="请输入模板标题" />
  13. </el-form-item>
  14. <el-form-item label="状态">
  15. <el-radio-group v-model="form.status">
  16. <el-radio
  17. v-for="dict in statusOptions"
  18. :key="dict.dictValue"
  19. :label="dict.dictValue"
  20. >{{dict.dictLabel}}</el-radio>
  21. </el-radio-group>
  22. </el-form-item>
  23. <el-form-item label="间隔天数" prop="gap">
  24. <el-input-number v-model="form.gap" :min="1" label="间隔天数"></el-input-number>
  25. </el-form-item>
  26. <el-form-item label="排序" prop="sort">
  27. <el-input-number v-model="form.sort" :min="0" label="排序"></el-input-number>
  28. </el-form-item>
  29. </el-form>
  30. <div slot="footer" class="dialog-footer" style="float: right;" v-if="formType==1 || formType==2 ">
  31. <el-button type="primary" @click="submitForm">确 定</el-button>
  32. <el-button @click="cancel">取 消</el-button>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import { listSopTemp, getSopTemp, delSopTemp, updateTemp, exportSopTemp } from "@/api/qw/sopTemp";
  39. export default {
  40. name: "updateSopTemp",
  41. data() {
  42. return {
  43. uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS2",
  44. uploadUrlByVoice:process.env.VUE_APP_BASE_API+"/common/uploadOSSByHOOKVoice",
  45. //上传语音的遮罩层
  46. voiceLoading :false,
  47. // 遮罩层
  48. loading: true,
  49. // 导出遮罩层
  50. exportLoading: false,
  51. // 选中数组
  52. ids: [],
  53. sysFsSopWatchStatus: [],
  54. //消息内容类型 企微版
  55. sysQwSopContentType:[],
  56. //插件版
  57. sysQwSopAiContentType:[],
  58. //类别
  59. sysQwSopSettingType:[],
  60. courseList:[],
  61. videoList:[],
  62. // 非单个禁用
  63. single: true,
  64. // 非多个禁用
  65. multiple: true,
  66. // 显示搜索条件
  67. showSearch: true,
  68. // 总条数
  69. total: 0,
  70. // sop模板表格数据
  71. setting: [],
  72. // 弹出层标题
  73. title: "",
  74. // 是否显示弹出层
  75. open: false,
  76. // 状态字典
  77. statusOptions: [],
  78. videoNumOptions:{
  79. title:'选择视频号',
  80. open:false,
  81. content:null,
  82. contentIndex:null,
  83. setIndex:null,
  84. },
  85. //1 修改 2 复制 3 查看
  86. formType:null,
  87. // 查询参数
  88. form: {
  89. name: null,
  90. setting: null,
  91. status: "1",
  92. sort: 1,
  93. companyId: null,
  94. gap:1,
  95. },
  96. // 表单校验
  97. rules: {
  98. name: [
  99. { required: true, message: '名称不能为空', trigger: 'blur' }
  100. ],
  101. status: [
  102. { required: true, message: '状态不能为空', trigger: 'blur' }
  103. ],
  104. sort: [
  105. { required: true, message: '排序不能为空', trigger: 'blur' }
  106. ],
  107. gap: [
  108. { required: true, message: '间隔天数不能为空', trigger: 'blur' }
  109. ],
  110. }
  111. };
  112. },
  113. created() {
  114. this.getDicts("sys_company_status").then(response => {
  115. this.statusOptions = response.data;
  116. });
  117. const id = this.$route.params && this.$route.params.id;
  118. this.formType = this.$route.params && this.$route.params.type;
  119. this.handleUpdate(id);
  120. },
  121. methods: {
  122. // 取消按钮
  123. cancel() {
  124. this.$store.dispatch("tagsView/delView", this.$route);
  125. this.$router.replace('/qw/conversion/sopTemp')
  126. // this.reset();
  127. },
  128. // 表单重置
  129. reset() {
  130. this.form = {
  131. id: null,
  132. name: null,
  133. setting: null,
  134. status: "0",
  135. sort: null,
  136. createTime: null,
  137. createBy: null,
  138. companyId: null
  139. };
  140. this.resetForm("form");
  141. },
  142. /** 修改按钮操作 */
  143. handleUpdate(id) {
  144. getSopTemp(id).then(response => {
  145. this.form = response.data;
  146. });
  147. },
  148. /** 提交按钮 */
  149. submitForm() {
  150. this.$refs["form"].validate(valid => {
  151. if (valid) {
  152. if (this.formType == 1) {
  153. if (this.form.id != null) {
  154. updateTemp(this.form).then(response => {
  155. this.msgSuccess("修改成功");
  156. this.$store.dispatch("tagsView/delView", this.$route);
  157. // this.$router.replace('/qw/conversion/sopTemp')
  158. window.location.replace('/qw/conversion/sopTemp')
  159. this.reset();
  160. });
  161. }
  162. } else {
  163. //id制空,防止键值重复-报错
  164. this.form.id = null
  165. //更新时间制空
  166. this.form.updateTime = null
  167. addTemp(this.form).then(response => {
  168. this.msgSuccess("复制成功");
  169. this.$store.dispatch("tagsView/delView", this.$route);
  170. // this.$router.replace('/qw/conversion/sopTemp')
  171. window.location.replace('/qw/conversion/sopTemp')
  172. this.reset();
  173. });
  174. }
  175. }
  176. });
  177. },
  178. }
  179. };
  180. </script>
  181. <style scoped>
  182. .custom-input /deep/ .el-input__inner {
  183. height: 20px;
  184. text-align: center;
  185. }
  186. .custom-input /deep/ .el-input__icon {
  187. line-height: 10px;
  188. }
  189. </style>