sop.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <!-- <el-form-item label="销售公司" prop="companyId">-->
  5. <!-- <el-select filterable v-model="queryParams.companyId" clearable placeholder="请选择公司名" size="small">-->
  6. <!-- <el-option-->
  7. <!-- v-for="item in companys"-->
  8. <!-- :key="item.companyId"-->
  9. <!-- :label="item.companyName"-->
  10. <!-- :value="item.companyId"-->
  11. <!-- />-->
  12. <!-- </el-select>-->
  13. <!-- </el-form-item>-->
  14. <el-form-item label="公司名" prop="companyId">
  15. <select-tree
  16. v-model="selectedCompanyList"
  17. :raw-data="deptList"
  18. placeholder="请选择销售"
  19. :parentSelectable="true"
  20. :multiple="true"
  21. component-width="300px"
  22. :max-display-tags="3"
  23. :check-strictly="false"
  24. :return-leaf-only="false"
  25. ></select-tree>
  26. </el-form-item>
  27. <el-form-item label="规则编号" prop="id">
  28. <el-input
  29. v-model="queryParams.id"
  30. placeholder="请输入规则名称"
  31. clearable
  32. size="small"
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="类型 " prop="type">
  37. <el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small" >
  38. <el-option
  39. :key="1"
  40. :label="'个微'"
  41. :value="1"
  42. />
  43. <el-option
  44. :key="2"
  45. :label="'企微'"
  46. :value="2"
  47. />
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="规则状态 " prop="status">
  51. <el-select v-model="queryParams.status" placeholder="请选择规则状态" clearable size="small" >
  52. <el-option
  53. v-for="dict in sysSopStatus"
  54. :key="dict.dictValue"
  55. :label="dict.dictLabel"
  56. :value="dict.dictValue"
  57. />
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="名称" prop="name">
  61. <el-input
  62. v-model="queryParams.name"
  63. placeholder="请输入规则名称"
  64. clearable
  65. size="small"
  66. @keyup.enter.native="handleQuery"
  67. />
  68. </el-form-item>
  69. <el-form-item label="创建时间" prop="createTime">
  70. <el-date-picker clearable size="small"
  71. v-model="queryParams.createTime"
  72. type="date"
  73. value-format="yyyy-MM-dd"
  74. placeholder="选择创建时间">
  75. </el-date-picker>
  76. </el-form-item>
  77. <el-form-item>
  78. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  79. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  80. </el-form-item>
  81. </el-form>
  82. <el-row :gutter="10" class="mb8">
  83. <el-col :span="1.5">
  84. <el-button
  85. type="success"
  86. plain
  87. icon="el-icon-download"
  88. size="mini"
  89. :loading="exportLoading"
  90. @click="handleExport"
  91. >导出</el-button>
  92. </el-col>
  93. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  94. </el-row>
  95. <el-table v-loading="loading" border :data="sopList" @selection-change="handleSelectionChange">
  96. <el-table-column type="selection" width="55" align="center" />
  97. <el-table-column label="规则编号" align="center" prop="id" />
  98. <el-table-column label="规则名称" align="center" prop="name" />
  99. <el-table-column label="规则状态" align="center" prop="status" width="150">
  100. <template slot-scope="scope">
  101. <dict-tag :options="sysSopStatus" :value="scope.row.status"></dict-tag>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="类别" align="center" prop="type">
  105. <template slot-scope="scope">
  106. <el-tag type="success" v-if="scope.row.type==1">个微</el-tag>
  107. <el-tag type="primary" v-else-if="scope.row.type==2">企微</el-tag>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="发送方式" align="center" prop="sendType">
  111. <template slot-scope="scope">
  112. <dict-tag :options="sysQwSopType" :value="scope.row.sendType"/>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="模板" align="center" prop="tempId" />
  116. <el-table-column label="新客户自动创建sop" align="center" prop="isAutoSop" width="140">
  117. <template slot-scope="scope">
  118. <span v-if="scope.row.sendType!=1 && scope.row.isAutoSop == '1'" style="margin-left: 10px;color: #13ce66">已开启</span>
  119. <span v-if="scope.row.sendType!=1 && scope.row.isAutoSop == '2'" style="margin-left: 10px;color: #ff4949">已关闭</span>
  120. <span v-if="scope.row.sendType==1" style="margin-left: 10px;color: rgb(250,114,3)">企微接口无法设置</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="过期时间" align="center" prop="expiryTime" >
  124. <template slot-scope="scope">
  125. {{scope.row.expiryTime}} 小时
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="创建人" align="center" prop="createBy" />
  129. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  130. <el-table-column label="修改规则状态时间" align="center" prop="stopTime" width="180"/>
  131. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px" fixed="right">
  132. <template slot-scope="scope">
  133. <el-button
  134. v-if="scope.row.status==2||scope.row.status==0 || scope.row.status == 3 || scope.row.status == 4 "
  135. size="mini"
  136. type="text"
  137. icon="el-icon-edit"
  138. @click="selectSchedule(scope.row)"
  139. >查看营期</el-button>
  140. <el-button
  141. v-if="scope.row.status==2 || scope.row.status==0 || scope.row.status == 3 || scope.row.status == 4 "
  142. size="mini"
  143. type="text"
  144. icon="el-icon-edit"
  145. @click="handleScheduleDetail(scope.row)"
  146. >执行详情</el-button>
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. <pagination
  151. v-show="total>0"
  152. :total="total"
  153. :page.sync="queryParams.pageNum"
  154. :limit.sync="queryParams.pageSize"
  155. @pagination="getList"
  156. />
  157. <!-- 执行详情 -->
  158. <el-drawer :title="sopLogsDialog.title" :visible.sync="sopLogsDialog.open" size="70%" style="font-weight: bolder">
  159. <sopLogsDetails ref="sopLogsDetails" :rowDetailFrom="sopLogsDialog.sopLogsForm"></sopLogsDetails>
  160. </el-drawer>
  161. </div>
  162. </template>
  163. <script>
  164. import { listSop, exportSop, } from "@/api/qw/sop";
  165. import sopLogsDetails from '@/views/qw/sopLogs/sopLogsList.vue'
  166. import { getCompanyList } from '@/api/company/company'
  167. import SelectTree from '@/components/TreeSelect/index.vue'
  168. import { getDeptData } from '@/api/system/employeeStats'
  169. export default {
  170. name: "Sop",
  171. components: { SelectTree, sopLogsDetails},
  172. data() {
  173. return {
  174. selectedCompanyList: [],
  175. deptList: [],
  176. //模板查询
  177. tempListLoading:false,
  178. // 遮罩层
  179. loading: false,
  180. // 导出遮罩层
  181. exportLoading: false,
  182. // 选中数组
  183. ids: [],
  184. //选中的map
  185. selectionMap:{},
  186. myQwCompanyList:[],
  187. //销售员工列表
  188. companyUserLists:[],
  189. companys: [],
  190. courseList:[],
  191. // videoList:[],
  192. tags:null,
  193. excludeTags:null,
  194. // 非单个禁用
  195. single: true,
  196. setting:[],
  197. tagList:[],
  198. tempList:[],
  199. // 非多个禁用
  200. multiple: true,
  201. // 显示搜索条件
  202. showSearch: true,
  203. // 总条数
  204. total: 0,
  205. // 企微sop表格数据
  206. sopList: [],
  207. // 弹出层标题
  208. title: "",
  209. // 是否显示弹出层
  210. open: false,
  211. companyUserList:[],
  212. // 状态字典
  213. statusOptions: [],
  214. //sop状态
  215. sysSopStatus: [],
  216. autoSopOpen:{
  217. title:'',
  218. open:false,
  219. id:null,
  220. isAutoSop:null,
  221. },
  222. outTimeOpen:{
  223. title:'',
  224. open:false,
  225. id:null,
  226. expiryTime:null,
  227. },
  228. //企微SOP发送类型
  229. sysQwSopType: [],
  230. //SOP课程观看状态
  231. sysFsSopWatchStatus:[],
  232. // 查询参数
  233. queryParams: {
  234. pageNum: 1,
  235. pageSize: 10,
  236. id: null,
  237. name: null,
  238. status: null,
  239. sendType:null,
  240. type: null,
  241. qwUserIds: null,
  242. setting: null,
  243. createBy: null,
  244. corpId: null,
  245. createTime: null,
  246. companyId: null
  247. },
  248. sopLogsDialog:{
  249. title:'',
  250. open:false,
  251. sopLogsForm:[],
  252. },
  253. // 表单参数
  254. form: {
  255. autoSopTime:{ autoSopType:2,autoStartTime:'00:00',autoEndTime:'24:00',autoSopSend:2},
  256. },
  257. userSelectList:[],
  258. listUser:{
  259. title:"",
  260. open:false
  261. },
  262. // 表单校验
  263. rules: {
  264. name:[ { required: true, message: "名称不能为空", trigger: "submit" }],
  265. type:[ { required: true, message: "不能为空", trigger: "submit" }],
  266. sendType:[ { required: true, message: "不能为空", trigger: "submit" }],
  267. startTime:[ { required: true, message: "开始时间不能为空", trigger: "submit" }],
  268. tempId:[ { required: true, message: "模板不能为空", trigger: "submit" }],
  269. },
  270. autoSopTimeRules:{
  271. autoSopType:[ { required: true, message: "选项不能为空", trigger: "submit" }],
  272. autoStartTime:[ { required: true, message: "起始时间不能为空", trigger: "submit" }],
  273. autoEndTime:[ { required: true, message: "结束时间不能为空", trigger: "submit" }],
  274. }
  275. };
  276. },
  277. created() {
  278. this.getDicts("sys_sop_status").then(response => {
  279. this.sysSopStatus = response.data;
  280. });
  281. this.getDicts("sys_company_status").then(response => {
  282. this.statusOptions = response.data;
  283. });
  284. this.getDicts("sys_qw_sop_type").then(response => {
  285. this.sysQwSopType = response.data;
  286. });
  287. getCompanyList().then(response => {
  288. this.companys = response.data;
  289. });
  290. getDeptData().then(response => {
  291. this.deptList = response.data;
  292. })
  293. this.getList();
  294. },
  295. methods: {
  296. /** 查询企微sop列表 */
  297. getList() {
  298. this.loading = true;
  299. if(this.selectedCompanyList != null && this.selectedCompanyList.length > 0) {
  300. this.queryParams.userIds = this.selectedCompanyList;
  301. }else {
  302. this.queryParams.userIds = [];
  303. }
  304. listSop(this.queryParams).then(response => {
  305. this.sopList = response.rows;
  306. this.total = response.total;
  307. this.loading = false;
  308. });
  309. },
  310. // 取消按钮
  311. cancel() {
  312. this.open = false;
  313. this.reset();
  314. },
  315. // 表单重置
  316. reset() {
  317. this.form = {
  318. id: null,
  319. name: null,
  320. status: 1,
  321. sendType:2,
  322. type: 2,
  323. filterType:2,
  324. qwUserIds: null,
  325. corpId: null,
  326. setting: null,
  327. createBy: null,
  328. createTime: null,
  329. isAutoSop:null,
  330. autoSopTime:{ autoSopType:2,autoStartTime:'00:00',autoEndTime:'24:00',autoSopSend:2},
  331. };
  332. this.resetForm("form");
  333. this.tags = null;
  334. this.excludeTags = null;
  335. },
  336. /** 搜索按钮操作 */
  337. handleQuery() {
  338. this.queryParams.pageNum = 1;
  339. this.getList();
  340. },
  341. /** 重置按钮操作 */
  342. resetQuery() {
  343. this.resetForm("queryForm");
  344. this.selectedCompanyList=[];
  345. this.handleQuery();
  346. },
  347. // 多选框选中数据
  348. handleSelectionChange(selection) {
  349. this.ids = selection.map(item => item.id)
  350. this.selectionMap=selection;
  351. this.single = selection.length!==1
  352. this.multiple = !selection.length
  353. },
  354. /**
  355. * 查看SOP任务内营期
  356. */
  357. selectSchedule(row){
  358. const data ={
  359. id : row.id,
  360. name :row.name,
  361. tempId :row.tempId
  362. }
  363. // 使用 params 传递参数
  364. this.$router.push({
  365. path: `/qw/sopUserLogs/sopUserLogsSchedule/${data.id}`,
  366. query: { name: data.name,
  367. tempId: data.tempId, } // 如果需要传递更多参数,可以使用 query
  368. });
  369. },
  370. /**
  371. * 查看营期内详情
  372. */
  373. handleScheduleDetail(row){
  374. this.sopLogsDialog.title='规则执行详情';
  375. this.sopLogsDialog.open=true;
  376. this.sopLogsDialog.sopLogsForm=row;
  377. },
  378. /** 导出按钮操作 */
  379. handleExport() {
  380. const queryParams = this.queryParams;
  381. this.$confirm('是否确认导出所有企微sop数据项?', "警告", {
  382. confirmButtonText: "确定",
  383. cancelButtonText: "取消",
  384. type: "warning"
  385. }).then(() => {
  386. this.exportLoading = true;
  387. return exportSop(queryParams);
  388. }).then(response => {
  389. this.download(response.msg);
  390. this.exportLoading = false;
  391. }).catch(() => {});
  392. }
  393. }
  394. };
  395. </script>
  396. <style scoped>
  397. .custom-input /deep/ .el-input__inner {
  398. height: 20px;
  399. padding: 0 4px;
  400. text-align:center;
  401. display: block;
  402. }
  403. .custom-input /deep/ .el-input__icon {
  404. line-height: 20px;
  405. }
  406. </style>