From 5208ae16a508a42be2e4b50ef299389fb556a67e Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期日, 28 四月 2024 09:14:18 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/api/platform/calculate-report.js | 21 src/permission.js | 2 vue.config.js | 2 src/api/platform/calculate-rule.js | 8 src/api/platform/contract-score.js | 2 src/views/system/work-order/index.vue | 8 .env.development | 4 src/views/system/result/index.vue | 130 ++++ src/views/login.vue | 6 src/views/system/contract/index.vue | 184 ++++++- src/api/platform/calculate-money-rule.js | 8 src/views/system/result/detail/index1.vue | 194 +++--- .env.production | 3 src/App.vue | 5 src/views/system/calculate/report/index.vue | 242 ++------ src/views/system/score/default/index.vue | 360 ++++++------- src/views/system/report/index.vue | 297 ++++++----- 17 files changed, 820 insertions(+), 656 deletions(-) diff --git a/.env.development b/.env.development index daabaa2..a529b6b 100644 --- a/.env.development +++ b/.env.development @@ -12,3 +12,7 @@ # websocket鍦板潃 VUE_APP_WEB_SOCKET_URL = 'ws://127.0.0.1:8044/ws' + +VUE_APP_FILE_URL = 'http://192.168.3.88:8085' + + diff --git a/.env.production b/.env.production index b796cdc..c9171e4 100644 --- a/.env.production +++ b/.env.production @@ -9,3 +9,6 @@ # websocket鍦板潃 VUE_APP_WEB_SOCKET_URL = 'ws://127.0.0.1:8044/ws' + + +VUE_APP_FILE_URL = 'http://192.168.3.88:8085' \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index b92ea37..4f406b2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,8 +21,11 @@ } }; </script> -<style scoped> +<style> #app .theme-picker { display: none; } +.el-dialog__body { + padding: 10px 20px !important; +} </style> diff --git a/src/api/platform/calculate-money-rule.js b/src/api/platform/calculate-money-rule.js index 025aebd..12285d2 100644 --- a/src/api/platform/calculate-money-rule.js +++ b/src/api/platform/calculate-money-rule.js @@ -9,6 +9,14 @@ }) } +// 鏍规嵁鍚堝悓id鏌ヨ杩濈害瑙勫垯鍒楄〃 +export function getMoneyRulesByContractId(data) { + return request({ + url: '/system/contract/selectMoneyRules?contractId=' + data, + method: 'get' + }) +} + // 鏌ヨ鏍哥畻瑙勫垯璇︾粏 export function getRule(id) { return request({ diff --git a/src/api/platform/calculate-report.js b/src/api/platform/calculate-report.js index dd5da2e..2476358 100644 --- a/src/api/platform/calculate-report.js +++ b/src/api/platform/calculate-report.js @@ -52,10 +52,27 @@ } // 娣诲姞鏍哥畻鎶ュ憡 -export const addCalculateReport = (params) => { +export const addCalculateReport = (data) => { return axios({ url: "/calculate-report/", method: "POST", - data: params + data: data }) } + +// 鍥炲~閲戦 +export const backfill = (data) => { + return axios({ + url: "/calculate-report/backfill/money", + method: "POST", + data: data + }) +} + +// 淇敼鍙戝竷鐘舵�� +export const updatePublishStatus = (data) => { + return axios({ + url: "/calculate-report/status/" + data, + method: "PUT", + }) +} diff --git a/src/api/platform/calculate-rule.js b/src/api/platform/calculate-rule.js index fd72c18..0979320 100644 --- a/src/api/platform/calculate-rule.js +++ b/src/api/platform/calculate-rule.js @@ -17,6 +17,14 @@ }) } +// 鏍规嵁杩愮淮鍗曚綅鏌ヨ杩濈害瑙勫垯鍒楄〃 +export function getRuleListByUnitId(data) { + return request({ + url: '/calculate/rule/getRuleListByUnitId?unitId=' + data, + method: 'get' + }) +} + // 鏌ヨ杩濈害瑙勫垯璇︾粏 export function getRule(id) { return request({ diff --git a/src/api/platform/contract-score.js b/src/api/platform/contract-score.js index d81bd1a..8e111ea 100644 --- a/src/api/platform/contract-score.js +++ b/src/api/platform/contract-score.js @@ -4,7 +4,7 @@ export function listAuditing(data) { return request({ url: '/contract/score/list', - method: 'get', + method: 'post', data: data }) } diff --git a/src/permission.js b/src/permission.js index 5f5442a..45c6285 100644 --- a/src/permission.js +++ b/src/permission.js @@ -8,7 +8,7 @@ NProgress.configure({ showSpinner: false }) -const whiteList = ['/login', '/register','/screen'] +const whiteList = ['/login', '/register'] router.beforeEach((to, from, next) => { NProgress.start() diff --git a/src/views/login.vue b/src/views/login.vue index 623456e..79d950a 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -191,9 +191,9 @@ this.loginInfo = loginInfo.user //濡傛灉杩斿洖涓�1姝e父璺宠浆 if (this.loginInfo.firstLogin == 1) { - this.$router.push({ path: "/" }).catch(() => { }); - return; - this.$router.push({ path: this.redirect || "/" }).catch(() => { }); + // this.$router.push({ path: "/" }).catch(() => { }); + // return; + this.$router.push({ path: this.redirect || "/screen" }).catch(() => { }); } else { localStorage.setItem('firstLogin', 0) } diff --git a/src/views/system/calculate/report/index.vue b/src/views/system/calculate/report/index.vue index 3665b14..df97728 100644 --- a/src/views/system/calculate/report/index.vue +++ b/src/views/system/calculate/report/index.vue @@ -1,54 +1,7 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> - <el-form-item label="鏍哥畻瀵硅薄" prop="checkUnitId"> - <el-input - v-model="queryParams.checkUnitName" - placeholder="璇疯緭鍏ユ牳绠楀璞�" - clearable - @clear="handleQuery" - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鏍哥畻鏃堕棿"> - <el-date-picker - v-model="daterangeCheckTime" - style="width: 240px" - value-format="yyyy-MM-dd HH:mm:ss" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> -<!-- <el-col :span="1.5">--> -<!-- <el-button--> -<!-- type="primary"--> -<!-- plain--> -<!-- icon="el-icon-plus"--> -<!-- size="mini"--> -<!-- @click="handleAdd"--> -<!-- v-hasPermi="['system:checkResult:add']"--> -<!-- >鏂板</el-button>--> -<!-- </el-col>--> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - >鍒犻櫎</el-button> - </el-col> + <el-row style="margin-left: 10px" :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="warning" @@ -56,23 +9,25 @@ icon="el-icon-download" size="mini" @click="handleExport" - >瀵煎嚭</el-button> + >瀵煎嚭鎵�鏈夋暟鎹�</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <el-card class="box-card" v-for="(item) in checkResultList"> <div slot="header" class="clearfix"> - <span>{{ checkUnitName }}</span> + <span>{{ item.unitName }}</span> <el-button style="float: right; padding: 3px 0" type="text" @click="handleDetail(item)">鏍哥畻</el-button> </div> - <div class="text item">鍚堝悓<span class="time">{{ checkUnitName }}</span></div> - <div class="text item">鎵e噺閲戦<span class="time">{{ "10鍏�" }}</span></div> - <div class="text item">鏈�鏂版牳绠楁椂闂� - <span class="time">{{ item.checkTime }}</span> + <div class="text item">鍚堝悓<span class="time">{{ item.contractName }}</span></div> + <div class="text item">鏈�杩戞墸鍑忛噾棰�<span class="time">{{ item.latestDeductMoney }}</span></div> + <div class="text item">绱鎵e噺閲戦<span class="time">{{ item.deductMoney }}</span></div> + <div class="text item">鏈�杩戞牳绠楁湀浠� + <span v-if="item.latestTime" class="time">{{ new Date(item.latestTime).getFullYear() }}骞磠{ new Date(item.latestTime).getMonth() }}鏈�</span> + <span v-else class="time">鏆傛棤</span> </div> - <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-show="item.publish != 1" v-hasPermi="['result:contract:publish']">纭鍙戝竷</el-button> - <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-show="item.publish == 1" v-hasPermi="['result:contract:publish']">宸插彂甯�</el-button> + <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-if="item.status === 'not_publish'" :disabled="!item.canPublish" v-hasPermi="['system:calculate:report:status']">纭鍙戝竷</el-button> + <el-button size="small" round style="float: right;margin-bottom: 18px;" @click="handlePublish(item)" v-if="item.status === 'published'" v-hasPermi="['system:calculate:report:status']">鍙栨秷鍙戝竷</el-button> </el-card> <pagination @@ -84,6 +39,14 @@ /> <el-dialog :title="detailTitle" :visible.sync="detailOpen" width="760px" append-to-body> + <div style="display: flex; flex-direction: row; width: 100%;margin-bottom: 10px; justify-content: center; align-items: center"> + <div style="line-height: 16px">搴旂敤瑙勫垯锛�</div> + <div v-for="ruleItem in detail.ruleList" style="display: flex; margin-right: 50px;"> + <div style="line-height: 16px;margin-right: 10px;display: flex; align-items: center">{{ ruleItem.scoreCondition }}鍒�</div> + <div style="line-height: 16px;max-width: 300px;word-wrap:break-word;word-break:normal;color: #2273b9">{{ ruleItem.description }}</div> + </div> + </div> + <el-descriptions class="margin-top" :column="3" border> <!-- <template slot="extra">--> <!-- <el-button type="primary" size="small">鎿嶄綔</el-button>--> @@ -93,67 +56,53 @@ <i class="el-icon-user"></i> 鏍哥畻瀵硅薄 </template> - {{checkUnitName}} + {{detail.unitName}} </el-descriptions-item> <el-descriptions-item> <template slot="label"> <i class="el-icon-s-management"></i> 鍚堝悓鍚嶇О </template> - {{checkUnitName}} + {{detail.contractName}} </el-descriptions-item> </el-descriptions> <el-table - :data="tableData" + align="center" + :data="detail.recordList" show-summary :summary-method="getSummaries" style="width: 100%;text-align:center"> <el-table-column - prop="time" + prop="createTime" label="鏍哥畻鏃ユ湡" width="180"> </el-table-column> <el-table-column prop="score" label="鑰冩牳鍒嗘暟" - doNotSum > <template slot-scope="scope"> <el-link @click="toScorePage(scope.row)">{{scope.row.score}}</el-link> </template> </el-table-column> <el-table-column - prop="ruleName" - label="閫傜敤瑙勫垯" - doNotSum> - </el-table-column> - <el-table-column - prop="score" - label="鎵e垎绯绘暟" - > - <template slot-scope="scope"> - <el-tooltip class="item" effect="dark" :content="'鑰冩牳瑙勫垯锛�' + scope.row.description" placement="top"> - <span>{{ scope.row.value }}</span> - </el-tooltip> - </template> - </el-table-column> - <el-table-column label="鎵e噺閲戦(鍏�)" - prop="money" + prop="deductMoney" width="180"> <template slot-scope="scope"> - <el-input type="number" + <el-input + :disabled="!scope.row.latest" + type="number" :precision="2" :step="0.1" :min="0" :max="1000000" - v-model="scope.row.money" - disabled + v-model="scope.row.deductMoney" placeholder="璇疯緭鍏ユ墸鍑忛噾棰�"> </el-input> </template> </el-table-column> </el-table> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button type="primary" @click="submitForm">淇� 瀛�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> </div> </el-dialog> @@ -171,33 +120,16 @@ </template> <script> -import { getCalculateReports, getCalculateReportById, deleteCalculateReportByIds, addCalculateReport, editCalculateReport } from "@/api/platform/calculate-report"; +import { getCalculateReports, getCalculateReportById, backfill, updatePublishStatus } from "@/api/platform/calculate-report"; export default { name: "CheckResult", data() { return { + manualOpen: false, detailTitle: '', detailOpen: false, - detail:{ - - }, - checkUnitName:'鎴愰兘x杩愮淮', - tableData: [{ - time: '2024-03-03', - score: '94', - value: '1%', - ruleName: '<95', - money: '10', - description: '姣忓皯1鍒嗘墸褰撴湀鎬绘湇鍔¤垂鐨�1%銆備緥濡傦細褰撴湀鑰冩牳寰楀垎91.5鍒嗭紝鎵i櫎褰撴湀鏈嶅姟璐�3.5%鐨勯噾棰�', - }, { - time: '2024-04-03', - score: '95', - value: '0', - ruleName: '鈮�95', - money: '0', - description: '涓嶆墸娆�', - }, ], + detail:{}, manualScoreOpen: false, manualScoreForm: {}, manualScoreTitle: '', @@ -263,7 +195,7 @@ this.queryParams["end"] = this.daterangeCheckTime[1]; } getCalculateReports(this.queryParams).then(response => { - this.checkResultList = response.rows; + this.checkResultList = response.data; this.total = response.total; this.loading = false; }); @@ -306,21 +238,21 @@ // }) }, handleDetail(row) { - console.log("row", row) - this.detail = row; - this.detail.carOnlineRate = '97%'; - this.detailTitle = this.checkUnitName + '鑰冩牳缁撴灉'; - this.detailOpen = true; - + getCalculateReportById(row.id).then(res => { + this.detail = res.data + this.detailTitle = row.unitName + '鑰冩牳缁撴灉' + this.detailOpen = true + }) }, handlePublish(row) { - let text = row.publish == 1 ? '鍙栨秷鍙戝竷' : '鍙戝竷'; - const ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭' + text + '鑰冩牳缁撴灉缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() { + let text = row.status === 'published' ? '鍙栨秷鍙戝竷' : '鍙戝竷'; + this.$modal.confirm('纭瑕併��' + text + "銆戙��" + row.contractName + "銆戙��" + new Date(row.latestTime).getMonth() + "鏈堛��" + '鐨勬牳绠楁姤鍛婂悧锛�').then(function() { // return publishCheckResult(ids); }).then(() => { - this.getList(); - this.$modal.msgSuccess(text + "鎴愬姛"); + updatePublishStatus(row.id).then(res => { + this.getList(); + this.$modal.msgSuccess(text + "鎴愬姛"); + }) }).catch(() => {}); }, @@ -335,58 +267,24 @@ this.resetForm("queryForm"); this.handleQuery(); }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.id) - this.single = selection.length!==1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞鑰冩牳缁撴灉"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const id = row.id || this.ids - getCalculateReportById(id).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼鑰冩牳缁撴灉"; - }); - }, - /** 鎻愪氦鎸夐挳 */ + /** 鍥炲~閲戦 */ submitForm() { - this.detailOpen = false; - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.id != null) { - editCalculateReport(this.form).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addCalculateReport(this.form).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); + let data = { + id: this.detail.id, + recordList: this.detail.recordList.filter(item => item.latest) + } + if (data.recordList.length > 0) { + backfill(data).then(res => { + if (res.code === 200) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.detailOpen = false; + this.getList(); } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎鑰冩牳缁撴灉缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() { - return deleteCalculateReportByIds(ids); - }).then(() => { - this.getList(); - this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + }) + } else { + this.detailOpen = false; + } + }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -403,6 +301,7 @@ sums[index] = '鍚堣'; return; } + const values = data.map(item => Number(item[column.property])); if (!values.every(value => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { @@ -413,24 +312,27 @@ return prev; } }, 0); - sums[index] += ' 鍏�'; if (column.property === 'score') { - sums[index] = '-'; // 鎴栬�呭叾浠栦綘鎯宠鏄剧ず鐨勫唴瀹� + sums[index] = '-'; } - if (column.property === 'value') { - sums[index] = '-'; // 鎴栬�呭叾浠栦綘鎯宠鏄剧ず鐨勫唴瀹� + if (column.property === 'deductMoney') { + sums[index] += ' 鍏�'; } } else { sums[index] = '-'; } }); - return sums; }, toScorePage() { // 浣跨敤Vue Router杩涜椤甸潰璺宠浆 this.$router.push('/contract/score/index'); }, + + // 鍒犻櫎鎸夐挳 + handleDelete() { + + } } }; </script> @@ -455,6 +357,8 @@ clear: both } .box-card { - width: 480px; + width: calc(33% - 20px); + min-width: 300px; + margin: 15px 10px; } </style> diff --git a/src/views/system/contract/index.vue b/src/views/system/contract/index.vue index f04da84..ec6f212 100644 --- a/src/views/system/contract/index.vue +++ b/src/views/system/contract/index.vue @@ -1,8 +1,8 @@ <template> <div class="app-container"> - <el-row> - <el-col :span="8" v-for="(item) in contractList" :key="item" style="margin: 10px;width: 30%;"> + <el-row v-loading="loading"> + <el-col :span="8" v-for="(item, index) in contractList" :key="index" style="margin: 10px;width: 30%;"> <el-card :body-style="{ padding: '0px' }"> <el-image style="width: 420px;height: 187px;" :preview-src-list="['https://img2.baidu.com/it/u=68398439,1553004927&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=357']" @@ -30,14 +30,26 @@ <!-- 鍚堝悓璇︽儏 --> <el-dialog :title="detailName" :visible.sync="detail" width="800px" append-to-body> <el-form label-position="left" inline class="table-expand"> - <el-collapse v-model="activeNames" @change="handleChange"> + <el-collapse v-model="activeNames"> <el-collapse-item v-for="(item, index) in ruleData" :key="index" :title="item.ruleName" :name="index"> <div class="inline-input-container" v-for="(item, index) in item.children" :key="index"> <b>{{ item.ruleDesc }}</b> <br v-if="item.ruleDesc"/> - <el-tooltip class="item" effect="dark" :content="item.deductCategory + ' ' + item.calcFraction + (item.calcUnit ? '/' + item.calcUnit : '')" placement="top"> - <span>{{ item.ruleCondition }}</span> + <el-tooltip class="item" v-for="(item, index) in item.children" :key="index" effect="dark" :content="item.deductCategory + ' ' + item.calcFraction + (item.calcUnit ? '/' + item.calcUnit : '')" placement="top"> + <span>{{ item.ruleCondition }}<br/></span> <!-- {{ item.deductCategory }} {{ item.calcFraction }}{{ item.calcUnit ? "/" + item.calcUnit : '' }} --> </el-tooltip> + </div> + </el-collapse-item> + <el-collapse-item title="鑰冩牳缁撴灉搴旂敤瑙勫垯" :name="ruleData.length"> + <div class="inline-input-container"> + <span v-for="(item, index) in moneyRules" :key="index"> + <div> + <span>{{ item.scoreCondition }}</span> + <el-tooltip class="item" effect="dark" :content="item.description" placement="top"> + <span style="margin-left: 20px;">{{ item.description }}</span> + </el-tooltip> + </div> + </span> </div> </el-collapse-item> <el-form-item label="鍚堝悓闄勪欢" prop="attachment" class="top"> @@ -52,35 +64,70 @@ </el-dialog> <!-- 鍚堝悓瀵煎叆瀵硅瘽妗� --> - <el-dialog :title="upload.title" :visible.sync="upload.open" width="550px" append-to-body> + <el-dialog :title="upload.title" :visible.sync="upload.open" width="1000px" append-to-body> <el-form ref="form" :model="upload" :rules="rules" label-width="80px"> - <el-form-item label="鍚堝悓鍚嶇О" prop="name"> - <el-input v-model="upload.name" /> - </el-form-item> - <el-form-item label="鍏徃鍚嶇О" prop="unitId"> - <el-select v-model="upload.unitId" placeholder="璇烽�夋嫨"> - <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id"> - </el-option> - </el-select> - </el-form-item> - <el-form-item label="鍚堝悓鏃堕棿" prop="timezone"> - <el-date-picker :disabled="title === '淇敼鍚堝悓鏃堕棿'" @change="dateChange" v-model="upload.timezone" - value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" align="right" unlink-panels range-separator="鑷�" - start-placeholder="寮�濮嬫椂闂�" end-placeholder="缁撴潫鏃堕棿"> - </el-date-picker> - </el-form-item> - <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" - :action="upload.url + '?unitId=' + upload.unitId + '&startTime=' + upload.startTime + '&endTime=' + upload.endTime + '&name=' + upload.name" - :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" - :auto-upload="false" drag style="text-align: center;"> - <i class="el-icon-upload"></i> - <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div> - <div class="el-upload__tip text-center" slot="tip"> - <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span> - <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" - @click="importTemplate">涓嬭浇妯℃澘</el-link> + <el-divider content-position="left">鍚堝悓淇℃伅</el-divider> + <div class="row-warp"> + <div class="row"> + <div class="row-left"> + <div class="block"> + <el-form-item label="鍚堝悓鍚嶇О" prop="name"> + <el-input v-model="upload.name" /> + </el-form-item> + <el-form-item label="鍏徃鍚嶇О" prop="unitId"> + <el-select v-model="upload.unitId" placeholder="璇烽�夋嫨"> + <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鍚堝悓鏃堕棿" prop="timezone"> + <el-date-picker :disabled="title === '淇敼鍚堝悓鏃堕棿'" @change="dateChange" v-model="upload.timezone" + value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" align="right" unlink-panels range-separator="鑷�" + start-placeholder="寮�濮嬫椂闂�" end-placeholder="缁撴潫鏃堕棿"> + </el-date-picker> + </el-form-item> + </div> + </div> + <div class="row-right" style="margin-left: 80px;"> + <div class="margin-5"> + <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" + :action="upload.url" + :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" + :data="upload" + :auto-upload="false" drag style="text-align: center;"> + <i class="el-icon-upload"></i> + <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div> + <div class="el-upload__tip text-center" slot="tip"> + <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span> + <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" + @click="importTemplate">涓嬭浇妯℃澘</el-link> + </div> + </el-upload> + </div> + </div> + </div> </div> - </el-upload> + <el-divider content-position="left">鑰冩牳缁撴灉搴旂敤瑙勫垯</el-divider> + <div class="row-warp"> + <div class="row" v-for="(item, index) in upload.ruleList" :key="index"> + <div class="row-left" style="flex: 0.7;"> + <div class="block"> + <el-form-item label="鑰冩牳鏉′欢" prop="ruleList"> + <el-input v-model="item.scoreCondition" style="width: 250px;" /> + </el-form-item> + </div> + </div> + <div class="row-right"> + <div class="margin-5"> + <el-form-item label="瑙勫垯鎻忚堪" prop="ruleList"> + <el-input type="textarea" v-model="item.description" style="width: 300px;" /> + <el-button style="margin-left: 50px;" type="danger" icon="el-icon-delete" circle @click="deleteRule(index)"></el-button> + </el-form-item> + </div> + </div> + </div> + </div> + <el-button style="margin-left: 50px;" type="success" icon="el-icon-plus" circle @click="addRule"></el-button> </el-form> <div slot="footer" class="dialog-footer"> @@ -95,6 +142,7 @@ <script> import { listContract, getContract, updateContract } from "@/api/platform/contract"; import { getRuleListByContractId } from "../../../api/platform/calculate-rule"; +import { getMoneyRulesByContractId } from "../../../api/platform/calculate-money-rule"; import { unitSelect } from "../../../api/platform/unit"; import { deptSelect } from "../../../api/system/dept"; import { getToken } from "@/utils/auth"; @@ -103,6 +151,7 @@ name: "Contract", data() { return { + loading: false, contractInfo: {}, // 鍚堝悓瀵煎叆鍙傛暟 upload: { @@ -116,6 +165,7 @@ headers: { Authorization: "Bearer " + getToken() }, // 涓婁紶鐨勫湴鍧� url: process.env.VUE_APP_BASE_API + "/system/contract/importData", + ruleList: [], unitId: '', startTime: '', endTime: '' @@ -154,6 +204,7 @@ // 鏄惁鏄剧ず璇︽儏 detail: false, ruleData: [], + moneyRules: [], // 琛ㄥ崟鍙傛暟 form: { }, @@ -167,6 +218,9 @@ ], timezone: [ { type: "array", required: true, message: "鍚堝悓鏃堕棿涓嶈兘涓虹┖", trigger: "change" } + ], + ruleList: [ + { type: "array", required: true, message: "鑰冩牳缁撴灉搴旂敤瑙勫垯涓嶈兘涓虹┖", trigger: "submit" } ] } }; @@ -177,8 +231,18 @@ this.selectDept(); }, methods: { + addRule() { + this.upload.ruleList.push({ + scoreCondition: '', + description: '' + }); + }, + deleteRule(index) { + this.upload.ruleList.splice(index, 1); + }, submitForm() { updateContract(this.form).then(response => { + this.detail = false; if (response.code != 200) { this.$message.error("鎿嶄綔澶辫触"); } else { @@ -217,7 +281,13 @@ let that = this; this.$refs["form"].validate(valid => { if (valid) { - that.$refs.upload.submit(); + that.upload.ruleList = JSON.stringify(this.upload.ruleList); + that.loading = true; + that.upload.open = false; + that.$refs.upload.submit().then(() => { + that.loading = false; + that.reset(); + }); } }) }, @@ -261,6 +331,9 @@ this.form.id = item.id; this.contractInfo = item; }); + getMoneyRulesByContractId(item.id).then(response => { + this.moneyRules = response.data; + }); }, /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd() { @@ -287,6 +360,16 @@ /** 涓嬭浇鎸夐挳鎿嶄綔 */ handleDownload (data) { this.$download.resource(data); + }, + reset () { + this.upload = { + open: false, + name: undefined, + unitId: undefined, + timezone: undefined, + ruleList: [] + }; + this.resetForm("form"); } } }; @@ -345,3 +428,38 @@ margin-top: 10px; } </style> +<style scoped> +.margin-5 { + margin-left: 5px; +} +.row-warp { + display: flex; + flex-direction: column; +} +.row { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + margin: 5px 0; +} +.row-left { + flex: 1; + display: flex; + flex-direction: row; +} +.row-right { + flex: 1; + display: flex; + flex-direction: row; +} +</style> +<style> +.el-cascader-node { + max-width: 300px; +} +.el-divider--horizontal { + margin-top: 50px; + margin-bottom: 50px; +} +</style> diff --git a/src/views/system/report/index.vue b/src/views/system/report/index.vue index f399ce2..3bdc812 100644 --- a/src/views/system/report/index.vue +++ b/src/views/system/report/index.vue @@ -2,41 +2,20 @@ <div class="app-container"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form-item label="杩愮淮浜哄憳" prop="peopleId"> - <el-input - v-model="queryParams.peopleId" - placeholder="杩愮淮浜哄憳濮撳悕" - clearable - @keyup.enter.native="handleQuery" - /> + <el-input v-model="queryParams.peopleId" placeholder="杩愮淮浜哄憳濮撳悕" clearable @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="鐐逛綅" prop="pointId"> - <el-input - v-model="queryParams.pointId" - placeholder="鐐逛綅" - clearable - @keyup.enter.native="handleQuery" - /> + <el-input v-model="queryParams.pointId" placeholder="鐐逛綅" clearable @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="鎶ュ绫诲瀷" prop="reportType"> - <el-select - v-model="queryParams.reportType" - placeholder="鎶ュ绫诲瀷" - clearable - > + <el-select v-model="queryParams.reportType" placeholder="鎶ュ绫诲瀷" clearable> <el-option label="浜嬪墠鎶ュ" value="浜嬪墠鎶ュ" /> <el-option label="浜嬪悗鎶ュ" value="浜嬪悗鎶ュ" /> </el-select> </el-form-item> <el-form-item label="鎶ュ鏃堕棿"> - <el-date-picker - v-model="daterangeCreateTime" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> + <el-date-picker v-model="daterangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" + range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"></el-date-picker> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> @@ -46,61 +25,64 @@ <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:report:add']" - >鏂板</el-button> + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" + v-hasPermi="['system:report:add']">鏂板</el-button> </el-col> -<!-- <el-col :span="1.5">--> -<!-- <el-button--> -<!-- type="success"--> -<!-- plain--> -<!-- icon="el-icon-edit"--> -<!-- size="mini"--> -<!-- :disabled="single"--> -<!-- @click="handleUpdate"--> -<!-- >淇敼</el-button>--> -<!-- </el-col>--> + <!-- <el-col :span="1.5">--> + <!-- <el-button--> + <!-- type="success"--> + <!-- plain--> + <!-- icon="el-icon-edit"--> + <!-- size="mini"--> + <!-- :disabled="single"--> + <!-- @click="handleUpdate"--> + <!-- >淇敼</el-button>--> + <!-- </el-col>--> <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:report:remove']" - >鍒犻櫎</el-button> + <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" + v-hasPermi="['system:report:remove']">鍒犻櫎</el-button> </el-col> <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['system:report:export']" - >瀵煎嚭</el-button> + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" + v-hasPermi="['system:report:export']">瀵煎嚭</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <el-table v-loading="loading" :data="reportList" @selection-change="handleSelectionChange"> + <el-table-column type="expand"> + <template slot-scope="scope"> + <div class="info-container"> + <div class="info-item"> + <div class="info-label">涓婃姤鍐呭</div> + <div class="info-text" v-html="scope.row.reportContent"></div> + </div> + <div class="info-item"> + <div class="info-label">涓婃姤鏉愭枡</div> + <div class="info-list"> + <div class="list-item" v-for="file in formatFileList(scope.row.reportMaterials)" :key="file" @click="showFile(file)"> + <div class="item-icon"> + <i class="el-icon-document"></i> + </div> + <div class="item-text">{{ file }}</div> + </div> + </div> + </div> + </div> + </template> + </el-table-column> <el-table-column type="selection" width="55" align="center" /> <el-table-column label="杩愮淮鍗曚綅" align="center" prop="unitName" /> <el-table-column label="鎶ュ浜哄憳" align="center" prop="peopleName" /> <el-table-column label="鐐逛綅" align="center" prop="pointName" /> <el-table-column label="鎶ュ绫诲瀷" align="center" prop="reportType" /> - <el-table-column label="鎶ュ鍐呭" align="center" prop="reportContent" show-overflow-tooltip="true" /> + <!-- <el-table-column label="鎶ュ鍐呭" align="center" prop="reportContent" show-overflow-tooltip="true" /> <el-table-column label="涓婃姤鏉愭枡" align="center" prop="reportMaterials" show-overflow-tooltip="true"> <template slot-scope="scope"> - <div v-for="(item, index) in scope.row.reportMaterials.split(',')" :key="index">{{ item.substring(item.lastIndexOf("/") + 1) }}</div> + <div v-for="(item, index) in scope.row.reportMaterials.split(',')" :key="index">{{ + item.substring(item.lastIndexOf("/") + 1) }}</div> </template> - </el-table-column> + </el-table-column> --> <el-table-column label="鏁呴殰绫诲瀷" align="center" prop="errorType" /> <el-table-column label="瀹℃牳鏃堕棿" align="center" prop="auditingTime" width="180"> <template slot-scope="scope"> @@ -109,90 +91,57 @@ </el-table-column> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> -<!-- <el-button--> -<!-- size="mini"--> -<!-- type="text"--> -<!-- icon="el-icon-edit"--> -<!-- @click="handleUpdate(scope.row)"--> -<!-- v-hasPermi="['system:report:edit']"--> -<!-- >淇敼</el-button>--> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleAuditing(scope.row)" - v-hasPermi="['system:report:edit']" - v-if="scope.row.status === 0" - >瀹℃牳</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:report:remove']" - >鍒犻櫎</el-button> + <!-- <el-button--> + <!-- size="mini"--> + <!-- type="text"--> + <!-- icon="el-icon-edit"--> + <!-- @click="handleUpdate(scope.row)"--> + <!-- v-hasPermi="['system:report:edit']"--> + <!-- >淇敼</el-button>--> + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAuditing(scope.row)" + v-hasPermi="['system:report:edit']" v-if="scope.row.status === 0">瀹℃牳</el-button> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" + v-hasPermi="['system:report:remove']">鍒犻櫎</el-button> </template> </el-table-column> </el-table> - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" + @pagination="getList" /> <!-- 娣诲姞鎴栦慨鏀规姤澶囧璇濇 --> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="鐐逛綅" prop="pointId"> - <el-select - v-model="form.pointId" - filterable - remote - reserve-keyword - placeholder="璇烽�夋嫨鐐逛綅" - :remote-method="remoteGetPoints" - :loading="selectLoading"> - <el-option - v-for="item in pointList" - :key="item.id" - :label="item.value" - :value="item.id"> + <el-select v-model="form.pointId" filterable remote reserve-keyword placeholder="璇烽�夋嫨鐐逛綅" + :remote-method="remoteGetPoints" :loading="selectLoading"> + <el-option v-for="item in pointList" :key="item.id" :label="item.value" :value="item.id"> </el-option> </el-select> </el-form-item> <el-form-item label="鎶ュ绫诲瀷" prop="reportType"> <el-select v-model="form.reportType"> - <el-option label="浜嬪墠鎶ュ" value="浜嬪墠鎶ュ"/> - <el-option label="浜嬪悗鎶ュ" value="浜嬪悗鎶ュ"/> + <el-option label="浜嬪墠鎶ュ" value="浜嬪墠鎶ュ" /> + <el-option label="浜嬪悗鎶ュ" value="浜嬪悗鎶ュ" /> </el-select> </el-form-item> <el-form-item label="鏁呴殰绫诲瀷" prop="errorType"> <el-select v-model="form.errorType"> - <el-option label="甯傛斂鏂藉伐" value="甯傛斂鏂藉伐"/> - <el-option label="璁惧鏁呴殰" value="璁惧鏁呴殰"/> - <el-option label="璁惧閬楀け" value="璁惧閬楀け"/> + <el-option label="甯傛斂鏂藉伐" value="甯傛斂鏂藉伐" /> + <el-option label="璁惧鏁呴殰" value="璁惧鏁呴殰" /> + <el-option label="璁惧閬楀け" value="璁惧閬楀け" /> </el-select> </el-form-item> <el-form-item label="鎶ュ鏃堕棿" prop="expirTime"> - <el-date-picker - v-model="form.expirTime" - style="width: 240px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - @change="handleExpirTimeChange" - ></el-date-picker> + <el-date-picker v-model="form.expirTime" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" + range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" + @change="handleExpirTimeChange"></el-date-picker> </el-form-item> <el-form-item label="鎶ュ鍐呭" prop="reportContent"> - <editor v-model="form.reportContent" :min-height="192"/> + <editor v-model="form.reportContent" :min-height="192" /> </el-form-item> <el-form-item label="涓婃姤鏉愭枡" prop="reportMaterials"> - <file-upload v-model="form.reportMaterials"/> + <file-upload v-model="form.reportMaterials" /> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> @@ -230,7 +179,10 @@ <el-input type="textarea" v-html="auditingForm.reportContent" disabled /> </el-form-item> <el-form-item label="涓婃姤鏉愭枡"> - <el-link v-for="item in auditingForm.reportMaterials != null ? auditingForm.reportMaterials.split(',') : auditingForm.reportMaterials" :underline="false" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1) }}</el-link> + <el-link + v-for="item in auditingForm.reportMaterials != null ? auditingForm.reportMaterials.split(',') : auditingForm.reportMaterials" + :underline="false" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1) + }}</el-link> </el-form-item> <el-form-item label="瀹℃牳缁撴灉"> <el-radio-group v-model="auditingForm.status"> @@ -239,7 +191,7 @@ </el-radio-group> </el-form-item> <el-form-item label="瀹℃牳鎰忚" prop="suggest"> - <el-input v-model="auditingForm.auditOpinion"/> + <el-input v-model="auditingForm.auditOpinion" /> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> @@ -350,17 +302,17 @@ }, handleAuditing(row) { this.auditingOpen = true; - this.auditingForm.id =row.id - this.auditingForm.pointId =row.pointId - this.auditingForm.pointName =row.pointName - this.auditingForm.unitName =row.unitName - this.auditingForm.peopleName =row.peopleName - this.auditingForm.errorType =row.errorType - this.auditingForm.reportContent =row.reportContent - this.auditingForm.reportType =row.reportType - this.auditingForm.endCreateTime =row.endCreateTime - this.auditingForm.beginCreateTime =row.beginCreateTime - this.auditingForm.reportMaterials =row.reportMaterials + this.auditingForm.id = row.id + this.auditingForm.pointId = row.pointId + this.auditingForm.pointName = row.pointName + this.auditingForm.unitName = row.unitName + this.auditingForm.peopleName = row.peopleName + this.auditingForm.errorType = row.errorType + this.auditingForm.reportContent = row.reportContent + this.auditingForm.reportType = row.reportType + this.auditingForm.endCreateTime = row.endCreateTime + this.auditingForm.beginCreateTime = row.beginCreateTime + this.auditingForm.reportMaterials = row.reportMaterials }, // 杩滅▼鎼滅储鐐逛綅 remoteGetPoints(query) { @@ -433,7 +385,7 @@ // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { this.ids = selection.map(item => item.id) - this.single = selection.length!==1 + this.single = selection.length !== 1 this.multiple = !selection.length }, /** 鏂板鎸夐挳鎿嶄綔 */ @@ -494,12 +446,12 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎鎶ュ缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() { + this.$modal.confirm('鏄惁纭鍒犻櫎鎶ュ缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function () { return delReport(ids); }).then(() => { this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + }).catch(() => { }); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -508,9 +460,74 @@ }, `report_${new Date().getTime()}.xlsx`) }, /** 涓嬭浇鎸夐挳鎿嶄綔 */ - handleDownload (data) { + handleDownload(data) { this.$download.resource(data); + }, + + formatFileList(data) { + if (!data) return []; + return data.split(','); + }, + showFile(filePath) { + console.log(process.env.VUE_APP_FILE_URL + filePath); } } }; </script> + +<style lang="scss" scoped> +.info-container { + width: 100%; + max-height: 400px; + overflow-y: scroll; +} + +.info-item { + display: flex; + margin-bottom: 20px; + + .info-label { + font-size: 14px; + font-weight: bold; + margin-right: 20px; + } + + .info-text { + width: 30%; + padding: 20px; + border-radius: 10px; + border: 1px solid #c0c0c0; + } + + .info-list { + width: 30%; + + .list-item { + width: 100%; + border-radius: 5px; + border: 1px solid #c0c0c0; + padding: 10px 10px; + display: flex; + align-items: center; + margin-bottom: 10px; + cursor: pointer; + + .item-icon { + flex-shrink: 0; + margin-right: 5px; + } + + .item-text { + flex-grow: 1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + &:hover { + border-color: #1890ff; + } + } + } +} +</style> diff --git a/src/views/system/result/detail/index1.vue b/src/views/system/result/detail/index1.vue index 4a9971c..3e3341f 100644 --- a/src/views/system/result/detail/index1.vue +++ b/src/views/system/result/detail/index1.vue @@ -1,9 +1,10 @@ <template> <div style="padding: 0px 10px"> <div> - <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" style="margin-bottom: 10px"> - <el-menu-item index="1">鐪佸巺鑰冩牳</el-menu-item> - <el-menu-item index="2">鍖哄煙鑰冩牳</el-menu-item> + <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" + style="margin-bottom: 10px"> + <el-menu-item index="0">鐪佸巺鑰冩牳</el-menu-item> + <el-menu-item index="1">鍖哄煙鑰冩牳</el-menu-item> </el-menu> </div> @@ -12,6 +13,11 @@ <div class="card-content"> <div class="title-container"> <h1>鑰冩牳鎴愮哗</h1> + <div class="select-container"> + <el-date-picker v-model="date" format="yyyy-MM" value-format="yyyy-MM" type="month" placeholder="閫夋嫨鏃ユ湡" + @change="dateChange"> + </el-date-picker> + </div> </div> <div class="chart-container"> <div id="chartContent" ref="chartContent"></div> @@ -21,49 +27,29 @@ </div> <div style="margin-top: 35px"> - <el-table - :data="tableData" - style="width: 100%"> - <el-table-column - label="鑰冩牳鏃堕棿" - prop="createTime" - align="center"> + <el-table :data="tableData" style="width: 100%" v-loading="loading"> + <el-table-column label="鑰冩牳鏃堕棿" prop="createTime" align="center"> </el-table-column> - <el-table-column - label="鑰冩牳瀵硅薄" - prop="deptId" - align="center"> + <el-table-column label="鑰冩牳瀵硅薄" prop="deptId" align="center"> <template slot-scope="scope"> {{ translateDeptId(scope.row.deptId) }} </template> </el-table-column> - <el-table-column - label="鏍囩" - prop="examineTag" - align="center"> + <el-table-column label="鏍囩" prop="examineTag" align="center"> <template slot-scope="scope"> {{ scope.row.examineTag == 0 ? '鐪佸巺鑰冩牳' : '甯傚眬鑰冩牳' }} </template> </el-table-column> - <el-table-column - label="鑰冩牳绫诲瀷" - prop="examineCategory" - align="center"> + <el-table-column label="鑰冩牳绫诲瀷" prop="examineCategory" align="center"> <template slot-scope="scope"> - <dict-tag :options="dict.type.platform_examine_category" :value="scope.row.examineCategory"/> + <dict-tag :options="dict.type.platform_examine_category" :value="scope.row.examineCategory" /> </template> </el-table-column> - <el-table-column - label="鍒嗘暟" - prop="score" - align="center"> + <el-table-column label="鍒嗘暟" prop="score" align="center"> </el-table-column> - <el-table-column - label="鐘舵��" - prop="publish" - align="center"> + <el-table-column label="鐘舵��" prop="publish" align="center"> </el-table-column> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> @@ -81,14 +67,9 @@ </div> <div style="text-align: right; margin-top: 10px"> - <el-pagination - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - :current-page="currentPage4" - :page-sizes="[5, 10, 20]" - :page-size="5" - layout="total, sizes, prev, pager, next, jumper" - :total="4"> + <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" + :current-page="queryParams.pageNum" :page-sizes="[10, 20, 50]" :page-size="queryParams.pageSize" + layout="total, sizes, prev, pager, next, jumper" :total="tableData.length"> </el-pagination> </div> @@ -96,41 +77,29 @@ </template> <script> -import { listScore, getScore, delScore, addScore, updateScore,publishScore} from "@/api/platform/check-score"; -import { areaSelect } from '@/api/system/dept' +import { listScore, getScore, delScore, addScore, updateScore, publishScore } from "@/api/platform/check-score"; +import { areaSelect } from '@/api/system/dept'; +import { mapState } from 'vuex'; import * as echarts from 'echarts'; let lineChart = null; let observer = null; export default { name: 'index', - dicts: ['platform_examine_use','platform_examine_category'], + dicts: ['platform_examine_use', 'platform_examine_category'], data() { return { - activeIndex: '1', - areaList:[], + activeIndex: '0', + areaList: [], + date: '', dateRange: '', - company: '', queryParams: { pageNum: 1, pageSize: 10, deptId: null, + examinTag:0 }, - dataList: [ - { - name: '鍏ㄩ儴', - complete: { '4.5': 95.5, '4.6': 95.3, '4.7': 96.0, '4.8': 97.2, '4.9': 96.5 , - '4.10': 95.5, '4.11': 95.3, '4.12': 96.0, '4.13': 97.2, '4.14': 96.5 , - '4.15': 95.5, '4.16': 95.3, '4.17': 96.0, '4.18': 97.2, '4.19': 96.5 , - '4.20': 95.5, '4.21': 95.3, '4.22': 96.0, '4.23': 97.2, '4.24': 96.5, - '4.25': 95.5, '4.26': 95.3, '4.27': 96.0, '4.28': 97.2, '4.29': 96.5 - }, - waiting: { '4.5': 94.8, '4.6': 91.3, '4.7': 95.3, '4.8': 92.3, '4.9': 93.3, - '4.10': 94.8, '4.11': 91.3, '4.12': 95.3, '4.13': 92.3, '4.14': 93.3 }, - pending: { '4.5': 91.6, '4.6': 92.6, '4.7': 93.7, '4.8': 94.0, '4.9': 95.9 - ,'4.10': 91.6, '4.11': 92.6, '4.12': 93.7, '4.13': 94.0, '4.14': 95.9 } - } - ], tableData: [], + loading: false, searchForm: { time: null, } @@ -139,11 +108,18 @@ created() { //鑰冩牳鎴愮哗璇︽儏璺宠浆鍙傛暟鎺ユ敹 console.log(this.$route.query.index) - if(this.$route.query.index){ + if (this.$route.query.index) { this.queryParams.deptId = this.$route.query.index } - this.getList(this.$route.query.index); + const date = new Date(); + const year = date.getFullYear(); + const month = (date.getMonth() + 1) >= 10 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1); + this.date = year + '-' + month; + this.queryParams.date = this.date; this.areaSelect(); + }, + computed: { + }, methods: { // 鍖哄煙涓嬫媺鏁版嵁 @@ -157,16 +133,19 @@ return department ? department.value : '鏈煡'; }, /** 瀵艰埅鍒囨崲 */ - handleSelect(key){ - this.activeIndex = key; // 鏇存柊褰撳墠婵�娲荤殑鑿滃崟椤� - this.getList(); + handleSelect(key) { + this.activeIndex = key; + this.queryParams.examinTag = key; + this.getList(this.queryParams.deptId); }, /** 鏌ヨ鑰冩牳妯℃澘鍒楄〃 */ getList(deptId) { this.loading = true; + lineChart.showLoading(); listScore(this.queryParams).then(response => { this.tableData = response.data[deptId]; this.loading = false; + this.initChart(response.data[deptId]); }); }, handleSizeChange(val) { @@ -186,33 +165,14 @@ handleDelete(index, row) { console.log(index, row); }, - initChart() { + initChart(data) { + const dataList = this.groupByData(data); const option = { legend: { right: 'right', top: 'top', icon: 'rect', orient: "vertical", - data: [ - { - name: '杞﹁締鑰冩牳', - itemStyle: { - color: 'rgba(62, 144, 247, 1)' - } - }, - { - name: '浜鸿劯鑰冩牳', - itemStyle: { - color: 'rgba(85, 192, 191, 1)' - } - }, - { - name: '瑙嗛鑰冩牳', - itemStyle: { - color: 'rgba(255, 165, 0, 1)' - } - }, - ], }, grid: { left: 0, @@ -224,7 +184,7 @@ tooltip: {}, xAxis: { type: 'category', - data: Object.keys(this.acitveData.complete), + data: dataList.map((item) => item[0]), }, yAxis: { min: 90, @@ -232,7 +192,7 @@ series: [ { name: '杞﹁締鑰冩牳', - data: Object.entries(this.acitveData.complete).map(([key, value]) => value), + data: this.filterData(dataList, 0), type: 'line', itemStyle: { color: 'rgba(62, 144, 247, 1)' @@ -240,7 +200,7 @@ }, { name: '浜鸿劯鑰冩牳', - data: Object.entries(this.acitveData.waiting).map(([key, value]) => value), + data: this.filterData(dataList, 1), type: 'line', itemStyle: { color: 'rgba(85, 192, 191, 1)' @@ -248,7 +208,7 @@ }, { name: '瑙嗛鑰冩牳', - data: Object.entries(this.acitveData.pending).map(([key, value]) => value), + data: this.filterData(dataList, 2), type: 'line', itemStyle: { color: 'rgba(255, 165, 0, 1)' @@ -257,6 +217,47 @@ ] }; lineChart.setOption(option, true); + lineChart.hideLoading(); + }, + + groupByData(data) { + if (!data) return this.getAllDay().map((item) => [item, []]); + const tempGroup = {}; + data.forEach((item) => { + let { createTime } = item; + let tempTime = createTime.split('-'); + createTime = tempTime[1] + '-' + tempTime[2]; + if (!tempGroup[createTime]) { + tempGroup[createTime] = []; + } + tempGroup[createTime].push(item); + }) + const tempArray = Object.entries(tempGroup).sort(([keyA], [keyB]) => new Date([keyA]) - new Date([keyB])); + return tempArray; + }, + filterData(data, tag) { + const scoreList = data.map((item) => { + let temp = item[1].find((exam) => exam.examineCategory === tag); + if (temp) { + return temp.score; + } else { + return; + } + }); + return scoreList; + }, + + getAllDay() { + const currentDate = this.date.split('-'); + const currentYear = currentDate[0]; + const currentMonth = currentDate[1]; + const daysInMonth = new Date(currentYear, currentMonth, 0).getDate(); + const datesOfMonth = []; + for (var day = 1; day <= daysInMonth; day++) { + const formattedDate = currentMonth + '-' + (day.toString().padStart(2, '0')); + datesOfMonth.push(formattedDate); + } + return datesOfMonth; }, // 鐩戝惉鍙樺寲 @@ -273,14 +274,18 @@ if (lineChart) { lineChart.resize(); } + }, + + dateChange() { + this.queryParams.date = this.date; + console.log(this.queryParams); + this.getList(this.queryParams.deptId); } }, mounted() { - this.acitveData = this.dataList[0]; - this.company = this.acitveData.name; lineChart = echarts.init(this.$refs.chartContent); - this.initChart(); + this.getList(this.$route.query.index); this.observe(); }, beforeDestroy() { @@ -292,6 +297,7 @@ handleSelect(key, keyPath) { console.log(key, keyPath); }, + } </script> @@ -327,7 +333,6 @@ } .chart-container { - width: 100%; height: 100%; @@ -341,5 +346,4 @@ margin: 0 20px; width: 180px; } - </style> diff --git a/src/views/system/result/index.vue b/src/views/system/result/index.vue index 7d4fdc5..c08c57f 100644 --- a/src/views/system/result/index.vue +++ b/src/views/system/result/index.vue @@ -1,7 +1,8 @@ <template> <div id="warp"> <div> - <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" style="margin-bottom: 10px"> + <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" + style="margin-bottom: 10px"> <el-menu-item index="1">鐪佸巺鑰冩牳</el-menu-item> <el-menu-item index="2">甯傚眬鑰冩牳</el-menu-item> </el-menu> @@ -13,9 +14,9 @@ <div class="title-container"> <h1>鑰冩牳鎴愮哗</h1> <div class="select-container"> - <el-date-picker v-model="date" type="date" placeholder="閫夋嫨鏃ユ湡"> - </el-date-picker> - </div> + <el-date-picker v-model="date" type="date" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </div> </div> <div class="echart-container"> <div id="barChart" ref="barChart"></div> @@ -30,12 +31,12 @@ <div class="city-warp"> <div class="city"> <div class="title"> - {{ translateDeptId(parseInt(index)) }} + {{ translateDeptId(parseInt(index)) }} </div> <div class="score-warp"> - <div class="score-item"> + <div class="score-item"> <div style="font-size: 15px; margin-bottom: 15px">{{ formatCreateDate(city[0].createTime) }}</div> - </div> + </div> <div v-for="(score, scoreIndex) in city" :key="scoreIndex"> <div class="score-item"> <div v-if="score.examineCategory == 0">杞﹁締锛�</div> @@ -46,11 +47,7 @@ </div> </div> <div class="bottom-publish"> - <el-button - size="medium" - :type="isAnyUnpublished(city) ? 'success' : 'danger'" - @click="publish(city)" - > + <el-button size="medium" :type="isAnyUnpublished(city) ? 'success' : 'danger'" @click="publish(city)"> {{ isAnyUnpublished(city) ? '鍙戝竷' : '鍙栨秷' }} </el-button> <el-button size="medium" @click="jumpDetail(index)" type="info">璇︽儏</el-button> @@ -66,7 +63,7 @@ <script> import { areaSelect } from '@/api/system/dept'; -import { listScore, getScore, delScore, addScore, updateScore,publishScore} from "@/api/platform/check-score"; +import { listScore, getScore, delScore, addScore, updateScore, publishScore } from "@/api/platform/check-score"; import * as echarts from 'echarts'; let observer = null; let chart = null; @@ -74,12 +71,12 @@ name: 'index', data() { return { - province:{ + province: { id: [], publish: null, }, - checkScoreList:[], - areaList:[], + checkScoreList: [], + areaList: [], activeIndex: '1', activeIndex2: '2', date: '', @@ -168,6 +165,88 @@ } chart.setOption(option, true); }, + + // 璁剧疆chart + setChartOption(data) { + if (!data) return; + const mapData = Object.keys(data).map(key => { + return { + name: this.translateDeptId(parseInt(key)), + data: data[key] + } + }); + const nameArray = mapData.map(item => item.name); + const data1 = this.filterData(mapData, 0); + const data2 = this.filterData(mapData, 1); + const data3 = this.filterData(mapData, 2); + const option = { + grid: { + left: 0, + right: 0, + bottom: 0, + top: '20%', + containLabel: true + }, + legend: { + right: 'right', + top: 'top', + icon: 'rect', + orient: "vertical", + }, + tooltip: {}, + xAxis: { + type: 'category', + axisLabel: { + }, + data: nameArray + }, + yAxis: { + min: 90, + }, + series: [ + { + type: 'bar', + name: '瑙嗛鑰冩牳', + data: data1, + itemStyle: { + color: 'rgba(255, 165, 0, 1)' + } + }, + { + type: 'bar', + name: '浜鸿劯鑰冩牳', + data: data2, + itemStyle: { + color: 'rgba(85, 192, 191, 1)' + } + }, + { + type: 'bar', + name: '杞﹁締鑰冩牳', + data: data3, + itemStyle: { + color: 'rgba(62, 144, 247, 1)' + } + }, + ] + } + chart.setOption(option, true); + }, + filterData(data, tag) { + if (!data) return; + if(!Array.isArray(data)) return; + const tempArray = []; + data.forEach((item) => { + if(item.data.length) { + item.data.forEach((examine) => { + if(examine.examineCategory === tag) { + tempArray.push(examine.score); + } + }) + } + }) + return tempArray; + }, // 鍖哄煙涓嬫媺鏁版嵁 areaSelect() { areaSelect().then(res => { @@ -196,7 +275,7 @@ return `${year}骞�${formattedMonth}鏈�${formattedDay}鍙穈; }, /** 瀵艰埅鍒囨崲 */ - handleSelect(key){ + handleSelect(key) { this.activeIndex = key; // 鏇存柊褰撳墠婵�娲荤殑鑿滃崟椤� this.getList(); }, @@ -223,10 +302,11 @@ this.checkScoreList = response.data; console.log(this.checkScoreList); this.loading = false; + this.setChartOption(this.checkScoreList); }); }, - publish(city){ - let text = this.isAnyUnpublished(city) ? "鍙戝竷":"鍙栨秷鍙戝竷"; + publish(city) { + let text = this.isAnyUnpublished(city) ? "鍙戝竷" : "鍙栨秷鍙戝竷"; const cityName = this.translateDeptId(parseInt(city[0].deptId)); this.province.publish = text === "鍙戝竷" ? "PUBLISHED" : "UNPUBLISHED"; this.province.id = city.map(city => city.id); @@ -246,7 +326,7 @@ } </script> -<style lang = "scss" scoped> +<style lang="scss" scoped> .score-warp { display: flex; flex-direction: column; @@ -254,19 +334,23 @@ align-items: center; color: #797777 } + .score-item { display: flex; flex-direction: row; } + .score { width: 60px; text-align: right; padding: 3px 0; } + #warp { padding: 0 10px; } + .city-warp { display: flex; flex-direction: column; @@ -275,6 +359,7 @@ height: 210px; margin-bottom: 25px; } + .city { width: 240px; height: 100%; @@ -284,15 +369,18 @@ text-align: center; padding: 10px 0px; } + .bottom-publish { width: 100%; position: absolute; bottom: 10px; } + .title { font-size: larger; margin-bottom: 5px; } + .data-chart-container { height: 400px; margin-bottom: 20px; @@ -307,6 +395,7 @@ } } } + .title-container { position: absolute; display: flex; @@ -331,6 +420,7 @@ height: 100%; } } + .select-container { margin: 0 20px; width: 180px; diff --git a/src/views/system/score/default/index.vue b/src/views/system/score/default/index.vue index 126fd5e..538e637 100644 --- a/src/views/system/score/default/index.vue +++ b/src/views/system/score/default/index.vue @@ -3,36 +3,18 @@ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> <el-form-item label="杩愮淮鑰冩牳鍗曚綅" prop="belongUnit"> <el-select v-model="queryParams.unitId" @change="handleQuery" clearable placeholder="杩愮淮鑰冩牳鍗曚綅"> - <el-option - v-for="item in unitList" - :key="item.id" - :label="item.value" - :value="item.id"> + <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id"> </el-option> </el-select> </el-form-item> <el-form-item label="瀹℃牳鏃堕棿"> - <el-date-picker - v-model="daterangeAuditingTime" - style="width: 240px" - value-format="yyyy-MM-dd HH:mm:ss" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> + <el-date-picker v-model="daterangeAuditingTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" + type="daterange" range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"></el-date-picker> </el-form-item> <el-form-item label="鍒涘缓鏃堕棿"> - <el-date-picker - v-model="daterangeCreateTime" - style="width: 240px" - value-format="yyyy-MM-dd HH:mm:ss" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> + <el-date-picker v-model="daterangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" + type="daterange" range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"></el-date-picker> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> @@ -42,119 +24,76 @@ <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:template:add']" - >鏂板</el-button> + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" + v-hasPermi="['platform:score:add']">鏂板</el-button> </el-col> <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['system:template:edit']" - >淇敼</el-button> + <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" + v-hasPermi="['platform:score:edit']">淇敼</el-button> </el-col> <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:template:remove']" - >鍒犻櫎</el-button> + <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" + v-hasPermi="['platform:score:remove']">鍒犻櫎</el-button> </el-col> <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['system:template:export']" - >瀵煎嚭</el-button> + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" + v-hasPermi="['platform:score:export']">瀵煎嚭</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <el-table v-loading="loading" :data="auditingList" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="杩愮淮鑰冩牳鍗曚綅" align="center" prop="unitName" width="180"/> - <el-table-column label="鑰冩牳鍚�" align="center" prop="checkPublishId" width="180"> + <el-table-column label="鑰冩牳鍗曚綅" align="center" prop="unitName" width="180" /> + <el-table-column label="鑰冩牳鍚堝悓" align="center" prop="contractName" width="180" /> + <el-table-column label="鑰冩牳瑙勫垯" align="center" prop="ruleName" width="120" :show-overflow-tooltip="true" /> + <el-table-column label="鑰冩牳鎸囨爣" align="center" prop="num" width="120" /> + <el-table-column label="鑰冩牳鎵e垎" align="center" prop="score" width="120" /> + <el-table-column label="鍒涘缓浜�" align="center" prop="createUser" /> + <el-table-column label="瀹℃牳鐘舵��" align="center" prop="auditingStatus"> <template slot-scope="scope"> - <div v-if="scope.row.checkPublishId === 5">瑙嗛鑰冩牳</div> + <el-tag + :type="scope.row.auditingStatus === '閫氳繃' ? 'success' : scope.row.auditingStatus === '鏈�氳繃' ? 'danger' : 'primary'" + disable-transitions>{{ scope.row.auditingStatus }}</el-tag> </template> </el-table-column> - <el-table-column label="杩愮淮鑰冩牳瑙勫垯" align="center" prop="defaultRuleName" width="180" /> - <el-table-column label="杩愮淮鑰冩牳鎵e垎" align="center" prop="score" width="120" /> - <el-table-column label="鍒涘缓浜�" align="center" prop="createBy" /> - <el-table-column label="瀹℃牳浜�" align="center" prop="auditingUserName" /> - <el-table-column label="瀹℃牳鐘舵��" align="center" prop="auditingStatus" /> - <el-table-column label="瀹℃牳璇存槑" align="center" prop="remark" width="180"/> - <el-table-column label="瀹℃牳鏃堕棿" align="center" prop="auditingTime" width="180"/> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"/> + <el-table-column label="瀹℃牳浜�" align="center" prop="auditingUser" /> <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width"> <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-s-check" - @click="handleAuditing(scope.row)" - v-hasPermi="['default:audit']" - >瀹℃牳</el-button> -<!-- <el-button--> -<!-- size="mini"--> -<!-- type="text"--> -<!-- icon="el-icon-edit"--> -<!-- @click="handleUpdate(scope.row)"--> -<!-- v-hasPermi="['system:auditing:edit']"--> -<!-- >淇敼</el-button>--> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - >鍒犻櫎</el-button> + <el-button size="mini" type="text" icon="el-icon-s-check" @click="handleAuditing(scope.row)" + v-hasPermi="['default:audit']" v-if="scope.row.auditingStatus === '寰呭鏍�'">瀹℃牳</el-button> + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" + v-if="scope.row.auditingStatus === '寰呭鏍�'" v-hasPermi="['system:auditing:edit']">淇敼</el-button> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button> </template> </el-table-column> </el-table> - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" + @pagination="getList" /> <!-- 瀹℃牳 --> <el-dialog title="杩愮淮鑰冩牳瀹℃牳" :visible.sync="auditingOpen" width="500px" append-to-body> <el-form ref="auditingForm" :model="auditingForm" :rules="auditingRules" label-width="120px"> <el-form-item label="杩愮淮鑰冩牳鍗曚綅"> - <el-input v-model="auditingForm.unitName" disabled/> + <el-input v-model="auditingForm.unitName" disabled /> </el-form-item> <el-form-item label="杩愮淮鑰冩牳瑙勫垯"> - <el-input v-model="auditingForm.defaultRuleName" disabled/> + <el-input v-model="auditingForm.ruleName" type="textarea" autosize disabled /> + </el-form-item> + <el-form-item label="杩愮淮鑰冩牳鎸囨爣"> + <el-input v-model="auditingForm.num" disabled /> </el-form-item> <el-form-item label="杩愮淮鑰冩牳鎵e垎"> - <el-input v-model="auditingForm.score" disabled/> + <el-input v-model="auditingForm.score" disabled /> </el-form-item> <el-form-item label="瀹℃牳缁撴灉" prop="auditingStatus"> - <el-radio v-model="auditingForm.auditingResult" label="pass">閫氳繃</el-radio> - <el-radio v-model="auditingForm.auditingResult" label="return">椹冲洖</el-radio> + <el-radio v-model="auditingForm.auditingStatus" label="閫氳繃">閫氳繃</el-radio> + <el-radio v-model="auditingForm.auditingStatus" label="鏈�氳繃">椹冲洖</el-radio> </el-form-item> <el-form-item label="瀹℃牳璇存槑" prop="remark"> - <el-input v-model="auditingForm.remark" type="textarea" show-word-limit maxlength="100"/> + <el-input v-model="auditingForm.remark" type="textarea" show-word-limit maxlength="100" /> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> @@ -164,63 +103,46 @@ </el-dialog> <!-- 鏂板鎴栦慨鏀� --> - <el-dialog title="杩愮淮绉垎瀹℃牳" :visible.sync="open" width="700px"append-to-body> - <el-form ref="auditingForm" :model="auditingForm" :rules="auditingRules" label-width="120px"> - <el-form-item label="杩愮淮鑰冩牳鍗曚綅" prop="unitName"> - <el-select v-model="form.unitNameList" placeholder="杩愮淮鑰冩牳鍗曚綅"> - <el-option - v-for="item in unitNameList" - :key="item.id" - :label="item.value" - :value="item.id"> + <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="120px"> + <el-form-item label="杩愮淮鑰冩牳鍗曚綅" prop="unitId"> + <el-select v-model="form.unitId" placeholder="杩愮淮鑰冩牳鍗曚綅" @change="handleChangeUnit"> + <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id"> </el-option> </el-select> </el-form-item> - <el-form-item label="鑰冩牳鍚�" prop="examineId"> - <el-select v-model="form.examineId" placeholder="鑰冩牳鍚�" > - <el-option - v-for="item in examineList" - :key="item.id" - :label="item.value" - :value="item.id"> - </el-option> - </el-select> - </el-form-item> - <el-form-item label="杩愮淮鑰冩牳瑙勫垯" prop="tempRuleFormList"> + <el-form-item label="杩愮淮鑰冩牳瑙勫垯" prop="ruleIdsArray"> <div class="row-warp"> - <div class="row" v-for="(form) in tempRuleFormList"> + <div class="row"> <div class="row-left"> - <div>瑙勫垯</div> <div class="block"> <span class="demonstration"></span> - <el-cascader - v-model="value" - :options="options" - :props = "props" - @change="handleChange"></el-cascader> + <el-cascader ref="cascader" v-model="form.ruleIdsArray" :options="options" @change="handleChange"> + <template slot-scope="{ data }"> + <el-tooltip class="item" :disabled="data.label.length < 16 && !data.deductCategory" effect="dark" + :content="data.label.length < 16 ? data.deductCategory ? data.deductCategory + ' ' + data.calcFraction + (data.calcUnit ? '/' + data.calcUnit : '') : '' : (data.deductCategory ? data.label + ' ' + data.deductCategory + ' ' + data.calcFraction + (data.calcUnit ? '/' + data.calcUnit : '') : data.label)" + placement="left"> + <span>{{ data.label }}</span> + </el-tooltip> + </template> + </el-cascader> </div> </div> - <div class="row-right"> + <div class="row-right" v-if="needNum"> <div>鎸囨爣</div> <div class="margin-5"> - <el-input type="number" v-model="form.weight"/> + <el-input placeholder="璇疯緭鍏�" v-model="form.num" @input="handleChangeNum" /> </div> </div> - <div class="item-op"> - <el-button @click="removeRule(form)" type="danger" icon="el-icon-delete" circle></el-button> - </div> - </div> - <div style="margin-top: 25px"> - <el-button type="success" @click="nextAdd" size="mini" plain>娣诲姞</el-button> </div> </div> </el-form-item> - <el-form-item label="杩愮淮鑰冩牳鎵e垎" style="width: 20%"> - <el-input v-model="auditingForm.score"></el-input> + <el-form-item label="杩愮淮鑰冩牳鎵e垎" style="width: 51%" prop="score"> + <el-input v-model="form.score"></el-input> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitAuditing">纭� 瀹�</el-button> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> </div> </el-dialog> @@ -228,44 +150,24 @@ </template> <script> -import { listAuditing, getAuditing, delAuditing, addAuditing, updateAuditing,auditing } from "@/api/platform/contract-score"; +import { listAuditing, getAuditing, delAuditing, addAuditing, updateAuditing, auditing } from "@/api/platform/contract-score"; import { unitSelect } from "@/api/platform/unit"; +import { getRuleListByUnitId, getRule } from "@/api/platform/calculate-rule"; export default { name: "Auditing", data() { return { - options: [{ - value: 'city', - label: '鍓嶇鎰熺煡婧愭不鐞嗗伐浣�', - children: [{ - value: 'fushun', - label: '鏃堕挓鍚屾', - }, { - value: 'rong', - label: 'OSD鏍囪瘑鏈慨澶�', - }, { - value: 'rong', - label: '涓�鏈轰竴妗d笉鍚堟牸', - } - ] - }, - ], + needNum: false, + options: [], auditingOpen: false, auditingForm: {}, unitList: [], - unitNameList: [ - {id:2 , value:"鎴愰兘x杩愮淮"} - ], // 鑰冩牳妯℃澘 examineList: [ - {id:1 , value:"杞﹁締鑰冩牳"}, - {id:2 , value:"瑙嗛鑰冩牳"} + { id: 1, value: "杞﹁締鑰冩牳" }, + { id: 2, value: "瑙嗛鑰冩牳" } ], - // 涓存椂瑙勫垯琛ㄥ崟 - tempRuleForm: {}, - // 涓存椂瑙勫垯琛ㄥ崟鍒楄〃 - tempRuleFormList: [{"ruleId": null, "adjustCoefficient": null}], // 閬僵灞� loading: true, // 閫変腑鏁扮粍 @@ -293,20 +195,45 @@ queryParams: { pageNum: 1, pageSize: 10, - defaultId: null, + unitId: null, auditingStatus: null, auditingTime: null, auditingUser: null, createTime: null, }, // 琛ㄥ崟鍙傛暟 - form: {}, + form: { + score: '', + temp: '' + }, // 琛ㄥ崟鏍¢獙 auditingRules: { auditingStatus: [ - { required: true, message: "璇峰厛瀹屾垚瀹℃牳缁撴灉", trigger: "blur" } + { required: true, message: "璇峰厛瀹屾垚瀹℃牳缁撴灉", trigger: "blur", }, + { + validator: (rule, value, callback) => { + if (value === '寰呭鏍�') { + callback(new Error("璇峰厛瀹屾垚瀹℃牳缁撴灉")); + } else { + callback(); + } + }, + trigger: 'blur' + } ], - } + }, + rules: { + unitId: [ + { required: true, message: "璇烽�夋嫨杩愮淮鑰冩牳鍗曚綅", trigger: "blur" } + ], + ruleIdsArray: [ + { required: true, message: "璇烽�夋嫨杩愮淮鑰冩牳瑙勫垯", trigger: "blur" } + ], + score: [ + { required: true, message: "鍒嗘暟涓嶈兘涓虹┖", trigger: "blur" } + ] + }, + calcObj: {} }; }, created() { @@ -314,8 +241,51 @@ this.getUnitSelect(); }, methods: { - handleChange(value) { - console.log(value); + /** + * 閫夋嫨瑙勫垯 + */ + handleChange() { + let item = this.$refs['cascader'].getCheckedNodes()[0].data; + this.calcObj = item; + this.form.contractId = item.contractId; + if (item.deductCategory == "鎵f寚瀹氬垎鏁�") { + this.needNum = false; + this.form.score = item.calcFraction; + } else { + this.needNum = true; + this.form.score = ''; + } + if (this.form.num != null && this.needNum) { + this.handleChangeNum(); + } + }, + /** + * 杈撳叆鎸囨爣 + */ + handleChangeNum() { + if (this.calcObj.deductCategory == "鍒嗘暟涔樹互鏁伴噺") { + this.form.score = Math.floor(this.calcObj.calcFraction * this.form.num * 100) / 100; + } else if (this.calcObj.deductCategory == "闄や互鏁伴噺鍚庝箻浠ュ垎鏁�") { + this.form.score = Math.floor(Math.ceil(this.form.num / this.calcObj.calcUnit) * this.calcObj.calcFraction * 100) / 100; + } + }, + + handleChangeUnit(value) { + getRuleListByUnitId(value).then((res) => { + this.options = this.getTreeData(res.data); + }) + }, + getTreeData(data) { + for (var i = 0; i < data.length; i++) { + if (data[i].children.length < 1) { + // children鑻ヤ负绌烘暟缁勶紝鍒欏皢children璁句负undefined + data[i].children = undefined; + } else { + // children鑻ヤ笉涓虹┖鏁扮粍锛屽垯缁х画 閫掑綊璋冪敤 鏈柟娉� + this.getTreeData(data[i].children); + } + } + return data; }, // 鎻愪氦瀹℃牳 submitAuditing() { @@ -336,8 +306,7 @@ // 鎵撳紑瀹℃牳 handleAuditing(row) { this.auditingOpen = true; - this.auditingForm = row; - this.auditingForm.auditingStatus = this.auditingForm.auditingStatus ? this.auditingForm.auditingStatus : null + this.auditingForm = { ...row }; }, // 鍏抽棴瀹℃牳 closeAuditing() { @@ -363,8 +332,9 @@ this.queryParams["createStartTime"] = this.daterangeCreateTime[0]; this.queryParams["createEndTime"] = this.daterangeCreateTime[1]; } + console.log("this.queryParams", this.queryParams) listAuditing(this.queryParams).then(response => { - this.auditingList = response.data; + this.auditingList = response.rows; this.total = response.total; this.loading = false; }); @@ -379,20 +349,16 @@ reset() { this.form = { id: null, - defaultId: null, auditingStatus: null, remark: null, auditingTime: null, auditingUser: null, - createTime: null, - updateTime: null, - deleted: null + score: '' }; this.resetForm("form"); }, /** 鎼滅储鎸夐挳鎿嶄綔 */ handleQuery() { - this.queryParams.pageNum = 1; this.getList(); }, /** 閲嶇疆鎸夐挳鎿嶄綔 */ @@ -405,7 +371,7 @@ // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { this.ids = selection.map(item => item.id) - this.single = selection.length!==1 + this.single = selection.length !== 1 this.multiple = !selection.length }, /** 鏂板鎸夐挳鎿嶄綔 */ @@ -418,14 +384,26 @@ handleUpdate(row) { this.reset(); const id = row.id || this.ids + if (row.auditingStatus != '寰呭鏍�') { + this.$message.warning("璇ヨ褰曞凡瀹℃牳锛屼笉鑳戒慨鏀�"); + return; + } getAuditing(id).then(response => { - this.form = response.data; + this.form = { ...response.data }; this.open = true; - this.title = "淇敼杩愮淮鑰冩牳瀹℃牳"; + this.title = "淇敼杩愮淮鑰冩牳绉垎"; + this.handleChangeUnit(this.form.unitId); + getRule(this.form.ruleId).then(res => { + this.calcObj = res.data; + if (this.calcObj.deductCategory != "鎵f寚瀹氬垎鏁�") { + this.needNum = true; + } + }) }); }, /** 鎻愪氦鎸夐挳 */ submitForm() { + this.form.ruleId = this.calcObj.id; this.$refs["form"].validate(valid => { if (valid) { if (this.form.id != null) { @@ -447,18 +425,18 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎杩愮淮鑰冩牳瀹℃牳缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() { + this.$modal.confirm('鏄惁纭鍒犻櫎杩愮淮鑰冩牳瀹℃牳缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function () { return delAuditing(ids); }).then(() => { this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + }).catch(() => { }); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { - this.download('/default-auditing/export', { + this.download('/contract/score/export', { ...this.queryParams - }, `auditing_${new Date().getTime()}.xlsx`) + }, `鍚堝悓鑰冩牳绉垎_${new Date().getTime()}.xlsx`) } } }; @@ -467,10 +445,12 @@ .margin-5 { margin-left: 5px; } + .row-warp { display: flex; flex-direction: column; } + .row { display: flex; flex-direction: row; @@ -478,15 +458,21 @@ justify-content: center; margin: 5px 0; } + .row-left { flex: 1; display: flex; flex-direction: row; } + .row-right { flex: 1; display: flex; flex-direction: row; } </style> - +<style> +.el-cascader-node { + max-width: 300px; +} +</style> \ No newline at end of file diff --git a/src/views/system/work-order/index.vue b/src/views/system/work-order/index.vue index f558e8b..401bf4b 100644 --- a/src/views/system/work-order/index.vue +++ b/src/views/system/work-order/index.vue @@ -43,11 +43,11 @@ </el-form-item> </el-form> - <el-row> - <el-col :span="8" v-for="item in workOrderList" :key="item" style="width: 390px;margin-left: 40px;margin-top:20px;"> - <el-card :body-style="{ padding: '0px' }"> + <el-row :gutter="20"> + <el-col :xl="6" :lg="8" :md="12" :sm="24" v-for="item in workOrderList" :key="item" style="margin-bottom: 20px;"> + <el-card :body-style="{ padding: '0px',display: 'flex' }"> <el-image :preview-src-list="['https://img2.baidu.com/it/u=68398439,1553004927&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=357']" fit="cover" src="https://img2.baidu.com/it/u=68398439,1553004927&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=357" class="image"/> - <div style="padding-right: 10px;padding-top: 10px;float: right;"> + <div style="padding-right: 10px;padding-top: 10px;"> <el-row> <el-col :span="24" class="time">鏁呴殰绫诲瀷锛�<el-tag size="small" type="danger">甯傛斂鏂藉伐</el-tag></el-col> </el-row> diff --git a/vue.config.js b/vue.config.js index 3cda444..4d77887 100644 --- a/vue.config.js +++ b/vue.config.js @@ -36,7 +36,9 @@ // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { target: `http://localhost:8080`, + // target: `http://192.168.3.64:8080`, // target: `http://192.168.3.87:8080`, + // target: `http://192.168.3.88:8085`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' -- Gitblit v1.8.0