Parcourir la source

1.部分问题修改;

zhaoxing il y a 1 an
Parent
commit
125e348651

+ 1 - 1
imcs-ui/.env.development

@@ -10,7 +10,7 @@ VUE_APP_WS_URL = 'ws://127.0.0.1:8764/ws/'
 #VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://localhost:8764'
 #VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://tangyh.top:10000'
 # SpringBoot 项目使用这个
-VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://127.0.0.1:8764'
+VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://106.14.142.95:8765/
 
 # 请求域名前缀, 该变量仅仅生产环境需要设置
 VUE_APP_PROD_REQUEST_DOMAIN_PREFIX = ''

+ 3 - 3
imcs-ui/.env.production

@@ -6,11 +6,11 @@ VUE_APP_WS_URL = 'ws://192.168.170.32:8764/ws/'
 
 VUE_APP_PROJECT_NAME = 'imcs-ui'
 # 开发环境请求域名前缀, 该变量仅仅开发环境需要设置
-VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://192.168.170.32/'
+#VUE_APP_DEV_REQUEST_DOMAIN_PREFIX = 'http://192.168.170.32/'
 # 请求域名前缀, 该变量仅仅生产环境需要设置
-VUE_APP_PROD_REQUEST_DOMAIN_PREFIX = 'http://192.168.170.32/'
+VUE_APP_PROD_REQUEST_DOMAIN_PREFIX = 'http://106.14.142.95:8765'
 # 本地打包测试需要,
-VUE_APP_PROD_REQUEST_DOMAIN_LOCAL = 'http://localhost:8764'
+#VUE_APP_PROD_REQUEST_DOMAIN_LOCAL = 'http://localhost:8764'
 
 # base api
 VUE_APP_BASE_API = '/api'

+ 5 - 3
imcs-ui/package.json

@@ -43,6 +43,7 @@
     "file-saver": "2.0.1",
     "fuse.js": "3.4.4",
     "gsap": "^3.10.2",
+    "js-base64": "^3.7.5",
     "jsbarcode": "^3.11.3",
     "jsonlint": "1.6.3",
     "jszip": "^3.7.1",
@@ -55,9 +56,10 @@
     "sortablejs": "1.8.4",
     "spark-md5": "^3.0.1",
     "tui-editor": "1.3.3",
-    "vue": "2.6.10",
+    "vue": "^2.6.10",
     "vue-count-to": "^1.0.13",
     "vue-echarts": "^6.0.0-rc.5",
+    "vue-fullscreen": "^2.6.1",
     "vue-i18n": "7.3.2",
     "vue-lazyload": "^1.3.3",
     "vue-print-nb": "^1.6.0",
@@ -95,8 +97,8 @@
     "less-loader": "^5.0.0",
     "lint-staged": "8.1.5",
     "mockjs": "1.0.1-beta3",
-    "node-sass": "^4.14.1",
-    "sass-loader": "^7.1.0",
+    "node-sass": "6.0.1",
+    "sass-loader": "^10.0.1",
     "plop": "2.3.0",
     "pug": "^3.0.2",
     "pug-plain-loader": "^1.1.0",

+ 3 - 2
imcs-ui/src/views/zuihou/prepareProductMgr/frockMgr/components/Edit.vue

@@ -47,7 +47,7 @@
 <!--        </el-select>-->
 <!--      </el-form-item>-->
       <el-form-item :label='$t("prepare.table.tools.materialType")+":"' prop="materialType">
-        <el-input v-model="tenant.materialType" :placeholder='$t("common.pleaseEnter")'/>
+        <el-input :disabled="true" v-model="tenant.materialType" :placeholder='$t("common.pleaseEnter")'/>
       </el-form-item>
       <el-form-item :label='$t("prepare.table.tools.mapNo")+":"' prop="mapNo">
         <el-input v-model="tenant.mapNo" :placeholder='$t("common.pleaseEnter")'/>
@@ -338,7 +338,8 @@ export default {
         status: '1',
         period:12,
         expiryDate:12,
-        num:1
+        num:1,
+        materialType:"夹具"
       }
     },
 

+ 1 - 0
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/TechnologyEdit.vue

@@ -8,6 +8,7 @@
   	width="90%"
   	top="50px"
   >
+  
     <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
 		<el-row :gutter="20">
 		  <el-col :span="4">

+ 873 - 380
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/technologyMgr/index.vue

@@ -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>

+ 284 - 272
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/trayForm/components/Edit.vue

@@ -1,17 +1,9 @@
 <template>
-  <el-dialog
-  	:close-on-click-modal="false"
-  	:close-on-press-escape="false"
-  	:title="title"
-  	:append-to-body="true"
-  	:visible.sync="isVisible"
-  	width="960px"
-  	top="50px"
-  >
+  <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :title="title" :append-to-body="true" :visible.sync="isVisible" width="60%" top="50px">
     <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
 
-    	<!-- 搜索模块 -->
-	    <!--<div class="filter-container">
+      <!-- 搜索模块 -->
+      <!--<div class="filter-container">
 	    	<span>
 	    		<span>{{$t("prepare.searchForm.model")}}:</span>
 	    		<el-input v-model="queryParams.model.specification" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
@@ -31,59 +23,60 @@
 		      </el-button>
 	      </span>
 	    </div>-->
