<template>
|
<el-dialog
|
:title="!dataForm.id ? '新增' : '修改'"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
>
|
<el-row type="flex" justify="space-between"
|
><el-col :span="15">
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
class="l-mes"
|
label-width="80px"
|
>
|
<el-form-item label="工作站" prop="workstationName">
|
<el-input
|
class="innerClass"
|
v-model="dataForm.workstationName"
|
placeholder="请选择工作站"
|
readonly
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="产出" prop="productNo">
|
<el-input
|
class="innerClass"
|
v-model="dataForm.productNo"
|
placeholder="请选择产出"
|
readonly
|
>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="异常类型" prop="exceptionType">
|
<el-select
|
v-model="dataForm.exceptionType"
|
style="width:100%;"
|
placeholder="异常类型"
|
disabled
|
>
|
<el-option
|
v-for="item in exceptionHandleTypeOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="异常描述" prop="exceptionDescription">
|
<el-input
|
type="textarea"
|
:rows="2"
|
v-model="dataForm.exceptionDescription"
|
placeholder="异常描述"
|
disabled
|
></el-input>
|
</el-form-item>
|
<el-form-item label="微信通知组" prop="notifierGroupId">
|
<el-select
|
v-model="dataForm.notifierGroupId"
|
style="width:100%;"
|
placeholder="微信通知组"
|
disabled
|
>
|
<el-option
|
v-for="item in wxNoticeOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="备注" prop="remark">
|
<el-input
|
type="textarea"
|
:rows="2"
|
v-model="dataForm.remark"
|
placeholder="备注"
|
disabled
|
></el-input>
|
</el-form-item>
|
<el-form-item label="处理方案" prop="handleWay">
|
<el-input
|
type="textarea"
|
:rows="2"
|
v-model="dataForm.handleWay"
|
placeholder="处理方案"
|
:disabled="!isShow"
|
></el-input>
|
</el-form-item>
|
</el-form> </el-col
|
><el-col :span="8">
|
<div>
|
<div v-for="(ele, index) in urlList" :key="index">
|
<el-image
|
:src="ele.url"
|
fit="fill"
|
:preview-src-list="[ele.url]"
|
></el-image>
|
</div>
|
</div> </el-col
|
></el-row>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button
|
v-if="isShow"
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>提交</el-button
|
>
|
</span>
|
<workstation-dialog
|
:currshowlist.sync="workstationVisible"
|
@listenToWorkStationEvent="selectWorkstation"
|
/>
|
<productout-dialog
|
:currshowlist.sync="productoutVisible"
|
:paramObj="paramObj"
|
@listenToproductionEvent="selectProductout"
|
/>
|
</el-dialog>
|
</template>
|
|
<script>
|
import { getObj, putObj } from '@/api/quality/exception'
|
import { fetchList } from '@/api/quality/wxnotice'
|
import workstationDialog from '@/views/common/workstation.vue'
|
import productoutDialog from '@/views/common/productout.vue'
|
import { getStore } from '../../../util/store'
|
import { remote } from '@/api/admin/dict'
|
|
export default {
|
components: { workstationDialog, productoutDialog },
|
data() {
|
return {
|
paramObj: {},
|
productoutVisible: false,
|
workstationVisible: false,
|
visible: false,
|
dataForm: {
|
id: 0,
|
code: '',
|
workstationId: 0,
|
productoutId: 0,
|
exceptionType: '',
|
exceptionDescription: '',
|
handleWay: '',
|
handleUser: '',
|
createTime: '',
|
remark: '',
|
workstationName: '',
|
productNo: '',
|
notifierGroupId: null,
|
processStatus: ''
|
},
|
dataRule: {},
|
isSubmit: false,
|
headers: {
|
Authorization: 'Bearer ' + getStore({ name: 'access_token' })
|
},
|
postData: {},
|
fileList: [],
|
exceptionHandleTypeOptions: [],
|
wxNoticeOptions: [],
|
urlList: [],
|
isShow: false
|
}
|
},
|
created() {
|
this.getExceptionHandleType()
|
this.getWxNoticeList()
|
},
|
methods: {
|
init(id, editType) {
|
this.isShow = editType
|
this.dataForm.workstationId = 0
|
this.dataForm.productoutId = 0
|
this.dataForm.id = id || 0
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs.dataForm.resetFields()
|
if (this.dataForm.id) {
|
getObj(this.dataForm.id).then((response) => {
|
this.dataForm = response.data.data
|
this.urlList = response.data.data.urlList
|
})
|
}
|
})
|
},
|
// 弹出工作站
|
openWorkstationDialog() {
|
this.workstationVisible = true
|
},
|
selectWorkstation(workstation) {
|
if (workstation) {
|
this.dataForm.workstationId = workstation.id
|
this.paramObj = { workstationId: workstation.id }
|
this.dataForm.workstationName = workstation.name
|
}
|
},
|
openProductoutDialog() {
|
if (this.dataForm.workstationId) {
|
this.productoutVisible = true
|
} else {
|
this.$message.error('请先选择工作站')
|
}
|
},
|
selectProductout(productout) {
|
if (productout) {
|
this.dataForm.productoutId = productout.id
|
this.dataForm.productNo = productout.productNo
|
}
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
const submitForm = {
|
id: this.dataForm.id,
|
handleWay: this.dataForm.handleWay,
|
processStatus: 1
|
}
|
putObj(submitForm).then((data) => {
|
this.$message.success('提交成功')
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
},
|
getExceptionHandleType() {
|
remote('exception_handle_type').then((response) => {
|
if (response.data.code === 0) {
|
this.exceptionHandleTypeOptions = response.data.data
|
} else {
|
this.exceptionHandleTypeOptions = []
|
}
|
})
|
},
|
getWxNoticeList() {
|
this.wxNoticeOptions = []
|
fetchList({ current: 1, size: 1000 }).then((response) => {
|
const resRecords = response.data.data.records
|
resRecords.forEach((ele) => {
|
this.wxNoticeOptions.push({
|
value: ele.id,
|
label: ele.groupName
|
})
|
})
|
})
|
}
|
}
|
}
|
</script>
|