From 80cbda0daa36d369479746ae4f432d0c13a17a56 Mon Sep 17 00:00:00 2001 From: fei <791364011@qq.com> Date: 星期一, 22 九月 2025 08:18:06 +0800 Subject: [PATCH] 修改了代码 --- src/views/archiveManager/index.vue | 139 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 117 insertions(+), 22 deletions(-) diff --git a/src/views/archiveManager/index.vue b/src/views/archiveManager/index.vue index 5087411..73e4d98 100644 --- a/src/views/archiveManager/index.vue +++ b/src/views/archiveManager/index.vue @@ -215,6 +215,49 @@ v-hasPermi="['system:records:export']" >瀵煎嚭</el-button> </el-col> + + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleBatchSubmit" + v-hasPermi="['system:records:export']" + >鎵归噺鎻愪氦</el-button> + </el-col> + + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExportTemplate" + v-hasPermi="['system:materials:edit']" + >瀵煎叆妯℃澘涓嬭浇</el-button> + </el-col> + + <el-col :span="1.5"> + + <el-upload + action="" + + class="upload-demo" + :show-file-list="false" + :http-request="handleImportData" + accept=".xlsx,.xls" + + > + <el-button size="mini" type="primary" + plain + icon="el-icon-top">瀵煎叆</el-button> + + </el-upload> + </el-col> + + + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> @@ -275,7 +318,7 @@ @click="handleCheck(scope.row)" >鏌ョ湅</el-button> <el-button - v-if="userId!==1" + v-if="userId!==1&&scope.row.ownData" size="mini" type="text" @@ -340,7 +383,24 @@ /> </el-select> </el-col> - <el-col :span="6"> + + + <el-col :span="6"> + <el-select + + v-model="form.recordZone" + placeholder="閫夋嫨鍦板尯" + @change="handleRecordTypeChange" + :disabled="userId!=1" > + <el-option + v-for="item in zoneTypeOptions" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-col> + <el-col :span="4"> <el-input v-model="form.recordYear" placeholder="杈撳叆骞翠唤" @@ -350,7 +410,7 @@ @input="generateRecordId" /> </el-col> - <el-col :span="6"> + <el-col :span="4"> <el-input v-model="form.recordSeq" placeholder="鑷姩鐢熸垚" @@ -360,7 +420,7 @@ </el-row> </el-form-item> <el-form-item label="鍙戞枃鍙�" prop="inquiryNumber"> - <el-input v-model="form.inquiryNumber" placeholder="璇疯緭鍏ュ彂闂彿" disabled/> + <el-input v-model="form.inquiryNumber" placeholder="璇疯緭鍏ュ彂鏂囧彿" disabled/> </el-form-item> <el-form-item label="寤鸿椤圭洰鍚嶇О" prop="projectName"> <el-input v-model="form.projectName" placeholder="璇疯緭鍏ュ缓璁鹃」鐩悕绉�" disabled/> @@ -467,22 +527,25 @@ <el-col :span="4"> <el-input v-model="form.recordYear" + @input="generateRecordId" + placeholder="杈撳叆骞翠唤" - @input="generateRecordId" :disabled="userId!=1" /> </el-col> <el-col :span="4"> <el-input v-model="form.recordSeq" - placeholder="鑷姩鐢熸垚" - disabled + :disabled="userId!=1" + @input="generateRecordId" + + placeholder="杈撳叆妗f搴忓彿" /> </el-col> </el-row> </el-form-item> <el-form-item label="鍙戞枃鍙�" prop="inquiryNumber"> - <el-input v-model="form.inquiryNumber" placeholder="璇疯緭鍏ュ彂闂彿" :disabled="userId!=1" + <el-input v-model="form.inquiryNumber" placeholder="璇疯緭鍏ュ彂鏂囧彿" :disabled="userId!=1" /> </el-form-item> <el-form-item label="椤圭洰鍚嶇О" prop="everyProjectName"> @@ -607,10 +670,10 @@ </template> <script> -import { updateStatusById,listRecords,getMaxId, getRecords, delRecords, addRecords, updateRecords } from "@/api/system/records" +import { batchSubmitRecords,updateStatusById,listRecords,getMaxId, getRecords, delRecords, addRecords, updateRecords } from "@/api/system/records" import { listAllCategory } from "@/api/system/category" -import { listName } from "@/api/system/projectName" -import { listPlaceName } from "@/api/system/placeName" +import { listAllProjectName } from "@/api/system/projectName" +import { listPlaceName, listAllPlaceName } from "@/api/system/placeName" export default { name: "Records", data() { @@ -708,7 +771,7 @@ this.userId = this.$store.state.user.id; // 鑾峰彇鐢ㄦ埛瑙掕壊 - this.getId() + // this.getId() this.getRecordTypes() this.getZoneOptions() this.fetchProjectOptions() @@ -731,10 +794,9 @@ async getZoneOptions() { try { - const response = await listPlaceName() - console.log(response) - // alert(134) - this.zoneTypeOptions = response.data.data.map(item => ({ + const response = await listAllPlaceName() + console.log(response.data) + this.zoneTypeOptions = response.data.map(item => ({ value: item.nnumber, label: item.name })) @@ -744,9 +806,9 @@ }, async fetchProjectOptions() { try { - const response = await listName() + const response = await listAllProjectName() console.log(response) - this.projectOptions = response.data.data.map(item => ({ + this.projectOptions = response.data.map(item => ({ value: item.name, label: item.name })) @@ -775,7 +837,7 @@ /** 鐢熸垚妗f鍙� */ generateRecordId() { - if (this.form.recordType && this.form.recordZone && this.form.recordYear) { + if (this.form.recordType && this.form.recordZone && this.form.recordYear && this.form.recordSeq) { // getNextRecordId({ // type: this.form.recordType, @@ -851,7 +913,7 @@ /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd() { this.reset() - this.form.recordSeq = this.maxId + // this.form.recordSeq = this.maxId this.open = true this.vis = false; this.title = "娣诲姞妗f璁板綍" @@ -871,7 +933,7 @@ // handleSubmit(row) { - alert(row.id) + // alert(row.id) var id = row.id updateStatusById(id).then(response=>{ this.$modal.msgSuccess("鎻愪氦鎴愬姛") @@ -900,6 +962,34 @@ } this.open = true this.title = "淇敼妗f璁板綍" + }) + }, + /** 鎵归噺鎻愪氦 */ + handleBatchSubmit() { + // alert(this.ids) + if (this.ids.length === 0) { + this.$modal.msgWarning('璇烽�夋嫨瑕佹彁浜ょ殑妗f璁板綍') + return + } + const myValidIds = this.recordsList + .filter(item => item.ownData === true) + .map(item => item.id); + // 妫�鏌ラ�変腑鐨処D鏄惁鍏ㄩ儴灞炰簬鑷繁 + const invalidIds = this.ids.filter(id => !myValidIds.includes(id)); + + if (invalidIds.length > 0) { + this.$message.error(`鍖呭惈鏃犳潈鎿嶄綔鐨処D: ${invalidIds.join(',')}`); + return false; + } + //濡傛灉id鍏ㄩ儴鏈夋晥鎵嶇户缁彁浜� + batchSubmitRecords( this.ids ).then(response => { + if (response.code === 0) { + this.$modal.msgSuccess('鎵归噺鎻愪氦鎴愬姛') + this.getList() + this.ids = [] + } else { + this.$modal.msgError(response.msg || '鎵归噺鎻愪氦澶辫触') + } }) }, /** 淇敼鎸夐挳鎿嶄綔 */ @@ -936,11 +1026,16 @@ }) } else { console.log(this.form) + addRecords(this.form).then(response => { + console.log(response) + if(response.code==0) + this.$modal.msgError(response.msg) + else{ this.$modal.msgSuccess("鏂板鎴愬姛") this.open = false this.getId() - this.getList() + this.getList()} }) -- Gitblit v1.9.1