node-modal.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  1. <!-- @desc:工艺流程工序弹窗 @auth:张潇木 @time:2023/1/5 9:35 -->
  2. <template>
  3. <div class="main-div" ref="node-modal-div" v-if="existsFlag">
  4. <DkModal
  5. :title="'工序 - '+nodeKindList.find(it => it.kindCode == nodeData.nodeKind)?.kindName"
  6. v-model="modalDisplay"
  7. :mask-closable="false"
  8. :loading="loading"
  9. draggable
  10. width="800"
  11. sticky
  12. @modalOk="modalOk"
  13. @modalCancel="modalCancel"
  14. @on-cancel="modalCancel"
  15. :saveFlag="isFromIndex">
  16. <DkTabs ref='tabs' :options="tabsOptions" v-model="currentTab" @on-click="changeTabs" style="margin: 10px 0;"/>
  17. <!-- {{ nodeData }}<br/>-->
  18. <!-- tab1 - 基本信息 -->
  19. <DkForm ref="formInline" v-if="currentTab =='tab1'" key="tab1" v-model="nodeData" :label-max-words="6" :colCount="2">
  20. <!-- 工序名称 -->
  21. <DkFormItem prop="nodeName" :required="true">
  22. <InputPop v-model="nodeData.nodeName" ref="nodeName"/>
  23. </DkFormItem>
  24. <!-- 显示顺序 -->
  25. <DkFormItem prop="displayNo" :required="true" :data-type="this.$config.dataType.number">
  26. <InputNumberPop v-model="nodeData.displayNo" ref="displayNo" :min="1" :digits="0"/>
  27. </DkFormItem>
  28. <!-- 流程类型 工艺工序-计件&&工序流程-结束,报损标识不可用(否)。其他可用) -->
  29. <DkFormItem prop="flowKind" key="flowKind" :required="true" v-if="nodeControl?.flowKind?.visible">
  30. <SelectPop ref="flowKind" v-model="nodeData.flowKind" label-key="kindName" value-key="kindCode"
  31. @on-select="handleSelectFlowKind"
  32. :multiple="false"
  33. :options="flowKindList.filter(it=>!(nodeControl?.flowKind?.invalidCode||[]).includes(it.kindCode))"/>
  34. </DkFormItem>
  35. <!-- 可判分级 -->
  36. <DkFormItem prop="judgeGradeIds" key="judgeGradeIds" :required="true" v-if="nodeControl?.judgeGradeIds?.visible" :data-type="$config.dataType.array">
  37. <MultiSelect v-model="nodeData.judgeGradeIds"
  38. main-field="defGradeId"
  39. main-field-text="【默认】"
  40. :mainFieldId="nodeData.defGradeId"
  41. @ok="chooseJudgeGradeIds"
  42. :default-value="judgeGradeDefaultValue"
  43. :check-auto-set-main-field="false"
  44. :type="$config.MagnifierType.judgeGrade"
  45. :other-condition="{flgValid: true,notInGradeKinds:[$config.gradeKind.damage],gradeTypes:[nodeData.nodeKind]}"/>
  46. </DkFormItem>
  47. <!-- 工号类型 -->
  48. <DkFormItem prop="userKind" key="userKind" :required="true" v-if="nodeControl?.userKind?.visible">
  49. <SelectPop ref="userKind" v-model="nodeData.userKind" label-key="kindName" value-key="kindCode"
  50. @on-select="changeUserKind"
  51. :multiple="false"
  52. :options="userKindList.filter(it=>!(nodeControl?.userKind?.invalidCode||[]).includes(it.kindCode))"/>
  53. </DkFormItem>
  54. <!-- 操作模式 -->
  55. <DkFormItem prop="opnKind" key="opnKind" :required="true" v-if="nodeControl?.opnKind?.visible">
  56. <SelectPop ref="opnKind" v-model="nodeData.opnKind" label-key="kindName" value-key="kindCode"
  57. @on-select="changeOpnKind"
  58. :multiple="false"
  59. :options="opnKindList.filter(it=>!(nodeControl?.opnKind?.invalidCode||[]).includes(it.kindCode))"/>
  60. </DkFormItem>
  61. <!-- 载具模式 -->
  62. <DkFormItem prop="carKind" key="carKind" :required="true" v-if="nodeControl?.carKind?.visible
  63. &&[$config.processType.dressKilnCar,$config.processType.exchangeKilnCar].includes(nodeData.opnKind)">
  64. <SelectPop ref="carKind" v-model="nodeData.carKind" label-key="kindName" value-key="kindCode" :multiple="false" :options="carKindList"/>
  65. </DkFormItem>
  66. <!-- 计件模式 -->
  67. <DkFormItem prop="pieceKind" key="pieceKind" :required="true" v-if="nodeControl?.pieceKind?.visible
  68. &&!([$config.nodeKind.outKiln,$config.nodeKind.inKiln].includes(nodeData.nodeKind)&&nodeData.opnKind==$config.processType.kilnCode)
  69. &&!($config.nodeKind.register==nodeData.nodeKind&&nodeData.opnKind!=$config.processType.productCode)">
  70. <SelectPop ref="pieceKind" v-model="nodeData.pieceKind" label-key="kindName" value-key="kindCode"
  71. :multiple="false"
  72. :options="pieceKindList.filter(it=>!(nodeControl?.pieceKind?.invalidCode||[]).includes(it.kindCode))"/>
  73. </DkFormItem>
  74. <!-- 回收到达 -->
  75. <DkFormItem prop="recycledKind" key="recycledKind" v-if="nodeControl?.recycledKind?.visible" :required="true">
  76. <SelectPop ref="recycledKind" v-model="nodeData.recycledKind" label-key="kindName" value-key="kindCode"
  77. :options="recycledKindList" :multiple="false" @on-select="changeRecycledKind"/>
  78. </DkFormItem>
  79. <!-- 回收分级 -->
  80. <DkFormItem prop="recycledGradeIds" key="recycledGradeIds" v-if="nodeControl?.recycledGradeIds?.visible">
  81. <SelectPop ref="recycledGradeIds" v-model="nodeData.recycledGradeIds" label-key="gradeName"
  82. value-key="gradeId" :multiple="true"
  83. :options="productGradeList.filter(it=>[$config.gradeKindType.decrease,$config.gradeKindType.inferior].includes(it.gradeKind))"/>
  84. </DkFormItem>
  85. <!-- 工序标签 -->
  86. <DkFormItem prop="nodeSysTags" key="nodeSysTags" v-if="nodeControl?.nodeSysTags?.visible">
  87. <SelectPop ref="nodeSysTags" v-model="nodeData.nodeSysTags" label-key="kindName" value-key="kindCode"
  88. :multiple="true"
  89. :options="nodeSysTagsList.filter(it=>!(nodeControl?.nodeSysTags?.invalidCode||[]).includes(it.kindCode))"/>
  90. </DkFormItem>
  91. <!-- 可用窑炉 -->
  92. <DkFormItem prop="kilnIds" key="kilnIds" v-if="nodeControl?.kilnIds?.visible">
  93. <SelectPop ref="kilnIds" v-model="nodeData.kilnIds" label-key="kilnName" value-key="uniqueId"
  94. :multiple="true" :options="kilnList"/>
  95. </DkFormItem>
  96. <!-- 生产车间 -->
  97. <DkFormItem prop="workShop" :data-type="$config.dataType.number">
  98. <SelectPop ref="workShop" v-model="nodeData.workShop" label-key="spaceName" value-key="spaceId"
  99. :multiple="false" :options="shopList"/>
  100. </DkFormItem>
  101. <!-- 备注 -->
  102. <DkFormItem prop="remarks" :span="24">
  103. <InputPop ref="remarks" v-model="nodeData.remarks"/>
  104. </DkFormItem>
  105. </DkForm>
  106. <!-- tab2 - 缺陷设置 -->
  107. <DkForm ref="formInline" v-if="currentTab =='tab2'" key="tab2" v-model="nodeData" :label-max-words="6" :colCount="2">
  108. <!-- 产生缺陷 -->
  109. <DkFormItem prop="flgJobDefect" key="flgJobDefect" v-if="nodeControl?.jobDefectTable?.visible">
  110. <DkSwitch ref="flgJobDefect" v-model="nodeData.flgJobDefect"
  111. @on-change="(e)=>{if(!e)nodeData.jobDefectList=undefined;}"></DkSwitch>
  112. </DkFormItem>
  113. </DkForm>
  114. <!-- tab3 - 高级属性 -->
  115. <DkForm ref="formInline" v-if="currentTab =='tab3'" key="tab3" v-model="nodeData" :label-max-words="6" :colCount="2">
  116. <!-- 工艺类别 -->
  117. <DkFormItem prop="techType" :data-type="$config.dataType.number">
  118. <SelectPop ref="techType" v-model="nodeData.techType" label-key="dataValue" value-key="dataId"
  119. :multiple="false" :options="techTypeList"/>
  120. </DkFormItem>
  121. <!-- 工序类别 -->
  122. <DkFormItem prop="nodeTypes" :data-type="$config.dataType.array">
  123. <SelectPop ref="nodeTypes" v-model="nodeData.nodeTypes" label-key="dataValue" value-key="dataId"
  124. :multiple="true" :options="nodeTypeList"/>
  125. </DkFormItem>
  126. <!-- 工序描述 -->
  127. <DkFormItem prop="nodeDesc">
  128. <InputPop v-model="nodeData.nodeDesc" ref="nodeDesc"/>
  129. </DkFormItem>
  130. <!-- 默认分级 -->
  131. <DkFormItem prop="defGradeId" key="defGradeId" v-if="nodeControl?.defGradeId?.visible" :data-type="$config.dataType.number">
  132. <SelectPop ref="defGradeId" v-model="nodeData.defGradeId" label-key="gradeName" value-key="gradeId"
  133. :multiple="false"
  134. :options="productGradeList.filter(it=>[$config.gradeKind.good,$config.gradeKind.fine].includes(it.gradeKind))"/>
  135. </DkFormItem>
  136. <!-- 报损标识 -->
  137. <DkFormItem prop="scrapFlg" key="scrapFlg"
  138. v-if="nodeControl?.flgScrap?.visible && !(nodeData.nodeKind==$config.nodeKind.register&&nodeData.flowKind==$config.flowKind.end)">
  139. <DkSwitch ref="flgScrap" v-model="nodeData.flgScrap"></DkSwitch>
  140. </DkFormItem>
  141. <!-- 撤销标识 -->
  142. <DkFormItem prop="flgUndo" key="flgUndo"
  143. v-if="nodeControl?.flgUndo?.visible && !(nodeData.nodeKind==$config.nodeKind.register&&nodeData.opnKind!=$config.processType.productCode)">
  144. <DkSwitch ref="flgUndo" v-model="nodeData.flgUndo"></DkSwitch>
  145. </DkFormItem>
  146. <!-- 验证标签 -->
  147. <DkFormItem prop="flgCheckLabel" key="flgCheckLabel"
  148. v-if="nodeControl?.flgCheckLabel?.visible && !(nodeData.nodeKind===$config.nodeKind.register&&nodeData.opnKind!==$config.processType.productCode)">
  149. <DkSwitch ref="flgCheckLabel" v-model="nodeData.flgCheckLabel"
  150. @on-change="(e)=>{if(!e) nodeData.pdtLabelKinds=undefined;this.$refs['formInline'].clearValidate()}"></DkSwitch>
  151. </DkFormItem>
  152. <!-- 标签类型 -->
  153. <DkFormItem prop="pdtLabelKinds" key="pdtLabelKinds" v-if="nodeControl?.pdtLabelKinds?.visible && nodeData.flgCheckLabel"
  154. :required="nodeData.flgCheckLabel"
  155. :data-type="$config.dataType.array">
  156. <SelectPop ref="pdtLabelKinds" v-model="nodeData.pdtLabelKinds" label-key="kindName" value-key="kindCode"
  157. :multiple="true" :options="pdtLabelKindsList"/>
  158. </DkFormItem>
  159. <!-- 独立检验 -->
  160. <DkFormItem prop="flgAloneJudge" key="flgAloneJudge"
  161. v-if="nodeControl?.flgAloneJudge?.visible && [$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flowKind!=$config.flowKind.start">
  162. <DkSwitch ref="flgAloneJudge" v-model="nodeData.flgAloneJudge"
  163. @on-change="changeFlgAloneJudge"></DkSwitch>
  164. </DkFormItem>
  165. <!-- 返回分级 -->
  166. <DkFormItem prop="backGradeIds" key="backGradeIds"
  167. v-if="nodeControl?.backGradeIds?.visible && ([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)"
  168. :data-type="$config.dataType.array">
  169. <SelectPop ref="backGradeIds" v-model="nodeData.backGradeIds" label-key="gradeName" value-key="gradeId"
  170. :options="productGradeList.filter(it=>it.gradeKind!==$config.gradeKind.damage&&(it.gradeTypes?.length===0||it.gradeTypes.includes(nodeData.nodeKind)))"
  171. @on-select="changeBackGradeIds" />
  172. </DkFormItem>
  173. <!-- 入库仓库 -->
  174. <DkFormItem prop="whId" :label="$t('whCodeName')" key="whId"
  175. v-if="nodeTypeList.filter(it=>it.dataValue=='入库').length && nodeData.nodeTypes && nodeData.nodeTypes.length &&
  176. nodeData.nodeTypes.includes(nodeTypeList.filter(it=>it.dataValue=='入库')[0].dataId)"
  177. :data-type="$config.dataType.array">
  178. <SelectPop ref="whId" v-model="nodeData.whId" label-key="whName" value-key="whId"
  179. :multiple="false" :options="whList" />
  180. </DkFormItem>
  181. </DkForm>
  182. <!-- tab4 - 流程控制 -->
  183. <DkForm ref="formInline" v-if="currentTab =='tab4'" key="tab4" v-model="nodeData" :label-max-words="6" :colCount="2">
  184. <!-- 成型标签 -->
  185. <DkFormItem prop="moldlineTags" key="moldlineTags" v-if="nodeControl?.moldlineTags?.visible" :span="12" :info="$config.nodeInfo.moldlineTags">
  186. <SelectPop ref="moldlineTags" v-model="nodeData.moldlineTags" label-key="dataValue" value-key="dataId"
  187. :multiple="true" :options="moldlineTagsList"/>
  188. </DkFormItem>
  189. </DkForm>
  190. <!-- 表格 -->
  191. <div style="margin-bottom: 8px">
  192. <div v-if="currentTab =='tab1'" key="tableTab1">
  193. <Divider v-if="nodeControl?.userTable?.visible" key="divider1"/>
  194. <!-- 生产工号 -->
  195. <EditTable ref="productUserTable" key="productUserTable" :title='"生产工号"' :titleInfo='$config.nodeInfo.productUserTable'
  196. :data="productUserList"
  197. v-if="nodeControl?.userTable?.visible&&productUserTableFlag"
  198. :columns="userColumns"
  199. enabledRepeatId="userId"
  200. :height="200"
  201. controlId="userId"
  202. :enabledRepeat="false"
  203. :show-setting-flag="false"/>
  204. <!-- 操作工号 -->
  205. <EditTable ref="operateUserTable" key="operateUserTable" :title='"操作工号"' :titleInfo='$config.nodeInfo.operateUserTable'
  206. :data="operateUserList"
  207. v-if="nodeControl?.userTable?.visible&&operateUserTableFlag&&nodeData.userKind==$config.userKind.operate"
  208. :columns="userColumns"
  209. enabledRepeatId="userId"
  210. :height="200"
  211. controlId="userId"
  212. :enabledRepeat="false"
  213. :show-setting-flag="false"/>
  214. </div>
  215. <div v-if="currentTab =='tab2'" key="tableTab2">
  216. <Divider v-if="(nodeControl?.defectTable?.visible)||(nodeControl?.jobDefectTable?.visible&&nodeData.flgJobDefect)" key="divider2"/>
  217. <!-- 可检缺陷 -->
  218. <EditTable ref="defectTable" key="defectTable" :title='"可检缺陷"' :data="nodeData.defectList" :titleInfo='$config.nodeInfo.defectTable'
  219. v-if="nodeControl?.defectTable?.visible&&defectTableFlag"
  220. :columns="defectColumns"
  221. enabledRepeatId="defectId"
  222. :height="200"
  223. controlId="pdtDefectId"
  224. :enabledRepeat="false"
  225. :show-setting-flag="false"/>
  226. <!-- 工种缺陷 -->
  227. <EditTable ref="jobDefectTable" key="jobDefectTable" :title='"工种缺陷"' :data="nodeData.jobDefectList" :titleInfo='$config.nodeInfo.jobDefectTable'
  228. v-if="nodeControl?.jobDefectTable?.visible&&jobDefectTableFlag&&nodeData.flgJobDefect"
  229. :columns="jobDefectColumns"
  230. :enabledRepeatId="['pdtDefectId','jobId']"
  231. :height="200"
  232. controlId="pdtDefectId"
  233. :enabledRepeat="false"
  234. :show-setting-flag="false"/>
  235. </div>
  236. <div v-if="currentTab =='tab3'" key="tableTab3">
  237. <Divider v-if="(([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)
  238. ||$config.nodeKind.recover==nodeData.nodeKind)
  239. &&checkRecoverTableFlag" key="divider3"/>
  240. <!-- 回收/检验设置 -->
  241. <EditTable ref="checkRecoverTable" key="checkRecoverTable" :title='nodeData.nodeKind===$config.nodeKind.recover?"回收设置":"检验设置"'
  242. :data="checkRecoverRouterList"
  243. v-if="(([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)
  244. ||$config.nodeKind.recover==nodeData.nodeKind)
  245. &&checkRecoverTableFlag"
  246. :columns="([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)
  247. ||($config.nodeKind.recover==nodeData.nodeKind&&nodeData.recycledKind==$config.recycledKind.before)?checkRecoverColumns:checkRecoverColumns_noBack"
  248. :controlId="'node1Id'"
  249. :height="200"
  250. :enabledRepeatId="['node1Id','backNodeIds']"
  251. :enabledRepeat="false"
  252. :show-setting-flag="false"/>
  253. </div>
  254. <div v-if="currentTab =='tab4'" key="tableTab4">
  255. <Divider v-if="(nodeControl?.pdtTable?.visible)||(nodeControl?.routerTable?.visible&&nodeData.recycledKind!==$config.recycledKind.before)" key="divider4"/>
  256. <!-- 工序在制品 -->
  257. <EditTable ref="pdtTable" key="pdtTable" :title='"工序在制品"' :data="nodeData.pdtList"
  258. v-if="nodeControl?.pdtTable?.visible&&pdtTableFlag"
  259. :columns="pdtColumns"
  260. enabledRepeatId="modelId"
  261. controlId="pdtModelId"
  262. :height="200"
  263. :enabledRepeat="false"
  264. :show-setting-flag="false"/>
  265. <!-- 跨流程工序 -->
  266. <!-- {{nodeData.routeType}}-->
  267. <EditTable ref="routerTable" key="routerTable" :title='"跨流程工序"' :data="crossRouterList"
  268. v-if="nodeControl?.routerTable?.visible&&routerTableFlag&&nodeData.recycledKind!==$config.recycledKind.before"
  269. :columns="crossRouterColumns"
  270. :controlId="'node2Id'"
  271. :height="200"
  272. :enabledRepeatId="'nodeId'"
  273. :enabledRepeat="false"
  274. :show-setting-flag="false"/>
  275. </div>
  276. </div>
  277. <!-- {{ nodeControl }}<br/>-->
  278. <!-- {{ allNodes }}<br/>-->
  279. <!-- {{nodeData.routerList}}<br/>-->
  280. </DkModal>
  281. </div>
  282. </template>
  283. <script>
  284. import { mapState, mapMutations } from 'vuex'
  285. import Process from '@/view/process/process-flow/config/ProcessConfig'
  286. export default {
  287. name: 'NodeModal',
  288. props: {
  289. shopList: {
  290. type: Array,
  291. default: () => []
  292. },
  293. dictionaryDataList: {
  294. type: Array,
  295. default: () => []
  296. },
  297. jobList: {
  298. type: Array,
  299. default: () => []
  300. },
  301. kilnList: {
  302. type: Array,
  303. default: () => []
  304. },
  305. whList: {
  306. type: Array,
  307. default: () => []
  308. },
  309. dataKindList: {
  310. type: Array,
  311. default: () => []
  312. },
  313. productGradeList: {
  314. type: Array,
  315. default: () => []
  316. },
  317. flowFormData: {
  318. type: Object,
  319. default: undefined,
  320. },
  321. isFromIndex: {
  322. type: Boolean,
  323. default: false
  324. }
  325. },
  326. computed: {
  327. ...mapState(['process']),
  328. },
  329. data() {
  330. let self = this
  331. return {
  332. operateUserList:[],//操作工号集合
  333. productUserList:[],///生产工号集合
  334. crossRouterList:[],///生产工号集合
  335. checkRecoverRouterList:[],//检验回收集合
  336. currentTab: 'tab1',
  337. judgeGradeDefaultValue: '',
  338. loading: false,
  339. existsFlag: true,
  340. productUserTableFlag: true,
  341. operateUserTableFlag: true,
  342. defectTableFlag: true,
  343. jobDefectTableFlag: true,
  344. pdtTableFlag: true,
  345. routerTableFlag: true,
  346. checkRecoverTableFlag: true,//检验/回收table
  347. modalDisplay: false,//如不定义此变量,则进入modal无动画
  348. split: 0.5,
  349. tableHeight: null,
  350. allNodes: [],//所有工序
  351. graph: null,//图形对象
  352. nodeData: {},//工序数据
  353. nodeDataSocial: {},// 工序数据(原始)
  354. nodeControl: {},//工序控制
  355. //tabs选项
  356. tabsOptions: [
  357. { label: self.$t('basic_info'), name: 'tab1' },
  358. { label: self.$t('defect_setting'), name: 'tab2' },
  359. { label: self.$t('advanced_attribute'), name: 'tab3' },
  360. { label: self.$t('flow_control'), name: 'tab4' },
  361. ],
  362. // 不包括工号类型
  363. userColumns: [
  364. {
  365. field: 'userCode',
  366. type: 'tableSelect',
  367. controlId: 'userId',
  368. param: () => {
  369. return { userType: self.$config.userType.workTeam }
  370. },
  371. sortBoolean: false,
  372. dataType: self.$config.tableSelectType.user,
  373. fieldUpdate: self.$updateColumns.processNodeChooseUser,
  374. searchDetailFlag: true,
  375. width: 'auto',
  376. },
  377. { field: 'userName', type: 'disabled', width: 'auto' },
  378. { field: 'remarks', type: 'text', width: 'auto' },
  379. ],
  380. pdtColumns: [
  381. {
  382. field: 'pdtModelCode',
  383. selectField: 'modelCode',
  384. type: 'tableSelect',
  385. controlId: 'pdtModelId',
  386. param: () => {
  387. return {}
  388. },
  389. sortBoolean: false,
  390. dataType: self.$config.tableSelectType.product,
  391. fieldUpdate: self.$updateColumns.processNodeChooseProduct,
  392. searchDetailFlag: true,
  393. width: 'auto',
  394. },
  395. { field: 'pdtModelName', type: 'disabled', width: 'auto', title: '产品名称' },
  396. { field: 'categoryName', type: 'disabled', width: 'auto' },
  397. { field: 'remarks', type: 'text', width: 'auto' },
  398. ],
  399. carColumns: [
  400. {
  401. field: 'carModelCode',
  402. selectField: 'modelCode',
  403. type: 'tableSelect',
  404. controlId: 'carModelId',
  405. param: () => {
  406. return {}
  407. },
  408. sortBoolean: false,
  409. dataType: self.$config.tableSelectType.carrier,
  410. fieldUpdate: self.$updateColumns.processNodeChooseCarrier,
  411. searchDetailFlag: true,
  412. width: 'auto',
  413. },
  414. { field: 'carModelName', type: 'disabled', width: 'auto' },
  415. { field: 'remarks', type: 'text', width: 'auto' },
  416. ],
  417. defectColumns: [
  418. {
  419. field: 'defectCode',
  420. type: 'tableSelect',
  421. controlId: 'pdtDefectId',
  422. param: () => {
  423. return { defectKind: self.$config.defectKind.Defect }
  424. },
  425. sortBoolean: false,
  426. dataType: self.$config.tableSelectType.defect,
  427. fieldUpdate: self.$updateColumns.processNodeChooseDefect,
  428. searchDetailFlag: true,
  429. width: 'auto',
  430. },
  431. { field: 'defectName', type: 'disabled', width: 'auto' },
  432. { field: 'defectTypesName', type: 'disabled', width: 'auto' },
  433. { field: 'remarks', type: 'text', width: 'auto' },
  434. ],
  435. jobDefectColumns: [
  436. {
  437. field: 'defectCode',
  438. type: 'tableSelect',
  439. controlId: 'pdtDefectId',
  440. param: () => {
  441. return { defectKind: self.$config.defectKind.Defect }
  442. },
  443. sortBoolean: false,
  444. dataType: self.$config.tableSelectType.defect,
  445. fieldUpdate: self.$updateColumns.processNodeChooseDefect,
  446. searchDetailFlag: true,
  447. width: 'auto',
  448. },
  449. { field: 'defectName', type: 'disabled', width: 'auto' },
  450. { field: 'defectTypesName', type: 'disabled', width: 'auto' },
  451. {
  452. field: 'jobId',
  453. type: 'select',
  454. options: () => self.jobList,
  455. labelKey: 'jobName',
  456. valueKey: 'jobId',
  457. searchDetailFlag: true,
  458. width: 'auto'
  459. },
  460. { field: 'remarks', type: 'text', width: 'auto' },
  461. ],
  462. //router_type=2/3
  463. checkRecoverColumns: [
  464. {
  465. field: 'node1Id',
  466. type: 'select',
  467. controlId: 'node1Id',
  468. options: () => self.allNodes.filter(it => !it.flgAloneJudge && it.id != self.process.currentNodeId),
  469. labelKey: 'name',
  470. valueKey: 'id',
  471. width: 'auto'
  472. },
  473. {
  474. field: 'productGrade',
  475. type: 'select',
  476. options: () => self.nodeData.nodeKind === self.$config.nodeKind.recover ?
  477. self.productGradeList.filter(it => [self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind))
  478. : self.productGradeList.filter(it => ![self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind)),
  479. labelKey: 'gradeName',
  480. valueKey: 'gradeId',
  481. multiple: true,
  482. width: 'auto'
  483. },
  484. {
  485. field: 'moldlineTags',
  486. info:self.$config.nodeInfo.moldlineTags,
  487. type: 'select',
  488. options: () => self.moldlineTagsList,
  489. labelKey: 'dataValue',
  490. valueKey: 'dataId',
  491. multiple: true,
  492. width: 'auto'
  493. },
  494. {
  495. field: 'backNodeIds',
  496. type: 'select',
  497. options: () => self.allNodes.filter(it => !it.flgAloneJudge && it.id != self.process.currentNodeId),
  498. labelKey: 'name',
  499. valueKey: 'id',
  500. width: 'auto',
  501. multiple: true,
  502. info:'未设置时,默认为下一道工序'
  503. },
  504. { field: 'remarks', type: 'text', width: 'auto' },
  505. ],
  506. checkRecoverColumns_noBack: [
  507. {
  508. field: 'node1Id',
  509. type: 'select',
  510. controlId: 'node1Id',
  511. options: () => self.allNodes.filter(it => !it.flgAloneJudge && it.id != self.process.currentNodeId),
  512. labelKey: 'name',
  513. valueKey: 'id',
  514. width: 'auto'
  515. },
  516. {
  517. field: 'productGrade',
  518. type: 'select',
  519. options: () => self.nodeData.nodeKind === self.$config.nodeKind.recover ?
  520. self.productGradeList.filter(it => [self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind))
  521. : self.productGradeList.filter(it => ![self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind)),
  522. labelKey: 'gradeName',
  523. valueKey: 'gradeId',
  524. multiple: true,
  525. width: 'auto'
  526. },
  527. {
  528. field: 'moldlineTags',
  529. info:self.$config.nodeInfo.moldlineTags,
  530. type: 'select',
  531. options: () => self.moldlineTagsList,
  532. labelKey: 'dataValue',
  533. valueKey: 'dataId',
  534. multiple: true,
  535. width: 'auto'
  536. },
  537. { field: 'remarks', type: 'text', width: 'auto' },
  538. ],
  539. //router_type=4
  540. crossRouterColumns: [
  541. {
  542. field: 'node2IdName',
  543. selectField: 'nodeName',
  544. type: 'tableSelect',
  545. controlId: 'node2Id',
  546. param: () => {
  547. return {
  548. notInFlowId: [this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id)],
  549. // notInFlowKind:[this.$config.flowKind.start],
  550. notInNodeKind: [self.$config.nodeKind.inKiln, self.$config.nodeKind.outKiln, self.$config.nodeKind.uninstallKiln, self.$config.nodeKind.recover, self.$config.nodeKind.shaping],
  551. flgAloneJudge: false,
  552. }
  553. },
  554. sortBoolean: false,
  555. dataType: self.$config.tableSelectType.processNode,
  556. fieldUpdate: self.$updateColumns.processNodeChooseNode,
  557. searchDetailFlag: true,
  558. width: 'auto'
  559. },
  560. {
  561. field: 'productGrade',
  562. type: 'select',
  563. options: () => self.nodeData.nodeKind === self.$config.nodeKind.recover ?
  564. self.productGradeList.filter(it => [self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind))
  565. : self.productGradeList.filter(it => ![self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind)),
  566. labelKey: 'gradeName',
  567. valueKey: 'gradeId',
  568. multiple: true,
  569. width: 'auto'
  570. },
  571. {
  572. field: 'moldlineTags',
  573. info:self.$config.nodeInfo.moldlineTags,
  574. type: 'select',
  575. options: () => self.moldlineTagsList,
  576. labelKey: 'dataValue',
  577. valueKey: 'dataId',
  578. multiple: true,
  579. width: 'auto'
  580. },
  581. { field: 'remarks', type: 'text', width: 'auto' },
  582. ],
  583. nodeKindList: [],// 工艺流程类型
  584. flowKindList: [],// 流程种类
  585. userKindList: [],// 用户类型
  586. pieceKindList: [],// 计件模式
  587. opnKindList: [],// 操作模式
  588. carKindList:[],// 载具模式
  589. nodeSysTagsList: [],// 工序标签
  590. moldlineTagsList: [],// 成线标签
  591. recycledKindList: [],// 回收到达
  592. recycledKindListSocial: [],// 回收到达(记录原始数据)
  593. packKindList: [], // 组装方式
  594. pdtLabelKindsList: [],//验证标签
  595. nodeTypeList: [],//工序类别
  596. techTypeList: [],//工艺类别
  597. }
  598. },
  599. watch: {
  600. //监听返回分级,处理检验table
  601. // 'nodeData.backGradeIds'(n, o){
  602. // console.log('o',o)
  603. // console.log('n',n)
  604. // if(!n||!o||n.isEmptyArray()||o.isEmptyArray()){
  605. // this.checkRecoverRouterList = []
  606. // this.checkRecoverTableFlag=false
  607. // this.$nextTick(() => {
  608. // this.checkRecoverTableFlag=true
  609. // })
  610. // }
  611. // },
  612. },
  613. methods: {
  614. ...mapMutations(['setProcessNodeModalDisplay', 'setProcessNodeModalIndexDisplay','setCurrentNodeId']),
  615. /**
  616. * @desc : 处理可判定分级初始值
  617. * @author : 张潇木
  618. * @date : 2023/5/26 16:03
  619. */
  620. handleJudgeGradeDefaultValue() {
  621. if (!this.nodeData.judgeGradeIds) return
  622. let value = ''
  623. //先处理默认
  624. if (this.nodeData.defGradeId) {
  625. value += this.productGradeList.filter(it => this.nodeData.defGradeId == it.gradeId)[0].gradeName + '【默认】 | '
  626. }
  627. //再处理其他
  628. this.productGradeList.filter(it => this.nodeData.judgeGradeIds.includes(it.gradeId) && this.nodeData.defGradeId !== it.gradeId).forEach(it => {
  629. value += it.gradeName + ' | '
  630. })
  631. this.judgeGradeDefaultValue = value.substring(0, value.length - 2)
  632. },
  633. /**
  634. * @desc : 选择可判分级
  635. * @author : 张潇木
  636. * @date : 2023/5/26 16:00
  637. */
  638. chooseJudgeGradeIds({ rows }) {
  639. if (rows && rows.length > 0) {
  640. this.nodeData.judgeGradeIds = rows.map(it => {
  641. return it.gradeId
  642. })
  643. let defaultRow = rows.filter(it => it.defGradeId)
  644. if (defaultRow.length > 0) {
  645. this.$set(this.nodeData, 'defGradeId', defaultRow[0].gradeId)
  646. }
  647. } else {
  648. this.nodeData.judgeGradeIds = []
  649. this.nodeData.defGradeId = undefined
  650. }
  651. },
  652. /**
  653. * @desc : 改变返回分级事件
  654. * @author : 张潇木
  655. * @date : 2023/7/13 16:20
  656. */
  657. changeBackGradeIds(e){
  658. //如果清空了返回分级,清空检验设置table
  659. if(!e||e.isEmptyArray()){
  660. this.checkRecoverRouterList = []
  661. this.checkRecoverTableFlag=false
  662. this.$nextTick(() => {
  663. this.checkRecoverTableFlag=true
  664. this.$nextTick(() => {
  665. //重新渲染回收/检验设置table列名
  666. if (this.$refs.checkRecoverTable
  667. && [this.$config.nodeKind.recover, this.$config.nodeKind.halfCheck, this.$config.nodeKind.finishCheck].includes(this.nodeData.nodeKind)) {
  668. let columnTile = this.nodeData.nodeKind === this.$config.nodeKind.recover ? '报废前工序' : '可检验工序'
  669. console.log('columnTile',columnTile)
  670. this.$refs.checkRecoverTable.changeColumnTitle('node1Id', columnTile)
  671. }
  672. })
  673. })
  674. }
  675. },
  676. /**
  677. * @desc : 当前tab改变事件
  678. * @author : 张潇木
  679. * @date : 2023/5/29 14:50
  680. */
  681. changeTabs(e) {
  682. //清除校验
  683. this.$refs['formInline'].clearValidate()
  684. // region重新渲染各table
  685. this.productUserTableFlag = !this.productUserTableFlag
  686. this.operateUserTableFlag = !this.operateUserTableFlag
  687. this.$nextTick(() => {
  688. this.productUserTableFlag = !this.productUserTableFlag
  689. this.operateUserTableFlag = !this.operateUserTableFlag
  690. })
  691. this.defectTableFlag = !this.defectTableFlag
  692. this.$nextTick(() => {
  693. this.defectTableFlag = !this.defectTableFlag
  694. })
  695. this.jobDefectTableFlag = !this.jobDefectTableFlag
  696. this.$nextTick(() => {
  697. this.jobDefectTableFlag = !this.jobDefectTableFlag
  698. })
  699. this.pdtTableFlag = !this.pdtTableFlag
  700. this.$nextTick(() => {
  701. this.pdtTableFlag = !this.pdtTableFlag
  702. })
  703. this.routerTableFlag = !this.routerTableFlag
  704. this.$nextTick(() => {
  705. this.routerTableFlag = !this.routerTableFlag
  706. })
  707. this.checkRecoverTableFlag = !this.checkRecoverTableFlag
  708. this.$nextTick(() => {
  709. this.checkRecoverTableFlag = !this.checkRecoverTableFlag
  710. this.$nextTick(() => {
  711. //重新渲染回收/检验设置table列名
  712. if (e == 'tab3' &&this.$refs.checkRecoverTable
  713. && [this.$config.nodeKind.recover, this.$config.nodeKind.halfCheck, this.$config.nodeKind.finishCheck].includes(this.nodeData.nodeKind)) {
  714. let columnTile = this.nodeData.nodeKind === this.$config.nodeKind.recover ? '报废前工序' : '可检验工序'
  715. console.log('columnTile',columnTile)
  716. this.$refs.checkRecoverTable.changeColumnTitle('node1Id', columnTile)
  717. }
  718. })
  719. })
  720. //endregion
  721. //设置表单数据
  722. this.setTableData()
  723. },
  724. /**
  725. * @desc : 改变操作模式
  726. * @author : 张潇木
  727. * @date : 2023/5/24 16:05
  728. */
  729. changeOpnKind() {
  730. if (this.nodeData.nodeKind === this.$config.nodeKind.register && this.nodeData.opnKind !== this.$config.processType.productCode) {
  731. this.nodeData.packKind = undefined
  732. this.nodeData.flgCheckLabel = false
  733. this.nodeData.pdtLabelKinds = undefined
  734. }
  735. //联动处理计件模式
  736. if ([this.$config.nodeKind.outKiln, this.$config.nodeKind.inKiln, this.$config.nodeKind.register].includes(this.nodeData.nodeKind)) {
  737. this.nodeData.pieceKind = this.nodeData.opnKind == this.$config.processType.productCode ? this.$config.registerType.singleProduct : this.$config.registerType.special
  738. }
  739. //联动处理撤销标识
  740. if (this.$config.nodeKind.register == this.nodeData.nodeKind) {
  741. this.nodeData.flgUndo = this.nodeData.opnKind == this.$config.processType.productCode ? true : false
  742. }
  743. //联动处理载具模式
  744. if(![this.$config.processType.dressKilnCar,this.$config.processType.exchangeKilnCar].includes(this.nodeData.opnKind)){
  745. this.nodeData.carKind=undefined
  746. }
  747. this.$refs['formInline'].clearValidate()
  748. },
  749. /**
  750. * @desc : 改变独立检验
  751. * @author : 张潇木
  752. * @date : 2023/4/6 16:19
  753. */
  754. changeFlgAloneJudge(e) {
  755. if (!e) {
  756. this.nodeData.backGradeIds = undefined
  757. }
  758. this.checkRecoverRouterList = []
  759. this.$refs['formInline'].clearValidate()
  760. },
  761. /**
  762. * @desc : 改变回收后到达类型
  763. * @author : 张潇木
  764. * @date : 2023/4/4 13:12
  765. */
  766. changeRecycledKind(e) {
  767. this.checkRecoverRouterList = []
  768. this.nodeData.routerList=this.nodeData.routerList.filter(it=>it.routeType!=this.$config.routeType.recover)
  769. },
  770. /**
  771. * @desc : 选择流程工序
  772. * @author : 周兴
  773. * @date : 2023/3/15 16:25
  774. */
  775. handleSelectFlowKind() {
  776. // 工序类型是计件,流程类型是 结束,那么报损标识为false
  777. if (this.nodeData.nodeKind == this.$config.nodeKind.register) {
  778. this.nodeData.flgScrap = this.nodeData.flowKind == this.$config.flowKind.end ? false : true
  779. }
  780. // 半检、成检 开始工序时,独立检验标识为false
  781. if ([this.$config.nodeKind.halfCheck, this.$config.nodeKind.finishCheck].includes(this.nodeData.nodeKind)
  782. && this.nodeData.flowKind == this.$config.flowKind.start) {
  783. this.nodeData.flgAloneJudge = false
  784. this.nodeData.backGradeIds = null
  785. }
  786. // 回收时,结束工序,回收初始方式只能是后续流程
  787. if (this.$config.nodeKind.recover===this.nodeData.nodeKind&&this.nodeData.flowKind === this.$config.flowKind.end) {
  788. this.recycledKindList = this.recycledKindListSocial.filter(it => it.kindCode === this.$config.recycledKind.after)
  789. this.$nextTick(() => {
  790. this.nodeData.recycledKind = this.$config.recycledKind.after
  791. })
  792. } else {
  793. this.recycledKindList = this.recycledKindListSocial.copy()
  794. }
  795. this.$refs['formInline'].clearValidate()
  796. },
  797. /**
  798. * @desc : 修改用户类别
  799. * @author : 张潇木
  800. * @date : 2023/3/1 14:11
  801. */
  802. changeUserKind(e) {
  803. //当切换到生产工号时,删除userTable中设置的操作工号
  804. if (e == this.$config.userKind.product) {
  805. this.nodeData.userList =this.nodeData.userList?.filter(it=>it.userKind==this.$config.userKind.product)
  806. }
  807. },
  808. /**
  809. * @desc : 确定
  810. * @author : 张潇木
  811. * @date : 2023/1/5 10:38
  812. */
  813. modalOk() {
  814. //校验
  815. if (!this.validData()) return
  816. //设置业务数据
  817. this.setParams()
  818. if (!this.isFromIndex) {
  819. //清空选中
  820. this.clearSelection()
  821. //关闭modal
  822. this.setProcessNodeModalDisplay(null)
  823. //清空当前选中工序id
  824. this.setCurrentNodeId(undefined)
  825. }
  826. },
  827. /**
  828. * @desc : 取消
  829. * @author : 张潇木
  830. * @date : 2023/1/5 10:38
  831. */
  832. modalCancel() {
  833. //清空选中
  834. this.clearSelection()
  835. //还原工序数据
  836. let cell = this.graph.getCellById(this.process.currentNodeId)
  837. cell.setData(this.nodeDataSocial, { overwrite: true })
  838. //设置显示隐藏状态以及清空当前工序id
  839. if(this.isFromIndex){
  840. this.setProcessNodeModalIndexDisplay(null)
  841. }else{
  842. this.setProcessNodeModalDisplay(null)
  843. }
  844. //清空当前选中工序id
  845. this.setCurrentNodeId(undefined)
  846. },
  847. /**
  848. * @desc : 清空选中项目 - 解决modal关闭后会选中部分文字的bug
  849. * @author : 张潇木
  850. * @date : 2024/3/14 11:21
  851. */
  852. clearSelection(){
  853. let selection = window.getSelection();
  854. // 如果存在选中的文本范围,则移除选中
  855. if (selection.rangeCount > 0) {
  856. selection.removeAllRanges();
  857. }
  858. },
  859. /**
  860. * @desc : 设置提交数据格式
  861. * @author : 张潇木
  862. * @date : 2023/2/16 16:21
  863. */
  864. setParams() {
  865. // 设置表单数据
  866. this.setTableData()
  867. // region 设置图形业务数据
  868. //根据工序id获取工序数据
  869. let cell = this.graph.getCellById(this.process.currentNodeId)
  870. //移除非法连线
  871. this.removeInvalidEdge(cell)
  872. //设置工序数据
  873. cell.setData(this.nodeData, { overwrite: true })
  874. // endregion
  875. //region 如果是一览页面的编辑,直接提交保存
  876. if (this.isFromIndex) {
  877. this.flowFormData.flowLayout = this.graph.toJSON()
  878. //发送保存网络请求
  879. this.excute(this.$service.processService, this.$service.processService.processSetting, this.flowFormData).then(res => {
  880. if (res.code === this.$config.SUCCESS_CODE) {
  881. // 提示信息
  882. this.$Message.success(vm.$t('I_001', { 'param': vm.$v('edit') }))
  883. // 刷新一览明细
  884. this.$emit('node-modal-ok', { row: this.flowFormData })
  885. //关闭modal
  886. this.setProcessNodeModalIndexDisplay(null)
  887. //清空当前选中工序id
  888. this.setCurrentNodeId(undefined)
  889. } else {
  890. // 如果不成功就提示错误信息
  891. this.$Message.warning(res.message)
  892. }
  893. })
  894. }
  895. //endregion
  896. },
  897. /**
  898. * @desc : 设置表单数据 - 判断当前哪些table存在,不存在的table 不需要重新设置数据
  899. * @author : 张潇木
  900. * @date : 2023/5/30 17:19
  901. */
  902. setTableData(){
  903. //region操作工号
  904. if(this.$refs.operateUserTable){
  905. //将原操作工号删除
  906. this.nodeData.userList =this.nodeData?.userList?.filter(it=>it.userKind!==this.$config.userKind.operate)||[]
  907. //取新的操作工号
  908. this.operateUserList = this.$refs?.operateUserTable?.getTableDataFilter().map((it, index) => {
  909. return {
  910. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  911. nodeId: this.process.currentNodeId,
  912. userId: it.userId,
  913. userCode: it.userCode,
  914. userName: it.userName,
  915. userKind :this.$config.userKind.operate,
  916. displayNo: index + 1,
  917. remarks: it.remarks,
  918. ftyId: this.$store.state.user.ftyId
  919. }
  920. })||[]
  921. //增加到userList中
  922. this.nodeData.userList=[...this.nodeData.userList,...this.operateUserList]
  923. }
  924. //endregion
  925. //region生产工号
  926. if(this.$refs.productUserTable){
  927. //将原操作工号删除
  928. this.nodeData.userList =this.nodeData?.userList?.filter(it=>it.userKind!==this.$config.userKind.product)||[]
  929. //取新的生产工号
  930. this.productUserList = this.$refs?.productUserTable?.getTableDataFilter().map((it, index) => {
  931. return {
  932. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  933. nodeId: this.process.currentNodeId,
  934. userId: it.userId,
  935. userCode: it.userCode,
  936. userName: it.userName,
  937. userKind :this.$config.userKind.product,
  938. displayNo: index + 1,
  939. remarks: it.remarks,
  940. ftyId: this.$store.state.user.ftyId
  941. }
  942. })||[]
  943. //增加到userList中
  944. this.nodeData.userList=[...this.nodeData.userList,...this.productUserList]
  945. }
  946. //endregion
  947. //region工序在制品
  948. if(this.$refs.pdtTable){
  949. this.nodeData.pdtList = this.$refs?.pdtTable?.getTableDataFilter().map((it) => {
  950. return {
  951. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  952. nodeId: this.process.currentNodeId,
  953. pdtModelId: it.pdtModelId,
  954. pdtModelCode: it.pdtModelCode,
  955. pdtModelName: it.pdtModelName,
  956. categoryName: it.categoryName,
  957. remarks: it.remarks,
  958. ftyId: this.$store.state.user.ftyId
  959. }
  960. })
  961. this.nodeData.cntPdtModel = this.nodeData.pdtList?.length // 在制品型号数量
  962. }
  963. //endregion
  964. //region载具
  965. if(this.$refs.carTable){
  966. this.nodeData.carList = this.$refs?.carTable?.getTableDataFilter().map((it) => {
  967. return {
  968. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  969. nodeId: this.process.currentNodeId,
  970. carModelId: it.carModelId,
  971. carModelCode: it.carModelCode,
  972. carModelName: it.carModelName,
  973. remarks: it.remarks,
  974. ftyId: this.$store.state.user.ftyId
  975. }
  976. })
  977. this.nodeData.cntCarModel = this.nodeData.carList?.length // 可用载具数量
  978. }
  979. //endregion
  980. //region缺陷
  981. if(this.$refs.defectTable){
  982. this.nodeData.defectList = this.$refs?.defectTable?.getTableDataFilter().map((it) => {
  983. return {
  984. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  985. nodeId: this.process.currentNodeId,
  986. pdtDefectId: it.pdtDefectId,
  987. defectCode: it.defectCode,
  988. defectName: it.defectName,
  989. defectTypesName: it.defectTypesName,
  990. remarks: it.remarks,
  991. ftyId: this.$store.state.user.ftyId
  992. }
  993. })
  994. this.nodeData.cntQuyDefect = this.nodeData.defectList?.length // 可检缺陷数量
  995. }
  996. //endregion
  997. //region工种缺陷
  998. if(this.$refs.jobDefectTable) {
  999. this.nodeData.jobDefectList = this.$refs?.jobDefectTable?.getTableDataFilter().map((it) => {
  1000. return {
  1001. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  1002. nodeId: this.process.currentNodeId,
  1003. jobId: it.jobId,
  1004. jobId_Name:it.jobId_Name,
  1005. pdtDefectId: it.pdtDefectId,
  1006. defectCode: it.defectCode,
  1007. defectName: it.defectName,
  1008. defectTypesName: it.defectTypesName,
  1009. remarks: it.remarks,
  1010. ftyId: this.$store.state.user.ftyId
  1011. }
  1012. })
  1013. }
  1014. this.nodeData.cntJobDefect = this.nodeData.flgJobDefect ? this.nodeData.jobDefectList?.length : -1 // 工种缺陷数量,产生缺陷为true时设置成 -1
  1015. //endregion
  1016. //region检验/回收设置
  1017. if(this.$refs.checkRecoverTable) {
  1018. //将原检验/回收设置删除
  1019. this.nodeData.routerList =this?.nodeData?.routerList?.filter(it=>it.routeType==this.$config.routeType.cross)||[]
  1020. //取新的检验/回收设置
  1021. this.checkRecoverRouterList = this.$refs?.checkRecoverTable?.getTableDataFilter().map((it) => {
  1022. return {
  1023. routeType: this.nodeData.nodeKind===this.$config.nodeKind.recover?this.$config.routeType.recover:this.$config.routeType.check,
  1024. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  1025. nodeId: this.process.currentNodeId,
  1026. node1Id: it.node1Id,
  1027. node2Id: this.process.currentNodeId,
  1028. backNodeIds: it.backNodeIds,
  1029. productGrade: it.productGrade,
  1030. moldlineTags: it.moldlineTags,
  1031. remarks: it.remarks,
  1032. ftyId: this.$store.state.user.ftyId
  1033. }
  1034. })||[]
  1035. //增加到routerList中
  1036. this.nodeData.routerList=[...this.nodeData.routerList,...this.checkRecoverRouterList]
  1037. }
  1038. //endregion
  1039. //region跨流程工序
  1040. if(this.$refs.routerTable) {
  1041. //将原跨流程工序删除
  1042. this.nodeData.routerList =this.nodeData?.routerList?.filter(it=>it.routeType!==this.$config.routeType.cross)||[]
  1043. //取新的跨流程工序
  1044. this.crossRouterList = this.$refs?.routerTable?.getTableDataFilter().map((it) => {
  1045. return {
  1046. routeType: this.$config.routeType.cross,
  1047. flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
  1048. nodeId: this.process.currentNodeId,
  1049. node1Id: this.process.currentNodeId,
  1050. node2Id: it.node2Id,
  1051. node2IdName: it.node2IdName,
  1052. productGrade: it.productGrade,
  1053. moldlineTags: it.moldlineTags,
  1054. remarks: it.remarks,
  1055. ftyId: this.$store.state.user.ftyId
  1056. }
  1057. })||[]
  1058. //增加到routerList中
  1059. this.nodeData.routerList=[...this.nodeData.routerList,...this.crossRouterList]
  1060. }
  1061. //endregion
  1062. },
  1063. /**
  1064. * @desc : 校验数据
  1065. * @author : 张潇木
  1066. * @date : 2023/2/27 11:12
  1067. */
  1068. validData() {
  1069. if(!this.nodeData.nodeName||!this.nodeData.flowKind||!this.nodeData.userKind||!this.nodeData.opnKind||!this.nodeData.pieceKind
  1070. ||([this.$config.processType.dressKilnCar,this.$config.processType.exchangeKilnCar].includes(this.nodeData.opnKind)&&!this.nodeData.carKind)
  1071. ||(this.nodeControl?.recycledKind?.visible&&!this.nodeData.recycledKind)||(this.nodeControl?.judgeGradeIds?.visible&&!this.nodeData.judgeGradeIds)) {
  1072. this.currentTab='tab1'
  1073. this.$nextTick(() => {
  1074. this.$refs['formInline'].validate()
  1075. })
  1076. return
  1077. }
  1078. if(this.nodeControl?.pdtLabelKinds?.visible&&this.nodeData.flgCheckLabel&&(!this.nodeData.pdtLabelKinds||this.nodeData.pdtLabelKinds.isEmptyArray())){
  1079. this.currentTab='tab3'
  1080. this.$nextTick(() => {
  1081. this.$refs['formInline'].validate()
  1082. })
  1083. return
  1084. }
  1085. // 销毁提示弹窗
  1086. this.$Message.destroy()
  1087. // 通过校验标识
  1088. this.nodeData.isValid = true
  1089. return true
  1090. },
  1091. /**
  1092. * @desc : 移除非法连线
  1093. * @author : 张潇木
  1094. * @date : 2023/3/1 13:29
  1095. */
  1096. removeInvalidEdge(cell) {
  1097. // 开始工序不能作为终点
  1098. if (this.nodeData?.flowKind == this.$config.flowKind.start) {
  1099. this.graph.getIncomingEdges(cell)?.forEach(it => {
  1100. this.graph.removeEdge(it.id)
  1101. })
  1102. }
  1103. // 结束工序不能作为起点 特殊处理:(后续流程+回收)允许有出线
  1104. if (this.nodeData?.flowKind == this.$config.flowKind.end) {
  1105. this.graph.getOutgoingEdges(cell)?.forEach(it => {
  1106. this.graph.removeEdge(it.id)
  1107. })
  1108. }
  1109. // 回收工序不能作为终点
  1110. if (this.nodeData?.nodeKind === this.$config.nodeKind.recover) {
  1111. this.graph.getIncomingEdges(cell)?.forEach(it => {
  1112. this.graph.removeEdge(it.id)
  1113. })
  1114. }
  1115. // 回收工序只有回收方式为后续流程时,才可以有出线
  1116. if (this.nodeData?.nodeKind === this.$config.nodeKind.recover && this.nodeData?.recycledKind != this.$config.recycledKind.after) {
  1117. this.graph.getOutgoingEdges(cell)?.forEach(it => {
  1118. this.graph.removeEdge(it.id)
  1119. })
  1120. }
  1121. // 独立检验既不能作为开始也不能作为结束
  1122. if (this.nodeData?.flgAloneJudge) {
  1123. this.graph.getConnectedEdges(cell)?.forEach(it => {
  1124. this.graph.removeEdge(it.id)
  1125. })
  1126. }
  1127. },
  1128. /**
  1129. * @desc : 处理系统数据
  1130. * @author : 周兴
  1131. * @date : 2023/3/15 10:26
  1132. */
  1133. handleDataKindList() {
  1134. // 工序
  1135. this.nodeKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.nodeKind)
  1136. // 流程种类
  1137. this.flowKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.flowKind)
  1138. // 用户类型
  1139. this.userKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.userKind)
  1140. // 计件模式
  1141. this.pieceKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.pieceKind)
  1142. // 操作模式
  1143. this.opnKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.opnKind)
  1144. // 载具模式
  1145. this.carKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.carKind)
  1146. // 工序标签
  1147. this.nodeSysTagsList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.nodeSysTags)
  1148. // 回收处理方式
  1149. this.recycledKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.recover)
  1150. this.recycledKindListSocial = this.recycledKindList?.copy()
  1151. // 组装方式
  1152. this.packKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.recycledKind)
  1153. // 验证标签
  1154. this.pdtLabelKindsList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.checkLabel)
  1155. // 工序类别
  1156. this.nodeTypeList = this.dictionaryDataList.filter(it => it.dictCode === this.$config.dictType.nodeType)
  1157. // 工艺类别
  1158. this.techTypeList = this.dictionaryDataList.filter(it => it.dictCode === this.$config.dictType.techType)
  1159. // 成线标签
  1160. this.moldlineTagsList = this.dictionaryDataList.filter(it => it.dictCode === this.$config.dictType.moldlineTag)
  1161. },
  1162. /**
  1163. * @desc : 设置table初始值
  1164. * @author : 张潇木
  1165. * @date : 2023/5/31 10:06
  1166. */
  1167. handleTableDefaultValue() {
  1168. //操作工号
  1169. this.operateUserList=this.nodeData?.userList?.filter(it=>it.userKind==this.$config.userKind.operate)
  1170. //生产工号
  1171. this.productUserList=this.nodeData?.userList?.filter(it=>it.userKind==this.$config.userKind.product)
  1172. //跨工序流程
  1173. this.crossRouterList=this.nodeData?.routerList?.filter(it=>it.routeType==this.$config.routeType.cross)
  1174. //检验/回收设置
  1175. this.checkRecoverRouterList=this.nodeData?.routerList?.filter(it=>it.routeType!==this.$config.routeType.cross)
  1176. }
  1177. },
  1178. created() {
  1179. this.loading = true
  1180. //获取图形对象
  1181. if (this.graph == null) this.graph = Process.graph
  1182. //获取业务数据
  1183. this.nodeData = this.graph.getCellById(this.process.currentNodeId)?.data
  1184. // //记录初始值
  1185. this.nodeDataSocial = JSON.parse(JSON.stringify(this.nodeData))
  1186. // //刷新工序属性控制
  1187. this.nodeControl = this.dataKindList.find(it => it.kindCode === this.nodeData.nodeKind)?.kindTags
  1188. // //处理跨流程工序类别
  1189. // this.handleRouterType()
  1190. // //过滤调工序组并将json解构成新结构数组
  1191. this.allNodes = this.graph.getNodes().filter(it => it.shape == 'custom-image').map((it) => {
  1192. return {
  1193. id: it.id,
  1194. name: it.data.nodeName,
  1195. flowKind: it.data.flowKind,
  1196. nodeKind: it.data.nodeKind,
  1197. flgAloneJudge: it.data.flgAloneJudge
  1198. }
  1199. })
  1200. //计算显示顺序
  1201. if (!this.nodeData.displayNo) {
  1202. this.nodeData.displayNo = this.allNodes.length
  1203. }
  1204. //设置系统基础数据初始值
  1205. this.handleDataKindList()
  1206. //设置table初始值
  1207. this.handleTableDefaultValue()
  1208. this.loading = false
  1209. },
  1210. mounted() {
  1211. //处理可判定分级初始值
  1212. this.handleJudgeGradeDefaultValue()
  1213. this.modalDisplay = true
  1214. },
  1215. beforeDestroy() {
  1216. this.existsFlag = null
  1217. },
  1218. }
  1219. </script>
  1220. <style scoped>
  1221. .ivu-divider-horizontal {
  1222. margin: 10px 0 2px !important;
  1223. }
  1224. .switch {
  1225. height: 28px;
  1226. display: flex;
  1227. align-items: center;
  1228. }
  1229. /deep/ .vxe-select-slots {
  1230. z-index: 5100 !important;
  1231. }
  1232. </style>