This commit is contained in:
Vinjor 2024-10-18 09:28:54 +08:00
commit c459dff15b
20 changed files with 1555 additions and 301 deletions

View File

@ -75,3 +75,11 @@ export function listByLeads(){
method: 'get'
})
}
// 查当前登录用户是否维修班组长
export function getIfLeader(){
return request({
url: "/repair/worker/getIfLeader",
method: "get"
})
}

View File

@ -27,3 +27,39 @@ export function removeTicketWares(id){
method: 'delete'
})
}
// 审核
export function auditTicketWares(data){
return request({
url: preUrl + '/audit',
method: 'post',
data
})
}
// 仓库通知领料
export function pass(data){
return request({
url: preUrl + '/pass',
method: 'post',
data
})
}
// 员工确认领料
export function repairPassTicketWares(data){
return request({
url: preUrl + "/repairPass",
method: "post",
data
})
}
// 仓库确认退料
export function passBackTicketWares(data){
return request({
url: preUrl + '/passBack',
method: 'post',
data
})
}

View File

@ -42,3 +42,11 @@ export function assignRoleDataScope(data) {
data: data
})
}
// 用来判断角色
export function checkRole(code){
return request({
url: '/system/permission/checkRole?code=' + code,
method: 'get'
})
}

View File

@ -25,16 +25,26 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="角色" prop="roleCode">
<el-select v-model="queryParams.roleCode" placeholder="请选择角色">
<el-option
v-for="dict in dict.type.jcz_role"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="角色" prop="roleCode">-->
<!-- <el-select v-model="queryParams.roleCode" placeholder="请选择角色">-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.jcz_role"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!--简单比较不做角色绑定-->
<el-table-column label="角色" align="center">
<template slot-scope="scope">
<span>{{ getOrderCount(scope.row.userId) > 1 ? '疑似代办' : '普通用户' }}</span>
</template>
</el-table-column>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -58,7 +68,13 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="客户手机号" align="center" prop="customerPhone" />
<el-table-column label="角色" align="center" prop="roleName" />
<el-table-column label="标签" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.orderCount > 3" type="danger">疑似代办</el-tag>
<el-tag v-else type="success">正常</el-tag>
</template>
</el-table-column>
<el-table-column label="本年度订单数量" align="center" prop="orderCount"/>
<el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
@ -67,11 +83,11 @@
<el-table-column label="年龄" align="center" prop="userAge" />
<el-table-column label="车辆号码----------保险到期时间-------年检到期时间 " width="355" align="center" prop="userCarList" >
<template slot-scope="scope">
<!-- <div style="display: flex">-->
<!-- <div>{{scope.row.userCarList.carNo}}</div>-->
<!-- <div>{{scope.row.userCarList.insuranceExpiryDate}}</div>-->
<!-- <div>{{scope.row.userCarList.nextInspectionDate}}</div>-->
<!-- </div>-->
<!-- <div style="display: flex">-->
<!-- <div>{{scope.row.userCarList.carNo}}</div>-->
<!-- <div>{{scope.row.userCarList.insuranceExpiryDate}}</div>-->
<!-- <div>{{scope.row.userCarList.nextInspectionDate}}</div>-->
<!-- </div>-->
<el-table v-loading="loading" :show-header="tou" :data="scope.row.userCarList" >
@ -162,7 +178,7 @@
<!-- 新增上传车辆信息-->
<!-- 新增上传车辆信息-->
<div v-for="(item,index) in form.userCarList" :key="index" style="width: 100%; ">
<el-collapse v-model="activeName" accordion>
<el-collapse-item title="车辆信息" accordion>
@ -241,26 +257,26 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="保险日期" prop="insuranceDate">
<el-row>
<el-col :span="12">
<el-form-item label="保险日期" prop="insuranceDate">
<el-date-picker
v-model="item.insuranceDate"
type="date"
placeholder="保险日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="保险到期日期" prop="insuranceExpiryDate">
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="保险到期日期" prop="insuranceExpiryDate">
<el-date-picker
v-model="item.insuranceExpiryDate"
type="date"
placeholder="保险到期日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
@ -289,7 +305,7 @@
</div>
</el-form>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
@ -299,218 +315,260 @@
</template>
<script>
import { listCustomerInfo, getCustomerInfo, delCustomerInfo, addCustomerInfo, updateCustomerInfo } from "./api/customer";
import request from "@/utils/request";
import DictTag from '@/components/DictTagOld/index.vue'
import {
listCustomerInfo,
getCustomerInfo,
delCustomerInfo,
addCustomerInfo,
updateCustomerInfo,
getUserOrderCounts
} from './api/customer';
import request from "@/utils/request";
import DictTag from '@/components/DictTagOld/index.vue'
export default {
name: "CustomerInfo",
components:{DictTag},
dicts: ['sys_user_sex','jcz_role'],
data() {
return {
tou:false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerInfoList: [],
// userCarList:[],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
customerName: null,
customerPhone: null,
carNum:null,
},
//
form: {
userCarList:[{
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
}]
},
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
//
rules: {
}
};
},
created() {
this.dict = {type:{}}
for (let i = 0; i < this.$options.dicts.length; i++) {
request({
url: '/rescue/dict/data/type/'+this.$options.dicts[i],
method: 'get'
}).then(res=>{
this.$set(this.dict.type,this.$options.dicts[i],res.data)
})
export default {
name: "CustomerInfo",
components:{DictTag},
dicts: ['sys_user_sex','jcz_role'],
data() {
return {
tou:false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerInfoList: [],
//
userOrderCounts: [],
// userCarList:[],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
customerName: null,
customerPhone: null,
carNum:null,
},
//
form: {
userCarList:[{
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
}]
},
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
//
rules: {
}
};
},
created() {
this.dict = {type:{}}
for (let i = 0; i < this.$options.dicts.length; i++) {
request({
url: '/rescue/dict/data/type/'+this.$options.dicts[i],
method: 'get'
}).then(res=>{
this.$set(this.dict.type,this.$options.dicts[i],res.data)
})
}
this.getList();
// this.queryUserOrderCounts();
},
methods: {
addCommodity(){
let data = {
carModel:this.carModel,
carNo:this.carNo,
maintenanceDate:this.maintenanceDate,
maintenanceMileage:this.maintenanceMileage,
inspectionDate:this.inspectionDate,
insuranceDate:this.insuranceDate,
nextMaintenanceDate:this.nextMaintenanceDate,
nextMaintenanceMileage:this.nextMaintenanceMileage,
nextInspectionDate:this.nextInspectionDate,
insuranceExpiryDate:this.insuranceExpiryDate,
}
this.form.userCarList.push(data)
},
deletecomm(index){
this.form.userCarList.splice(index, 1);
},
/** 查询客户信息列表 */
getList() {
this.loading = true;
//
listCustomerInfo(this.queryParams).then(response => {
this.customerInfoList = response.data.records;
this.total = response.data.total;
this.loading = false;
//
// return getUserOrderCounts().then(userOrderCounts => {
// console.log(":", userOrderCounts.data);
// this.userOrderCounts = userOrderCounts.data;
// }).catch(error => {
// console.error(":", error);
// });
// }).then(userOrderCounts => {
// this.userOrderCounts = userOrderCounts.data;
});
},
// getRoleLabel(userId) {
// const orderCount = this.getOrderCount(userId);
// return orderCount > 1 ? '' : '';
// },
queryUserOrderCounts() {
getUserOrderCounts().then(userOrderCounts => {
console.log("成功获取用户订单数量:", userOrderCounts);
//
this.userOrderCounts = userOrderCounts.data;
this.getList();
}).catch(error => {
console.error("获取用户订单数量失败:", error);
});
},
getOrderCount(userId) {
const userOrder = this.userOrderCounts.find(order => order.userId === userId);
console.log("用户订单数量:", this.userOrderCounts,userOrder);
// 0
return userOrder ? userOrder.orderCount : 0;
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
customerName: null,
customerPhone: null,
userId: null,
sex: null,
userAge: null,
deptId: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
userCarList:[{
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
}]
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
methods: {
addCommodity(){
let data = {
carModel:this.carModel,
carNo:this.carNo,
maintenanceDate:this.maintenanceDate,
maintenanceMileage:this.maintenanceMileage,
inspectionDate:this.inspectionDate,
insuranceDate:this.insuranceDate,
nextMaintenanceDate:this.nextMaintenanceDate,
nextMaintenanceMileage:this.nextMaintenanceMileage,
nextInspectionDate:this.nextInspectionDate,
insuranceExpiryDate:this.insuranceExpiryDate,
}
this.form.userCarList.push(data)
},
deletecomm(index){
this.form.userCarList.splice(index, 1);
},
/** 查询客户信息列表 */
getList() {
this.loading = true;
listCustomerInfo(this.queryParams).then(response => {
this.customerInfoList = response.data.records;
// this.userCarList = response.rows.userCarList
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
customerName: null,
customerPhone: null,
userId: null,
sex: null,
userAge: null,
deptId: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
userCarList:[{
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
}]
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids
this.form = row;
this.open = true;
this.title = "修改客户信息";
// this.reset();
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids
this.form = row;
this.open = true;
this.title = "修改客户信息";
// this.reset();
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除客户信息编号为"' + ids + '"的数据项?').then(function() {
return delCustomerInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('customerInfo/customerInfo/export', {
...this.queryParams
}, `customerInfo_${new Date().getTime()}.xlsx`)
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除客户信息编号为"' + ids + '"的数据项?').then(function() {
return delCustomerInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('customerInfo/customerInfo/export', {
...this.queryParams
}, `customerInfo_${new Date().getTime()}.xlsx`)
}
};
}
};
</script>

View File

@ -9,6 +9,14 @@ export function listCustomerInfo(query) {
})
}
// 查询客户订单数量列表
export function getUserOrderCounts() {
return request({
url: '/customerInfo/customerInfo/userOrderCounts',
method: 'get'
});
}
// 查询客户信息详细
export function getCustomerInfo(id) {
return request({
@ -52,3 +60,5 @@ export function partnerGetWtList(query) {
params: query
})
}

View File

@ -164,7 +164,7 @@ export default {
this.loading = false
},
getWareHoseName(value){
return this.warehouseList.find(item => item.id === value).name
return this.warehouseList?.find(item => item.id === value)?.name
}
}
}

View File

@ -188,7 +188,7 @@ export default {
/** 保存数据 */
save(row) {
if (!this.soByType && row.stock < row.count){
row.count = 1
row.count = 0
this.$modal.msgError("库存数量不足")
}
//

View File

@ -161,7 +161,7 @@ export default {
},
getWareHoseName(value){
if (!(this.warehouseList && this.warehouseList.length > 0)) return ''
return this.warehouseList.find(item => item.id === value).name
return this.warehouseList.find(item => item.id === value)?.name
}
}
}

View File

@ -0,0 +1,512 @@
<template>
<div>
<!-- 搜索 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="关键字" prop="query">
<el-input style="width: 20rem" type="text" placeholder="工单号、车牌号、联系电话" v-model="queryParams.query"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作 -->
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" width="80">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="单据号" align="center" prop="no" />
<el-table-column label="服务顾问" align="center" prop="adviserName" />
<el-table-column label="申请人" align="center" prop="repairName" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TICKET_WARES_STATUS" v-model="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleDispose(scope.row)" icon="el-icon-edit">
处理
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog title="单据处理" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" :row-class-name="getClass" @selection-change="handleSelect">
<el-table-column type="selection" width="80" align="center" />
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="规格" align="center" prop="wares.model" width="180"/>
<el-table-column label="申请数量" align="center" prop="waresCount" width="180"/>
<el-table-column label="库存数量" align="center" prop="wares.stock" width="180"/>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handlePass(false)" :disabled="selections.length === 0 || selections.filter(item => !item.isStock).length !== 0">通过选择</el-button>
<el-button type="success" @click="handlePass(true)"
:disabled="this.items.filter(item => !item.isStock).length !== 0"
:title="this.items.filter(item => !item.isStock).length !== 0 ? '有配件库存不足':''">通过全部</el-button>
<el-button v-if="type" type="primary" @click="handleCreate(false)" :disabled="selections.length === 0">选择生成采购单</el-button>
<el-button v-if="type" type="primary" @click="handleCreate(true)">全部生成采购单</el-button>
</div>
</el-dialog>
<el-dialog title="采购单" :visible.sync="inStockDialog" width="80%" v-dialogDrag append-to-body>
<el-table
:data="partList"
:stripe="true"
:show-overflow-tooltip="true"
show-summary
:summary-method="getSummaries"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
>
<el-table-column label="序号" align="center">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" align="center" prop="name" width="200"/>
<el-table-column label="规格" align="center" width="180" prop="model"/>
<el-table-column label="商品编码" align="center" width="180" prop="code">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.code"
placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.code }}</span>
</div>
</el-table-column>
<el-table-column label="仓库" align="center" width="150" prop="warehouse">
<div class="item" slot-scope="scope">
<WarehouseChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.ware"
@change="changeWare(scope.row)"/>
<span class="item__txt">{{ scope.row.warehouseName }}</span>
</div>
</el-table-column>
<el-table-column label="库存" align="center" width="150" prop="stock"/>
<el-table-column label="单位" align="center" width="150" prop="unit">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.REPAIR_UNIT" v-model="scope.row.unit"/>
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="150" prop="count">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.count"
placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.count }}</span>
</div>
</el-table-column>
<el-table-column label="上次进价" align="center" width="150" prop="purPrice"/>
<el-table-column label="采购单价" align="center" width="150" prop="newPrice">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.newPrice"
placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.newPrice }}</span>
</div>
</el-table-column>
<el-table-column label="采购金额" align="center" width="150" prop="totalPrice"/>
<el-table-column label="备注" align="center" width="180" prop="remark">
<div class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.remark"
placeholder="请输入内容"></el-input>
<span class="item__txt">{{ scope.row.remark }}</span>
</div>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteItem(scope.$index)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-row :gutter="1" style="margin-top: 1rem">
<el-col :span="24">
<el-input v-model="remark" placeholder="备注"/>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="danger" @click="handleSubmit">结算</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getPage, pass, passBackTicketWares} from "@/api/repair/tickets/TicketWares";
import {listTwItem} from "@/api/repair/tickets/TWItem";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {parseTime} from "@/utils/ruoyi";
import SoTable from "@/views/repair/stockOperate/Components/SoTable.vue";
import WarehouseChoose from "@/views/repair/Components/WarehouseChoose.vue";
import {createRepairSo} from "@/api/repair/stockOperate/stockOperate";
import {getUserProfile} from "@/api/system/user";
export default {
name: "WaresItem",
components: {WarehouseChoose, SoTable},
props:{
type: Boolean,
},
data(){
return{
queryParams:{
pageNo: 1,
pageSize: 10,
query: null,
type: this.type ? "01" : "02"
},
showSearch: true,
loading: false,
list:[],
total: 0,
dialogVisible: false,
items:[],
dialogLoading: false,
selections:[],
formData:{},
inStockDialog: false,
partList: [],
includeColumn: ['count', 'totalPrice'],
// cell
clickCellMap: {},
//
editProp: ['warehouse', 'count', 'newPrice', 'remark', 'code'],
remark: null,
}
},
mounted() {
this.getList()
},
methods:{
// truefalse
async handlePass(flag){
//
if (this.type){
this.formData.repairSo = {
soType: "02",
soNo: createUniqueCodeByHead("LL"),
userId: this.formData.repairId,
userName: this.formData.repairName,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
soStatus: "04",
purchaseType: "01"
}
if (flag){
this.formData.repairSois = [...this.items.map(item => {
return {
soiType: '02',
goodsId: item.waresId,
goodsCount: item.waresCount,
}
})]
this.formData.items = [...this.items.map(item => {
return {
id: item.id,
waresStatus: "04"
}
})]
}else {
this.formData.repairSois = [...this.selections.map(item => {
return {
soiType: '02',
goodsId: item.waresId,
goodsCount: item.waresCount,
}
})]
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "04"
}
})]
}
try {
await pass(this.formData)
this.$modal.msgSuccess("处理成功")
await this.getList()
}finally {
this.dialogVisible = false
}
}else {
// 退
this.formData = {}
if (flag){
this.formData.items = [...this.items.map(item => {
return {
id: item.id,
waresStatus: "05"
}
})]
}else {
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: "05"
}
})]
}
try {
await passBackTicketWares(this.formData)
this.$modal.msgSuccess("处理成功")
await this.getList()
}finally {
this.dialogVisible = false
}
}
},
// truefalse
async handleCreate(flag){
this.inStockDialog = true
if (flag){
this.partList = [...this.items.map(item => {
return {
...item.wares,
count: item.waresCount,
newPrice: item.wares.purPrice,
totalPrice: item.waresCount * item.wares.purPrice
}
})]
}else {
this.partList = [...this.selections.map(item => {
return {
...item.wares,
count: item.waresCount,
newPrice: item.wares.price,
totalPrice: item.waresCount * item.wares.price
}
})]
}
this.dialogVisible = false
},
async getList(){
try {
this.loading = true
const res = await getPage(this.queryParams)
if (res.data){
this.list = res.data.records
this.total = res.data.total
}
}finally {
this.loading = false
}
},
handleQuery(){
this.queryParams.pageNo = 1
this.getList()
},
resetQuery(){
this.resetForm('queryForm')
this.handleQuery()
},
async handleDispose(row){
this.formData = {}
this.formData = {
...row
}
this.dialogVisible = true
try {
this.dialogLoading = true
const data = {twId: row.id}
const res = await listTwItem(data)
this.items = res.data
//
this.items.forEach(item => {
item.isStock = item.waresCount <= item.wares.stock
})
//
if (this.type){
this.items = this.items.filter(item => item.waresStatus === '02')
}else {
//
this.items = this.items.filter(item => item.waresStatus !== '02')
}
}finally {
this.dialogLoading = false
}
},
getClass(row){
if (this.type && !row.row.isStock){
return 'stock'
}
return ''
},
handleSelect(row){
this.selections = row
},
//
getSummaries(param) {
const {columns, data} = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (this.includeColumn.includes(column.property)) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index];
}
});
return sums
},
/** 鼠标移入cell */
handleCellEnter(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.add('item__txt--hover')
}
},
/** 鼠标移出cell */
handleCellLeave(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.remove('item__txt--hover')
}
},
/** 点击cell */
handleCellClick(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
// cell
this.saveCellClick(row, cell)
cell.querySelector('.item__txt').style.display = 'none'
cell.querySelector('.item__input').style.display = 'inline'
cell.querySelector('input').focus()
}
},
/** 取消编辑状态 */
cancelEditable(cell) {
cell.querySelector('.item__txt').style.display = 'inline'
cell.querySelector('.item__input').style.display = 'none'
},
/** 保存进入编辑的cell */
saveCellClick(row, cell) {
const id = row.id
if (this.clickCellMap[id] !== undefined) {
if (!this.clickCellMap[id].includes(cell)) {
this.clickCellMap[id].push(cell)
}
} else {
this.clickCellMap[id] = [cell]
}
},
/** 保存数据 */
save(row) {
//
row.totalPrice = row.count * row.newPrice
const id = row.id
// cell
this.clickCellMap[id].forEach(cell => {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
},
changeWare(row) {
if (row.ware) {
row['wareId'] = row.ware.id
row['warehouse'] = row.ware.id
row['warehouseName'] = row.ware.name
}
},
//
deleteItem(index) {
this.partList.splice(index, 1)
},
//
async handleSubmit(){
try {
await this.createInit()
await createRepairSo(this.formData)
this.inStockDialog = false
this.$modal.msgSuccess("新增成功")
await this.getList()
}catch{
}
},
//
async createInit(){
const res = await getUserProfile()
this.formData = {}
this.formData = {
soType: '01',
purchaseType: '01',
soNo: createUniqueCodeByHead("CG"),
userId: res.data.id,
userName: res.data.nickname,
soTime: parseTime(Date.now(), '{y}-{m}-{d}'),
itemCount: this.partList.length,
totalPrice: this.partList.reduce((x, y) => {return x + y.totalPrice}, 0),
soStatus: "03",
remark: this.remark,
}
this.formData.goodsList = [...this.partList.map(item => {
return {
soiType: '01',
goodsId: item.id,
goodsType: '0',
wareId: item?.wareId,
goodsCount: item.count,
goodsPrice: item.newPrice,
remark: item.remark
}
})]
},
}
}
</script>
<style scoped lang="scss">
::v-deep .el-table .stock td{
background-color: #ff0000 !important; /* 红色背景 */
}
.item {
.item__input {
display: none;
width: 100px;
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__inner {
height: 24px !important;
}
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__suffix {
i {
font-size: 12px !important;
line-height: 26px !important;
}
}
}
.item__txt {
box-sizing: border-box;
border: 1px solid transparent;
width: 100px;
line-height: 24px;
padding: 0 8px;
}
.item__txt--hover {
border: 1px solid #dddddd;
border-radius: 4px;
cursor: text;
}
}
</style>

