diff --git a/src/api/repair/stockOperate/stockOperate.js b/src/api/repair/stockOperate/stockOperate.js index a2a1685..c4a4c24 100644 --- a/src/api/repair/stockOperate/stockOperate.js +++ b/src/api/repair/stockOperate/stockOperate.js @@ -11,6 +11,7 @@ export function createRepairSo(data){ }) } +// 分页 export function getRepairSoPage(params){ return request({ url: preUrl + "/page", @@ -18,3 +19,12 @@ export function getRepairSoPage(params){ params }) } + +// 作废 +export function voidSo(data){ + return request({ + url: preUrl + "/void", + method: "post", + data + }) +} diff --git a/src/api/repair/stockOperate/stockOperateItem.js b/src/api/repair/stockOperate/stockOperateItem.js index 543ea86..781b2ef 100644 --- a/src/api/repair/stockOperate/stockOperateItem.js +++ b/src/api/repair/stockOperate/stockOperateItem.js @@ -1 +1,12 @@ import request from '@/utils/request' + +const preUrl= "/repair/soi" + +// 分页查询 +export function getSoiPage(params){ + return request({ + url: preUrl + "/page", + method: "get", + params + }) +} diff --git a/src/views/repair/Components/CorpChoose.vue b/src/views/repair/Components/CorpChoose.vue index 9b6f556..72ed768 100644 --- a/src/views/repair/Components/CorpChoose.vue +++ b/src/views/repair/Components/CorpChoose.vue @@ -10,6 +10,12 @@ import {getCompanyList} from "@/api/base/company"; export default { name: "", + props:{ + value:{ + type: Object, + default: null + } + }, data() { return { corpSelected: undefined, @@ -19,7 +25,14 @@ export default { watch:{ corpSelected(val) { const company = this.corpList.find(item => item.id === val); - this.$emit("selected", company); + this.$emit("input", company); + }, + value(val){ + if (val){ + this.corpSelected = val.id + }else { + this.corpSelected = null + } } }, mounted() { diff --git a/src/views/repair/Components/PartChoose.vue b/src/views/repair/Components/PartChoose.vue index f80cbfc..882e365 100644 --- a/src/views/repair/Components/PartChoose.vue +++ b/src/views/repair/Components/PartChoose.vue @@ -36,7 +36,7 @@ export default { price: "100", type: "不知道", unit: "个", - warehouse: "d1", + warehouse: "6335b519fde3cabf298e763bc1c38df1", miniStock: 100, maxStock: 100, stock: 20, @@ -57,7 +57,7 @@ export default { price: "10", type: "不知道", unit: "个", - warehouse: "d2", + warehouse: "6335b519fde3cabf298e763bc1c38df1", miniStock: 10, maxStock: 10, stock: 5, diff --git a/src/views/repair/Components/WarehouseChoose.vue b/src/views/repair/Components/WarehouseChoose.vue index 0b0fcb7..60d8870 100644 --- a/src/views/repair/Components/WarehouseChoose.vue +++ b/src/views/repair/Components/WarehouseChoose.vue @@ -22,6 +22,13 @@ import {getBaseWarehouseList} from "@/api/base/warehouse"; export default { name: "WarehouseChoose", + props:{ + value:{ + type: String, + default: "", + required:false + } + }, data() { return { warehouseSelected: undefined, @@ -33,6 +40,15 @@ export default { } } }, + watch:{ + value(val){ + if (val){ + this.warehouseSelected = val + }else { + this.warehouseSelected = null + } + }, + }, created() { this.listWarehouse() }, diff --git a/src/views/repair/stockOperate/Components/SoIndex.vue b/src/views/repair/stockOperate/Components/SoIndex.vue index edd98f3..700c681 100644 --- a/src/views/repair/stockOperate/Components/SoIndex.vue +++ b/src/views/repair/stockOperate/Components/SoIndex.vue @@ -4,6 +4,7 @@ - + @@ -29,10 +30,10 @@ - + - + 搜索 @@ -55,7 +56,7 @@ {{ scope.$index + 1 }} - + @@ -84,29 +85,38 @@ {{ scope.$index + 1 }} - + - + - + + + - + + + - @@ -117,7 +127,8 @@ import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue"; import CorpChoose from "@/views/repair/Components/CorpChoose.vue"; import StaffChoose from "@/views/repair/Components/StaffChoose.vue"; import {DICT_TYPE} from "@/utils/dict"; -import {getRepairSoPage} from "@/api/repair/stockOperate/stockOperate"; +import {getRepairSoPage, voidSo} from "@/api/repair/stockOperate/stockOperate"; +import {getSoiPage} from "@/api/repair/stockOperate/stockOperateItem"; export default { name: "SoIndex", @@ -157,7 +168,14 @@ export default { corpId: null, userId: null, userName: null, - soType: this.soByType ? "01" : "02" + soType: this.soByType ? "01" : "02", + purchaseType: this.goodsYes ? "02" : "01", + goodsType: this.goodsYes ? "1" : "0" + }, + formData: { + remark: null, + id: null, + soStatus: "06" }, showSearch: true, list: [], @@ -171,17 +189,30 @@ export default { methods: { // 分页 async pageSo() { - try { - this.loading = true - const res = await getRepairSoPage(this.queryParams) - this.list = res.data.records - this.total = res.data.total - }finally { - this.loading = false + if (this.soByType && this.goodsYes) { + try { + this.loading = true + const res = await getSoiPage(this.queryParams) + this.list = res.data.records + this.total = res.data.total + } finally { + this.loading = false + } + } else { + try { + this.loading = true + const res = await getRepairSoPage(this.queryParams) + this.list = res.data.records + this.total = res.data.total + } finally { + this.loading = false + } } }, // 搜索按钮 handleQuery() { + this.queryParams.pageNo = 1 + this.pageSo() }, // 搜索重置 resetQuery() { @@ -196,6 +227,25 @@ export default { // 门店选择 getCompany(data) { console.log(data) + }, + // 作废 + handleVoidSo(row) { + this.$prompt('作废备注', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + }).then(({value}) => { + this.formData.id = row.id + this.formData.remark = value + this.doVoidSo() + }).catch(() => { + }) + }, + async doVoidSo() { + try { + await voidSo(this.formData) + this.$modal.msgSuccess("作废成功") + await this.pageSo() + }catch{} } } } diff --git a/src/views/repair/stockOperate/Components/SoVoid.vue b/src/views/repair/stockOperate/Components/SoVoid.vue index f29e0a4..ee577c7 100644 --- a/src/views/repair/stockOperate/Components/SoVoid.vue +++ b/src/views/repair/stockOperate/Components/SoVoid.vue @@ -4,6 +4,7 @@ - + - + - + - 搜索 - 重置 + 搜索 + 重置 @@ -38,20 +39,28 @@ {{ scope.$index + 1 }} - - + + - - - + + + + + + + - @@ -60,6 +69,7 @@ import CorpChoose from "@/views/repair/Components/CorpChoose.vue"; import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue"; import StaffChoose from "@/views/repair/Components/StaffChoose.vue"; +import {getRepairSoPage} from "@/api/repair/stockOperate/stockOperate"; export default { name: "SoVoid", @@ -82,7 +92,10 @@ export default { supplierName: null, corpId: null, userId: null, - userName: null + userName: null, + soType: this.soByType ? "01" : "02", + purchaseType: this.goodsYes ? "02" : "01", + soStatus: "06" }, showSearch: true, loading: false, @@ -90,12 +103,35 @@ export default { total: 0, } }, + mounted() { + this.pageSo() + }, methods: { + async pageSo(){ + try { + this.loading = true + const res = await getRepairSoPage(this.queryParams) + this.list = res.data.records + this.total = res.data.total + }finally { + this.loading = false + } + }, // 子组件回调 getStaff(data){ this.queryParams.userId = data.id this.queryParams.userName = data.name }, + // 搜索 + handleQuery(){ + this.queryParams.pageNo = 1 + this.pageSo() + }, + // 重置 + handleResetQuery(){ + this.resetForm('queryForm') + this.handleQuery() + } } } diff --git a/src/views/repair/stockOperate/Components/SoiTable.vue b/src/views/repair/stockOperate/Components/SoiTable.vue index d015173..f73ad33 100644 --- a/src/views/repair/stockOperate/Components/SoiTable.vue +++ b/src/views/repair/stockOperate/Components/SoiTable.vue @@ -4,6 +4,7 @@ - - + + - + - - + + - 搜索 - 重置 + 搜索 + 重置 @@ -44,7 +45,7 @@ {{ scope.$index + 1 }} - + @@ -68,6 +69,7 @@