Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system-vue into dev
This commit is contained in:
commit
e8a5ca2864
@ -27,3 +27,30 @@ 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
|
||||
})
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ export default {
|
||||
/** 保存数据 */
|
||||
save(row) {
|
||||
if (!this.soByType && row.stock < row.count){
|
||||
row.count = 1
|
||||
row.count = 0
|
||||
this.$modal.msgError("库存数量不足")
|
||||
}
|
||||
// 更新表格的数据
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
484
src/views/repair/stockOperate/Components/WaresItem.vue
Normal file
484
src/views/repair/stockOperate/Components/WaresItem.vue
Normal file
@ -0,0 +1,484 @@
|
||||
<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 type="primary" @click="handleCreate(false)" :disabled="selections.length === 0">选择生成采购单</el-button>
|
||||
<el-button 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} 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:{
|
||||
// 通过 true是全部、false是选择
|
||||
async handlePass(flag){
|
||||
// 生成领料单
|
||||
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
|
||||
}
|
||||
},
|
||||
// 生成采购 true是全部、false是选择
|
||||
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 res = await listTwItem({twId: row.twId})
|
||||
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>
|
33
src/views/repair/stockOperate/WaresAudit.vue
Normal file
33
src/views/repair/stockOperate/WaresAudit.vue
Normal 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>
|
@ -53,7 +53,7 @@
|
||||
<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 === 3 || userRole === 4)" 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"
|
||||
@ -169,7 +169,7 @@ export default {
|
||||
handleReTake(row){
|
||||
row = {
|
||||
...row,
|
||||
isLeads: true
|
||||
isLeads: this.userRole === 3
|
||||
}
|
||||
this.$refs.updateRepair.open(row)
|
||||
},
|
||||
|
@ -151,7 +151,7 @@
|
||||
<el-col :span="24">
|
||||
<el-form-item label="结算方法" prop="payType">
|
||||
<el-select v-model="formData.payType">
|
||||
<el-option v-for="item in this.getDictDatas(DICT_TYPE.REPAIR_PAY_TYPE)" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<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>
|
||||
@ -159,7 +159,7 @@
|
||||
<el-row :gutter="1">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="结算备注" prop="remark">
|
||||
<el-input style="width:40rem" type="textarea" v-model="formData.remark" :autosize="{ minRows: 4, maxRows: 8}"/>
|
||||
<el-input style="width:30rem" type="textarea" v-model="formData.remark" :autosize="{ minRows: 4, maxRows: 8}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -175,6 +175,7 @@
|
||||
<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",
|
||||
@ -205,7 +206,8 @@ export default {
|
||||
formRules:{
|
||||
payType: [{required: true, message: '支付方式不能为空', trigger: 'blur'}]
|
||||
},
|
||||
dialogVisible: false
|
||||
dialogVisible: false,
|
||||
isHangAccount: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -236,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)
|
||||
},
|
||||
|
||||
@ -259,6 +260,14 @@ export default {
|
||||
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 {
|
||||
@ -268,7 +277,15 @@ export default {
|
||||
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>
|
||||
|
@ -36,14 +36,14 @@
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.status === '02' || userRole === 3 || userRole === 4" type="text" size="mini" icon="el-icon-view" @click="handleShow(scope.row)">
|
||||
<el-button v-if="scope.row.status !== '01' || userRole === 3 || userRole === 4" 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'" @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 === 3 || userRole === 4 && scope.row.status !== '01'" type="text" size="mini" icon="el-icon-finished">
|
||||
领料
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -52,13 +52,27 @@
|
||||
<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"/>
|
||||
|
||||
<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" @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">领料选择</el-button>
|
||||
<el-button type="primary" @click="handleDoGet(true)">领料全部</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",
|
||||
@ -79,7 +93,12 @@ export default {
|
||||
showSearch: true,
|
||||
loading: false,
|
||||
list: [],
|
||||
total: 0
|
||||
total: 0,
|
||||
dialogVisible: false,
|
||||
dialogLoading: false,
|
||||
items: [],
|
||||
selections: [],
|
||||
formData:{},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -111,6 +130,52 @@ export default {
|
||||
},
|
||||
handleAudit(row){
|
||||
this.handleShow(row)
|
||||
},
|
||||
async handleGet(row){
|
||||
this.formData = {
|
||||
id: row.id,
|
||||
}
|
||||
this.dialogVisible = true
|
||||
try {
|
||||
this.dialogLoading = true
|
||||
const res = await listTwItem({twId: row.twId})
|
||||
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 === '01')
|
||||
}
|
||||
}finally {
|
||||
this.dialogLoading = false
|
||||
}
|
||||
},
|
||||
handleSelect(val){
|
||||
this.selections = val
|
||||
},
|
||||
async handleDoGet(flag){
|
||||
if (flag){
|
||||
this.formData.items = [...this.items.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
waresStatus: "01"
|
||||
}
|
||||
})]
|
||||
}else {
|
||||
this.formData.items = [...this.selections.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
waresStatus: "01"
|
||||
}
|
||||
})]
|
||||
}
|
||||
try {
|
||||
await repairPassTicketWares(this.formData)
|
||||
this.dialogVisible = false
|
||||
this.$modal.msgSuccess("领料成功")
|
||||
await this.getList()
|
||||
}catch{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,11 @@
|
||||
<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>
|
||||
@ -160,9 +164,18 @@
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" align="center" prop="waresName" width="180" :show-overflow-tooltip="true"/>
|
||||
<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 === 2" 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" />
|
||||
@ -182,6 +195,7 @@
|
||||
|
||||
<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 {
|
||||
@ -200,12 +214,16 @@ 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
|
||||
@ -219,6 +237,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
|
||||
}
|
||||
@ -239,9 +263,91 @@ export default {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
// TODO 审核
|
||||
handleAudit(flag){
|
||||
// 审核
|
||||
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
|
||||
}
|
||||
})]
|
||||
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] = []
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -251,4 +357,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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user