View File

@ -0,0 +1,33 @@
<template>
<div class="app-container">
<el-tabs v-model="activeTab">
<el-tab-pane label="领料申请" name="get">
<WaresItem :type="true"/>
</el-tab-pane>
<el-tab-pane label="退料申请" name="back">
<WaresItem :type="false"/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import WaresItem from "@/views/repair/stockOperate/Components/WaresItem.vue";
export default {
name: "WaresAudit",
components: {WaresItem},
data(){
return{
activeTab: "get"
}
},
methods:{
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -153,7 +153,7 @@ export default {
this.info = row
const id = row.id
const res = await getSt(id)
console.log(res.data)
// console.log(res.data)
this.info.items = res.data.items
const response = await getBaseWarehouseList()
this.warehouseList = response.data

View File

@ -338,7 +338,7 @@ export default {
this.list.splice(index, 1)
}
},
// TODO
//
handleCreateItem() {
switch (this.itemType) {
case "project":

View File

@ -44,22 +44,25 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
</el-button>
<el-button v-if="scope.row.ticketsWorkStatus === '01' && (userRole === 3 || userRole === 4)" size="mini" type="text" icon="el-icon-check" @click="handleTake(scope.row)">
<el-button v-if="scope.row.ticketsWorkStatus === '01' && userRole === 'repair_staff'" size="mini" type="text" icon="el-icon-check" @click="handleTake(scope.row)">
接单
</el-button>
<el-button v-if="userRole === 2 && scope.row.ticketsWorkStatus === '01'" size="mini" type="text" icon="el-icon-check" @click="handleNotify(scope.row)">
<el-button v-if="userRole === 'service_advisor' && scope.row.ticketsWorkStatus === '01'" size="mini" type="text" icon="el-icon-check" @click="handleNotify(scope.row)">
通知施工
</el-button>
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus === '02'" command="handleGet" size="mini" type="text" icon="el-icon-document-add"
<el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus === '02' && userRole === 'repair_staff'" command="handleGet" size="mini" type="text" icon="el-icon-document-add"
>申请领料
</el-dropdown-item>
<el-dropdown-item v-if="isFinish" @click="handleBack(scope.row)" size="mini" type="text" icon="el-icon-document-delete"
<el-dropdown-item v-if="scope.row.ticketsWorkStatus === '02' && userRole === 'repair_staff'" command="handleBack" size="mini" type="text" icon="el-icon-document-delete"
>申请退料
</el-dropdown-item>
<el-dropdown-item v-if="userRole !== 4" command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
<!-- 还要判断是不是员工 -->
<el-dropdown-item
v-if="userRole === 'repair_staff' ? leader : true"
command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
>重新指派
</el-dropdown-item>
</el-dropdown-menu>
@ -74,6 +77,40 @@
<TicketsShow ref="ticketsShow"/>
<UpdateRepair ref="updateRepair" @success="listTickets"/>
<TWOperate ref="twOperate" @success="listTickets"/>
<el-dialog title="退料申请" :visible.sync="backVisible" width="60%" v-dialogDrag append-to-body>
<el-table v-loading="backLoading" :data="partList" :stripe="true" :show-overflow-tooltip="true"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
@selection-change="rowSelect"
>
<el-table-column type="selection" align="center" />
<el-table-column label="商品名称" prop="waresName" align="center"/>
<el-table-column label="规格" prop="wares.model" align="center"/>
<el-table-column label="数量" prop="waresCount" align="center">
<div v-if="scope.row.id" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.waresCount"/>
<span class="item__txt">{{ scope.row.waresCount }}</span>
</div>
</el-table-column>
<el-table-column label="备注" prop="remark" align="center">
<div v-if="scope.row.id" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.remark"/>
<span class="item__txt">{{ scope.row.remark }}</span>
</div>
</el-table-column>
</el-table>
<el-row :gutter="1" style="margin-top: 1rem">
<el-col :span="24">
<el-input v-model="remark" placeholder="备注" />
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button @click="doBack(false)" type="primary" :disabled="selections.length === 0">退料选择</el-button>
<el-button @click="doBack(true)" type="success" :disabled="partList.length === 0">退料全部</el-button>
</div>
</el-dialog>
</div>
</template>
@ -82,6 +119,10 @@ import {getPageType, updateTake} from "@/api/repair/tickets/Tickets";
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
import TWOperate from "@/views/repair/tickets/form/TWOperate.vue";
import {listTwItem} from "@/api/repair/tickets/TWItem";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
import {getIfLeader} from "@/api/repair/repairworker";
export default {
name: "TicketManagerItem",
@ -91,8 +132,8 @@ export default {
type: Boolean,
},
userRole: {
type: Number,
default: -1,
type: String,
default: '',
required: true
}
},
@ -108,13 +149,29 @@ export default {
showSearch: true,
loading: false,
list: [],
total: 0
total: 0,
backVisible: false,
partList: [],
backLoading: false,
// cell
clickCellMap: {},
//
editProp: ['remark', 'waresCount'],
selections: [],
formData: {},
remark: null,
leader: false,
}
},
mounted() {
this.listTickets()
this.isLeader()
},
methods: {
async isLeader(){
const res = await getIfLeader()
this.leader = res.data
},
async listTickets() {
try {
this.loading = true
@ -162,14 +219,30 @@ export default {
}
},
// 退
handleBack(row){
async handleBack(row){
this.formData = {}
this.formData = row
this.remark = null
this.backVisible = true
try {
this.backLoading = true
const data = {
twId: row.twId
}
const res = await listTwItem(data)
this.partList = res.data
//
this.partList = this.partList.filter(item => item.waresStatus === '01')
}finally {
this.backLoading = false
}
},
//
handleReTake(row){
row = {
...row,
isLeads: true
//
isLeads: this.userRole === 'repair_staff'
}
this.$refs.updateRepair.open(row)
},
@ -186,14 +259,123 @@ export default {
case 'handleGet':
this.handleGet(row)
break
case 'handleBack':
this.handleBack(row)
break
default:
break
}
},
/** 鼠标移入cell */
handleCellEnter(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.add('item__txt--hover')
}
},
/** 鼠标移出cell */
handleCellLeave(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.remove('item__txt--hover')
}
},
/** 点击cell */
handleCellClick(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
// cell
this.saveCellClick(row, cell)
cell.querySelector('.item__txt').style.display = 'none'
cell.querySelector('.item__input').style.display = 'inline'
cell.querySelector('input').focus()
}
},
/** 取消编辑状态 */
cancelEditable(cell) {
cell.querySelector('.item__txt').style.display = 'inline'
cell.querySelector('.item__input').style.display = 'none'
},
/** 保存进入编辑的cell */
saveCellClick(row, cell) {
const id = row.id
if (this.clickCellMap[id] !== undefined) {
if (!this.clickCellMap[id].includes(cell)) {
this.clickCellMap[id].push(cell)
}
} else {
this.clickCellMap[id] = [cell]
}
},
/** 保存数据 */
save(row) {
//
row.totalPrice = row.count * row.newPrice
const id = row.id
// cell
this.clickCellMap[id].forEach(cell => {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
},
rowSelect(val){
this.selections = val
},
async doBack(flag){
const data = {
no: createUniqueCodeByHead("TLSQ"),
ticketId: this.formData.id,
type: "02",
status: "01",
remark: this.remark,
adviserId: this.formData.adviserId,
adviserName: this.formData.adviserName
}
if (flag){
data.items = this.partList
}else {
data.items = this.selections
}
await updateTicketWares(data)
this.backVisible = false
this.$modal.msgSuccess("申请成功");
await this.listTickets()
}
}
}
</script>
<style scoped lang="scss">
.item {
.item__input {
display: none;
width: 100px;
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__inner {
height: 24px !important;
}
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__suffix {
i {
font-size: 12px !important;
line-height: 26px !important;
}
}
}
.item__txt {
box-sizing: border-box;
border: 1px solid transparent;
width: 100px;
line-height: 24px;
padding: 0 8px;
}
.item__txt--hover {
border: 1px solid #dddddd;
border-radius: 4px;
cursor: text;
}
}
</style>

View File

@ -41,7 +41,7 @@
</el-col>
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
</el-row>
<TicketTable :ticket-type="TicketType" :list="list" @setVoid="getPage"/>
<TicketTable :ticket-type="TicketType" :list="list" @setVoid="getPage" :is-w-x-c-w="isWXCW"/>
<pagination @pagination="getPage" v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
/>
</div>
@ -53,6 +53,7 @@ import TicketTable from "@/views/repair/tickets/Components/TicketTable.vue";
import RepairTypeChoose from "@/views/repair/Components/RepairTypeChoose.vue";
import {getTicketsPage} from "@/api/repair/tickets/Tickets";
import CorpChoose from "@/views/repair/Components/CorpChoose.vue";
import {checkRole} from "@/api/system/permission";
export default {
name: "TicketSearch",
@ -83,13 +84,20 @@ export default {
},
showSearch: true,
total: 0,
list: []
list: [],
isWXCW: false
}
},
mounted() {
this.getPage()
this.getIsWXCW()
},
methods: {
//
async getIsWXCW(){
const res = await checkRole("wxcw")
this.isWXCW = res.data
},
//
getRepairType(data){
console.log(data)

View File

@ -104,7 +104,7 @@
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
</el-button>
<el-button v-if="TicketType === 'tu'" size="mini" type="text" icon="el-icon-finished"
<el-button v-if="TicketType === 'tu' && isWXCW && !scope.row.payType" size="mini" type="text" icon="el-icon-finished"
@click="handlePaid(scope.row)"
>结算
</el-button>
@ -145,12 +145,37 @@
<!-- <el-table-column label="作废备注" align="center" prop="remark" width="180" />-->
<!-- </el-table>-->
<TicketsShow ref="ticketsShow"/>
<el-dialog title="结算信息" :visible.sync="dialogVisible" width="40%" v-dialogDrag append-to-body>
<el-form :model="formData" ref="formRef" :inline="true" label-width="10rem" :rules="formRules">
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="结算方法" prop="payType">
<el-select v-model="formData.payType">
<el-option v-for="item in this.getDictDataByCode(DICT_TYPE.REPAIR_PAY_TYPE)" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="1">
<el-col :span="24">
<el-form-item label="结算备注" prop="remark">
<el-input style="width:30rem" type="textarea" v-model="formData.remark" :autosize="{ minRows: 4, maxRows: 8}"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="doPaid"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {setTicketsVoid, setTicketsPaid, setTicketsPrint} from '@/api/repair/tickets/Tickets'
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import {getByNameAndMobile} from "@/api/base/customer";
export default {
name: "TicketTable",
@ -164,6 +189,9 @@ export default {
list: {
type: Array,
default: []
},
isWXCW:{
type:Boolean
}
},
data() {
@ -172,8 +200,14 @@ export default {
formData: {
id: null,
ticketsStatus: null,
remark: null
}
remark: null,
payType: null
},
formRules:{
payType: [{required: true, message: '支付方式不能为空', trigger: 'blur'}]
},
dialogVisible: false,
isHangAccount: false
}
},
methods: {
@ -204,7 +238,6 @@ export default {
* 打印
*/
async handlePrint(row) {
// window.location.href = process.env.VUE_APP_BASE_API + '/admin-api/repair/tickets/print/'+row.id;
window.open(process.env.VUE_APP_BASE_API + '/admin-api/repair/tickets/print/'+row.id)
},
@ -218,26 +251,41 @@ export default {
},
handlePaid(row) {
this.$prompt('结算备注', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({value}) => {
const data = {}
data['id'] = row.id
data['remark'] = value
data['ticketsStatus'] = '02'
this.doPaid(data)
}).catch(() => {
})
},
async doPaid(data) {
try {
await setTicketsPaid(data)
this.$modal.msgSuccess("结算成功")
this.$emit("setVoid")
} catch {
this.formData = {
id: null,
ticketsStatus: null,
remark: null,
payType: null
}
}
this.formData['id'] = row.id
this.formData['ticketsStatus'] = '02'
this.dialogVisible = true
this.checkIsHangAccount(row)
},
async checkIsHangAccount(row){
const data = {
cusName: row.userName, phoneNumber: row.userMobile
}
const res = await getByNameAndMobile(data)
this.isHangAccount = res.data.isHangAccount === '1'
},
async doPaid() {
try {
await this.$refs['formRef'].validate()
await setTicketsPaid(this.formData)
this.$modal.msgSuccess("结算成功")
this.dialogVisible = false
this.$emit("setVoid")
}catch{}
},
getDictDataByCode(code){
const data = this.getDictDatas(code);
if (this.isHangAccount){
return data
}else {
return data.filter(item => !item.label.includes("挂账"))
}
},
}
}
</script>

View File

@ -36,14 +36,17 @@
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-view" @click="handleShow(scope.row)">
<el-button v-if="scope.row.status !== '01' || userRole !== 'service_advisor'" type="text" size="mini" icon="el-icon-view" @click="handleShow(scope.row)">
查看
</el-button>
<el-button v-if="userRole === 1 || userRole === 2 && scope.row.status === '01'" type="text" size="mini" icon="el-icon-s-check">
<el-button v-if="(userRole === 'service_advisor' || userRole === 'general_inspection') && scope.row.status === '01'" @click="handleAudit(scope.row)" type="text" size="mini" icon="el-icon-s-check">
审核
</el-button>
<el-button v-if="userRole === 3 || userRole === 4 && scope.row.status !== '01'" type="text" size="mini" icon="el-icon-finished">
完成
<el-button @click="handleGet(scope.row)" v-if="userRole === 'repair_staff' && scope.row.status !== '01' && scope.row.type === '01'" type="text" size="mini" icon="el-icon-finished">
领料
</el-button>
<el-button @click="handleGet(scope.row)" v-if="userRole === 'repair_staff' && scope.row.status !== '01' && scope.row.type === '02'" type="text" size="mini" icon="el-icon-finished">
退料
</el-button>
</template>
</el-table-column>
@ -52,20 +55,38 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole"/>
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList" :type="type"/>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="handleSelect">
<el-table-column type="selection" width="80" align="center" />
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="规格" align="center" prop="wares.model" width="180"/>
<el-table-column label="数量" align="center" prop="waresCount" width="180"/>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleDoGet(false)" :disabled="selections.length === 0">
{{this.type ? '领料选择' : '退料选择'}}
</el-button>
<el-button type="primary" :disabled="items.length === 0" @click="handleDoGet(true)">
{{this.type ? '领料全部' : '退料全部'}}
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getPage} from "@/api/repair/tickets/TicketWares";
import {getPage, repairPassTicketWares} from "@/api/repair/tickets/TicketWares";
import TicketWaresShow from "@/views/repair/tickets/Components/TicketWaresShow.vue";
import {listTwItem} from "@/api/repair/tickets/TWItem";
export default {
name: "TicketWares",
components: {TicketWaresShow},
props:{
type: Boolean,
userRole: Number,
userRole: String,
},
data(){
return{
@ -79,7 +100,13 @@ export default {
showSearch: true,
loading: false,
list: [],
total: 0
total: 0,
dialogVisible: false,
dialogLoading: false,
items: [],
selections: [],
formData:{},
dialogTitle: ""
}
},
mounted() {
@ -108,6 +135,58 @@ export default {
},
handleShow(row){
this.$refs.ticketWaresShow.open(row)
},
handleAudit(row){
this.handleShow(row)
},
async handleGet(row){
this.formData = {
id: row.id,
}
this.dialogVisible = true
this.dialogTitle = this.type ? "领料确认" : "退料确认"
try {
this.dialogLoading = true
const data = {twId: row.id}
const res = await listTwItem(data)
this.items = res.data
//
if (this.type){
this.items = this.items.filter(item => item.waresStatus === '04')
}else {
// 退
this.items = this.items.filter(item => item.waresStatus === '05')
}
}finally {
this.dialogLoading = false
}
},
handleSelect(val){
this.selections = val
},
async handleDoGet(flag){
this.formData.type = this.type ? "01" : "02"
if (flag){
this.formData.items = [...this.items.map(item => {
return {
id: item.id,
waresStatus: this.type ? "01" : "03"
}
})]
}else {
this.formData.items = [...this.selections.map(item => {
return {
id: item.id,
waresStatus: this.type ? "01" : "03"
}
})]
}
try {
await repairPassTicketWares(this.formData)
this.dialogVisible = false
this.$modal.msgSuccess(this.type ? "领料成功" : "退料成功")
await this.getList()
}catch{}
}
}
}

View File

@ -141,22 +141,17 @@
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true">
<el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
>
<el-table-column label="序号" align="center" width="80">
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="名称" align="center" prop="waresName"/>
<el-table-column label="规格" align="center" prop="wares.model" />
<el-table-column label="数量" align="center" prop="waresCount" />
<el-table-column label="状态" align="center" prop="waresStatus">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark" />
<el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 2">
<el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 'service_advisor' && type" width="180">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
@ -169,21 +164,45 @@
</el-switch>
</template>
</el-table-column>
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="规格" align="center" prop="wares.model" width="180"/>
<el-table-column label="数量" align="center" prop="waresCount" width="180"/>
<el-table-column v-if="userRole === 'service_advisor' && type" label="折扣" align="center" prop="itemDiscount" width="180">
<div v-if="formData.status === '01'" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount"/>
<span class="item__txt">{{ scope.row.itemDiscount }}</span>
</div>
<div v-else class="item" slot-scope="scope">
<span>{{ scope.row.itemDiscount }}</span>
</div>
</el-table-column>
<el-table-column label="状态" align="center" prop="waresStatus" width="180">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus" />
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark" width="180" :show-overflow-tooltip="true"/>
</el-table>
</div>
</el-card>
<div slot="footer" class="dialog-footer" v-if="info.status === '01' && (userRole === 'service_advisor' || userRole === 'general_inspection')">
<el-button type="primary" @click="handleAudit(true)"> </el-button>
<el-button @click="handleAudit(false)"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getTicketsById} from "@/api/repair/tickets/Tickets";
import {auditTicketWares} from "@/api/repair/tickets/TicketWares";
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
export default {
name: "TicketWaresShow",
props:{
userRole: Number
userRole: String,
type: Boolean
},
data(){
return{
@ -196,14 +215,19 @@ export default {
waresStatus: null
},
showSearch: true,
loading: false
loading: false,
formData: {},
clickCellMap: {},
editProp: ['itemDiscount'],
}
},
methods:{
async open(row){
if (row){
this.formData = row
const res = await getTicketsById(row.ticketId)
this.info = res.data
this.info.status = row.status
this.queryParams.twId = row.id
await this.getTwItem()
}
@ -214,6 +238,12 @@ export default {
this.loading = true
const res = await listTwItem(this.queryParams)
this.items = res.data
this.items = [...this.items.map(item => {
return {
...item,
itemDiscount: 10,
}
})]
}finally {
this.loading = false
}
@ -233,7 +263,94 @@ export default {
}finally {
this.loading = false
}
}
},
//
async handleAudit(flag){
try {
this.formData['status'] = flag ? "02" : '05'
//
this.formData.wares = [...this.items.map(item => {
return {
itemName: item.waresName,
itemCount: item.waresCount,
itemUnit: item.wares.unit,
itemPrice: item.wares.price,
repairIds: this.formData.repairId,
repairNames: this.formData.repairName,
saleId: this.formData.adviserId,
saleName: this.formData.adviserName,
itemDiscount: item.itemDiscount,
itemMoney: item.wares.price * item.waresCount * (item.itemDiscount / 10),
partId: item.waresId,
remark: item.remark
}
})]
console.log(this.formData)
await auditTicketWares(this.formData)
this.dialogVisible = false
this.$modal.msgSuccess("审核成功")
this.$emit('success')
}catch {
}
},
/** 鼠标移入cell */
handleCellEnter(row, column, cell, event) {
const property = column.property
if (row.id && this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.add('item__txt--hover')
}
},
/** 鼠标移出cell */
handleCellLeave(row, column, cell, event) {
const property = column.property
if (row.id && this.editProp.includes(property)) {
cell.querySelector('.item__txt').classList.remove('item__txt--hover')
}
},
/** 点击cell */
handleCellClick(row, column, cell, event) {
const property = column.property
if (this.editProp.includes(property)) {
if (!row.id || property !== 'goods') {
// cell
this.saveCellClick(row, cell)
cell.querySelector('.item__txt').style.display = 'none'
cell.querySelector('.item__input').style.display = 'inline'
cell.querySelector('input').focus()
}
}
},
/** 取消编辑状态 */
cancelEditable(cell) {
cell.querySelector('.item__txt').style.display = 'inline'
cell.querySelector('.item__input').style.display = 'none'
},
/** 保存进入编辑的cell */
saveCellClick(row, cell) {
const id = row.id
if (this.clickCellMap[id] !== undefined) {
if (!this.clickCellMap[id].includes(cell)) {
this.clickCellMap[id].push(cell)
}
} else {
this.clickCellMap[id] = [cell]
}
},
/** 保存数据 */
save(row) {
if (row.itemDiscount <= 0 || row.itemDiscount > 10){
row.itemDiscount = 10
this.$modal.msgError("折扣只能是1-10")
}
const id = row.id
// cell
this.clickCellMap[id].forEach(cell => {
this.cancelEditable(cell)
})
this.clickCellMap[id] = []
},
}
}
</script>
@ -242,4 +359,36 @@ export default {
.box-card {
margin-bottom: 10px;
}
.item {
.item__input {
display: none;
width: 100px;
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__inner {
height: 24px !important;
}
/* 调整elementUI中样式 如果不需要调整请忽略 */
.el-input__suffix {
i {
font-size: 12px !important;
line-height: 26px !important;
}
}
}
.item__txt {
box-sizing: border-box;
border: 1px solid transparent;
width: 100px;
line-height: 24px;
padding: 0 8px;
}
.item__txt--hover {
border: 1px solid #dddddd;
border-radius: 4px;
cursor: text;
}
}
</style>

View File

@ -28,7 +28,7 @@ export default {
data() {
return {
activeTab: 'unFinish',
userRole: -1,
userRole: "",
exportRole:[3, 4]
}
},

View File

@ -187,6 +187,7 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-button type="primary" size="mini" @click="handleAddWares">新增配件</el-button>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getWaresList"></right-toolbar>
</el-row>
<el-table ref="multipleTable" @selection-change="handleSelectionChange" v-loading="loading" :data="partList" :stripe="true" :show-overflow-tooltip="true" @row-click="handleSelect">
@ -201,6 +202,55 @@
<el-button @click="chooseWaresVisible = false"> </el-button>
</div>
</el-dialog>
<el-dialog title="新增配件" :visible.sync="addWaresVisible" width="60%" v-dialogDrag append-to-body>
<el-form :model="waresFormData" ref="waresFormRef" :rules="waresRules" :inline="true" label-width="10rem" v-loading="wareFormLoading">
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="waresFormData.name" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格" prop="model">
<el-input v-model="waresFormData.model" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="价格" prop="price">
<el-input-number v-model="waresFormData.price" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属分类" prop="type">
<TreeSelect
style="width: 20rem"
v-model="waresFormData.type"
:options="baseTypeTree"
:normalizer="normalizer"
placeholder="请选择所属分类"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="计量单位" prop="unit">
<el-select v-model="waresFormData.unit" placeholder="请选择单位">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.REPAIR_UNIT)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="doAddWares"> </el-button>
<el-button @click="addWaresVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -209,11 +259,14 @@ import TicketItem from "@/views/repair/tickets/Components/TicketItem.vue";
import {getWaresPage} from "@/api/repair/wares";
import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
import {createWares} from "@/api/repair/wares";
import TreeSelect from "@riophae/vue-treeselect";
import * as BaseTypeApi from "@/api/base/type";
export default {
//
name: "TWOperate",
components: {TicketItem},
components: {TreeSelect, TicketItem},
data(){
return{
dialogVisible: false,
@ -243,10 +296,39 @@ export default {
remark: null,
adviserId: null,
adviserName: null
}
},
addWaresVisible: false,
waresFormData:{
name: null,
model: null,
price: null,
type: null,
unit: null,
},
waresRules:{
name: [{required: true, message: '名称不能为空', trigger: 'blur'}],
model: [{required: true, message: '规格不能为空', trigger: 'blur'}],
price: [{required: true, message: '价格不能为空', trigger: 'blur'}],
type: [{required: true, message: '所属分类不能为空', trigger: 'blur'}],
unit: [{required: true, message: '计量单位不能为空', trigger: 'blur'}],
},
wareFormLoading: false,
//
baseTypeTree: [],
}
},
methods:{
/** 转换仓库数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children
};
},
async open(row){
this.reset()
if (row){
@ -408,6 +490,48 @@ export default {
})
this.clickCellMap[id] = []
},
handleAddWares(){
this.waresFormData = {
name: null,
model: null,
price: null,
type: null,
unit: null,
}
this.addWaresVisible = true
this.getBaseTypeTree()
},
async doAddWares(){
try{
this.wareFormLoading = true
await this.$refs.waresFormRef.validate()
this.waresFormData = {
...this.waresFormData,
miniStock: 0,
maxStock: 0,
stock: 0,
status: '01',
purPrice: 0,
}
await createWares(this.waresFormData)
this.addWaresVisible = false
this.$modal.msgSuccess("新增成功")
await this.getWaresList()
}finally {
this.wareFormLoading = false
}
},
/** 获得配置类型树 */
async getBaseTypeTree() {
this.baseTypeTree = [];
let param = {
type: '02'
}
const res = await BaseTypeApi.getBaseTypeList(param);
const root = {id: 0, name: '顶级配置类型', children: []};
root.children = this.handleTree(res.data, 'id', 'parentId', "children", "0")
this.baseTypeTree.push(root)
},
}
}
</script>

View File

@ -186,7 +186,6 @@ export default {
try {
this.info = row
this.loading = true
console.log(row.isLeads)
if (!row.isLeads) {
const res = await listByTicketId(row.id)
this.workerList = res.data