| | |
| | | :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-row :gutter="20">
|
| | | <!-- <el-col :xs="24":sm="6":md="6":lg="6":xl="6">
|
| | | <el-form-item label="机床名" prop="machineName">
|
| | | <el-select filterable v-model="dataForm.machineName" placeholder="支持模糊查询" clearable>
|
| | | <el-option
|
| | |
| | | <el-button size="small" type="primary">点击上传</el-button>
|
| | | </el-upload>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row> -->
|
| | | </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>
|
| | | <el-button size="mini" type="primary" style="background-color: #409EFF;" @click="dataFormSubmit()">保存</el-button>
|
| | | </span>
|
| | | </el-dialog>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { getUseDpts,accountCreate } from '@/api/Api'
|
| | | import { accountUpdate,accountCreate } from '@/api/Api'
|
| | | export default {
|
| | | props: ['addVisible','deviceType','departmentlist'],
|
| | | props: ['addVisible','deviceType','departmentlist','row','isselectlist','deviceStatus','financePro'],
|
| | | data() {
|
| | | return {
|
| | | visible: false,
|
| | |
| | | workshoplist: [], // 车间list
|
| | | oldworkshoplist: [],
|
| | | sectionlist: [], // 工段
|
| | | isselectlist: [
|
| | | {
|
| | | label: '是',
|
| | | value: '1'
|
| | | },
|
| | | {
|
| | | label: '否',
|
| | | value: '0'
|
| | | }
|
| | | ],
|
| | | // 设备状态
|
| | | deviceStatus: [
|
| | | { value: 'STOP', label: '关机' },
|
| | | { value: 'RUN', label: '运行' },
|
| | | { value: 'IDLE', label: '空闲' },
|
| | | { value: 'ALARM', label: '报警' }
|
| | | ],
|
| | | // 账务属性
|
| | | financePro: [
|
| | | { value: '帐内', label: '帐内' },
|
| | | { value: '帐外', label: '帐外' }
|
| | | ],
|
| | | userNamelist: [], // 用户list
|
| | | imageUrl: '', // 图片
|
| | | fileList: []// 文档上传list
|
| | |
| | | },
|
| | | immediate: true
|
| | | }
|
| | | },
|
| | | created () {
|
| | | this.init(this.row)
|
| | | },
|
| | | methods: {
|
| | | init(row) {
|
| | |
| | | this.dataForm.remark = row.remark
|
| | | this.dataForm.managType = row.managType
|
| | | this.dataForm.classes = row.classes
|
| | | } else { this.dataForm.id = 0 }
|
| | | this.visible = true
|
| | | this.getMachineList()
|
| | | this.queryuserlist()
|
| | | this.queryworkshoplist()
|
| | | } else { this.dataForm.id = '' }
|
| | | },
|
| | | /* 查询使用部门*/
|
| | | cancel () {
|
| | | this.$emit('close')
|
| | | },
|
| | | // -----------------
|
| | | // 获取机床lists
|
| | | getMachineList() {
|
| | | // getMachineList(this.currentPage, this.keyWord).then(res => {
|
| | | // this.machineNamelist = []
|
| | | // if (res.list.length > 0) {
|
| | | // res.list.map(item => {
|
| | | // this.machineNamelist.push({
|
| | | // value: item.name,
|
| | | // label: item.name
|
| | | // })
|
| | | // })
|
| | | // }
|
| | | // })
|
| | | },
|
| | | |
| | | /* 获取用户list*/
|
| | | queryuserlist() {
|
| | | // queryuserlist().then(res => {
|
| | | // this.userNamelist = []
|
| | | // if (res.list.length > 0) {
|
| | | // res.list.map(item => {
|
| | | // this.userNamelist.push({
|
| | | // value: item.name,
|
| | | // label: item.name
|
| | | // })
|
| | | // })
|
| | | // }
|
| | | // })
|
| | | },
|
| | | /* 获取车间名list*/
|
| | | queryworkshoplist() {
|
| | | // queryworkshoplist().then(res => {
|
| | | // this.workshoplist = []
|
| | | // if (res.workshopList.length > 0) {
|
| | | // this.oldworkshoplist = res.workshopList
|
| | | // res.workshopList.map(item => {
|
| | | // this.workshoplist.push({
|
| | | // value: item.name,
|
| | | // label: item.name
|
| | | // })
|
| | | // })
|
| | | // }
|
| | | // })
|
| | | },
|
| | | /* 车间名改变 获取工段*/
|
| | | workshopchange() {
|
| | | var cjname = this.dataForm.workshop
|
| | | this.sectionlist = []
|
| | | this.oldworkshoplist.map(item => {
|
| | | if (item.name === cjname) {
|
| | | item.sectionList.map(items => {
|
| | | this.sectionlist.push({
|
| | | value: items.name,
|
| | | label: items.name
|
| | | })
|
| | | })
|
| | | }
|
| | | })
|
| | | },
|
| | |
|
| | | /* 图片*/
|
| | | handleAvatarSuccess(res, file) {
|
| | | this.imageUrl = URL.createObjectURL(file.raw)
|
| | | },
|
| | | beforeAvatarUpload(file) {
|
| | | const isJPG = file.type === 'image/jpeg'
|
| | | const isLt2M = file.size / 1024 / 1024 < 2
|
| | | if (!isJPG) {
|
| | | this.$message.error('上传头像图片只能是 JPG 格式!')
|
| | | }
|
| | | if (!isLt2M) {
|
| | | this.$message.error('上传头像图片大小不能超过 2MB!')
|
| | | }
|
| | | return isJPG && isLt2M
|
| | | },
|
| | | /* 文档 */
|
| | | handleRemove(file, fileList) {
|
| | | // console.log(file, fileList)
|
| | | },
|
| | | handlePreview(file) {
|
| | | // console.log(file)
|
| | | },
|
| | | handleExceed(files, fileList) {
|
| | | this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
| | | },
|
| | | beforeRemove(file, fileList) {
|
| | | return this.$confirm(`确定移除 ${file.name}?`)
|
| | | },
|
| | | /* 提交*/
|
| | | dataFormSubmit() {
|
| | | if (this.dataForm.id === 0) { // 新增
|
| | | if (this.dataForm.id === '') { // 新增
|
| | | accountCreate(this.dataForm).then(res => {
|
| | | this.$message({
|
| | | message: '新增成功',
|
| | |
| | | })
|
| | | })
|
| | | } else {
|
| | | accountCreate(this.dataForm).then(res => {
|
| | | accountUpdate(this.dataForm).then(res => {
|
| | | this.$message({
|
| | | message: '修改成功',
|
| | | type: 'success',
|
| | |
| | |
|
| | | <style lang="scss">
|
| | | .el-form-item__content {
|
| | | .el-select {
|
| | | .el-select,.el-input {
|
| | | width: 100%;
|
| | | }
|
| | | }
|
| | | .el-dialog__body {
|
| | | overflow: hidden;
|
| | | }
|
| | | .avatar-uploader .el-upload {
|
| | | border: 1px dashed #d9d9d9;
|
| | | border-radius: 6px;
|