diff --git a/src/api/repair/stockOperate/stockOperate.js b/src/api/repair/stockOperate/stockOperate.js
index 23d957c..a2a1685 100644
--- a/src/api/repair/stockOperate/stockOperate.js
+++ b/src/api/repair/stockOperate/stockOperate.js
@@ -2,6 +2,7 @@ import request from '@/utils/request'
const preUrl = "/repair/so"
+// 采购单\领料单 新增
export function createRepairSo(data){
return request({
url: preUrl + "/create",
@@ -9,3 +10,11 @@ export function createRepairSo(data){
data
})
}
+
+export function getRepairSoPage(params){
+ return request({
+ url: preUrl + "/page",
+ method: "get",
+ params
+ })
+}
diff --git a/src/views/repair/Components/StaffChoose.vue b/src/views/repair/Components/StaffChoose.vue
index a5301bb..223f742 100644
--- a/src/views/repair/Components/StaffChoose.vue
+++ b/src/views/repair/Components/StaffChoose.vue
@@ -10,6 +10,12 @@ import {getStaffList} from "@/api/company/staff";
export default {
name: "StaffChoose",
+ props:{
+ value: {
+ type: Object,
+ defaultValue: null
+ }
+ },
data() {
return {
staffList: [],
@@ -19,7 +25,14 @@ export default {
watch:{
staffSelected(val) {
const staff = this.staffList.find(item => item.id === val);
- this.$emit("selected", staff);
+ this.$emit("input", staff);
+ },
+ value(newVal){
+ if (newVal){
+ this.staffSelected = newVal.id
+ }else {
+ this.staffSelected = null
+ }
}
},
mounted() {
diff --git a/src/views/repair/Components/SupplierChoose.vue b/src/views/repair/Components/SupplierChoose.vue
index 85ff8b9..7011d0f 100644
--- a/src/views/repair/Components/SupplierChoose.vue
+++ b/src/views/repair/Components/SupplierChoose.vue
@@ -11,16 +11,29 @@ import {getBaseSupplierList} from "@/api/repair/supplier";
export default {
name: "SupplierChoose",
+ props: {
+ value: {
+ type: Object,
+ defaultValue: null
+ }
+ },
data() {
return {
supplierSelected: undefined,
supplierList: null
}
},
- watch:{
+ watch: {
supplierSelected(val) {
- const supplier = this.supplierList.find(item => item.id === val);
- this.$emit("selected", supplier);
+ const supplier = this.supplierList.find(item => item.id === val)
+ this.$emit("input", supplier);
+ },
+ value(newVal) {
+ if (newVal) {
+ this.supplierSelected = newVal.id
+ } else {
+ this.supplierSelected = null
+ }
}
},
mounted() {
diff --git a/src/views/repair/Components/WarehouseChoose.vue b/src/views/repair/Components/WarehouseChoose.vue
index 7dad376..0b0fcb7 100644
--- a/src/views/repair/Components/WarehouseChoose.vue
+++ b/src/views/repair/Components/WarehouseChoose.vue
@@ -51,7 +51,8 @@ export default {
return JSON.parse(JSON.stringify(result))
},
handleNodeClick(node){
- this.$emit("selected", node)
+ this.$emit("input", node.name)
+ this.$emit("change")
this.warehouseSelected = node.name
this.$refs.selectTree.blur()
}
diff --git a/src/views/repair/stockOperate/Components/SoIndex.vue b/src/views/repair/stockOperate/Components/SoIndex.vue
index ad3f7d9..edd98f3 100644
--- a/src/views/repair/stockOperate/Components/SoIndex.vue
+++ b/src/views/repair/stockOperate/Components/SoIndex.vue
@@ -12,7 +12,7 @@
-
+
@@ -25,7 +25,7 @@
+ :value="item.value"/>
@@ -55,19 +55,19 @@
{{ scope.$index + 1 }}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ scope.$index + 1 }}
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
item.label.toString().indexOf("领料") === -1)
}
},
- components:{
+ components: {
StaffChoose,
SupplierChoose,
CorpChoose
},
- props:{
+ props: {
soByType: {
type: Boolean,
defaultValue: true,
@@ -145,17 +146,18 @@ export default {
},
data() {
return {
- queryParams:{
+ queryParams: {
pageNo: 1,
pageSize: 10,
- searchTimeArray:[],
+ searchTimeArray: [],
soNo: null,
supplierId: null,
supplierName: null,
soStatus: null,
corpId: null,
userId: null,
- userName: null
+ userName: null,
+ soType: this.soByType ? "01" : "02"
},
showSearch: true,
list: [],
@@ -163,21 +165,36 @@ 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
+ }
+ },
// 搜索按钮
- handleQuery(){},
+ handleQuery() {
+ },
// 搜索重置
- resetQuery(){
+ resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
// 员工选择组件的回调
- getStaff(data){
+ getStaff(data) {
this.queryParams.userId = data.id
this.queryParams.userName = data.name
},
// 门店选择
- getCompany(data){
+ getCompany(data) {
console.log(data)
}
}
diff --git a/src/views/repair/stockOperate/Components/SoInfo.vue b/src/views/repair/stockOperate/Components/SoInfo.vue
index 7ab2e92..7eed3ab 100644
--- a/src/views/repair/stockOperate/Components/SoInfo.vue
+++ b/src/views/repair/stockOperate/Components/SoInfo.vue
@@ -4,8 +4,8 @@
-
-
+
+
@@ -20,8 +20,8 @@
-
-
+
+
@@ -54,7 +54,7 @@
结算
- 确定
+ 确定
@@ -89,12 +89,10 @@ export default {
return {
formData: {
soNo: null,
- supplierId: null,
- supplierName: null,
+ supplier: null,
soTime: Date.now(),
- userId: null,
- userName: null,
- partList: [],
+ user: null,
+ goodsList: [],
totalPrice: null,
soType: this.soByType ? "01" : "02",
purchaseType: "01",
@@ -107,8 +105,7 @@ export default {
}
},
mounted() {
- this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL")
- this.staffRole = this.soByType ? this.staffRole : "领料人"
+ this.init()
},
methods: {
// 得到选择的员工
@@ -142,11 +139,61 @@ export default {
tableData(data){
this.formData.totalPrice = data.reduce((x, y) => {return x + y.totalPrice}, 0)
this.formData.itemCount = data.reduce((x, y) => {return x + y.count}, 0)
- this.formData.partList = data
+ this.formData.goodsList = data.map(item => {
+ return {
+ goodsId: item.id,
+ goodsType: "0",
+ wareId: "0",
+ goodsCount: item.count,
+ goodsPrice: item.newPrice,
+ remark: item.remark
+ }
+ })
},
+ // 提交
async handleSubmit(){
- const res = await createRepairSo(this.formData)
- console.log(res)
+ try {
+ this.createInit()
+ await createRepairSo(this.formData)
+ this.$modal.msgSuccess("新增成功")
+ this.init()
+ }catch{
+ }
+ },
+ // 初始化
+ init(){
+ this.formData = {
+ soNo: null,
+ supplier: null,
+ soTime: Date.now(),
+ user: null,
+ goodsList: [],
+ totalPrice: null,
+ soType: this.soByType ? "01" : "02",
+ purchaseType: "01",
+ itemCount: 0,
+ soStatus: this.soByType ? "01" : "04",
+ remark: null,
+ }
+ this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL")
+ this.staffRole = this.soByType ? this.staffRole : "领料人"
+ this.partList = []
+ },
+ // 提交前的构建
+ createInit(){
+ const data = this.formData
+ this.formData = {
+ ...data,
+ userId: data.user.id,
+ userName: data.user.name,
+ }
+ if (this.soByType){
+ this.formData = {
+ ...data,
+ supplierId: data.supplier.id,
+ supplierName: data.supplier.name
+ }
+ }
}
}
}
diff --git a/src/views/repair/stockOperate/Components/SoTable.vue b/src/views/repair/stockOperate/Components/SoTable.vue
index 524e9c7..21b635a 100644
--- a/src/views/repair/stockOperate/Components/SoTable.vue
+++ b/src/views/repair/stockOperate/Components/SoTable.vue
@@ -16,7 +16,16 @@
-
+
+
+
+ {{ scope.row.warehouse }}
+
+
@@ -31,7 +40,7 @@
-
@@ -59,8 +68,11 @@