| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541 |
- <!-- 用户编辑弹窗 -->
- <template>
- <el-dialog
- class="ele-dialog-form"
- :title="title"
- :visible.sync="visible"
- :before-close="handleClose"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- width="1200px"
- >
- <el-form ref="form" :model="form" :rules="rules" label-width="100px">
- <el-row>
- <el-col :span="8" v-if="title != '新增'">
- <el-form-item label="编码:">
- <el-input :maxlength="20" v-model="form.code" disabled />
- </el-form-item>
- </el-col>
- <el-col :span="8" v-if="title != '新增'">
- <el-form-item label="工单号:">
- <el-input :maxlength="20" v-model="form.workOrderCode" disabled />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="类型:" prop="qualityType">
- <DictSelection
- dictName="质检计划类型"
- v-if="title != '详情'"
- v-model="form.qualityType"
- ></DictSelection>
- <el-input
- :value="getDictValue('质检计划类型', form.qualityType)"
- disabled
- v-if="title == '详情'"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="取样类型:" prop="qualityMode">
- <DictSelection
- dictName="取样类型"
- v-model="form.qualityMode"
- clearable
- v-if="title != '详情'"
- ></DictSelection>
- <el-input
- :value="getDictValue('取样类型', form.qualityMode)"
- disabled
- v-if="title == '详情'"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="工艺路线:">
- <el-input
- @click.native="openVersion"
- clearable
- v-model="form.produceRoutingName"
- v-if="title != '详情'"
- />
- <el-input
- v-model="form.produceRoutingName"
- disabled
- v-if="title == '详情'"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="工序:" v-if="!form.qualityPlanId">
- <el-select
- style="width: 100%"
- v-model="form.produceTaskId"
- placeholder="请选择"
- clearable
- @change="produceTaskChange"
- v-if="title != '详情'"
- >
- <el-option
- v-for="item in produceTaskList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-input
- v-model="form.produceTaskName"
- disabled
- v-if="title == '详情'"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="产品名称:" prop="productName">
- <el-input
- v-model="form.productName"
- @click.native="addProduct"
- readonly
- v-if="title == '新增'"
- />
- <el-input
- v-model="form.productName"
- disabled
- v-if="title != '新增'"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="总数量:">
- <el-input v-model="form.total" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="合格数:" prop="qualifiedNumber">
- <el-input
- v-model="form.qualifiedNumber"
- @input="inputValue"
- :disabled="title == '详情'"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="不合格数:" prop="noQualifiedNumber">
- <el-input
- v-model="form.noQualifiedNumber"
- @input="inputValue"
- :disabled="title == '详情'"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="工时(h):" prop="hours">
- <el-input
- v-model="form.hours"
- :disabled="title == '详情'"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质检时间:" prop="qualityTime">
- <el-date-picker
- class="w100"
- v-model="form.qualityTime"
- type="date"
- value-format="yyyy-MM-dd"
- :disabled="title == '详情'"
- ></el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质检部门" prop="groupId">
- <deptSelect
- :disabled="title == '详情'"
- v-model="form.groupId"
- @changeGroup="searchDeptNodeClick"
- />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="质检人" prop="qualityId">
- <el-select
- :disabled="title == '详情'"
- v-model="form.qualityId"
- @change="changeExecutor"
- size="small"
- style="width: 100%"
- filterable
- >
- <el-option
- v-for="item in executorList"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="附件:" prop="accessory">
- <fileUpload
- v-model="form.accessory"
- module="main"
- :showLib="false"
- :limit="1"
- :disabled="title == '详情'"
- />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="title" v-if="title != '新增'">质检内容</div>
- <el-tabs
- v-model="tabTaskId"
- class="tab-box"
- type="border-card"
- >
- <el-tab-pane
- v-for="(item, index) in form.categoryParamList"
- :label="item.name"
- :name="item.id"
- :key="index"
- >
- <term
- :qualityParam="item.qualityParam"
- :isDetails="title == '详情'"
- ref="qualityParamRef"
- ></term>
- </el-tab-pane>
- </el-tabs>
- <div class="title" v-if="title != '新增'">不良品列表</div>
- <el-table :data="form.voList" border v-if="title != '新增'" height="25vh">
- <el-table-column label="序号" align="center" width="60">
- <template slot-scope="scope">
- <span>{{ scope.$index + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="不良品编码" align="center" prop="code">
- </el-table-column>
- <el-table-column label="数量" align="center" prop="unqualifiedQuantity">
- </el-table-column>
- <el-table-column label="原因" align="center" prop="unqualifiedReason">
- </el-table-column>
- <el-table-column label="创建时间" align="center" prop="createTime">
- </el-table-column>
- <el-table-column label="创建人" align="center" prop="reviewerName">
- </el-table-column>
- <el-table-column label="处置类型" align="center" prop="type">
- <template slot-scope="scope">
- {{ getDictValue('不良品处理类型', scope.row.type + '') }}
- </template>
- </el-table-column>
- </el-table>
- <template v-slot:footer>
- <el-button @click="handleClose">返回</el-button>
- <el-button
- type="primary"
- :loading="loading"
- @click="update"
- v-if="title == '报工'"
- >
- 报工
- </el-button>
- <el-button
- type="primary"
- :loading="loading"
- @click="save"
- v-if="title == '新增'"
- >
- 保存
- </el-button>
- </template>
- <ProductionVersion ref="versionRefs" @changeProduct="changeProduct" />
- <EquipmentDialog ref="equipmentRefs" @choose="choose" />
- </el-dialog>
- </template>
- <script>
- import { save, update, getById } from '@/api/inspectionWork';
- import { getProduceTaskList } from '@/api/aps';
- import EquipmentDialog from './EquipmentDialog.vue';
- import ProductionVersion from './ProductionVersion.vue';
- import dictMixins from '@/mixins/dictMixins';
- import deptSelect from '@/components/CommomSelect/dept-select.vue';
- import { getUserPage } from '@/api/system/organization';
- import fileUpload from '@/components/upload/fileUpload';
- import term from './term';
- export default {
- components: {
- ProductionVersion,
- EquipmentDialog,
- deptSelect,
- fileUpload,
- term
- },
- mixins: [dictMixins],
- data() {
- const defaultForm = function () {
- return {
- produceRoutingName: '',
- produceRoutingId: '',
- produceTaskId: '',
- produceTaskName: '',
- code: '',
- workOrderCode: '',
- batchNo: '',
- productName: '',
- productCode: '',
- specification: '',
- brandNo: '',
- qualityType: '',
- total: '',
- qualifiedNumber: '',
- noQualifiedNumber: '',
- hours: '',
- qualityTime: '',
- qualityName: '',
- qualityId: '',
- voList: [],
- groupId: '',
- groupName: '',
- id: '',
- accessory: [],
- qualityMode: ''
- };
- };
- return {
- defaultForm,
- // 表单数据
- form: { ...defaultForm() },
- // 表单验证规则
- rules: {
- productName: [
- { required: true, message: '请输入', trigger: 'change' }
- ],
- qualifiedNumber: [
- { required: true, message: '请输入', trigger: 'blur' }
- ],
- noQualifiedNumber: [
- { required: true, message: '请输入', trigger: 'blur' }
- ],
- qualityTime: [{ required: true, message: '请输入', trigger: 'blur' }],
- groupId: [{ required: true, message: '请输入', trigger: 'change' }],
- qualityId: [{ required: true, message: '请输入', trigger: 'change' }]
- },
- visible: false,
- type: null,
- title: null,
- loading: false,
- produceTaskList: [],
- executorList: '',
- tabTaskId: null
- };
- },
- created() {},
- methods: {
- open(type, row) {
- this.title = type == 'add' ? '新增' : type == 'edit' ? '报工' : '详情';
- this.type = type;
- if (this.type == 'detail') {
- row.accessory = row.accessory || [];
- this.form = JSON.parse(JSON.stringify(row));
- this.tabTaskId =
- this.form.categoryParamList[0] && this.form.categoryParamList[0].id;
- if (this.form.groupId) {
- this.getUserList({ groupId: this.form.groupId });
- }
- this.getProduceTaskList();
- } else if (type == 'edit') {
- getById(row.id).then((res) => {
- row.accessory = row.accessory || [];
- this.form = res.data;
- this.tabTaskId =
- this.form.categoryParamList[0] &&
- this.form.categoryParamList[0].id;
- if (this.form.groupId) {
- this.getUserList({ groupId: this.form.groupId });
- }
- this.getProduceTaskList();
- });
- }
- this.visible = true;
- },
- inputValue() {
- if(!this.form.qualityPlanId) {
- this.form.total =
- Number(this.form.qualifiedNumber) +
- Number(this.form.noQualifiedNumber);
- }
-
- },
- addProduct() {
- this.$refs.equipmentRefs.open();
- },
- openVersion() {
- this.$refs.versionRefs.open();
- },
- //工艺路线回调
- changeProduct(data) {
- this.form.produceRoutingId = data.id;
- this.form.produceRoutingName = data.name;
- this.form.produceTaskId = '';
- this.form.produceTaskName = '';
- this.getProduceTaskList();
- },
- async getProduceTaskList() {
- if (!this.form.produceRoutingId) {
- return;
- }
- const res = await getProduceTaskList({
- isDetail: true,
- pageNum: 1,
- routingId: this.form.produceRoutingId,
- size: -1
- });
- this.produceTaskList = res.list;
- },
- produceTaskChange() {
- if (!this.form.produceTaskId) {
- return;
- }
- this.form.produceTaskName = this.produceTaskList.find(
- (item) => item.id == this.form.produceTaskId
- ).name;
- },
- choose(data) {
- this.form.productName = data[0].name;
- this.form.productCode = data[0].code;
- this.form.specification = data[0].specification;
- this.form.brandNo = data[0].brandNum;
- },
- //选择部门(搜索)
- searchDeptNodeClick(info, row) {
- if (info) {
- const params = { groupId: info };
- this.getUserList(params);
- this.form.groupName = row.name;
- } else {
- this.form.executeGroupId = null;
- }
- },
- // 获取审核人列表、巡点检人员
- async getUserList(params) {
- try {
- let data = { pageNum: 1, size: -1 };
- // 如果传了参数就是获取巡点检人员数据
- if (params) {
- data = Object.assign(data, params);
- }
- const res = await getUserPage(data);
- this.executorList = res.list;
- } catch (error) {}
- },
- // 执行人选择
- changeExecutor(val) {
- if (val) {
- this.form.qualityId = val;
- this.form.qualityName = this.executorList.filter(
- (item) => item.id === val
- )[0].name;
- }
- },
- /* 保存编辑 */
- save() {
- this.$refs.form.validate((valid) => {
- if (!valid) {
- return false;
- }
- this.loading = true;
- save(this.form)
- .then((msg) => {
- this.loading = false;
- this.$message.success(msg);
- this.handleClose();
- this.$emit('done');
- })
- .catch((e) => {
- this.loading = false;
- });
- });
- },
- update() {
- this.loading = true;
- this.form['status'] = 1;
- update({ ...this.form })
- .then((msg) => {
- this.loading = false;
- this.$message.success(msg);
- this.handleClose();
- this.$emit('done');
- })
- .catch((e) => {
- this.loading = false;
- });
- },
- restForm() {
- this.form = { ...this.defaultForm() };
- this.$nextTick(() => {
- this.$refs.form.clearValidate();
- });
- },
- handleClose() {
- this.restForm();
- this.visible = false;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .title {
- font-size: 16px;
- line-height: 45px;
- }
- .location-warp {
- display: flex;
- .detail {
- margin-left: 10px;
- }
- }
- :deep(
- .el-dialog:not(.ele-dialog-form)
- .el-dialog__body
- .el-form
- .el-form-item:last-child
- ) {
- margin-bottom: 22px;
- }
- :deep(
- .el-dialog:not(.ele-dialog-form)
- .el-dialog__body
- .el-form
- .el-table__body
- .el-table__row
- .el-form-item:last-child
- ) {
- margin-bottom: 0 !important;
- }
- .add-product {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- font-size: 30px;
- color: #1890ff;
- margin: 10px 0;
- cursor: pointer;
- }
- </style>
|