allTask.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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="qwUserName">
  5. <el-input
  6. v-model="queryParams.qwUserName"
  7. placeholder="请输入企微昵称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  19. <el-table border v-loading="loading" :data="QwWorkTaskList" @selection-change="handleSelectionChange">
  20. <el-table-column type="selection" width="55" align="center" />
  21. <el-table-column label="企微账号" align="center" prop="qwUserName" />
  22. <el-table-column label="销售昵称" align="center" prop="companyUserName" />
  23. <el-table-column label="待处理" align="center" prop="status0" />
  24. <el-table-column label="已处理" align="center" prop="status1" />
  25. <el-table-column label="待处理完课" align="center" prop="status2" />
  26. <el-table-column label="已处理完课" align="center" prop="status3" />
  27. </el-table>
  28. <pagination
  29. v-show="total>0"
  30. :total="total"
  31. :page.sync="queryParams.pageNum"
  32. :limit.sync="queryParams.pageSize"
  33. @pagination="getList"
  34. />
  35. <!-- 添加或修改企微任务看板对话框 -->
  36. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  37. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  38. <el-form-item label="备注" prop="remark">
  39. <el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :rows="3"/>
  40. </el-form-item>
  41. </el-form>
  42. <div slot="footer" class="dialog-footer">
  43. <el-button type="primary" @click="submitForm">确 定</el-button>
  44. <el-button @click="cancel">取 消</el-button>
  45. </div>
  46. </el-dialog>
  47. </div>
  48. </template>
  49. <script>
  50. import { listQwWorkTask, getQwWorkTask, delQwWorkTask, addQwWorkTask, updateQwWorkTask, exportQwWorkTask,allListQwWorkTask } from "@/api/qw/QwWorkTask";
  51. import {getMyQwUserList, getMyQwCompanyList, handleInputAuthAppKey, updateUser} from "@/api/qw/user";
  52. export default {
  53. name: "QwWorkTask",
  54. data() {
  55. return {
  56. actName:"0",
  57. // 遮罩层
  58. loading: true,
  59. // 导出遮罩层
  60. exportLoading: false,
  61. // 选中数组
  62. ids: [],
  63. myQwUserList:[],
  64. // 非单个禁用
  65. single: true,
  66. // 非多个禁用
  67. multiple: true,
  68. // 显示搜索条件
  69. showSearch: true,
  70. // 总条数
  71. total: 0,
  72. // 企微任务看板表格数据
  73. QwWorkTaskList: [],
  74. // 弹出层标题
  75. title: "",
  76. // 是否显示弹出层
  77. open: false,
  78. // 状态 0 待处理 1 已处理 3 过期字典
  79. statusOptions: [],
  80. // 类别 1先导 2 课程 3 大小转 4 转人工字典
  81. typeOptions: [],
  82. // 查询参数
  83. queryParams: {
  84. pageNum: 1,
  85. pageSize: 10,
  86. extId: null,
  87. status: 0,
  88. type: null,
  89. title: null,
  90. score: null,
  91. sopId: null,
  92. companyId: null,
  93. companyUserId: null,
  94. qwUserId: null,
  95. },
  96. // 表单参数
  97. form: {},
  98. // 表单校验
  99. rules: {
  100. }
  101. };
  102. },
  103. created() {
  104. this.handleGetMyQwUserList();
  105. this.getDicts("sys_qw_work_task_status").then(response => {
  106. this.statusOptions = response.data;
  107. });
  108. this.getDicts("sys_qw_work_task_type").then(response => {
  109. this.typeOptions = response.data;
  110. });
  111. },
  112. methods: {
  113. getScoreStyle(score) {
  114. let backgroundColor = '';
  115. if (score >= 15) {
  116. backgroundColor = '#ff4d4f'; // 红色
  117. } else if (score >= 9) {
  118. backgroundColor = '#ff7d45'; // 橘红
  119. } else if (score >= 4) {
  120. backgroundColor = '#ffec3d'; // 黄色
  121. } else {
  122. backgroundColor = '#ffffff'; // 白色
  123. }
  124. return {
  125. 'background-color': backgroundColor,
  126. 'padding': '5px 10px',
  127. 'border-radius': '4px'
  128. };
  129. },
  130. formatTime(timeStr) {
  131. if (!timeStr && timeStr !== 0) return '';
  132. // 处理数字和字符串输入
  133. const str = String(timeStr).padStart(4, '0');
  134. // 提取有效部分
  135. const hours = str.substring(0, 2);
  136. const minutes = str.substring(2, 4);
  137. // 简单验证
  138. if (hours > 23 || minutes > 59) return '无效时间';
  139. return `${hours}:${minutes}`;
  140. },
  141. /** 查询企微任务看板列表 */
  142. getList() {
  143. this.loading = true;
  144. allListQwWorkTask(this.queryParams).then(response => {
  145. this.QwWorkTaskList = response.rows;
  146. this.total = response.total;
  147. this.loading = false;
  148. });
  149. },
  150. handleClickX(tab, event) {
  151. this.queryParams.status=tab.name;
  152. this.handleQuery();
  153. },
  154. // 取消按钮
  155. cancel() {
  156. this.open = false;
  157. this.reset();
  158. },
  159. // 表单重置
  160. reset() {
  161. this.form = {
  162. id: null,
  163. extId: null,
  164. qwUserId: null,
  165. status: 0,
  166. type: null,
  167. title: null,
  168. remark: null,
  169. score: null,
  170. sopId: null,
  171. companyId: null,
  172. companyUserId: null,
  173. createTime: null,
  174. updateTime: null
  175. };
  176. this.resetForm("form");
  177. },
  178. /** 搜索按钮操作 */
  179. handleQuery() {
  180. this.queryParams.pageNum = 1;
  181. this.getList();
  182. },
  183. handleGetMyQwUserList(){
  184. this.getList();
  185. },
  186. /** 重置按钮操作 */
  187. resetQuery() {
  188. this.resetForm("queryForm");
  189. this.handleQuery();
  190. },
  191. // 多选框选中数据
  192. handleSelectionChange(selection) {
  193. this.ids = selection.map(item => item.id)
  194. this.single = selection.length!==1
  195. this.multiple = !selection.length
  196. },
  197. /** 新增按钮操作 */
  198. handleAdd() {
  199. this.reset();
  200. this.open = true;
  201. this.title = "添加企微任务看板";
  202. },
  203. /** 修改按钮操作 */
  204. handleUpdate(row) {
  205. this.reset();
  206. const id = row.id || this.ids
  207. this.form = row;
  208. this.open = true;
  209. this.title = "处理任务";
  210. },
  211. /** 提交按钮 */
  212. submitForm() {
  213. this.$refs["form"].validate(valid => {
  214. if (valid) {
  215. if (this.form.id != null) {
  216. updateQwWorkTask(this.form).then(response => {
  217. this.msgSuccess("修改成功");
  218. this.open = false;
  219. this.getList();
  220. });
  221. } else {
  222. addQwWorkTask(this.form).then(response => {
  223. this.msgSuccess("新增成功");
  224. this.open = false;
  225. this.getList();
  226. });
  227. }
  228. }
  229. });
  230. },
  231. /** 删除按钮操作 */
  232. handleDelete(row) {
  233. const ids = row.id || this.ids;
  234. this.$confirm('是否确认删除企微任务看板编号为"' + ids + '"的数据项?', "警告", {
  235. confirmButtonText: "确定",
  236. cancelButtonText: "取消",
  237. type: "warning"
  238. }).then(function() {
  239. return delQwWorkTask(ids);
  240. }).then(() => {
  241. this.getList();
  242. this.msgSuccess("删除成功");
  243. }).catch(() => {});
  244. },
  245. /** 导出按钮操作 */
  246. handleExport() {
  247. const queryParams = this.queryParams;
  248. this.$confirm('是否确认导出所有企微任务看板数据项?', "警告", {
  249. confirmButtonText: "确定",
  250. cancelButtonText: "取消",
  251. type: "warning"
  252. }).then(() => {
  253. this.exportLoading = true;
  254. return exportQwWorkTask(queryParams);
  255. }).then(response => {
  256. this.download(response.msg);
  257. this.exportLoading = false;
  258. }).catch(() => {});
  259. }
  260. }
  261. };
  262. </script>