|
@@ -1,176 +1,131 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <!-- 功能按钮 -->
|
|
|
+ <!-- 功能按钮 -->
|
|
|
<div class="filter-container">
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="medium" @click="add">{{$t("common.add")}}</el-button>
|
|
|
- <!--<el-button type="primary" icon="el-icon-rank" size="medium" @click="add">{{$t("common.sort")}}</el-button>-->
|
|
|
- <span>{{$t("prepare.tips.sortTips")}}</span>
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="medium" @click="add">{{$t("common.add")}}</el-button>
|
|
|
+ <!--<el-button type="primary" icon="el-icon-rank" size="medium" @click="add">{{$t("common.sort")}}</el-button>-->
|
|
|
+ <span>{{$t("prepare.tips.sortTips")}}</span>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<!-- 主要内容 -->
|
|
|
- <el-table
|
|
|
- :key="tableKey"
|
|
|
- ref="table"
|
|
|
- v-loading="loading"
|
|
|
- :data="tableData.data"
|
|
|
- border
|
|
|
- fit
|
|
|
- row-key="id"
|
|
|
- style="width: 100%;"
|
|
|
- @selection-change="onSelectChange"
|
|
|
- @cell-click="cellClick"
|
|
|
- >
|
|
|
- <el-table-column :label='$t("common.serialNo")' width="55px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
|
|
|
- <el-table-column :label='$t("common.sort")' width="200px" align="center">
|
|
|
- <template slot="header">
|
|
|
- <span>{{$t("common.sort")}}</span>
|
|
|
- <span class="star">*</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input-number v-model="row.sort" :min="1" :max="100" :placeholder='$t("common.pleaseEnter")'></el-input-number>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-for="item in tableData.titleList" :key="item.id" :prop="item.identifier" :label='item.fieldName' :show-overflow-tooltip="true" >
|
|
|
- <template slot="header">
|
|
|
- <span>{{ item.fieldName }}</span>
|
|
|
- <span v-if="item.identifier!='remark'" class="star">*</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <!-- 如果是【文本框】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'input' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <el-input v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :placeholder='$t("common.pleaseEnter")'/>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 如果是【多行文本框】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'textarea' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <el-input v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" type="textarea" :rows="3" :placeholder='$t("common.pleaseEnter")'/>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 如果是【单选框】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'radio' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <el-radio-group v-model="row[item.identifier]">
|
|
|
- <el-radio v-for="(obj, index) in commList[item.identifier]" :disabled="item.readonly == '1' ? true : false" :key="index" :label="obj.code">{{obj.name}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 如果是【计数器】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'inputNumber' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <el-input-number v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :min="1" :max="999999"></el-input-number>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 如果是【开关】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'switch' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <el-switch v-model="row[item.identifier]" active-value="1" inactive-value="0" :disabled="item.readonly == '1' ? true : false"></el-switch>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 如果是【选择器】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'select' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <el-select v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :placeholder='$t("common.pleaseSelect")' filterable style="width: 100%;">
|
|
|
- <el-option
|
|
|
- v-for="(obj, index) in commList[item.identifier]"
|
|
|
- :key="index"
|
|
|
- :label="obj.name"
|
|
|
- :value="obj.code">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 如果是【级联选择器】-->
|
|
|
- <div
|
|
|
- v-if="item.formControlsType == 'cascader' && item.showStatus == '1'"
|
|
|
- :key="item.id"
|
|
|
- >
|
|
|
- <div class="block">
|
|
|
- <el-cascader
|
|
|
- :disabled="item.readonly == '1' ? true : false"
|
|
|
- style="width: 100%;"
|
|
|
- :placeholder='$t("common.pleaseSelect")'
|
|
|
- v-model="row[item.identifier]"
|
|
|
- :options="commList[item.identifier]"
|
|
|
- :props="{ value: 'code', label: 'name', checkStrictly: true, expandTrigger: 'hover' }"
|
|
|
- clearable>
|
|
|
- </el-cascader>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- :label="$t('table.operation')"
|
|
|
- fixed="right"
|
|
|
- align="center"
|
|
|
- column-key="operation"
|
|
|
- width="60px"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
|
|
|
- <i
|
|
|
- class="el-icon-delete table-operation"
|
|
|
- style="color: #f50;"
|
|
|
- @click="domDelete(scope.row, scope.$index)"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table :key="tableKey" ref="table" v-loading="loading" :data="tableData.data" border fit row-key="id" style="width: 100%;" @selection-change="onSelectChange" @cell-click="cellClick" :span-method="objectSpanMethod">
|
|
|
+ <el-table-column :label='$t("common.serialNo")' width="55px" align="center" column-key="index">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{scope.row.xh}}
|
|
|
+ <!-- {{Math.ceil((scope.$index+(queryParams.current - 1) * queryParams.size + 1)/4)}} -->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column :label='$t("common.serialNo")' width="55px" align="center" column-key="index1">
|
|
|
+
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{scope.$index+1}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
+ <!-- <el-table-column align="center" type="selection" width="50" :reserve-selection="true" /> -->
|
|
|
+ <el-table-column :label='$t("common.sort")' width="200px" align="center">
|
|
|
+ <template slot="header">
|
|
|
+ <span>{{$t("common.sort")}}</span>
|
|
|
+ <span class="star">*</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-input-number @change="test" v-model="row.sort" :min="1" :max="100" :placeholder='$t("common.pleaseEnter")'></el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column v-for="item in tableData.titleList" :key="item.id" :prop="item.identifier" :label='item.fieldName' :show-overflow-tooltip="true">
|
|
|
+ <template slot="header">
|
|
|
+ <span>{{ item.fieldName }}</span>
|
|
|
+ <span v-if="item.identifier!='remark'" class="star">*</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row}">
|
|
|
+ <!-- 如果是【文本框】-->
|
|
|
+ <div v-if="item.formControlsType == 'input' && item.showStatus == '1'&&item.identifier!='name'" :key="item.id">
|
|
|
+ <el-input v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :placeholder='$t("common.pleaseEnter")' />
|
|
|
+ </div>
|
|
|
+ <!-- 工序名称输入-->
|
|
|
+ <div v-if="row.isinput&&item.identifier=='name'" :key="item.id">
|
|
|
+ <el-input v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :placeholder='$t("common.pleaseEnter")' />
|
|
|
+ </div>
|
|
|
+ <!-- 工序名称下拉-->
|
|
|
+ <div v-if="!row.isinput&&item.identifier=='name'" :key="item.id">
|
|
|
+ <el-select @change="(name)=>changename(name,row)" v-model="row[item.identifier]" :placeholder='$t("common.pleaseSelect")' filterable style="width: 100%;">
|
|
|
+ <el-option v-for="(value,key) in dicts['PROCEDURE_TYPE_NAME']" :key="key" :label="value" :value="value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <!-- 如果是【多行文本框】-->
|
|
|
+ <div v-if="item.formControlsType == 'textarea' && item.showStatus == '1'" :key="item.id">
|
|
|
+ <el-input v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" type="textarea" :rows="3" :placeholder='$t("common.pleaseEnter")' />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 如果是【单选框】-->
|
|
|
+ <div v-if="item.formControlsType == 'radio' && item.showStatus == '1'" :key="item.id">
|
|
|
+ <el-radio-group v-model="row[item.identifier]">
|
|
|
+ <el-radio v-for="(obj, index) in commList[item.identifier]" :disabled="item.readonly == '1' ? true : false" :key="index" :label="obj.code">{{obj.name}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 如果是【计数器】-->
|
|
|
+ <div v-if="item.formControlsType == 'inputNumber' && item.showStatus == '1'" :key="item.id">
|
|
|
+ <el-input-number v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :min="1" :max="999999"></el-input-number>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 如果是【开关】-->
|
|
|
+ <div v-if="item.formControlsType == 'switch' && item.showStatus == '1'" :key="item.id">
|
|
|
+ <el-switch v-model="row[item.identifier]" active-value="1" inactive-value="0" :disabled="item.readonly == '1' ? true : false"></el-switch>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 如果是【选择器】-->
|
|
|
+ <div v-if="item.formControlsType == 'select' && item.showStatus == '1'" :key="item.id">
|
|
|
+ <el-select v-model="row[item.identifier]" :disabled="item.readonly == '1' ? true : false" :placeholder='$t("common.pleaseSelect")' filterable style="width: 100%;">
|
|
|
+ <el-option v-for="(obj, index) in commList[item.identifier]" :key="index" :label="obj.name" :value="obj.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 如果是【级联选择器】-->
|
|
|
+ <div v-if="item.formControlsType == 'cascader' && item.showStatus == '1'" :key="item.id">
|
|
|
+ <div class="block">
|
|
|
+ <el-cascader :disabled="item.readonly == '1' ? true : false" style="width: 100%;" :placeholder='$t("common.pleaseSelect")' v-model="row[item.identifier]" :options="commList[item.identifier]" :props="{ value: 'code', label: 'name', checkStrictly: true, expandTrigger: 'hover' }" clearable>
|
|
|
+ </el-cascader>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column :label="$t('table.operation')" fixed="right" align="center" column-key="operation" width="120px">
|
|
|
+
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tooltip v-if="scope.row.isadd" class="item" content='新增' effect="dark" placement="top-start">
|
|
|
+ <i class="el-icon-plus table-operation" style="color: #409EFF;" @click="add1(scope.row.xh, scope.row.index)" />
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip class="item" content='清空' effect="dark" placement="top-start">
|
|
|
+ <i class="el-icon-delete table-operation" style="color: #f50;" @click="clear(scope.row, scope.$index)" />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('table.operation')" fixed="right" align="center" column-key="operation1" width="60px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tooltip class="item" :content='$t("common.delete")' effect="dark" @click="domDelete(scope.row)" placement="top-start">
|
|
|
+ <i class="el-icon-delete table-operation" style="color: #f50;" />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
- <pagination
|
|
|
- v-show="tableData.total > 0"
|
|
|
- :limit.sync="queryParams.size"
|
|
|
- :page.sync="queryParams.current"
|
|
|
- :total="Number(tableData.total)"
|
|
|
- @pagination="fetch"
|
|
|
- />
|
|
|
- <tenant-edit
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
- <tenant-view
|
|
|
- ref="view"
|
|
|
- :dialog-visible="tenantViewVisible"
|
|
|
- @close="viewClose"
|
|
|
- />
|
|
|
- <el-dialog
|
|
|
- v-el-drag-dialog
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="true"
|
|
|
- title="预览"
|
|
|
- width="80%"
|
|
|
- top="50px"
|
|
|
- :visible.sync="preview.isVisible"
|
|
|
- >
|
|
|
+ <pagination v-show="tableData.total > 0" :limit.sync="queryParams.size" :page.sync="queryParams.current" :total="Number(tableData.total)" @pagination="fetch" />
|
|
|
+ <tenant-edit ref="edit" :dialog-visible="dialog.isVisible" :title="dialog.title" @close="editClose" @success="editSuccess" />
|
|
|
+ <tenant-view ref="view" :dialog-visible="tenantViewVisible" @close="viewClose" />
|
|
|
+ <el-dialog v-el-drag-dialog :close-on-click-modal="false" :close-on-press-escape="true" title="预览" width="80%" top="50px" :visible.sync="preview.isVisible">
|
|
|
<el-scrollbar>
|
|
|
<div v-html="preview.context" />
|
|
|
</el-scrollbar>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
+
|
|
|
<!-- 按钮 -->
|
|
|
<div slot="footer" style="text-align: center;margin-top: 20px;">
|
|
|
<el-button plain type="warning" @click="cancel">{{ $t('common.cancel') }}</el-button>
|
|
@@ -180,38 +135,48 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Pagination from "@/components/Pagination"
|
|
|
-import TenantEdit from "./components/Edit"
|
|
|
-import TenantView from "./components/View"
|
|
|
+import Pagination from "@/components/Pagination";
|
|
|
+import TenantEdit from "./components/Edit";
|
|
|
+import TenantView from "./components/View";
|
|
|
// 【工艺管理】-API
|
|
|
-import technologyMgrApi from "@/api/prepareProductMgr/technologyMgr"
|
|
|
+import technologyMgrApi from "@/api/prepareProductMgr/technologyMgr";
|
|
|
// 【建模中心】主要使用,动态查询共通的数据-API
|
|
|
-import modelingCenterApi from "@/api/modelingCenter/modelingCenter"
|
|
|
-import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
-import { downloadFile, initEnums, initQueryParams } from '@/utils/commons'
|
|
|
-import axios from 'axios'
|
|
|
+import modelingCenterApi from "@/api/modelingCenter/modelingCenter";
|
|
|
+import elDragDialog from "@/directive/el-drag-dialog";
|
|
|
+import dictionaryItemApi from "@/api/DictionaryItem";
|
|
|
+import {
|
|
|
+ downloadFile,
|
|
|
+ initEnums,
|
|
|
+ initQueryParams,
|
|
|
+ initDicts,
|
|
|
+} from "@/utils/commons";
|
|
|
+import axios from "axios";
|
|
|
+import { del } from "vue";
|
|
|
export default {
|
|
|
name: "ProcessTemplate",
|
|
|
directives: { elDragDialog },
|
|
|
components: { Pagination, TenantEdit, TenantView },
|
|
|
props: {
|
|
|
- //工艺建模对象
|
|
|
- processModeling: Object
|
|
|
+ //工艺建模对象
|
|
|
+ processModeling: Object,
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
- confirmDisabled: false,
|
|
|
- validateMsg: "",
|
|
|
- titleMap: {sort:"排序"},
|
|
|
- qiyongStatus: [], //状态
|
|
|
- audioStatus: [],
|
|
|
+ firstLevelIndexArr: [], // 一个空的数组,用于存放第一列每一行记录的合并数 控制第一列的合并
|
|
|
+ firstLevelIndexPos: 0, // firstLevelIndexArr 的索引
|
|
|
+ dicts: [],
|
|
|
+ confirmDisabled: false,
|
|
|
+ validateMsg: "",
|
|
|
+ titleMap: { sort: "排序" },
|
|
|
+ qiyongStatus: [], //状态
|
|
|
+ audioStatus: [],
|
|
|
dialog: {
|
|
|
isVisible: false,
|
|
|
- title: ""
|
|
|
+ title: "",
|
|
|
},
|
|
|
preview: {
|
|
|
isVisible: false,
|
|
|
- context: ''
|
|
|
+ context: "",
|
|
|
},
|
|
|
tenantViewVisible: false,
|
|
|
tableKey: 0,
|
|
@@ -219,244 +184,772 @@ export default {
|
|
|
selection: [],
|
|
|
loading: false,
|
|
|
tableData: {
|
|
|
- titleList: [], // 表头数据
|
|
|
- data: [], // 内容数据
|
|
|
- total: 0 // 分页总数
|
|
|
+ titleList: [], // 表头数据
|
|
|
+ data: [], // 内容数据
|
|
|
+ total: 0, // 分页总数
|
|
|
},
|
|
|
- commList: {key: 1}, // 动态的数据对象,比如表单中的select、cascader、radio、checkbox等需要数据的控件
|
|
|
+ commList: { key: 1 }, // 动态的数据对象,比如表单中的select、cascader、radio、checkbox等需要数据的控件
|
|
|
enums: {
|
|
|
TenantTypeEnum: {},
|
|
|
- TenantStatusEnum: {}
|
|
|
+ TenantStatusEnum: {},
|
|
|
},
|
|
|
// 模拟字段,拼接
|
|
|
titleField: [
|
|
|
- {"id":"11","createTime":"2020-11-17 17:08:45","createUser":"3","updateTime":"2020-11-19 11:15:29","updateUser":"3","fieldName":"名称","identifier":"name","remark":"测试专用字段","dataType":"varchar","length":255,"decimalLength":null,"sort":1,"formControlsType":"input","bizType":"1","readonly":"0","comboxUrl":null,"showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328237616922886144","createTime":"2020-11-16 15:24:59","createUser":"3","updateTime":"2020-11-19 21:27:02","updateUser":"3","fieldName":"工艺模板","identifier":"product_module_id","remark":"工艺模板id","dataType":"bigint","length":20,"decimalLength":null,"sort":2,"formControlsType":"select","bizType":"1","readonly":"0","comboxUrl":"{\"tableName\":\"c_auth_user\",\"field1\":\"id\",\"field2\":\"name\",\"condition\":\"account='manong' and station_id=642032719487828225\"}","showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"12","createTime":"2020-11-17 17:08:45","createUser":"3","updateTime":"2020-11-19 10:59:19","updateUser":"3","fieldName":"品牌","identifier":"brand","remark":"测试专用字段","dataType":"varchar","length":128,"decimalLength":null,"sort":4,"formControlsType":"select","bizType":"1","readonly":"0","comboxUrl":"{\"tableName\":\"c_auth_user\",\"field1\":\"id\",\"field2\":\"name\",\"condition\":\"account='manong' and station_id=642032719487828225\"}","showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328239955868123136","createTime":"2020-11-16 15:34:17","createUser":"3","updateTime":"2020-11-19 11:10:53","updateUser":"3","fieldName":"单位","identifier":"unit","remark":"单位","dataType":"varchar","length":100,"decimalLength":null,"sort":5,"formControlsType":"input","bizType":"1","readonly":"0","comboxUrl":null,"showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328239689886334976","createTime":"2020-11-16 15:33:14","createUser":"3","updateTime":"2020-11-19 21:27:15","updateUser":"3","fieldName":"数量","identifier":"number","remark":"数量","dataType":"bigint","length":20,"decimalLength":null,"sort":5,"formControlsType":"inputNumber","bizType":"1","readonly":"0","comboxUrl":null,"showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328240402125291520","createTime":"2020-11-16 15:36:04","createUser":"3","updateTime":"2020-11-19 11:19:05","updateUser":"3","fieldName":"型号","identifier":"model","remark":"型号","dataType":"varchar","length":128,"decimalLength":null,"sort":7,"formControlsType":"input","bizType":"1","readonly":"0","comboxUrl":null,"showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328240158608195584","createTime":"2020-11-16 15:35:05","createUser":"3","updateTime":"2020-11-19 21:27:08","updateUser":"3","fieldName":"启用状态","identifier":"status","remark":"777","dataType":"varchar","length":10,"decimalLength":null,"sort":7,"formControlsType":"radio","bizType":"1","readonly":"0","comboxUrl":"{\"tableName\":\"c_common_dictionary_item\",\"field1\":\"code\",\"field2\":\"name\",\"condition\":\"dictionary_type='STATUS' \"}","showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328241044487143424","createTime":"2020-11-16 15:38:37","createUser":"3","updateTime":"2020-11-19 11:12:17","updateUser":"3","fieldName":"规格","identifier":"specifications","remark":"规格","dataType":"varchar","length":255,"decimalLength":null,"sort":9,"formControlsType":"input","bizType":"1","readonly":"0","comboxUrl":null,"showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1328241343830425600","createTime":"2020-11-16 15:39:48","createUser":"3","updateTime":"2020-11-19 11:17:05","updateUser":"3","fieldName":"是否外购","identifier":"is_outsourcing","remark":"是否外购","dataType":"varchar","length":6,"decimalLength":null,"sort":11,"formControlsType":"radio","bizType":"1","readonly":"0","comboxUrl":"{\"tableName\":\"c_common_dictionary_item\",\"field1\":\"code\",\"field2\":\"name\",\"condition\":\"dictionary_type='STATUS' \"}","showStatus":"1","requireFlag":"1","validate":null,"moduleId":"0","builtIn":"1"},
|
|
|
- {"id":"1329261864890138624","createTime":"2020-11-19 11:14:59","createUser":"3","updateTime":"2020-11-19 16:07:21","updateUser":"3","fieldName":"备注","identifier":"remark","remark":"多行文本信息","dataType":"varchar","length":200,"decimalLength":null,"sort":12,"formControlsType":"textarea","bizType":"1","readonly":"0","comboxUrl":null,"showStatus":"1","requireFlag":"0","validate":null,"moduleId":"0","builtIn":"1"}
|
|
|
- ]
|
|
|
- }
|
|
|
+ {
|
|
|
+ id: "11",
|
|
|
+ createTime: "2020-11-17 17:08:45",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 11:15:29",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "名称",
|
|
|
+ identifier: "name",
|
|
|
+ remark: "测试专用字段",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 255,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 1,
|
|
|
+ formControlsType: "input",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl: null,
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328237616922886144",
|
|
|
+ createTime: "2020-11-16 15:24:59",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 21:27:02",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "工艺模板",
|
|
|
+ identifier: "product_module_id",
|
|
|
+ remark: "工艺模板id",
|
|
|
+ dataType: "bigint",
|
|
|
+ length: 20,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 2,
|
|
|
+ formControlsType: "select",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl:
|
|
|
+ '{"tableName":"c_auth_user","field1":"id","field2":"name","condition":"account=\'manong\' and station_id=642032719487828225"}',
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "12",
|
|
|
+ createTime: "2020-11-17 17:08:45",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 10:59:19",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "品牌",
|
|
|
+ identifier: "brand",
|
|
|
+ remark: "测试专用字段",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 128,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 4,
|
|
|
+ formControlsType: "select",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl:
|
|
|
+ '{"tableName":"c_auth_user","field1":"id","field2":"name","condition":"account=\'manong\' and station_id=642032719487828225"}',
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328239955868123136",
|
|
|
+ createTime: "2020-11-16 15:34:17",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 11:10:53",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "单位",
|
|
|
+ identifier: "unit",
|
|
|
+ remark: "单位",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 100,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 5,
|
|
|
+ formControlsType: "input",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl: null,
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328239689886334976",
|
|
|
+ createTime: "2020-11-16 15:33:14",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 21:27:15",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "数量",
|
|
|
+ identifier: "number",
|
|
|
+ remark: "数量",
|
|
|
+ dataType: "bigint",
|
|
|
+ length: 20,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 5,
|
|
|
+ formControlsType: "inputNumber",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl: null,
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328240402125291520",
|
|
|
+ createTime: "2020-11-16 15:36:04",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 11:19:05",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "型号",
|
|
|
+ identifier: "model",
|
|
|
+ remark: "型号",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 128,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 7,
|
|
|
+ formControlsType: "input",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl: null,
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328240158608195584",
|
|
|
+ createTime: "2020-11-16 15:35:05",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 21:27:08",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "启用状态",
|
|
|
+ identifier: "status",
|
|
|
+ remark: "777",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 10,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 7,
|
|
|
+ formControlsType: "radio",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl:
|
|
|
+ '{"tableName":"c_common_dictionary_item","field1":"code","field2":"name","condition":"dictionary_type=\'STATUS\' "}',
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328241044487143424",
|
|
|
+ createTime: "2020-11-16 15:38:37",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 11:12:17",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "规格",
|
|
|
+ identifier: "specifications",
|
|
|
+ remark: "规格",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 255,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 9,
|
|
|
+ formControlsType: "input",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl: null,
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1328241343830425600",
|
|
|
+ createTime: "2020-11-16 15:39:48",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 11:17:05",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "是否外购",
|
|
|
+ identifier: "is_outsourcing",
|
|
|
+ remark: "是否外购",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 6,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 11,
|
|
|
+ formControlsType: "radio",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl:
|
|
|
+ '{"tableName":"c_common_dictionary_item","field1":"code","field2":"name","condition":"dictionary_type=\'STATUS\' "}',
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "1",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "1329261864890138624",
|
|
|
+ createTime: "2020-11-19 11:14:59",
|
|
|
+ createUser: "3",
|
|
|
+ updateTime: "2020-11-19 16:07:21",
|
|
|
+ updateUser: "3",
|
|
|
+ fieldName: "备注",
|
|
|
+ identifier: "remark",
|
|
|
+ remark: "多行文本信息",
|
|
|
+ dataType: "varchar",
|
|
|
+ length: 200,
|
|
|
+ decimalLength: null,
|
|
|
+ sort: 12,
|
|
|
+ formControlsType: "textarea",
|
|
|
+ bizType: "1",
|
|
|
+ readonly: "0",
|
|
|
+ comboxUrl: null,
|
|
|
+ showStatus: "1",
|
|
|
+ requireFlag: "0",
|
|
|
+ validate: null,
|
|
|
+ moduleId: "0",
|
|
|
+ builtIn: "1",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
},
|
|
|
// 监听数据的变化
|
|
|
- watch: {
|
|
|
- // 监听,路由传参数变化
|
|
|
- 'processModeling.id'(currVal, oldVal){
|
|
|
- console.log("监听数据的变化:", currVal, oldVal)
|
|
|
- // 查询所有数据
|
|
|
- this.getList()
|
|
|
- }
|
|
|
- },
|
|
|
+ watch: {
|
|
|
+ // 监听,路由传参数变化
|
|
|
+ "processModeling.id"(currVal, oldVal) {
|
|
|
+ console.log("监听数据的变化:", currVal, oldVal);
|
|
|
+ // 查询所有数据
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ },
|
|
|
// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- // 更新列表数据
|
|
|
- this.fetch()
|
|
|
- // 查询所有数据
|
|
|
- this.getList()
|
|
|
- // 调用常量-初始化值
|
|
|
- this.qiyongStatus = this.$constWKS.STATUSLIST
|
|
|
- // 调用常量-审核状态
|
|
|
- this.audioStatus = this.$constWKS.AUDIOLIST
|
|
|
- },
|
|
|
+ created() {},
|
|
|
computed: {
|
|
|
- currentUser () {
|
|
|
- return this.$store.state.account.user
|
|
|
- }
|
|
|
+ currentUser() {
|
|
|
+ return this.$store.state.account.user;
|
|
|
+ },
|
|
|
+ dictsKeys() {
|
|
|
+ return Object.keys(this.dicts["PROCEDURE_TYPE_NAME"]);
|
|
|
+ },
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ async mounted() {
|
|
|
+ // 更新列表数据
|
|
|
+ await this.initDicts(["PROCEDURE_TYPE_NAME"], this.dicts);
|
|
|
+
|
|
|
+ await this.fetch();
|
|
|
+
|
|
|
+ // 查询所有数据
|
|
|
+ await this.getList();
|
|
|
+
|
|
|
+ // 调用常量-初始化值
|
|
|
+ this.qiyongStatus = this.$constWKS.STATUSLIST;
|
|
|
+ // 调用常量-审核状态
|
|
|
+ this.audioStatus = this.$constWKS.AUDIOLIST;
|
|
|
},
|
|
|
methods: {
|
|
|
- // 【确认】按钮-事件
|
|
|
- submitForm(){
|
|
|
- let obj = {
|
|
|
- versionId: this.processModeling.id,
|
|
|
- bomId: this.processModeling.bomId,
|
|
|
- procedureList: this.tableData.data // 新增的数据
|
|
|
- }
|
|
|
-
|
|
|
- for(let i=0; i< this.tableData.data.length; i++){
|
|
|
- let item = this.tableData.data[i];
|
|
|
- for(let property in item){
|
|
|
- if(property == "remark") continue;
|
|
|
-
|
|
|
- if( typeof item[property] == "undefined" || item[property] ==null || item[property] ==""){
|
|
|
- this.confirmDisabled = true
|
|
|
- this.validateMsg="第"+(i+1)+"行的"+this.titleMap[property]+"列数据为空";
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(this.confirmDisabled){
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(this.confirmDisabled){
|
|
|
- this.$message({
|
|
|
- message: this.validateMsg,
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- this.confirmDisabled = false
|
|
|
- this.validateMsg = ""
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- technologyMgrApi.saveList(obj).then(res => {
|
|
|
- res = res.data
|
|
|
- if(res.isSuccess){
|
|
|
- this.$message({
|
|
|
+ async initDicts(codes, dicts = {}) {
|
|
|
+ try {
|
|
|
+ if (typeof codes === "string") {
|
|
|
+ codes = [codes];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (codes && codes.length > 0) {
|
|
|
+ let response = await dictionaryItemApi.list({ codes: codes });
|
|
|
+
|
|
|
+ const res = response.data;
|
|
|
+ for (const code of codes) {
|
|
|
+ dicts[code] = res.data[code];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ test() {
|
|
|
+ // this.getSpanArr(this.tableData.data)
|
|
|
+ },
|
|
|
+ changename(name, obj) {
|
|
|
+ let keys = this.dictsKeys;
|
|
|
+ let no = keys.find(
|
|
|
+ (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == name
|
|
|
+ );
|
|
|
+ let n = no ? no[no.length - 1] : -2;
|
|
|
+ if (n == 0 || n == 1) {
|
|
|
+ obj["type"] = `设备序`;
|
|
|
+ }
|
|
|
+ if (n == 2 || n == 4) {
|
|
|
+ obj["type"] = `工序下料`;
|
|
|
+ }
|
|
|
+ if (n == 6 || n == 8) {
|
|
|
+ obj["type"] = `工序上料`;
|
|
|
+ }
|
|
|
+ if (n == 5) {
|
|
|
+ obj["type"] = `下料`;
|
|
|
+ }
|
|
|
+ if (n == 4) {
|
|
|
+ obj["type"] = `热处理下料`;
|
|
|
+ }
|
|
|
+ if (n == 8) {
|
|
|
+ obj["type"] = `热处理上料`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSpanArr(data) {
|
|
|
+ // firstLevelIndexArr/secondLevelIndexArr来存放要合并的格数,同时还要设定一个变量firstLevelIndexPos/secondLevelIndexPos来记录
|
|
|
+ for (let i = 0, len = data.length; i < len; i++) {
|
|
|
+ let xh = Math.ceil((i + 1) / 4);
|
|
|
+
|
|
|
+ data[i].index = i + 1;
|
|
|
+ }
|
|
|
+ data.sort((a, b) => a.xh - b.xh);
|
|
|
+ this.firstLevelIndexArr = [];
|
|
|
+ this.secondLevelIndexArr = [];
|
|
|
+ this.indexDescArr = [];
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ if (i === 0) {
|
|
|
+ this.firstLevelIndexArr.push(1);
|
|
|
+ this.firstLevelIndexPos = 0;
|
|
|
+ } else {
|
|
|
+ // 判断当前元素与上一个元素是否相同(第1和第2列)
|
|
|
+
|
|
|
+ if (data[i].xh === data[i - 1].xh) {
|
|
|
+ this.firstLevelIndexArr[this.firstLevelIndexPos] += 1;
|
|
|
+ this.firstLevelIndexArr.push(0);
|
|
|
+ } else {
|
|
|
+ this.firstLevelIndexArr.push(1);
|
|
|
+ this.firstLevelIndexPos = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //按行合并
|
|
|
+ objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ if (columnIndex === 0 || columnIndex === 9) {
|
|
|
+ const _row = this.firstLevelIndexArr[rowIndex];
|
|
|
+ const _col = _row > 0 ? 1 : 0;
|
|
|
+ return {
|
|
|
+ rowspan: _row,
|
|
|
+ colspan: _col,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ let n = this.tableData.data.filter((ele) => ele.xh == row.xh);
|
|
|
+ n = n.length;
|
|
|
+ console.log(n);
|
|
|
+ if (columnIndex === 0 || columnIndex === 11) {
|
|
|
+ if (rowIndex % n === 0) {
|
|
|
+ return [n, 1];
|
|
|
+ } else {
|
|
|
+ return [0, 0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 【确认】按钮-事件
|
|
|
+ submitForm() {
|
|
|
+ let obj = {
|
|
|
+ versionId: this.processModeling.id,
|
|
|
+ bomId: this.processModeling.bomId,
|
|
|
+ procedureList: this.tableData.data, // 新增的数据
|
|
|
+ };
|
|
|
+
|
|
|
+ for (let i = 0; i < this.tableData.data.length; i++) {
|
|
|
+ let item = this.tableData.data[i];
|
|
|
+ item.opId = item.xh;
|
|
|
+
|
|
|
+ for (let property in item) {
|
|
|
+ if (
|
|
|
+ ["remark", "xh", "index", "isadd", "isinput"].includes(property)
|
|
|
+ ) {
|
|
|
+ // if (["xh", "index", "isadd"].includes(property))
|
|
|
+ // delete item[property];
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ typeof item[property] == "undefined" ||
|
|
|
+ item[property] == null ||
|
|
|
+ item[property] == ""
|
|
|
+ ) {
|
|
|
+ this.confirmDisabled = true;
|
|
|
+ this.validateMsg =
|
|
|
+ "第" + (i + 1) + "行的" + this.titleMap[property] + "列数据为空";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.confirmDisabled) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.confirmDisabled) {
|
|
|
+ this.$message({
|
|
|
+ message: this.validateMsg,
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ this.confirmDisabled = false;
|
|
|
+ this.validateMsg = "";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // console.log(obj);
|
|
|
+ obj.procedureList = obj.procedureList.map((ele) => {
|
|
|
+ let obj = {};
|
|
|
+ for (let property in ele) {
|
|
|
+ if (["xh", "index", "isadd", "isinput"].includes(property)) continue;
|
|
|
+ obj[property] = ele[property];
|
|
|
+ }
|
|
|
+ return obj;
|
|
|
+ });
|
|
|
+ technologyMgrApi.saveList(obj).then((res) => {
|
|
|
+ res = res.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.$message({
|
|
|
message: "保存成功!",
|
|
|
- type: "success"
|
|
|
- })
|
|
|
- // 查询所有数据
|
|
|
- this.getList()
|
|
|
- // 【确定】按钮(通知父组件)-事件
|
|
|
- this.$emit("success")
|
|
|
- // 【关闭】按钮-事件
|
|
|
- this.$emit("close")
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 【关闭】按钮-事件
|
|
|
- cancel(){
|
|
|
- this.$emit("close")
|
|
|
- },
|
|
|
- // 【新增】按钮-事件(前端新增)
|
|
|
- add(){
|
|
|
- let obj = {}
|
|
|
- for(let key in this.titleMap){
|
|
|
- obj[key] = "";
|
|
|
- }
|
|
|
- this.tableData.data.push(obj)
|
|
|
- },
|
|
|
- // 【删除】按钮-事件(前端删除)
|
|
|
- domDelete(row, index){
|
|
|
- this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ // 查询所有数据
|
|
|
+ this.getList();
|
|
|
+ // 【确定】按钮(通知父组件)-事件
|
|
|
+ this.$emit("success");
|
|
|
+ // 【关闭】按钮-事件
|
|
|
+ this.$emit("close");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 【关闭】按钮-事件
|
|
|
+ cancel() {
|
|
|
+ this.$emit("close");
|
|
|
+ },
|
|
|
+ // 【新增】按钮-事件(前端新增)
|
|
|
+ add() {
|
|
|
+ try {
|
|
|
+ let index = this.tableData.data.length - 1;
|
|
|
+ let item = this.tableData.data[index] || {};
|
|
|
+ let keys = this.dictsKeys;
|
|
|
+ for (let i = 0, len = 3; i <= len; i++) {
|
|
|
+ let obj = {};
|
|
|
+ let xh = (item.xh || 0) + 1;
|
|
|
+ obj.xh = xh;
|
|
|
+ // obj.index = index + 1 + i + 1;
|
|
|
+ for (let key in this.titleMap) {
|
|
|
+ obj[key] = "";
|
|
|
+
|
|
|
+ if (i == 0) {
|
|
|
+ if (key == "name") {
|
|
|
+ obj[key] = `OP${xh}0上料`;
|
|
|
+ }
|
|
|
+ obj.no = keys.find(
|
|
|
+ (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == "OP20上料"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (i == 1) {
|
|
|
+ if (key == "type") {
|
|
|
+ obj[key] = `设备序`;
|
|
|
+ }
|
|
|
+ obj.isinput = true;
|
|
|
+ obj.no = keys.find(
|
|
|
+ (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == "设备序"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (i == 2) {
|
|
|
+ if (key == "name") {
|
|
|
+ obj[key] = `清洗${xh}`;
|
|
|
+ }
|
|
|
+ obj.isadd = true;
|
|
|
+ obj.no = keys.find(
|
|
|
+ (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == "清洗"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (i == 3) {
|
|
|
+ if (key == "name") {
|
|
|
+ obj[key] = `OP${xh}0下料`;
|
|
|
+ }
|
|
|
+ obj.no = keys.find(
|
|
|
+ (ele) => this.dicts["PROCEDURE_TYPE_NAME"][ele] == "OP10下料"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (key == "sort") obj[key] = (item.sort || 101) - i - 1;
|
|
|
+ let n = obj.no ? obj.no[obj.no.length - 1] : -2;
|
|
|
+ if (n == 0 || n == 1) {
|
|
|
+ obj["type"] = `设备序`;
|
|
|
+ }
|
|
|
+ if (n == 2 || n == 4) {
|
|
|
+ obj["type"] = `工序下料`;
|
|
|
+ }
|
|
|
+ if (n == 6 || n == 8) {
|
|
|
+ obj["type"] = `工序上料`;
|
|
|
+ }
|
|
|
+ if (n == 5) {
|
|
|
+ obj["type"] = `下料`;
|
|
|
+ }
|
|
|
+ if (n == 4) {
|
|
|
+ obj["type"] = `热处理下料`;
|
|
|
+ }
|
|
|
+ if (n == 8) {
|
|
|
+ obj["type"] = `热处理上料`;
|
|
|
+ }
|
|
|
+ obj["no"] = `OP${xh}${i}`;
|
|
|
+ obj.content = obj.name;
|
|
|
+ }
|
|
|
+ this.tableData.data.push(obj);
|
|
|
+ this.getSpanArr(this.tableData.data);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ add1(xh, index) {
|
|
|
+ // let index = this.tableData.data.length - 1;
|
|
|
+
|
|
|
+ let obj = {};
|
|
|
+
|
|
|
+ // let xh = Math.ceil((index + 1 + 1) / 4);
|
|
|
+ obj.xh = xh;
|
|
|
+ // obj.index = index + 1 + 1;
|
|
|
+ for (let key in this.titleMap) {
|
|
|
+ obj[key] = "";
|
|
|
+ obj["type"] = `设备序`;
|
|
|
+ obj["name"] = `打标`;
|
|
|
+ }
|
|
|
+ this.tableData.data.splice(index, 0, obj);
|
|
|
+
|
|
|
+ this.getSpanArr(this.tableData.data);
|
|
|
+ },
|
|
|
+ clear(row) {
|
|
|
+ for (let key in this.titleMap) {
|
|
|
+ if (key == "sort") continue;
|
|
|
+ row[key] = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 【删除】按钮-事件(前端删除)
|
|
|
+ domDelete(row, index) {
|
|
|
+ let xhs = this.tableData.data.map((ele) => ele.xh);
|
|
|
+
|
|
|
+ if ([...new Set(xhs)].length == 1) {
|
|
|
+ this.$message({
|
|
|
+ message: "必须保留一条工序",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
confirmButtonText: this.$t("common.confirm"),
|
|
|
cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- // 过滤我们需要的数据
|
|
|
- this.tableData.data.splice(index, 1)
|
|
|
- // 清除table的选中数据
|
|
|
- this.$refs.table.toggleRowSelection(row, false)
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- viewClose () {
|
|
|
- this.tenantViewVisible = false
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ let data = this.tableData.data.filter((ele) => ele.xh != row.xh);
|
|
|
+
|
|
|
+ for (let i = 0, len = data.length; i < len; i++) {
|
|
|
+ if (data[i].xh > row.xh) data[i].xh = data[i].xh - 1;
|
|
|
+ }
|
|
|
+ this.tableData.data = data;
|
|
|
+ // // 过滤我们需要的数据
|
|
|
+ // this.tableData.data.splice(index, 1);
|
|
|
+ // // 清除table的选中数据
|
|
|
+ // this.$refs.table.toggleRowSelection(row, false);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ viewClose() {
|
|
|
+ this.tenantViewVisible = false;
|
|
|
},
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
+ editClose() {
|
|
|
+ this.dialog.isVisible = false;
|
|
|
},
|
|
|
- editSuccess () {
|
|
|
- this.search()
|
|
|
+ editSuccess() {
|
|
|
+ this.search();
|
|
|
},
|
|
|
- onSelectChange (selection) {
|
|
|
- this.selection = selection
|
|
|
+ onSelectChange(selection) {
|
|
|
+ this.selection = selection;
|
|
|
},
|
|
|
- search () {
|
|
|
+ search() {
|
|
|
this.fetch({
|
|
|
- ...this.queryParams
|
|
|
- })
|
|
|
+ ...this.queryParams,
|
|
|
+ });
|
|
|
},
|
|
|
- reset () {
|
|
|
- this.queryParams = initQueryParams({})
|
|
|
- this.$refs.table.clearSort()
|
|
|
- this.$refs.table.clearFilter()
|
|
|
- this.search()
|
|
|
+ reset() {
|
|
|
+ this.queryParams = initQueryParams({});
|
|
|
+ this.$refs.table.clearSort();
|
|
|
+ this.$refs.table.clearFilter();
|
|
|
+ this.search();
|
|
|
},
|
|
|
- clearSelections () {
|
|
|
- this.$refs.table.clearSelection()
|
|
|
+ clearSelections() {
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
},
|
|
|
- view (row) {
|
|
|
- this.$refs.view.setTenant(row)
|
|
|
- this.tenantViewVisible = true
|
|
|
+ view(row) {
|
|
|
+ this.$refs.view.setTenant(row);
|
|
|
+ this.tenantViewVisible = true;
|
|
|
},
|
|
|
- fetch (params = {}) {
|
|
|
- this.loading = true
|
|
|
- technologyMgrApi.getProcedureField(this.processModeling).then(response => {
|
|
|
- const res = response.data
|
|
|
- console.log("工艺管理的表头数据:", res)
|
|
|
+ async fetch(params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ try {
|
|
|
+ let response = await technologyMgrApi.getProcedureField(
|
|
|
+ this.processModeling
|
|
|
+ );
|
|
|
+
|
|
|
+ const res = response.data;
|
|
|
+ console.log("工艺管理的表头数据:", res);
|
|
|
if (res.isSuccess) {
|
|
|
- // 表头字段
|
|
|
- this.tableData.titleList = res.data;
|
|
|
- // 判断数据是否存在
|
|
|
- if(res.data && res.data.length > 0){
|
|
|
- let leng = res.data.length - 1
|
|
|
- res.data.forEach((item, index) => {
|
|
|
- // 需要加载数据的字段
|
|
|
- let str = "radio,checkbox,select,cascader"
|
|
|
- if(str.indexOf(item.formControlsType) > -1 ){
|
|
|
- // 加载响应的数据
|
|
|
- this.getCommList(item)
|
|
|
- }
|
|
|
- if(index == leng){
|
|
|
- this.isEnd = true
|
|
|
- }
|
|
|
- this.titleMap[item.identifier] = item.fieldName
|
|
|
- })
|
|
|
- }
|
|
|
+ // 表头字段
|
|
|
+ this.tableData.titleList = res.data;
|
|
|
+ // 判断数据是否存在
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ let leng = res.data.length - 1;
|
|
|
+ for (let index in res.data) {
|
|
|
+ let item = res.data[index];
|
|
|
+ // 需要加载数据的字段
|
|
|
+ let str = "radio,checkbox,select,cascader";
|
|
|
+ if (str.indexOf(item.formControlsType) > -1) {
|
|
|
+ // 加载响应的数据
|
|
|
+ await this.getCommList(item);
|
|
|
+ }
|
|
|
+ if (index == leng) {
|
|
|
+ this.isEnd = true;
|
|
|
+ }
|
|
|
+ this.titleMap[item.identifier] = item.fieldName;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // eslint-disable-next-line no-return-assign
|
|
|
- }).finally(() => this.loading = false)
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ // eslint-disable-next-line no-return-assign
|
|
|
},
|
|
|
// 加载动态表单的数据-函数
|
|
|
- getCommList(fieldObj){
|
|
|
- modelingCenterApi.formCommList({comboxUrl: fieldObj.comboxUrl}).then(res => {
|
|
|
- res = res.data
|
|
|
- console.log("动态表单的数据:", res)
|
|
|
- if(res.isSuccess){
|
|
|
- // 初始化,表单的数据
|
|
|
- this.commList[fieldObj.identifier] = res.data
|
|
|
- }
|
|
|
- })
|
|
|
- if(this.isEnd){
|
|
|
- this.commList.key++
|
|
|
- }
|
|
|
+ async getCommList(fieldObj) {
|
|
|
+ try {
|
|
|
+ let res = await modelingCenterApi.formCommList({
|
|
|
+ comboxUrl: fieldObj.comboxUrl,
|
|
|
+ });
|
|
|
+
|
|
|
+ res = res.data;
|
|
|
+ console.log("动态表单的数据:", res);
|
|
|
+ if (res.isSuccess) {
|
|
|
+ // 初始化,表单的数据
|
|
|
+ this.commList[fieldObj.identifier] = res.data;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.isEnd) {
|
|
|
+ this.commList.key++;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
},
|
|
|
// 获取工艺所有数据
|
|
|
- getList(){
|
|
|
- // 参数 bomVersionId 、bomId
|
|
|
- let obj = {
|
|
|
- bomId: this.processModeling.bomId, // 获取Bom产品的id
|
|
|
- bomVersionId: this.processModeling.id, // 获取版本id
|
|
|
- bizType: "0" // bizType = 0 ;是工艺版本的列表; 如果是1 的话,则是正式工艺的列表
|
|
|
- }
|
|
|
- technologyMgrApi.getList(obj).then(res => {
|
|
|
- res = res.data
|
|
|
- // console.log("所有数据:::", res)
|
|
|
- if(res.isSuccess){
|
|
|
- this.tableData.data = res.data.data
|
|
|
- }
|
|
|
- })
|
|
|
+ async getList() {
|
|
|
+ this.loading = true;
|
|
|
+ // 参数 bomVersionId 、bomId
|
|
|
+ try {
|
|
|
+ let obj = {
|
|
|
+ bomId: this.processModeling.bomId, // 获取Bom产品的id
|
|
|
+ bomVersionId: this.processModeling.id, // 获取版本id
|
|
|
+ bizType: "0", // bizType = 0 ;是工艺版本的列表; 如果是1 的话,则是正式工艺的列表
|
|
|
+ };
|
|
|
+ let res = await technologyMgrApi.getList(obj);
|
|
|
+ res = res.data;
|
|
|
+ // console.log("所有数据:::", res)
|
|
|
+ if (res.isSuccess) {
|
|
|
+ for (let i = 0, len = res.data.data.length; i < len; i++) {
|
|
|
+ let xh = Math.ceil((i + 1) / 4);
|
|
|
+ res.data.data[i].xh = res.data.data[i].opId || xh;
|
|
|
+ res.data.data[i].index = i + 1;
|
|
|
+ }
|
|
|
+ // return;
|
|
|
+ let arr = res.data.data.map((ele) => ele.xh);
|
|
|
+ arr = Array.from(new Set(arr));
|
|
|
+ arr = arr.map((xh) => ({ xh }));
|
|
|
+ for (let item of arr) {
|
|
|
+ item.children = res.data.data.filter((ele) => ele.xh == item.xh);
|
|
|
+ item.children[2].isadd = true;
|
|
|
+
|
|
|
+ item.children[1].isinput = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.tableData.data = res.data.data;
|
|
|
+
|
|
|
+ if (this.tableData.data == "") {
|
|
|
+ this.$nextTick(() => this.add());
|
|
|
+ } else {
|
|
|
+ this.getSpanArr(this.tableData.data);
|
|
|
+ }
|
|
|
+
|
|
|
+ // console.log(arr);
|
|
|
+ // this.tableData.data = arr;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
- cellClick (row, column) {
|
|
|
- if (column['columnKey'] === "operation") {
|
|
|
- return
|
|
|
+ cellClick(row, column, cell, event) {
|
|
|
+ let flag1 = this.tableData.data.some((ele) => ele.xh > row.xh);
|
|
|
+ if (
|
|
|
+ column["columnKey"] === "operation" ||
|
|
|
+ column["columnKey"] === "operation1"
|
|
|
+ ) {
|
|
|
+ if (column["columnKey"] === "operation1") this.domDelete(row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (column["columnKey"] === "index" && !flag1) {
|
|
|
+ this.add();
|
|
|
+ return;
|
|
|
}
|
|
|
- let flag = false
|
|
|
+ // let item = this.tableData.data.find(
|
|
|
+ // (ele) => ele.xh == row.xh && ele.name.includes("清洗")
|
|
|
+ // );
|
|
|
+
|
|
|
+ // if (column["columnKey"] === "index1" && item.index == row.index) {
|
|
|
+ // // alert(123);
|
|
|
+ // this.add1(row.xh, row.index);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (row.isadd) {
|
|
|
+ // // alert(123);
|
|
|
+ // this.add1(row.xh, row.index);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ let flag = false;
|
|
|
this.selection.forEach((item) => {
|
|
|
if (item.id === row.id) {
|
|
|
- flag = true
|
|
|
- this.$refs.table.toggleRowSelection(row)
|
|
|
+ flag = true;
|
|
|
+ this.$refs.table.toggleRowSelection(row);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
|
|
|
if (!flag) {
|
|
|
- this.$refs.table.toggleRowSelection(row, true)
|
|
|
+ this.$refs.table.toggleRowSelection(row, true);
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
- .star {
|
|
|
- color: #F56C6C;
|
|
|
- font-size: 14px;
|
|
|
- margin-right: 4px;
|
|
|
- }
|
|
|
+.star {
|
|
|
+ color: #f56c6c;
|
|
|
+ font-size: 14px;
|
|
|
+ margin-right: 4px;
|
|
|
+}
|
|
|
</style>
|