fix:新购机具管理bug修改

This commit is contained in:
jackal 2024-04-20 12:23:39 +08:00
parent 720ac160e6
commit c39b231e09
2 changed files with 460 additions and 443 deletions

View File

@ -151,7 +151,7 @@
</el-form-item> </el-form-item>
<el-form-item label="验收结论" prop="checkResult"> <el-form-item label="验收结论" prop="checkResult">
<el-radio v-model="form.checkResult" label="通过">通过</el-radio> <el-radio v-model="form.checkResult" label="通过">通过</el-radio>
<el-radio v-model="form.checkResult" label="不通过">不通过</el-radio> <!-- <el-radio v-model="form.checkResult" label="不通过">不通过</el-radio> -->
</el-form-item> </el-form-item>
<el-form-item label="验收通过数量" prop="checkNum"> <el-form-item label="验收通过数量" prop="checkNum">
<el-input-number <el-input-number
@ -191,7 +191,7 @@
<el-form ref="aform" :model="aform" :rules="arules" label-width="120px"> <el-form ref="aform" :model="aform" :rules="arules" label-width="120px">
<el-form-item label="验收结论" prop="checkResult"> <el-form-item label="验收结论" prop="checkResult">
<el-radio v-model="aform.checkResult" label="通过">通过</el-radio> <el-radio v-model="aform.checkResult" label="通过">通过</el-radio>
<el-radio v-model="aform.checkResult" label="不通过">不通过</el-radio> <!-- <el-radio v-model="aform.checkResult" label="不通过">不通过</el-radio> -->
</el-form-item> </el-form-item>
<el-form-item label="验收图片" prop="checkUrl"> <el-form-item label="验收图片" prop="checkUrl">
<el-upload <el-upload
@ -355,14 +355,7 @@
</template> </template>
<script> <script>
import { import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type'
listType,
getType,
delType,
addType,
updateType,
refreshCache
} from "@/api/system/dict/type";
import { import {
getPurchaseCheckInfo, getPurchaseCheckInfo,
bmNoticeInfo, bmNoticeInfo,
@ -370,17 +363,17 @@ import {
getNoticeUserList, getNoticeUserList,
getAllNotificationList, getAllNotificationList,
addNoticeUser, addNoticeUser,
delNoticeUser delNoticeUser,
} from "@/api/store/newBuy"; } from '@/api/store/newBuy'
import { imgUpLoad, fileUpLoad } from "@/api/system/upload"; import { imgUpLoad, fileUpLoad } from '@/api/system/upload'
export default { export default {
name: "NewDevicesAccept", name: 'NewDevicesAccept',
dicts: ["sys_normal_disable"], dicts: ['sys_normal_disable'],
data() { data() {
return { return {
//ID //ID
taskId: "", taskId: '',
// //
loading: true, loading: true,
// //
@ -406,7 +399,7 @@ export default {
// //
equipmentList: [], equipmentList: [],
// //
title: "", title: '',
// //
open: false, open: false,
openAll: false, openAll: false,
@ -417,11 +410,11 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
keyWord: undefined keyWord: undefined,
}, },
//--- //---
imageUrl: "", imageUrl: '',
imageName: "", imageName: '',
fileList: [], fileList: [],
checkUrlList: [], checkUrlList: [],
checkUrlNameList: [], checkUrlNameList: [],
@ -431,97 +424,85 @@ export default {
// //
// uploadUrl:'http://192.168.0.14:21624/system',//线+system // uploadUrl:'http://192.168.0.14:21624/system',//线+system
// uploadUrl:'http://112.29.103.165:21624/system',//线+system // uploadUrl:'http://112.29.103.165:21624/system',//线+system
uploadUrl: process.env.VUE_APP_BASE_API + "/system", // uploadUrl: process.env.VUE_APP_BASE_API + '/system', //
dialogImageUrl: "", dialogImageUrl: '',
dialogVisible: false, dialogVisible: false,
//-------------- //--------------
// //
form: {}, form: {},
// //
rules: { rules: {
checkResult: [ checkResult: [{ required: true, message: '验收结论不能为空', trigger: 'blur' }],
{ required: true, message: "验收结论不能为空", trigger: "blur" } checkNum: [{ required: true, message: '验收通过数量不能为空', trigger: 'blur' }],
], checkUrl: [{ required: true, message: '验收图片不能为空', trigger: 'blur' }],
checkNum: [
{ required: true, message: "验收通过数量不能为空", trigger: "blur" }
],
checkUrl: [
{ required: true, message: "验收图片不能为空", trigger: "blur" }
]
}, },
// //
aform: {}, aform: {},
// //
arules: { arules: {
checkResult: [ checkResult: [{ required: true, message: '验收结论不能为空', trigger: 'blur' }],
{ required: true, message: "验收结论不能为空", trigger: "blur" } checkUrl: [{ required: true, message: '验收图片不能为空', trigger: 'blur' }],
],
checkUrl: [
{ required: true, message: "验收图片不能为空", trigger: "blur" }
]
}, },
peopleOpen: false, peopleOpen: false,
noticeOpen: false, noticeOpen: false,
nform: { nform: {
notice: "" notice: '',
}, },
nrules: { nrules: {
notice: [ notice: [{ required: true, message: '通知内容不能为空', trigger: 'blur' }],
{ required: true, message: "通知内容不能为空", trigger: "blur" }
]
}, },
deptName: undefined deptName: undefined,
}; }
}, },
computed: { computed: {
//1 //1
uploadDisabled() { uploadDisabled() {
return this.checkUrlList.length > 4; return this.checkUrlList.length > 4
} },
}, },
mounted() { mounted() {
const taskId = this.$route.query && this.$route.query.taskId; const taskId = this.$route.query && this.$route.query.taskId
this.taskId = taskId; this.taskId = taskId
console.log(this.taskId); console.log(this.taskId)
const isView = this.$route.query && this.$route.query.isView; const isView = this.$route.query && this.$route.query.isView
if (isView && isView == "true") { if (isView && isView == 'true') {
this.isView = true; this.isView = true
} else { } else {
this.isView = false; this.isView = false
} }
this.getTaskInfo(); this.getTaskInfo()
this.getAllUserList(); this.getAllUserList()
this.getNoticeUserList(); this.getNoticeUserList()
}, },
methods: { methods: {
//- //-
getTaskInfo() { getTaskInfo() {
this.loading = true; this.loading = true
getPurchaseCheckInfo({ getPurchaseCheckInfo({
taskId: this.taskId, taskId: this.taskId,
keyWord: this.queryParams.keyWord keyWord: this.queryParams.keyWord,
}).then(response => { }).then(response => {
this.taskInfo = response.data; this.taskInfo = response.data
this.equipmentList = response.data.checkDetailsList; this.equipmentList = response.data.checkDetailsList
this.equipmentList.forEach(item => { this.equipmentList.forEach(item => {
if (item.checkUrl) { if (item.checkUrl) {
item.imgUrlList = item.checkUrl.split(","); item.imgUrlList = item.checkUrl.split(',')
item.imgNameList = item.checkUrlName.split(","); item.imgNameList = item.checkUrlName.split(',')
} }
}); })
this.loading = false; this.loading = false
}); })
}, },
// //
jumpList() { jumpList() {
const obj = { path: "/store/newBuy/newDevicesList" }; const obj = { path: '/store/newBuy/newDevicesList' }
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj)
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset() { reset() {
@ -529,321 +510,318 @@ export default {
machineTypeName: undefined, machineTypeName: undefined,
specificationType: undefined, specificationType: undefined,
checkNum: undefined, checkNum: undefined,
checkResult: "通过", checkResult: '通过',
inputNum: undefined, inputNum: undefined,
checkUrl: undefined checkUrl: undefined,
}; }
this.imageUrl = ""; this.imageUrl = ''
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getTaskInfo(); this.getTaskInfo()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
//---- //----
getNowTime() { getNowTime() {
var today = new Date(); var today = new Date()
var year = today.getFullYear(); // var year = today.getFullYear() //
var month = today.getMonth() + 1; // var month = today.getMonth() + 1 //
var day = today.getDate(); // var day = today.getDate() //
return year + "-" + month + "-" + day; return year + '-' + month + '-' + day
// console.log(year + "-" + month + "-" + day); // console.log(year + "-" + month + "-" + day);
}, },
// //
handleNotice() { handleNotice() {
this.noticeOpen = true; this.noticeOpen = true
this.resetForm("nform"); this.resetForm('nform')
this.$set( this.$set(
this.nform, this.nform,
"notice", 'notice',
"各位同事您好,请于" + '各位同事您好,请于' + this.getNowTime() + '进行机具验收。验收单号:' + this.taskInfo.code
this.getNowTime() + )
"进行机具验收。验收单号:" +
this.taskInfo.code
);
}, },
// //
getNoticeUserList() { getNoticeUserList() {
getNoticeUserList().then(response => { getNoticeUserList().then(response => {
this.noticeUserList = response.data; this.noticeUserList = response.data
}); })
}, },
/** 查询所有用户列表--可添加人员 */ /** 查询所有用户列表--可添加人员 */
getAllUserList() { getAllUserList() {
getAllNotificationList().then(response => { getAllNotificationList().then(response => {
this.userList = response.data; this.userList = response.data
}); })
}, },
addUserOpen() { addUserOpen() {
this.getAllUserList(); this.getAllUserList()
this.peopleOpen = true; this.peopleOpen = true
}, },
// - // -
handleSelectionUser(selection) { handleSelectionUser(selection) {
// console.log(selection) // console.log(selection)
this.chosenUserList = selection; this.chosenUserList = selection
}, },
// //
addUser() { addUser() {
// console.log(this.chosenUserList,"chosenUserList") // console.log(this.chosenUserList,"chosenUserList")
addNoticeUser(this.chosenUserList).then(response => { addNoticeUser(this.chosenUserList).then(response => {
if (response.code == 200) { if (response.code == 200) {
this.getNoticeUserList(); this.getNoticeUserList()
this.peopleOpen = false; this.peopleOpen = false
} }
}); })
}, },
delUser(row) { delUser(row) {
delNoticeUser(row.userId).then(response => { delNoticeUser(row.userId).then(response => {
if (response.code == 200) { if (response.code == 200) {
this.getNoticeUserList(); this.getNoticeUserList()
} }
}); })
}, },
// - // -
handleSelectionNotice(selection) { handleSelectionNotice(selection) {
this.configUserList = selection; this.configUserList = selection
}, },
// //
configNotice() { configNotice() {
this.$refs["nform"].validate(valid => { this.$refs['nform'].validate(valid => {
if (valid) { if (valid) {
this.configUserList.forEach((item, index) => { this.configUserList.forEach((item, index) => {
item.noticeUser = item.userId; item.noticeUser = item.userId
item.phone = item.telphone; item.phone = item.telphone
}); })
let param = { let param = {
// message:this.nform.notice, // message:this.nform.notice,
message: `${this.getNowTime()},${this.taskInfo.code}`, message: `${this.getNowTime()},${this.taskInfo.code}`,
taskId: this.taskInfo.taskId, taskId: this.taskInfo.taskId,
bmNoticeInfoList: this.configUserList bmNoticeInfoList: this.configUserList,
}; }
if (this.configUserList.length > 0) { if (this.configUserList.length > 0) {
bmNoticeInfo(param).then(response => { bmNoticeInfo(param).then(response => {
console.log(response); console.log(response)
if (response.code == 200) { if (response.code == 200) {
this.$message({ this.$message({
message: "操作成功", message: '操作成功',
type: "success" type: 'success',
}); })
this.noticeOpen = false; this.noticeOpen = false
this.getTaskInfo(); this.getTaskInfo()
} }
}); })
} else { } else {
this.$message({ this.$message({
message: "请选择通知人员!", message: '请选择通知人员!',
type: "error" type: 'error',
}); })
} }
} }
}); })
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item); this.ids = selection.map(item => item)
this.single = selection.length != 1; this.single = selection.length != 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
/** 验收按钮操作 */ /** 验收按钮操作 */
handleCheck(row) { handleCheck(row) {
// console.log(row) // console.log(row)
this.$set(this.form, "code", row.code); this.$set(this.form, 'code', row.code)
this.$set(this.form, "companyId", row.companyId); this.$set(this.form, 'companyId', row.companyId)
this.$set(this.form, "createBy", row.createBy); this.$set(this.form, 'createBy', row.createBy)
this.$set(this.form, "createTime", row.createTime); this.$set(this.form, 'createTime', row.createTime)
this.$set(this.form, "id", row.id); this.$set(this.form, 'id', row.id)
this.$set(this.form, "machineTypeName", row.machineTypeName); this.$set(this.form, 'machineTypeName', row.machineTypeName)
this.$set(this.form, "manageType", row.manageType); this.$set(this.form, 'manageType', row.manageType)
this.$set(this.form, "specificationType", row.specificationType); this.$set(this.form, 'specificationType', row.specificationType)
this.$set(this.form, "typeName", row.typeName); this.$set(this.form, 'typeName', row.typeName)
this.$set(this.form, "machineTypeName", row.machineTypeName); this.$set(this.form, 'machineTypeName', row.machineTypeName)
this.$set(this.form, "taskId", row.taskId); this.$set(this.form, 'taskId', row.taskId)
this.$set(this.form, "typeId", row.typeId); this.$set(this.form, 'typeId', row.typeId)
this.$set(this.form, "checkResult", row.checkResult || "通过"); this.$set(this.form, 'checkResult', row.checkResult || '通过')
// this.$set(this.form,'machineTypeName',row.machineTypeName) // this.$set(this.form,'machineTypeName',row.machineTypeName)
this.$set(this.form, "purchaseNum", row.purchaseNum); this.$set(this.form, 'purchaseNum', row.purchaseNum)
this.$set(this.form, "checkNum", row.purchaseNum); this.$set(this.form, 'checkNum', row.purchaseNum)
this.$set(this.form, "checkUrl", ""); this.$set(this.form, 'checkUrl', '')
this.$set(this.form, "checkUrlName", ""); this.$set(this.form, 'checkUrlName', '')
this.fileList = []; this.fileList = []
this.checkUrlList = []; this.checkUrlList = []
this.checkUrlNameList = []; this.checkUrlNameList = []
this.open = true; this.open = true
this.title = "验收"; this.title = '验收'
}, },
/** 批量验收按钮操作 */ /** 批量验收按钮操作 */
handleListCheck() { handleListCheck() {
// console.log(this.ids) // console.log(this.ids)
this.fileList1 = []; this.fileList1 = []
this.checkUrlList1 = []; this.checkUrlList1 = []
this.checkUrlNameList1 = []; this.checkUrlNameList1 = []
this.aform = { this.aform = {
checkResult: "通过", checkResult: '通过',
checkUrl: "", checkUrl: '',
checkUrlName: "" checkUrlName: '',
}; }
this.imageUrl = ""; this.imageUrl = ''
this.openAll = true; this.openAll = true
this.title = "批量验收"; this.title = '批量验收'
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
// console.log(this.form) // console.log(this.form)
this.form.checkUrl = this.checkUrlList.join(","); this.form.checkUrl = this.checkUrlList.join(',')
this.form.checkUrlName = this.checkUrlNameList.join(","); this.form.checkUrlName = this.checkUrlNameList.join(',')
let equipments = [this.form]; let equipments = [this.form]
console.log(equipments); console.log(equipments)
this.$refs["form"].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
updatePurchaseCheckDetails(equipments).then(response => { updatePurchaseCheckDetails(equipments).then(response => {
if (response.code == 200) { if (response.code == 200) {
this.$message({ this.$message({
message: "操作成功", message: '操作成功',
type: "success" type: 'success',
}); })
this.open = false; this.open = false
this.fileList = []; this.fileList = []
this.checkUrlList = []; this.checkUrlList = []
this.checkUrlNameList = []; this.checkUrlNameList = []
this.getTaskInfo(); this.getTaskInfo()
} }
}); })
} }
}); })
}, },
submitListForm: function() { submitListForm: function() {
// console.log(this.aform) // console.log(this.aform)
this.aform.checkUrl = this.checkUrlList1.join(","); this.aform.checkUrl = this.checkUrlList1.join(',')
this.aform.checkUrlName = this.checkUrlNameList1.join(","); this.aform.checkUrlName = this.checkUrlNameList1.join(',')
this.ids.forEach(item => { this.ids.forEach(item => {
item.checkNum = item.purchaseNum; item.checkNum = item.purchaseNum
item.checkResult = this.aform.checkResult; item.checkResult = this.aform.checkResult
item.checkUrl = this.aform.checkUrl; item.checkUrl = this.aform.checkUrl
item.checkUrlName = this.aform.checkUrlName; item.checkUrlName = this.aform.checkUrlName
}); })
// console.log(this.ids) // console.log(this.ids)
let equipments = this.ids; let equipments = this.ids
console.log(equipments); console.log(equipments)
this.$refs["aform"].validate(valid => { this.$refs['aform'].validate(valid => {
if (valid) { if (valid) {
updatePurchaseCheckDetails(equipments).then(response => { updatePurchaseCheckDetails(equipments).then(response => {
if (response.code == 200) { if (response.code == 200) {
this.$message({ this.$message({
message: "验收成功", message: '验收成功',
type: "success" type: 'success',
}); })
this.openAll = false; this.openAll = false
this.open = false; this.open = false
this.fileList1 = []; this.fileList1 = []
this.checkUrlList1 = []; this.checkUrlList1 = []
this.checkUrlNameList1 = []; this.checkUrlNameList1 = []
this.getTaskInfo(); this.getTaskInfo()
} }
}); })
} }
}); })
}, },
// //
imgUpLoad(param, name, index) { imgUpLoad(param, name, index) {
param.type = "ma"; param.type = 'ma'
imgUpLoad(param) imgUpLoad(param)
.then(res => { .then(res => {
if (res.code == 200) { if (res.code == 200) {
// console.log(res.data) // console.log(res.data)
if (this.open) { if (this.open) {
this.checkUrlList.push(res.data.fileUrl); this.checkUrlList.push(res.data.fileUrl)
this.checkUrlNameList.push(res.data.fileName); this.checkUrlNameList.push(res.data.fileName)
} }
if (this.openAll) { if (this.openAll) {
this.checkUrlList1.push(res.data.fileUrl); this.checkUrlList1.push(res.data.fileUrl)
this.checkUrlNameList1.push(res.data.fileName); this.checkUrlNameList1.push(res.data.fileName)
// this.aform.checkUrl = res.data.fileUrl; // this.aform.checkUrl = res.data.fileUrl;
// this.aform.checkUrlName = res.data.fileName; // this.aform.checkUrlName = res.data.fileName;
} }
} else { } else {
// this.$msgError(res.msg) // this.$msgError(res.msg)
this.$modal.msgError(res.msg); this.$modal.msgError(res.msg)
} }
}) })
.catch(error => { .catch(error => {
// this.$msgError(error) // this.$msgError(error)
this.$modal.msgError(error); this.$modal.msgError(error)
}); })
}, },
handleAvatarSuccess(res, file) { handleAvatarSuccess(res, file) {
// console.log("success") // console.log("success")
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
if (this.open) { if (this.open) {
let sum = 0; let sum = 0
this.checkUrlNameList.forEach((item, index) => { this.checkUrlNameList.forEach((item, index) => {
if (item == file.name) { if (item == file.name) {
sum = index; sum = index
} }
}); })
this.checkUrlNameList.splice(sum, 1); this.checkUrlNameList.splice(sum, 1)
this.checkUrlList.splice(sum, 1); this.checkUrlList.splice(sum, 1)
} }
if (this.openAll) { if (this.openAll) {
let sum1 = 0; let sum1 = 0
this.checkUrlNameList1.forEach((item, index) => { this.checkUrlNameList1.forEach((item, index) => {
if (item == file.name) { if (item == file.name) {
sum1 = index; sum1 = index
} }
}); })
this.checkUrlNameList1.splice(sum1, 1); this.checkUrlNameList1.splice(sum1, 1)
this.checkUrlList1.splice(sum1, 1); this.checkUrlList1.splice(sum1, 1)
} }
}, },
// //
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
// console.log(file) // console.log(file)
this.dialogImageUrl = file.url; this.dialogImageUrl = file.url
this.dialogVisible = true; this.dialogVisible = true
}, },
// //
openImg(url) { openImg(url) {
this.dialogImageUrl = this.uploadUrl + url; this.dialogImageUrl = this.uploadUrl + url
this.dialogVisible = true; this.dialogVisible = true
}, },
// //
selectable(row, index) { selectable(row, index) {
if (row.status == 0) { if (row.status == 0) {
return true; return true
} else { } else {
return false; return false
} }
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download( this.download(
"system/dict/type/export", 'system/dict/type/export',
{ {
...this.queryParams ...this.queryParams,
}, },
`type_${new Date().getTime()}.xlsx` `type_${new Date().getTime()}.xlsx`
); )
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {
refreshCache().then(() => { refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功"); this.$modal.msgSuccess('刷新成功')
this.$store.dispatch("dict/cleanDict"); this.$store.dispatch('dict/cleanDict')
}); })
} },
} },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini { ::v-deep.el-table .fixed-width .el-button--mini {

View File

@ -1,13 +1,21 @@
<template> <template>
<div class="app-container" id="newDevicesCode"> <div class="app-container" id="newDevicesCode">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px"> <el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="80px"
>
<el-form-item label="关键字" prop="keyWord"> <el-form-item label="关键字" prop="keyWord">
<el-input <el-input
v-model="queryParams.keyWord" v-model="queryParams.keyWord"
placeholder="请输入关键字" placeholder="请输入关键字"
clearable maxlength="50" clearable
style="width: 240px" maxlength="50"
@keyup.enter.native="handleQuery" style="width: 240px"
@keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
@ -26,18 +34,11 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
</el-col> --> </el-col>-->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button type="success" plain size="mini" icon="el-icon-back" @click="jumpList">新购验收管理</el-button>
type="success"
plain
size="mini"
icon="el-icon-back"
@click="jumpList"
>新购验收管理</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -45,26 +46,39 @@
<!-- <el-table-column type="selection" width="55" align="center" /> --> <!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index" />
<el-table-column label="机具类型名称" align="center" prop="typeName" :show-overflow-tooltip="true" /> <el-table-column label="机具类型名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="specificationType" :show-overflow-tooltip="true"/> <el-table-column
<el-table-column label="采购时间" align="center" prop="purchaseTime" :show-overflow-tooltip="true" /> label="规格型号"
<el-table-column label="采购数量" align="center" prop="purchaseNum" :show-overflow-tooltip="true" /> align="center"
prop="specificationType"
:show-overflow-tooltip="true"
/>
<el-table-column
label="采购时间"
align="center"
prop="purchaseTime"
:show-overflow-tooltip="true"
/>
<el-table-column
label="采购数量"
align="center"
prop="purchaseNum"
:show-overflow-tooltip="true"
/>
<el-table-column label="验收数量" align="center" prop="checkNum" :show-overflow-tooltip="true" /> <el-table-column label="验收数量" align="center" prop="checkNum" :show-overflow-tooltip="true" />
<el-table-column label="绑定数量" align="center" prop="bindNum" :show-overflow-tooltip="true" > <el-table-column label="绑定数量" align="center" prop="bindNum" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.bindNum>0">{{ scope.row.bindNum }}</span> <span v-if="scope.row.bindNum>0">{{ scope.row.bindNum }}</span>
<span v-else >0</span> <span v-else>0</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否为固定资产" align="center" prop="fixCode" :show-overflow-tooltip="true" > <el-table-column label="是否为固定资产" align="center" prop="fixCode" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.fixCode == '0'"></span> <span v-if="scope.row.fixCode == '0'"></span>
<span v-if="scope.row.fixCode == '1'"></span> <span v-if="scope.row.fixCode == '1'"></span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="编码类型" align="center" prop="codeType" :show-overflow-tooltip="true" /> <!-- <el-table-column label="编码类型" align="center" prop="codeType" :show-overflow-tooltip="true" />
<el-table-column label="二维码" align="center" prop="dictName" :show-overflow-tooltip="true" /> --> <el-table-column label="二维码" align="center" prop="dictName" :show-overflow-tooltip="true" />-->
<el-table-column label="状态" align="center" prop="status" width="180"> <el-table-column label="状态" align="center" prop="status" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.status==0">待入库</span> <span v-if="scope.row.status==0">待入库</span>
@ -74,44 +88,68 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="primary" type="primary"
v-if="scope.row.bindNum<scope.row.checkNum" v-if="scope.row.bindNum<scope.row.checkNum"
@click="handleCode(scope.row)" @click="handleCode(scope.row)"
>绑定编码</el-button> >绑定编码</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- <!--
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> --> />-->
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false"> <el-dialog
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
:close-on-click-modal="false"
>
<el-row :gutter="24" class="mb8"> <el-row :gutter="24" class="mb8">
<el-form ref="form" :model="form" :rules="rules" label-width="78px"> <el-form ref="form" :model="form" :rules="rules" label-width="78px">
<el-input v-model="form.typeId" disabled v-show="false"/> <el-input v-model="form.typeId" disabled v-show="false" />
<el-col :span="7"> <el-col :span="7">
<el-form-item label="编码前缀" prop="exCode"> <el-form-item label="编码前缀" prop="exCode">
<el-input v-model="form.exCode"/> <el-input v-model="form.exCode" @change="fillingCodeList" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="后缀范围"> <el-form-item label="后缀范围">
<div style="display: flex;"><el-input v-model="form.str" placeholder="0001" maxlength="4"></el-input> - <el-input v-model="form.str1" placeholder="0005" maxlength="4"></el-input></div> <div style="display: flex;">
<el-input
v-model="form.str"
placeholder="0001"
maxlength="4"
@change="fillingCodeList"
></el-input>-
<el-input
v-model="form.str1"
placeholder="0005"
maxlength="4"
@change="fillingCodeList"
></el-input>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="固定资产" prop="fixCode"> <el-form-item label="固定资产" prop="fixCode">
<el-select v-model="form.fixCode" placeholder="是否为固定资产" clearable allow-create=""> <el-select
<el-option label="是" value="0"/> v-model="form.fixCode"
<el-option label="否" value="1"/> placeholder="是否为固定资产"
@change="fillingCodeList"
clearable
allow-create
>
<el-option label="是" value="0" />
<el-option label="否" value="1" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -122,75 +160,87 @@
size="mini" size="mini"
@click="createCodeList" @click="createCodeList"
>生成</el-button> >生成</el-button>
</el-col> --> </el-col>-->
<el-col :span="2"> <el-col :span="2">
<el-button <el-button type="primary" plain size="mini" @click="fillingCodeList">填充</el-button>
type="primary"
plain
size="mini"
@click="fillingCodeList"
>填充</el-button>
</el-col> </el-col>
</el-form> </el-form>
</el-row> </el-row>
<el-table v-loading="loading" :data="codeList" height="400"> <el-table v-loading="loading" :data="codeList" height="400">
<!-- <el-table-column type="selection" width="50" align="center" /> --> <!-- <el-table-column type="selection" width="50" align="center" /> -->
<el-table-column label="序号" align="center" type="index"/> <el-table-column label="序号" align="center" type="index" />
<el-table-column label="机具种类" align="center" prop="typeName" :show-overflow-tooltip="true" width="120"/> <el-table-column
<el-table-column label="规格型号" align="center" prop="specificationType" :show-overflow-tooltip="true" width="120"/> label="机具种类"
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"> align="center"
<template slot-scope="scope"> prop="typeName"
<el-input v-model="scope.row.maCode" :disabled="scope.row.statusFlag==0" οninput="value=value.replace(/[^0-9.]/g,'')"></el-input> :show-overflow-tooltip="true"
</template> width="120"
</el-table-column> />
<el-table-column label="固定资产编码" align="center" prop="assetsCode" > <el-table-column
<template slot-scope="scope"> label="规格型号"
<el-input v-model="scope.row.assetsCode" v-show="form.fixCode=='0'" maxlength="50" ></el-input> align="center"
</template> prop="specificationType"
</el-table-column> :show-overflow-tooltip="true"
<el-table-column width="120"
label="操作" />
align="center" <el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true">
width="160" <template slot-scope="scope">
class-name="small-padding fixed-width" <el-input
> v-model="scope.row.maCode"
<template slot-scope="scope"> :disabled="scope.row.statusFlag==0"
<el-button οninput="value=value.replace(/[^0-9.]/g,'')"
size="mini" ></el-input>
type="text" </template>
icon="el-icon-delete" </el-table-column>
@click="delCode(scope.row)" <el-table-column label="固定资产编码" align="center" prop="assetsCode">
>删除</el-button> <template slot-scope="scope">
</template> <el-input v-model="scope.row.assetsCode" v-show="form.fixCode=='0'" maxlength="50"></el-input>
</el-table-column> </template>
</el-table> </el-table-column>
<el-table-column
label="操作"
align="center"
width="160"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="delCode(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer" style="text-align: center"> <div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type'
import { getPurchaseCheckInfo, listPurchaseMacodeInfo,addPurchaseMacode,updateMacode,delMacode,getMacodeInfo, } from "@/api/store/newBuy"; import {
import { getMacodeList,getMacodeDetailList,makeEquipmentNumber,editPurchaseMacode,delMacodeList } from "@/api/store/newBuy"; getPurchaseCheckInfo,
listPurchaseMacodeInfo,
import { getTypeList } from "@/api/store/warehousing"; addPurchaseMacode,
import { getListByMaType } from "@/api/store/tools"; updateMacode,
import { number } from 'echarts'; delMacode,
getMacodeInfo,
} from '@/api/store/newBuy'
import {
getMacodeList,
getMacodeDetailList,
makeEquipmentNumber,
editPurchaseMacode,
delMacodeList,
} from '@/api/store/newBuy'
import { getTypeList } from '@/api/store/warehousing'
import { getListByMaType } from '@/api/store/tools'
import { number } from 'echarts'
export default { export default {
name: "NewDevicesCode", name: 'NewDevicesCode',
dicts: ['sys_normal_disable'], dicts: ['sys_normal_disable'],
data() { data() {
return { return {
@ -208,11 +258,11 @@ export default {
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
taskId:'', taskId: '',
// //
typeList: [], typeList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -225,15 +275,15 @@ export default {
}, },
// //
form: { form: {
exCode:'', exCode: '',
str:'', str: '',
str1:'', str1: '',
fixCode:'1', fixCode: '1',
typeId:'' typeId: '',
}, },
codeList: [],//list codeList: [], //list
getCodeList: [],//list getCodeList: [], //list
newCodeList: [],//list newCodeList: [], //list
// //
rules: { rules: {
// typeId: [ // typeId: [
@ -245,102 +295,96 @@ export default {
// maCode: [ // maCode: [
// { required: true, message: "", trigger: "blur" } // { required: true, message: "", trigger: "blur" }
// ], // ],
},
} }
};
}, },
created() { created() {
const taskId = this.$route.query && this.$route.query.taskId; const taskId = this.$route.query && this.$route.query.taskId
this.taskId = taskId; this.taskId = taskId
console.log(this.taskId) console.log(this.taskId)
this.getList(); this.getList()
}, },
methods: { methods: {
// //
getTypeList() { getTypeList() {
getTypeList({level:'3'}).then(response => { getTypeList({ level: '3' }).then(response => {
this.typeList = response.data; this.typeList = response.data
} })
);
}, },
selectType(id) { selectType(id) {
console.log(id) console.log(id)
getListByMaType({typeId:id}).then(response => { getListByMaType({ typeId: id }).then(response => {
this.modelList = response.data; this.modelList = response.data
} })
);
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true
this.queryParams.taskId = this.taskId this.queryParams.taskId = this.taskId
getMacodeList(this.queryParams).then(response => { getMacodeList(this.queryParams).then(response => {
this.typeList = response.data; this.typeList = response.data
this.loading = false; this.loading = false
} })
);
}, },
// //
cancel() { cancel() {
this.reset() this.reset()
this.open = false; this.open = false
}, },
// //
reset() { reset() {
this.form = { this.form = {
str: undefined, str: undefined,
str1: undefined, str1: undefined,
fixCode:'1', fixCode: '1',
}
}; this.resetForm('form')
this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加"; this.title = '添加'
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.maId) this.ids = selection.map(item => item.maId)
this.single = selection.length!=1 this.single = selection.length != 1
this.multiple = !selection.length this.multiple = !selection.length
}, }, //getCodeList newCodeList
/** 编码按钮操作 */ //getCodeList newCodeList /** 编码按钮操作 */ handleCode(row) {
handleCode(row) {
console.log(row) console.log(row)
this.reset() this.reset()
this.form = row; this.form = row
this.$set(this.form,'str','') this.$set(this.form, 'str', '')
this.$set(this.form,'str1','') this.$set(this.form, 'str1', '')
// this.$set(this.form,'fixCode','1') // this.$set(this.form,'fixCode','1')
let arr = this.form.arrivalTime.split('-') let arr = this.form.arrivalTime.split('-')
// this.form.exCode = ; // this.form.exCode = ;
// this.form.typeCode=111 // this.form.typeCode=111
if(!this.form.typeCode){ if (!this.form.typeCode) {
this.form.typeCode='' this.form.typeCode = ''
} }
if(!this.form.specsCode){ if (!this.form.specsCode) {
this.form.specsCode='' this.form.specsCode = ''
} }
this.$set(this.form,'exCode','NSJJ'+this.form.typeCode+this.form.specsCode+arr[0][2]+arr[0][3]+arr[1]) this.$set(this.form, 'exCode', 'NSJJ' + this.form.typeCode + this.form.specsCode + arr[0][2] + arr[0][3] + arr[1])
this.form.count = row.checkNum; this.form.count = row.checkNum
this.codeList=[] this.codeList = []
this.open = true; this.open = true
this.title = "生成编码"; this.title = '生成编码'
// let param = { // let param = {
// taskId:this.taskId, // taskId:this.taskId,
// typeId:row.typeId, // typeId:row.typeId,
@ -349,10 +393,9 @@ export default {
// this.codeList = response.data; // this.codeList = response.data;
// }); // });
}, },
//codeList //codeList
createCodeList(){ createCodeList() {
// if(this.codeList.length>=this.form.checkNum){ // if(this.codeList.length>=this.form.checkNum){
// this.$modal.msgError(""); // this.$modal.msgError("");
// }else{ // }else{
@ -372,34 +415,34 @@ export default {
// } // }
}, },
// //
fillingCodeList(){ fillingCodeList() {
console.log(Number(this.form.str)) console.log(Number(this.form.str))
this.codeList = [] this.codeList = []
let num = Number(this.form.str) let num = Number(this.form.str)
// console.log(Number(this.form.str1)) // console.log(Number(this.form.str1))
let num1 = Number(this.form.str1) let num1 = Number(this.form.str1)
let count= num1-num+1;// let count = num1 - num + 1 //
console.log() console.log()
let sum = count + this.form.bindNum; let sum = count + this.form.bindNum
console.log(sum) console.log(sum)
if(sum>this.form.checkNum){ if (sum > this.form.checkNum) {
this.$modal.msgError("已绑定编码"+this.form.bindNum+"个,总数量已超过验收数量,请调整后缀范围。"); this.$modal.msgError('已绑定编码' + this.form.bindNum + '个,总数量已超过验收数量,请调整后缀范围。')
}else{ } else {
if(num1=>num){ if (num1 => num) {
for(let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
let obj = { let obj = {
typeName:this.form.typeName, typeName: this.form.typeName,
specificationType:this.form.specificationType, specificationType: this.form.specificationType,
typeId: this.form.typeId, typeId: this.form.typeId,
taskId: this.form.taskId, taskId: this.form.taskId,
maCode:this.form.exCode+("00000" + (num+i)).slice(-4), maCode: this.form.exCode + ('00000' + (num + i)).slice(-4),
assetsCode:'', assetsCode: '',
fixCode:this.form.fixCode, fixCode: this.form.fixCode,
} }
this.codeList.push(obj) this.codeList.push(obj)
} }
} else{ } else {
this.$modal.msgError("编码后缀范围输入格式不正确"); this.$modal.msgError('编码后缀范围输入格式不正确')
} }
} }
}, },
@ -407,57 +450,57 @@ export default {
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
// console.log(this.codeList) // console.log(this.codeList)
if(this.form.fixCode==0){ if (this.form.fixCode == 0) {
if(this.hasDuplicateField(this.codeList, 'assetsCode')){ if (this.hasDuplicateField(this.codeList, 'assetsCode')) {
this.$modal.msgError("固定资产编码绑定失败,存在重复编码,请重新输入"); this.$modal.msgError('固定资产编码不能为空')
return false return false
} }
} }
if(this.codeList.length==0){ if (this.codeList.length == 0) {
this.$modal.msgError("无新增编码绑定"); this.$modal.msgError('无新增编码绑定')
}else{ } else {
editPurchaseMacode(this.codeList).then(response => { editPurchaseMacode(this.codeList).then(response => {
console.log(response.data) console.log(this.codeList)
if(response.data && response.data.length>0){ if (response.data && response.data.length > 0) {
this.codeList = response.data; this.codeList = response.data
this.$modal.msgError("编码绑定失败,存在重复编码,请重新输入"); this.$modal.msgError('编码绑定失败,存在重复编码,请重新输入')
}else{ } else {
this.$modal.msgSuccess("编码绑定成功"); this.$modal.msgSuccess('编码绑定成功')
this.open = false; this.open = false
this.getList(); this.getList()
} }
}); })
} }
}, },
hasDuplicateField(array, field) { hasDuplicateField(array, field) {
const map = {}; const map = {}
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {
const value = array[i][field]; const value = array[i][field]
if (map[value]) { if (map[value]) {
return true; return true
} }
map[value] = true; map[value] = true
} }
return false; return false
}, },
getdetailmaCodeList(data){ getdetailmaCodeList(data) {
console.log(data) console.log(data)
let param = { let param = {
taskId:this.taskId, taskId: this.taskId,
typeId:data.typeId, typeId: data.typeId,
} }
getMacodeDetailList(param).then(response => { getMacodeDetailList(param).then(response => {
this.getCodeList = response.data; this.getCodeList = response.data
this.codeList = this.getCodeList.concat(this.newCodeList) this.codeList = this.getCodeList.concat(this.newCodeList)
}); })
}, },
delCode(row) { delCode(row) {
console.log(row) console.log(row)
this.codeList.forEach((item,index) => { this.codeList.forEach((item, index) => {
if(item.maCode==row.maCode){ if (item.maCode == row.maCode) {
this.codeList.splice(index,1) this.codeList.splice(index, 1)
} }
}); })
// const maCode = row.maCode ; // const maCode = row.maCode ;
// this.$modal.confirm('').then(function() { // this.$modal.confirm('').then(function() {
// return delMacodeList(maCode); // return delMacodeList(maCode);
@ -466,23 +509,19 @@ export default {
// this.$modal.msgSuccess(""); // this.$modal.msgSuccess("");
// }).catch(() => {}); // }).catch(() => {});
}, },
// //
jumpList(){ jumpList() {
const obj = { path: "/store/newBuy/newDevicesList" } const obj = { path: '/store/newBuy/newDevicesList' }
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj)
}, },
},
}
}
};
</script> </script>
<style scoped> <style scoped>
.redColor{ .redColor {
color: red; color: red;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini { ::v-deep.el-table .fixed-width .el-button--mini {