From 5b9a1d6cb3a7d59c8f2de83c495bba1a069b2723 Mon Sep 17 00:00:00 2001 From: gaosp <gaosp> Date: 星期五, 19 一月 2024 00:23:15 +0800 Subject: [PATCH] update --- src/container/maintenance/index.vue | 7 src/container/list/index.vue | 4 src/api/Api.js | 4 src/container/maintenance/dailyMAdd.vue | 461 ++++++++++++++++++++++++-------------------------- src/styles/index.scss | 5 5 files changed, 234 insertions(+), 247 deletions(-) diff --git a/src/api/Api.js b/src/api/Api.js index f1b648b..a8c7064 100644 --- a/src/api/Api.js +++ b/src/api/Api.js @@ -1,7 +1,7 @@ /* * @Date: 2024-01-10 20:37:45 * @LastEditors: Sneed - * @LastEditTime: 2024-01-17 22:48:20 + * @LastEditTime: 2024-01-18 23:37:37 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/api/Api.js */ import ajax from '@/utils/ajax' @@ -51,7 +51,7 @@ method: 'POST' }, maintainUpdate: { - url: '/maintain/update', + url: '/maintain/modify', method: 'POST' }, maintainDel: { diff --git a/src/container/list/index.vue b/src/container/list/index.vue index cfe0cfc..7548ada 100644 --- a/src/container/list/index.vue +++ b/src/container/list/index.vue @@ -1,7 +1,7 @@ <!-- * @Date: 2024-01-06 17:40:19 * @LastEditors: Sneed - * @LastEditTime: 2024-01-16 22:13:59 + * @LastEditTime: 2024-01-18 23:55:56 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/list/index.vue --> <template> @@ -36,7 +36,7 @@ <el-pagination style="background: transparent;" :page-size="pageSize" - :pager-count="current" + :current-page="current" layout="prev, pager, next" :total="total"> </el-pagination> diff --git a/src/container/maintenance/dailyMAdd.vue b/src/container/maintenance/dailyMAdd.vue index 3dc55ce..0af8beb 100644 --- a/src/container/maintenance/dailyMAdd.vue +++ b/src/container/maintenance/dailyMAdd.vue @@ -1,256 +1,239 @@ <!-- 鏃ュ父淇濆吇 缂栬緫 --> <template> - <!-- 鏂板寮规 --> - <el-dialog - :title="title" - width="80%" - @close="cancel" - :visible.sync="dialogVisibleAdd" class="role-select"> - <!-- 鏌ヨ琛ㄥ崟 --> - <el-form :model="dataForm" ref="dataForm" label-width="150px" style="margin-top:10px;"> - <el-row :gutter="24"> - <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> - <el-form-item label="璁惧鍚嶇О" prop="machineName"> - <el-select v-model="dataForm.machineId" placeholder="---璇烽�夋嫨---" clearable> - <el-option - v-for="item in machineList" - :key="item.id" - :label="item.machineName" - :value="item.id"> - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> - <el-form-item label="浣跨敤閮ㄩ棬" prop="department"> - <el-select v-model="dataForm.department" placeholder="---璇烽�夋嫨---" clearable > - <el-option - v-for="item in departmentlist" - :key="item.value" - :label="item.label" - :value="item.value"> - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> - <el-form-item label="淇濆吇鑰�" prop="maintainPerson"> - <el-select v-model="dataForm.maintainPerson" placeholder="---璇烽�夋嫨---" clearable > - <el-option - v-for="item in userList" - :key="item.id" - :label="item.label" - :value="item.value"> - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> - <el-form-item label="鏄惁鍚堟牸" prop="isQualified"> - <el-select v-model="dataForm.isQualified" placeholder="---璇烽�夋嫨---" clearable > - <el-option - v-for="item in isQualified" - :key="item.id" - :label="item.label" - :value="item.value"> - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> - <el-form-item label="淇濆吇鍐呭涓庡瓨鍦ㄩ棶棰�" prop="detail"> - <el-input size="mini" type="text" v-model="dataForm.detail" clearable></el-input> - </el-form-item> - </el-col> - <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> - </el-col> - <el-col :xs="24":sm="10":md="10":lg="10":xl="10"> - <el-form-item label="璁″垝寮�濮嬫棩鏈�" prop="planStartDate"> - <el-date-picker - format="yyyy 骞� MM 鏈� dd 鏃�" - value-format="yyyy-MM-dd" - v-model="dataForm.planStartDate" - range-separator="鑷�" - clearable - type="daterange" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡"> - </el-date-picker> - </el-form-item> - </el-col> - <el-col :xs="24":sm="10":md="10":lg="10":xl="10"> - <el-form-item label="璁″垝瀹屾垚鏃ユ湡" prop="planFinishDate"> - <el-date-picker - format="yyyy 骞� MM 鏈� dd 鏃�" - value-format="yyyy-MM-dd" - v-model="dataForm.planFinishDate" - range-separator="鑷�" - clearable - type="daterange" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡"> - </el-date-picker> - </el-form-item> - </el-col> - </el-row> - </el-form> - <div style="display: flex;justify-content: center;align-items: center;margin-top:15px;"> - <el-button size="mini" type="primary" @click="savedata()" plain>淇濆瓨</el-button> - <el-button size="mini" type="warning" @click="resetForm()" plain>閲嶇疆</el-button> - </div> + <!-- 鏂板寮规 --> + <el-dialog :title="title" width="80%" :visible.sync="dialogVisibleAdd" class="role-select"> + <!-- 鏌ヨ琛ㄥ崟 --> + <el-form :model="dataForm" ref="dataForm" label-width="150px" style="margin-top:10px;"> + <el-row :gutter="24"> + <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> + <el-form-item label="璁惧鍚嶇О" prop="machineName"> + <el-select v-model="dataForm.machineId" placeholder="---璇烽�夋嫨---" clearable> + <el-option v-for="item in machineList" :key="item.id" :label="item.machineName" + :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> + <el-form-item label="浣跨敤閮ㄩ棬" prop="department"> + <el-select v-model="dataForm.department" placeholder="---璇烽�夋嫨---" clearable> + <el-option v-for="item in departmentlist" :key="item.value" :label="item.label" + :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> + <el-form-item label="淇濆吇鑰�" prop="maintainPerson"> + <el-select v-model="dataForm.userId" placeholder="---璇烽�夋嫨---" clearable> + <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> + <el-form-item label="鏄惁鍚堟牸" prop="isQualified"> + <el-select v-model="dataForm.isQualified" placeholder="---璇烽�夋嫨---" clearable> + <el-option v-for="item in isQualified" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> + <el-form-item label="淇濆吇鍐呭涓庡瓨鍦ㄩ棶棰�" prop="detail"> + <el-input size="mini" type="text" v-model="dataForm.detail" clearable></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6"> + </el-col> + <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10"> + <el-form-item label="璁″垝寮�濮嬫棩鏈�" prop="planStartDate"> + <el-date-picker format="yyyy 骞� MM 鏈� dd 鏃�" value-format="yyyy-MM-dd" v-model="dataForm.planStartDate" + range-separator="鑷�" clearable type="daterange" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"> + </el-date-picker> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10"> + <el-form-item label="璁″垝瀹屾垚鏃ユ湡" prop="planFinishDate"> + <el-date-picker format="yyyy 骞� MM 鏈� dd 鏃�" value-format="yyyy-MM-dd" + v-model="dataForm.planFinishDate" range-separator="鑷�" clearable type="daterange" + start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"> + </el-date-picker> + </el-form-item> + </el-col> + </el-row> + </el-form> + <div style="display: flex;justify-content: center;align-items: center;margin-top:15px;"> + <el-button size="mini" type="primary" @click="savedata()" plain>淇濆瓨</el-button> + <el-button size="mini" type="warning" @click="resetForm()" plain>閲嶇疆</el-button> + </div> - </el-dialog> + </el-dialog> </template> <script> -// import { getMachineList, maintainCreate, maintainUpdate, deviceManage, userList, departmentGet } from '@/api/MdcApi' -import { getMachineList, maintainCreate, maintainUpdate, userList, departmentGet } from '@/api/MdcApi' import { getRequest } from '@/api/Api' export default { - props: ['styleName','styles','styleValue', 'departmentlist','machineList','userList'], - data() { - return { - dataForm: { - machineId: '', - department: '', - maintainPerson: '', - isQualified: '', - detail: '', - style: '', - }, - dialogVisibleAdd: false, - // 涓嬫媺妗� - isQualified: [{ // 鏄惁鍚堟牸 - label: '鍚堟牸', - value: '鍚堟牸' - }, { - label: '涓嶅悎鏍�', - value: '涓嶅悎鏍�' - }], // 璁惧鍚嶇О - title: '鏂板', - data: null, // 缂栬緫鏁版嵁鍥炲~ - no: null - } - }, - methods: { - // 鍒濆鍖� - init(n, data) { - this.data = data - this.no = n - - if (n === 1) { - this.title = '鏂板' + this.styleName - Object.keys(this.dataForm).forEach(key => { - this.dataForm[key] = '' - }) - this.dataForm['style'] = '' - } else { - this.title = '淇敼' + this.style - Object.keys(this.dataForm).forEach(key => { - this.dataForm[key] = data[key] - }) - } - this.dialogVisibleAdd = true - this.machineName = [] - this.maintainPerson = [] - // this.initDevices() // 鍒濆鍖栨暟鎹� - }, - // 淇濆瓨 - savedata() { - // 鏂板淇濆瓨 - // const style = 1 - const startDateFrom = this.dataForm.planStartDate[0] - const startDateTo = this.dataForm.planStartDate[1] - const completeDateFrom = this.dataForm.planFinishDate[0] - const completeDateTo = this.dataForm.planFinishDate[1] - const isQualified = this.dataForm.isQualified === '鍚堟牸' ? 1 : 0 - if (this.no === 1) { - console.log({ - ...this.dataForm, - startDateFrom, - startDateTo, - completeDateFrom, - completeDateTo, - isQualified, - styles: this.style - }) - // return - getRequest('maintainCreate',{ - ...this.dataForm, - startDateFrom, - startDateTo, - completeDateFrom, - completeDateTo, - isQualified, - style: this.styleValue - }).then(res => { - if (res.result === 'SUCCESS') { - this.$message({ - type: 'success', - message: '淇濆瓨鎴愬姛!' - }) - this.$emit('reflash') - // const that = this - this.dialogVisibleAdd = false - } else { - this.$message({ - type: 'error', - message: res.result - }) - } - }) - } else { - getRequest('maintainUpdate',{ - ...this.dataForm, - startDateFrom, - startDateTo, - completeDateFrom, - completeDateTo, - isQualified, - style: this.styleValue - }).then(res => { - if (res.result === 'SUCCESS') { - this.$message({ - type: 'success', - message: '淇濆瓨鎴愬姛!' - }) - this.$emit('reflash') - // const that = this - this.dialogVisibleAdd = false - } else { - this.$message({ - type: 'error', - message: res.result - }) - } - }) - } - }, - /** - * 鍒濆鍖栧凡鏈夋満搴� - */ - // 閲嶇疆 - resetForm() { - this.$refs.dataForm.resetFields() - } - }, - created() { - // this.initDevices() - } + props: ['styleName', 'styles', 'styleValue', 'departmentlist', 'machineList', 'userList'], + data() { + return { + dataForm: { + id: '', + machineId: '', + department: '', + userId: '', + isQualified: '', + detail: '', + style: '', + planStartDate: [], + planFinishDate: [] + }, + dialogVisibleAdd: false, + // 涓嬫媺妗� + isQualified: [{ // 鏄惁鍚堟牸 + label: '鍚堟牸', + value: true + }, { + label: '涓嶅悎鏍�', + value: false + }], // 璁惧鍚嶇О + title: '鏂板', + data: null, // 缂栬緫鏁版嵁鍥炲~ + no: null, + } + }, + methods: { + // 鍒濆鍖� + init(n, data) { + this.data = data + this.no = n + if (n === 1) { + this.title = '鏂板' + this.styleName + Object.keys(this.dataForm).forEach(key => { + this.dataForm[key] = '' + }) + this.dataForm['style'] = '' + } else { + this.title = '淇敼' + this.styleName + Object.keys(this.dataForm).forEach(key => { + this.dataForm[key] = data[key] + }) + try { + this.dataForm.planStartDate = [(data.startDateFrom || ''),(data.startDateTo || '')] + this.dataForm.planFinishDate = [(data.completeDateFrom || ''),(data.completeDateTo || '')] + } catch (error) { + + } + + } + this.dialogVisibleAdd = true + // this.initDevices() // 鍒濆鍖栨暟鎹� + }, + // 淇濆瓨 + savedata() { + // 鏂板淇濆瓨 + // const style = 1 + let startDateFrom + let startDateTo + let completeDateFrom + let completeDateTo + try { + startDateFrom = this.dataForm.planStartDate[0] + startDateTo = this.dataForm.planStartDate[1] + completeDateFrom = this.dataForm.planFinishDate[0] + completeDateTo = this.dataForm.planFinishDate[1] + } catch (error) { + + } + + if (this.no === 1) { + console.log({ + ...this.dataForm, + startDateFrom, + startDateTo, + completeDateFrom, + completeDateTo, + styles: this.style + }) + // return + getRequest('maintainCreate', { + ...this.dataForm, + startDateFrom, + startDateTo, + completeDateFrom, + completeDateTo, + style: this.styleValue + }).then(res => { + if (res.result === 'SUCCESS') { + this.$message({ + type: 'success', + message: '淇濆瓨鎴愬姛!' + }) + this.$emit('reflash') + // const that = this + this.dialogVisibleAdd = false + } else { + this.$message({ + type: 'error', + message: res.result + }) + } + }) + } else { + getRequest('maintainUpdate', { + ...this.dataForm, + startDateFrom, + startDateTo, + completeDateFrom, + completeDateTo, + style: this.styleValue + }).then(res => { + if (res.result === 'SUCCESS') { + this.$message({ + type: 'success', + message: '淇濆瓨鎴愬姛!' + }) + this.$emit('reflash') + // const that = this + this.dialogVisibleAdd = false + } else { + this.$message({ + type: 'error', + message: res.result + }) + } + }) + } + }, + /** + * 鍒濆鍖栧凡鏈夋満搴� + */ + // 閲嶇疆 + resetForm() { + Object.keys(this.dataForm).forEach(key => { + this.dataForm[key] = '' + }) + } + }, + created() { + } } </script> <style lang="scss"> .el-form-item__content { - .el-select,.el-input { - width: 100%; - } - } - .el-dialog__body { - overflow: hidden; - } + + .el-select, + .el-input { + width: 100%; + } +} + +.el-dialog__body { + overflow: hidden; +} </style> <style scoped> - /* .el-table__body .cell{padding:3px;} +/* .el-table__body .cell{padding:3px;} .el-input__icon{line-height: 30px;} .el-input__inner{height:30px;line-height: 30px;} .el-form-item__content{line-height: 40px;} diff --git a/src/container/maintenance/index.vue b/src/container/maintenance/index.vue index 257e81b..f768474 100644 --- a/src/container/maintenance/index.vue +++ b/src/container/maintenance/index.vue @@ -1,7 +1,7 @@ <!-- * @Date: 2024-01-06 17:40:19 * @LastEditors: Sneed - * @LastEditTime: 2024-01-16 23:02:37 + * @LastEditTime: 2024-01-19 00:15:38 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/container/maintenance/index.vue --> <template> @@ -111,13 +111,12 @@ </el-table-column> </template> </List> - <DailyMAddD ref="dailyMAddD" @reflash="submitForm" :styleValue="queryInfo.style" :styleName="navName" :departmentlist="departmentlist" :machineList="machineList" :userList="userList"></DailyMAddD> + <DailyMAddD ref="dailyMAddD" @reflash="query" :styleValue="queryInfo.style" :styleName="navName" :departmentlist="departmentlist" :machineList="machineList" :userList="userList"></DailyMAddD> </div> </template> <script> import List from '../list/index.vue' import { getUseDpts,getRequest } from '@/api/Api' -import { userList } from '@/api/MdcApi' import DailyMAddD from './dailyMAdd.vue' export default { components: { @@ -177,7 +176,7 @@ }) getRequest('userList', { }).then(res => { - this.userList = res.data.list + this.userList = res.data }) }, diff --git a/src/styles/index.scss b/src/styles/index.scss index 142ded5..1f28d1a 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -117,4 +117,9 @@ } .el-form-item__label { font-size: 12px; +} +.el-dialog__wrapper { + .el-input__inner { + color: #000; + } } \ No newline at end of file -- Gitblit v1.9.3