问题修复
This commit is contained in:
parent
996a20e6fe
commit
c18977b826
|
|
@ -395,7 +395,7 @@ export function getMaTypeDataById(data) {
|
|||
url: '/material/select/getMaTypeDataById',
|
||||
method: 'post',
|
||||
headers: {
|
||||
repeatSubmit: false,
|
||||
repeatSubmit: true,
|
||||
},
|
||||
data,
|
||||
})
|
||||
|
|
@ -407,7 +407,7 @@ export function getMaTypeDataByIdTwo(data) {
|
|||
url: '/material/select/getMaTypeDataByIdTwo',
|
||||
method: 'post',
|
||||
headers: {
|
||||
repeatSubmit: false,
|
||||
repeatSubmit: true,
|
||||
},
|
||||
data,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -68,9 +68,7 @@
|
|||
v-loading="loading"
|
||||
:data="typeList"
|
||||
border
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="序号"
|
||||
|
|
|
|||
|
|
@ -728,7 +728,7 @@ export default {
|
|||
// 是否以大代小
|
||||
if (item.isReplace == 1) {
|
||||
console.log("xxxxxxxxxxxx",item)
|
||||
getMaTypeDataByIdTwo({ id: item.levelTwoId }).then((res) => {
|
||||
getMaTypeDataById({ id: item.maTypeId }).then((res) => {
|
||||
console.log('🚀 ~ this.leaseApplyDetails.forEach ~ res:', res)
|
||||
this.$set(item, 'isReplaceOpt', res.data)
|
||||
})
|
||||
|
|
@ -828,7 +828,8 @@ export default {
|
|||
template.maTypeId = item.maTypeId
|
||||
template.replaceTypeId = item.replaceTypeId
|
||||
template.maModel = item.maModel
|
||||
template.levelTwoId = item.levelTwoId
|
||||
template.leasePrice = item.leasePrice
|
||||
template.isChange = item.isChange
|
||||
return template
|
||||
},
|
||||
|
||||
|
|
@ -997,7 +998,7 @@ export default {
|
|||
|
||||
// this.queryParams.leaseApplyDetails = wholeTypeList
|
||||
}
|
||||
|
||||
console.log("xxxxxxxxxxxx",params)
|
||||
res = await editLeaseApply(params)
|
||||
} else {
|
||||
// console.log(this.queryParams)
|
||||
|
|
@ -1275,12 +1276,17 @@ export default {
|
|||
},
|
||||
// 以大代小
|
||||
handleReplaceType(e, row) {
|
||||
console.log('🚀 ~ handleReplaceType ~ e:', e)
|
||||
console.log('🚀 ~ handleReplaceType ~ row:', row)
|
||||
const objSmall = row.isReplaceOpt.find((item) => item.id == row.typeId)
|
||||
const obj = row.isReplaceOpt.find((item) => item.id == e)
|
||||
console.log('🚀 ~ handleReplaceType ~ obj:', obj)
|
||||
row.leasePrice = obj.leasePrice
|
||||
row.maModel = obj.name
|
||||
if(row.typeId != e){
|
||||
row.leasePrice = objSmall.leasePrice
|
||||
row.maModel = objSmall.name
|
||||
row.isChange = 1
|
||||
}else{
|
||||
row.leasePrice = objSmall.leasePrice
|
||||
row.maModel = objSmall.name
|
||||
row.isChange = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,12 +122,7 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
label="规格型号"
|
||||
align="center"
|
||||
prop="typeModelName"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="当前库存" align="center" prop="num" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="预出库数量" align="center" prop="outNum" :show-overflow-tooltip="true" />
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@
|
|||
/>
|
||||
|
||||
<!-- 领料单弹窗 -->
|
||||
<el-dialog :visible.sync="open" width="800px" append-to-body>
|
||||
<el-dialog :visible.sync="open" width="900px" append-to-body>
|
||||
<div style="height: 500px; overflow-y: scroll; padding: 0 20px">
|
||||
<vue-easy-print tableShow ref="remarksPrintRef" class="print">
|
||||
<div class="title" style="text-align: center; font-weight: 600; font-size: 16px">领料单</div>
|
||||
|
|
@ -252,9 +252,9 @@
|
|||
<el-table-column label="备注" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.remark && scope.row.maModel
|
||||
scope.row.remark && scope.row.replaceTypeName
|
||||
? scope.row.remark + ', 以大代小'
|
||||
: scope.row.maModel
|
||||
: scope.row.replaceTypeName
|
||||
? '以大代小'
|
||||
: scope.row.remark
|
||||
}}</span>
|
||||
|
|
@ -266,14 +266,15 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="类型名称" align="center" prop="typeName" />
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" />
|
||||
<el-table-column label="以大代小" align="center" prop="replaceTypeName" />
|
||||
<el-table-column label="计量单位" align="center" prop="unitName" />
|
||||
<el-table-column label="预领数量" align="center" prop="preNum" />
|
||||
<el-table-column label="备注" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.remark && scope.row.maModel
|
||||
scope.row.remark && scope.row.replaceTypeName
|
||||
? scope.row.remark + ', 以大代小'
|
||||
: scope.row.maModel
|
||||
: scope.row.replaceTypeName
|
||||
? '以大代小'
|
||||
: scope.row.remark
|
||||
}}</span>
|
||||
|
|
|
|||
|
|
@ -530,6 +530,7 @@ import { equipmentTypeTree } from '@/api/store/tools'
|
|||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import vueEasyPrint from 'vue-easy-print'
|
||||
import { replace } from 'lodash'
|
||||
export default {
|
||||
name: 'Outbound',
|
||||
components: { Treeselect, vueEasyPrint },
|
||||
|
|
@ -896,6 +897,8 @@ export default {
|
|||
this.$set(obj, 'outNum', row.outNum) //待出库数量
|
||||
this.$set(obj, 'inputNum', row.outNum) //出库数量
|
||||
this.$set(obj, 'num', row.num) //库存
|
||||
this.$set(obj, 'replaceTypeId', row.replaceTypeId) //以大代小id
|
||||
this.$set(obj, 'leasePrice', row.leasePrice) //租赁价
|
||||
this.$set(obj, 'maModel', row.maModel) // 以大代小 规格
|
||||
this.$set(obj, 'maName', row.maName) // 以大代小 类型
|
||||
this.outNumList = [obj]
|
||||
|
|
@ -959,6 +962,8 @@ export default {
|
|||
outNum: 1,
|
||||
taskId: this.outObj.taskId,
|
||||
leaseType: this.leaseType,
|
||||
leasePrice: this.outObj.leasePrice,
|
||||
replaceTypeId: this.outObj.replaceTypeId,
|
||||
maModel: this.outObj.maModel,
|
||||
maName: this.outObj.maName,
|
||||
createTime: this.codeOutForm.createTime,
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@
|
|||
<el-table-column label="计划退料时间" align="center" prop="backTime" show-overflow-tooltip width="100px"/>
|
||||
<el-table-column label="退料工程" align="center" prop="lotName" show-overflow-tooltip width="200px"/>
|
||||
<el-table-column label="退料单位" align="center" prop="unitName" show-overflow-tooltip width="150px"/>
|
||||
<el-table-column label="退料类型名称" align="center" prop="typeName" show-overflow-tooltip width="170px"/>
|
||||
<el-table-column label="退料类型名称" align="center" prop="typeName" width="200px"/>
|
||||
<el-table-column label="退料人员" align="center" prop="backPerson" show-overflow-tooltip width="100px"/>
|
||||
<el-table-column label="联系电话" align="center" prop="phone" show-overflow-tooltip width="120px"/>
|
||||
<el-table-column label="协议号" align="center" prop="agreementCode" show-overflow-tooltip width="150px"/>
|
||||
|
|
|
|||
|
|
@ -390,7 +390,9 @@ export default {
|
|||
/** 全部导出 */
|
||||
handleExportAll() {
|
||||
for (let i = 1; i < 7; i++) {
|
||||
this.handleExport(i)
|
||||
if(i != 3){
|
||||
this.handleExport(i)
|
||||
}
|
||||
}
|
||||
},
|
||||
/** 单个导出 */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,740 @@
|
|||
<template>
|
||||
<!-- 新增工机具 -->
|
||||
<div class="app-container">
|
||||
<el-form :model="maForm" ref="maForm" :rules="rules" size="small" :inline="true" label-width="120px">
|
||||
<el-form-item label="结算单位" prop="unitId">
|
||||
<el-select
|
||||
v-model="repairParams.unitId"
|
||||
placeholder="请选择往来单位"
|
||||
clearable
|
||||
filterable
|
||||
@change="unitChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in unitList"
|
||||
:key="item.unitId"
|
||||
:label="item.unitName"
|
||||
:value="item.unitId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="结算工程" prop="projectId">
|
||||
<el-select
|
||||
v-model="repairParams.projectId"
|
||||
placeholder="请选择工程名称"
|
||||
clearable
|
||||
filterable
|
||||
@change="proChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.projectId"
|
||||
:label="item.projectName"
|
||||
:value="item.projectId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="规格型号" prop="equipmentId">
|
||||
<el-cascader
|
||||
:key="propsKey"
|
||||
v-model="deviceType"
|
||||
:show-all-levels="false"
|
||||
:options="equipmentTypeList"
|
||||
:props="deviceTypeTreeProps"
|
||||
filterable
|
||||
collapse-tags
|
||||
style="width: 240px"
|
||||
placeholder="请选择规格型号"
|
||||
ref="deviceTypeCascader"
|
||||
popper-class="popper-select"
|
||||
@change="deviceTypeChange"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleSave">保存</el-button>
|
||||
<el-button type="success" plain icon="el-icon-download" size="mini" @click="downloadModel">模板下载</el-button>
|
||||
<el-button type="success" plain icon="el-icon-upload2" size="mini" @click="uploadModel">模板上传</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="equipmentList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column align="center" label="序号" type="index" width="55" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="机具名称"
|
||||
prop="machineTypeName"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column align="center" label="规格型号" prop="specificationType" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="单位" prop="unitName" />
|
||||
<el-table-column align="center" label="维修配件名称" prop="partModelName" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
maxlength="100"
|
||||
v-model="scope.row.partModelName"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修配件型号" align="center" prop="partTypeName" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
maxlength="100"
|
||||
v-model="scope.row.partTypeName"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用数量" align="center" prop="useNum">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
type="number"
|
||||
:min="1"
|
||||
clearable
|
||||
v-model.number="scope.row.useNum"
|
||||
style="width: 100%"
|
||||
></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配件单价" align="center" prop="partPrice" >
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
maxlength="100"
|
||||
v-model="scope.row.partPrice"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配件总价" align="center" prop="partCost">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
maxlength="100"
|
||||
v-model="scope.row.partCost"
|
||||
placeholder="请输入"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="color: red"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog
|
||||
title="模板上传"
|
||||
:visible.sync="dialogUpload"
|
||||
width="400px"
|
||||
append-to-body
|
||||
>
|
||||
<template >
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
drag
|
||||
:action="actionUrl"
|
||||
:headers="headers"
|
||||
:on-success="handleUploadSuccess"
|
||||
:accept="'.xlsx'"
|
||||
:before-upload="beforeUpload"
|
||||
:auto-upload="true"
|
||||
:show-file-list="false"
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip" slot="tip" style="color: red;">只能上传.xlsx文件</div>
|
||||
</el-upload>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addPurchaseCheckInfo, getPurchaseCheckInfo, updatePurchaseCheckInfo } from '@/api/store/newBuy'
|
||||
import { getUserByRoleList } from '@/api/system/user'
|
||||
import { equipmentTypeTree, supplierInfoList, listSupplierInfo } from '@/api/store/tools'
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import HoldingpoleDialog from '@/components/HoldingpoleDialog/index.vue'
|
||||
|
||||
import {} from '@/api/store/newBuy'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'RepairCostList',
|
||||
dicts: ['sys_normal_disable'],
|
||||
components: { Treeselect, HoldingpoleDialog },
|
||||
props: {
|
||||
isEdit: {
|
||||
type: Boolean,
|
||||
default: () => {
|
||||
return false
|
||||
},
|
||||
},
|
||||
editTaskId: {
|
||||
type: [String, Number],
|
||||
default: () => {
|
||||
return ''
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
actionUrlPic: process.env.VUE_APP_BASE_API + '/system/sys/file/upload',
|
||||
actionUrl: process.env.VUE_APP_BASE_API + '/material/purchaseCheckInfo/importData',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + localStorage.getItem('token'),
|
||||
},
|
||||
aform: {
|
||||
checkUrl: '',
|
||||
checkUrlName: '',
|
||||
fileListNew: [],
|
||||
},
|
||||
taskId: '',
|
||||
// isEdit: false,
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
//制造厂家(供应商管理)
|
||||
supplierList: [],
|
||||
//机具类型
|
||||
equipmentTypeList: [],
|
||||
// 用户数据
|
||||
userList: [],
|
||||
// 角色表格数据
|
||||
equipmentList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否显示弹出层(数据权限)
|
||||
openDataScope: false,
|
||||
menuExpand: false,
|
||||
menuNodeAll: false,
|
||||
deptExpand: true,
|
||||
deptNodeAll: false,
|
||||
showDialog: false,
|
||||
holdingpoleData: {},
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
// 数据范围选项
|
||||
dataScopeOptions: [
|
||||
{
|
||||
value: '1',
|
||||
label: '全部数据权限',
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '自定数据权限',
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '本部门数据权限',
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '本部门及以下数据权限',
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '仅本人数据权限',
|
||||
},
|
||||
],
|
||||
// 菜单列表
|
||||
menuOptions: [],
|
||||
// 部门列表
|
||||
deptOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
equipmentId: undefined,
|
||||
productionTime: '',
|
||||
supplierId: '',
|
||||
},
|
||||
maForm: {
|
||||
purchaseTime: '',
|
||||
arrivalTime: '',
|
||||
purchaser: '',
|
||||
remark: '',
|
||||
purchaseNumber: '',
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
purchaseNumber: [
|
||||
{
|
||||
required: false,
|
||||
message: '请输入线下采购单编号',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
purchaseTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '采购日期不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
arrivalTime: [
|
||||
{
|
||||
required: false,
|
||||
message: '到货日期不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
// purchaser: [
|
||||
// { required: true, message: "采购员不能为空", trigger: "blur" }
|
||||
// ]
|
||||
},
|
||||
deviceTypeTreeProps: {
|
||||
children: 'children',
|
||||
label: 'typeName',
|
||||
// multiple: false,
|
||||
value: 'typeId',
|
||||
multiple: true,
|
||||
},
|
||||
deviceType: [],
|
||||
propsKey: 1000,
|
||||
currentIndex: 0,
|
||||
dialogUpload: false,
|
||||
// 往来单位数据
|
||||
unitList: [],
|
||||
// 工程数据
|
||||
projectList: [],
|
||||
repairParams: {
|
||||
unitId: '',
|
||||
projectId: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pickerOptions() {
|
||||
return {
|
||||
disabledDate(time) {
|
||||
const currentDate = new Date()
|
||||
currentDate.setHours(0, 0, 0, 0)
|
||||
return time.getTime() < currentDate.getTime()
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
this.getUnitList()
|
||||
this.getProjectList()
|
||||
|
||||
this.getUserList()
|
||||
this.equipmentType()
|
||||
},
|
||||
methods: {
|
||||
//获取结算单位下的结算工程
|
||||
unitChange(val){
|
||||
console.log("xxxxxxxxxx",val)
|
||||
if(!val){
|
||||
console.log("yyyyyyyy")
|
||||
this.queryParams.projectId = null;
|
||||
this.queryParams.unitId = null
|
||||
this.getUnitList()
|
||||
this.getProjectList()
|
||||
// this.GetProData()
|
||||
return
|
||||
}
|
||||
setTimeout(()=>{
|
||||
|
||||
this.GetProData()
|
||||
},500)
|
||||
},
|
||||
//获取结算工程下的结算单位
|
||||
proChange(val){
|
||||
console.log("xxxxxxxxxx",val)
|
||||
if(val.length==0){
|
||||
setTimeout(()=>{
|
||||
this.getUnitList()
|
||||
},500)
|
||||
return
|
||||
}
|
||||
setTimeout(()=>{
|
||||
this.GetUnitData()
|
||||
},500)
|
||||
},
|
||||
|
||||
/** 查询用户列表--采购员 */
|
||||
getUserList() {
|
||||
getUserByRoleList({ roleIds: [152] }).then((response) => {
|
||||
this.userList = response.data
|
||||
})
|
||||
},
|
||||
/** 机具类型 */
|
||||
equipmentType() {
|
||||
equipmentTypeTree().then((response) => {
|
||||
this.equipmentTypeList = response.data
|
||||
this.equipmentTypeList.forEach((item, index) => {
|
||||
if (item.children && item.children.length > 0) {
|
||||
item.children.forEach((item2, index2) => {
|
||||
if (item2.children && item2.children.length > 0) {
|
||||
item2.children.forEach((item3) => {
|
||||
if (item3.children && item3.children.length > 0) {
|
||||
item3.children.forEach((item4) => {
|
||||
item4.machineTypeName = item3.typeName
|
||||
item4.specificationType = item4.typeName
|
||||
this.$set(item4, 'purchasePrice', 0)
|
||||
this.$set(item4, 'purchaseNum', 1)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
let selectList = []
|
||||
this.equipmentList.forEach((e) => {
|
||||
selectList.push(this.getParentsById(this.equipmentTypeList, e.typeId))
|
||||
})
|
||||
this.deviceType = selectList
|
||||
})
|
||||
},
|
||||
|
||||
//添加机具类型
|
||||
select(row) {
|
||||
console.log(row)
|
||||
if (row.level == 4) {
|
||||
for (let i = 0; i < this.equipmentList.length; i++) {
|
||||
if (this.equipmentList[i].typeId == row.typeId) {
|
||||
this.equipmentList.splice(i, 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有厂家则代入
|
||||
if (this.queryParams.supplierId) {
|
||||
this.$set(row, 'supplierId', this.queryParams.supplierId)
|
||||
} else {
|
||||
this.$set(row, 'supplierId', '')
|
||||
}
|
||||
this.$set(row, 'createTime', null)
|
||||
this.$set(row, 'productionTime', '')
|
||||
// this.$set(row, 'supplierId', '')
|
||||
this.$set(row, 'purchasePrice', 0)
|
||||
this.$set(row, 'purchaseNum', 1)
|
||||
this.equipmentList.unshift(row)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
//获取任务详情--- 编辑回显数据
|
||||
getTaskInfo() {
|
||||
// this.loading = true;
|
||||
getPurchaseCheckInfo({
|
||||
taskId: this.taskId,
|
||||
keyWord: this.queryParams.keyWord,
|
||||
}).then((response) => {
|
||||
// this.taskInfo = response.data
|
||||
this.maForm.purchaseTime = response.data.purchaseTime
|
||||
this.maForm.arrivalTime = response.data.arrivalTime
|
||||
this.maForm.purchaser = response.data.purchaser
|
||||
this.maForm.remark = response.data.remark
|
||||
this.maForm.purchaseNumber = response.data.purchaseNumber
|
||||
this.equipmentList = response.data.checkDetailsList
|
||||
|
||||
// this.loading = false;
|
||||
})
|
||||
},
|
||||
|
||||
getParentsById(list, id) {
|
||||
for (let i in list) {
|
||||
if (list[i].typeId == id) {
|
||||
//查询到就返回该数组对象的value
|
||||
return [list[i].typeId]
|
||||
}
|
||||
if (list[i].children) {
|
||||
let node = this.getParentsById(list[i].children, id)
|
||||
if (node !== undefined) {
|
||||
//查询到把父节把父节点加到数组前面
|
||||
node.unshift(list[i].typeId)
|
||||
return node
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** 查询右侧列表 */
|
||||
getList() {
|
||||
// this.loading = true;
|
||||
// listRole().then(response => {
|
||||
// this.equipmentList = response.rows;
|
||||
// this.total = response.total;
|
||||
// this.loading = false;
|
||||
// }
|
||||
// );
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 取消按钮(数据权限)
|
||||
cancelDataScope() {
|
||||
this.openDataScope = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
if (this.$refs.menu != undefined) {
|
||||
this.$refs.menu.setCheckedKeys([])
|
||||
}
|
||||
;(this.menuExpand = false),
|
||||
(this.menuNodeAll = false),
|
||||
(this.deptExpand = true),
|
||||
(this.deptNodeAll = false),
|
||||
(this.form = {
|
||||
roleId: undefined,
|
||||
roleName: undefined,
|
||||
roleKey: undefined,
|
||||
roleSort: 0,
|
||||
status: '0',
|
||||
menuIds: [],
|
||||
deptIds: [],
|
||||
menuCheckStrictly: true,
|
||||
deptCheckStrictly: true,
|
||||
remark: undefined,
|
||||
})
|
||||
this.resetForm('form')
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.roleId)
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleSave() {
|
||||
if (this.equipmentList.length > 0) {
|
||||
this.$refs['maForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// console.log(this.maForm,'maForm')
|
||||
// console.log(this.equipmentList,'equipmentList')
|
||||
let isEmpty = true
|
||||
this.equipmentList.forEach((item) => {
|
||||
if (item.purchaseNum == '' || !item.purchaseNum) {
|
||||
isEmpty = false
|
||||
}
|
||||
})
|
||||
// console.log(this.taskId)
|
||||
|
||||
this.maForm.taskId = this.taskId
|
||||
this.maForm.checkDetailsList = this.equipmentList
|
||||
// console.log(this.maForm)
|
||||
if (isEmpty) {
|
||||
if (this.equipmentList.length > 0) {
|
||||
this.$modal
|
||||
.confirm('是否确认保存当前页面')
|
||||
.then(function () {})
|
||||
.then(() => {
|
||||
if (this.isEdit) {
|
||||
console.log('编辑')
|
||||
this.loading = true
|
||||
updatePurchaseCheckInfo(this.maForm).then((response) => {
|
||||
if (response.code == 200) {
|
||||
this.$modal.msgSuccess('编辑成功')
|
||||
// this.$tab.closeOpenPage({
|
||||
// path: '/store/newBuy/newDevicesList',
|
||||
// })
|
||||
|
||||
this.$emit('addToolsSuccess')
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
} else if (!this.isEdit) {
|
||||
console.log('新增')
|
||||
this.loading = true
|
||||
addPurchaseCheckInfo(this.maForm).then((response) => {
|
||||
if (response.code == 200) {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
// this.$tab.closeOpenPage({
|
||||
// path: '/store/newBuy/newDevicesList',
|
||||
// })
|
||||
|
||||
this.$emit('addToolsSuccess')
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
this.$modal.msgError('请先选择并添加机具类型!!!')
|
||||
}
|
||||
} else {
|
||||
this.$modal.msgError('请填写采购数量!!!')
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$modal.msgError('请先添加机具类型')
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
// console.log(row.id)
|
||||
this.$modal
|
||||
.confirm('是否确认删除所选择的数据项?')
|
||||
.then(() => {
|
||||
this.deviceType.forEach((e, index) => {
|
||||
if (e[3] === row.typeId) {
|
||||
this.deviceType.splice(index, 1)
|
||||
this.propsKey++
|
||||
}
|
||||
})
|
||||
this.equipmentList.forEach((item, index) => {
|
||||
if (item.id == row.id) {
|
||||
this.equipmentList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
deviceTypeChange(val) {
|
||||
const deviceTypeList = this.$refs.deviceTypeCascader.getCheckedNodes()
|
||||
let tempList = []
|
||||
if (val.length > 0) {
|
||||
const items = val.map((e) => {
|
||||
return e[3]
|
||||
})
|
||||
for (let i of items) {
|
||||
for (let z of deviceTypeList) {
|
||||
if (z.data.typeId === i) {
|
||||
const obj = JSON.parse(JSON.stringify(z.data))
|
||||
obj.supplierId = this.queryParams.supplierId
|
||||
obj.createTime = null
|
||||
obj.productionTime = this.queryParams.productionTime
|
||||
obj.purchasePrice = 0
|
||||
obj.purchaseNum = ''
|
||||
obj.purveyorId = this.queryParams.purveyorId
|
||||
obj.checkUrl = ''
|
||||
obj.checkUrlName = ''
|
||||
obj.fileList = []
|
||||
tempList.push(obj)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const newDataListNew = [...this.equipmentList, ...tempList]
|
||||
const map = new Map()
|
||||
for (let item of newDataListNew) {
|
||||
if (!map.has(item.typeId)) {
|
||||
map.set(item.typeId, item)
|
||||
}
|
||||
}
|
||||
const newArray = [...map.values()]
|
||||
let newArray_array = []
|
||||
items.forEach((e) => {
|
||||
newArray.forEach((j) => {
|
||||
if (e == j.typeId) {
|
||||
newArray_array.push(j)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.equipmentList = newArray_array
|
||||
} else {
|
||||
this.equipmentList = []
|
||||
}
|
||||
},
|
||||
|
||||
/** 模板下载 */
|
||||
downloadModel() {
|
||||
const params = {params:JSON.stringify(this.queryParams)}
|
||||
this.download(
|
||||
'material/purchaseCheckInfo/downLoadTypeModel',
|
||||
{...params,},
|
||||
`模板下载_${new Date().getTime()}.xlsx`,
|
||||
)
|
||||
|
||||
},
|
||||
uploadModel() {
|
||||
this.dialogUpload = true
|
||||
},
|
||||
beforeUpload(file) {
|
||||
const fileType = file.name.split('.').pop().toLowerCase();
|
||||
if (fileType!== 'xls' && fileType!== 'xlsx') {
|
||||
this.$message.error('只能上传 Excel 文件(.xls 或 .xlsx)');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
if (response.code == 200) {
|
||||
this.$message.success('文件上传成功');
|
||||
this.dialogUpload = false; // 上传成功后关闭弹窗
|
||||
response.data.forEach((item) => {
|
||||
this.equipmentList.push({
|
||||
machineTypeName: item.typeName,
|
||||
specificationType: item.modelName,
|
||||
typeId: item.typeId,
|
||||
unitName: item.unitName,
|
||||
supplierId: this.queryParams.supplierId? this.queryParams.supplierId : '',
|
||||
createTime: null,
|
||||
productionTime: this.queryParams.productionTime? this.queryParams.productionTime : '',
|
||||
purchasePrice: 0,
|
||||
purchaseNum: '',
|
||||
purveyorId: this.queryParams.purveyorId? this.queryParams.purveyorId : '',
|
||||
checkUrl: '',
|
||||
checkUrlName: '',
|
||||
fileList: [],
|
||||
})
|
||||
// 获取新增项的层级路径
|
||||
const path = this.getParentsById(this.equipmentTypeList, item.typeId);
|
||||
if (path) {
|
||||
this.deviceType.push(path);
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
this.$message.error('文件上传失败');
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.popper-select {
|
||||
.el-cascader-panel .el-scrollbar .el-checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-cascader-panel .el-scrollbar:nth-child(4) .el-checkbox {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue