index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. <script lang="ts" setup>
  2. import Selector from '/src/views/reportManage/dataCenter/normalDisplay/components/Selector/index.vue';
  3. import { onMounted, reactive, ref } from 'vue';
  4. import { VxeGridInstance, VxeGridListeners, VxeGridProps, VXETable } from 'vxe-table';
  5. import {
  6. exportTaskData,
  7. getCurrencyCodeSelect,
  8. getOperationSelect,
  9. getTasks,
  10. postCreateTask,
  11. postDeleteTask,
  12. postSendMessage,
  13. postUpdateTask,
  14. postUpdateTaskStatus
  15. } from '/src/views/reportManage/TaskManage/api.ts';
  16. import { ComponentSize, ElMessage, FormInstance, FormRules } from 'element-plus';
  17. import { Delete, Plus } from '@element-plus/icons-vue';
  18. import { dateType } from '/@/views/reportManage/TaskManage/utils/enum';
  19. const selectorRef = ref(null);
  20. const message = ref('');
  21. //表单
  22. interface taskRuleForm {
  23. number: string;
  24. name: string;
  25. country: string;
  26. brand: string;
  27. operation: string[];
  28. operater: string[];
  29. currency: string;
  30. currencyCodePlatform: string;
  31. line: string;
  32. ipaddress: string;
  33. company: string;
  34. platform: string;
  35. }
  36. const formSize = ref<ComponentSize>('default');
  37. const dialogFormVisible = ref(false);
  38. const taskRuleFormRef = ref<FormInstance>();
  39. const taskRuleForm = reactive({
  40. number: '',
  41. name: '',
  42. country: '',
  43. brand: '',
  44. operation: [],
  45. operater: [],
  46. currency: '',
  47. currencyCodePlatform: '',
  48. });
  49. const resetForm = (formEl: FormInstance | undefined) => {
  50. if (!formEl) return;
  51. formEl.resetFields();
  52. };
  53. const rules = reactive<FormRules>({
  54. number: [{ required: true, message: '请输入平台编号', trigger: 'blur' },],
  55. name: [{ required: true, message: '请输入平台名称', trigger: 'blur' }],
  56. country: [{ required: true, message: '请输入国家', trigger: 'blur' }],
  57. brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
  58. operation: [{ required: true, message: '请选择填写人', trigger: 'change' }],
  59. operater: [{ required: true, message: '请输入运营', trigger: 'change' }],
  60. currency: [{ required: true, message: '请输入回款/余额币种', trigger: 'blur' }],
  61. currencyCodePlatform: [{ required: true, message: '请输入平台货币', trigger: 'blur' }],
  62. line: [{ required: true, message: '请输入线路', trigger: 'blur' }],
  63. ipaddress: [{ required: true, message: '请输入IP地址', trigger: 'blur' }],
  64. company: [{ required: true, message: '请输入注册公司', trigger: 'blur' }],
  65. platform: [{ required: true, message: '请输入平台', trigger: 'blur' }],
  66. });
  67. const currencyList = ref([]);
  68. //表格
  69. interface RowVO {
  70. platformNumber: string;
  71. platformName: string;
  72. country: string;
  73. brandName: string;
  74. user_name: string;
  75. operater: string;
  76. currencyCode: string;
  77. currencyCodePlatform: string;
  78. child_user_number: number;
  79. user: [];
  80. line: string;
  81. ipaddress: string;
  82. company: string;
  83. platform: string;
  84. }
  85. const xGrid = ref<VxeGridInstance<RowVO>>();
  86. const originalDataMap = new Map();
  87. let allTasks = []; // 用于存储所有任务数据
  88. const gridOptions = reactive<VxeGridProps<RowVO>>({
  89. border: 'inner',
  90. keepSource: true,
  91. //showOverflow: true,
  92. height: 900,
  93. loading: false,
  94. round: true,
  95. toolbarConfig: {
  96. zoom: {
  97. iconIn: 'vxe-icon-fullscreen',
  98. iconOut: 'vxe-icon-minimize'
  99. },
  100. slots: {
  101. buttons: 'toolbar_buttons',
  102. tools: 'toolbar_tools'
  103. }
  104. },
  105. rowConfig: {
  106. isHover: true,
  107. },
  108. columnConfig: {
  109. resizable: true,
  110. },
  111. pagerConfig: {
  112. enabled: true,
  113. total: 20,
  114. currentPage: 1,
  115. pageSize: 20,
  116. pageSizes: [10, 20, 30],
  117. },
  118. editConfig: {
  119. trigger: 'manual',
  120. mode: 'row',
  121. showStatus: true,
  122. autoClear: false,
  123. },
  124. checkboxConfig: {
  125. reserve: true,
  126. highlight: true,
  127. range: true,
  128. },
  129. columns: [
  130. { type: 'checkbox', width: 50 },
  131. {
  132. field: 'platformNumber',
  133. title: '平台编号',
  134. editRender: { autofocus: '.vxe-input--inner' },
  135. slots: { edit: 'number_edit' },
  136. minWidth: 97
  137. },
  138. {
  139. field: 'platformName',
  140. title: '平台名称',
  141. editRender: { autofocus: '.vxe-input--inner' },
  142. slots: { edit: 'name_edit' },
  143. align: 'center',
  144. minWidth: 150
  145. },
  146. {
  147. field: 'country',
  148. title: '国家',
  149. editRender: { autofocus: '.vxe-input--inner' },
  150. slots: { edit: 'country_edit' },
  151. minWidth: 89,
  152. align: 'center'
  153. },
  154. {
  155. field: 'brandName',
  156. title: '品牌',
  157. editRender: {},
  158. slots: { edit: 'brand_edit' },
  159. align: 'center',
  160. minWidth: 89,
  161. },
  162. {
  163. field: 'user_name',
  164. title: '填写人',
  165. editRender: {},
  166. slots: { edit: 'operation_edit' },
  167. align: 'center',
  168. minWidth: 104
  169. },
  170. {
  171. field: 'operater',
  172. title: '运营',
  173. editRender: {},
  174. slots: { edit: 'operater_name_edit' },
  175. align: 'center',
  176. minWidth: 104
  177. },
  178. {
  179. field: 'currencyCode',
  180. title: '平台币种',
  181. editRender: {},
  182. slots: { edit: 'currency_edit' },
  183. align: 'center',
  184. minWidth: 89
  185. },
  186. {
  187. field: 'currencyCodePlatform',
  188. title: '回款/余额币种',
  189. editRender: {},
  190. slots: { edit: 'currencyCodePlatform_edit' },
  191. minWidth: 130,
  192. align: 'center'
  193. },
  194. { field: 'line', title: '线路', editRender: {}, slots: { edit: 'line_edit' }, align: 'center', minWidth: 89 },
  195. { field: 'ipaddress', title: 'IP地址', editRender: {}, slots: { edit: 'ipaddress_edit' }, minWidth: 138 },
  196. {
  197. field: 'company',
  198. title: '注册公司',
  199. editRender: {},
  200. slots: { edit: 'company_edit' },
  201. align: 'center',
  202. minWidth: 89
  203. },
  204. {
  205. field: 'platform',
  206. title: '平台',
  207. editRender: {},
  208. slots: { edit: 'platform_edit' },
  209. align: 'center',
  210. minWidth: 89
  211. },
  212. { field: 'status', title: '状态', slots: { default: 'status_default' }, align: 'center', minWidth: 89 },
  213. { title: '操作', width: 120, slots: { default: 'operate' } },
  214. ],
  215. data: [],
  216. });
  217. const operationList = ref([]);
  218. const gridEvents: VxeGridListeners<RowVO> = {
  219. pageChange({ currentPage, pageSize }) {
  220. if (gridOptions.pagerConfig) {
  221. gridOptions.pagerConfig.currentPage = currentPage;
  222. gridOptions.pagerConfig.pageSize = pageSize;
  223. getTaskList();
  224. }
  225. },
  226. };
  227. async function getTaskList(filters = {}) {
  228. try {
  229. gridOptions.loading = true;
  230. const response = await getTasks({
  231. page: gridOptions.pagerConfig.currentPage,
  232. limit: gridOptions.pagerConfig.pageSize,
  233. ...filters,
  234. });
  235. gridOptions.data = response.data;
  236. gridOptions.pagerConfig.total = response.total;
  237. } catch (error) {
  238. console.error('Error fetching task data:', error);
  239. } finally {
  240. gridOptions.loading = false;
  241. }
  242. }
  243. function filteredDataChange(newList) {
  244. if (selectorRef.value) {
  245. // 重置页码到第一页
  246. if (gridOptions.pagerConfig) {
  247. gridOptions.pagerConfig.currentPage = 1;
  248. }
  249. getTaskList(newList.value);
  250. }
  251. }
  252. const hasActiveEditRow = (row: RowVO) => {
  253. const $grid = xGrid.value;
  254. if ($grid) {
  255. return $grid.isEditByRow(row);
  256. }
  257. return false;
  258. };
  259. const editRowEvent = (row: RowVO) => {
  260. const $grid = xGrid.value;
  261. if ($grid) {
  262. // 在进入编辑状态前保存原始数据
  263. originalDataMap.set(row.id, { ...row });
  264. // 初始化 row.user 确保其与 row.user_name 同步
  265. if (!row.user || row.user.length === 0) {
  266. row.user = operationList.value
  267. .filter(op => row.user_name.includes(op.label))
  268. .map(op => op.value);
  269. }
  270. $grid.setEditRow(row);
  271. }
  272. };
  273. const clearRowEvent = (row: RowVO) => {
  274. const $grid = xGrid.value;
  275. if ($grid) {
  276. const originalData = originalDataMap.get(row.id);
  277. if (originalData) {
  278. // 恢复原始数据
  279. Object.assign(row, originalData);
  280. originalDataMap.delete(row.id);
  281. }
  282. $grid.clearEdit();
  283. }
  284. };
  285. async function deleteTask() {
  286. const $grid = xGrid.value;
  287. if ($grid) {
  288. const selectRecords = $grid.getCheckboxRecords();
  289. const selectedIds = selectRecords.map(record => record.id);
  290. // console.log(selectedIds);
  291. const obj = { keys: selectedIds };
  292. try {
  293. const resp = await postDeleteTask(obj);
  294. if (resp.code === 2000) {
  295. ElMessage({
  296. message: '删除成功',
  297. type: 'success',
  298. });
  299. await getTaskList();
  300. }
  301. } catch (e) {
  302. ElMessage({
  303. message: '删除失败',
  304. type: 'error',
  305. });
  306. }
  307. }
  308. }
  309. const isDeleteDisabled = computed(() => {
  310. const $grid = xGrid.value;
  311. return !$grid || $grid.getCheckboxRecords().length === 0;
  312. });
  313. const removeEvent = async () => {
  314. const $grid = xGrid.value;
  315. if ($grid) {
  316. const selectRecords = $grid.getCheckboxRecords();
  317. if (selectRecords.length > 0) {
  318. const type = await VXETable.modal.confirm('您确定要删除选中的数据?');
  319. if (type === 'confirm') {
  320. await deleteTask(selectRecords);
  321. await $grid.removeCheckboxRow();
  322. }
  323. } else {
  324. await VXETable.modal.message({ content: '请选择要删除的数据', status: 'error' });
  325. }
  326. }
  327. };
  328. const requiredFields = [
  329. { field: 'platformNumber', title: '平台编号' },
  330. { field: 'platformName', title: '平台名称' },
  331. { field: 'country', title: '国家' },
  332. { field: 'brandName', title: '品牌' },
  333. { field: 'user', title: '填写人' },
  334. { field: 'operater', title: '运营' },
  335. { field: 'currencyCode', title: '平台币种' },
  336. { field: 'currencyCodePlatform', title: '回款/余额币种' },
  337. { field: 'line', title: '线路' },
  338. { field: 'ipaddress', title: 'IP地址' },
  339. { field: 'company', title: '注册公司' },
  340. { field: 'platform', title: '平台' },
  341. ];
  342. const validateRow = (row) => {
  343. for (const { field, title } of requiredFields) {
  344. if (!row[field] || (Array.isArray(row[field]) && row[field].length === 0)) {
  345. ElMessage.error(`${ title }不能为空`);
  346. return;
  347. }
  348. }
  349. if (!currencyList.value.includes(row.currencyCode)) {
  350. ElMessage.error('回款币种格式不正确,请重新选择');
  351. return;
  352. }
  353. if (!currencyList.value.includes(row.currencyCodePlatform)) {
  354. ElMessage.error('回款/余额币种格式不正确,请重新选择');
  355. return;
  356. }
  357. return true;
  358. };
  359. async function updateRow(row) {
  360. const $grid = xGrid.value;
  361. if ($grid) {
  362. const updatedRowData = {
  363. id: row.id,
  364. platformNumber: row.platformNumber,
  365. platformName: row.platformName,
  366. country: row.country,
  367. brandName: row.brandName,
  368. user: row.user,
  369. operater: row.operater,
  370. currencyCode: row.currencyCode,
  371. currencyCodePlatform: row.currencyCodePlatform,
  372. line: row.line,
  373. ipaddress: row.ipaddress,
  374. company: row.company,
  375. platform: row.platform,
  376. };
  377. //console.log('updatedRowData', updatedRowData);
  378. try {
  379. const response = await postUpdateTask(updatedRowData);
  380. if (response.code === 2000) {
  381. ElMessage.success('更新成功');
  382. } else if (response.code == 400) {
  383. ElMessage.warning(`${ response.data.description }`);
  384. } else {
  385. ElMessage.error('更新失败');
  386. }
  387. } catch (error) {
  388. console.log('error:', error);
  389. }
  390. }
  391. }
  392. async function handleStatusChange(row) {
  393. const $grid = xGrid.value;
  394. if ($grid) {
  395. const updatedData = {
  396. id: row.id,
  397. status: row.status,
  398. };
  399. // 传partial=1,可只修改状态
  400. const query = { partial: 1, };
  401. try {
  402. const response = await postUpdateTaskStatus(query, updatedData);
  403. if (response.code === 2000) {
  404. ElMessage.success('状态更新成功');
  405. } else if (response.code == 400) {
  406. ElMessage.warning(`${ response.data.description }`);
  407. } else {
  408. ElMessage.error('状态更新失败');
  409. }
  410. } catch (error) {
  411. console.log('error:', error);
  412. }
  413. }
  414. }
  415. const saveRowEvent = async (row: RowVO) => {
  416. const $grid = xGrid.value;
  417. if ($grid) {
  418. if (!validateRow(row)) {
  419. return;
  420. }
  421. await $grid.clearEdit();
  422. await updateRow(row);
  423. await getTaskList();
  424. gridOptions.loading = true;
  425. setTimeout(() => {
  426. gridOptions.loading = false;
  427. }, 300);
  428. }
  429. };
  430. async function createTask() {
  431. const body = {
  432. country: taskRuleForm.country,
  433. platformNumber: taskRuleForm.number,
  434. platformName: taskRuleForm.name,
  435. brandName: taskRuleForm.brand,
  436. currencyCode: taskRuleForm.currency,
  437. currencyCodePlatform: taskRuleForm.currencyCodePlatform,
  438. line: taskRuleForm.line,
  439. ipaddress: taskRuleForm.ipaddress,
  440. company: taskRuleForm.company,
  441. platform: taskRuleForm.platform,
  442. user: taskRuleForm.operation,
  443. operater: taskRuleForm.operater,
  444. };
  445. try {
  446. const resp = await postCreateTask(body);
  447. if (resp.code === 2000) {
  448. dialogFormVisible.value = false;
  449. await getTaskList(); // 重新获取任务列表
  450. ElMessage({ message: '创建成功', type: 'success', });
  451. }
  452. } catch (error) {
  453. ElMessage({ message: '创建失败', type: 'error', });
  454. }
  455. }
  456. const submitForm = async (formEl) => {
  457. if (!formEl) return;
  458. await formEl.validate(async (valid, fields) => {
  459. if (valid) {
  460. const isDuplicate = allTasks.some(task => String(task.platformNumber) === String(taskRuleForm.number));
  461. if (isDuplicate) {
  462. await ElMessage({ message: '平台编号已存在,请重新输入', type: 'warning' });
  463. return;
  464. }
  465. if (!currencyList.value.includes(taskRuleForm.currency)) {
  466. await ElMessage({ message: '回款币种无效,请重新选择', type: 'warning' });
  467. return;
  468. }
  469. if (!currencyList.value.includes(taskRuleForm.currencyCodePlatform)) {
  470. await ElMessage({ message: '回款/余额币种无效,请重新选择', type: 'warning' });
  471. return;
  472. }
  473. await createTask();
  474. taskRuleFormRef.value.resetFields();
  475. }
  476. });
  477. };
  478. async function handleExport() {
  479. gridOptions.loading = true;
  480. const response = await exportTaskData();
  481. const url = window.URL.createObjectURL(new Blob([response.data]));
  482. const link = document.createElement('a');
  483. link.href = url;
  484. link.setAttribute('download', '店铺数据.xlsx');
  485. document.body.appendChild(link);
  486. link.click();
  487. gridOptions.loading = false;
  488. ElMessage.success('导出数据成功');
  489. }
  490. function handleClose(done: Function) {
  491. if (taskRuleFormRef.value) taskRuleFormRef.value.resetFields();
  492. done();
  493. }
  494. async function fetchOperationSelect() {
  495. try {
  496. const resp = await getOperationSelect();
  497. operationList.value = resp.data.map((item: any) => {
  498. return { value: item.id, label: item.name };
  499. });
  500. } catch (e) {
  501. console.error('Failed to fetch operation select:', e);
  502. }
  503. }
  504. async function fetchCurrencyList() {
  505. try {
  506. const response = await getCurrencyCodeSelect(); // 替换为你的后端接口
  507. currencyList.value = response.data;
  508. } catch (error) {
  509. ElMessage.error('请求失败');
  510. }
  511. }
  512. const querySearch = (queryString, cb) => {
  513. const results = queryString
  514. ? currencyList.value.filter(currency => currency.toLowerCase().includes(queryString.toLowerCase()))
  515. : currencyList.value;
  516. cb(results);
  517. };
  518. const handleSelect = item => {
  519. taskRuleForm.currency = item;
  520. };
  521. const handleCurrencyCodePlatformSelect = item => {
  522. taskRuleForm.currencyCodePlatform = item;
  523. };
  524. function handleRowSelect(item, row) {
  525. row.currencyCode = item;
  526. }
  527. function handelRowCurrencyCodePlatformSelect(item, row) {
  528. row.currencyCodePlatform = item;
  529. }
  530. const cellStyle = () => {
  531. return {
  532. fontSize: '13px',
  533. fontWeight: '500',
  534. };
  535. };
  536. const headerCellStyle = () => {
  537. return {
  538. fontSize: '14px',
  539. };
  540. };
  541. //发送通知
  542. async function sendMessage(selectedValue: string) {
  543. const body = {
  544. date_type: selectedValue,
  545. };
  546. try {
  547. const response = await postSendMessage(body);
  548. if (response.code === 2000) {
  549. ElMessage.success('发送成功');
  550. } else if (response.code == 400) {
  551. ElMessage.warning(`${ response.data.description }`);
  552. } else {
  553. ElMessage.error('发送失败');
  554. }
  555. } catch (error) {
  556. }
  557. }
  558. onMounted(() => {
  559. getTaskList();
  560. fetchOperationSelect();
  561. fetchCurrencyList();
  562. });
  563. </script>
  564. <template>
  565. <el-card class="custom-card-style flex gap-1.5 justify-between mx-8">
  566. <Selector ref="selectorRef" :showOperationSearch="true" @update:filteredData="filteredDataChange" />
  567. </el-card>
  568. <el-card class="mx-8 my-3">
  569. <div style="position: relative">
  570. <vxe-grid ref="xGrid" :cell-style="cellStyle" :header-cell-style="headerCellStyle" stripe v-bind="gridOptions"
  571. v-on="gridEvents">
  572. <template #toolbar_buttons>
  573. <el-button :icon="Plus" plain type="success" @click="dialogFormVisible = true"> 添加任务</el-button>
  574. <el-dropdown style="padding: 0 10px;" trigger="click">
  575. <el-button plain type="primary">
  576. <el-icon class="el-icon--left">
  577. <arrow-down />
  578. </el-icon>
  579. 发送通知
  580. </el-button>
  581. <template #dropdown>
  582. <el-dropdown-menu>
  583. <el-dropdown-item v-for="info of dateType" @click="sendMessage(info.value)">{{
  584. info.label
  585. }}
  586. </el-dropdown-item>
  587. </el-dropdown-menu>
  588. </template>
  589. </el-dropdown>
  590. <el-button :disabled="isDeleteDisabled" :icon="Delete" plain type="danger" @click="removeEvent">删除
  591. </el-button>
  592. </template>
  593. <template #toolbar_tools>
  594. <div class="mx-3.5">
  595. <vxe-button circle icon="vxe-icon-download" @click="handleExport"></vxe-button>
  596. </div>
  597. </template>
  598. <template #operate="{ row }">
  599. <template v-if="hasActiveEditRow(row)">
  600. <vxe-button content="取消" type="text" @click="clearRowEvent(row)"></vxe-button>
  601. <vxe-button content="保存" status="success" type="text" @click="saveRowEvent(row)"></vxe-button>
  602. </template>
  603. <template v-else>
  604. <el-button icon="Edit" type="text" @click="editRowEvent(row)"></el-button>
  605. </template>
  606. </template>
  607. <template #number_edit="{ row }">
  608. <vxe-input v-model="row.platformNumber"></vxe-input>
  609. </template>
  610. <template #name_edit="{ row }">
  611. <vxe-input v-model="row.platformName"></vxe-input>
  612. </template>
  613. <template #country_edit="{ row }">
  614. <vxe-input v-model="row.country"></vxe-input>
  615. </template>
  616. <template #brand_edit="{ row }">
  617. <vxe-input v-model="row.brandName"></vxe-input>
  618. </template>
  619. <template #line_edit="{ row }">
  620. <vxe-input v-model="row.line"></vxe-input>
  621. </template>
  622. <template #ipaddress_edit="{ row }">
  623. <vxe-input v-model="row.ipaddress"></vxe-input>
  624. </template>
  625. <template #company_edit="{ row }">
  626. <vxe-input v-model="row.company"></vxe-input>
  627. </template>
  628. <template #platform_edit="{ row }">
  629. <vxe-input v-model="row.platform"></vxe-input>
  630. </template>
  631. <template #status_default="{ row }">
  632. <el-switch
  633. v-model="row.status"
  634. :active-value="1"
  635. :inactive-value="0"
  636. inline-prompt
  637. @change="handleStatusChange(row)"
  638. />
  639. </template>
  640. <template #operation_edit="{ row }">
  641. <vxe-select v-model="row.user" multiple>
  642. <vxe-option v-for="item in operationList" :key="item.value" :label="item.label"
  643. :value="item.value"></vxe-option>
  644. </vxe-select>
  645. </template>
  646. <template #operater_name_edit="{ row }">
  647. <vxe-input v-model="row.operater"></vxe-input>
  648. </template>
  649. <template #currency_edit="{ row }">
  650. <!--<vxe-input v-model="row.currencyCode"></vxe-input>-->
  651. <el-autocomplete
  652. v-model="row.currencyCode"
  653. :debounce="100"
  654. :fetch-suggestions="querySearch"
  655. :trigger-on-focus="false"
  656. clearable
  657. @select="item => handleRowSelect(item, row)"
  658. >
  659. <template v-slot="{ item }">
  660. <div>{{ item }}</div>
  661. </template>
  662. </el-autocomplete>
  663. </template>
  664. <template #currencyCodePlatform_edit="{ row }">
  665. <el-autocomplete
  666. v-model="row.currencyCodePlatform"
  667. :debounce="100"
  668. :fetch-suggestions="querySearch"
  669. :trigger-on-focus="false"
  670. clearable
  671. @select="item => handelRowCurrencyCodePlatformSelect(item,row)"
  672. >
  673. <template v-slot="{ item }">
  674. <div>{{ item }}</div>
  675. </template>
  676. </el-autocomplete>
  677. </template>
  678. </vxe-grid>
  679. </div>
  680. </el-card>
  681. <el-dialog v-model="dialogFormVisible" :before-close="handleClose" style="border-radius: 10px;" title="新建任务"
  682. width="500">
  683. <el-form
  684. ref="taskRuleFormRef"
  685. :model="taskRuleForm"
  686. :rules="rules"
  687. :size="formSize"
  688. class="demo-taskRuleForm"
  689. label-width="auto"
  690. status-icon
  691. style="max-width: 600px">
  692. <el-form-item label="平台编号" prop="number">
  693. <el-input v-model="taskRuleForm.number" placeholder="请输入平台编号" />
  694. </el-form-item>
  695. <el-form-item label="平台名称" prop="name">
  696. <el-input v-model="taskRuleForm.name" placeholder="请输入平台名称" />
  697. </el-form-item>
  698. <el-form-item label="国家" prop="country">
  699. <el-input v-model="taskRuleForm.country" placeholder="请输入国家" />
  700. </el-form-item>
  701. <el-form-item label="品牌" prop="brand">
  702. <el-input v-model="taskRuleForm.brand" placeholder="请输入品牌" />
  703. </el-form-item>
  704. <el-form-item label="录入人员" prop="operation">
  705. <el-select v-model="taskRuleForm.operation" collapse-tags collapse-tags-tooltip multiple
  706. placeholder="请选择录入人员">
  707. <el-option v-for="item in operationList" :key="item.value" :label="item.label"
  708. :value="item.value"></el-option>
  709. </el-select>
  710. </el-form-item>
  711. <el-form-item label="运营" prop="operater">
  712. <el-input v-model="taskRuleForm.operater" placeholder="请输入运营" />
  713. </el-form-item>
  714. <el-form-item label="平台币种" prop="currency">
  715. <el-autocomplete
  716. v-model="taskRuleForm.currency"
  717. :debounce="100"
  718. :fetch-suggestions="querySearch"
  719. :trigger-on-focus="false"
  720. clearable
  721. placeholder="请输入回款币种"
  722. @select="handleSelect"
  723. >
  724. <template v-slot="{ item }">
  725. <div>{{ item }}</div> <!-- 确保正确显示每个选项 -->
  726. </template>
  727. </el-autocomplete>
  728. </el-form-item>
  729. <el-form-item label="回款/余额币种" prop="currencyCodePlatform">
  730. <el-autocomplete
  731. v-model="taskRuleForm.currencyCodePlatform"
  732. :debounce="100"
  733. :fetch-suggestions="querySearch"
  734. :trigger-on-focus="false"
  735. clearable
  736. placeholder="请输入回款/余额币种"
  737. @select="handleCurrencyCodePlatformSelect"
  738. >
  739. <template v-slot="{ item }">
  740. <div>{{ item }}</div> <!-- 确保正确显示每个选项 -->
  741. </template>
  742. </el-autocomplete>
  743. </el-form-item>
  744. <el-form-item label="线路" prop="line">
  745. <el-input v-model="taskRuleForm.line" placeholder="请输入线路" />
  746. </el-form-item>
  747. <el-form-item label="IP地址" prop="ipaddress">
  748. <el-input v-model="taskRuleForm.ipaddress" placeholder="请输入IP地址" />
  749. </el-form-item>
  750. <el-form-item label="注册公司" prop="company">
  751. <el-input v-model="taskRuleForm.company" placeholder="请输入注册公司" />
  752. </el-form-item>
  753. <el-form-item label="平台" prop="platform">
  754. <el-input v-model="taskRuleForm.platform" placeholder="请输入平台" />
  755. </el-form-item>
  756. </el-form>
  757. <template #footer>
  758. <div class="dialog-footer">
  759. <el-button @click="dialogFormVisible = false ;resetForm(taskRuleFormRef)">取消</el-button>
  760. <el-button type="primary" @click="submitForm(taskRuleFormRef)"> 确认</el-button>
  761. </div>
  762. </template>
  763. </el-dialog>
  764. </template>
  765. <style scoped>
  766. .custom-card-style {
  767. z-index: 999;
  768. position: sticky;
  769. margin-top: 15px;
  770. margin-bottom: 5px;
  771. }
  772. .el-card {
  773. border: none;
  774. box-shadow: none;
  775. }
  776. .el-card:hover {
  777. box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
  778. 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  779. border-color: #eee;
  780. transition: all 0.2s ease-in-out;
  781. }
  782. </style>