From 0b9a9b4aa3051565b213b9efcb5e02ecbda0e791 Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期一, 04 九月 2023 15:22:35 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.73.113:9001/r/lims-before --- src/views/CNAS/satisfactionSurveys/index.vue | 553 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 551 insertions(+), 2 deletions(-) diff --git a/src/views/CNAS/satisfactionSurveys/index.vue b/src/views/CNAS/satisfactionSurveys/index.vue index 0888772..98bf3c6 100644 --- a/src/views/CNAS/satisfactionSurveys/index.vue +++ b/src/views/CNAS/satisfactionSurveys/index.vue @@ -1,5 +1,554 @@ <template> - <div> - 婊℃剰搴﹁皟鏌� + <div class="content-main survey"> + <div class="top-bar"> + <el-form ref="form" style="width: 1000px;" :inline="true"> + <!-- <el-input v-model="input" class="input-form" placeholder="璇风洿鎺ヨ緭鍏ユ牱寮忕紪鍙�/鏍峰搧鍚嶇О/鍨嬪彿瑙勬牸/杩涜鎼滅储鎴栦笅鎷夐�夋嫨杩涜缁勫悎鏌ヨ" + @keyup.enter.native="getData" /> --> + <el-form-item style="width: 800px;"> + <el-col style="display: flex; justify-content: space-around;" :span="12"> + <el-row>璋冩煡鏃ユ湡:</el-row> + <el-row style="width: 300px;"> + <el-date-picker style="width: 270px;" class="newly-form" v-model="surveyDate" type="date" + placeholder="璇烽�夋嫨璋冩煡鏃ユ湡" autocomplete="off"> + </el-date-picker> + </el-row> + </el-col> + <el-col style="display: flex; justify-content: space-around;" :span="12"> + <el-row>褰曞叆鏃ユ湡:</el-row> + <el-row style="width: 300px;"> + <el-date-picker style="width: 270px;" class="newly-form" v-model="entryDate" type="date" + placeholder="璇烽�夋嫨褰曞叆鏃ユ湡" autocomplete="off"> + </el-date-picker> + </el-row> + </el-col> + </el-form-item> + <el-form-item> + <el-button type="primary" size="small" @click="getData()">鏌ヨ</el-button> + <el-button type="primary" size="small" plain @click="resetData()">娓呯┖</el-button> + </el-form-item> + </el-form> + <el-form> + <el-button size="40" @click="getFillName()" icon="el-icon-document-add" type="primary">鏂板璁板綍</el-button> + </el-form> </div> + <div class="library-table"> + <div class="table-box"> + <el-table ref="tableData" :max-height="800" :cell-style="{ textAlign: 'left' }" + :header-cell-style="{ border: '0px', background: '#f5f7fa', color: '#606266', boxShadow: 'inset 0 1px 0 #ebeef5', textAlign: 'left' }" + :data="tableData" style="width: 100%"> + <el-table-column prop="id" type="index" label="搴忓彿" min-width="20%"/> + <el-table-column prop="surveyDate" label="璋冩煡鏃ユ湡" min-width="10%" /> + <el-table-column prop="userUnit" label="瀹㈡埛鍗曚綅鍚嶇О" min-width="10%" /> + <el-table-column prop="projectName" label="椤圭洰鍚嶇О" min-width="10%" /> + <el-table-column prop="fillName" label="濉〃浜哄鍚�" min-width="10%" /> + <el-table-column prop="post" label="鑱屼綅" min-width="10%" /> + <el-table-column prop="telephone" label="鑱旂郴鐢佃瘽" min-width="10%" /> + <el-table-column prop="userName" label="褰曞叆浜�" min-width="10%" /> + <el-table-column label="闄勪欢" min-width="10%"> + <template slot-scope="scope"> + <a style="color: #3894d1;" @click="look(scope.row.id)">鏌ョ湅闄勪欢</a> + </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> + <el-dialog title="婊℃剰搴﹁皟鏌�" :visible.sync="dialogVisible" width="50%"> + <table class="table" style="width: 100%;"> + <tr> + <td> </td> + <td>婊℃剰</td> + <td>涓�鑸�</td> + <td>涓嶆弧鎰�</td> + <td>寤鸿</td> + </tr> + <tr> + <td>鏈嶅姟鎬佸害</td> + <td><el-radio v-model="serviceAttitude" label="0"><span hidden>婊℃剰</span></el-radio></td> + <td><el-radio v-model="serviceAttitude" label="1"><span hidden>涓�鑸�</span> </el-radio></td> + <td><el-radio v-model="serviceAttitude" label="2"><span hidden>涓嶆弧鎰�</span></el-radio></td> + <td><el-input v-model="serviceAttitudeInput" placeholder="璇疯緭鍏ュ唴瀹�"></el-input></td> + </tr> + <tr> + <td>鎶�鏈兘鍔�</td> + <td><el-radio v-model="technicalPower" label="0"><span hidden>婊℃剰</span></el-radio></td> + <td><el-radio v-model="technicalPower" label="1"><span hidden>涓�鑸�</span> </el-radio></td> + <td><el-radio v-model="technicalPower" label="2"><span hidden>涓嶆弧鎰�</span></el-radio></td> + <td><el-input v-model="technicalPowerInput" placeholder="璇疯緭鍏ュ唴瀹�"></el-input></td> + </tr> + <tr> + <td>妫�娴嬪伐浣�</td> + <td><el-radio v-model="testJob" label="0"><span hidden>婊℃剰</span></el-radio></td> + <td><el-radio v-model="testJob" label="1"><span hidden>涓�鑸�</span> </el-radio></td> + <td><el-radio v-model="testJob" label="2"><span hidden>涓嶆弧鎰�</span></el-radio></td> + <td><el-input v-model="testJobInput" placeholder="璇疯緭鍏ュ唴瀹�"></el-input></td> + </tr> + <tr> + <td>鏀惰垂鍚堢悊鎬�</td> + <td><el-radio v-model="reasonableCharge" label="0"><span hidden>婊℃剰</span></el-radio></td> + <td><el-radio v-model="reasonableCharge" label="1"><span hidden>涓�鑸�</span> </el-radio></td> + <td><el-radio v-model="reasonableCharge" label="2"><span hidden>涓嶆弧鎰�</span></el-radio></td> + <td><el-input v-model="reasonableChargeInput" placeholder="璇疯緭鍏ュ唴瀹�"></el-input></td> + </tr> + <tr> + <td>鏀硅繘瑕佹眰</td> + <td colspan="4"> + <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="璇疯緭鍏ュ唴瀹�" + v-model="improvementRequirements"> + </el-input> + </td> + </tr> + <tr> + <td>鍏朵粬琛ュ厖</td> + <td colspan="4"> + <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="璇疯緭鍏ュ唴瀹�" + v-model="otherSupplements"> + </el-input> + </td> + </tr> + </table> + <!-- <span slot="footer" class="dialog-footer"> + <el-button @click="dialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="dialogVisible = false">纭� 瀹�</el-button> + </span> --> + </el-dialog> + <el-dialog title="鏂板婊℃剰搴﹁皟鏌ヨ褰�" :visible.sync="dialogVisible2" width="50%"> + <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> + <el-row> + <el-col :span="12"> + <el-form-item label="璋冩煡鏃ユ湡锛�" prop="surveyDate"> + <el-date-picker style="width: 200px;" class="newly-form" v-model="ruleForm.surveyDate" type="date" + placeholder="璇烽�夋嫨璋冩煡鏃ユ湡" autocomplete="off"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="瀹㈡埛鍗曚綅锛�" prop="userUnit"> + <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ鎴峰崟浣嶅悕绉�" v-model="ruleForm.userUnit"></el-input> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="椤圭洰鍚嶇О锛�" prop="projectName"> + <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ラ」鐩悕绉�" v-model="ruleForm.projectName"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="telephone"> + <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" v-model="ruleForm.telephone"></el-input> + </el-form-item> + </el-col> + </el-row> + <!-- 濉〃浜哄鍚� --> + <el-row> + <el-col :span="12"> + <el-form-item label="濉〃浜哄鍚嶏細" prop="fillName"> + <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ~琛ㄤ汉濮撳悕" v-model="ruleForm.fillName"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鑱屼綅锛�" prop="post"> + <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ヨ亴浣�" v-model="ruleForm.post"></el-input> + </el-form-item> + </el-col> + </el-row> + <!-- 鑱旂郴鐢佃瘽/褰曞叆鏃ユ湡 --> + <el-row> + <el-col :span="12"> + <el-form-item label="褰曞叆浜猴細" prop="userName"> + <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ綍鍏ヤ汉濮撳悕" v-model="ruleForm.userName"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate"> + <el-date-picker style="width: 200px;" class="newly-form" v-model="ruleForm.entryDate" type="date" + placeholder="璇烽�夋嫨褰曞叆鏃ユ湡" autocomplete="off"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + <el-row> + <el-col :span="12"> + <el-form-item label="闄勪欢涓婁紶锛�"> + <el-upload class="upload-demo" :action="path" :on-preview="handlePreview" :on-remove="handleRemove" multiple + :limit="1" :on-exceed="handleExceed" :file-list="fileList" :on-success="handleSuccess" + :before-upload="beforeAvatarUpload"> + <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + </el-row> + <!-- 鎻愪氦 --> + <el-row> + <el-col :span="24" style="display: flex;justify-content: center;"> + <el-form-item> + <el-button @click="resetForm('ruleForm')">鍙栨秷</el-button> + <el-button type="primary" @click="submitForm('ruleForm')">淇濆瓨</el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </el-dialog> + </div> </template> + +<script> +import { get, post } from '@/api/util/requestUtil'; +import urlInfo from '../../../api/urlEnum/satisfactionSurveys.js' +export default { + data() { + return { + input: '', + tableData: [], + page: 1, + total: 0, + pageSize: 10, + entryDate: null, + surveyDate: null, + id: 0, + dialogVisible: false, + serviceAttitude: 3, + serviceAttitudeInput: "鏃�", + technicalPower: 3, + technicalPowerInput: "鏃�", + testJob: 3, + testJobInput: "鏃�", + reasonableCharge: 3, + reasonableChargeInput: "鏃�", + otherSupplements: "鏃�", + improvementRequirements: "鏃�", + dialogVisible2: false, + path: 'http://localhost:1234/cnasSatisfactionSurvey/uploadFile', + ruleForm: { + surveyDate: '', + userUnit: '', + projectName: '', + fillName: '', + post: '', + userId: '', + telephone: '', + entryDate: '', + userName: '', + serviceAttitude: '', + technicalPower: '', + testJob: '', + reasonableCharge: '', + improvementRequirements: '', + otherSupplements: '' + }, + rules: { + surveyDate: [ + { type: 'date', required: true, message: '璇烽�夋嫨璋冩煡鏃ユ湡', trigger: 'change' } + ], + userUnit: [ + { required: true, message: '璇疯緭鍏ュ鎴峰崟浣嶅悕绉�', trigger: 'blur' }, + ], + projectName: [ + { required: true, message: '璇疯緭鍏ラ」鐩悕绉�', trigger: 'blur' } + ], + entryDate: [ + { type: 'date', required: true, message: '璇烽�夋嫨褰曞叆鏃ユ湡', trigger: 'change' } + ], + telephone: [ + { required: true, message: '璇疯緭鍏ヨ仈绯荤數璇�', trigger: 'blur' } + ] + }, + fileList: [], + } + }, + created() { + // this.path=process.env.VUE_APP_BASE_API+"cnasSatisfactionSurvey/uploadFile" + }, + mounted() { + this.getData() + }, + methods: { + handleCurrentChange() { + this.getData(); + }, + look(id) { + console.log(id); + let str = "/$"; + this.dialogVisible = true + let data = this.tableData.filter(res => { + return res.id == id + })[0] + let serviceAttitudeInfo = data.serviceAttitude.split(str); + this.serviceAttitude = serviceAttitudeInfo[0] + this.serviceAttitudeInput = serviceAttitudeInfo[1] + let technicalPowerInfo = data.technicalPower.split(str) + this.technicalPower = technicalPowerInfo[0] + this.technicalPowerInput = technicalPowerInfo[1] + let testJobInfo = data.testJob.split(str) + this.testJob = testJobInfo[0] + this.testJobInput = testJobInfo[1] + let reasonableChargeInfo = data.reasonableCharge.split(str) + this.reasonableCharge = reasonableChargeInfo[0] + this.reasonableChargeInput = reasonableChargeInfo[1] + this.otherSupplements = data.otherSupplements + this.improvementRequirements = data.improvementRequirements + }, + handleSizeChange() { + + }, + exportData() { + + }, + // 閲嶇疆鎸夐挳 + resetData() { + this.page = 1 + this.pageSize = 10 + this.surveyDate = null + this.entryDate = null + this.getData() + }, + async getData() { + let param = { + "currentPage": this.page, + 'pageNum': this.pageSize, + "surveyDate": this.surveyDate, + "entryDate": this.entryDate + } + if (this.surveyDate != null) { + param.surveyDate = this.dateFormat(this.surveyDate); + } + if (this.entryDate !== null) { + param.entryDate = this.dateFormat(this.entryDate); + } + let res = await get(urlInfo.url.getCnasSatisfactionSurvey, param) + this.tableData = res.data.cnasSatisfactionSurveyList + this.total = res.data.total + }, + async getFillName() { + this.dialogVisible2 = true + let res = await get(urlInfo.url.getFillNameAndId) + this.ruleForm.userName = res.data.name + this.ruleForm.userId = res.data.id + var now = new Date(); + this.ruleForm.entryDate = now + }, + async submitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + this.add(); + } else { + console.log('error submit!!'); + return false; + } + }); + }, + async add() { + let data = JSON.parse(JSON.stringify(this.ruleForm)) + let entryDate = this.format(this.ruleForm.entryDate); + let surveyDate = this.format(this.ruleForm.surveyDate); + data.entryDate = entryDate + data.surveyDate = surveyDate + // data.dateInfo = dateInfo + let add = await post(urlInfo.url.addSurvey, data); + if (add) { + this.$message({ + message: '娣诲姞鎴愬姛', + type: 'success' + }); + this.fileList = [] + this.$refs["ruleForm"].resetFields(); + let res = await get(urlInfo.url.getFillNameAndId) + this.ruleForm.userName = res.data.name + this.ruleForm.id = res.data.id + var now = new Date(); + this.ruleForm.entryDate = now + this.getData() + } else { + this.$message.error('娣诲姞澶辫触锛佽妫�鏌ュ唴瀹�'); + } + }, + resetForm(formName) { + this.dialogVisible2 = false + this.fileList = [] + this.$refs[formName].resetFields(); + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + handlePreview(file) { + console.log(file); + }, + handleExceed(files, fileList) { + this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠讹紝鍏遍�夋嫨浜� ${files.length + fileList.length} 涓枃浠禶); + }, + // beforeRemove(file, fileList) { + // return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋); + // }, + handleSuccess(response, file, fileList) { + let data = response.data; + if (this.ruleForm.userUnit == '') { + this.ruleForm.userUnit = data.unitName + } + if (this.ruleForm.projectName == '') { + this.ruleForm.projectName = data.projectName + } + if (this.ruleForm.post === '') { + this.ruleForm.post = data.post + } + if (this.ruleForm.fillName == '') { + this.ruleForm.fillName = data.fillName.split("/")[0] + } + if (this.ruleForm.telephone == '') { + this.ruleForm.telephone = data.telephone + } + if(this.ruleForm.surveyDate==null||this.ruleForm.surveyDate==''){ + let dates = new Date(data.fillName.split("/")[1]); + console.log(dates); + if(dates!=''&&dates!=''){ + this.ruleForm.surveyDate=dates + } + } + this.ruleForm.serviceAttitude = data.serviceAttitude + this.ruleForm.technicalPower = data.technicalPower + this.ruleForm.testJob = data.testJob + this.ruleForm.improvementRequirements = data.improvementRequirements + this.ruleForm.otherSupplements = data.otherSupplements + this.ruleForm.reasonableCharge=data.reasonableCharge + }, + beforeAvatarUpload(file) { + let split = file.name.split("."); + let fileName = split[split.length - 1]; + const isWord = fileName == 'doc' || fileName == 'docx'; + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isWord) { + this.$message.error('涓婁紶word鏂囦欢鍙兘鏄� doc/docx 鏍煎紡!'); + } + if (!isLt2M) { + this.$message.error('涓婁紶word鏂囦欢澶у皬涓嶈兘瓒呰繃 2MB!'); + } + return isWord && isLt2M; + }, + dateFormat(longTypeDate) { + var dateTypeDate = ""; + var date = new Date(); + date.setTime(longTypeDate); + dateTypeDate += date.getFullYear(); //骞� + dateTypeDate += "-" + this.getMonth(date); //鏈� + dateTypeDate += "-" + this.getDay(date); //鏃� + return dateTypeDate; + }, + //杩斿洖 01-12 鐨勬湀浠藉�� + getMonth(date) { + var month = ""; + month = date.getMonth() + 1; //getMonth()寰楀埌鐨勬湀浠芥槸0-11 + if (month < 10) { + month = "0" + month; + } + return month; + }, + //杩斿洖01-30鐨勬棩鏈� + getDay(date) { + var day = ""; + day = date.getDate(); + if (day < 10) { + day = "0" + day; + } + return day; + }, + datetimeFormat(longTypeDate) { + var dateTypeDate = ""; + var date = new Date(); + date.setTime(longTypeDate); + dateTypeDate += date.getFullYear(); //骞� + dateTypeDate += "-" + this.getMonth(date); //鏈� + dateTypeDate += "-" + this.getDay(date); //鏃� + return dateTypeDate; + }, + format(d) { + var y = d.getFullYear(); + var m = d.getMonth() + 1; + if (m < 10) { + m = "0" + m; + } + var day = d.getDate(); + if (day < 10) { + day = "0" + day; + } + return y + "-" + m + "-" + day; + } + } +} +</script> + +<style lang="scss" scoped> +.content-main { + .el-form .el-form-item .el-form-item__content { + width: 100% !important; + } + + .top-bar { + margin: -25px -15px; + background: #fff; + display: flex; + justify-content: space-between; + padding: 5px 24px 0px 24px; + + .input-form { + width: 800px; + } + + .el-dropdown-link { + cursor: pointer; + color: #409EFF !important; + } + + .el-icon-arrow-down { + font-size: 12px !important; + } + + + } + + .library-table { + background-color: #fff; + flex: 1; + margin: 0px -15px; + margin-top: 40px; + display: flex; + flex-direction: column; + + .table-header { + padding: 20px; + display: flex; + justify-content: space-between; + + .el-form-item { + margin-bottom: 30px !important; + } + } + + .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; + } + + } + } + + .table, + tr, + td { + padding: 10px; + } +} +</style> -- Gitblit v1.9.3