退料接受接口对接

This commit is contained in:
zzyuan 2024-11-14 10:31:33 +08:00
parent 882b72ad1b
commit 0e8ebc3559
6 changed files with 1499 additions and 782 deletions

90
src/api/back/index.js Normal file
View File

@ -0,0 +1,90 @@
import request from '@/utils/request'
//退料申请-列表
export function getBackApplyList(query) {
return request({
url: '/material/back_apply_info/list',
method: 'get',
params: query,
})
}
// 工程下拉选
export function getProjectList(data) {
return request({
url: '/material/select/getProjectList',
method: 'post',
data: data,
})
}
// 往来单位下拉选
export function getUnitList(data) {
return request({
url: '/material/select/getUnitList',
method: 'post',
data: data,
})
}
// 协议
export function getAgreementInfoById(data) {
return request({
url: '/material/select/getAgreementInfoById',
method: 'post',
data: data,
})
}
// 可退料设备类型-根据协议查询
export function getDeviceTreeByAgreementId(data) {
return request({
url: '/material/select/getUseTypeTree',
method: 'post',
data: data,
})
}
// 退料新增
export function addBackApply(data) {
return request({
url: '/material/back_apply_info',
method: 'post',
data: data,
})
}
// 退料--删除
export function backApplyRemove(ids) {
return request({
url: '/material/back_apply_info/' + ids,
method: 'delete',
})
}
// 查询详情
export function getBackApplyInfo(id) {
return request({
url: '/material/back_apply_info/' + id,
method: 'get'
})
}
// 退料新增
export function editBackApply(data) {
return request({
url: '/material/back_apply_info/edit',
method: 'post',
data: data,
})
}
//新增编辑-编码类型-获取所有编码
export function getMachineById(query) {
return request({
url: '/material/back_apply_info/getMachineById',
method: 'get',
params: query,
})
}

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,18 @@
:inline="true"
v-show="showSearch"
label-width="100px"
>
>
<el-form-item label="退料申请时间" prop="time">
<el-date-picker
v-model="queryParams.time"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
type="daterange"
value-format="yyyy-MM-dd"
style="width: 240px"
></el-date-picker>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
<el-input
maxlength="50"
@ -17,20 +28,43 @@
style="width: 240px"
/>
</el-form-item>
<!-- <el-form-item label="退料单位" prop="unitId">
<el-form-item label="退料状态" prop="taskStatus">
<el-select
v-model="queryParams.taskStatus"
clearable
filterable
style="width: 240px"
placeholder="请选择"
>
<el-option
v-for="dict in dict.type.back_task_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
<!-- <el-option
v-for="item in taskStatusList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option> -->
</el-select>
</el-form-item>
<br>
<el-form-item label="退料单位" prop="unitId">
<el-select
v-model="queryParams.unitId"
clearable
filterable
@change="getAgreementByUnit"
@change="GetProData"
style="width: 240px"
placeholder="请选择"
>
<el-option
v-for="item in unitList"
:key="item.id"
:label="item.name"
:value="item.id"
:key="item.unitId"
:label="item.unitName"
:value="item.unitId"
></el-option>
</el-select>
</el-form-item>
@ -39,70 +73,17 @@
v-model="queryParams.proId"
clearable
filterable
@change="getAgreementByProId"
style="width: 240px"
placeholder="请选择"
>
<el-option
v-for="item in proList"
:key="item.id"
:label="item.name"
:value="item.id"
:key="item.proId"
:label="item.proName"
:value="item.proId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工机具类型" prop="typeId">
<el-cascader
v-model="queryParams.typeId"
:options="deptOptions"
:props="{
expandTrigger: 'hover',
label: 'typeName',
value: 'typeId',
checkStrictly: true,
}"
@change="handleNodeClick"
aria-placeholder="请选择极具类型"
style="width: 240px"
></el-cascader>
</el-form-item> -->
<el-form-item label="退料申请时间" prop="time">
<el-date-picker
v-model="queryParams.time"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
type="date"
value-format="yyyy-MM-dd"
style="width: 240px"
></el-date-picker>
</el-form-item>
<el-form-item label="退料状态" prop="taskStatus">
<el-select
v-model="queryParams.taskStatus"
clearable
filterable
style="width: 240px"
placeholder="请选择"
>
<el-option
v-for="item in taskStatusList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="协议号" prop="agreementCode">
<el-input
maxlength="50"
v-model="queryParams.agreementCode"
placeholder="请选择协议号"
clearable
style="width: 240px"
/>
</el-form-item> -->
<el-form-item>
<el-button
type="primary"
@ -185,7 +166,7 @@
<el-table-column
label="退料工程"
align="center"
prop="lotName"
prop="proName"
:show-overflow-tooltip="true"
/>
<el-table-column
@ -234,45 +215,24 @@
label="状态"
align="center"
:show-overflow-tooltip="true"
prop="taskStatus"
>
<template slot-scope="scope">
<!-- 状态 37-待审核 38-已审核 -->
<el-button type="text" v-if="scope.row.taskStatus == '37'"
>待审核</el-button
>
<el-button
type="text"
style="color: #67c23a"
v-if="scope.row.taskStatus == '38'"
>已审核</el-button
>
<el-button type="text" v-if="scope.row.taskStatus == '39'"
>退料核查</el-button
>
<el-button
type="text"
style="color: #67c23a"
v-if="scope.row.taskStatus == '40'"
>退料完成</el-button
>
<el-button
type="text"
style="color: #67c23a"
v-if="scope.row.taskStatus == '101'"
>退料驳回</el-button
>
<dict-tag :options="dict.type.back_task_status" :value="scope.row.taskStatus"/>
<!-- <el-button type="text" v-if="scope.row.taskStatus == '0'">未完成</el-button>
<el-button type="text" style="color: #67c23a" v-if="scope.row.taskStatus == '2'">已完成</el-button>
<el-button type="text" style="color: #67c23a" v-if="scope.row.taskStatus == '1'">已驳回</el-button> -->
</template>
</el-table-column>
<el-table-column
label="打印状态"
align="center"
prop=""
prop="printStatus"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<div>
未打印
</div>
<div v-if="scope.row.printStatus==1">已打印</div>
<div v-if="scope.row.printStatus==0">未打印</div>
</template>
</el-table-column>
<el-table-column
@ -292,25 +252,18 @@
size="mini"
plain
icon="el-icon-zoom-in"
@click="handleSee(scope.row, 'see')"
@click="handleSee(scope.row)"
>查看</el-button
>
<!-- <el-button
size="mini"
type="warning"
plain
icon="el-icon-edit"
@click="handlUpdate(scope.row, 'update')"
>编辑</el-button
> -->
<el-button
size="mini"
type="info"
v-if="scope.row.taskStatus == '101'"
@click="handleUpdate(scope.row)"
type="warning"
plain
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>编辑</el-button
>
驳回提交
</el-button>
<el-button
size="mini"
type="danger"
@ -335,191 +288,7 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
:close-on-click-modal="false"
>
<el-form
:model="dialogQueryParams"
ref="queryForm1"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-row>
<el-form-item label="退料单位" prop="unitName">
<el-input
disabled
v-model="dialogQueryParams.unitName"
placeholder="请输入退料单位"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item label="退料工程" prop="lotName">
<el-input
disabled
v-model="dialogQueryParams.lotName"
placeholder="请输入退料工程"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item label="退料协议编号" prop="agreementCode">
<el-input
disabled
v-model="dialogQueryParams.agreementCode"
placeholder="请输入退料协议编号"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item label="预退料时间" prop="backTime">
<el-date-picker
style="width: 240px"
disabled
v-model="dialogQueryParams.backTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择时间"
></el-date-picker>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="退料人" prop="backPerson">
<el-input
disabled
v-model="dialogQueryParams.backPerson"
placeholder="请输入退料人"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item label="退料人电话" prop="phone">
<el-input
disabled
v-model="dialogQueryParams.phone"
placeholder="请输入退料人电话"
clearable
style="width: 240px"
/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="dialogQueryParams.keyWord"
placeholder="请输入关键字"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery1"
>查询</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery1"
>重置</el-button
>
</el-form-item>
</el-row>
</el-form>
<el-table
v-loading="loading"
:data="loadingList"
height="500px"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="序号"
align="center"
width="80"
type="index"
>
<template slot-scope="scope">
<span>{{
(dialogQueryParams.pageNum - 1) * 10 +
scope.$index +
1
}}</span>
</template>
</el-table-column>
<el-table-column
label="类型名称"
align="center"
prop="typeName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="规格型号"
align="center"
prop="typeCode"
:show-overflow-tooltip="true"
/>
<!-- <el-table-column
label="编码"
align="center"
prop="maCode"
:show-overflow-tooltip="true"
/> -->
<el-table-column
label="当前在用量"
align="center"
prop="useNum"
:show-overflow-tooltip="true"
/>
<el-table-column
label="退料数量"
align="center"
prop="num"
class-name="small-padding fixed-width"
width="200"
>
<!-- <template slot-scope="scope">
<el-input
v-model="scope.row.num"
:disabled="true"
placeholder="请输入退料数量"
clearable
/>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="loadingTotal > 0"
:total="loadingTotal"
:page.sync="dialogQueryParams.pageNum"
:limit.sync="dialogQueryParams.pageSize"
@pagination="getDialogList"
/>
<div
slot="footer"
class="dialog-footer"
style="text-align: center"
v-if="loadingType == 'update'"
>
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</el-dialog>
<!-- 退料单 -->
<!-- <dialogFormByCq
:dialogTitle="title"
@ -548,7 +317,7 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">返回</el-button>
<el-button @click="openOne=false">返回</el-button>
<el-button type="primary" @click="submitOpenOneForm()"
>确定</el-button
>
@ -578,12 +347,13 @@
<script>
// import {
// ApiGetBackApplyList,
// getViewByApply,
// backApplyDelApi,
// submitBackApplyApi,
// } from '@/api/claimAndRefund/return.js'
import {
getBackApplyList,
getProjectList,
getUnitList,
backApplyRemove
} from '@/api/back/index.js'
// import { getInfo, h } from '@/api/login'
// import {
// getUnitData,
@ -595,7 +365,7 @@
export default {
name: '',
dicts: ['sys_normal_disable'],
dicts: ['back_task_status'],
// components: { dialogFormByCq },
data() {
return {
@ -672,25 +442,13 @@ export default {
proList: [],
taskStatusList: [
{
name: '待退料审核',
name: '待退料',
id: '37',
},
{
name: '退料审核通过',
name: '退料已提交',
id: '38',
},
{
name: '退料核查中',
id: '39',
},
{
name: '退料完成',
id: '40',
},
{
name: '退料审核驳回',
id: '101',
},
}
],
rowObj: {},
loadingType: '',
@ -699,48 +457,53 @@ export default {
}
},
created() {
// this.getList();
// this.initSelectData()
this.getList();
this.initSelectData()
// this.InitIGetInfo()
},
methods: {
// claimAndRefund/return/returnApplyAdd
// claimAndRefund/return/returnApplyAdd
/** 查询字典类型列表 startTime,结束日期endTime */
InitIGetInfo() {
// getInfo().then((res) => {
// this.companyId = res.user.companyId
// this.getList()
// })
},
initSelectData() {
this.GetUnitData()
this.GetProData()
},
//
async GetUnitData() {
const params = {}
const res = await getUnitList(params)
this.unitList = res.data
},
//
async GetProData() {
const params = {
unitId: this.queryParams.unitId,
}
const res = await getProjectList(params)
this.proList = res.data
},
/** 查询列表 startTime,结束日期endTime */
async getList() {
this.loading = true
if (this.queryParams.time && this.queryParams.time.length > 0) {
this.queryParams.startTime = this.queryParams.time[0]
this.queryParams.endTime = this.queryParams.time[1]
}
try {
let params = {
companyId: this.companyId,
...this.queryParams,
}
// const res = await ApiGetBackApplyList(params)
// this.typeList = res.data.rows
// this.total = res.data.total
const res = await getBackApplyList(params)
this.typeList = res.rows
this.total = res.total
this.loading = false
} catch (error) {}
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
dictId: undefined,
dictName: undefined,
dictType: undefined,
status: '0',
remark: undefined,
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
@ -754,28 +517,24 @@ export default {
this.initSelectData()
this.handleQuery()
},
/** 新增按钮操作 */
handleAdd() {
// this.$tab.closeOpenPage('/claimAndRefund/return/returnApplyAddByCq')
this.$emit('returnApply')
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.dictId)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$emit('returnApply')
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.$tab.closeOpenPage({
// path: '/claimAndRefund/return/returnApplyAddByCq',
// query: {
// Id: row.id,
// isEdit: true,
// },
// })
this.$emit('rejectSubmit', { id: row.id, agreementId: row.agreementId })
this.$emit("returnEdit",row.id);
},
/** 查看按钮操作 */
handleSee(row) {
this.$emit("queryReturn",row.id);
},
// 退
handleUpdateOrder() {
this.title = '查看'
@ -792,60 +551,15 @@ export default {
this.openTextThree = '提交成功!'
this.openTwo = true
},
/** 提交按钮 */
submitForm: function () {
this.$refs['queryForm1'].validate((valid) => {
if (valid) {
let backApplyInfo = []
for (let i = 0; i < this.loadingList.length; i++) {
this.loadingList[i].companyId = this.companyId
}
backApplyInfo.push({
backPerson: '张三',
phone: '1234578988',
remark: '1425备注',
backTime: '2023-12-14',
// backPerson: this.dialogQueryParams.backPerson,
// phone: this.dialogQueryParams.phone,
// remark: this.dialogQueryParams.remark,
// backTime: this.dialogQueryParams.backTime,
companyId: this.companyId,
})
let params = {
companyId: this.companyId,
agreementId: this.rowObj.agreementId,
backApplyInfo: JSON.stringify(backApplyInfo),
backApplyDetails: JSON.stringify(this.loadingList),
}
console.log('param----', params)
// submitBackApplyApi(params).then((res) => {})
// if (this.form.dictId != undefined) {
// updateType(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// } else {
// addType(this.form).then(response => {
// this.$modal.msgSuccess("");
// this.open = false;
// this.getList();
// });
// }
} else {
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
let param = {
id: row.id + '',
}
// let param = {
// id:row.id+ '',
// }
this.$modal
.confirm('是否确认删除所选择的数据项?')
.then(() => {
// return backApplyDelApi(param)
return backApplyRemove(row.id)
})
.then(() => {
this.getList()
@ -858,29 +572,8 @@ export default {
this.isShowOneFlag = true
this.rowObj = row
},
handleSee(row, type) {
this.dialogQueryParams.unitName = row.unitName
this.dialogQueryParams.lotName = row.lotName
this.dialogQueryParams.agreementCode = row.agreementCode
this.dialogQueryParams.backPerson = row.backPerson
this.dialogQueryParams.phone = row.phone
this.dialogQueryParams.backTime = row.backTime + ''
this.$set(this.dialogQueryParams, 'keyWord', '')
this.loadingType = type
this.rowObj = row
this.open = true
this.getDialogList()
},
handlUpdate(row, type) {
this.loadingType = type
this.rowObj = row
this.open = true
this.getDialogList()
},
/** 导出按钮操作 */
handleExport() {
/** 导出按钮操作 */
handleExport() {
this.download(
'material/backApply/export',
{
@ -889,84 +582,6 @@ export default {
`退料申请单_${new Date().getTime()}.xlsx`,
)
},
getDialogList() {
let params = {
id: this.rowObj.id,
agreementId: this.rowObj.agreementId,
keyWord: this.dialogQueryParams.keyWord,
pageNum: this.dialogQueryParams.pageNum,
pageSize: this.dialogQueryParams.pageSize,
}
// getViewByApply(params).then((res) => {
// console.log(res)
// this.loadingList = res.data.rows
// this.loadingTotal = res.data.total
// })
},
InitIGetInfo() {
// getInfo().then((res) => {
// this.companyId = res.user.companyId
// this.getList()
// })
// this.initGetUseTypeTree()
},
handleNodeClick(ev) {},
initSelectData() {
this.GetUnitData()
this.GetProData()
},
//
async GetUnitData() {
const params = {}
// const res = await getUnitData(params)
// this.unitList = res.data
},
//
async GetProData() {
const params = {
id: this.queryParams.unitId,
}
// const res = await getProData(params)
// this.proList = res.data
},
//
async InitGetAgreementInfoById() {
const { unitId, proId } = this.queryParams
if (!unitId || !proId) {
return
}
const params = {
unitId: unitId,
projectId: proId,
}
// const res = await getAgreementInfoById(params)
// this.queryParams.agreementCode = res.data.agreementCode
},
getAgreementByUnitAndProId() {
this.InitGetAgreementInfoById()
},
getAgreementByProId() {
this.InitGetAgreementInfoById()
},
getAgreementByUnit() {
this.GetProData()
},
handleQuery1() {
this.getDialogList()
},
resetQuery1() {
this.dialogQueryParams.keyWord = ''
this.getDialogList()
},
async initGetUseTypeTree(id) {
// let params = {
// agreementId: id,
// }
// const res = await getUseTypeTree(params)
// console.log('res-getUseTypeTree', res)
// this.deptOptions = res.data
},
},
}
</script>

View File

@ -0,0 +1,851 @@
<template>
<div>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:rules="queryRules"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-row>
<el-form-item label="退料单位" prop="unitId">
<el-select
v-model="queryParams.unitId"
clearable
filterable
@change="GetProData"
style="width: 240px"
placeholder="请选择"
:disabled="isView"
>
<el-option
v-for="item in unitList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="退料工程" prop="proId">
<el-select
v-model="queryParams.proId"
clearable
filterable
@change="GetUnitData"
style="width: 240px"
placeholder="请选择"
:disabled="isView"
>
<el-option
v-for="item in proList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="协议号" prop="agreementCode">
<el-input
v-model="queryParams.agreementCode"
disabled
style="width: 240px"
></el-input>
</el-form-item> -->
<el-form-item label="退料人" prop="backPerson">
<el-input
v-model="queryParams.backPerson"
placeholder="请输入退料人"
clearable :disabled="isView"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="退料人电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入退料人电话"
clearable :disabled="isView"
style="width: 240px"
:maxlength="11"
/>
</el-form-item>
<!-- <el-form-item label="物品类型" prop="status">
<el-cascader
placeholder="请输入物品类型"
:options="deviceTypeTree"
:props="deviceTypeTreeProps"
v-model="deviceType"
@change="deviceTypeChange"
ref="deviceTypeCascader"
filterable
style="width: 240px"
></el-cascader>
</el-form-item> -->
<el-form-item label="退料时间" prop="backTime">
<el-date-picker
v-model="queryParams.backTime"
type="date" :disabled="isView"
value-format="yyyy-MM-dd"
placeholder="选择时间"
style="width: 240px"
>
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="roleName">
<el-input
v-model="queryParams.remark"
placeholder="请输入备注"
clearable :disabled="isView"
rows="1"
type="textarea"
style="width: 240px"
/>
</el-form-item>
</el-row>
<el-row> </el-row>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-back"
size="mini"
@click="handleBack"
>退料管理</el-button
>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>保存</el-button
>
</el-col> -->
<el-col :span="1.5">
<!-- <el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:role:export']"
>导出</el-button> -->
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="backApplyDetails"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
min-width="55"
align="center"
:selectable="selectable"
/>
<el-table-column label="序号" type="index" align="center" min-width="80" />
<el-table-column
label="类型名称"
align="center"
prop="typeName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="规格型号"
align="center"
prop="typeCode"
:show-overflow-tooltip="true"
/>
<el-table-column
label="计量单位"
align="center"
prop="unitNames"
/>
<el-table-column
label="当前在用量"
align="center"
prop="useNum"
>
</el-table-column>
<el-table-column
label="管理模式"
align="center"
prop="unitNames"
/>
<el-table-column
label="退料数量"
align="center"
prop="createTime"
min-width="100"
>
<template slot-scope="scope">
<el-input
v-model.number="scope.row.num"
placeholder="退料数量"
type="number"
min="1"
clearable
@input="checkNum(scope.row)"
style="width: 100%"
/>
<div style="color: rgb(2, 167, 240);" @click="openAddCode(scope.row)">添加编码</div>
</template>
</el-table-column>
<el-table-column
label="外观判定"
align="center"
prop="look"
min-width="120"
>
<template slot-scope="scope">
<el-input
v-model.number="scope.row.look"
placeholder="外观判定"
type="text"
clearable maxlength="20"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column
label="备注"
align="center"
prop="remark"
min-width="120"
>
<template slot-scope="scope">
<el-input
v-model="scope.row.remark"
placeholder="备注"
clearable maxlength="100"
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column
label="附件"
align="center"
prop="file"
>
<template slot-scope="scope">
<div style="color: rgb(2, 167, 240);">上传</div>
</template>
</el-table-column>
<!-- <el-table-column
label="操作"
align="center"
width="100px"
>
<template slot-scope="scope">
<el-button size="mini" type="danger"
@click="handleDelete({ ...scope.row, index: scope.$index })">删除</el-button>
</template>
</el-table-column> -->
</el-table>
<el-dialog title="编码退料" :visible.sync="open" width="1000px" append-to-body>
<el-row :gutter="10" class="mb8">
<el-col :span="6">
<div style="width: 100%;height: 100%;display: flex;align-items: center;">
<span style="width: 80px;">编码</span>
<el-input v-model="devCode" placeholder="请输入编码" clearable style="width: 100%"/>
</div>
</el-col>
<el-col :span="1.5">
<el-button type="primary" size="mini" @click="handleAddCode">保存</el-button>
</el-col>
</el-row>
<el-table :data="codeDataList" width="100%" height="450px">
<el-table-column label="序号" type="index" width="55" align="center"/>
<el-table-column label="类型名称" prop="typeName" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="规格型号" prop="typeCode" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="设备编码" prop="devCode" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="设备状态" prop="status" align="center" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="外观判定" prop="look" align="center" width="150" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input
v-model.number="scope.row.look"
placeholder="外观判定" maxlength="20"
type="text" clearable
style="width: 100%"
/>
</template>
</el-table-column>
<el-table-column label="附件" align="center" width="100">
<template slot-scope="scope">
<div style="display: flex;align-items: center;justify-content: center;">
<el-upload ref="upload" :limit="1" :headers="upload.headers"
:action="upload.url" :show-file-list="false" accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
:on-success="handleFileSuccess" :auto-upload="true"
>
<el-button size="mini" type="text" @click="beforeFileUpload(scope.row)">
上传
</el-button>
</el-upload>
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.fileInfos&&scope.row.fileInfos.length>0">
查看
</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120px">
<template slot-scope="scope">
<el-button size="mini" type="danger"
@click="handleDeleteCode({ ...scope.row, index: scope.$index })">删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="width: 100%;height: 50px;display: flex;justify-content: flex-end;align-items: center;">
<el-button type="primary" size="mini" @click="saveDevCode">保存</el-button>
<el-button type="normal" size="mini" @click="open=false">取消</el-button>
</div>
</el-dialog>
<!-- 图片查看弹窗 -->
<el-dialog :visible.sync="dialogVisible" width="500px" height="500px" >
<img width="100%" height="500px" :src="dialogImageUrl" />
</el-dialog>
</div>
</template>
<script>
import {
equipmentTypeTree,
} from '@/api/purchase/goodsArrived';
// import {
// getProData,
// getUnitData,
// getDeviceTypeTree,
// getAgreementInfoById,
// submitLeaseApply,
// getUseTypeTreee,
// getUseNumByTypeId,
// } from '@/api/claimAndRefund/receive'
// import { submitBackApplyApi } from '@/api/claimAndRefund/return'
// import {
// materialReturnNoteByApply,
// submitRefuseBackApply,
// } from '@/api/claimAndRefund/return.js'
import { mapState } from 'vuex'
import { getInfo, h } from '@/api/login'
import { getToken } from '@/utils/auth'
export default {
name: 'ReturnApplyAdd',
props: {
backId: {
type: [String, Number],
},
agreementId: {
type: [String, Number],
},
isView: {
type: Boolean,
default:true
},
},
data() {
const validatePhone = (rule, value, callback) => {
const reg = /^[1][3-9][0-9]{9}$/
if (!reg.test(value)) {
this.queryParams.phone = ''
} else {
callback()
}
}
return {
//
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
roleList: [],
//
title: '',
//
open: false,
rowData:{},
devCode:"",
codeDataList: [],
//
dialogImageUrl: '',
dialogVisible: false,
fileData:{},
//
upload: {
//
headers: { Authorization: 'Bearer ' + getToken() },
//
url: process.env.VUE_APP_BASE_API + '/file/upload'
},
//
queryParams: {
types: 2,
unitId: null,
proId: null,
agreementId: null, //id
agreementCode: null, //code
companyId: '', //
createBy: '', //
taskType: 29,
taskStatus: 30,
backTime: '', //
//退
leaseApplyInfo: {
backPerson: '',
phone: '',
remark: '',
},
//退
backApplyDetails: [],
},
backApplyDetails: [],
//退
leaseApplyDetailsItem: {
createBy: null,
companyId: null,
status: 0,
typeId: null, // 4 id
typeName: '', //
typeCode: '', //
unitNames: '', //
useNum: '', //
remark: '', //
preNum: 1, //
},
//
queryRules: {
unitId: [
{
required: true,
message: '请选择退料单位',
trigger: 'change',
type: 'number',
},
],
proId: [
{
required: true,
message: '请选择退料工程',
trigger: 'change',
type: 'number',
},
],
backPerson: [
{
required: true,
message: '请输入退料人',
trigger: 'blur',
},
],
backTime: [
{
required: true,
message: '请选择退料时间',
trigger: 'change',
},
],
phone: [
{
required: true,
trigger: 'blur',
message: '请输入退料人的手机号',
},
{
pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的手机号码',
trigger: 'blur',
},
],
// phone: [
// { validator: validatePhone, trigger: "blur"},
// {required: true, message: '', trigger: 'change'},
// ],
},
unitList: [], //
proList: [], //
deviceTypeTree: [], //
//
deviceTypeTreeProps: {
children: 'children',
label: 'typeName',
// multiple: false,
value: 'typeId',
},
//
deviceType: null,
// defaultProps: {
// children: "children",
// label: "label"
// },
companyId: '',
createBy: '',
rowId: '',
}
},
mounted() {
this.GetDeviceTypeTreeFn()
// this.GetUnitData()
// this.GetProData()
if (this.backId) {//
console.log("查看")
console.log(this.backId)
console.log(this.isView)
this.rowId = this.backId;
this.GetViewByApply({id: this.backId,agreementId: this.agreementId})
}
// getInfo().then((res) => {
// this.companyId = res.user.companyId
// this.createBy = res.user.userName
// })
},
computed: {
...mapState(['user']),
},
methods: {
//
async GetUnitData() {
const params = {
id: this.queryParams.proId /* */,
}
// const res = await getUnitData(params)
// this.unitList = res.data
// this.GetAgreementInfoById()
},
//
async GetProData() {
const params = {
id: this.queryParams.unitId,
}
// const res = await getProData(params)
// this.proList = res.data
// this.GetAgreementInfoById()
},
//
async GetDeviceTypeTreeFn(agreementId) {
// const params = {
// agreementId: agreementId,
// }
equipmentTypeTree().then((response) => {
this.deviceTypeTree = response.data
})
// const res = await getUseTypeTreee(params)
// console.log('resgetUseTypeTreee==========', res)
// this.deviceTypeTree = res.data
},
// id
async GetAgreementInfoById() {
if (this.queryParams.unitId && this.queryParams.proId) {
const params = {
unitId: this.queryParams.unitId,
projectId: this.queryParams.proId,
}
// const res = await getAgreementInfoById(params)
// if (!(res.data && res.data.agreementId)) {
// this.$message.error('')
// this.queryParams.unitId = null
// this.queryParams.proId = null
// this.GetUnitData()
// this.GetProData()
// } else {
// this.queryParams.agreementId = res.data.agreementId
// this.queryParams.agreementCode = res.data.agreementCode
// this.GetDeviceTypeTreeFn(res.data.agreementId)
// }
}
},
//
async GetViewByApply(params) {
// const res = await materialReturnNoteByApply({
// id: params.id,
// agreementId: params.agreementId,
// })
// const data = res.data[0]
// // console.log(data)
// this.queryParams.unitId = data.unitId
// this.queryParams.proId = Number(data.proId)
// this.$set(this.queryParams, 'phone', data.phone)
// this.queryParams.backPerson = data.backPerson
// this.queryParams.backTime = data.backTime
// this.queryParams.agreementCode = data.agreementCode
// this.queryParams.agreementId = data.agreementId
// this.queryParams.remark = data.remark
// this.backApplyDetails = res.data
// this.GetDeviceTypeTreeFn(data.agreementId)
},
//
selectable(row) {
console.log(row)
if (row.num != 0) {
return true
} else {
return false
}
},
//
handleSelectionChange(selection) {
this.queryParams.backApplyDetails = selection
},
/** 保存按钮操作 */
handleAdd() {
this.$refs.queryForm.validate(async (valid) => {
if (!valid) {
return false
} else {
let backApplyInfo = []
if (this.queryParams.backApplyDetails.length == 0) {
this.$message.error('请添加数据')
return
}
// const isRemark = this.queryParams.backApplyDetails.some(
// (item) => item.remark == '' || item.remark == undefined
// );
const isNum = this.queryParams.backApplyDetails.some(
(item) => item.num == '' || item.num == undefined,
)
if (isNum) {
this.$message.error('退料数量不能为空!')
return
}
this.queryParams.createBy = this.user.name
this.queryParams.companyId = this.companyId
this.queryParams.backApplyInfo = {
backPerson: this.queryParams.backPerson,
phone: this.queryParams.phone,
remark: this.queryParams.remark,
backTime: this.queryParams.backTime,
companyId: this.companyId,
}
if (this.rowId != '') {
let params = {
companyId: this.companyId,
createBy: this.createBy,
id: this.rowId,
agreementId: this.queryParams.agreementId,
backApplyInfo: this.queryParams.backApplyInfo,
backApplyDetails:
this.queryParams.backApplyDetails,
}
// const res = await submitRefuseBackApply(params)
// if (res.code == 200) {
// this.$message({ type: 'success', message: res.msg })
// setTimeout(() => {
// this.$emit('goBackPage')
// // this.$tab.closeOpenPage({
// // path: '/claimAndRefund/return/returnApplyByCq',
// // })
// }, 1000)
// }
} else {
let params = {
companyId: this.companyId,
createBy: this.createBy,
agreementId: this.queryParams.agreementId,
backApplyInfo: this.queryParams.backApplyInfo,
backApplyDetails:
this.queryParams.backApplyDetails,
}
// const res = await submitBackApplyApi(params)
// if (res.code == 200) {
// this.$message({ type: 'success', message: res.msg })
// setTimeout(() => {
// this.$emit('goBackPage')
// // this.$tab.closeOpenPage({
// // path: '/claimAndRefund/return/returnApplyByCq',
// // })
// }, 1000)
// }
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
this.backApplyDetails.splice(row.index, 1)
},
/** 导出按钮操作 */
handleExport() {
this.download(
'system/role/export',
{
...this.queryParams,
},
`role_${new Date().getTime()}.xlsx`,
)
},
checkNum(row) {
let maxNum = row.useNum
if (row.num <= 1) {
row.num = 1
} else if (row.num >= maxNum) {
row.num = maxNum
}
},
///////
async deviceTypeChange(val) {
let nodes = null
console.log('vall1211221122',
this.$refs.deviceTypeCascader.getCheckedNodes().length,
this.$refs.deviceTypeCascader.getCheckedNodes(),
[this.$refs.deviceTypeCascader.panel.getNodeByValue(val)],
)
nodes =
this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
? this.$refs.deviceTypeCascader.getCheckedNodes()
: [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
console.log('nodes', nodes)
// const res = await getUseNumByTypeId({ typeId: nodes[0].data.typeId })
nodes[0].data.useNum = nodes[0].data.num
if (nodes[0].level != 4) {
return
}
if (nodes[0].data.useNum < 1) {
this.$modal.msgError('所选机具类型当前无在用!')
return
}
for (let i = 0; i < this.backApplyDetails.length; i++) {
if (this.backApplyDetails[i].typeId == nodes[0].data.typeId) {
this.backApplyDetails.splice(i, 1)
break
}
}
this.backApplyDetails.push(this.handelTableItemData(nodes[0]))
// this.$refs.cascader.$refs.panel.clearCheckedNodes()
// //
// this.$refs.cascader.$refs.panel.activePath = []
this.deviceType = {}
},
////
handelTableItemData(node) {
const template = JSON.parse(
JSON.stringify(this.leaseApplyDetailsItem),
)
template.createBy = this.createBy
template.typeId = node.data.typeId
template.companyId = node.data.companyId
// template.typeId = node.data.id
template.unitNames = node.data.unitNames
template.preNum = node.data.num
template.typeName = node.pathLabels[2]
template.typeCode = node.pathLabels[3]
template.num = node.data.num
template.useNum = node.data.useNum
return template
},
//
openAddCode(row){
this.rowData=row;
this.devCode=""
this.codeDataList=[]
if(this.rowData.codeDataList&&this.rowData.codeDataList.length>0){
this.codeDataList = this.rowData.codeDataList
}
this.open=true
},
handleAddCode(){
console.log(this.rowData)
if(this.devCode!=""){
let obj = {
typeName:this.rowData.typeName,
typeId:this.rowData.typeId,
typeCode:this.rowData.typeCode,
devCode:this.devCode,
status:this.rowData.status,
fileInfos:[],
look:"",
}
let index = this.codeDataList.findIndex(v=>v.devCode==this.devCode)
if(index>-1){
this.$message.error('设备编码已存在!')
}else{
this.codeDataList.push(obj)
}
}else{
this.$message.error('请先填写设备编码!')
}
},
/** 删除按钮操作 */
handleDeleteCode(row) {
this.codeDataList.splice(row.index, 1)
},
saveDevCode(){
console.log(this.rowData)
console.log(this.codeDataList)
this.rowData.codeDataList = this.codeDataList
console.log(this.backApplyDetails)
},
beforeFileUpload(row){
this.fileData = row
},
//
handleFileSuccess(response, file, fileList) {
if(response.code==200){
let obj = {
"taskId": "",
"taskType": "0",
"name": response.data.name,
"url": response.data.url,
"modelId": this.rowData.typeId,
// "fileType": this.rowData.fileType
}
let index = this.codeDataList.findIndex(v=>v.devCode==this.fileData.devCode)
this.codeDataList[index].fileInfos=[obj]
}
},
//
picturePreview(row) {
console.log(row)
console.log(row.fileInfos)
if(row.fileInfos.length>0){
let file = row.fileInfos[0]
this.dialogImageUrl = file.url;
const parts = file.name.split('.');
const extension = parts.pop();
if(extension === 'doc'||extension === 'docx'||extension === 'pdf'){
const windowName = file.name;
window.open(file.url,windowName)
}else{
this.dialogVisible = true
}
}
},
},
}
</script>

View File

@ -8,11 +8,12 @@
/>
<component
:is="isShowComponent"
:rejectId="rejectId"
:backId="backId"
:agreementId="agreementId"
:isEdit="isEdit"
:isView="isView"
@returnApply="returnApply"
@rejectSubmit="rejectSubmit"
@returnEdit="returnEdit"
@queryReturn="queryReturn"
@goBackPage="goBack"
/>
</div>
@ -22,38 +23,44 @@
import PageHeader from '@/components/pageHeader'
import Home from './component/home.vue'
import AddReturn from './component/addReturn.vue'
import QueryReturn from './component/queryReturn.vue'
export default {
components: {
PageHeader,
Home,
AddReturn,
QueryReturn
},
data() {
return {
isShowComponent: 'Home',
pageContent: '',
rejectId: '',
backId: '',
agreementId: '',
isView: false,
isEdit: false,
}
},
methods: {
// 退
returnApply() {
this.rejectId = ''
this.backId = ''
this.pageContent = '新建退料任务'
this.isShowComponent = 'AddReturn'
this.isEdit = false
},
//
rejectSubmit({id, agreementId}) {
this.rejectId = id
this.agreementId = agreementId
this.isEdit = true
// 退
returnEdit(id) {
this.backId = id
this.pageContent = '编辑退料任务'
this.isShowComponent = 'AddReturn'
},
/* 查询 */
queryReturn(id) {
this.isView = true
this.backId = id
this.pageContent = '查看退料任务'
this.isShowComponent = 'QueryReturn'
},
goBack() {
this.isShowComponent = 'Home'
},

View File

@ -533,6 +533,7 @@ export default {
for (let z of deviceTypeList) {
if (z.data.typeId === i) {
const obj = JSON.parse(JSON.stringify(z.data))
console.log(z.data)
// obj.supplierId = ''
obj.createTime = null
obj.productionTime = ''