+      <div class="filter-container" style="mnargin-bottpm:15px">
+        <span>
+          <span>{{$t("prepare.table.tools.no")}}:</span>
+          <el-input v-model="queryParams.model.no" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium" />
+        </span>
+        <span style="margin-left: 15px;">
+          <span>{{$t("prepare.table.tools.materialType")}}:</span>
+          <el-input v-model="queryParams.model.materialType" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium" />
+        </span>
+        <span style="margin-left: 15px;">
+          <span>{{$t("prepare.table.tools.name")}}:</span>
+          <el-input v-model="queryParams.model.name" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium" />
+        </span>
+        <span style="margin-left: 15px;">
+          <span>{{$t("prepare.searchForm.status")}}:</span>
+          <el-select v-model="queryParams.model.status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 120px;">
+            <el-option v-for="item in audioStatus" :key="item.value" :label="item.label" :value="item.value">
+            </el-option>
+          </el-select>
+        </span>
+        <span style="margin-left: 15px;">
+          <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
+            {{ $t("table.search") }}
+          </el-button>
+          <el-button plain type="warning" icon="el-icon-refresh" size="medium" @click="reset">
+            {{ $t("table.reset") }}
+          </el-button>
+        </span>
+      </div>
+      <!-- 列表数据 -->
+      <el-table :key="tableKey" ref="table" v-loading="loading" :data="tableData.records" 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 prop="no" :label='$t("prepare.table.tools.no")' :show-overflow-tooltip="true"></el-table-column>
+        <el-table-column prop="name" :label='$t("prepare.table.tools.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
+        <el-table-column prop="materialType" label='物料类型' :show-overflow-tooltip="true" width="100px"></el-table-column>
+        <el-table-column prop="brand.data" :label='$t("prepare.table.tools.brand")' :show-overflow-tooltip="true" width="180px"></el-table-column>
+        <el-table-column :label="$t('table.operation')" fixed="right" align="center" column-key="operation" width="100px">
+          <template slot-scope="{ row }">
+            <el-tooltip class="item" :content='$t("common.selected")' effect="dark" placement="top-start">
+              <i class="el-icon-check table-operation" style="color: #2db7f5;" @click="selected(row)"><span style="margin-left: 5px;">{{$t("common.selected")}}</span></i>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
 
-	    <!-- 列表数据 -->
-	    <el-table
-	      :key="tableKey"
-	      ref="table"
-	      v-loading="loading"
-	      :data="tableData.records"
-	      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 prop="no" :label='$t("prepare.table.tools.no")' :show-overflow-tooltip="true"></el-table-column>
-	      <el-table-column prop="name" :label='$t("prepare.table.tools.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
-	      <el-table-column prop="materialType" label='物料类型' :show-overflow-tooltip="true" width="100px"></el-table-column>
-	      <el-table-column prop="brand.data" :label='$t("prepare.table.tools.brand")' :show-overflow-tooltip="true" width="180px"></el-table-column>
-	    	<el-table-column
-	        :label="$t('table.operation')"
-	        fixed="right"
-	        align="center"
-	        column-key="operation"
-	        width="100px"
-	      >
-	        <template slot-scope="{ row }">
-	          <el-tooltip class="item" :content='$t("common.selected")' effect="dark" placement="top-start">
-		          <i
-		            class="el-icon-check table-operation"
-		            style="color: #2db7f5;"
-		            @click="selected(row)"
-		          ><span style="margin-left: 5px;">{{$t("common.selected")}}</span></i>
-	          </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="mToolPageList"
-	    />
+      <!-- 【分页组件】-->
+      <pagination v-show="tableData.total > 0" :limit.sync="queryParams.size" :page.sync="queryParams.current" :total="Number(tableData.total)" @pagination="mToolPageList" />
 
     </el-form>
     <div slot="footer" class="dialog-footer">
@@ -94,47 +87,48 @@
 </template>
 <script>
 // 【夹具管理】-API
-import trayMgrApi from "@/api/prepareProductMgr/trayMgr"
+import trayMgrApi from "@/api/prepareProductMgr/trayMgr";
 // 【分页】组件
-import Pagination from "@/components/Pagination"
+import Pagination from "@/components/Pagination";
 // 【工具原材料管理】-API
-import toolsMaterialApi from "@/api/prepareProductMgr/toolsMaterial"
+import toolsMaterialApi from "@/api/prepareProductMgr/toolsMaterial";
 // 【共通】函数
-import { initQueryParams, initDicts } from '@/utils/commons'
+import { initQueryParams, initDicts } from "@/utils/commons";
 export default {
-  name: 'TenantEdit',
+  name: "TenantEdit",
   components: { Pagination },
   props: {
     dialogVisible: {
       type: Boolean,
-      default: false
+      default: false,
     },
     title: {
       type: String,
-      default: ''
-    }
+      default: "",
+    },
   },
