| | |
| | | // 鍙拌处淇濆瓨 |
| | | accountCreate: '/account/create', |
| | | accountUpdate: '/account/update', |
| | | //璁惧绫诲瀷 |
| | | deviceTypeCreate: '/devicetype/create', |
| | | deviceTypeUpdate: '/devicetype/update', |
| | | // 杞﹂棿 宸ユ涓嬪暒鏁版嵁 |
| | | getWsl: '/machine/workshopList', |
| | | getPcl: '/machine/protocolList' |
| | |
| | | export function accountUpdate(params) { |
| | | return sendRequest(HttpConstants.accountUpdate, params) |
| | | } |
| | | |
| | | // 璁惧绫诲瀷淇濆瓨 |
| | | export function deviceTypeCreate(params) { |
| | | return sendRequest(HttpConstants.deviceTypeCreate, params) |
| | | } |
| | | export function deviceTypeUpdate(params) { |
| | | return sendRequest(HttpConstants.deviceTypeUpdate, params) |
| | | } |
| | | |
| | | // |
| | | export function getWsl(params) { |
| | | return getData(HttpConstants.getWsl, params) |
对比新文件 |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | :title="!dataForm.id ? '鏂板缓' : '缂栬緫'" |
| | | :close-on-click-modal="false" |
| | | width="80%" |
| | | :visible.sync="addVisible"> |
| | | <!-- 娣诲姞鍐呭--> |
| | | <el-form :model="dataForm" label-width="100px" ref="dataForm"> |
| | | <el-row :gutter="20"> |
| | | |
| | | <el-col :xs="24":sm="6":md="6":lg="6":xl="6"> |
| | | <el-form-item label="鍚嶇О" prop="name"> |
| | | <el-input v-model="dataForm.name" placeholder="鍚嶇О" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | |
| | | </el-form> |
| | | <!-- 鎸夐挳 --> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button size="mini" @click="cancel">鍙栨秷</el-button> |
| | | <el-button size="mini" type="primary" @click="dataFormSubmit()">淇濆瓨</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { deviceTypeUpdate,deviceTypeCreate } from '@/api/Api' |
| | | export default { |
| | | props: ['addVisible','row'], |
| | | data() { |
| | | return { |
| | | visible: false, |
| | | dataForm: { |
| | | id: 0, // title鏄剧ず鏂板杩樻槸淇敼 |
| | | name: '' |
| | | } |
| | | |
| | | } |
| | | }, |
| | | watch: { |
| | | addVisible: { |
| | | handler (val) { |
| | | if (val) { |
| | | this.init() |
| | | } |
| | | }, |
| | | immediate: true |
| | | } |
| | | }, |
| | | created () { |
| | | console.log('add create'); |
| | | this.init(this.row) |
| | | }, |
| | | methods: { |
| | | init(row) { |
| | | if (this.$refs['dataForm']) { |
| | | this.$refs['dataForm'].resetFields() |
| | | } |
| | | if (row !== undefined) { |
| | | this.dataForm.id = row.id |
| | | this.dataForm.name = row.name |
| | | |
| | | } else { |
| | | this.dataForm.id = '' |
| | | } |
| | | }, |
| | | /* 鏌ヨ浣跨敤閮ㄩ棬*/ |
| | | cancel () { |
| | | this.$emit('close') |
| | | }, |
| | | /* 鎻愪氦*/ |
| | | dataFormSubmit() { |
| | | if (this.dataForm.id === '') { // 鏂板 |
| | | deviceTypeCreate(this.dataForm).then(res => { |
| | | this.$message({ |
| | | message: '鏂板鎴愬姛', |
| | | type: 'success', |
| | | duration: 1500, |
| | | onClose: () => { |
| | | this.$emit('confirm') |
| | | this.visible = false |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | deviceTypeUpdate(this.dataForm).then(res => { |
| | | this.$message({ |
| | | message: '淇敼鎴愬姛', |
| | | type: 'success', |
| | | duration: 1500, |
| | | onClose: () => { |
| | | this.$emit('confirm') |
| | | this.visible = false |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .el-form-item__content { |
| | | .el-select,.el-input { |
| | | width: 100%; |
| | | } |
| | | } |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 178px; |
| | | height: 178px; |
| | | line-height: 178px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 178px; |
| | | height: 178px; |
| | | display: block; |
| | | } |
| | | </style> |
| | |
| | | this.$refs.list.pageQuery(this.queryInfo) |
| | | }, |
| | | add() { |
| | | this.row = {} |
| | | this.row = {id:''} |
| | | this.addOrUpdateVisible = true |
| | | console.log(this.addOrUpdateVisible); |
| | | |
| | | }, |
| | | close() { |
| | | this.addOrUpdateVisible = false |