审批申请
This commit is contained in:
parent
ee94473c76
commit
a26488930b
@ -27,3 +27,12 @@ export function removeTicketWares(id){
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 审核
|
||||||
|
export function auditTicketWares(data){
|
||||||
|
return request({
|
||||||
|
url: preUrl + '/audit',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)">
|
<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-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<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>
|
||||||
<el-dropdown-item v-if="isFinish" @click="handleBack(scope.row)" size="mini" type="text" icon="el-icon-document-delete"
|
<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){
|
handleReTake(row){
|
||||||
row = {
|
row = {
|
||||||
...row,
|
...row,
|
||||||
isLeads: true
|
isLeads: this.userRole === 3
|
||||||
}
|
}
|
||||||
this.$refs.updateRepair.open(row)
|
this.$refs.updateRepair.open(row)
|
||||||
},
|
},
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template slot-scope="scope">
|
<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>
|
||||||
<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 v-if="userRole === 1 || userRole === 2 && scope.row.status === '01'" @click="handleAudit(scope.row)" type="text" size="mini" icon="el-icon-s-check">
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole"/>
|
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -141,7 +141,11 @@
|
|||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
|
||||||
</el-row>
|
</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">
|
<el-table-column label="序号" align="center" width="80">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<span>{{ scope.$index + 1 }}</span>
|
<span>{{ scope.$index + 1 }}</span>
|
||||||
@ -160,9 +164,15 @@
|
|||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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="wares.model" width="180"/>
|
||||||
<el-table-column label="数量" align="center" prop="waresCount" 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 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>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="waresStatus" width="180">
|
<el-table-column label="状态" align="center" prop="waresStatus" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus" />
|
<dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus" />
|
||||||
@ -182,6 +192,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getTicketsById} from "@/api/repair/tickets/Tickets";
|
import {getTicketsById} from "@/api/repair/tickets/Tickets";
|
||||||
|
import {auditTicketWares} from "@/api/repair/tickets/TicketWares";
|
||||||
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
|
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -200,12 +211,16 @@ export default {
|
|||||||
waresStatus: null
|
waresStatus: null
|
||||||
},
|
},
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
loading: false
|
loading: false,
|
||||||
|
formData: {},
|
||||||
|
clickCellMap: {},
|
||||||
|
editProp: ['itemDiscount'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
async open(row){
|
async open(row){
|
||||||
if (row){
|
if (row){
|
||||||
|
this.formData = row
|
||||||
const res = await getTicketsById(row.ticketId)
|
const res = await getTicketsById(row.ticketId)
|
||||||
this.info = res.data
|
this.info = res.data
|
||||||
this.info.status = row.status
|
this.info.status = row.status
|
||||||
@ -219,6 +234,12 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
const res = await listTwItem(this.queryParams)
|
const res = await listTwItem(this.queryParams)
|
||||||
this.items = res.data
|
this.items = res.data
|
||||||
|
this.items = [...this.items.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
itemDiscount: 10,
|
||||||
|
}
|
||||||
|
})]
|
||||||
}finally {
|
}finally {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
@ -239,9 +260,91 @@ export default {
|
|||||||
this.loading = false
|
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 +354,36 @@ export default {
|
|||||||
.box-card {
|
.box-card {
|
||||||
margin-bottom: 10px;
|
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>
|
</style>
|
||||||
|
@ -187,6 +187,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row :gutter="10" class="mb8">
|
<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>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getWaresList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table ref="multipleTable" @selection-change="handleSelectionChange" v-loading="loading" :data="partList" :stripe="true" :show-overflow-tooltip="true" @row-click="handleSelect">
|
<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>
|
<el-button @click="chooseWaresVisible = false">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -209,11 +259,14 @@ import TicketItem from "@/views/repair/tickets/Components/TicketItem.vue";
|
|||||||
import {getWaresPage} from "@/api/repair/wares";
|
import {getWaresPage} from "@/api/repair/wares";
|
||||||
import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
|
import {updateTicketWares} from "@/api/repair/tickets/TicketWares";
|
||||||
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
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 {
|
export default {
|
||||||
// 工单配件操作
|
// 工单配件操作
|
||||||
name: "TWOperate",
|
name: "TWOperate",
|
||||||
components: {TicketItem},
|
components: {TreeSelect, TicketItem},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
@ -243,10 +296,39 @@ export default {
|
|||||||
remark: null,
|
remark: null,
|
||||||
adviserId: null,
|
adviserId: null,
|
||||||
adviserName: 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:{
|
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){
|
async open(row){
|
||||||
this.reset()
|
this.reset()
|
||||||
if (row){
|
if (row){
|
||||||
@ -408,6 +490,48 @@ export default {
|
|||||||
})
|
})
|
||||||
this.clickCellMap[id] = []
|
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>
|
</script>
|
||||||
|
@ -186,7 +186,6 @@ export default {
|
|||||||
try {
|
try {
|
||||||
this.info = row
|
this.info = row
|
||||||
this.loading = true
|
this.loading = true
|
||||||
console.log(row.isLeads)
|
|
||||||
if (!row.isLeads) {
|
if (!row.isLeads) {
|
||||||
const res = await listByTicketId(row.id)
|
const res = await listByTicketId(row.id)
|
||||||
this.workerList = res.data
|
this.workerList = res.data
|
||||||
|
Loading…
Reference in New Issue
Block a user