|
@@ -15,7 +15,7 @@
|
|
|
<el-button v-if="!form.status || form.status === 0" type="warning" size="small" @click="submitStorage">
|
|
|
提 交
|
|
|
</el-button>
|
|
|
- <el-button v-if="!form.status || form.status === 1" type="error" size="small" @click="submitStorage">
|
|
|
+ <el-button v-if="form.status && form.status === 1" type="error" size="small" @click="disabledRegion">
|
|
|
禁 用
|
|
|
</el-button>
|
|
|
</div>
|
|
@@ -30,7 +30,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getDetail, add, update, remove} from "@/api/storehouse/storage-region.js";
|
|
|
+import {getDetail, add, disabledStorageRegion} from "@/api/storehouse/storage-region.js";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
data() {
|
|
@@ -87,7 +87,7 @@ export default {
|
|
|
watch: {
|
|
|
onLoad: {
|
|
|
handler(val) {
|
|
|
- this.form.parentId = this.onLoad.id
|
|
|
+ this.form.parentId = this.onLoad.parentId
|
|
|
},
|
|
|
deep: true
|
|
|
}
|
|
@@ -109,8 +109,10 @@ export default {
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
})
|
|
|
- this.form.parentId = this.onLoad.id
|
|
|
- this.form.top = this.onLoad.parentId === 0 ? 1 : 0
|
|
|
+ if (!this.form.id) {
|
|
|
+ this.form.parentId = this.onLoad.parentId
|
|
|
+ this.form.top = this.onLoad.parentId === 0 ? 1 : 0
|
|
|
+ }
|
|
|
add(this.form).then(res => {
|
|
|
console.info('res----', res)
|
|
|
this.$message.success(res.data.msg)
|
|
@@ -124,6 +126,28 @@ export default {
|
|
|
this.form = res.data.data;
|
|
|
})
|
|
|
},
|
|
|
+ disabledRegion(){
|
|
|
+ this.$confirm('确定要禁用该库区吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '正在提交....',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ })
|
|
|
+ disabledStorageRegion(this.form.id).then(res => {
|
|
|
+ console.info('res----', res)
|
|
|
+ this.$message.success('禁用成功')
|
|
|
+ this.getItem(this.form.id)
|
|
|
+ }).finally(() => {
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ },
|
|
|
submitStorage(){
|
|
|
this.$confirm('确定提交吗?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
@@ -136,9 +160,11 @@ export default {
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
})
|
|
|
- this.form.parentId = this.onLoad.id
|
|
|
+ if (!this.form.id) {
|
|
|
+ this.form.top = this.onLoad.parentId === 0 ? 1 : 0
|
|
|
+ this.form.parentId = this.onLoad.parentId
|
|
|
+ }
|
|
|
this.form.status = 1
|
|
|
- this.form.top = this.onLoad.parentId === 0 ? 1 : 0
|
|
|
add(this.form).then(res => {
|
|
|
console.info('res----', res)
|
|
|
this.$message.success(res.data.msg)
|