From c40f4c1267dae4fcf27dbbd75ea83014fba87783 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 15 七月 2025 15:28:21 +0800 Subject: [PATCH] 新增联合执法清单 --- src/api/fytz/userApi.js | 2 src/views/fysp/data-product/ProdSceneReport.vue | 3 src/components/CompGenericWrapper.vue | 5 src/components.d.ts | 12 + src/api/fysp/problemApi.js | 36 +++- src/views/fysp/check/components/CompProRecent.vue | 3 src/api/fysp/userApi.js | 2 src/components/table/FYTable.vue | 39 +++ src/views/fysp/check/components/ArbitraryPhoto.vue | 2 src/views/fysp/data-product/ProdLawEnforceList.vue | 304 ++++++++++++++++----------------- src/api/index.js | 4 src/components/FYImageSelectDialog.vue | 31 ++- index.html | 5 src/views/fysp/check/ProCheck.vue | 5 src/views/fysp/check/components/CompProblemAddOrUpd.vue | 2 src/components/list-item/ItemSubTask.vue | 4 src/utils/excel.js | 48 +++++ 17 files changed, 313 insertions(+), 194 deletions(-) diff --git a/index.html b/index.html index dc36b7f..d5c41ec 100644 --- a/index.html +++ b/index.html @@ -9,15 +9,14 @@ <body> <div id="app"></div> </body> - <script type="text/javascript"> + <!-- <script type="text/javascript"> window._AMapSecurityConfig = { serviceHost: 'http://47.100.191.150:8083/_AMapService' - //渚嬪 锛歴erviceHost:'http://1.1.1.1:80/_AMapService', }; </script> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.5&key=520c5e5cf44c7793104e500cbf0ed711&plugin=Map3D,ElasticMarker,AMap.ControlBar,AMap.Geocoder" - ></script> + ></script> --> <script type="module" src="/src/main.js"></script> </html> diff --git a/src/api/fysp/problemApi.js b/src/api/fysp/problemApi.js index b5ed2fb..a1ca7d5 100644 --- a/src/api/fysp/problemApi.js +++ b/src/api/fysp/problemApi.js @@ -5,12 +5,30 @@ export default { /** + * 鑾峰彇瀛愪换鍔¢棶棰樿鎯� + */ + getProBySubtask(id) { + return $fysp + .get('problemlist/subtask', { + params: { + stGuid: id + } + }) + .then((res) => res.data); + }, + /** * 闂瀹℃牳 * @param {Number} action 0锛氶棶棰橀�氳繃锛�1锛氶棶棰樹笉閫氳繃锛�2锛氭暣鏀归�氳繃锛�3鏁存敼涓嶉�氳繃 */ checkProblem({ pId, action, remark = '', userId = id, userName = name }) { - const params = `?pId=${pId}&action=${action}&remark=${remark}&userId=${userId}&userName=${userName}`; - return $fysp.post(`problemlist/check${params}`).then((res) => res.data); + // const params = `?pId=${pId}&action=${action}&remark=${remark}&userId=${userId}&userName=${userName}`; + return $fysp + .post( + `problemlist/check`, + {}, + { params: { pId, action, remark, userId, userName } } + ) + .then((res) => res.data); }, fetchProblemType({ cityCode, districtCode, sceneTypeId }) { @@ -26,7 +44,7 @@ return $fysp.get(`mediafile/${params}/5`).then((res) => res); }, // 鑾峰彇闂浣嶇疆 - getLocation({ sceneTypeId }) { + getLocation({ sceneTypeId }) { const params = `?sceneType=${sceneTypeId}`; return $fysp.get(`domainitem/location${params}`).then((res) => res); }, @@ -35,23 +53,23 @@ return $fysp.get(`changeadvice`).then((res) => res); }, // 淇敼闂 - updateProblem(data) { + updateProblem(data) { return $fysp.post(`problemlist/updateProblem`, data).then((res) => res); }, // 鏂板闂 newProblem(data) { - return $fysp.post(`problemlist/newProblem`, data).then((res) => res) + return $fysp.post(`problemlist/newProblem`, data).then((res) => res); }, // 淇敼鏁存敼 updateChange(data) { - return $fysp.post(`problemlist/updateChange`, data).then((res) => res) + return $fysp.post(`problemlist/updateChange`, data).then((res) => res); }, // 鏁存敼涓婁紶 changeProblem(data) { - return $fysp.post(`problemlist/changeProblem`, data).then((res) => res) + return $fysp.post(`problemlist/changeProblem`, data).then((res) => res); }, // 闂鍒犻櫎 deleteProblem({ pid }) { - return $fysp.post(`problemlist/${pid}`).then((res) => res.data) + return $fysp.post(`problemlist/${pid}`, {}).then((res) => res.data); } -} +}; diff --git a/src/api/fysp/userApi.js b/src/api/fysp/userApi.js index 022c9be..bb6f58c 100644 --- a/src/api/fysp/userApi.js +++ b/src/api/fysp/userApi.js @@ -28,7 +28,7 @@ * 鑷姩鍒涘缓璐︽埛 */ autoCreateAccount(sId) { - return $fysp.post(`userinfo/create?sceneId=${sId}`).then((res) => res.data); + return $fysp.post(`userinfo/create?sceneId=${sId}`, {}).then((res) => res.data); }, /** * 鑾峰彇鍦烘櫙瀵瑰簲鐨勯缇界幆澧冪郴缁熺敤鎴穒d diff --git a/src/api/fytz/userApi.js b/src/api/fytz/userApi.js index c93ecb6..c089940 100644 --- a/src/api/fytz/userApi.js +++ b/src/api/fytz/userApi.js @@ -45,7 +45,7 @@ * 閲嶇疆鐢ㄦ埛瀵嗙爜 */ resetPassword(id) { - return $fytz.post(`userInfo/resetPw?userId=${id}`).then((res) => res.data); + return $fytz.post(`userInfo/resetPw?userId=${id}`, {}).then((res) => res.data); }, diff --git a/src/api/index.js b/src/api/index.js index fc2c53e..dca45b4 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -7,11 +7,13 @@ // let ip1_file = 'http://47.100.191.150:9005/'; let ip1 = 'https://fyami.com.cn:447/'; let ip1_file = 'https://fyami.com.cn:447/'; +// let ip1 = 'https://fyami.com.cn:449/api/'; +// let ip1_file = 'https://fyami.com.cn:449/api/'; let ip2 = 'https://fyami.com.cn/'; let ip2_file = 'https://fyami.com.cn/'; if (debug) { - ip1 = 'http://192.168.0.110:9001/'; + ip1 = 'http://192.168.0.103:8080/'; // ip1_file = 'http://192.168.0.138:8080/'; // ip2 = 'http://192.168.0.138:8080/'; // ip2_file = 'https://fyami.com.cn/'; diff --git a/src/components.d.ts b/src/components.d.ts index 06b456c..2b04de3 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -13,15 +13,19 @@ CompGenericWrapper: typeof import('./components/CompGenericWrapper.vue')['default'] CompQuickSet: typeof import('./components/search-option/CompQuickSet.vue')['default'] Content: typeof import('./components/core/Content.vue')['default'] + ElAffix: typeof import('element-plus/es')['ElAffix'] ElAside: typeof import('element-plus/es')['ElAside'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] + ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] + ElCalendar: typeof import('element-plus/es')['ElCalendar'] ElCard: typeof import('element-plus/es')['ElCard'] ElCascader: typeof import('element-plus/es')['ElCascader'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] + ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] ElCol: typeof import('element-plus/es')['ElCol'] ElCollapse: typeof import('element-plus/es')['ElCollapse'] ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] @@ -33,6 +37,9 @@ ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] ElDrawer: typeof import('element-plus/es')['ElDrawer'] + ElDropdown: typeof import('element-plus/es')['ElDropdown'] + ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] + ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] @@ -42,13 +49,17 @@ ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElInput: typeof import('element-plus/es')['ElInput'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] + ElLink: typeof import('element-plus/es')['ElLink'] ElMain: typeof import('element-plus/es')['ElMain'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup'] ElOption: typeof import('element-plus/es')['ElOption'] + ElPageHeader: typeof import('element-plus/es')['ElPageHeader'] ElPagination: typeof import('element-plus/es')['ElPagination'] + ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] ElPopover: typeof import('element-plus/es')['ElPopover'] + ElRadio: typeof import('element-plus/es')['ElRadio'] ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] @@ -67,6 +78,7 @@ ElTag: typeof import('element-plus/es')['ElTag'] ElText: typeof import('element-plus/es')['ElText'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTree: typeof import('element-plus/es')['ElTree'] ElUpload: typeof import('element-plus/es')['ElUpload'] Footer: typeof import('./components/core/Footer.vue')['default'] diff --git a/src/components/CompGenericWrapper.vue b/src/components/CompGenericWrapper.vue index 545b7fd..8048cb5 100644 --- a/src/components/CompGenericWrapper.vue +++ b/src/components/CompGenericWrapper.vue @@ -9,6 +9,7 @@ destroy-on-close :draggable="draggable" :modal="modal" + :append-to-body="appendToBody" > <div v-if="visible"> <slot name="content"></slot> @@ -45,6 +46,10 @@ modal: { type: Boolean, default: true + }, + appendToBody: { + type: Boolean, + default: true } }); const typeOptions = ref([ diff --git a/src/components/FYImageSelectDialog.vue b/src/components/FYImageSelectDialog.vue index 7a10793..c35bc94 100644 --- a/src/components/FYImageSelectDialog.vue +++ b/src/components/FYImageSelectDialog.vue @@ -39,17 +39,24 @@ </el-row> <div class="center"> - <el-tabs v-if="typeList.length > 0" v-model="activeId" type="card"> - <el-tab-pane - v-for="item in typeList" - :key="item.typeId" - :label=" - item.typeName + ' (' + typeImgMap.get(item.typeId).length + ')' - " - :name="item.typeId" + <el-scrollbar class="scrollbar-flex-content"> + <el-tabs + v-if="typeList.length > 0" + v-model="activeId" + type="card" + stretch > - </el-tab-pane> - </el-tabs> + <el-tab-pane + v-for="item in typeList" + :key="item.typeId" + :label=" + item.typeName + ' (' + typeImgMap.get(item.typeId).length + ')' + " + :name="item.typeId" + > + </el-tab-pane> + </el-tabs> + </el-scrollbar> <el-scrollbar height="70vh"> <div v-if="typeImgMap.get(activeId) && typeImgMap.get(activeId).length > 0" @@ -216,6 +223,10 @@ ); </script> <style scoped> +.scrollbar-flex-content { + display: flex; + width: 100%; +} .center { display: flex; flex-direction: column; diff --git a/src/components/list-item/ItemSubTask.vue b/src/components/list-item/ItemSubTask.vue index ac1f3ab..20f9ee1 100644 --- a/src/components/list-item/ItemSubTask.vue +++ b/src/components/list-item/ItemSubTask.vue @@ -60,7 +60,7 @@ </template> <script setup> import { ref, watch, computed } from 'vue'; -import taskApi from '@/api/fysp/taskApi'; +import problemApi from '@/api/fysp/problemApi'; import ProCheckProxy from '@/views/fysp/check/ProCheckProxy'; /** @@ -128,7 +128,7 @@ function fetchProblems(subtask) { loading.value = true; - taskApi + problemApi .getProBySubtask(subtask.stguid) .then((res) => { proList.value = res; diff --git a/src/components/table/FYTable.vue b/src/components/table/FYTable.vue index 3e5da08..478a48d 100644 --- a/src/components/table/FYTable.vue +++ b/src/components/table/FYTable.vue @@ -28,6 +28,7 @@ <slot name="options-expand2"></slot> </div> <el-table + id="fyTable" ref="tableRef" :data="tableData" v-loading="loading" @@ -78,6 +79,14 @@ size: { type: String, default: 'default' + }, + data: { + type: Array, + default: () => [] + }, + totalCount: { + type: Number, + default: 0 } }, data() { @@ -110,13 +119,25 @@ } }, immediate: true + }, + data(nValue, oValue) { + if (nValue != oValue) { + this.tableData = nValue; + } + }, + totalCount(nValue, oValue) { + if (nValue != oValue) { + this.total = nValue; + } } }, computed: { cTableHeight() { if (this.$refs.searchRef) { const h1 = this.$refs.searchRef.$el.offsetHeight; - const h2 = this.$refs.paginationRef ? this.$refs.paginationRef.$el.offsetHeight : 0; + const h2 = this.$refs.paginationRef + ? this.$refs.paginationRef.$el.offsetHeight + : 0; const h3 = this.$refs.expandRef.$el.offsetHeight; const h4 = this.$refs.expand2Ref.offsetHeight; @@ -143,8 +164,14 @@ pageSize: this.pageSize }, (res) => { - this.tableData = res.data; - this.total = res.total ? res.total : 0; + if (res) { + if (res.data) { + this.tableData = res.data; + } + if (res.total) { + this.total = res.total; + } + } this.loading = false; this.doLayout(); } @@ -152,7 +179,9 @@ }, calcTableHeight() { const h1 = this.$refs.searchRef.$el.offsetHeight; - const h2 = this.$refs.paginationRef ? this.$refs.paginationRef.$el.offsetHeight : 0; + const h2 = this.$refs.paginationRef + ? this.$refs.paginationRef.$el.offsetHeight + : 0; const h3 = this.$refs.expandRef.$el.offsetHeight; const h4 = this.$refs.expand2Ref.offsetHeight; @@ -183,7 +212,7 @@ handleSortChange({ column, prop, order }) { this.$emit('sortChange', { column, prop, order }); }, - clearSort(){ + clearSort() { this.$refs.tableRef.clearSort(); } }, diff --git a/src/utils/excel.js b/src/utils/excel.js new file mode 100644 index 0000000..a42c45f --- /dev/null +++ b/src/utils/excel.js @@ -0,0 +1,48 @@ +import * as XLSX from 'xlsx'; +import FileSaver from 'file-saver'; + +function conversionFromTable(elementId, title) { + // 鑾峰彇琛ㄦ牸鍏冪礌 + let list = document.getElementById(elementId); + let tables = list.cloneNode(true); //鍏嬮殕姝ゅ厓绱狅紝鍚﹀垯鏇存敼鏁版嵁鏃朵細褰卞搷鍒板師琛ㄦ牸 + //濡傛灉琛ㄦ牸涓惈鏈塻witch寮�鍏筹紝鏀惧叆浠ヤ笅浠g爜锛屽彲杞崲鐘舵�佷細鍦‥xcel涓樉绀猴紝鍚﹀垯杞崲鍑烘潵涓虹┖锛屼笉浼氬湪Excel涓樉绀� + // const rows = tables.getElementsByTagName('tr'); + // for (let i = 1; i < rows.length; i++) { + // // 浠�1寮�濮嬶紝浠ヨ烦杩囪〃澶� + // const cells = rows[i].getElementsByTagName('td'); + // for (let j = 0; j < cells.length; j++) { + // const cell = cells[j]; + // // 鎵惧埌寮�鍏冲厓绱犲苟鑾峰彇鐘舵�� + // const switchElement = cell.querySelector('input[type="checkbox"]'); + // if (switchElement) { + // // 鏍规嵁寮�鍏崇姸鎬佽缃崟鍏冩牸鍐呭 + // cells[j].innerText = switchElement.checked ? '鍏抽棴' : '寮�鍚�'; + // } + // } + // } + console.log(tables); + + //------鏀惧叆浠ヤ笂鎷垮埌switch鐘舵�侊紝浠ュ強涓嬫媺妗嗕唬鐮侊紝濡傛灉娌″厠闅嗗厓绱犲垯浼氬奖鍝嶅埌鍘熻〃鏍�-------------// + + // 瀵煎嚭琛ㄦ牸 + var xlsxParam = { raw: true }; // 瀵煎嚭鐨勫唴瀹瑰彧鍋氳В鏋愶紝涓嶈繘琛屾牸寮忚浆鎹� + let table_book = XLSX.utils.table_to_book(tables, xlsxParam); + const table_write = XLSX.write(table_book, { + bookType: 'xlsx', + bookSST: true, + type: 'array' + }); + try { + FileSaver.saveAs( + new Blob([table_write], { type: 'application/octet-stream' }), + `${title}.xlsx` //淇敼鍚嶅瓧 + ); + //杩欓噷鍙互鏀惧叆浣犵殑鍥炶皟鍑芥暟 + alert('寮�濮嬩笅杞�'); + } catch (e) { + if (typeof console !== 'undefined') console.log(e, table_write); + } + return table_write; +} + +export { conversionFromTable }; diff --git a/src/views/fysp/check/ProCheck.vue b/src/views/fysp/check/ProCheck.vue index dedfd26..a7dfec4 100644 --- a/src/views/fysp/check/ProCheck.vue +++ b/src/views/fysp/check/ProCheck.vue @@ -81,6 +81,7 @@ <script> import ArbitraryPhoto from './components/ArbitraryPhoto.vue'; import taskApi from '@/api/fysp/taskApi'; +import problemApi from '@/api/fysp/problemApi'; import ProCheckProxy from './ProCheckProxy'; import CompProblemAddOrUpd from './components/CompProblemAddOrUpd.vue'; import CompProblemCard from './components/CompProblemCard.vue'; @@ -217,7 +218,7 @@ this.sideLoading = false; this.mainLoading = true; // const controller = new AbortController(); - taskApi + problemApi .getProBySubtask(s.data.stGuid) .then((res) => { this.curProList = res; @@ -242,7 +243,7 @@ this.sideLoading = false; setTimeout(() => { this.mainLoading = true; - taskApi + problemApi .getProBySubtask(this.curSubtask.data.stGuid) .then((res) => { if (refresh) { diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue index 29c5a4e..012ae5c 100644 --- a/src/views/fysp/check/components/ArbitraryPhoto.vue +++ b/src/views/fysp/check/components/ArbitraryPhoto.vue @@ -218,7 +218,7 @@ canvas.width = img.naturalWidth; canvas.height = img.naturalHeight; ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - // this.copyCanvasToClipboard(canvas); + this.copyCanvasToClipboard(canvas); const dataUrl = canvas.toDataURL('image/png'); // 鍙互閫夋嫨鍏朵粬鏍煎紡濡�'image/jpeg' // 鍒涘缓涓�涓复鏃剁殑textarea鍏冪礌鏉ュ鍒舵枃鏈� const tempTextArea = document.createElement('textarea'); diff --git a/src/views/fysp/check/components/CompProRecent.vue b/src/views/fysp/check/components/CompProRecent.vue index 81be92d..6305479 100644 --- a/src/views/fysp/check/components/CompProRecent.vue +++ b/src/views/fysp/check/components/CompProRecent.vue @@ -57,6 +57,7 @@ <script> import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue'; import taskApi from '@/api/fysp/taskApi'; +import problemApi from '@/api/fysp/problemApi'; import { useCloned } from '@vueuse/core'; import dayjs from 'dayjs'; export default { @@ -180,7 +181,7 @@ }, // 鏍规嵁瀛愪换鍔¤幏鍙栭噷闈㈢殑闂鍒楄〃 getProBySubtask(subtask) { - return taskApi.getProBySubtask(subtask.stGuid).then((pros) => { + return problemApi.getProBySubtask(subtask.stGuid).then((pros) => { if (pros) { pros.forEach((pro) => { if (pro.ptguid == this.deepCopyPro.ptguid) { diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue index ad0049c..dbd66dc 100644 --- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue +++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue @@ -1,5 +1,5 @@ <template> - <CompGenericWrapper type="dialog"> + <CompGenericWrapper type="dialog" append-to-body> <template #content> <div class="main-container"> <el-form diff --git a/src/views/fysp/data-product/ProdLawEnforceList.vue b/src/views/fysp/data-product/ProdLawEnforceList.vue index 99d1b0f..2dccfb8 100644 --- a/src/views/fysp/data-product/ProdLawEnforceList.vue +++ b/src/views/fysp/data-product/ProdLawEnforceList.vue @@ -1,12 +1,12 @@ <template> <FYTable @search="onSearch" + :data="tableData" :pagination="false" ref="tableRef" @cell-click="cellClick" :cell-class-name="cellClassName" @table-paste="handlePaste" - @sort-change="handleSortChange" > <template #options> <!-- 鍖哄幙 --> @@ -34,18 +34,36 @@ <el-form :inline="true"> <CompQuickSet @quick-set="setOptions"></CompQuickSet> </el-form> - <el-descriptions v-if="this.tableData.length > 0" title="" :column="1" direction="vertical" border> + <el-descriptions + v-if="this.tableData.length > 0" + title="" + :column="1" + direction="vertical" + border + > <el-descriptions-item label="鑱斿悎鎵ф硶娓呭崟"> {{ listSummary }} </el-descriptions-item> </el-descriptions> </template> - + <template #buttons> + <el-button + icon="Download" + type="primary" + plain + @click="download" + :loading="dlLoading" + :disabled="downloadDisabled" + >涓嬭浇娓呭崟</el-button + > + </template> <template #table-column="{ size }"> - <el-table-column fixed="left" label="搴忓彿" width="80"> + <el-table-column fixed="left" label="搴忓彿" width="53"> <template #default="{ row }"> {{ row.index + 1 }} </template> + </el-table-column> + <el-table-column fixed="left" label="缂栧彿" width="53" prop="sceneIndex"> </el-table-column> <el-table-column prop="sceneName" @@ -53,6 +71,23 @@ label="鍚嶇О" width="300" > + </el-table-column> + <el-table-column prop="evaluation.scenseaddress" label="鍦板潃" /> + <el-table-column prop="_problems" label="闂" width="300"> + <template #default="{ row }"> + <el-icon class="is-loading" v-if="row._loading"> + <Loading color="#409eff" /> + </el-icon> + <div v-else> + <template v-if="row._problems.length > 0"> + <div v-for="(p, i) in row._problems" :key="p.guid"> + <el-text>{{ i + 1 }}銆�</el-text> + <el-text>{{ p.problemname }}</el-text> + </div> + </template> + <el-text v-else>/</el-text> + </div> + </template> </el-table-column> <!-- <el-table-column prop="subTaskTime" @@ -65,8 +100,15 @@ prop="evaluation.resultscorebef" label="寰楀垎" width="90" - sortable="custom" /> --> + <el-table-column prop="" label="鐩戞祴鏁版嵁" width="81"> + <template #default="{ row }"> + <el-icon class="is-loading" v-if="row._loading"> + <Loading color="#409eff" /> + </el-icon> + <el-text v-else>/</el-text> + </template> + </el-table-column> <!-- <el-table-column prop="evaluation.resultscorebef" label="鐜俊鐮�" @@ -80,14 +122,23 @@ </el-table-column> --> <el-table-column prop="dname" label="鍖哄幙" width="90" /> - <el-table-column - prop="tname" - label="琛楅亾" - width="110" - :filters="townFilters" - :filter-method="filterHandler" - /> - <el-table-column prop="evaluation.scenseaddress" label="鍦板潃" /> + <el-table-column prop="tname" label="琛楅亾" width="110" /> + <el-table-column prop="_contacts" label="鑱旂郴浜�" width="70"> + <template #default="{ row }"> + <el-icon class="is-loading" v-if="row._loading2"> + <Loading color="#409eff" /> + </el-icon> + <el-text v-else>{{ row._contacts }}</el-text> + </template> + </el-table-column> + <el-table-column prop="_contactst" label="鑱旂郴鐢佃瘽" width="112"> + <template #default="{ row }"> + <el-icon class="is-loading" v-if="row._loading2"> + <Loading color="#409eff" /> + </el-icon> + <el-text v-else>{{ row._contactst }}</el-text> + </template> + </el-table-column> <!-- <el-table-column prop="biArea" label="闆嗕腑鍖�" width="110" /> <el-table-column prop="biManagementCompany" label="鐗╀笟" min-width="110"/> --> <!-- <el-table-column fixed="right" align="right" label="鎿嶄綔" width="160"> @@ -107,10 +158,15 @@ */ import dayjs from 'dayjs'; import evaluateApi from '@/api/fysp/evaluateApi'; +import problemApi from '@/api/fysp/problemApi'; +import sceneApi from '@/api/fysp/sceneApi'; +import { conversionFromTable } from "@/utils/excel"; import { envCreditCode } from '@/constants/index'; import { useTablePaste } from '@/composables/tablePaste'; import { useCloned } from '@vueuse/core'; import { useMessageBoxTip } from '@/composables/messageBox'; +import * as XLSX from 'xlsx'; +import FileSaver from 'file-saver'; export default { setup() { @@ -144,20 +200,7 @@ townFilters: [], // 鍘熷鏁版嵁锛岀敤浜庢帓搴忓彇娑堝悗 orginData: [], - evaluationRule: undefined, - evaluationSubRule: undefined, - //鐩戞祴鏁版嵁瑙勫垯鍚嶇О - ruleName: { - score1: { - id: undefined, - name: '鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�' - }, - score2: { - id: undefined, - name: '鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�' - } - }, - updateLoading: false + dlLoading: false }; }, computed: { @@ -185,22 +228,20 @@ } else { return ``; } + }, + downloadDisabled() { + if (this.tableData.length == 0) { + return true; + } else { + let b = false; + this.tableData.forEach((e) => { + b = b || e._loading || e._loading2; + }); + return b; + } } }, methods: { - // _getParam() { - // const { locations, scenetype, time } = this.formSearch; - // return { - // provincecode: locations.pCode, - // provincename: locations.pName, - // citycode: locations.cCode, - // cityname: locations.cName, - // districtcode: locations.dCode, - // districtname: locations.dName, - // starttime: dayjs(time).format('YYYY-MM-DD HH:mm:ss'), - // scensetypeid: scenetype.value - // }; - // }, editRow(row) { this.$router.push(`evalutationEdit/${row.subTaskId}`); }, @@ -212,78 +253,60 @@ }, onSearch(page, func) { this.$refs.tableRef.clearSort(); - this.fetchEvaluationRule(this.area).then(() => { - evaluateApi.fetchAutoEvaluation(this.area).then((res) => { - if (res.data) { - this.tableData = res.data - .filter((d) => { - return d.evaluation != null; + // this.fetchEvaluationRule(this.area).then(() => { + evaluateApi.fetchAutoEvaluation(this.area).then((res) => { + if (res.data) { + res.data.sort((a, b) => { + const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0; + const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0; + return s1 - s2; + }); + this.tableData = res.data + .filter((d) => { + return ( + d.evaluation != null && + parseInt(d.evaluation.resultscorebef) < 90 + ); + }) + .slice(0, 10); + this.tableData.forEach((e) => { + e._loading = true; + problemApi + .getProBySubtask(e.subTaskId) + .then((res) => { + e._problems = res; }) - .slice(0, 10); - this.tableData.sort((a, b) => { - const s1 = a.evaluation - ? parseInt(a.evaluation.resultscorebef) - : 0; - const s2 = b.evaluation - ? parseInt(b.evaluation.resultscorebef) - : 0; - return s1 - s2; - }); - this.orginData = useCloned(this.tableData).cloned; - this.getFilters(res.data); - if (typeof func === 'function') { - func({ data: this.tableData }); - } - } else { - this.tableData = []; - this.orginData = []; - if (typeof func === 'function') { - func({ data: this.tableData }); - } - } - }); - }); - }, - fetchEvaluationRule() { - const param = { - // 鑷姩璇勪及绫诲瀷 - taskTypeId: 99, - ...this.area - }; - // 鑾峰彇璇勪及鎬昏鍒� - return evaluateApi.fetchEvaluationRule(param).then((res) => { - if (res.data.length > 0) { - this.evaluationRule = res.data[0]; - // 鑾峰彇鍏蜂綋瀛愯鍒� - return evaluateApi - .getSubRules(this.evaluationRule.guid) - .then((res) => { - this.evaluationSubRule = res.data; - // 鏌ユ壘鍙鍏ュ緱鍒嗙殑瑙勫垯id - for (const key in this.ruleName) { - const value = this.ruleName[key]; - const subrule = this.evaluationSubRule.find((v) => { - return v.itemname == value.name; - }); - if (subrule) { - value.id = subrule.guid; - } - } - }); - } - }); - }, + .finally(() => { + e._loading = false; + }); - getFilters(data) { - const townList = []; - data.forEach((e) => { - if (townList.indexOf(e.tname) == -1) { - townList.push(e.tname); + e._loading2 = true; + sceneApi + .getSceneDetail(e.sceneId) + .then((res) => { + //鍦烘櫙 + if (res.data.scense) { + e._contacts = res.data.scense.contacts; + e._contactst = res.data.scense.contactst; + } + }) + .finally(() => { + e._loading2 = false; + }); + }); + // this.orginData = useCloned(this.tableData).cloned; + if (typeof func === 'function') { + func(); + } + } else { + this.tableData = []; + // this.orginData = []; + if (typeof func === 'function') { + func(); + } } }); - this.townFilters = townList.map((v) => { - return { text: v, value: v }; - }); + // }); }, toCode(row, column) { if (row.evaluation) { @@ -304,54 +327,23 @@ const property = column['property']; return row[property] === value; }, - sortScore(a, b) { - const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0; - const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0; - return s1 - s2; - }, - handleSortChange({ column, prop, order }) { - console.log(column, prop, order); - if (order == null) { - this.orginData.forEach((e, i) => { - this.tableData[i] = e; - }); - } else if (prop == 'evaluation.resultscorebef') { - this.tableData.sort((a, b) => { - const s1 = a.evaluation ? parseInt(a.evaluation.resultscorebef) : 0; - const s2 = b.evaluation ? parseInt(b.evaluation.resultscorebef) : 0; - if (order == 'ascending') { - return s1 - s2; - } else if (order == 'descending') { - return s2 - s1; - } - }); - } else if (prop == 'sceneIndex') { - this.tableData.sort((a, b) => { - if (order == 'ascending') { - if (a.sceneIndex === b.sceneIndex) { - return a.subTaskTime > b.subTaskTime ? 1 : -1; - } else { - return a.sceneIndex - b.sceneIndex; - } - } else if (order == 'descending') { - if (a.sceneIndex === b.sceneIndex) { - return b.subTaskTime > a.subTaskTime ? 1 : -1; - } else { - return b.sceneIndex - a.sceneIndex; - } - } - }); - } else if (prop == 'subTaskTime') { - this.tableData.sort((a, b) => { - if (order == 'ascending') { - return a[prop] > b[prop] ? 1 : -1; - // return dayjs(a).isAfter(dayjs(b)) ? 1 : -1; - } else if (order == 'descending') { - return b[prop] > a[prop] ? 1 : -1; - // return dayjs(b).isAfter(dayjs(a)) ? 1 : -1; - } - }); - } + download() { + // const workbook = XLSX.utils.book_new(); + // const worksheet = XLSX.utils.json_to_sheet(this.tableData); + // XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); + // const excelData = XLSX.write(workbook, { + // bookType: 'xlsx', + // type: 'array' + // }); + // const blob = new Blob([excelData], { + // type: 'application/vnd.openxmlformats-officedocumnet.spreadsheetml.sheet' + // }); + const { locations, scenetype, time } = this.formSearch; + const name = `${locations.dName}${dayjs(time).format( + 'YYYY骞碝M鏈�' + )}鑱斿悎鎵ф硶娓呭崟.xlsx`; + // FileSaver.saveAs(blob, name); + conversionFromTable('fyTable', name) } }, mounted() { diff --git a/src/views/fysp/data-product/ProdSceneReport.vue b/src/views/fysp/data-product/ProdSceneReport.vue index 2f2a140..d9d626d 100644 --- a/src/views/fysp/data-product/ProdSceneReport.vue +++ b/src/views/fysp/data-product/ProdSceneReport.vue @@ -107,6 +107,7 @@ import { ref, computed } from 'vue'; import { $fysp } from '@/api/index'; +import problemApi from '@/api/fysp/problemApi'; import taskApi from '@/api/fysp/taskApi'; import sceneApi from '@/api/fysp/sceneApi'; import deviceApi from '@/api/fysp/deviceApi'; @@ -317,7 +318,7 @@ function fetchProblems(s) { curProList.value = []; - taskApi.getProBySubtask(s.data.stGuid).then((res) => { + problemApi.getProBySubtask(s.data.stGuid).then((res) => { curProList.value = res; // 鐢熸垚宸℃煡鎻忚堪鏂囨湰 -- Gitblit v1.9.3