From 019f1c8bac7e8986d299aff70c123dedc1747d72 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期四, 06 六月 2024 11:15:10 +0800 Subject: [PATCH] - --- jcdm-ui/src/views/main/em/inspectionPlan/index.vue | 298 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 211 insertions(+), 87 deletions(-) diff --git a/jcdm-ui/src/views/main/em/inspectionPlan/index.vue b/jcdm-ui/src/views/main/em/inspectionPlan/index.vue index 5d62c7a..47d0e5f 100644 --- a/jcdm-ui/src/views/main/em/inspectionPlan/index.vue +++ b/jcdm-ui/src/views/main/em/inspectionPlan/index.vue @@ -18,39 +18,27 @@ @keyup.enter.native="handleQuery" /> </el-form-item> -<!-- <el-form-item label="璁″垝绫诲瀷" prop="planType">--> -<!-- <el-select v-model="queryParams.planType" placeholder="璇烽�夋嫨璁″垝绫诲瀷" clearable>--> -<!-- <el-option--> -<!-- v-for="dict in dict.type.${dictType}"--> -<!-- :key="dict.value"--> -<!-- :label="dict.label"--> -<!-- :value="dict.value"--> -<!-- />--> -<!-- </el-select>--> -<!-- </el-form-item>--> - <el-form-item label="鐘舵��" prop="state"> - <el-input - v-model="queryParams.state" - placeholder="璇疯緭鍏ョ姸鎬�" - clearable - @keyup.enter.native="handleQuery" - /> + <el-form-item label="鐘舵��" prop="status"> + <el-select v-model="queryParams.status" placeholder="璇烽�夋嫨鐘舵��" clearable> + <el-option + v-for="dict in dict.type.plan_status" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> </el-form-item> - <el-form-item label="棰戠巼" prop="frequency"> - <el-input - v-model="queryParams.frequency" - placeholder="璇疯緭鍏ラ鐜�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="缁村害" prop="dimension"> - <el-input - v-model="queryParams.dimension" - placeholder="璇疯緭鍏ョ淮搴�" - clearable - @keyup.enter.native="handleQuery" - /> + <el-form-item label-width="130" label="寮�濮嬫椂闂�" prop="startTime"> + <el-date-picker + v-model="queryParams.startTime" + type="datetimerange" + :picker-options="pickerOptions" + value-format="yyyy-MM-dd HH:mm:ss" + range-separator="鑷�" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + align="right"> + </el-date-picker> </el-form-item> <el-form-item style="float: right"> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> @@ -106,26 +94,34 @@ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> - <el-table border v-loading="loading" :data="inspectionPlanList" @selection-change="handleSelectionChange"> + <el-table border v-loading="loading" :data="inspectionPlanList" @selection-change="handleSelectionChange" > <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="ID" align="center" prop="id" /> - <el-table-column label="璁″垝缂栧彿" align="center" prop="planCode"> - </el-table-column> <el-table-column label="璁″垝鍚嶇О" align="center" prop="planName"> </el-table-column> - <el-table-column label="璁″垝绫诲瀷" align="center" prop="planType"> + <el-table-column label="璁″垝缂栧彿" align="center" prop="planCode"> </el-table-column> - <el-table-column label="鐘舵��" align="center" prop="state"> + <el-table-column label="璁″垝绫诲瀷" align="center" prop="planType"> + <template slot-scope="scope"> + <dict-tag :options="dict.type.plan_type" :value="scope.row.planType"/> + </template> </el-table-column> <el-table-column label="棰戠巼" align="center" prop="frequency"> </el-table-column> <el-table-column label="缁村害" align="center" prop="dimension"> - </el-table-column> - <el-table-column label="涓婃鐢熸垚鏃堕棿" align="center" prop="lastGenerationTime"> + <template slot-scope="scope"> + <dict-tag :options="dict.type.dimension" :value="scope.row.dimension"/> + </template> </el-table-column> <el-table-column label="寮�濮嬫椂闂�" align="center" prop="startTime"> </el-table-column> <el-table-column label="缁撴潫鏃堕棿" align="center" prop="endTime"> + </el-table-column> + <el-table-column label="鐘舵��" align="center" prop="state"> + <template slot-scope="scope"> + <dict-tag :options="dict.type.plan_status" :value="scope.row.state"/> + </template> + </el-table-column> + <el-table-column label="涓婃鐢熸垚鏃堕棿" align="center" prop="lastGenerationTime"> </el-table-column> <el-table-column label="澶囨敞" align="center" prop="remarks"> </el-table-column> @@ -136,28 +132,6 @@ <el-table-column label="淇敼鏃堕棿" align="center" prop="updateTime"> </el-table-column> <el-table-column label="淇敼浜�" align="center" prop="updateUser"> - </el-table-column> - <el-table-column fixed="right" width="200" label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="success" - plain - style="width: 72px" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['em:inspectionPlan:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="danger" - plain - style="width: 72px" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['em:inspectionPlan:remove']" - >鍒犻櫎</el-button> - </template> </el-table-column> </el-table> </el-card> @@ -171,61 +145,109 @@ /> <!-- 娣诲姞鎴栦慨鏀圭偣妫�淇濆吇璁″垝瀵硅瘽妗� --> - <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body> + <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="1200px" append-to-body> <span slot="title"> <i class="el-icon-s-order"></i> {{titleName}} </span> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form ref="form" inline :model="form" :rules="rules" label-width="80px" > + <el-form-item label="璁″垝鍚嶇О" prop="planName" > + <el-input style="width: 450px" v-model="form.planName" placeholder="璇疯緭鍏ヨ鍒掑悕绉�" /> + </el-form-item> <el-form-item label="璁″垝缂栧彿" prop="planCode"> - <el-input v-model="form.planCode" placeholder="璇疯緭鍏ヨ鍒掔紪鍙�" /> + <el-input style="width: 450px" v-model="form.planCode" placeholder="璇疯緭鍏ヨ鍒掔紪鍙�" /> </el-form-item> - <el-form-item label="璁″垝鍚嶇О" prop="planName"> - <el-input v-model="form.planName" placeholder="璇疯緭鍏ヨ鍒掑悕绉�" /> - </el-form-item> -<!-- <el-form-item label="璁″垝绫诲瀷" prop="planType">--> -<!-- <el-select v-model="form.planType" placeholder="璇烽�夋嫨璁″垝绫诲瀷">--> -<!-- <el-option--> -<!-- v-for="dict in dict.type.${dictType}"--> -<!-- :key="dict.value"--> -<!-- :label="dict.label"--> -<!-- :value="dict.value"--> -<!-- ></el-option>--> -<!-- </el-select>--> -<!-- </el-form-item>--> <el-form-item label="鐘舵��" prop="state"> - <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> + <el-radio-group style="width: 450px" v-model="form.status"> + <el-radio + v-for="dict in dict.type.plan_status" + :key="dict.value" + :label="dict.value" + >{{dict.label}}</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="璁″垝绫诲瀷" prop="state"> + <el-radio-group style="width: 450px" v-model="form.planType"> + <el-radio + v-for="dict in dict.type.plan_type" + :key="dict.value" + :label="dict.value" + >{{dict.label}}</el-radio> + </el-radio-group> </el-form-item> <el-form-item label="棰戠巼" prop="frequency"> - <el-input v-model="form.frequency" placeholder="璇疯緭鍏ラ鐜�" /> + <el-input style="width: 450px" v-model="form.frequency" placeholder="璇疯緭鍏ラ鐜�" /> </el-form-item> <el-form-item label="缁村害" prop="dimension"> - <el-input v-model="form.dimension" placeholder="璇疯緭鍏ョ淮搴�" /> + <el-select v-model="form.dimension" placeholder="璇烽�夋嫨缁村害" style="width: 450px"> + <el-option + v-for="dict in dict.type.dimension" + :key="dict.value" + :label="dict.label" + :value="dict.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="寮�濮嬫椂闂�" prop="startTime"> + <el-date-picker + style="width: 450px" + clearable + v-model="form.startTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鍑虹珯鏃堕棿"> + </el-date-picker> + </el-form-item> + <el-form-item label="缁撴潫鏃堕棿" prop="endTime"> + <el-date-picker + style="width: 450px" + clearable + v-model="form.endTime" + type="date" + value-format="yyyy-MM-dd" + placeholder="璇烽�夋嫨鍑虹珯鏃堕棿"> + </el-date-picker> </el-form-item> <el-form-item label="澶囨敞" prop="remarks"> - <el-input v-model="form.remarks" placeholder="璇疯緭鍏ュ娉�" /> + <el-input style="width: 1000px" v-model="form.remarks" placeholder="璇疯緭鍏ュ娉�" /> </el-form-item> </el-form> - <div slot="footer" class="dialog-footer"> + <el-tabs type="border-card" > + <el-tab-pane label="璁惧娓呭崟" > + <Checkmachinery ref="machinerylist" :id="form.id" :planCode="form.planCode" @inSelected="onMachineryAdd" ></Checkmachinery> + </el-tab-pane> + <el-tab-pane label="鐐规椤圭洰"> + <Checksubject ref="subjectlist" :id="form.id" @subSelected="subMachineryAdd"></Checksubject> + </el-tab-pane> + </el-tabs> + <el-divider></el-divider> <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> - </div> </el-dialog> </div> </template> <script> import { listInspectionPlan, getInspectionPlan, delInspectionPlan, addInspectionPlan, updateInspectionPlan } from "@/api/main/em/inspectionPlan/inspectionPlan"; +import { listInspectionPlanArchives, delInspectionPlanArchives, addInspectionPlanArchives,getInspectionPlanArchives} from "@/api/main/em/inspectionPlanArchives/inspectionPlanArchives"; +import {listInspectionPlanItems,delInspectionPlanItems,addInspectionPlanItems,getInspectionPlanItems} from "@/api/main/em/inspectionPlanItems/inspectionPlanItems"; +import Checkmachinery from "./machinery.vue" +import Checksubject from "./subject.vue" export default { name: "InspectionPlan", + dicts: ['plan_status','plan_type','dimension'], + components:{Checkmachinery,Checksubject}, + data() { return { // 閬僵灞� loading: true, titleName: "", + optType: null, // 閫変腑鏁扮粍 ids: [], + planCodes: [], // 闈炲崟涓鐢� single: true, // 闈炲涓鐢� @@ -236,6 +258,8 @@ total: 0, // 鐐规淇濆吇璁″垝琛ㄦ牸鏁版嵁 inspectionPlanList: [], + machineryList: [], + subjectList: [], // 寮瑰嚭灞傛爣棰� title: "", // 鏄惁鏄剧ず寮瑰嚭灞� @@ -258,16 +282,81 @@ // 琛ㄥ崟鏍¢獙 rules: { id: [ - { required: true, message: "ID涓嶈兘涓虹┖", trigger: "blur" } + { required: true, message: "id涓嶈兘涓虹┖", trigger: "blur" } ], - } + planName: [ + { required: true, message: "璁″垝鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + planCode: [ + { required: true, message: "璁″垝缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + ], + planType: [ + { required: true, message: "璁″垝绫诲瀷涓嶈兘涓虹┖", trigger: "blur" } + ], + dimension: [ + { required: true, message: "缁村害涓嶈兘涓虹┖", trigger: "blur" } + ], + frequency: [ + { required: true, message: '棰戠巼涓嶈兘涓虹┖', trigger: 'blur' }, + { + validator: (rule, value, callback) => { + if (value === '' || value === undefined || value === null) { + callback(new Error('棰戠巼涓嶈兘涓虹┖')); + } else if (!Number.isInteger(Number(value))) { + callback(new Error('棰戠巼蹇呴』鏄暣鏁�')); + } else { + callback(); + } + }, + trigger: 'blur' + } + ], + }, + pickerOptions: { + shortcuts: [{ + text: '鏈�杩戜竴鍛�', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); + picker.$emit('pick', [start, end]); + }, + class: 'custom-shortcut' // 娣诲姞class灞炴�� + }, { + text: '鏈�杩戜竴涓湀', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit('pick', [start, end]); + }, + class: 'custom-shortcut' // 娣诲姞class灞炴�� + }, { + text: '鏈�杩戜笁涓湀', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); + picker.$emit('pick', [start, end]); + }, + }] + }, }; }, created() { this.getList(); }, methods: { - /** 鏌ヨ鐐规淇濆吇璁″垝鍒楄〃 */ + clearCheckmachineryList(){ + this.$refs.machinerylist.clearCheckmachineryList() + }, + clearSubjectList() { + this.subjectList = []; + }, + clearMachineryList(){ + this.machineryList =[]; + }, + /** 鏌ヨ鐐规淇濆吇璁″垝鍒楄〃 */ getList() { this.loading = true; listInspectionPlan(this.queryParams).then(response => { @@ -280,6 +369,7 @@ cancel() { this.open = false; this.reset(); + this.clearCheckmachineryList() }, // 琛ㄥ崟閲嶇疆 reset() { @@ -308,6 +398,17 @@ }; this.resetForm("form"); }, + + onMachineryAdd(checkmachineryList){ + if(checkmachineryList !=null && checkmachineryList.length >0){ + this.machineryList = checkmachineryList + } + }, + subMachineryAdd(checksubjectList){ + if(checksubjectList !=null && checksubjectList.length >0){ + this.subjectList = checksubjectList + } + }, /** 鎼滅储鎸夐挳鎿嶄綔 */ handleQuery() { this.queryParams.pageNum = 1; @@ -317,18 +418,22 @@ resetQuery() { this.resetForm("queryForm"); this.handleQuery(); + }, // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { this.ids = selection.map(item => item.id) + this.planCode =selection.map(item => item.planCode) this.single = selection.length!==1 this.multiple = !selection.length + console.log(this.planCode) }, /** 鏂板鎸夐挳鎿嶄綔 */ handleAdd() { this.reset(); this.open = true; this.titleName = "娣诲姞鐐规淇濆吇璁″垝"; + console.log(this.machineryList) }, /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { @@ -340,6 +445,20 @@ this.titleName = "淇敼鐐规淇濆吇璁″垝"; }); }, + /** 瀛愯〃娓呭崟鏂板 */ + checkAdd(){ + for (let i = 0; i < this.machineryList.length; i++) { + this.machineryList[i].planCode = this.form.planCode + addInspectionPlanArchives(this.machineryList[i]).then(response =>{ + }); + } + for (let i = 0; i < this.subjectList.length; i++) { + this.subjectList[i].planCode = this.form.planCode + addInspectionPlanItems(this.subjectList[i]).then(response =>{ + }); + } + }, + /** 鎻愪氦鎸夐挳 */ submitForm() { this.$refs["form"].validate(valid => { @@ -350,15 +469,20 @@ this.open = false; this.getList(); }); + this.checkAdd() } else { addInspectionPlan(this.form).then(response => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; this.getList(); }); + this.checkAdd() } } }); + this.clearSubjectList(); + this.clearMachineryList(); + this.clearCheckmachineryList() }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { -- Gitblit v1.9.3