From 5eb1499c02ac96f5d58fabfd17e36103d35a675c Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期四, 07 九月 2023 14:01:26 +0800 Subject: [PATCH] modified: src/views/experiment/nonConformingFeedback/index.vue modified: src/views/experiment/planAssignments/plan.vue modified: src/views/login/index.vue modified: src/views/standardLibrary/index.vue --- src/views/experiment/planAssignments/plan.vue | 365 ++++++++++++++++++++++++++++++++++------------------ 1 files changed, 238 insertions(+), 127 deletions(-) diff --git a/src/views/experiment/planAssignments/plan.vue b/src/views/experiment/planAssignments/plan.vue index ee84390..34a94cc 100644 --- a/src/views/experiment/planAssignments/plan.vue +++ b/src/views/experiment/planAssignments/plan.vue @@ -17,11 +17,11 @@ margin: 10px; padding: 15px; background-color: white; - height: calc(100vh - 15vh); + height: calc(100vh - 18vh); overflow-y: auto; } - .order_num{ + .order_num { border-radius: 1rem; width: 35px; height: 25px; @@ -44,53 +44,101 @@ <template> <div class="plan"> <div class="title"> - <span>椤圭洰鍚嶇О锛�</span> - <el-input v-model="search.name" size="medium" style="width: 200px;margin-right: 20px;"></el-input> - <span>妫�楠屾椂闂达細</span> - <el-date-picker v-model="search.date" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" size="medium" style="margin-right: 20px;"> - </el-date-picker> - <span>妫�楠屼汉锛�</span> - <el-input v-model="search.userName" size="medium" style="width: 200px;margin-right: 20px;"></el-input> - <el-button size="small" type="primary">鏌ヨ</el-button> - <el-button size="small">閲嶇疆</el-button> + <el-form :model="search" :inline="true" label-position="left"> + <el-form-item prop="code" label="鐢宠鍗曠紪鍙凤細" width="200" style="margin: 20px 10px;"> + <el-input v-model="search.code" size="small" ></el-input> + </el-form-item> + <el-form-item prop="date" label="妫�楠屾椂闂达細" width="200" style="margin: 20px 10px;"> + <el-date-picker v-model="search.date" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" size="small" value-format="yyyy-MM-dd" style="margin-right: 20px;"> + </el-date-picker> + </el-form-item> + <el-form-item prop="testValue" label="妫�楠岀粨鏋滐細" width="200" style="margin: 20px 10px;"> + <el-select v-model="search.testValue" size="small"> + <el-option label="鍏ㄩ儴" :value="null"></el-option> + <el-option label="鍚堟牸" :value="1"></el-option> + <el-option label="涓嶅悎鏍�" :value="0"></el-option> + </el-select> + </el-form-item> + </el-form> + <el-button size="small" type="primary" @click="selectDataList">鏌ヨ</el-button> + <el-button size="small" @click="cleanBtn">閲嶇疆</el-button> + <el-checkbox style="margin-left: 10px;" @change="selectDataList" v-model="isLookMe">鍙湅鎴�</el-checkbox> </div> <div class="thing"> - <el-table :data="tableData" style="width: 100%;" row-key="id" default-expand-all + <el-table :data="tableData" style="width: 100%;" row-key="code" default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :key="upIndex"> <el-table-column type="index" width="50" label="搴忓彿"> </el-table-column> - <el-table-column prop="date" label="鐢宠鍗曞彿"> + <el-table-column prop="code" label="鐢宠鍗曞彿" width="250px"> <template slot-scope="scope"> <div style="display: flex;"> - <div v-if="scope.row.code=='01'" style="color: #3caaff;background-color: #eff5ff;" class="order_num">01</div> - <div v-else-if="scope.row.code=='02'" style="color: #57c981;background-color: #f1fbf4;" class="order_num">02</div> - <div v-else-if="scope.row.code=='03'" style="color: #dfa8fb;background-color: #faf2ff;" class="order_num">03</div> - <div>{{scope.row.date}}</div> + <div v-if="scope.row.orderNum=='01'" style="color: #3caaff;background-color: #eff5ff;" class="order_num"> + 01 + </div> + <div v-else-if="scope.row.orderNum=='02'" style="color: #57c981;background-color: #f1fbf4;" + class="order_num"> + 02</div> + <div v-else-if="scope.row.orderNum=='03'" style="color: #dfa8fb;background-color: #faf2ff;" + class="order_num"> + 03</div> + <div>{{scope.row.code}}</div> </div> </template> </el-table-column> - <el-table-column prop="name" label="妫�楠岀粨鏋�"> + <el-table-column prop="name" label="鍚嶇О" width="200px"> </el-table-column> - <el-table-column prop="address" label="鍦板潃"> + <el-table-column prop="unit" label="鍗曚綅"> </el-table-column> - <el-table-column label="鎿嶄綔" width="80"> + <el-table-column prop="required" label="瑕佹眰鍊�"> + </el-table-column> + <el-table-column prop="internal" label="鍐呮帶鍊�"> + </el-table-column> + <el-table-column prop="testValue" label="妫�楠屽��"> + </el-table-column> + <el-table-column prop="checker" label="鎵ц浜�"> + </el-table-column> + <el-table-column prop="instrumentname" label="妫�楠岃澶�"> + </el-table-column> + <el-table-column prop="testState" label="妫�楠岀姸鎬�" width="100px"> <template slot-scope="scope"> - <el-button size="mini" type="primary" v-if="isIfReport(scope.row)">涓婃姤</el-button> - <el-button size="mini" type="warning" @click="openUpDia(scope.row)" - v-else-if="scope.row.code=='03'&&scope.row.insId==undefined&&scope.row.address==null">鍒嗛厤</el-button> - <el-button size="mini" type="success" @click="openUpInsDia(scope.row)" - v-else-if="scope.row.code=='03'&&scope.row.insId==undefined&&scope.row.name==null">妫�楠�</el-button> + <el-tag type="success" effect="dark" v-if="scope.row.children!=undefined&&scope.row.testState!=null">宸蹭笂鎶�</el-tag> + <el-tag type="danger" effect="dark" v-else-if="scope.row.children!=undefined&&scope.row.testState==null">鏈笂鎶�</el-tag> + <el-tag type="success" v-else-if="scope.row.children==undefined&&scope.row.testState!=null">宸叉楠�</el-tag> + <el-tag type="danger" v-else-if="scope.row.children==undefined&&scope.row.testState==null">鏈楠�</el-tag> + </template> + </el-table-column> + <el-table-column prop="startTime" label="妫�楠屽紑濮�" width="100px"> + </el-table-column> + <el-table-column prop="endTime" label="妫�楠岀粨鏉�" width="100px"> + </el-table-column> + <el-table-column label="鎿嶄綔" width="150"> + <template slot-scope="scope"> + <el-button size="mini" :disabled="!isIfReport(scope.row)" type="primary" v-if="scope.row.orderNum == '01'" + @click="addReported(scope.row.id)">涓婃姤</el-button> + <el-button size="mini" type="text" @click="openUpDia(scope.row)" + v-if="scope.row.orderNum=='02'&&scope.row.children==undefined&&scope.row.testState==null">鍒嗛厤</el-button> + <el-button size="mini" type="text" @click="openUpInsDia(scope.row)" + v-if="scope.row.orderNum=='02'&&scope.row.children==undefined&&scope.row.testState==null">妫�楠�</el-button> </template> </el-table-column> </el-table> </div> <el-dialog title="鍒嗛厤璁惧鍜屼汉鍛�" :visible.sync="upDia" width="500px" top="30vh"> <div class="body"> - <el-row style="line-height: 46px;"> + <el-row style="line-height: 50px;"> <el-col :span="4" style="font-size: 14px;text-align: right;">浜哄憳:</el-col> <el-col :span="16" :offset="1"> - <el-input v-model="upData.address" size="small" clearable></el-input> + <el-select @change="selectChecker" v-model="upData.checker" size="medium" clearable style="width: 100%;"> + <el-option v-for="(a, ai) in users" :key="ai" :label="a.name" :value="a.id"></el-option> + </el-select> + </el-col> + </el-row> + <el-row style="line-height: 50px;"> + <el-col :span="4" style="font-size: 14px;text-align: right;">璁惧:</el-col> + <el-col :span="16" :offset="1"> + <el-cascader v-model="upData.device" :options="devices" size="medium" style="width: 100%;" clearable + :props="{label: 'name',value: 'id',emitPath: false}" :show-all-levels="false"></el-cascader> </el-col> </el-row> </div> @@ -99,32 +147,40 @@ <el-button @click="upDia = false">鍙� 娑�</el-button> </span> </el-dialog> - <el-dialog title="妫�楠�" :visible.sync="upInsDia" width="500px"> + <el-dialog title="妫�楠�" :visible.sync="upInsDia" width="600px"> <div class="body" style="max-height: 50vh;overflow-y: auto;"> <el-row style="line-height: 46px;"> - <el-col :span="4" style="font-size: 14px;text-align: right;">鏍峰搧缂栫爜锛�</el-col> - <el-col :span="8">{{upData.date}}</el-col> - <el-col :span="4" style="font-size: 14px;text-align: right;">鏍峰搧鍚嶇О锛�</el-col> - <el-col :span="8">{{upData.date}}</el-col> + <el-col :span="5" style="font-size: 14px;text-align: right;">鐢宠鍗曠紪鐮侊細</el-col> + <el-col :span="7">{{upData.insId}}</el-col> + <el-col :span="5" style="font-size: 14px;text-align: right;">鏍峰搧鍚嶇О锛�</el-col> + <el-col :span="7">{{upData.productName}}</el-col> </el-row> <el-row style="line-height: 46px;"> - <el-col :span="4" style="font-size: 14px;text-align: right;">妫�楠岄」鐩細</el-col> - <el-col :span="8">{{upData.date}}</el-col> - <el-col :span="4" style="font-size: 14px;text-align: right;">鍗曚綅锛�</el-col> - <el-col :span="8">{{upData.date}}</el-col> + <el-col :span="5" style="font-size: 14px;text-align: right;">妫�楠岄」鐩細</el-col> + <el-col :span="7">{{upData.name}}</el-col> + <el-col :span="5" style="font-size: 14px;text-align: right;">鍗曚綅锛�</el-col> + <el-col :span="7">{{upData.unit}}</el-col> </el-row> <el-row style="line-height: 46px;"> - <el-col :span="4" style="font-size: 14px;text-align: right;">鏍囧噯鍊硷細</el-col> - <el-col :span="8">{{upData.date}}</el-col> - <el-col :span="4" style="font-size: 14px;text-align: right;">鍐呮帶鍊硷細</el-col> - <el-col :span="8">{{upData.date}}</el-col> + <el-col :span="5" style="font-size: 14px;text-align: right;">鏍囧噯鍊硷細</el-col> + <el-col :span="7">{{upData.required}}</el-col> + <el-col :span="5" style="font-size: 14px;text-align: right;">鍐呮帶鍊硷細</el-col> + <el-col :span="7">{{upData.internal}}</el-col> + </el-row> + <el-row style="line-height: 46px;"> + <el-col :span="5" style="font-size: 14px;text-align: right;">妫�楠岀粨鏋滐細</el-col> + <el-col :span="7"> + <el-tag type="success" v-if="upData.testState==1">鍚堟牸</el-tag> + <el-tag type="danger" v-else-if="upData.testState==0">涓嶅悎鏍�</el-tag> + <el-tag type="info" v-else>鏃犵粨鏋�</el-tag> + </el-col> </el-row> <el-row style="line-height: 46px;"> <el-col style="text-align: right;"><el-button size="mini" @click="addRes">娣诲姞妫�楠屽��</el-button></el-col> </el-row> <el-row> <el-col> - <el-table :data="upData.res" border style="width: 99.9%;" :key="upIndex2"> + <el-table :data="upData.testValue" border style="width: 99.9%;" :key="upIndex2"> <el-table-column type="index" width="100" label="搴忓彿"> </el-table-column> <el-table-column label="妫�楠屽��"> @@ -134,10 +190,10 @@ </el-input> </template> </el-table-column> - <el-table-column label="鎿嶄綔" width="60"> + <el-table-column label="鎿嶄綔" width="80"> <template slot-scope="scope"> <el-button size="mini" type="text" - @click.native.prevent="deleteRow(scope.$index, upData.res)">鍒犻櫎</el-button> + @click.native.prevent="deleteRow(scope.$index, upData.testValue)">鍒犻櫎</el-button> </template> </el-table-column> </el-table> @@ -145,7 +201,7 @@ </el-row> </div> <span slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitUpData">鎻� 浜�</el-button> + <el-button type="primary" @click="submitUpData2">鎻� 浜�</el-button> <el-button @click="upInsDia = false">鍙� 娑�</el-button> </span> </el-dialog> @@ -153,133 +209,188 @@ </template> <script> + import { + get, + post, + wpost, + postFile + } from "@/api/util/requestUtil.js" export default { data() { return { search: { - name: null, + code: null, date: [], - userName: null, + testValue: null, }, - tableData: [{ - id: 1, - insId: 123, - date: '2016-05-02', - name: null, - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1518 寮�', - children: [{ - id: 33, - date: '2016-05-01', - name: null, - res: '[{"number": 1},{"number": 2}]', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' - }, { - id: 34, - date: '2016-05-01', - name: null, - res: '[{"number": 1,"res": "涓嶅悎鏍�"},{"number": 3,"res": "涓嶅悎鏍�"}]', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�', - children: [{ - id: 35, - date: 'hhh', - name: null, - res: '[{"number": 1},{"number": 2}]', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' - }] - }] - }, { - id: 2, - insId: 123, - date: '2016-05-04', - name: null, - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1517 寮�', - children: [] - }, { - id: 3, - insId: 123, - date: '2016-05-01', - children: [{ - id: 31, - date: '2016-05-01', - name: null, - res: '[{"number": 1},{"number": 2}]', - address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�' - }, { - id: 32, - date: '2016-05-01', - name: null, - res: '[]', - address: null - }] - }], + tableData: [], upDia: false, upData: {}, upIndex: 0, upInsDia: false, - upIndex2: 0 + upIndex2: 0, + users: [], + devices: [], + isLookMe: false } }, mounted() { this.selectDataList() + this.getUsers() + this.getDevices() }, methods: { selectDataList() { - this.tableData.forEach(a => { - a.code = '01' - if (a.children != undefined) { - a.children.forEach(b => { - b.code = '02' - if (b.children != undefined) { - b.children.forEach(c => { - c.code = '03' - c.res = JSON.parse(c.res) - }) - } - }) + var str = {} + str.code = this.search.code + str.isLookMe=this.isLookMe + str.status = this.search.testValue + try { + if (this.search.date.length != 0) { + str.beginTime = this.search.date[0] + str.endTime = this.search.date[1] } + } catch (e) {} + get(this.$url.selectAllPlan, str).then(res => { + this.tableData = JSON.parse(JSON.stringify(res.data).replaceAll('pid', 'code').replaceAll('samplename', + 'name').replaceAll('inspectionStatus', 'testState')) + this.tableData.forEach(a => { + a.orderNum = '01' + if (a.children != undefined) { + a.children.forEach(b => { + b.orderNum = '02' + if (b.testValue == undefined) { + b.testValue = [] + } + }) + } + }) + this.upIndex++ }) - this.upIndex++ }, isIfReport(row) { var count = 0 if (row.children == undefined) return false row.children.forEach(a => { - if (a.name != null && a.name != undefined) count++ + if (a.testState != null && a.testState != undefined) count++ }) - return row.insId != undefined && count == row.children.length + return row.testState == undefined && count == row + .children.length }, openUpDia(row) { + // console.log(row); this.upDia = true this.upData = { - id: row.id, - address: row.address + id: row.code, + checker: null, + device: null } + this.upData.checker=row.uId + this.upData.device=row.isuId }, submitUpData() { - this.tableData.forEach(a => { - a.children.forEach(b => { - if (b.id == this.upData.id) { - b.address = this.upData.address - } - }) + // console.log(this.upData.device); + // console.log(this.devices); + // return; + if (this.upData.checker == null || this.upData.checker == '') { + this.$message.error('浜哄憳鏈垎閰�') + return + } else if (this.upData.device == null || this.upData.device == '') { + this.$message.error('璁惧鏈垎閰�') + return + } + wpost(this.$url.distribution, { + id: this.upData.id, + userId: this.upData.checker, + instrumentId: this.upData.device + }).then(res => { + this.$message.success('鍒嗛厤鎴愬姛') + this.upDia = false + this.selectDataList() }) - this.$message.success('淇敼鎴愬姛') - this.upIndex++ - this.upDia = false + }, + selectChecker(){ + // console.log(this.upData.checker); }, openUpInsDia(row) { this.upInsDia = true this.upData = this.HaveJson(row) + var str = [] + JSON.parse('[' + this.upData.testValue + ']').forEach(a => { + str.push({ + number: a + }) + }) + this.upData.testValue = this.HaveJson(str) + this.tableData.forEach(a => { + a.children.forEach(b => { + if (b.code == this.upData.code) { + this.upData.insId = a.code + this.upData.productName = a.name + } + }) + }) }, deleteRow(index, rows) { rows.splice(index, 1); }, addRes() { - this.upData.res.push({ + this.upData.testValue.push({ "number": null }) this.upIndex2++ + }, + getUsers() { + get(this.$url.choosecheck).then(res => { + this.users = res.data + }) + }, + getDevices() { + get(this.$url.chooseinstum).then(res => { + this.devices = res.data + }) + }, + addReported(id) { + wpost(this.$url.reported, { + id: id + }).then(res => { + this.$message.success('涓婃姤鎴愬姛') + this.selectDataList() + }).catch(e => { + this.$message.error('涓婃姤澶辫触') + }) + }, + submitUpData2() { + var data = [] + this.upData.testValue.forEach(a => { + if (a.number != '' && a.number != null) { + data.push(a.number) + } + }) + wpost(this.$url.check, { + id: this.upData.code, + value: data.toString() + }).then(res => { + this.upInsDia = false + this.selectDataList() + this.$confirm( + `<p style="line-height: 80px">鎮ㄧ殑椤圭洰锛�${this.upData.name}锛夋楠岀粨鏋滀负锛�<span class="${res.data==1?'ins_state_success':'ins_state_error'}">${res.data==1?'鍚堟牸':'涓嶅悎鏍�'}</span></p>`, + '鎻愪氦鎴愬姛', { + confirmButtonText: '纭畾', + cancelButtonText: '鍏抽棴', + dangerouslyUseHTMLString: true, + type: `${res.data==1?'success':'error'}` + }).then(() => {}).catch(() => {}) + }) + }, + cleanBtn(){ + this.search = { + code: null, + date: [], + testValue: null, + } + this.selectDataList() } } } -</script> +</script> \ No newline at end of file -- Gitblit v1.9.3