allTask.vue 8.0 KB

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