Commit 39c34b0e authored by shifangwuji's avatar shifangwuji

9/21

parent 41ae2365
...@@ -9,7 +9,7 @@ export function queryList(params) { ...@@ -9,7 +9,7 @@ export function queryList(params) {
}) })
} }
// 保存接口 // 保存接口
export function add(data) { export function addApplication(data) {
return request({ return request({
url: '/ysgxlog/add', url: '/ysgxlog/add',
method: 'post', method: 'post',
...@@ -21,8 +21,8 @@ export function add(data) { ...@@ -21,8 +21,8 @@ export function add(data) {
} }
// 编辑基础信息接口 // 解锁接口
export function updataInfo(data) { export function unlockUser(data) {
return request({ return request({
url: '/ysgxlog/unlock', url: '/ysgxlog/unlock',
method: 'put', method: 'put',
......
...@@ -5,14 +5,31 @@ ...@@ -5,14 +5,31 @@
<el-row :gutter="40"> <el-row :gutter="40">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="pn:" style="flex-basis: 50%;" prop="pn"> <el-form-item label="pn:" style="flex-basis: 50%;" prop="pn">
<el-input ref="input1" v-model="form.pn" placeholder="请输入pn" :minlength="3" style="width: 400px" :maxlength="100" @keyup.enter.native="handleQuery" /> <el-input
ref="input1"
v-model="form.pn"
placeholder="请输入pn"
:minlength="3"
style="width: 400px"
:maxlength="100"
:disabled="lockUserEnabled"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="40"> <el-row :gutter="40">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="lot:" style="flex-basis: 50%;" prop="lot"> <el-form-item label="lot:" style="flex-basis: 50%;" prop="lot">
<el-input ref="input2" v-model="form.lot" placeholder="请输入lot" style="width: 400px" :maxlength="100" @keyup.enter.native="handleQuery" /> <el-input
ref="input2"
v-model="form.lot"
placeholder="请输入lot"
style="width: 400px"
:maxlength="100"
:disabled="lockUserEnabled"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -25,6 +42,7 @@ ...@@ -25,6 +42,7 @@
placeholder="请选择gx" placeholder="请选择gx"
style="width: 100%; max-width: 400px;" style="width: 100%; max-width: 400px;"
@change="handlePgxChange" @change="handlePgxChange"
:disabled="lockUserEnabled"
> >
<el-option <el-option
v-for="(dict, index) in pissbList" v-for="(dict, index) in pissbList"
...@@ -38,10 +56,20 @@ ...@@ -38,10 +56,20 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="machine:" prop="machine"> <el-form-item label="machine:" prop="machine">
<el-input ref="input4" v-model="form.machine" placeholder="请输入machine" style="width: 100%; max-width: 400px;" :maxlength="10" @keyup.enter.native="handleQuery" /> <el-input
ref="input4"
v-model="form.machine"
placeholder="请输入machine"
style="width: 100%; max-width: 400px;"
:maxlength="10"
:disabled="lockUserEnabled"
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item> <el-form-item>
<el-button type="primary" style="padding: 8px 16px;" size="small" @click="handleQuery">查询</el-button> <el-button type="primary" style="padding: 8px 16px;" size="small" @click="handleQuery">查询</el-button>
...@@ -197,8 +225,28 @@ ...@@ -197,8 +225,28 @@
<el-row style="padding-left; padding-top: 1%"> <el-row style="padding-left; padding-top: 1%">
<el-col :span="12"> <el-col :span="12">
<el-form-item style="flex-basis: 50%;"> <el-form-item style="flex-basis: 50%;">
<el-button type="primary" @click="submitForm">保存</el-button> <el-button
<el-button @click="resetQuery">清空</el-button> v-if="!unlockButtonVisible"
type="primary"
@click="submitForm"
>
保存
</el-button>
<el-button
v-if="!unlockButtonVisible"
@click="resetQuery"
>
清空
</el-button>
<el-button
v-if="unlockButtonVisible"
type="warning"
@click="unlockQuery"
>
解锁
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -208,7 +256,7 @@ ...@@ -208,7 +256,7 @@
</template> </template>
<script> <script>
import { getDictData, addApplication, queryList } from '@/api/production/gfual' import { getDictData, addApplication, queryList,unlockUser } from '@/api/production/gfual'
import { MessageBox } from 'element-ui' import { MessageBox } from 'element-ui'
export default { export default {
...@@ -221,6 +269,7 @@ export default { ...@@ -221,6 +269,7 @@ export default {
jlcodEnabled: false, jlcodEnabled: false,
lockUserEnabled: false, lockUserEnabled: false,
isRequired: false, isRequired: false,
unlockButtonVisible: false,
// 对应后端配置文件cy.init.pgxList的的内容 // 对应后端配置文件cy.init.pgxList的的内容
phdList: ['003'], phdList: ['003'],
// 判断是否存在缓存 // 判断是否存在缓存
...@@ -277,10 +326,25 @@ export default { ...@@ -277,10 +326,25 @@ export default {
const parts = newJlcod.split(',') const parts = newJlcod.split(',')
this.form.jltype = parts[0] || '' this.form.jltype = parts[0] || ''
this.form.jllot = parts[1] || '' this.form.jllot = parts[1] || ''
this.form.jlbzq = parts[2] || ''
// 验证并格式化 jlbzq
const jlbzqPart = parts[2] || ''
const jlbzqRegex = /^\d{4}-\d{2}-\d{2}$/ // 正则表达式用于验证 'yyyy-mm-dd' 格式
if (jlbzqRegex.test(jlbzqPart)) {
this.form.jlbzq = jlbzqPart
} else {
// 如果不符合规范,可以设置一个默认值或者给出错误提示
this.form.jlbzq = '' // 或者设置一个默认值
// 或者显示错误提示
MessageBox.alert('jlcod 中的 jlbzq 不符合规范,请输入有效的日期格式(yyyy-mm-dd)', '错误', {
confirmButtonText: '确定',
type: 'error'
})
}
}, },
immediate: true // 立即执行一次以处理初始值 immediate: true // 立即执行一次以处理初始值
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -330,46 +394,50 @@ export default { ...@@ -330,46 +394,50 @@ export default {
console.log('data', response.data) console.log('data', response.data)
if (response.data.jbcode !== null) { if (response.data.jbcode !== null) {
this.jbcodeEnabled = true this.jbcodeEnabled = true
this.form.jbcode = ''
this.form.wbcode = ''
this.form.wblot = ''
this.form.jlcod = ''
this.form.lockUser = ''
} }
if (response.data.wb !== null) { if (response.data.wb !== null) {
this.wbcodeEnabled = true this.wbcodeEnabled = true
this.wblotEnabled = true this.wblotEnabled = true
this.form.jbcode = ''
this.form.wbcode = ''
this.form.wblot = ''
this.form.jlcod = ''
this.form.lockUser = ''
} }
if (response.data.jl !== null) { if (response.data.jl !== null) {
this.jlcodEnabled = true this.jlcodEnabled = true
this.form.jbcode = ''
this.form.wbcode = ''
this.form.wblot = ''
this.form.jlcod = ''
this.form.lockUser = ''
} }
if (response.data.jbcode === null && response.data.wb === null && response.data.jl === null) { if (response.data.jbcode === "" && response.data.wb === "" && response.data.jl === "") {
// 所有输入框都锁定,报错 // 所有输入框都锁定,报错
this.jbcodeEnabled = false this.jbcodeEnabled = false
this.wbcodeEnabled = false this.wbcodeEnabled = false
this.wblotEnabled = false this.wblotEnabled = false
this.jlcodEnabled = false this.jlcodEnabled = false
this.lockUserEnabled = true this.lockUserEnabled = true
this.unlockButtonVisible = true;
this.form.jbcode = '' this.form.jbcode = ''
this.form.wbcode = '' this.form.wbcode = ''
this.form.wblot = '' this.form.wblot = ''
this.form.jlcod = '' this.form.jlcod = ''
this.form.lockUser = '' MessageBox.alert('jbcode,wb,jl内容均为空,查询无效,请解锁后重新查询', '错误', {
MessageBox.alert('jbcode,wb,jl内容均为空,查询无效,请重新查询', '错误', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error' type: 'error'
}) })
} }
} else if (response.code === 400) {
console.log('Setting lockUserEnabled to true');
// 查询失败时,将所有输入框锁定并显示错误提示
this.jbcodeEnabled = false;
this.wbcodeEnabled = false;
this.wblotEnabled = false;
this.jlcodEnabled = false;
this.lockUserEnabled = true;
this.form.jbcode = '';
this.form.wbcode = '';
this.form.wblot = '';
this.form.jlcod = '';
this.form.lockUser = '';
MessageBox.alert('查询错误', '错误', {
confirmButtonText: '确定',
type: 'error',
});
} }
}) })
} }
...@@ -379,6 +447,44 @@ export default { ...@@ -379,6 +447,44 @@ export default {
// 执行下一步操作的逻辑 // 执行下一步操作的逻辑
}, },
unlockQuery() {
// 先触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
// 向后端发送解锁请求,并将 lockUser 的值传递过去
unlockUser({
lockUser: this.form.lockUser
})
.then(response => {
if (response.code === 200) {
// 解锁成功,恢复页面状态
this.jbcodeEnabled = false;
this.wbcodeEnabled = false;
this.wblotEnabled = false;
this.jlcodEnabled = false;
this.lockUserEnabled = false;
this.form.jbcode = '';
this.form.wbcode = '';
this.form.wblot = '';
this.form.jlcod = '';
this.form.lockUser = '';
// 显示成功提示
MessageBox.alert('解锁成功', '成功', {
confirmButtonText: '确定',
type: 'success'
});
} else {
// 解锁失败,显示解锁失败的弹出框
MessageBox.alert(response.data.message, '解锁失败', {
confirmButtonText: '确定',
type: 'error'
});
}
});
}
});
},
/** 查询基础信息列表 */ /** 查询基础信息列表 */
getList() { getList() {
this.loading = true this.loading = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment