From 80740c17e5c742d8de2d7b2c7493ebc7704ead4e Mon Sep 17 00:00:00 2001 From: yuyu <1981343953@qq.com> Date: 星期二, 15 八月 2023 17:15:26 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.110.209:9001/r/lims-before --- src/views/CNAS/reviewAnnualPlan/index.vue | 632 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 630 insertions(+), 2 deletions(-) diff --git a/src/views/CNAS/reviewAnnualPlan/index.vue b/src/views/CNAS/reviewAnnualPlan/index.vue index 183ba06..e99d7f6 100644 --- a/src/views/CNAS/reviewAnnualPlan/index.vue +++ b/src/views/CNAS/reviewAnnualPlan/index.vue @@ -1,5 +1,633 @@ <template> - <div> - 瀹℃牳骞村害璁″垝 + <div class="content-main"> + <div class="top-bar"> + <el-form ref="form" :inline="true"> + <el-form-item> + <el-date-picker + v-model="input" + class="input-form" + type="month" + placeholder="璇烽�夋嫨鏌ヨ鏃ユ湡" + > + </el-date-picker> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="getData()">鏌ヨ</el-button> + <el-button type="primary" plain @click="resetData()">閲嶇疆</el-button> + </el-form-item> + </el-form> + <el-form class="rightBtn"> + <!-- 涓婁紶闄勪欢 --> + <el-form-item class="createBtn"> + <el-button + type="primary" + icon="el-icon-upload2" + @click=" + dialogFormVisible1 = true; + uploading = {}; + resetForm('uploading'); + " + >涓婁紶闄勪欢</el-button + > + <el-dialog + title="涓婁紶闄勪欢" + :visible.sync="dialogFormVisible1" + width="30%" + > + <el-form :model="uploading" :rules="rules1" ref="uploading"> + <el-form-item + label="瀹℃牳鏃ユ湡:" + :label-width="formLabelWidth1" + prop="auditTime" + style="margin-bottom: 20px" + > + <el-date-picker + class="uploading-form" + v-model="uploading.auditTime" + type="date" + placeholder="璇烽�夋嫨鏃ユ湡" + autocomplete="off" + > + </el-date-picker> + </el-form-item> + <el-form-item + prop="accessoryFile" + label="涓婁紶闄勪欢:" + :label-width="formLabelWidth1" + > + <el-input + class="uploading-form" + v-model="uploading.accessoryFile" + autocomplete="off" + placeholder="璇烽�夋嫨鏂囦欢" + ></el-input> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="dialogFormVisible1 = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitUp('uploading')" + >纭� 瀹�</el-button + > + </div> + </el-dialog> + </el-form-item> + <!-- 鏂板璁″垝 --> + <el-form-item class="createBtn"> + <el-button + type="primary" + icon="el-icon-document-add" + @click=" + dialogFormVisible2 = true; + newly = {}; + resetForm('newly'); + " + >鏂板璁″垝</el-button + > + + <el-dialog + title="鏂板璁″垝" + :visible.sync="dialogFormVisible2" + width="55%" + > + <el-form :model="newly" :rules="rules2" ref="newly"> + <!-- 绗竴琛� --> + <el-row class="newly-margin-bottom"> + <el-col :span="12"> + <el-form-item + label="璁″垝鏃堕棿:" + :label-width="formLabelWidth2" + prop="planTime" + > + <el-date-picker + class="newly-form" + v-model="newly.planTime" + type="date" + placeholder="璇烽�夋嫨璁″垝鏃ユ湡" + autocomplete="off" + > + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label="閮ㄩ棬:" + :label-width="formLabelWidth2" + prop="department" + > + <el-input + class="newly-form" + v-model="newly.department" + placeholder="璇烽�夋嫨閮ㄩ棬" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + </el-row> + <!-- 绗簩琛� --> + <el-row class="newly-margin-bottom"> + <el-col :span="12"> + <el-form-item + label="鎬ц川:" + :label-width="formLabelWidth2" + prop="auditType" + > + <el-select + class="newly-form" + v-model="newly.auditType" + placeholder="璇烽�夋嫨鎬ц川" + autocomplete="off" + > + <el-option label="鍐呭" value="0"></el-option> + <el-option label="绠$悊璇勫" value="1"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label="瀹℃牳鐩殑:" + :label-width="formLabelWidth2" + prop="auditPurpose" + > + <el-input + class="newly-form" + v-model="newly.auditPurpose" + placeholder="璇疯緭鍏ュ鏍哥洰鐨�" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + </el-row> + <!-- 绗笁琛� --> + <el-row class="newly-margin-bottom"> + <el-col :span="12"> + <el-form-item + label="瀹℃牳缁勯暱:" + :label-width="formLabelWidth2" + prop="auditLeader" + > + <el-input + class="newly-form" + v-model="newly.auditLeader" + placeholder="璇疯緭鍏ュ鏍哥粍闀�" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label="瀹℃牳鑼冨洿:" + :label-width="formLabelWidth2" + prop="auditScope" + > + <el-input + class="newly-form" + v-model="newly.auditScope" + placeholder="璇疯緭鍏ュ鏍歌寖鍥�" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + </el-row> + <!-- 绗洓琛� --> + <el-row class="newly-margin-bottom"> + <el-col :span="12"> + <el-form-item + label="缁勫憳:" + :label-width="formLabelWidth2" + prop="auditEmp" + > + <el-input + class="newly-form" + v-model="newly.auditEmp" + placeholder="璇疯緭鍏ョ粍鍛�" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label="瀹℃牳渚濇嵁:" + :label-width="formLabelWidth2" + prop="auditPursuant" + > + <el-input + class="newly-form" + v-model="newly.auditPursuant" + placeholder="璇疯緭鍏ュ鏍镐緷鎹�" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + </el-row> + <!-- 绗簲琛� --> + <el-row class="newly-margin-bottom"> + <el-col :span="12"> + <el-form-item + label="缂栧埗浜�:" + :label-width="formLabelWidth2" + prop="writeUser" + > + <el-input + class="newly-form" + v-model="newly.writeUser" + placeholder="璇疯緭鍏ョ紪鍒朵汉" + autocomplete="off" + ></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item + label="瀹℃牳鏃ユ湡:" + :label-width="formLabelWidth2" + > + <el-date-picker + class="newly-form" + v-model="newly.auditTime" + type="date" + placeholder="璇烽�夋嫨瀹℃牳鏃ユ湡" + autocomplete="off" + > + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="dialogFormVisible2 = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitAddData('newly')" + >纭� 瀹�</el-button + > + </div> + </el-dialog> + </el-form-item> + <!-- 瀵煎嚭骞村害璁″垝 --> + <el-form-item class="createBtn"> + <el-button type="primary" icon="el-icon-document-checked" + >瀵煎嚭骞村害璁″垝</el-button + > + </el-form-item> + <el-form-item class="createBtn"> + <el-button type="primary" icon="el-icon-document-checked" + >瀵煎嚭鍐呴儴瀹炴柦璁″垝</el-button + > + </el-form-item> + </el-form> </div> + <div class="library-table"> + <div class="table-box"> + <el-table + ref="auditTable" + border + :max-height="800" + :cell-style="{ textAlign: 'center' }" + :header-cell-style="{ + border: '0px', + background: '#f5f7fa', + color: '#606266', + boxShadow: 'inset 0 1px 0 #ebeef5', + textAlign: 'center', + }" + :data="auditTable" + style="width: 100%" + > + <el-table-column type="index" label="搴忓彿" min-width="30px"> + <template> + <el-checkbox type="checkbox" /> + </template> + </el-table-column> + <el-table-column prop="year" label="骞村害" min-width="60px" /> + <el-table-column prop="month" label="鏈堝害" min-width="60px" /> + <el-table-column prop="planTime" label="璁″垝鏃堕棿" min-width="100px" /> + <el-table-column prop="auditType" label="鎬ц川" min-width="80px"> + <template slot-scope="scope"> + <span> + {{ scope.row.auditType == 0 ? "鍐呭" : "绠$悊璇勫" }} + </span> + </template> + </el-table-column> + <el-table-column prop="department" label="閮ㄩ棬" min-width="80px" /> + <el-table-column + prop="auditLeader" + label="瀹℃牳缁勯暱" + min-width="80px" + /> + <el-table-column prop="auditEmp" label="缁勫憳" min-width="80px" /> + <el-table-column + prop="auditPurpose" + label="瀹℃牳鐩殑" + min-width="100px" + /> + <el-table-column + prop="auditScope" + label="瀹℃牳鑼冨洿" + min-width="100px" + /> + <el-table-column + prop="auditPursuant" + label="瀹℃牳渚濇嵁" + min-width="100px" + /> + <el-table-column prop="writeUser" label="缂栧埗浜�" min-width="80px" /> + <el-table-column prop="createTime" label="缂栧埗鏃ユ湡" min-width="100px"> + </el-table-column> + <el-table-column prop="keyboarder" label="褰曞叆浜�" min-width="80px" /> + <el-table-column prop="checker" label="妫�楠屼汉" min-width="80px" /> + <el-table-column + prop="auditTime" + label="瀹℃牳鏃ユ湡" + min-width="100px" + /> + <el-table-column prop="count" label="涓嶇鍚堥」鐩暟" min-width="60px" /> + <el-table-column prop="auditState" label="鐘舵��" min-width="100px"> + <template slot-scope="scope"> + <div v-if="scope.row.auditState === 0"> + <el-tag class="tag-item" type="warning">鍗冲皢寮�濮�</el-tag> + </div> + <div v-else-if="scope.row.auditState === 1"> + <el-tag class="tag-item" type="success">瀹屾垚</el-tag> + </div> + <div v-else> + <el-tag class="tag-item" type="danger">閫炬湡</el-tag> + </div> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" min-width="100" fixed="right"> + <template slot-scope="scope"> + <el-button type="text" size="small">鏌ョ湅</el-button> + <el-button + type="text" + size="small" + @click="deleteClick(scope.row.id)" + >鍒犻櫎</el-button + > + </template> + </el-table-column> + </el-table> + <!-- 鍒嗛〉鍣� --> + <div> + <el-pagination + :current-page="page" + :page-sizes="[10, 20, 30, 40]" + :page-size="pageSize" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + /> + </div> + </div> + </div> + </div> </template> + +<script> +import { + selectAllList, + addCnasAnnualPlan, + addAccessory, + deleteCnasAnnualPlan, +} from "@/api/CNAS/reviewAnnualPlan"; +import { P } from "af-table-column"; +export default { + data() { + return { + input: "", + auditTable: [], + page: 1, + total: 0, + pageSize: 10, + dialogFormVisible1: false, + dialogFormVisible2: false, + formLabelWidth1: "80px", + formLabelWidth2: "80px", + //涓婁紶闄勪欢鍙傛暟 + uploading: { + auditTime: "", + //====================鏂囦欢涓婁紶杩樻病鍋�,姝ゅ鏄簲鏄枃浠跺弬鏁�,鏆傛椂杩樻槸鏂囨湰 + accessoryFile: "", + }, + rules1: { + auditTime: [ + { + type: "date", + required: true, + message: "璇烽�夋嫨鏃ユ湡", + trigger: "blur", + }, + ], + accessoryFile: [ + { required: true, message: "璇疯緭鍏ユ椿鍔ㄥ悕绉�", trigger: "blur" }, + { min: 3, max: 5, message: "闀垮害鍦� 3 鍒� 5 涓瓧绗�", trigger: "blur" }, + ], + }, + //鏂板璁″垝瀵硅薄 + newly: { + planTime: "", + auditType: "", + department: "", + auditPurpose: "", + auditLeader: "", + auditEmp: "", + auditPursuant: "", + auditScope: "", + writeUser: "", + auditTime: "", + }, + rules2: { + planTime: [ + { + type: "date", + required: true, + message: "璇烽�夋嫨鏃ユ湡", + trigger: "blur", + }, + ], + auditType: [ + { required: true, message: "璇烽�夋嫨鎬ц川", trigger: "change" }, + ], + department: [ + { required: true, message: "璇疯緭鍏ラ儴闂�", trigger: "blur" }, + { min: 1, max: 25, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + auditPurpose: [ + { required: true, message: "璇疯緭鍏ュ鏍哥洰鐨�", trigger: "blur" }, + { min: 1, max: 25, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + auditLeader: [ + { required: true, message: "璇疯緭鍏ュ鏍哥粍闀�", trigger: "blur" }, + { min: 1, max: 25, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + auditEmp: [ + { required: true, message: "璇疯緭鍏ョ粍鍛�", trigger: "blur" }, + { min: 1, max: 25, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + auditPursuant: [ + { required: true, message: "璇疯緭鍏ュ鏍镐緷鎹�", trigger: "blur" }, + { min: 1, max: 25, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + auditScope: [ + { required: true, message: "璇疯緭鍏ュ鏍歌寖鍥�", trigger: "blur" }, + { min: 1, max: 5, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + writeUser: [ + { required: true, message: "璇疯緭鍏ョ紪鍒朵汉", trigger: "blur" }, + { min: 1, max: 25, message: "瀛楁暟杩囬暱", trigger: "blur" }, + ], + }, + }; + }, + created() { + this.getData(); + }, + methods: { + //====================================================涓婁紶闄勪欢 + //涓婁紶闄勪欢瀛楁纭 + submitUp(uploading) { + this.$refs[uploading].validate((valid) => { + if (!valid) { + return false; + } else { + // this.upData(); + } + }); + }, + // //涓婁紶闄勪欢 + // async upData() { + // try { + // const res = await addAccessory(this.uploading); + // console.log(res); + // } catch (error) { + // this.$message.error("娣诲姞澶辫触"); + // } + // this.resetData(); + // this.dialogFormVisible1 = false; + // }, + + //鏂板璁″垝瀛楁纭 + submitAddData(newly) { + this.$refs[newly].validate((valid) => { + if (!valid) { + return false; + } else { + this.addData(); + } + }); + }, + //鏂板璁″垝 + async addData() { + try { + const res = await deleteCnasAnnualPlan(this.newly); + } catch (error) { + this.$message.error("娣诲姞澶辫触"); + } + this.getData(); + this.dialogFormVisible2 = false; + }, + // 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣 + handleSizeChange(val) { + console.log(`姣忛〉 ${val} 鏉); + this.pageSize = val; + this.getData(); + }, + // 褰撳墠椤垫敼鍙樻椂瑙﹀彂 璺宠浆鍏朵粬椤� + handleCurrentChange(val) { + console.log(`褰撳墠椤�: ${val}`); + this.page = val; + this.getData(); + }, + // 閲嶇疆鎸夐挳 + resetData() { + this.input = undefined; + this.page = 1; + this.pageSize = 10; + this.getData(); + }, + // 鏌ヨ鍒楄〃 + async getData() { + const params = { + page: this.page, + pageSize: this.pageSize, + planTime: this.input ? this.input : undefined, + }; + const { data } = await selectAllList(params); + this.auditTable = data.row; + this.total = data.total; + }, + async deleteOneData(planId) { + await deleteCnasAnnualPlan({ planId: planId }); + this.getData(); + console.log(planId); + }, + + deleteClick(planId) { + this.$confirm("纭鍒犻櫎?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + }).then(() => { + this.deleteOneData(planId); + }); + }, + //閲嶇疆琛ㄥ崟 + resetForm(formName) { + this.$refs[formName].resetFields(); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.top-bar { + margin: -25px -15px; + background: #fff; + display: flex; + justify-content: space-between; + padding: 5px 24px 0px 24px; + .input-form { + width: 400px; + } + .uploading-form { + // margin-bottom: 20px; + width: 400px; + } + .newly-form { + // margin-bottom: 20px; + width: 400px; + } + .newly-margin-bottom { + margin-bottom: 23px; + } +} + +.library-table { + background-color: #fff; + flex: 1; + margin: 0px -15px; + margin-top: 40px; + display: flex; + flex-direction: column; + + .table-box { + padding: 0px 20px; + margin-top: 20px; + flex: 1; + background: #fff; + display: flex; + flex-direction: column; + > div:nth-child(2) { + display: flex; + justify-content: end; + margin: 10px 0; + } + .tag-item { + width: 80px; + } + } +} +.rightBtn { + display: flex; + justify-content: flex-end; +} +.createBtn { + margin-left: 10px; +} +</style> -- Gitblit v1.9.3