| | |
| | | <el-divider /> |
| | | <div style="margin-left: 10px;display: flex"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-refresh-right" |
| | | @click="syncSeaveSearchWhareHouseLocation" |
| | | >同步仓库/库位 |
| | | </el-button> |
| | | <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button> |
| | | </div> |
| | | <el-divider /> |
| | |
| | | <el-table |
| | | :data="tableData" |
| | | border |
| | | :height="tableHeight" |
| | | stripe |
| | | :height="tableHeight+'px'" |
| | | :style="{width: 100+'%',height:tableHeight+'px',}" |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | |
| | | prop="lm_date" |
| | | label="创建时间" |
| | | sortable="custom" |
| | | width="160" |
| | | /> |
| | | <el-table-column |
| | | label="操作" |
| | | width="120" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <div class="operationClass"> |
| | | <el-button type="text" @click="edit('edit',row)">修改</el-button> |
| | | <el-button type="text" @click="del(row.id)">删除</el-button> |
| | | <el-button type="text" @click="edit('edit',row)">编辑</el-button> |
| | | <el-button type="text" @click="del(row)">删除</el-button> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </div> |
| | | |
| | | <el-dialog |
| | | :title="operation==='add'?'新增':'修改'" |
| | | :title="operation==='add'?'新增':'编辑'" |
| | | :visible.sync="dialogVisible" |
| | | width="50%" |
| | | width="800px" |
| | | :close-on-click-modal="false" |
| | | top="15vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px"> |
| | | <el-form-item label="仓库编码" prop="OrgCode"> |
| | | <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 220px" /> |
| | | <el-form-item label="仓库编码" prop="warehousecode"> |
| | | <el-input v-model="dialogForm.warehousecode" :disabled="operation!=='add'" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="仓库名称" prop="OrgName"> |
| | | <el-input v-model="dialogForm.OrgName" style="width: 220px" /> |
| | | <el-form-item label="仓库名称" prop="warehousename"> |
| | | <el-input v-model="dialogForm.warehousename" style="width: 200px" /> |
| | | </el-form-item> |
| | | <el-form-item label="仓库描述" prop="SupUnit"> |
| | | <el-input v-model="dialogForm.OrgName" type="textarea" style="width: 220px" /> |
| | | <el-form-item label="仓库描述"> |
| | | <el-input v-model="dialogForm.description" type="textarea" style="width: 200px" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!--导入组件--> |
| | | <import-picker ref="importPickerFunc" :shows.sync="shows" :title="title_value" :colos="colos" :code="code" /> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Pagination from '@/components/Pagination' |
| | | import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | import { WareHouseDefSearch } from '@/api/wlgl' |
| | | import { AddUpdateWareHouseDef, DeleteWareHouseDef, WareHouseDefSearch } from '@/api/wlgl' |
| | | import { SeaveSearchWhareHouseLocation } from '@/api/ErpSyncMes' |
| | | import ImportPicker from '@/components/ImportPicker' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | | name: 'Zzjg', |
| | | name: 'CKDY', |
| | | components: { |
| | | Pagination |
| | | Pagination, ImportPicker |
| | | }, |
| | | data() { |
| | | const validateName = (rule, value, callback) => { |
| | |
| | | } |
| | | } |
| | | } |
| | | const validateTypeCode = (rule, value, callback) => { |
| | | if (!value) { |
| | | return callback(new Error('请选择上级')) |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | return { |
| | | mainHeight: 0, |
| | | tableHeight: 0, |
| | |
| | | prop: 'lm_date', // 排序字段 |
| | | order: 'desc', // 排序字段 |
| | | page: 1, // 第几页 |
| | | rows: 10 // 每页多少条 |
| | | rows: 20 // 每页多少条 |
| | | }, |
| | | total: 10, |
| | | tableData: [], |
| | | dialogVisible: false, |
| | | dialogForm: { |
| | | OrgType: '', |
| | | OrgCode: '', |
| | | OrgName: '' |
| | | id: '', |
| | | warehousecode: '', |
| | | warehousename: '', |
| | | description: '', |
| | | OperType: '' |
| | | }, |
| | | dialogFormOrgTypeSelected: '', |
| | | operation: '', |
| | | dialogFormRules: { |
| | | OrgType: [ |
| | | { required: true, message: '请输入选择类型', trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgCode: [ |
| | | warehousecode: [ |
| | | { required: true, validator: validateName, trigger: ['blur', 'change'] } |
| | | ], |
| | | OrgName: [ |
| | | warehousename: [ |
| | | { required: true, message: '请输入名称', trigger: ['blur', 'change'] } |
| | | ], |
| | | SupUnit: [ |
| | | { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] } |
| | | ] |
| | | } |
| | | }, |
| | | |
| | | title_value: '数据导入 / 仓库、库位定义', |
| | | code: '6', |
| | | shows: false |
| | | |
| | | } |
| | | }, |
| | | watch: { |
| | | shows() { |
| | | if (!this.shows) { |
| | | this.getWareHouseDefSearch() |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | const res = await WareHouseDefSearch(this.form) |
| | | this.tableData = res.data |
| | | this.total = res.count |
| | | }, |
| | | // 同步仓库/库位 |
| | | async syncSeaveSearchWhareHouseLocation() { |
| | | const loading = this.$loading({ |
| | | lock: true, |
| | | text: '正在同步仓库/库位,请稍等...', |
| | | spinner: 'el-icon-loading', |
| | | customClass: 'osloading', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }) |
| | | const res = await SeaveSearchWhareHouseLocation() |
| | | if (res.code === '200') { |
| | | setTimeout(() => { |
| | | this.getWareHouseDefSearch() |
| | | loading.close() |
| | | this.$message.success('同步成功!') |
| | | }, 2000) |
| | | } else { |
| | | setTimeout(() => { |
| | | loading.close() |
| | | this.$message.error('同步失败!') |
| | | }, 10000) |
| | | } |
| | | }, |
| | | // 排序改变时 |
| | | sortChange({ column, prop, order }) { |
| | |
| | | search() { |
| | | this.getWareHouseDefSearch() |
| | | }, |
| | | // 导入按钮 |
| | | upload() { |
| | | |
| | | this.shows = true |
| | | this.$refs.importPickerFunc.newDataFunc() |
| | | }, |
| | | colos() { |
| | | this.shows = false |
| | | }, |
| | | // 重置 |
| | | reset() { |
| | |
| | | edit(operation, row) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | |
| | | this.$nextTick(() => { |
| | | this.dialogForm.OrgCode = row.org_code |
| | | this.dialogForm.OrgName = row.org_name |
| | | this.dialogForm.SupUnit = row.parent_id |
| | | this.dialogForm.id = row.id |
| | | this.dialogForm.warehousecode = row.code |
| | | this.dialogForm.warehousename = row.name |
| | | this.dialogForm.description = row.description |
| | | }) |
| | | }, |
| | | // 删除按钮 |
| | | async del(id) { |
| | | async del(row) { |
| | | this.$confirm('是否确认删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | DeleteOrganization({ orgid: id }).then(res => { |
| | | DeleteWareHouseDef({ warehousecode: row.code }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | this.getWareHouseDefSearch() |
| | |
| | | }, |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.OrgType = '' |
| | | this.dialogForm.OrgCode = '' |
| | | this.dialogForm.OrgName = '' |
| | | this.dialogForm.SupUnit = '' |
| | | this.dialogForm.warehousecode = '' |
| | | this.dialogForm.warehousename = '' |
| | | this.dialogForm.description = '' |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | const data = { |
| | | OrganType: this.dialogFormOrgTypeSelected, |
| | | OrganCode: this.dialogForm.OrgCode, |
| | | OrganName: this.dialogForm.OrgName, |
| | | SupUnit: this.dialogFormOrgTypeSelected === 'F' ? '0' : this.dialogForm.SupUnit, |
| | | OperType: this.operation === 'add' ? 'Add' : 'Update', |
| | | Operator: getCookie('admin') |
| | | 'id': this.dialogForm.id, |
| | | 'warehousecode': this.dialogForm.warehousecode, |
| | | 'warehousename': this.dialogForm.warehousename, |
| | | 'description': this.dialogForm.description, |
| | | 'OperType': this.operation === 'add' ? 'Add' : 'Update' |
| | | } |
| | | AddUpdateOrganization(data).then(res => { |
| | | AddUpdateWareHouseDef(data).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!') |
| | | this.dialogVisible = false |
| | |
| | | getHeight() { |
| | | this.$nextTick(() => { |
| | | this.mainHeight = window.innerHeight - 250 |
| | | this.tableHeight = this.mainHeight - 100 |
| | | this.tableHeight = this.mainHeight - 50 |
| | | if (window.innerHeight < 769) { |
| | | this.tableHeight = this.tableHeight - 50 |
| | | } |
| | | }) |
| | | } |
| | | } |
| | |
| | | height: 30px; |
| | | display: flex; |
| | | align-items: center; |
| | | border: 1px solid $main_color; |
| | | //border: 1px solid $main_color; |
| | | border: none; |
| | | padding: 0 20px; |
| | | } |
| | | ::v-deep .el-button--primary:hover { |
| | | border: none; |
| | | } |
| | | |
| | | ::v-deep .el-button--info { |
| | |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | ::v-deep .el-input__inner:focus { |
| | | border-color: $main_color; |
| | | } |
| | | ::v-deep .el-textarea__inner:focus{ |
| | | border-color: $main_color; |
| | | } |
| | | |
| | | </style> |