-  data () {
+  data() {
     return {
-    	audioStatus: [],
-    	brand: {
-      	key: ''
+      audioStatus: [],
+      brand: {
+        key: "",
       },
-      category: {   //  02:夹具,03:托盘,04:原材料
-      	key: '02'
+      category: {
+        //  02:夹具,03:托盘,04:原材料
+        key: "02",
       },
       dicts: {
-	      METERIAL_BRAND: {},  //工具材料品牌
-	      METERIAL_CATEGORY: {}  //工具材料分类
-	    },
-    	queryParams: initQueryParams({}),
-    	selection: [],
-    	loading: false,
-    	tableKey: 0,
-      type: 'add',
-      keys: '',
+        METERIAL_BRAND: {}, //工具材料品牌
+        METERIAL_CATEGORY: {}, //工具材料分类
+      },
+      queryParams: initQueryParams({}),
+      selection: [],
+      loading: false,
+      tableKey: 0,
+      type: "add",
+      keys: "",
       tableData: {
-        total: 0
+        total: 0,
       },
       tenant: this.initTenant(),
       screenWidth: 0,
@@ -143,244 +137,256 @@ export default {
       roles: [],
       rules: {
         name: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
-        ]
-      }
-    }
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+        ],
+      },
+    };
   },
   // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
   created() {
-  	// 调用常量-审核状态
-	  this.audioStatus = this.$constWKS.STATUSORTHERLIST
-  	// 加载【字典】
-	  initDicts(['METERIAL_BRAND', 'METERIAL_CATEGORY'], this.dicts);
-  	// 加载列表数据
-  	// this.fetch();
-  	// 加载夹具数据
-  	this.mToolPageList();
-	},
+    // 调用常量-审核状态
+    this.audioStatus = this.$constWKS.STATUSORTHERLIST;
+    // 加载【字典】
+    initDicts(["METERIAL_BRAND", "METERIAL_CATEGORY"], this.dicts);
+    // 加载列表数据
+    // this.fetch();
+    // 加载夹具数据
+    this.mToolPageList();
+  },
   computed: {
     isVisible: {
-      get () {
-        return this.dialogVisible
+      get() {
+        return this.dialogVisible;
       },
-      set () {
-        this.close()
-        this.reset()
-      }
-    }
+      set() {
+        this.close();
+        this.reset();
+      },
+    },
   },
-  mounted () {
+  mounted() {
     window.onresize = () => {
       return (() => {
-        this.width = this.initWidth()
-      })()
-    }
+        this.width = this.initWidth();
+      })();
+    };
   },
   methods: {
-  	 // 【选择】按钮-事件
-    selected(row){
-    	// 赋值数据
-      this.giveParent(row)
+    // 【选择】按钮-事件
+    selected(row) {
+      // 赋值数据
+      this.giveParent(row);
     },
     // 【确定】按钮-事件
-    submitForm () {
-    	if (this.selection.length <= 0) {
+    submitForm() {
+      if (this.selection.length <= 0) {
         this.$message({
           message: this.$t("tips.noDataSelected"),
-          type: "warning"
-        })
-        return
+          type: "warning",
+        });
+        return;
       }
-    	if (this.selection.length > 1) {
+      if (this.selection.length > 1) {
         this.$message({
           message: this.$t("tips.mustOne"),
-          type: "warning"
-        })
-        return
+          type: "warning",
+        });
+        return;
       }
-    	// console.log("表单数据:", this.tenant)
+      // console.log("表单数据:", this.tenant)
       this.$refs.form.validate((valid) => {
         if (valid) {
-        	// 赋值数据
-        	this.giveParent(this.selection[0])
+          // 赋值数据
+          this.giveParent(this.selection[0]);
         } else {
-          return false
+          return false;
         }
-      })
+      });
     },
     // 把【选择、确定】的数据给父组件
-    giveParent(obj){
-    	console.log("列表的数据111:", obj);
-    	if(this.type == "add"){
-    		// 赋值唯一值
-    		obj.key = ''+ Math.random();
-    	} else {
-    		obj.key = this.keys;
-    	}
-    	// 夹具唯一id
-    	obj.trayId = obj.id
-	    // 把选择的数据提交到父组件
-	    this.$emit("success", JSON.stringify(obj), this.type);
-	    // 关闭弹出框
-	    this.$emit("close")
+    giveParent(obj) {
+      console.log("列表的数据111:", obj);
+      if (this.type == "add") {
+        // 赋值唯一值
+        obj.key = "" + Math.random();
+      } else {
+        obj.key = this.keys;
+      }
+      // 夹具唯一id
+      obj.trayId = obj.id;
+      // 把选择的数据提交到父组件
+      this.$emit("success", JSON.stringify(obj), this.type);
+      // 关闭弹出框
+      this.$emit("close");
     },
     // 【搜索】按钮-事件
-    search () {
+    search() {
       this.fetch({
-        ...this.queryParams
-      })
+        ...this.queryParams,
+      });
     },
     // Table的选择事件
