领退料级联选择器问题优化,新需求完善
This commit is contained in:
parent
287aa0ae97
commit
4dc002e9e6
|
|
@ -1,83 +1,87 @@
|
||||||
import { Message, MessageBox, Notification, Loading } from 'element-ui'
|
import { Message, MessageBox, Notification, Loading } from 'element-ui'
|
||||||
|
|
||||||
let loadingInstance;
|
let loadingInstance
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// 消息提示
|
// 消息提示
|
||||||
msg(content) {
|
msg(content) {
|
||||||
Message.info(content)
|
Message.closeAll()
|
||||||
},
|
Message.info(content)
|
||||||
// 错误消息
|
},
|
||||||
msgError(content) {
|
// 错误消息
|
||||||
Message.error(content)
|
msgError(content) {
|
||||||
},
|
Message.closeAll()
|
||||||
// 成功消息
|
Message.error(content)
|
||||||
msgSuccess(content) {
|
},
|
||||||
Message.success(content)
|
// 成功消息
|
||||||
},
|
msgSuccess(content) {
|
||||||
// 警告消息
|
Message.closeAll()
|
||||||
msgWarning(content) {
|
Message.success(content)
|
||||||
Message.warning(content)
|
},
|
||||||
},
|
// 警告消息
|
||||||
// 弹出提示
|
msgWarning(content) {
|
||||||
alert(content) {
|
Message.closeAll()
|
||||||
MessageBox.alert(content, "系统提示")
|
Message.warning(content)
|
||||||
},
|
},
|
||||||
// 错误提示
|
// 弹出提示
|
||||||
alertError(content) {
|
alert(content) {
|
||||||
MessageBox.alert(content, "系统提示", { type: 'error' })
|
MessageBox.alert(content, '系统提示')
|
||||||
},
|
},
|
||||||
// 成功提示
|
// 错误提示
|
||||||
alertSuccess(content) {
|
alertError(content) {
|
||||||
MessageBox.alert(content, "系统提示", { type: 'success' })
|
MessageBox.alert(content, '系统提示', { type: 'error' })
|
||||||
},
|
},
|
||||||
// 警告提示
|
// 成功提示
|
||||||
alertWarning(content) {
|
alertSuccess(content) {
|
||||||
MessageBox.alert(content, "系统提示", { type: 'warning' })
|
MessageBox.alert(content, '系统提示', { type: 'success' })
|
||||||
},
|
},
|
||||||
// 通知提示
|
// 警告提示
|
||||||
notify(content) {
|
alertWarning(content) {
|
||||||
Notification.info(content)
|
MessageBox.alert(content, '系统提示', { type: 'warning' })
|
||||||
},
|
},
|
||||||
// 错误通知
|
// 通知提示
|
||||||
notifyError(content) {
|
notify(content) {
|
||||||
Notification.error(content);
|
Notification.info(content)
|
||||||
},
|
},
|
||||||
// 成功通知
|
// 错误通知
|
||||||
notifySuccess(content) {
|
notifyError(content) {
|
||||||
Notification.success(content)
|
Notification.error(content)
|
||||||
},
|
},
|
||||||
// 警告通知
|
// 成功通知
|
||||||
notifyWarning(content) {
|
notifySuccess(content) {
|
||||||
Notification.warning(content)
|
Notification.success(content)
|
||||||
},
|
},
|
||||||
// 确认窗体
|
// 警告通知
|
||||||
confirm(content) {
|
notifyWarning(content) {
|
||||||
return MessageBox.confirm(content, "系统提示", {
|
Notification.warning(content)
|
||||||
confirmButtonText: '确定',
|
},
|
||||||
cancelButtonText: '取消',
|
// 确认窗体
|
||||||
type: "warning",
|
confirm(content) {
|
||||||
})
|
return MessageBox.confirm(content, '系统提示', {
|
||||||
},
|
confirmButtonText: '确定',
|
||||||
// 提交内容
|
cancelButtonText: '取消',
|
||||||
prompt(content) {
|
type: 'warning',
|
||||||
return MessageBox.prompt(content, "系统提示", {
|
})
|
||||||
confirmButtonText: '确定',
|
},
|
||||||
cancelButtonText: '取消',
|
// 提交内容
|
||||||
type: "warning",
|
prompt(content) {
|
||||||
})
|
return MessageBox.prompt(content, '系统提示', {
|
||||||
},
|
confirmButtonText: '确定',
|
||||||
// 打开遮罩层
|
cancelButtonText: '取消',
|
||||||
loading(content) {
|
type: 'warning',
|
||||||
loadingInstance = Loading.service({
|
})
|
||||||
lock: true,
|
},
|
||||||
text: content,
|
// 打开遮罩层
|
||||||
spinner: "el-icon-loading",
|
loading(content) {
|
||||||
background: "rgba(0, 0, 0, 0.7)",
|
loadingInstance = Loading.service({
|
||||||
})
|
lock: true,
|
||||||
},
|
text: content,
|
||||||
// 关闭遮罩层
|
spinner: 'el-icon-loading',
|
||||||
closeLoading() {
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
loadingInstance.close();
|
})
|
||||||
}
|
},
|
||||||
|
// 关闭遮罩层
|
||||||
|
closeLoading() {
|
||||||
|
loadingInstance.close()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,179 +3,244 @@ import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import errorCode from '@/utils/errorCode'
|
import errorCode from '@/utils/errorCode'
|
||||||
import { tansParams, blobValidate } from "@/utils/ruoyi";
|
import { tansParams, blobValidate } from '@/utils/ruoyi'
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
|
|
||||||
let downloadLoadingInstance;
|
let downloadLoadingInstance
|
||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export let isRelogin = { show: false };
|
export let isRelogin = { show: false }
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
baseURL: process.env.VUE_APP_BASE_API,
|
baseURL: process.env.VUE_APP_BASE_API,
|
||||||
// 超时
|
// 超时
|
||||||
timeout: 10000
|
timeout: 10000,
|
||||||
})
|
})
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(
|
||||||
// 是否需要设置 token
|
(config) => {
|
||||||
const isToken = (config.headers || {}).isToken === false
|
// 是否需要设置 token
|
||||||
// 是否需要防止数据重复提交
|
const isToken = (config.headers || {}).isToken === false
|
||||||
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
// 是否需要防止数据重复提交
|
||||||
if (getToken() && !isToken) {
|
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
||||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
if (getToken() && !isToken) {
|
||||||
}
|
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
// get请求映射params参数
|
}
|
||||||
if (config.method === 'get' && config.params) {
|
// get请求映射params参数
|
||||||
let url = config.url + '?' + tansParams(config.params);
|
if (config.method === 'get' && config.params) {
|
||||||
url = url.slice(0, -1);
|
let url = config.url + '?' + tansParams(config.params)
|
||||||
config.params = {};
|
url = url.slice(0, -1)
|
||||||
config.url = url;
|
config.params = {}
|
||||||
}
|
config.url = url
|
||||||
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
|
}
|
||||||
const requestObj = {
|
if (
|
||||||
url: config.url,
|
!isRepeatSubmit &&
|
||||||
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
|
(config.method === 'post' || config.method === 'put')
|
||||||
time: new Date().getTime()
|
) {
|
||||||
}
|
const requestObj = {
|
||||||
const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小
|
url: config.url,
|
||||||
const limitSize = 5 * 1024 * 1024; // 限制存放数据5M
|
data:
|
||||||
if (requestSize >= limitSize) {
|
typeof config.data === 'object'
|
||||||
console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制,无法进行防重复提交验证。')
|
? JSON.stringify(config.data)
|
||||||
return config;
|
: config.data,
|
||||||
}
|
time: new Date().getTime(),
|
||||||
const sessionObj = cache.session.getJSON('sessionObj')
|
}
|
||||||
if (sessionObj === undefined || sessionObj === null || sessionObj === '') {
|
const requestSize = Object.keys(JSON.stringify(requestObj)).length // 请求数据大小
|
||||||
cache.session.setJSON('sessionObj', requestObj)
|
const limitSize = 5 * 1024 * 1024 // 限制存放数据5M
|
||||||
} else {
|
if (requestSize >= limitSize) {
|
||||||
const s_url = sessionObj.url; // 请求地址
|
console.warn(
|
||||||
const s_data = sessionObj.data; // 请求数据
|
`[${config.url}]: ` +
|
||||||
const s_time = sessionObj.time; // 请求时间
|
'请求数据大小超出允许的5M限制,无法进行防重复提交验证。',
|
||||||
const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交
|
)
|
||||||
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
|
return config
|
||||||
const message = '数据正在处理,请勿重复提交';
|
}
|
||||||
console.warn(`[${s_url}]: ` + message)
|
const sessionObj = cache.session.getJSON('sessionObj')
|
||||||
return Promise.reject(new Error(message))
|
if (
|
||||||
} else {
|
sessionObj === undefined ||
|
||||||
cache.session.setJSON('sessionObj', requestObj)
|
sessionObj === null ||
|
||||||
}
|
sessionObj === ''
|
||||||
}
|
) {
|
||||||
}
|
cache.session.setJSON('sessionObj', requestObj)
|
||||||
return config
|
} else {
|
||||||
}, error => {
|
const s_url = sessionObj.url // 请求地址
|
||||||
console.log(error)
|
const s_data = sessionObj.data // 请求数据
|
||||||
Promise.reject(error)
|
const s_time = sessionObj.time // 请求时间
|
||||||
})
|
const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交
|
||||||
|
if (
|
||||||
|
s_data === requestObj.data &&
|
||||||
|
requestObj.time - s_time < interval &&
|
||||||
|
s_url === requestObj.url
|
||||||
|
) {
|
||||||
|
const message = '数据正在处理,请勿重复提交'
|
||||||
|
console.warn(`[${s_url}]: ` + message)
|
||||||
|
return Promise.reject(new Error(message))
|
||||||
|
} else {
|
||||||
|
cache.session.setJSON('sessionObj', requestObj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
console.log(error)
|
||||||
|
Promise.reject(error)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(
|
||||||
// 未设置状态码则默认成功状态
|
(res) => {
|
||||||
const code = res.data.code || 200;
|
// 未设置状态码则默认成功状态
|
||||||
// 获取错误信息
|
const code = res.data.code || 200
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
// 获取错误信息
|
||||||
// 二进制数据则直接返回
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
// 二进制数据则直接返回
|
||||||
return res.data
|
if (
|
||||||
}
|
res.request.responseType === 'blob' ||
|
||||||
if (code === 401) {
|
res.request.responseType === 'arraybuffer'
|
||||||
if (!isRelogin.show) {
|
) {
|
||||||
isRelogin.show = true;
|
return res.data
|
||||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
}
|
||||||
isRelogin.show = false;
|
if (code === 401) {
|
||||||
store.dispatch('LogOut').then(() => {
|
if (!isRelogin.show) {
|
||||||
// location.href = '/login';
|
isRelogin.show = true
|
||||||
// location.href = '/gl/login';
|
MessageBox.confirm(
|
||||||
|
'登录状态已过期,您可以继续留在该页面,或者重新登录',
|
||||||
|
'系统提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '重新登录',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
isRelogin.show = false
|
||||||
|
store.dispatch('LogOut').then(() => {
|
||||||
|
// location.href = '/login';
|
||||||
|
// location.href = '/gl/login';
|
||||||
|
|
||||||
location.href = process.env.VUE_APP_ENV === 'production-nw' ? '/sgzbgl/login' : '/login'
|
location.href =
|
||||||
})
|
process.env.VUE_APP_ENV === 'production-nw'
|
||||||
}).catch(() => {
|
? '/sgzbgl/login'
|
||||||
isRelogin.show = false;
|
: '/login'
|
||||||
});
|
})
|
||||||
}
|
})
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
.catch(() => {
|
||||||
} else if (code === 500) {
|
isRelogin.show = false
|
||||||
Message({ message: msg, type: 'error' })
|
})
|
||||||
return Promise.reject(new Error(msg))
|
}
|
||||||
} else if (code === 601) {
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
Message({ message: msg, type: 'warning' })
|
} else if (code === 500) {
|
||||||
return Promise.reject('error')
|
Message.closeAll()
|
||||||
} else if (code !== 200) {
|
Message({ message: msg, type: 'error' })
|
||||||
Notification.error({ title: msg })
|
return Promise.reject(new Error(msg))
|
||||||
return Promise.reject('error')
|
} else if (code === 601) {
|
||||||
} else {
|
Message.closeAll()
|
||||||
return res.data
|
Message({ message: msg, type: 'warning' })
|
||||||
}
|
return Promise.reject('error')
|
||||||
},
|
} else if (code !== 200) {
|
||||||
error => {
|
Notification.closeAll()
|
||||||
console.log('err' + error)
|
Notification.error({ title: msg })
|
||||||
let { message } = error;
|
return Promise.reject('error')
|
||||||
if (message == "Network Error") {
|
} else {
|
||||||
message = "后端接口连接异常";
|
return res.data
|
||||||
} else if (message.includes("timeout")) {
|
}
|
||||||
message = "系统接口请求超时";
|
},
|
||||||
} else if (message.includes("Request failed with status code")) {
|
(error) => {
|
||||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
console.log('err' + error)
|
||||||
}
|
let { message } = error
|
||||||
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
if (message == 'Network Error') {
|
||||||
return Promise.reject(error)
|
message = '后端接口连接异常'
|
||||||
}
|
} else if (message.includes('timeout')) {
|
||||||
|
message = '系统接口请求超时'
|
||||||
|
} else if (message.includes('Request failed with status code')) {
|
||||||
|
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||||
|
}
|
||||||
|
Message.closeAll()
|
||||||
|
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
||||||
|
return Promise.reject(error)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
export function download(url, params, filename, config) {
|
export function download(url, params, filename, config) {
|
||||||
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
|
downloadLoadingInstance = Loading.service({
|
||||||
return service.post(url, params, {
|
text: '正在下载数据,请稍候',
|
||||||
transformRequest: [(params) => { return tansParams(params) }],
|
spinner: 'el-icon-loading',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
responseType: 'blob',
|
})
|
||||||
...config
|
return service
|
||||||
}).then(async (data) => {
|
.post(url, params, {
|
||||||
const isBlob = blobValidate(data);
|
transformRequest: [
|
||||||
if (isBlob) {
|
(params) => {
|
||||||
const blob = new Blob([data])
|
return tansParams(params)
|
||||||
saveAs(blob, filename)
|
},
|
||||||
} else {
|
],
|
||||||
const resText = await data.text();
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
const rspObj = JSON.parse(resText);
|
responseType: 'blob',
|
||||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
...config,
|
||||||
Message.error(errMsg);
|
})
|
||||||
}
|
.then(async (data) => {
|
||||||
downloadLoadingInstance.close();
|
const isBlob = blobValidate(data)
|
||||||
}).catch((r) => {
|
if (isBlob) {
|
||||||
console.error(r)
|
const blob = new Blob([data])
|
||||||
Message.error('下载文件出现错误,请联系管理员!')
|
saveAs(blob, filename)
|
||||||
downloadLoadingInstance.close();
|
} else {
|
||||||
})
|
const resText = await data.text()
|
||||||
|
const rspObj = JSON.parse(resText)
|
||||||
|
const errMsg =
|
||||||
|
errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg)
|
||||||
|
}
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
})
|
||||||
|
.catch((r) => {
|
||||||
|
console.error(r)
|
||||||
|
Message.error('下载文件出现错误,请联系管理员!')
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
export function downloadJson(url, params, filename, config) {
|
export function downloadJson(url, params, filename, config) {
|
||||||
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
|
downloadLoadingInstance = Loading.service({
|
||||||
return service.post(url, params, {
|
text: '正在下载数据,请稍候',
|
||||||
transformRequest: [(params) => { return params }],
|
spinner: 'el-icon-loading',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
responseType: 'blob',
|
})
|
||||||
...config
|
return service
|
||||||
}).then(async (data) => {
|
.post(url, params, {
|
||||||
const isBlob = blobValidate(data);
|
transformRequest: [
|
||||||
if (isBlob) {
|
(params) => {
|
||||||
const blob = new Blob([data])
|
return params
|
||||||
saveAs(blob, filename)
|
},
|
||||||
} else {
|
],
|
||||||
const resText = await data.text();
|
headers: { 'Content-Type': 'application/json' },
|
||||||
const rspObj = JSON.parse(resText);
|
responseType: 'blob',
|
||||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
...config,
|
||||||
Message.error(errMsg);
|
})
|
||||||
}
|
.then(async (data) => {
|
||||||
downloadLoadingInstance.close();
|
const isBlob = blobValidate(data)
|
||||||
}).catch((r) => {
|
if (isBlob) {
|
||||||
console.error(r)
|
const blob = new Blob([data])
|
||||||
Message.error('下载文件出现错误,请联系管理员!')
|
saveAs(blob, filename)
|
||||||
downloadLoadingInstance.close();
|
} else {
|
||||||
})
|
const resText = await data.text()
|
||||||
|
const rspObj = JSON.parse(resText)
|
||||||
|
const errMsg =
|
||||||
|
errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg)
|
||||||
|
}
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
})
|
||||||
|
.catch((r) => {
|
||||||
|
console.error(r)
|
||||||
|
Message.error('下载文件出现错误,请联系管理员!')
|
||||||
|
downloadLoadingInstance.close()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
export default service
|
export default service
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,17 @@
|
||||||
<el-form-item label="规格型号" prop="status">
|
<el-form-item label="规格型号" prop="status">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
placeholder="请输入规格型号"
|
placeholder="请输入规格型号"
|
||||||
|
collapse-tags
|
||||||
:options="deviceTypeTree"
|
:options="deviceTypeTree"
|
||||||
:props="deviceTypeTreeProps"
|
:props="deviceTypeTreeProps"
|
||||||
|
popper-class="popper-select"
|
||||||
|
:show-all-levels="false"
|
||||||
v-model="deviceType"
|
v-model="deviceType"
|
||||||
@change="deviceTypeChange"
|
@change="deviceTypeChange"
|
||||||
ref="deviceTypeCascader"
|
ref="deviceTypeCascader"
|
||||||
filterable
|
filterable
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
|
:key="propsKey"
|
||||||
:disabled="(isEdit && !isView) || isCost"
|
:disabled="(isEdit && !isView) || isCost"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -457,11 +461,11 @@ export default {
|
||||||
|
|
||||||
// 设备 树显示 配置
|
// 设备 树显示 配置
|
||||||
deviceTypeTreeProps: {
|
deviceTypeTreeProps: {
|
||||||
multiple: false,
|
multiple: true,
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
// 选中的设备类型
|
// 选中的设备类型
|
||||||
deviceType: null,
|
deviceType: [],
|
||||||
|
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
|
|
@ -495,6 +499,7 @@ export default {
|
||||||
},
|
},
|
||||||
costBearingList: [],
|
costBearingList: [],
|
||||||
isCost: false,
|
isCost: false,
|
||||||
|
propsKey: 1000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -506,7 +511,7 @@ export default {
|
||||||
|
|
||||||
this.getCostBearingFun()
|
this.getCostBearingFun()
|
||||||
|
|
||||||
this.GetDeviceTypeTree()
|
// this.GetDeviceTypeTree()
|
||||||
// this.getList();
|
// this.getList();
|
||||||
if (this.$route.query.taskId && !this.$route.query.isBack) {
|
if (this.$route.query.taskId && !this.$route.query.isBack) {
|
||||||
console.log('查看')
|
console.log('查看')
|
||||||
|
|
@ -521,8 +526,25 @@ export default {
|
||||||
this.taskId = this.viewTaskId
|
this.taskId = this.viewTaskId
|
||||||
|
|
||||||
if (this.taskId) {
|
if (this.taskId) {
|
||||||
this.GetTaskDetail(this.taskId)
|
Promise.all([
|
||||||
|
this.GetTaskDetail(this.taskId),
|
||||||
|
this.GetDeviceTypeTree(),
|
||||||
|
]).then(() => {
|
||||||
|
let selectList = []
|
||||||
|
this.leaseApplyDetails.forEach((e) => {
|
||||||
|
selectList.push(
|
||||||
|
this.getParentsById(this.deviceTypeTree, e.typeId),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.deviceType = selectList
|
||||||
|
this.propsKey++
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.GetDeviceTypeTree()
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(typeof(this.isEdit))
|
// console.log(typeof(this.isEdit))
|
||||||
// this.$set('isEdit',this.$route.query.isEdit)
|
// this.$set('isEdit',this.$route.query.isEdit)
|
||||||
},
|
},
|
||||||
|
|
@ -560,8 +582,25 @@ export default {
|
||||||
const params = {
|
const params = {
|
||||||
level: 4,
|
level: 4,
|
||||||
}
|
}
|
||||||
const res = await getDeviceTypeTree(params)
|
getDeviceTypeTree(params).then((res) => {
|
||||||
this.deviceTypeTree = res.data
|
this.deviceTypeTree = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getParentsById(list, id) {
|
||||||
|
for (let i in list) {
|
||||||
|
if (list[i].id == id) {
|
||||||
|
//查询到就返回该数组对象的value
|
||||||
|
return [list[i].id]
|
||||||
|
}
|
||||||
|
if (list[i].children) {
|
||||||
|
let node = this.getParentsById(list[i].children, id)
|
||||||
|
if (node !== undefined) {
|
||||||
|
//查询到把父节把父节点加到数组前面
|
||||||
|
node.unshift(list[i].id)
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 获取 协议id
|
// 获取 协议id
|
||||||
async GetAgreementInfoById() {
|
async GetAgreementInfoById() {
|
||||||
|
|
@ -832,6 +871,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
|
this.deviceType.forEach((e, index) => {
|
||||||
|
if (e[3] === row.typeId) {
|
||||||
|
this.deviceType.splice(index, 1)
|
||||||
|
this.propsKey++
|
||||||
|
}
|
||||||
|
})
|
||||||
this.leaseApplyDetails.splice(row.index, 1)
|
this.leaseApplyDetails.splice(row.index, 1)
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
|
|
@ -851,25 +896,74 @@ export default {
|
||||||
},
|
},
|
||||||
/////// 设备类型树 切换
|
/////// 设备类型树 切换
|
||||||
deviceTypeChange(val) {
|
deviceTypeChange(val) {
|
||||||
console.log(val)
|
const deviceTypeList =
|
||||||
let nodes = null
|
this.$refs.deviceTypeCascader.getCheckedNodes()
|
||||||
nodes =
|
|
||||||
this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
|
// if (val.length > 0) {
|
||||||
? this.$refs.deviceTypeCascader.getCheckedNodes()
|
// for (let i in val) {
|
||||||
: [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
|
// console.log(val[i], '----+++')
|
||||||
if (nodes[0].level != 4) {
|
// }
|
||||||
return
|
// }
|
||||||
}
|
let tempList = []
|
||||||
// console.log(this.leaseApplyDetails)
|
if (val.length > 0) {
|
||||||
// console.log(nodes[0].data.id)
|
const items = val.map((e) => {
|
||||||
for (let i = 0; i < this.leaseApplyDetails.length; i++) {
|
return e[3]
|
||||||
if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) {
|
})
|
||||||
this.leaseApplyDetails.splice(i, 1)
|
for (let i in items) {
|
||||||
break
|
for (let z in deviceTypeList) {
|
||||||
|
if (deviceTypeList[z].data.id === items[i]) {
|
||||||
|
let { num, companyId, id, unitName } =
|
||||||
|
deviceTypeList[z].data
|
||||||
|
tempList.push({
|
||||||
|
createBy: this.user.name,
|
||||||
|
typeId: id,
|
||||||
|
num,
|
||||||
|
companyId,
|
||||||
|
unitCn: unitName,
|
||||||
|
typeCn: deviceTypeList[z].pathLabels[2],
|
||||||
|
guigeCn: deviceTypeList[z].pathLabels[3],
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.leaseApplyDetails.push(this.handelTableItemData(nodes[0]))
|
|
||||||
this.deviceType = {}
|
this.leaseApplyDetails = [...new Set(tempList)]
|
||||||
|
|
||||||
|
// const templateList = deviceTypeList.map((e) => {
|
||||||
|
// let { num, companyId, id, unitName } = e.data
|
||||||
|
// return {
|
||||||
|
// createBy: this.user.name,
|
||||||
|
// num,
|
||||||
|
// companyId,
|
||||||
|
// typeId: id,
|
||||||
|
// unitCn: unitName,
|
||||||
|
// typeCn: e.pathLabels[2],
|
||||||
|
// guigeCn: e.pathLabels[3],
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// this.leaseApplyDetails = [...new Set(templateList)]
|
||||||
|
// console.log(templateList, '----')
|
||||||
|
|
||||||
|
// let nodes = null
|
||||||
|
// nodes =
|
||||||
|
// this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
|
||||||
|
// ? this.$refs.deviceTypeCascader.getCheckedNodes()
|
||||||
|
// : [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
|
||||||
|
// if (nodes[0].level != 4) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// // console.log(this.leaseApplyDetails)
|
||||||
|
// // console.log(nodes[0].data.id)
|
||||||
|
// for (let i = 0; i < this.leaseApplyDetails.length; i++) {
|
||||||
|
// if (this.leaseApplyDetails[i].typeId == nodes[0].data.id) {
|
||||||
|
// this.leaseApplyDetails.splice(i, 1)
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// this.leaseApplyDetails.push(this.handelTableItemData(nodes[0]))
|
||||||
|
// this.deviceType = {}
|
||||||
},
|
},
|
||||||
//// 将数据处理成 表格中需要的数据
|
//// 将数据处理成 表格中需要的数据
|
||||||
handelTableItemData(node) {
|
handelTableItemData(node) {
|
||||||
|
|
@ -912,3 +1006,21 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.popper-select {
|
||||||
|
// li[aria-haspopup='true'] {
|
||||||
|
// .el-checkbox {
|
||||||
|
// display: none;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
.el-cascader-panel .el-scrollbar .el-checkbox {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-cascader-panel .el-scrollbar:nth-child(4) .el-checkbox {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,18 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="规格型号" prop="status">
|
<el-form-item label="规格型号" prop="status">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
placeholder="规格型号"
|
:key="propsKey"
|
||||||
|
v-model="deviceType"
|
||||||
|
:show-all-levels="false"
|
||||||
:options="deviceTypeTree"
|
:options="deviceTypeTree"
|
||||||
:props="deviceTypeTreeProps"
|
:props="deviceTypeTreeProps"
|
||||||
v-model="deviceType"
|
|
||||||
@change="deviceTypeChange"
|
|
||||||
ref="deviceTypeCascader"
|
|
||||||
filterable
|
filterable
|
||||||
|
collapse-tags
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
|
placeholder="规格型号"
|
||||||
|
ref="deviceTypeCascader"
|
||||||
|
popper-class="popper-select"
|
||||||
|
@change="deviceTypeChange"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="退料人" prop="backPerson">
|
<el-form-item label="退料人" prop="backPerson">
|
||||||
|
|
@ -159,18 +163,21 @@
|
||||||
label="机具名称"
|
label="机具名称"
|
||||||
prop="typeName"
|
prop="typeName"
|
||||||
min-width="200"
|
min-width="200"
|
||||||
|
align="center"
|
||||||
:show-overflow-tooltip="true"
|
:show-overflow-tooltip="true"
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="规格型号"
|
label="规格型号"
|
||||||
prop="typeCode"
|
prop="typeCode"
|
||||||
min-width="200"
|
min-width="200"
|
||||||
|
align="center"
|
||||||
:show-overflow-tooltip="true"
|
:show-overflow-tooltip="true"
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="计量单位"
|
label="计量单位"
|
||||||
prop="unitNames"
|
prop="unitNames"
|
||||||
min-width="100"
|
min-width="100"
|
||||||
|
align="center"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
|
@ -286,6 +293,7 @@ export default {
|
||||||
},
|
},
|
||||||
isEdit: {
|
isEdit: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -445,9 +453,10 @@ export default {
|
||||||
label: 'typeName',
|
label: 'typeName',
|
||||||
// multiple: false,
|
// multiple: false,
|
||||||
value: 'typeId',
|
value: 'typeId',
|
||||||
|
multiple: true,
|
||||||
},
|
},
|
||||||
// 选中的设备类型
|
// 选中的设备类型
|
||||||
deviceType: null,
|
deviceType: [],
|
||||||
|
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
|
|
@ -481,8 +490,9 @@ export default {
|
||||||
},
|
},
|
||||||
companyId: '',
|
companyId: '',
|
||||||
createBy: '',
|
createBy: '',
|
||||||
isEdit: 'true',
|
// isEdit: 'true',
|
||||||
rowId: '',
|
rowId: '',
|
||||||
|
propsKey: 2000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -539,9 +549,38 @@ export default {
|
||||||
// this.agreementId
|
// this.agreementId
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await getUseTypeTreee(params)
|
getUseTypeTreee(params).then((res) => {
|
||||||
console.log('resgetUseTypeTreee==========', res)
|
this.deviceTypeTree = res.data
|
||||||
this.deviceTypeTree = res.data
|
|
||||||
|
// console.log(this.deviceTypeTree, this.leaseApplyDetails, '6666')
|
||||||
|
|
||||||
|
let selectList = []
|
||||||
|
this.leaseApplyDetails.forEach((e) => {
|
||||||
|
selectList.push(
|
||||||
|
this.getParentsById(this.deviceTypeTree, e.typeId),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.deviceType = selectList
|
||||||
|
this.propsKey++
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 获取 协议id
|
// 获取 协议id
|
||||||
async GetAgreementInfoById() {
|
async GetAgreementInfoById() {
|
||||||
|
|
@ -587,7 +626,7 @@ export default {
|
||||||
},
|
},
|
||||||
//生成回显数据
|
//生成回显数据
|
||||||
handelEchoData(item) {
|
handelEchoData(item) {
|
||||||
console.log('item======', item)
|
// console.log('item======', item)
|
||||||
const template = JSON.parse(
|
const template = JSON.parse(
|
||||||
JSON.stringify(this.leaseApplyDetailsItem),
|
JSON.stringify(this.leaseApplyDetailsItem),
|
||||||
)
|
)
|
||||||
|
|
@ -693,7 +732,7 @@ export default {
|
||||||
},
|
},
|
||||||
//是否可用勾选框
|
//是否可用勾选框
|
||||||
selectable(row) {
|
selectable(row) {
|
||||||
console.log(row)
|
// console.log(row)
|
||||||
if (row.num != 0) {
|
if (row.num != 0) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -844,6 +883,12 @@ export default {
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
|
this.deviceType.forEach((e, index) => {
|
||||||
|
if (e[3] === row.typeId) {
|
||||||
|
this.deviceType.splice(index, 1)
|
||||||
|
this.propsKey++
|
||||||
|
}
|
||||||
|
})
|
||||||
this.leaseApplyDetails.splice(row.index, 1)
|
this.leaseApplyDetails.splice(row.index, 1)
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
|
|
@ -868,38 +913,75 @@ export default {
|
||||||
|
|
||||||
/////// 设备类型树 切换
|
/////// 设备类型树 切换
|
||||||
async deviceTypeChange(val) {
|
async deviceTypeChange(val) {
|
||||||
let nodes = null
|
// let nodes = null
|
||||||
console.log(
|
// console.log(
|
||||||
'vall1211221122',
|
// 'vall1211221122',
|
||||||
this.$refs.deviceTypeCascader.getCheckedNodes().length,
|
// this.$refs.deviceTypeCascader.getCheckedNodes().length,
|
||||||
this.$refs.deviceTypeCascader.getCheckedNodes(),
|
// this.$refs.deviceTypeCascader.getCheckedNodes(),
|
||||||
[this.$refs.deviceTypeCascader.panel.getNodeByValue(val)],
|
// [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)],
|
||||||
)
|
// )
|
||||||
nodes =
|
// nodes =
|
||||||
this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
|
// this.$refs.deviceTypeCascader.getCheckedNodes().length > 0
|
||||||
? this.$refs.deviceTypeCascader.getCheckedNodes()
|
// ? this.$refs.deviceTypeCascader.getCheckedNodes()
|
||||||
: [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
|
// : [this.$refs.deviceTypeCascader.panel.getNodeByValue(val)]
|
||||||
console.log('nodes', nodes)
|
// console.log('nodes', nodes)
|
||||||
// const res = await getUseNumByTypeId({ typeId: nodes[0].data.typeId })
|
// // const res = await getUseNumByTypeId({ typeId: nodes[0].data.typeId })
|
||||||
nodes[0].data.useNum = nodes[0].data.num
|
// nodes[0].data.useNum = nodes[0].data.num
|
||||||
if (nodes[0].level != 4) {
|
// if (nodes[0].level != 4) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if (nodes[0].data.useNum < 1) {
|
// if (nodes[0].data.useNum < 1) {
|
||||||
this.$modal.msgError('所选机具类型当前无在用!')
|
// this.$modal.msgError('所选机具类型当前无在用!')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
for (let i = 0; i < this.leaseApplyDetails.length; i++) {
|
// for (let i = 0; i < this.leaseApplyDetails.length; i++) {
|
||||||
if (this.leaseApplyDetails[i].typeId == nodes[0].data.typeId) {
|
// if (this.leaseApplyDetails[i].typeId == nodes[0].data.typeId) {
|
||||||
this.leaseApplyDetails.splice(i, 1)
|
// this.leaseApplyDetails.splice(i, 1)
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
this.leaseApplyDetails.push(this.handelTableItemData(nodes[0]))
|
// this.leaseApplyDetails.push(this.handelTableItemData(nodes[0]))
|
||||||
// this.$refs.cascader.$refs.panel.clearCheckedNodes()
|
// this.$refs.cascader.$refs.panel.clearCheckedNodes()
|
||||||
// // 设置为空可以让节点不高亮显示
|
// // 设置为空可以让节点不高亮显示
|
||||||
// this.$refs.cascader.$refs.panel.activePath = []
|
// this.$refs.cascader.$refs.panel.activePath = []
|
||||||
this.deviceType = {}
|
// this.deviceType = {}
|
||||||
|
|
||||||
|
const deviceTypeList =
|
||||||
|
this.$refs.deviceTypeCascader.getCheckedNodes()
|
||||||
|
|
||||||
|
// if (val.length > 0) {
|
||||||
|
// for (let i in val) {
|
||||||
|
// console.log(val[i], '----+++')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
let tempList = []
|
||||||
|
if (val.length > 0) {
|
||||||
|
const items = val.map((e) => {
|
||||||
|
return e[3]
|
||||||
|
})
|
||||||
|
for (let i in items) {
|
||||||
|
for (let z in deviceTypeList) {
|
||||||
|
if (deviceTypeList[z].data.typeId === items[i]) {
|
||||||
|
let { num, companyId, typeId, unitNames } =
|
||||||
|
deviceTypeList[z].data
|
||||||
|
tempList.push({
|
||||||
|
createBy: this.createBy,
|
||||||
|
typeId,
|
||||||
|
preNum: num,
|
||||||
|
num,
|
||||||
|
companyId,
|
||||||
|
unitNames,
|
||||||
|
useNum: num,
|
||||||
|
typeName: deviceTypeList[z].pathLabels[2],
|
||||||
|
typeCode: deviceTypeList[z].pathLabels[3],
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.leaseApplyDetails = [...new Set(tempList)]
|
||||||
},
|
},
|
||||||
//// 将数据处理成 表格中需要的数据
|
//// 将数据处理成 表格中需要的数据
|
||||||
handelTableItemData(node) {
|
handelTableItemData(node) {
|
||||||
|
|
@ -921,3 +1003,15 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</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>
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,12 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="退料接收时间"
|
||||||
|
align="center"
|
||||||
|
prop="backReceiveTime"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="操作"
|
label="操作"
|
||||||
align="center"
|
align="center"
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="规格型号" prop="equipmentId">
|
<el-form-item label="规格型号" prop="equipmentId">
|
||||||
<treeselect
|
<!-- <treeselect
|
||||||
v-model="queryParams.equipmentId"
|
v-model="queryParams.equipmentId"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:options="equipmentTypeList"
|
:options="equipmentTypeList"
|
||||||
|
|
@ -63,7 +63,21 @@
|
||||||
noChildrenText="没有数据了"
|
noChildrenText="没有数据了"
|
||||||
noOptionsText="没有数据"
|
noOptionsText="没有数据"
|
||||||
noResultsText="没有搜索结果"
|
noResultsText="没有搜索结果"
|
||||||
/>
|
/> -->
|
||||||
|
<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-form-item label="采购日期" prop="purchaseTime">
|
<el-form-item label="采购日期" prop="purchaseTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
|
@ -130,25 +144,29 @@
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="序号" type="index" width="55" />
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="序号"
|
||||||
|
type="index"
|
||||||
|
width="55"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
label="机具名称"
|
label="机具名称"
|
||||||
prop="machineTypeName"
|
prop="machineTypeName"
|
||||||
:show-overflow-tooltip="true"
|
show-overflow-tooltip
|
||||||
width="200"
|
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
align="center"
|
||||||
label="规格型号"
|
label="规格型号"
|
||||||
prop="specificationType"
|
prop="specificationType"
|
||||||
:show-overflow-tooltip="true"
|
show-overflow-tooltip
|
||||||
width="200"
|
|
||||||
/>
|
/>
|
||||||
<el-table-column label="单位" prop="unitName" width="100" />
|
<el-table-column align="center" label="单位" prop="unitName" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="购置单价(元)"
|
label="购置单价(元)"
|
||||||
prop="purchasePrice"
|
prop="purchasePrice"
|
||||||
align="center"
|
align="center"
|
||||||
width="150"
|
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
|
|
@ -160,9 +178,9 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
align="center"
|
||||||
label="采购数量"
|
label="采购数量"
|
||||||
prop="purchaseNum"
|
prop="purchaseNum"
|
||||||
width="150"
|
|
||||||
type="number"
|
type="number"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
>
|
>
|
||||||
|
|
@ -175,14 +193,18 @@
|
||||||
></el-input-number>
|
></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="机具厂家" prop="supplierId" width="200">
|
<el-table-column
|
||||||
|
label="机具厂家"
|
||||||
|
prop="supplierId"
|
||||||
|
align="center"
|
||||||
|
width="200"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="scope.row.supplierId"
|
v-model="scope.row.supplierId"
|
||||||
placeholder="机具厂家"
|
placeholder="机具厂家"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
style="width: 180px"
|
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in supplierList"
|
v-for="item in supplierList"
|
||||||
|
|
@ -202,15 +224,16 @@
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="scope.row.productionTime"
|
v-model="scope.row.productionTime"
|
||||||
style="width: 180px"
|
style="width: 100%"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
type="date"
|
type="date"
|
||||||
range-separator="-"
|
range-separator="-"
|
||||||
placeholder="出厂日期"
|
placeholder="出厂日期"
|
||||||
|
clearable
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="150">
|
<el-table-column label="操作" align="center">
|
||||||
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
|
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
@ -384,6 +407,15 @@ export default {
|
||||||
// { required: true, message: "采购员不能为空", trigger: "blur" }
|
// { required: true, message: "采购员不能为空", trigger: "blur" }
|
||||||
// ]
|
// ]
|
||||||
},
|
},
|
||||||
|
deviceTypeTreeProps: {
|
||||||
|
children: 'children',
|
||||||
|
label: 'typeName',
|
||||||
|
// multiple: false,
|
||||||
|
value: 'typeId',
|
||||||
|
multiple: true,
|
||||||
|
},
|
||||||
|
deviceType: [],
|
||||||
|
propsKey: 1000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -464,8 +496,17 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let selectList = []
|
||||||
|
this.equipmentList.forEach((e) => {
|
||||||
|
selectList.push(
|
||||||
|
this.getParentsById(this.equipmentTypeList, e.typeId),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
this.deviceType = selectList
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//添加机具类型
|
//添加机具类型
|
||||||
select(row) {
|
select(row) {
|
||||||
console.log(row)
|
console.log(row)
|
||||||
|
|
@ -519,10 +560,28 @@ export default {
|
||||||
this.maForm.remark = response.data.remark
|
this.maForm.remark = response.data.remark
|
||||||
this.maForm.purchaseNumber = response.data.purchaseNumber
|
this.maForm.purchaseNumber = response.data.purchaseNumber
|
||||||
this.equipmentList = response.data.checkDetailsList
|
this.equipmentList = response.data.checkDetailsList
|
||||||
|
|
||||||
// this.loading = false;
|
// 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() {
|
getList() {
|
||||||
// this.loading = true;
|
// this.loading = true;
|
||||||
|
|
@ -676,10 +735,16 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
console.log(row.id)
|
// console.log(row.id)
|
||||||
this.$modal
|
this.$modal
|
||||||
.confirm('是否确认删除所选择的数据项?')
|
.confirm('是否确认删除所选择的数据项?')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
this.deviceType.forEach((e, index) => {
|
||||||
|
if (e[3] === row.typeId) {
|
||||||
|
this.deviceType.splice(index, 1)
|
||||||
|
this.propsKey++
|
||||||
|
}
|
||||||
|
})
|
||||||
this.equipmentList.forEach((item, index) => {
|
this.equipmentList.forEach((item, index) => {
|
||||||
if (item.id == row.id) {
|
if (item.id == row.id) {
|
||||||
this.equipmentList.splice(index, 1)
|
this.equipmentList.splice(index, 1)
|
||||||
|
|
@ -702,20 +767,73 @@ export default {
|
||||||
// ...this.queryParams
|
// ...this.queryParams
|
||||||
// }, `role_${new Date().getTime()}.xlsx`)
|
// }, `role_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
|
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 in items) {
|
||||||
|
for (let z in deviceTypeList) {
|
||||||
|
if (deviceTypeList[z].data.typeId === items[i]) {
|
||||||
|
this.$set(deviceTypeList[z].data, 'supplierId', '')
|
||||||
|
this.$set(
|
||||||
|
deviceTypeList[z].data,
|
||||||
|
'createTime',
|
||||||
|
null,
|
||||||
|
)
|
||||||
|
this.$set(
|
||||||
|
deviceTypeList[z].data,
|
||||||
|
'productionTime',
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
this.$set(
|
||||||
|
deviceTypeList[z].data,
|
||||||
|
'purchasePrice',
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
this.$set(deviceTypeList[z].data, 'purchaseNum', 1)
|
||||||
|
|
||||||
|
tempList.push(deviceTypeList[z].data)
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.equipmentList = [...new Set(tempList)]
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</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 {
|
||||||
width: 60px !important;
|
// width: 60px !important;
|
||||||
margin-bottom: 10px;
|
// margin-bottom: 10px;
|
||||||
}
|
// }
|
||||||
|
|
||||||
::v-deep input::-webkit-inner-spin-button {
|
// ::v-deep input::-webkit-inner-spin-button {
|
||||||
-webkit-appearance: none !important;
|
// -webkit-appearance: none !important;
|
||||||
}
|
// }
|
||||||
|
|
||||||
::v-deep input[type='number'] {
|
// ::v-deep input[type='number'] {
|
||||||
-moz-appearance: textfield !important;
|
// -moz-appearance: textfield !important;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<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>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
v-if="scope.row.purchasingId == 25"
|
v-if="scope.row.purchasingId === 24"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['newPurchase:tools:del']"
|
v-hasPermi="['newPurchase:tools:del']"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
>
|
>
|
||||||
<i class="el-icon-plus avatar-uploader-icon"></i>
|
<i class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
<div class="el-upload__tip" slot="tip"
|
<div class="el-upload__tip" slot="tip"
|
||||||
>请上传png、jpg、jpeg类型文件,文件个数不能超过
|
>请上传png、jpg、jpeg类型图片,图片总数不能超过
|
||||||
{{ limit }} 个,且单个文件不能超过5M</div
|
{{ limit }} 个,且单张图片不能超过5M</div
|
||||||
>
|
>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -55,7 +55,7 @@ export default {
|
||||||
this.$emit('success', response, file)
|
this.$emit('success', response, file)
|
||||||
},
|
},
|
||||||
handleExceed() {
|
handleExceed() {
|
||||||
this.$message.error(`最多只能上传${this.limit}个文件!`)
|
this.$message.error(`最多只能上传${this.limit}个图片!`)
|
||||||
},
|
},
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
const isJPGorPNG =
|
const isJPGorPNG =
|
||||||
|
|
@ -64,10 +64,10 @@ export default {
|
||||||
file.type == 'image/jpeg'
|
file.type == 'image/jpeg'
|
||||||
const isLt5M = file.size / 1024 / 1024 < 5 // 小于 5MB
|
const isLt5M = file.size / 1024 / 1024 < 5 // 小于 5MB
|
||||||
if (!isJPGorPNG) {
|
if (!isJPGorPNG) {
|
||||||
this.$message.error('只能上传 jpg、jpeg、png 、 格式的文件!')
|
this.$message.error('只能上传 jpg、jpeg、png 、 格式的图片!')
|
||||||
}
|
}
|
||||||
if (!isLt5M) {
|
if (!isLt5M) {
|
||||||
this.$message.error('上传图片大小不能超过 5MB')
|
this.$message.error('上传的图片大小不能超过 5MB')
|
||||||
}
|
}
|
||||||
return isJPGorPNG && isLt5M
|
return isJPGorPNG && isLt5M
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,10 @@
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="入库人员"
|
label="入库人员"
|
||||||
align="center"
|
align="center"
|
||||||
prop="updateBy"
|
prop="inputUser"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
label="入库时间"
|
label="入库时间"
|
||||||
align="center"
|
align="center"
|
||||||
prop="updateTime"
|
prop="updateTime"
|
||||||
|
|
@ -127,7 +127,7 @@
|
||||||
align="center"
|
align="center"
|
||||||
prop="createTime"
|
prop="createTime"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
/>
|
/> -->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="备注"
|
label="备注"
|
||||||
align="center"
|
align="center"
|
||||||
|
|
@ -336,6 +336,12 @@
|
||||||
<span v-if="scope.row.manageType == '1'">数量管理</span>
|
<span v-if="scope.row.manageType == '1'">数量管理</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="入库时间"
|
||||||
|
align="center"
|
||||||
|
prop="inputTime"
|
||||||
|
show-overflow-tooltip
|
||||||
|
/>
|
||||||
<!-- <el-table-column label="不通过原因" align="center" prop="remark" show-overflow-tooltip /> -->
|
<!-- <el-table-column label="不通过原因" align="center" prop="remark" show-overflow-tooltip /> -->
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue