diff --git a/src/api/repair/repairworker/index.js b/src/api/repair/repairworker/index.js index 144e61d..ed084fc 100644 --- a/src/api/repair/repairworker/index.js +++ b/src/api/repair/repairworker/index.js @@ -75,3 +75,11 @@ export function listByLeads(){ method: 'get' }) } + +// 查当前登录用户是否维修班组长 +export function getIfLeader(){ + return request({ + url: "/repair/worker/getIfLeader", + method: "get" + }) +} diff --git a/src/api/repair/tickets/TicketWares.js b/src/api/repair/tickets/TicketWares.js index 3f1d86c..635d79f 100644 --- a/src/api/repair/tickets/TicketWares.js +++ b/src/api/repair/tickets/TicketWares.js @@ -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 + }) +} diff --git a/src/api/system/permission.js b/src/api/system/permission.js index 1eee42a..0bf6f7a 100644 --- a/src/api/system/permission.js +++ b/src/api/system/permission.js @@ -42,3 +42,11 @@ export function assignRoleDataScope(data) { data: data }) } + +// 用来判断角色 +export function checkRole(code){ + return request({ + url: '/system/permission/checkRole?code=' + code, + method: 'get' + }) +} diff --git a/src/views/partner/CustomerInfo.vue b/src/views/partner/CustomerInfo.vue index 08384be..f5c1cb8 100644 --- a/src/views/partner/CustomerInfo.vue +++ b/src/views/partner/CustomerInfo.vue @@ -25,16 +25,26 @@ @keyup.enter.native="handleQuery" /> - - - - - + + + + + + + + + + + + + + + + + + 搜索 重置 @@ -58,7 +68,13 @@ - + + + + @@ -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() } } } diff --git a/src/views/repair/tickets/Components/TicketSearch.vue b/src/views/repair/tickets/Components/TicketSearch.vue index 13d87f8..05d5032 100644 --- a/src/views/repair/tickets/Components/TicketSearch.vue +++ b/src/views/repair/tickets/Components/TicketSearch.vue @@ -41,7 +41,7 @@ - + @@ -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) diff --git a/src/views/repair/tickets/Components/TicketTable.vue b/src/views/repair/tickets/Components/TicketTable.vue index e8181c0..6de6f60 100644 --- a/src/views/repair/tickets/Components/TicketTable.vue +++ b/src/views/repair/tickets/Components/TicketTable.vue @@ -104,7 +104,7 @@ 查看 - 结算 @@ -145,12 +145,37 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/repair/tickets/Components/TicketWares.vue b/src/views/repair/tickets/Components/TicketWares.vue index 6c4cbcd..0643bf9 100644 --- a/src/views/repair/tickets/Components/TicketWares.vue +++ b/src/views/repair/tickets/Components/TicketWares.vue @@ -36,14 +36,17 @@ @@ -52,20 +55,38 @@ - + + + + + + + + + + + @@ -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; + } +} diff --git a/src/views/repair/tickets/TicketManager.vue b/src/views/repair/tickets/TicketManager.vue index 91aecb7..98271c6 100644 --- a/src/views/repair/tickets/TicketManager.vue +++ b/src/views/repair/tickets/TicketManager.vue @@ -28,7 +28,7 @@ export default { data() { return { activeTab: 'unFinish', - userRole: -1, + userRole: "", exportRole:[3, 4] } }, diff --git a/src/views/repair/tickets/form/TWOperate.vue b/src/views/repair/tickets/form/TWOperate.vue index 6f826cc..062b823 100644 --- a/src/views/repair/tickets/form/TWOperate.vue +++ b/src/views/repair/tickets/form/TWOperate.vue @@ -187,6 +187,7 @@ + 新增配件 @@ -201,6 +202,55 @@ 取 消 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -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) + }, } } diff --git a/src/views/repair/tickets/form/UpdateRepair.vue b/src/views/repair/tickets/form/UpdateRepair.vue index 53d2f0b..6c722c1 100644 --- a/src/views/repair/tickets/form/UpdateRepair.vue +++ b/src/views/repair/tickets/form/UpdateRepair.vue @@ -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