index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="page-container list-container">
  3. <div>
  4. <span
  5. style="
  6. display: inline-block;
  7. height: 20px;
  8. line-height: 18px;
  9. font-size: 15px;
  10. padding: 10px 20px 0 8px;
  11. margin-top: 5px;
  12. font-weight: 700;
  13. border-left: 3px;
  14. "
  15. >待完成任务</span
  16. >
  17. <el-button
  18. type="success"
  19. icon="link"
  20. :disabled="multiple"
  21. size="small"
  22. @click="handleTyransfer"
  23. v-hasPermi="['business:workOrder:tyransfer']"
  24. >转交</el-button
  25. >
  26. </div>
  27. <!-- v-hasPermi="['business:workOrder:transfer']" -->
  28. <!-- 搜索区 -->
  29. <el-form
  30. class="list-search-container"
  31. size="small"
  32. :model="queryParams"
  33. ref="queryRef"
  34. :inline="true"
  35. label-width="68px"
  36. @selection-change="handleSelectionChange"
  37. >
  38. <el-form-item label="客户名称:" prop="companyName">
  39. <el-input
  40. style="width: 150px"
  41. v-model="queryParams.companyName"
  42. placeholder="请输入客户名称"
  43. clearable
  44. @keyup.enter="handleQuery"
  45. />
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button type="primary" icon="Search" @click="handleQuery"
  49. >搜索</el-button
  50. >
  51. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <!-- 列表区 -->
  55. <el-table
  56. v-loading="loading"
  57. :data="orderList"
  58. size="small"
  59. border
  60. height="100%"
  61. @selection-change="handleSelectionChange"
  62. >
  63. <el-table-column type="selection" width="55" align="center" />
  64. <el-table-column
  65. label="客户名称"
  66. align="center"
  67. prop="companyName"
  68. width="250"
  69. />
  70. <el-table-column label="类型" align="center" width="150">
  71. <template #default="scope">
  72. {{ scope.row.type === 1 ? "循环工单" : "代办工单" }}
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="项目" align="center" prop="taskTypeName">
  76. </el-table-column>
  77. </el-table>
  78. <!-- 分页 -->
  79. <pagination
  80. v-show="total > 0"
  81. :total="total"
  82. v-model:page="queryParams.pageNum"
  83. v-model:limit="queryParams.pageSize"
  84. @pagination="getList"
  85. />
  86. <el-dialog
  87. title="转交执行人"
  88. v-model="formOpen"
  89. width="500px"
  90. append-to-body
  91. draggable
  92. @close="cancel"
  93. >
  94. <el-form ref="dictRef" :model="form" :rules="rules" label-width="100">
  95. <el-form-item label="转交执行人:" :prop="content">
  96. <el-autocomplete
  97. :fetch-suggestions="querySearchAsync"
  98. :trigger-on-focus="true"
  99. v-model="selectionName"
  100. placeholder="输入执行人"
  101. popper-class="my-autocomplete"
  102. @select="handleSelectEmployee"
  103. >
  104. <template #default="{ item }">
  105. <div
  106. style="
  107. display: flex;
  108. flex-direction: row;
  109. justify-content: space-between;
  110. "
  111. >
  112. <div class="name" style="font-size: 12px">
  113. {{ item.nickName }}
  114. </div>
  115. <span class="code" style="font-size: 10px; color: darkgrey">{{
  116. item.userName
  117. }}</span>
  118. </div>
  119. </template>
  120. </el-autocomplete>
  121. </el-form-item>
  122. </el-form>
  123. <template #footer>
  124. <div class="dialog-footer">
  125. <el-button
  126. type="primary"
  127. icon="Finished"
  128. size="small"
  129. @click="submitForm"
  130. >确 定</el-button
  131. >
  132. <el-button icon="close" size="small" @click="formOpen = false"
  133. >取 消</el-button
  134. >
  135. </div>
  136. </template>
  137. </el-dialog>
  138. </div>
  139. </template>
  140. <script setup name="index">
  141. import { indexList } from "@/api/business/crm/workOrder";
  142. import { setWorkOrderService } from "@/api/business/crm/workOrder";
  143. import { listUser } from "@/api/system/user";
  144. const { proxy } = getCurrentInstance();
  145. /** 字典数组区 */
  146. /** 查询对象 */
  147. const loading = ref(true);
  148. const orderList = ref([]);
  149. const multiple = ref(true);
  150. const selectionName = ref("");
  151. const formOpen = ref(false);
  152. const selectionUser = ref(null);
  153. const prev = ref([]);
  154. const ids = ref([]);
  155. const total = ref(0);
  156. /** 查询对象 */
  157. const queryParams = ref({
  158. pageNum: 1,
  159. pageSize: 20,
  160. companyName: "",
  161. orderByColumn: "create_time",
  162. });
  163. const editStatus = {
  164. startMonth: false,
  165. };
  166. /*********************** 方法区 ****************************/
  167. /** 查询company列表 */
  168. function getList() {
  169. loading.value = true;
  170. formOpen.value = false;
  171. indexList(queryParams.value).then((response) => {
  172. orderList.value = response.rows.map((l) => ({
  173. ...l,
  174. editStatus: proxy.deepClone(editStatus),
  175. }));
  176. total.value = response.total;
  177. loading.value = false;
  178. });
  179. }
  180. /** 搜索按钮操作 */
  181. function handleQuery() {
  182. queryParams.value.pageNum = 1;
  183. getList();
  184. }
  185. /** 重置按钮操作 */
  186. function resetQuery() {
  187. proxy.resetForm("queryRef");
  188. handleQuery();
  189. }
  190. // 多选框选中数据
  191. function handleSelectionChange(selection) {
  192. ids.value = selection.map((item) => item.id);
  193. multiple.value = !selection.length;
  194. }
  195. // 转交按钮操作
  196. function handleTyransfer() {
  197. formOpen.value = true;
  198. }
  199. //转交弹框确定按钮操作
  200. function submitForm() {
  201. if (selectionUser.value == null || selectionUser.value.userId == null) {
  202. proxy.$modal.msgError("请选择用户!");
  203. return;
  204. }
  205. setWorkOrderService({
  206. ids: ids.value,
  207. serviceId: selectionUser.value.userId,
  208. }).then((response) => {
  209. proxy.$modal.msgSuccess("设置完成!");
  210. formOpen.value = false;
  211. getList();
  212. });
  213. }
  214. /** 输入框输出建议 */
  215. const querySearchAsync = (queryString, cb) => {
  216. const query = { keyword: queryString };
  217. listUser(query).then((res) => {
  218. cb(res.rows);
  219. });
  220. };
  221. //转交搜索框输入
  222. function handleSelectEmployee(item) {
  223. selectionName.value = item.nickName;
  224. selectionUser.value = item;
  225. }
  226. getList();
  227. </script>