-    onSelectChange (selection) {
-      this.selection = selection
+    onSelectChange(selection) {
+      this.selection = selection;
     },
-    cellClick (row, column) {
-      if (column['columnKey'] === "operation") {
-        return
+    cellClick(row, column) {
+      if (column["columnKey"] === "operation") {
+        return;
       }
-      let flag = false
+      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);
       }
     },
     // 【修改】按钮事件
-    edit(row){
-    	let list = new Array();
-    	this.tableData.forEach((item, index) => {
-    		// 当前编辑行
-    		if(!!item.id && item.id == row.id){
-    			item.isEdit = true
-    		}
-    		list.push(item)
-    	})
-    	// 赋值给当前
-    	this.tableData = list
+    edit(row) {
+      let list = new Array();
+      this.tableData.forEach((item, index) => {
+        // 当前编辑行
+        if (!!item.id && item.id == row.id) {
+          item.isEdit = true;
+        }
+        list.push(item);
+      });
+      // 赋值给当前
+      this.tableData = list;
     },
-    initTenant () {
+    initTenant() {
       return {
-      	model: '',
-        name: '',
+        model: "",
+        name: "",
         category: {
-          key: ''
+          key: "",
         },
         brand: {
-          key: ''
+          key: "",
         },
-        status: '1'
-      }
+        status: "1",
+      };
     },
-    initWidth () {
-      this.screenWidth = document.body.clientWidth
+    initWidth() {
+      this.screenWidth = document.body.clientWidth;
       if (this.screenWidth < 991) {
-        return '90%'
+        return "90%";
       } else if (this.screenWidth < 1400) {
-        return '45%'
+        return "45%";
       } else {
-        return '800px'
+        return "800px";
       }
     },
-    setTenant (val) {
-    	if(val){
-    		this.tenant = { ...val }
-    	}
+    setTenant(val) {
+      if (val) {
+        this.tenant = { ...val };
+      }
     },
-    close () {
-      this.$emit('close')
+    close() {
+      this.$emit("close");
     },
     // 【重置】按钮-事件
-    reset () {
-    	// 初始化表单
-      this.queryParams = initQueryParams({})
+    reset() {
+      // 初始化表单
+      this.queryParams = initQueryParams({});
       // 清空列表选中的数据
-      this.$refs.table.clearSelection()
+      this.$refs.table.clearSelection();
     },
-    submitForm () {
-    	if (!this.selection.length) {
+    submitForm() {
+      if (!this.selection.length) {
         this.$message({
           message: this.$t("tips.noDataSelected"),
-          type: "warning"
-        })
-        return
+          type: "warning",
+        });
+        return;
       }
-    	if (this.selection.length > 1) {
+      if (this.selection.length > 1) {
         this.$message({
           message: this.$t("tips.mustOne"),
-          type: "warning"
-        })
-        return
+          type: "warning",
+        });
+        return;
       }
-    	// 【选择】按钮-事件
-    	this.giveParent(this.selection[0])
-    	/*// 把选择的数据提交到父组件
+      // 【选择】按钮-事件
+      this.giveParent(this.selection[0]);
+      /*// 把选择的数据提交到父组件
     	this.$emit("success", this.selection)
     	// 关闭弹出框
     	this.isVisible = false*/
     },
-    save () {
-      trayMgrApi.save(this.tenant)
+    save() {
+      trayMgrApi
+        .save(this.tenant)
         .then((response) => {
-          const res = response.data
+          const res = response.data;
           if (res.isSuccess) {
-            this.isVisible = false
+            this.isVisible = false;
             this.$message({
-              message: this.$t('tips.createSuccess'),
-              type: 'success'
-            })
+              message: this.$t("tips.createSuccess"),
+              type: "success",
+            });
             // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
+            this.$emit("success");
+            // 通知列表-并关闭弹出框
+            this.$emit("close");
           }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
         })
+        .finally(() => {
+          this.confirmDisabled = false;
+          return true;
+        });
     },
-    update () {
-      trayMgrApi.update(this.tenant)
+    update() {
+      trayMgrApi
+        .update(this.tenant)
         .then((response) => {
-          const res = response.data
+          const res = response.data;
           if (res.isSuccess) {
-            this.isVisible = false
+            this.isVisible = false;
             this.$message({
-              message: this.$t('tips.updateSuccess'),
-              type: 'success'
-            })
+              message: this.$t("tips.updateSuccess"),
+              type: "success",
+            });
             // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
+            this.$emit("success");
+            // 通知列表-并关闭弹出框
+            this.$emit("close");
           }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
         })
+        .finally(() => {
+          this.confirmDisabled = false;
+          return true;
+        });
     },
 
     // 工装夹具列表
     mToolPageList(params = {}) {
-    	this.loading = true
-			// 分页信息
-      this.queryParams.current = params.current ? params.current : this.queryParams.current;
+      this.loading = true;
+      // 分页信息
+      this.queryParams.current = params.current
+        ? params.current
+        : this.queryParams.current;
       this.queryParams.size = params.size ? params.size : this.queryParams.size;
       // 搜索条件添加
       //this.queryParams.model.brand = this.brand;
       // 分类,【原材料】固定,查询原材,分类就是:04
       //this.queryParams.model.category = this.category;
-      trayMgrApi.mToolPageList(this.queryParams).then(response => {
-        const res = response.data;
-        console.log("工装夹具列表 = ", res);
-        if (res.isSuccess) {
-        	// 数据存在,规格改成下拉数据结构
-        	/*if(res.data.records && res.data.records.length > 0){
+      trayMgrApi
+        .mToolPageList(this.queryParams)
+        .then((response) => {
+          const res = response.data;
+          console.log("工装夹具列表 = ", res);
+          if (res.isSuccess) {
+            // 数据存在,规格改成下拉数据结构
+            /*if(res.data.records && res.data.records.length > 0){
         		res.data.records.forEach((item, index) => {
         			// 如果规格存在
         			if(!!item.specification){
@@ -390,45 +396,51 @@ export default {
         			}
         		})
         	}*/
-          this.tableData = res.data;
-        }
-        // eslint-disable-next-line no-return-assign
-      }).finally(() => this.loading = false)
+            this.tableData = res.data;
+          }
+          // eslint-disable-next-line no-return-assign
+        })
+        .finally(() => (this.loading = false));
     },
 
     // 夹具分页列表
