更新代码

This commit is contained in:
xiao-fajia 2024-09-25 18:15:28 +08:00
parent 56ae63493d
commit d8036252db
7 changed files with 82 additions and 27 deletions

View File

@ -27,3 +27,10 @@ export function deleteOther(id){
method: "delete" method: "delete"
}) })
} }
export function getOtherByName(name){
return request({
url: preUrl + "/getByName?name=" + name,
method: "get"
})
}

View File

@ -51,3 +51,10 @@ export function exportRepairProjectExcel(params) {
responseType: 'blob' responseType: 'blob'
}) })
} }
export function getProjectByName(name){
return request({
url: "/repair/project/getByName?name=" + name,
method: "get",
})
}

View File

@ -43,3 +43,10 @@ export function getWaresPage(params) {
}) })
} }
export function getWaresByName(name){
return request({
url: "/repair/wares/getByName?name=" + name,
method: "get"
})
}

View File

@ -45,7 +45,7 @@ export default {
try { try {
await updateOther(this.formData) await updateOther(this.formData)
this.$modal.msgSuccess(this.formData.id ? "修改成功" : "新增成功") this.$modal.msgSuccess(this.formData.id ? "修改成功" : "新增成功")
this.$emit("success") this.$emit("success", this.formData.name)
} finally { } finally {
this.dialogVisible = false this.dialogVisible = false
this.formLoading = false this.formLoading = false

View File

@ -197,7 +197,7 @@ export default {
await RepairProjectApi.updateRepairProject(data); await RepairProjectApi.updateRepairProject(data);
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.dialogVisible = false; this.dialogVisible = false;
this.$emit('success'); this.$emit('success', this.formData.name);
return; return;
} }
// //

View File

@ -21,14 +21,14 @@
<span class="item__txt">{{ scope.row.name ? scope.row.name : scope.row.goods }}</span> <span class="item__txt">{{ scope.row.name ? scope.row.name : scope.row.goods }}</span>
</div> </div>
</el-table-column> </el-table-column>
<!-- <el-table-column align="center" label="使用权益" width="200" prop="coupon">--> <!-- <el-table-column align="center" label="使用权益" width="200" prop="coupon">-->
<!-- <div class="item" slot-scope="scope">--> <!-- <div class="item" slot-scope="scope">-->
<!-- <el-select class="item__input" v-model="scope.row.coupon.id" clearable filterable @blur="save(scope.row)">--> <!-- <el-select class="item__input" v-model="scope.row.coupon.id" clearable filterable @blur="save(scope.row)">-->
<!-- <el-option v-for="coupon in couponList" :key="coupon.id" :label="coupon.couponName" :value="coupon.id" />--> <!-- <el-option v-for="coupon in couponList" :key="coupon.id" :label="coupon.couponName" :value="coupon.id" />-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- <span class="item__txt">{{ get }}</span>--> <!-- <span class="item__txt">{{ get }}</span>-->
<!-- </div>--> <!-- </div>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column align="center" label="规格" width="180" prop="model"/> <el-table-column align="center" label="规格" width="180" prop="model"/>
<el-table-column align="center" label="编码" width="180" prop="code"/> <el-table-column align="center" label="编码" width="180" prop="code"/>
<el-table-column align="center" label="数量" width="180" prop="count"> <el-table-column align="center" label="数量" width="180" prop="count">
@ -128,6 +128,10 @@ import RepairProjectForm from "@/views/repair/project/form/RepairProjectForm.vue
import ProjectChoose from "@/views/repair/Components/ProjectChoose.vue"; import ProjectChoose from "@/views/repair/Components/ProjectChoose.vue";
import OtherChoose from "@/views/repair/Components/OtherChoose.vue"; import OtherChoose from "@/views/repair/Components/OtherChoose.vue";
import OtherForm from "@/views/repair/other/OtherForm.vue"; import OtherForm from "@/views/repair/other/OtherForm.vue";
import request from "@/utils/request";
import {getOtherByName} from "@/api/repair/other";
import {getProjectByName} from "@/api/repair/project";
import {getWares, getWaresByName} from "@/api/repair/wares";
export default { export default {
name: "TicketItem", name: "TicketItem",
@ -141,14 +145,18 @@ export default {
default: 'project', default: 'project',
required: true required: true
}, },
inListData:{ inListData: {
type:Array, type: Array,
default: () => {return []}, default: () => {
return []
},
required: false required: false
}, },
couponList: { couponList: {
type: Array, type: Array,
default: () => {return []}, default: () => {
return []
},
required: false required: false
} }
}, },
@ -156,7 +164,7 @@ export default {
return { return {
loading: false, loading: false,
list: [{ list: [{
coupon:{ coupon: {
id: null id: null
} }
}], }],
@ -177,14 +185,14 @@ export default {
handler(val) { handler(val) {
this.$emit("tableData", val) this.$emit("tableData", val)
const coupons = val.filter(item => item.coupon).map(item => item.coupon) const coupons = val.filter(item => item.coupon).map(item => item.coupon)
if (coupons && coupons.length > 0){ if (coupons && coupons.length > 0) {
this.$emit("changeCoupon", coupons) this.$emit("changeCoupon", coupons)
} }
}, },
deep: true deep: true
}, },
inListData(val){ inListData(val) {
if (val && val.length > 0){ if (val && val.length > 0) {
// console.log(val) // console.log(val)
// this.list = val.map(item => { // this.list = val.map(item => {
// return { // return {
@ -333,17 +341,43 @@ export default {
break break
} }
}, },
returnProject(row) { async returnProject(name) {
// this.list.push(row) const res = await getProjectByName(name)
const data = res.data
}, if (data) {
returnPart(row) { this.list.splice(this.list.length - 1, 0, {
...data,
count: 1,
totalPrice: data.price
})
}
// this.list.push(row) // this.list.push(row)
}, },
returnOther() { async returnPart(name) {
const res = await getWaresByName(name)
const data = res.data
if (data) {
this.list.splice(this.list.length - 1, 0, {
...data,
count: 1,
totalPrice: data.price
})
}
// this.list.push(row)
}, },
getCouponName(id){ async returnOther(name) {
const res = await getOtherByName(name)
const data = res.data
if (data) {
this.list.splice(this.list.length - 1, 0, {
...data,
count: 1,
totalPrice: data.price
})
}
},
getCouponName(id) {
// this. // this.
} }
} }

View File

@ -290,7 +290,7 @@ export default {
await WaresApi.updateWares(data); await WaresApi.updateWares(data);
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.dialogVisible = false; this.dialogVisible = false;
this.$emit('success'); this.$emit('success', this.formData.name);
return; return;
} }
// //