From f07dc0ad4170e2ed6c44743e72de032419809788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E8=90=BD=28YangLei=29?= Date: Thu, 8 Jul 2021 16:19:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 1 + src/api/xunjian.js | 32 ++++++ src/components/MySelect/search_select.vue | 54 +++++++++ src/components/MySelect/url_select.vue | 52 +++++++++ src/components/table/table.vue | 43 +++++--- src/components/table/wraper.vue | 13 ++- .../task_managment/center/common/index.js | 17 +++ .../xunjian/task_managment/center/form.vue | 99 ++++++++++++++++- .../xunjian/task_managment/center/index.vue | 103 +++++++++++++++++- src/utils/index.js | 15 ++- 10 files changed, 407 insertions(+), 22 deletions(-) create mode 100644 src/api/xunjian.js create mode 100644 src/components/MySelect/search_select.vue create mode 100644 src/components/MySelect/url_select.vue create mode 100644 src/pages/xunjian/task_managment/center/common/index.js diff --git a/src/api/index.js b/src/api/index.js index 212ee85..38e355e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -2,6 +2,7 @@ import { request, METHOD, formatObj } from '@/utils'; export * from './menu'; export * from './system'; export * from './task'; +export * from './xunjian'; export function getUserDetailInfoApi() { return request('/api/v1/detail', METHOD.GET); diff --git a/src/api/xunjian.js b/src/api/xunjian.js new file mode 100644 index 0000000..d4d106f --- /dev/null +++ b/src/api/xunjian.js @@ -0,0 +1,32 @@ +import { getReq, postReq } from '@/utils/requestUtil'; +import langUtils from '@/utils/langUtils'; + +export function getXunJianDownloadUrlApi(idList) { + return getReq('/ranger/inspection/api/v1/jobs/export', { jobIdList: idList.join(',') }); +} + +export function getAreaListDataApi() { + return getReq(`/ranger/inspection/api/v1/region/list`); +} + +export function getBusinessListApi() { + return getReq( + `/api/v1/parameters/business/list?paramModule=rpis_route_schedule¶mCode=inspection_state¶mLocale=${langUtils.get()}`, + ); +} + +export function getBanZuListApi() { + return getReq( + `/api/v1/parameters/business/list?paramModule=rpis_route_schedule¶mCode=shift_type¶mLocale=${langUtils.get()}`, + ); +} + +export function getTaskTypeApi() { + return getReq( + `/api/v1/parameters/business/list?paramModule=rpis_route_schedule¶mCode=job_type¶mLocale=${langUtils.get()}`, + ); +} + +export function addXunJianTaskApi(data) { + return postReq('/ranger/inspection/api/v1/jobs/temporary', data); +} diff --git a/src/components/MySelect/search_select.vue b/src/components/MySelect/search_select.vue new file mode 100644 index 0000000..52b9877 --- /dev/null +++ b/src/components/MySelect/search_select.vue @@ -0,0 +1,54 @@ + + + diff --git a/src/components/MySelect/url_select.vue b/src/components/MySelect/url_select.vue new file mode 100644 index 0000000..35b180a --- /dev/null +++ b/src/components/MySelect/url_select.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/components/table/table.vue b/src/components/table/table.vue index 7718106..b61d4b2 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -1,6 +1,6 @@ @@ -70,6 +65,8 @@ const initQuery = { pageNum: 1, }; +const defaultTitle = '新增'; + export default { props: { url: String, @@ -78,9 +75,11 @@ export default { noPage: Boolean, formatData: Function, rowKey: [String, Function], + selected: Array, }, data() { + const newBtn = this.addBtn ? (typeof this.addBtn === 'object' ? this.addBtn : {}) : this.addBtn; return { initQuery: { ...initQuery, @@ -90,7 +89,7 @@ export default { loading: false, total: 0, visible: false, - title: '新增', + title: newBtn.title ?? defaultTitle, drawerStyle: { display: 'flex', flexDirection: 'column', @@ -108,6 +107,9 @@ export default { }, computed: { + newBtn() { + return this.addBtn ? (typeof this.addBtn === 'object' ? this.addBtn : {}) : this.addBtn; + }, pagination() { return this.noPage ? false @@ -118,6 +120,13 @@ export default { showQuickJumper: true, }; }, + rowSelection() { + return { + onChange: (selectedRowKeys, selectedRows) => { + this.$emit('update:selected', [selectedRowKeys, selectedRows]); + }, + }; + }, }, methods: { @@ -151,21 +160,29 @@ export default { hidden() { this.visible = false; + this.title = this.addBtn?.title ?? defaultTitle; }, + show({ title } = {}) { this.visible = true; if (title) this.title = title; }, + reset() { this.queryForm = {}; this.initQuery = { ...initQuery }; this.getData(); }, + addBtnClick() { const { click } = typeof this.addBtn === 'object' ? this.addBtn : {}; click && click(); this.visible = true; }, + + getFormRef(ref) { + console.log(ref); + }, }, }; diff --git a/src/components/table/wraper.vue b/src/components/table/wraper.vue index 88560df..efdb986 100644 --- a/src/components/table/wraper.vue +++ b/src/components/table/wraper.vue @@ -31,6 +31,10 @@ export default { type: Function, default: EMPTY_FUN, }, + refresh: { + type: Function, + default: EMPTY_FUN, + }, }, data: () => ({ loading: false, @@ -43,9 +47,14 @@ export default { async ok() { this.loading = true; - await this.onOk(); + try { + await this.onOk(); + this.hidden(); + this.refresh(); + } catch (error) { + // todo + } this.loading = false; - this.hidden(); }, }, }; diff --git a/src/pages/xunjian/task_managment/center/common/index.js b/src/pages/xunjian/task_managment/center/common/index.js new file mode 100644 index 0000000..610a23d --- /dev/null +++ b/src/pages/xunjian/task_managment/center/common/index.js @@ -0,0 +1,17 @@ +export const areaFormatData = { + label: 'regionName', + value: 'regionId', + key: 'regionId', +}; + +export const statusFormtData = { + label: 'paramName', + value: 'paramValue', + key: 'paramValue', +}; + +export const banZuFormatData = { + label: 'paramName', + value: 'paramValue', + key: 'paramValue', +}; diff --git a/src/pages/xunjian/task_managment/center/form.vue b/src/pages/xunjian/task_managment/center/form.vue index a2e32df..a2e5282 100644 --- a/src/pages/xunjian/task_managment/center/form.vue +++ b/src/pages/xunjian/task_managment/center/form.vue @@ -1,3 +1,100 @@ + + diff --git a/src/pages/xunjian/task_managment/center/index.vue b/src/pages/xunjian/task_managment/center/index.vue index 5f72a30..5dabdc5 100644 --- a/src/pages/xunjian/task_managment/center/index.vue +++ b/src/pages/xunjian/task_managment/center/index.vue @@ -1,5 +1,11 @@