-    fetch (params = {}) {
-      this.loading = true
-			// 分页信息
-      this.queryParams.current = params.current ? params.current : this.queryParams.current
-      this.queryParams.size = params.size ? params.size : this.queryParams.size
+    fetch(params = {}) {
+      this.loading = true;
+      // 分页信息
+      this.queryParams.current = params.current
+        ? params.current
+        : this.queryParams.current;
+      this.queryParams.size = params.size ? params.size : this.queryParams.size;
       // 搜索条件添加
-      this.queryParams.model.brand = this.brand
+      this.queryParams.model.brand = this.brand;
       // 分类,【原材料】固定,查询原材,分类就是:04
-      this.queryParams.model.category = this.category
+      this.queryParams.model.category = this.category;
 
-      toolsMaterialApi.page(this.queryParams).then(response => {
-        const res = response.data
-        if (res.isSuccess) {
-        	// 数据存在,规格改成下拉数据结构
-        	if(res.data.records && res.data.records.length > 0){
-        		res.data.records.forEach((item, index) => {
-        			console.log("ddddd = ", item)
-        			// 如果规格存在
-        			if(!!item.specification){
-        				let arr = item.specification.split(",")
-        				// 赋值一个新数组属性,供列表使用
-        				item.spList = arr
-        			}
-        		})
-        	}
-          this.tableData = res.data
-        }
-        // eslint-disable-next-line no-return-assign
-      }).finally(() => this.loading = false)
+      toolsMaterialApi
+        .page(this.queryParams)
+        .then((response) => {
+          const res = response.data;
+          if (res.isSuccess) {
+            // 数据存在,规格改成下拉数据结构
+            if (res.data.records && res.data.records.length > 0) {
+              res.data.records.forEach((item, index) => {
+                console.log("ddddd = ", item);
+                // 如果规格存在
+                if (!!item.specification) {
+                  let arr = item.specification.split(",");
+                  // 赋值一个新数组属性,供列表使用
+                  item.spList = arr;
+                }
+              });
+            }
+            this.tableData = res.data;
+          }
+          // eslint-disable-next-line no-return-assign
+        })
+        .finally(() => (this.loading = false));
     },
-  }
-}
+  },
+};
 </script>
 <style lang="scss" >
 .avatar-uploader .el-upload {
@@ -454,9 +466,9 @@ export default {
   height: 100px;
   display: block;
 }
-.checkUsed{
-	display: inline-block;
-	margin-left: 10px;
-	color: #1890ff;
+.checkUsed {
+  display: inline-block;
+  margin-left: 10px;
+  color: #1890ff;
 }
 </style>

+ 239 - 235
imcs-ui/src/views/zuihou/prepareProductMgr/trayMgr/components/Edit.vue

@@ -1,75 +1,53 @@
 <template>
-  <el-dialog
-  	:close-on-click-modal="false"
-  	:close-on-press-escape="false"
-  	:title="title"
-  	:append-to-body="true"
-  	:visible.sync="isVisible"
-  	:width="width"
-  	top="50px"
-  >
+  <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :title="title" :append-to-body="true" :visible.sync="isVisible" :width="width" top="50px">
     <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
-    	<!--所属产线-->
+      <!--所属产线-->
       <el-form-item v-if="$store.state.account.user.roles.indexOf('舱体') < 0 && $store.state.account.user.roles.indexOf('框体') < 0" label='所属产线:' prop="zoneId">
-        <el-select
-          v-model="tenant.zoneId"
-           :placeholder='$t("common.pleaseSelect")'
-           :disabled="this.type=='edit'"
-          style="width: 50%"
-        >
-          <el-option
-            v-for="(item, index) in zoneList"
-            :key="index"
-            :label="item.name"
-            :value="item.id"
-          />
+        <el-select v-model="tenant.zoneId" :placeholder='$t("common.pleaseSelect")' :disabled="this.type=='edit'" style="width: 50%">
+          <el-option v-for="(item, index) in zoneList" :key="index" :label="item.name" :value="item.id" />
         </el-select>
       </el-form-item>
       <!--编码-->
       <el-form-item :label='$t("prepare.table.tray.no")+":"' prop="no">
-        <el-input v-model="tenant.no" :placeholder='$t("common.pleaseEnter")'/>
+        <el-input v-model="tenant.no" :placeholder='$t("common.pleaseEnter")' />
       </el-form-item>
       <!--名称-->
       <el-form-item :label='$t("prepare.table.tray.name")+":"' prop="name">
-        <el-input v-model="tenant.name" :placeholder='$t("common.pleaseEnter")'/>
+        <el-input v-model="tenant.name" :placeholder='$t("common.pleaseEnter")' />
       </el-form-item>
       <!--物料类型-->
       <el-form-item :label='$t("prepare.table.tray.materialType")+":"' prop="materialType">
-        <el-input v-model="tenant.materialType" :placeholder='$t("common.pleaseEnter")'/>
+        <el-input :disabled="true" v-model="tenant.materialType" :placeholder='$t("common.pleaseEnter")' />
       </el-form-item>
       <el-form-item :label="$t('prepare.table.tray.productionType')" prop="productionType">
-        <el-select style="width:100%"  :placeholder="$t('prepare.table.tray.productionType')" v-model="tenant.productionType.key" value>
+        <el-select style="width:100%" :placeholder="$t('prepare.table.tray.productionType')" v-model="tenant.productionType.key" value>
           <el-option :key="index" :label="item" :value="key" v-for="(item, key, index) in dicts.BUSINESS_PRODUCT_TYPE" />
         </el-select>
       </el-form-item>
       <el-form-item :label="$t('prepare.table.tray.categoryType')" prop="categoryType">
-        <el-select style="width:100%"  :placeholder="$t('prepare.table.tray.categoryType')" v-model="tenant.categoryType.key" value>
+        <el-select style="width:100%" :placeholder="$t('prepare.table.tray.categoryType')" v-model="tenant.categoryType.key" value>
           <el-option :key="index" :label="item" :value="key" v-for="(item, key, index) in dicts.TRAY_CATEGORY_TYPE" />
         </el-select>
       </el-form-item>
-<!--      &lt;!&ndash;品牌&ndash;&gt;-->
-<!--    	<el-form-item :label='$t("prepare.table.tray.brand")+":"' prop="brand">-->
-<!--      	<el-select style="width:100%" :placeholder='$t("common.pleaseSelect")' v-model="tenant.brand.key" value>-->
-<!--          <el-option :key="index" :label="item" :value="key" v-for="(item, key, index) in dicts.METERIAL_BRAND" />-->
-<!--        </el-select>-->
-<!--      </el-form-item>-->
+      <!--      &lt;!&ndash;品牌&ndash;&gt;-->
+      <!--    	<el-form-item :label='$t("prepare.table.tray.brand")+":"' prop="brand">-->
+      <!--      	<el-select style="width:100%" :placeholder='$t("common.pleaseSelect")' v-model="tenant.brand.key" value>-->
+      <!--          <el-option :key="index" :label="item" :value="key" v-for="(item, key, index) in dicts.METERIAL_BRAND" />-->
+      <!--        </el-select>-->
+      <!--      </el-form-item>-->
       <!--生产分厂/制造商-->
       <el-form-item :label='$t("prepare.table.tray.fiveAxis")+":"' prop="fiveAxis">
         <template>
-				  <el-radio v-model="tenant.fiveAxis" :label="0">{{$t("common.no")}}</el-radio>
-				  <el-radio v-model="tenant.fiveAxis" :label="1">{{$t("common.yes")}}</el-radio>
-				</template>
+          <el-radio v-model="tenant.fiveAxis" :label="0">{{$t("common.no")}}</el-radio>
+          <el-radio v-model="tenant.fiveAxis" :label="1">{{$t("common.yes")}}</el-radio>
+        </template>
       </el-form-item>
       <el-form-item :label='$t("prepare.table.tray.factory")+":"' prop="factory">
-        <el-input v-model="tenant.factory" :placeholder='$t("common.pleaseEnter")'/>
+        <el-input v-model="tenant.factory" :placeholder='$t("common.pleaseEnter")' />
       </el-form-item>
 
       <el-form-item :label='$t("prepare.table.tray.joinDate")+":"' prop="joinDate">
-        <el-date-picker
-          v-model="tenant.joinDate"
-          type="date"
-          value-format="yyyy-MM-dd"
-          placeholder="">
+        <el-date-picker v-model="tenant.joinDate" type="date" value-format="yyyy-MM-dd" placeholder="">
         </el-date-picker>
       </el-form-item>
       <el-form-item :label='$t("prepare.table.tray.period")+":"' prop="period">
@@ -83,9 +61,9 @@
       </el-form-item>
       <el-form-item :label='$t("prepare.table.tools.status")+":"' prop="status">
         <template>
-				  <el-radio v-model="tenant.status" label="1">{{$t("common.status.valid")}}</el-radio>
-				  <el-radio v-model="tenant.status" label="0">{{$t("common.frozen")}}</el-radio>
-				</template>
+          <el-radio v-model="tenant.status" label="1">{{$t("common.status.valid")}}</el-radio>
+          <el-radio v-model="tenant.status" label="0">{{$t("common.frozen")}}</el-radio>
+        </template>
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer">
@@ -96,27 +74,27 @@
 </template>
 <script>
 // 【夹具管理】-API
-import trayMgrApi from "@/api/prepareProductMgr/trayMgr"
+import trayMgrApi from "@/api/prepareProductMgr/trayMgr";
 //【所属产线】-API
-import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
-import { initDicts } from '@/utils/commons'
-import {convertEnum} from "@/utils/utils"
+import areaMgrApi from "@/api/resourceProductMgr/areaMgr";
+import { initDicts } from "@/utils/commons";
+import { convertEnum } from "@/utils/utils";
 export default {
-  name: 'TenantEdit',
+  name: "TenantEdit",
   props: {
     dialogVisible: {
       type: Boolean,
-      default: false
+      default: false,
     },
     title: {
       type: String,
-      default: ''
-    }
+      default: "",
+    },
   },
-  data () {
+  data() {
     return {
-    	loading: false,
-      type: 'add',
+      loading: false,
+      type: "add",
       zoneList: [],
       tableData: [],
       oldVal: {},
@@ -127,97 +105,115 @@ export default {
       dicts: {
         BUSINESS_PRODUCT_TYPE: {},
         TRAY_CATEGORY_TYPE: {},
-	      METERIAL_BRAND: {} //工具材料品牌
-	    },
+        METERIAL_BRAND: {}, //工具材料品牌
+      },
       roles: [],
       rules: {
         name: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' },
-           { validator: (rule, value, callback) => {		
-				    if(this.type === "edit" && value === this.oldVal.name){
-        			return callback()
-      			}			 
-            if (value.trim().length > 0) {					
-                  trayMgrApi.checkField({"name":value})
-                    .then((response) => {
-                      const res = response.data
-                      if (res.data) {
-                        callback('托盘名称重复')
-                      } else {
-                        callback()
-                      }
-                    })
-                } else {
-                  callback()
-                }                
-               }, trigger: 'blur'
-            }
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+          {
+            validator: (rule, value, callback) => {
+              if (this.type === "edit" && value === this.oldVal.name) {
+                return callback();
+              }
+              if (value.trim().length > 0) {
+                trayMgrApi.checkField({ name: value }).then((response) => {
+                  const res = response.data;
+                  if (res.data) {
+                    callback("托盘名称重复");
+                  } else {
+                    callback();
+                  }
+                });
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur",
+          },
         ],
         zoneId: [
-          { required: true, message: this.$t("rules.require"), trigger: 'blur' }
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
         ],
         no: [
-          { required: true, message: this.$t("rules.require"), trigger: 'blur' },
-          { validator: (rule, value, callback) => {		
-				    if(this.type === "edit" && value === this.oldVal.no){
-        			return callback()
-      			}			 
-            if (value.trim().length > 0) {					
-                  trayMgrApi.checkField({"no":value})
-                    .then((response) => {
-                      const res = response.data
-                      if (res.data) {
-                        callback('物料编码重复')
-                      } else {
-                        callback()
-                      }
-                    })
-                } else {
-                  callback()
-                }                
-               }, trigger: 'blur'
-            }
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+          {
+            validator: (rule, value, callback) => {
+              if (this.type === "edit" && value === this.oldVal.no) {
+                return callback();
+              }
+              if (value.trim().length > 0) {
+                trayMgrApi.checkField({ no: value }).then((response) => {
+                  const res = response.data;
+                  if (res.data) {
+                    callback("物料编码重复");
+                  } else {
+                    callback();
+                  }
+                });
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur",
+          },
         ],
         num: [
-          { required: true, message: this.$t("rules.require"), trigger: 'blur' }
-        ]
-      }
-    }
+          {
+            required: true,
+            message: this.$t("rules.require"),
+            trigger: "blur",
+          },
+        ],
+      },
+    };
   },
   // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
   created() {
     // 加载列表数据
-    this.getZoneList()    
+    this.getZoneList();
   },
   computed: {
     isVisible: {
-      get () {
-        return this.dialogVisible
+      get() {
+        return this.dialogVisible;
       },
-      set () {
-        this.close()
-        this.reset()
-      }
-    }   
+      set() {
+        this.close();
+        this.reset();
+      },
+    },
   },
-  mounted () {
+  mounted() {
     window.onresize = () => {
       return (() => {
-        this.width = this.initWidth()
-      })()
-    }
+        this.width = this.initWidth();
+      })();
+    };
   },
   methods: {
-  	// 【新增】按钮-事件
-    addRes(){
+    // 【新增】按钮-事件
+    addRes() {
       this.tableData.push({
-      	key: "WKS_"+ Math.random(),
-      	id: '',
-      	positionSort: this.tableData.length + 1,
-      	size: '',
-      	remark: '',
-      	isEdit: true
-      })
+        key: "WKS_" + Math.random(),
+        id: "",
+        positionSort: this.tableData.length + 1,
+        size: "",
+        remark: "",
+        isEdit: true,
+      });
     },
 
     // 获取【所属产线】下拉数据
@@ -226,167 +222,175 @@ export default {
         res = res.data;
         if (res.isSuccess) {
           this.zoneList = res.data;
-          if(this.zoneList.length == 1){
-             this.zoneId = this.zoneList[0].id
+          if (this.zoneList.length == 1) {
+            this.zoneId = this.zoneList[0].id;
           }
         }
       });
     },
 
     // Table的选择事件
