更新代码

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"
})
}
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'
})
}
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 {
await updateOther(this.formData)
this.$modal.msgSuccess(this.formData.id ? "修改成功" : "新增成功")
this.$emit("success")
this.$emit("success", this.formData.name)
} finally {
this.dialogVisible = false
this.formLoading = false

View File

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

View File

@ -21,14 +21,14 @@
<span class="item__txt">{{ scope.row.name ? scope.row.name : scope.row.goods }}</span>
</div>
</el-table-column>
<!-- <el-table-column align="center" label="使用权益" width="200" prop="coupon">-->
<!-- <div class="item" slot-scope="scope">-->
<!-- <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-select>-->
<!-- <span class="item__txt">{{ get }}</span>-->
<!-- </div>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" label="使用权益" width="200" prop="coupon">-->
<!-- <div class="item" slot-scope="scope">-->
<!-- <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-select>-->
<!-- <span class="item__txt">{{ get }}</span>-->
<!-- </div>-->
<!-- </el-table-column>-->
<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="count">
@ -113,7 +113,7 @@
</el-table>
<WaresForm ref="partFormRef" class="noPadding" @success="returnPart"/>
<RepairProjectForm class="noPadding" ref="projectFormRef" @success="returnProject"/>
<RepairProjectForm class="noPadding" ref="projectFormRef" @success="returnProject"/>
<OtherForm ref="otherFormRef" class="noPadding" @success="returnOther"/>
</div>
</template>
@ -128,6 +128,10 @@ import RepairProjectForm from "@/views/repair/project/form/RepairProjectForm.vue
import ProjectChoose from "@/views/repair/Components/ProjectChoose.vue";
import OtherChoose from "@/views/repair/Components/OtherChoose.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 {
name: "TicketItem",
@ -141,14 +145,18 @@ export default {
default: 'project',
required: true
},
inListData:{
type:Array,
default: () => {return []},
inListData: {
type: Array,
default: () => {
return []
},
required: false
},
couponList: {
type: Array,
default: () => {return []},
default: () => {
return []
},
required: false
}
},
@ -156,7 +164,7 @@ export default {
return {
loading: false,
list: [{
coupon:{
coupon: {
id: null
}
}],
@ -177,14 +185,14 @@ export default {
handler(val) {
this.$emit("tableData", val)
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)
}
},
deep: true
},
inListData(val){
if (val && val.length > 0){
inListData(val) {
if (val && val.length > 0) {
// console.log(val)
// this.list = val.map(item => {
// return {
@ -333,17 +341,43 @@ export default {
break
}
},
returnProject(row) {
// this.list.push(row)
},
returnPart(row) {
async returnProject(name) {
const res = await getProjectByName(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)
},
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.
}
}

View File

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