-    onSelectChange (selection) {
-      this.selection = selection
+    onSelectChange(selection) {
+      this.selection = selection;
     },
     // 【删除】按钮事件
-    singleDelete(row){
-    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
-      	distinguishCancelAndClose: true,
+    singleDelete(row) {
+      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(() => {
-      	// 过滤符合条件的数据
-      	let arr = this.tableData.filter(item => item.key != row.key || item.id != row.id)
-      	// 给数据排序
-    		arr.forEach((item, index) => {
-    			item.positionSort = index + 1
-    		})
-      	// 给新的数据赋值
-    		this.tableData = arr;
-
-      }).catch(() => {})
+        type: "warning",
+      })
+        .then(() => {
+          // 过滤符合条件的数据
+          let arr = this.tableData.filter(
+            (item) => item.key != row.key || item.id != row.id
+          );
+          // 给数据排序
+          arr.forEach((item, index) => {
+            item.positionSort = index + 1;
+          });
+          // 给新的数据赋值
+          this.tableData = arr;
+        })
+        .catch(() => {});
     },
     // 【修改】按钮事件
-    edit(row){
-    	let list = new Array();
-    	this.tableData.forEach((item, index) => {
-    		// 当前编辑行
-    		if(!!item.id && item.id == row.id){
-    			item.isEdit = true
-    		}
-    		list.push(item)
-    	})
-    	// 赋值给当前
-    	this.tableData = list
+    edit(row) {
+      let list = new Array();
+      this.tableData.forEach((item, index) => {
+        // 当前编辑行
+        if (!!item.id && item.id == row.id) {
+          item.isEdit = true;
+        }
+        list.push(item);
+      });
+      // 赋值给当前
+      this.tableData = list;
     },
-    initTenant () {
+    initTenant() {
       return {
-      	model: '',
-        name: '',
-        zoneId: '',
+        model: "",
+        name: "",
+        zoneId: "",
         category: {
-          key: ''
+          key: "",
         },
         productionType: {
-          key: ''
+          key: "",
         },
         categoryType: {
-          key: ''
+          key: "",
         },
         fiveAxis: 0,
-        status: '1',
-        num: '1'
-      }
+        status: "1",
+        num: "1",
+        materialType: "托盘",
+      };
     },
-    initWidth () {
-      this.screenWidth = document.body.clientWidth
+    initWidth() {
+      this.screenWidth = document.body.clientWidth;
       if (this.screenWidth < 991) {
-        return '90%'
+        return "90%";
       } else if (this.screenWidth < 1400) {
-        return '45%'
+        return "45%";
       } else {
-        return '800px'
+        return "800px";
       }
     },
-    setTenant (val, dicts) {
-    	if(val){
-    		this.tenant = { ...val }        
-    		// 根据id,查询规格列表数据
-    		this.getSpecsList(val)
-    	}
+    setTenant(val, dicts) {
+      if (val) {
+        this.tenant = { ...val };
+        // 根据id,查询规格列表数据
+        this.getSpecsList(val);
+      }
       // 字典表
-      this.dicts = dicts
-      this.oldVal = {...val }
+      this.dicts = dicts;
+      this.oldVal = { ...val };
     },
-    close () {
-      this.$emit('close')
+    close() {
+      this.$emit("close");
     },
-    reset () {
+    reset() {
       // 先清除校验,再清除表单,不然有奇怪的bug
-      this.$refs.form.clearValidate()
-      this.$refs.form.resetFields()
-      this.tenant = this.initTenant()
-      this.tableData = []  	//清空【规格】数据
+      this.$refs.form.clearValidate();
+      this.$refs.form.resetFields();
+      this.tenant = this.initTenant();
+      this.tableData = []; //清空【规格】数据
     },
-    submitForm () {
-    	// 添加夹紧位置数据
-    	this.tenant.trayPositionList = this.tableData
-    	//console.log("Form数据:", this.tenant)
+    submitForm() {
+      // 添加夹紧位置数据
+      this.tenant.trayPositionList = this.tableData;
+      //console.log("Form数据:", this.tenant)
       this.$refs.form.validate((valid) => {
         if (valid) {
-          this.confirmDisabled = true
-          if (this.type === 'add') {
-            this.save()
+          this.confirmDisabled = true;
+          if (this.type === "add") {
+            this.save();
           } else {
-            this.update()
+            this.update();
           }
         } else {
-          return false
+          return false;
         }
-      })
+      });
     },
-    save () {
-      trayMgrApi.save(this.tenant)
+    save() {
+      trayMgrApi
+        .save(this.tenant)
         .then((response) => {
-          const res = response.data
+          const res = response.data;
           if (res.isSuccess) {
-            this.isVisible = false
+            this.isVisible = false;
             this.$message({
-              message: this.$t('tips.createSuccess'),
-              type: 'success'
-            })
+              message: this.$t("tips.createSuccess"),
+              type: "success",
+            });
             // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
+            this.$emit("success");
+            // 通知列表-并关闭弹出框
+            this.$emit("close");
           }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
         })
+        .finally(() => {
+          this.confirmDisabled = false;
+          return true;
+        });
     },
-    update () {
-      trayMgrApi.update(this.tenant)
+    update() {
+      trayMgrApi
+        .update(this.tenant)
         .then((response) => {
-          const res = response.data
+          const res = response.data;
           if (res.isSuccess) {
-            this.isVisible = false
+            this.isVisible = false;
             this.$message({
-              message: this.$t('tips.updateSuccess'),
-              type: 'success'
-            })
+              message: this.$t("tips.updateSuccess"),
+              type: "success",
+            });
             // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
+            this.$emit("success");
+            // 通知列表-并关闭弹出框
+            this.$emit("close");
           }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
         })
+        .finally(() => {
+          this.confirmDisabled = false;
+          return true;
+        });
     },
     // 根据【托盘】的id,查询,夹紧位置列表数据
-    getSpecsList(row){
-    	trayMgrApi.listSpecs(row).then(res => {
-    		res = res.data
-    		// console.log("夹紧位置数据:", res)
-    		if(res.isSuccess){
-    			this.tableData = res.data
-    		}
-    	})
-    }
-  }
-}
+    getSpecsList(row) {
+      trayMgrApi.listSpecs(row).then((res) => {
+        res = res.data;
+        // console.log("夹紧位置数据:", res)
+        if (res.isSuccess) {
+          this.tableData = res.data;
+        }
+      });
+    },
+  },
+};
 </script>
 <style lang="scss" >
 .avatar-uploader .el-upload {
@@ -412,10 +416,10 @@ export default {
   height: 100px;
   display: block;
 }
-.checkUsed{
-	display: inline-block;
-	margin-left: 10px;
-	color: #1890ff;
+.checkUsed {
+  display: inline-block;
+  margin-left: 10px;
+  color: #1890ff;
 }
 </style>
 

+ 2 - 1
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/Index.vue

@@ -591,6 +591,7 @@ export default {
       // this.batchDelete()
     },
     updateOnline(row){
+      this.loading = true;
       let bool = row.onlineStatus=='0'? true : false
       let msg = bool? '上线处理成功,请确认是否自动模式状态':'下线处理成功'
       equipmentMgrApi.updateOnline({"ip":row.ip, "useState":bool}).then((response)=>{
@@ -603,7 +604,7 @@ export default {
           // 查询列表
           this.search();        
         }
-      });     
+      }).finally(() => (this.loading = false));
     },
     batchDelete() {
       /*if (!this.selection.length) {

+ 6 - 0
imcs-ui/src/views/zuihou/user/user/Edit.vue

@@ -339,8 +339,14 @@ export default {
     },
     setUser(val, orgs, dicts, enums) {
       const vm = this;
+     
       if (val) {
+        let stationkey=val.station.key
         vm.user = { ...val };
+        setTimeout(()=>{
+// 让监听组织更新回调重置岗位 之后才重设一次值
+this.user.station.key = stationkey;
+        })
 
       }
       vm.dicts = dicts;