BaseForm.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658
  1. <template>
  2. <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
  3. <a-row :gutter="48" slot="extra">
  4. <a-col :md="48" :sm="48">
  5. <span class="table-page-search-submitButtons" style="float: right">
  6. <a-button type="primary" @click="save()">提交</a-button>
  7. <a-button style="margin-left: 8px" @click="handleFresh()">刷新位置</a-button>
  8. <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
  9. </span>
  10. </a-col>
  11. </a-row>
  12. <title-divider title="基本信息" width="90px"></title-divider>
  13. <a-form :form="form">
  14. <a-form-item v-show="false" >
  15. <a-input v-decorator="['id']" type="hidden"/>
  16. <a-input v-decorator="['parentId']" type="hidden"/>
  17. </a-form-item>
  18. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  19. <a-col :lg="12" :md="24" :sm="24">
  20. <a-form-item
  21. label="设备编号"
  22. :labelCol="BaseTool.Constant.labelCol"
  23. :wrapperCol="BaseTool.Constant.wrapperCol"
  24. >
  25. <a-input
  26. v-decorator="['no', {rules: [{required: true, message: '不能为空'}]}]" />
  27. </a-form-item>
  28. </a-col>
  29. <a-col :lg="12" :md="24" :sm="24">
  30. <a-form-item
  31. label="父设备"
  32. :labelCol="BaseTool.Constant.labelCol"
  33. :wrapperCol="BaseTool.Constant.wrapperCol"
  34. >
  35. <a-input
  36. disabled
  37. style="width: 60%"
  38. v-decorator="['parentSbName']"/>
  39. <a-button type="primary" style="width: 20%" @click="handleSbSelect">选择</a-button>
  40. <a-button type="default" style="width: 20%" @click="clearParent">清空</a-button>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :lg="12" :md="24" :sm="24">
  44. <a-form-item
  45. label="父位号"
  46. :labelCol="BaseTool.Constant.labelCol"
  47. :wrapperCol="BaseTool.Constant.wrapperCol"
  48. >
  49. <a-input
  50. v-decorator="['ppNo']"/>
  51. </a-form-item>
  52. </a-col>
  53. <!-- <a-col :lg="12" :md="24" :sm="24">
  54. <a-form-item
  55. label="是否子设备"
  56. :labelCol="BaseTool.Constant.labelCol"
  57. :wrapperCol="BaseTool.Constant.wrapperCol"
  58. >
  59. <a-select @change="childChange" v-decorator="['isChild', { rules: [{required: true, message: '是否子设备不能为空'}]}]" placeholder="请选择">
  60. <a-select-option
  61. v-for="(label,value) in isChildMap"
  62. :key="value"
  63. :label="label"
  64. :value="parseInt(value)">{{ label }}
  65. </a-select-option>
  66. </a-select>
  67. </a-form-item>
  68. </a-col>-->
  69. <a-col :lg="12" :md="24" :sm="24">
  70. <a-form-item
  71. label="设备位号"
  72. :labelCol="BaseTool.Constant.labelCol"
  73. :wrapperCol="BaseTool.Constant.wrapperCol"
  74. >
  75. <a-input
  76. v-decorator="['positionNo', {rules: [{required: false, message: '不能为空'}]}]" />
  77. </a-form-item>
  78. </a-col>
  79. </a-row>
  80. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  81. <a-col :lg="12" :md="24" :sm="24">
  82. <a-form-item
  83. label="设备名称"
  84. :labelCol="BaseTool.Constant.labelCol"
  85. :wrapperCol="BaseTool.Constant.wrapperCol"
  86. >
  87. <a-input
  88. v-decorator="['name', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
  89. </a-form-item>
  90. </a-col>
  91. <a-col :lg="12" :md="24" :sm="24">
  92. <a-form-item
  93. label="设备型号"
  94. :labelCol="BaseTool.Constant.labelCol"
  95. :wrapperCol="BaseTool.Constant.wrapperCol"
  96. >
  97. <a-input
  98. v-decorator="['model', {rules: [{required: true, message: '设备型号不能为空'}]}]" />
  99. </a-form-item>
  100. </a-col>
  101. </a-row>
  102. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  103. <a-col :lg="12" :md="24" :sm="24">
  104. <a-form-item
  105. label="是否固定资产"
  106. :labelCol="BaseTool.Constant.labelCol"
  107. :wrapperCol="BaseTool.Constant.wrapperCol"
  108. >
  109. <a-select v-decorator="['isFinancing', { rules: [{required: true, message: '是否显示不能为空'}]}]" placeholder="请选择">
  110. <a-select-option
  111. v-for="(label,value) in isFinancingMap"
  112. :key="value"
  113. :label="label"
  114. :value="parseInt(value)">{{ label }}
  115. </a-select-option>
  116. </a-select>
  117. </a-form-item>
  118. </a-col>
  119. </a-row>
  120. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  121. <a-col :lg="12" :md="24" :sm="24">
  122. <a-form-item
  123. label="设备等级"
  124. :labelCol="BaseTool.Constant.labelCol"
  125. :wrapperCol="BaseTool.Constant.wrapperCol"
  126. >
  127. <a-select v-decorator="['level', {initialValue:1, rules: [{required: true, message: '设备等级不能为空'}]}]" placeholder="请选择">
  128. <a-select-option
  129. v-for="(label,value) in levelMap"
  130. :key="value"
  131. :label="label"
  132. :value="parseInt(value)">{{ label }}
  133. </a-select-option>
  134. </a-select>
  135. </a-form-item>
  136. </a-col>
  137. <a-col :lg="12" :md="24" :sm="24">
  138. <a-form-item
  139. label="设备价格(原值)"
  140. :labelCol="BaseTool.Constant.labelCol"
  141. :wrapperCol="BaseTool.Constant.wrapperCol"
  142. >
  143. <a-input-number
  144. style="width: 100%"
  145. :min="0"
  146. :step="0.01"
  147. :formatter="BaseTool.Amount.formatter"
  148. :parser="BaseTool.Amount.parser"
  149. v-decorator="['initialValue']" />
  150. </a-form-item>
  151. </a-col>
  152. </a-row>
  153. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  154. <a-col :lg="12" :md="24" :sm="24">
  155. <a-form-item
  156. label="设备类型"
  157. :labelCol="BaseTool.Constant.labelCol"
  158. :wrapperCol="BaseTool.Constant.wrapperCol"
  159. >
  160. <a-tree-select
  161. style="width: 100%"
  162. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  163. :treeData="sbTypeTreeData"
  164. :treeNodeFilterProp="'title'"
  165. :showSearch="true"
  166. v-decorator="['typeId', {rules: [{required: true, message: '设备类型不能为空'}]}]"
  167. placeholder="请选择"
  168. >
  169. </a-tree-select>
  170. </a-form-item>
  171. </a-col>
  172. <a-col :lg="12" :md="24" :sm="24">
  173. <a-form-item
  174. label="自定义类型"
  175. :labelCol="BaseTool.Constant.labelCol"
  176. :wrapperCol="BaseTool.Constant.wrapperCol"
  177. >
  178. <a-select @change="handleChange" v-decorator="['useType', {rules: [{required: true, message: '自定义类型不能为空'}]}]" placeholder="请选择">
  179. <a-select-option
  180. v-for="(label,value) in useTypeMap"
  181. :key="value"
  182. :label="label"
  183. :value="parseInt(value)">{{ label }}
  184. </a-select-option>
  185. </a-select>
  186. </a-form-item>
  187. </a-col>
  188. </a-row>
  189. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  190. <a-col :lg="12" :md="24" :sm="24">
  191. <a-form-item
  192. label="状态"
  193. :labelCol="BaseTool.Constant.labelCol"
  194. :wrapperCol="BaseTool.Constant.wrapperCol"
  195. >
  196. <a-select v-decorator="['status', {rules: [{required: true, message: '状态不能为空'}]}]" placeholder="请选择">
  197. <a-select-option
  198. v-for="(label,value) in statusMap"
  199. :key="value"
  200. :label="label"
  201. :value="parseInt(value)">{{ label }}
  202. </a-select-option>
  203. </a-select>
  204. </a-form-item>
  205. </a-col>
  206. <a-col :lg="12" :md="24" :sm="24" v-if="useType===4">
  207. <a-form-item
  208. label="是否强检"
  209. :labelCol="BaseTool.Constant.labelCol"
  210. :wrapperCol="BaseTool.Constant.wrapperCol"
  211. >
  212. <a-select v-decorator="['checkType', {rules: [{required: true, message: '请选择'}]}]" placeholder="请选择">
  213. <a-select-option
  214. v-for="(label,value) in checkTypeMap"
  215. :key="value"
  216. :label="label"
  217. :value="parseInt(value)">{{ label }}
  218. </a-select-option>
  219. </a-select>
  220. </a-form-item>
  221. </a-col>
  222. </a-row>
  223. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  224. <!-- <a-col :lg="12" :md="24" :sm="24">
  225. <a-form-item
  226. label="大小/尺寸"
  227. :labelCol="BaseTool.Constant.labelCol"
  228. :wrapperCol="BaseTool.Constant.wrapperCol"
  229. >
  230. <a-input
  231. v-decorator="['zz']" />
  232. </a-form-item>
  233. </a-col>-->
  234. <a-col :lg="12" :md="24" :sm="24">
  235. <a-form-item
  236. label="出厂编号"
  237. :labelCol="BaseTool.Constant.labelCol"
  238. :wrapperCol="BaseTool.Constant.wrapperCol"
  239. >
  240. <a-input
  241. v-decorator="['zzh']" />
  242. </a-form-item>
  243. </a-col>
  244. </a-row>
  245. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  246. <a-col :lg="12" :md="24" :sm="24">
  247. <a-form-item
  248. label="生产商"
  249. :labelCol="BaseTool.Constant.labelCol"
  250. :wrapperCol="BaseTool.Constant.wrapperCol"
  251. >
  252. <a-input
  253. v-decorator="['producerId']" />
  254. </a-form-item>
  255. </a-col>
  256. </a-row>
  257. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  258. <a-col :lg="12" :md="24" :sm="24">
  259. <a-form-item
  260. label="设备位置"
  261. :labelCol="BaseTool.Constant.labelCol"
  262. :wrapperCol="BaseTool.Constant.wrapperCol"
  263. >
  264. <a-tree-select
  265. style="width: 100%"
  266. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  267. :treeData="treeData"
  268. :treeNodeFilterProp="'title'"
  269. :showSearch="true"
  270. v-decorator="['positionId', {rules: [{required: false, message: '上层位置不能为空'}]}]"
  271. placeholder="请选择"
  272. >
  273. </a-tree-select>
  274. </a-form-item>
  275. </a-col>
  276. <a-col :lg="12" :md="24" :sm="24">
  277. <a-form-item
  278. label="电力线路"
  279. :labelCol="BaseTool.Constant.labelCol"
  280. :wrapperCol="BaseTool.Constant.wrapperCol"
  281. >
  282. <a-select v-decorator="['baoyangTimes', {rules: [{required: false, message: '不能为空'}]}]" placeholder="请选择">
  283. <a-select-option
  284. v-for="(label,value) in lineMap"
  285. :key="value"
  286. :label="label"
  287. :value="parseInt(value)">{{ label }}
  288. </a-select-option>
  289. </a-select>
  290. </a-form-item>
  291. </a-col>
  292. <!-- <a-col :lg="12" :md="24" :sm="24">
  293. <a-form-item
  294. label="是否显示"
  295. :labelCol="BaseTool.Constant.labelCol"
  296. :wrapperCol="BaseTool.Constant.wrapperCol"
  297. >
  298. <a-select v-decorator="['isShow', { rules: [{required: true, message: '是否显示不能为空'}]}]" placeholder="请选择">
  299. <a-select-option
  300. v-for="(label,value) in isShowMap"
  301. :key="value"
  302. :label="label"
  303. :value="parseInt(value)">{{ label }}
  304. </a-select-option>
  305. </a-select>
  306. </a-form-item>
  307. </a-col>-->
  308. </a-row>
  309. <!-- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  310. <a-col :lg="12" :md="24" :sm="24">
  311. <a-form-item
  312. label="水平位置"
  313. :labelCol="BaseTool.Constant.labelCol"
  314. :wrapperCol="BaseTool.Constant.wrapperCol"
  315. >
  316. <a-input-number
  317. :step="1"
  318. :min="85"
  319. style="width:70%"
  320. v-decorator="['zjm']"
  321. placeholder="请输入离屏幕左上角的右方距离,最低85"/>
  322. <a-button style="width: 30%" type="primary" @click="handlePoint">设置预览</a-button>
  323. </a-form-item>
  324. </a-col>
  325. <a-col :lg="12" :md="24" :sm="24">
  326. <a-form-item
  327. label="垂直位置"
  328. :labelCol="BaseTool.Constant.labelCol"
  329. :wrapperCol="BaseTool.Constant.wrapperCol"
  330. >
  331. <a-input-number
  332. :step="1"
  333. :min="340"
  334. style="width:70%"
  335. v-decorator="['jbdh']"
  336. placeholder="请输入离屏幕左上角的下方位置,最低340"/>
  337. <a-button style="width: 30%" type="primary" @click="handlePoint">设置预览</a-button>
  338. </a-form-item>
  339. </a-col>
  340. </a-row>-->
  341. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  342. <a-col :lg="12" :md="24" :sm="24">
  343. <a-form-item
  344. label="备注"
  345. :labelCol="BaseTool.Constant.labelCol"
  346. :wrapperCol="BaseTool.Constant.wrapperCol"
  347. >
  348. <a-input
  349. v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]" />
  350. </a-form-item>
  351. </a-col>
  352. <a-col :lg="12" :md="24" :sm="24">
  353. <a-form-item
  354. label="使用人员"
  355. :labelCol="BaseTool.Constant.labelCol"
  356. :wrapperCol="BaseTool.Constant.wrapperCol"
  357. >
  358. <a-input
  359. v-decorator="['saveUser', {rules: [{required: false, message: '使用人员不能为空'}]}]" />
  360. </a-form-item>
  361. </a-col>
  362. </a-row>
  363. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  364. <a-col :lg="12" :md="24" :sm="24">
  365. <a-form-item
  366. label="设备识别码"
  367. :labelCol="BaseTool.Constant.labelCol"
  368. :wrapperCol="BaseTool.Constant.wrapperCol"
  369. >
  370. <a-input
  371. v-decorator="['identifyNo', {rules: [{required: false, message: '设备识别码不能为空'}]}]" />
  372. </a-form-item>
  373. </a-col>
  374. <a-col :lg="12" :md="24" :sm="24">
  375. <a-form-item
  376. label="设备注册码"
  377. :labelCol="BaseTool.Constant.labelCol"
  378. :wrapperCol="BaseTool.Constant.wrapperCol"
  379. >
  380. <a-input
  381. v-decorator="['sbRegisterNo', {rules: [{required: false, message: '设备注册码不能为空'}]}]" />
  382. </a-form-item>
  383. </a-col>
  384. <a-col :lg="12" :md="24" :sm="24">
  385. <a-form-item
  386. label="使用证号"
  387. :labelCol="BaseTool.Constant.labelCol"
  388. :wrapperCol="BaseTool.Constant.wrapperCol"
  389. >
  390. <a-input
  391. v-decorator="['useNo', {rules: [{required: false, message: '使用证号不能为空'}]}]" />
  392. </a-form-item>
  393. </a-col>
  394. <a-col :lg="12" :md="24" :sm="24">
  395. <a-form-item
  396. label="设备代号"
  397. :labelCol="BaseTool.Constant.labelCol"
  398. :wrapperCol="BaseTool.Constant.wrapperCol"
  399. >
  400. <a-input
  401. v-decorator="['sbCode', {rules: [{required: false, message: '设备代号不能为空'}]}]" />
  402. </a-form-item>
  403. </a-col>
  404. <a-col :lg="12" :md="24" :sm="24">
  405. <a-form-item
  406. label="安装单位"
  407. :labelCol="BaseTool.Constant.labelCol"
  408. :wrapperCol="BaseTool.Constant.wrapperCol"
  409. >
  410. <a-input
  411. v-decorator="['installUnit', {rules: [{required: false, message: '安装单位不能为空'}]}]" />
  412. </a-form-item>
  413. </a-col>
  414. <a-col :lg="12" :md="24" :sm="24">
  415. <a-form-item
  416. label="检验结论"
  417. :labelCol="BaseTool.Constant.labelCol"
  418. :wrapperCol="BaseTool.Constant.wrapperCol"
  419. >
  420. <a-input
  421. v-decorator="['examResult', {rules: [{required: false, message: '检验结论不能为空'}]}]" />
  422. </a-form-item>
  423. </a-col>
  424. <a-col :lg="12" :md="24" :sm="24">
  425. <a-form-item
  426. label="单位内部使用地点"
  427. :labelCol="BaseTool.Constant.labelCol"
  428. :wrapperCol="BaseTool.Constant.wrapperCol"
  429. >
  430. <a-input
  431. v-decorator="['usePosition', {rules: [{required: false, message: '单位内部使用地点不能为空'}]}]" />
  432. </a-form-item>
  433. </a-col>
  434. </a-row>
  435. <!-- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  436. <a-col :lg="12" :md="24" :sm="24">
  437. <a-form-item
  438. label="所属区域"
  439. :labelCol="BaseTool.Constant.labelCol"
  440. :wrapperCol="BaseTool.Constant.wrapperCol"
  441. >
  442. <a-select @change="handleAreaChange" v-decorator="['useArea', {rules: [{required: true, message: '所属区域不能为空'}]}]" placeholder="请选择">
  443. <a-select-option
  444. v-for="({deptId, name}) in areaList"
  445. :key="deptId"
  446. :label="name"
  447. :value="deptId">{{ name }}
  448. </a-select-option>
  449. </a-select>
  450. </a-form-item>
  451. </a-col>
  452. <a-col :lg="12" :md="24" :sm="24">
  453. <a-form-item
  454. label="所属公司"
  455. :labelCol="BaseTool.Constant.labelCol"
  456. :wrapperCol="BaseTool.Constant.wrapperCol"
  457. >
  458. <a-select @change="handleCompanyChange" v-decorator="['useCompany', {rules: [{required: true, message: '所属公司不能为空'}]}]" placeholder="请选择">
  459. <a-select-option
  460. v-for="({deptId, name}) in companyList"
  461. :key="deptId"
  462. :label="name"
  463. :value="deptId">{{ name }}
  464. </a-select-option>
  465. </a-select>
  466. </a-form-item>
  467. </a-col>
  468. </a-row>
  469. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  470. <a-col :lg="12" :md="24" :sm="24">
  471. <a-form-item
  472. label="所属项目部"
  473. :labelCol="BaseTool.Constant.labelCol"
  474. :wrapperCol="BaseTool.Constant.wrapperCol"
  475. >
  476. <a-select @change="handleProjectChange" v-decorator="['useProject', {rules: [{required: true, message: '项目部不能为空'}]}]" placeholder="请选择">
  477. <a-select-option
  478. v-for="({deptId, name}) in projectList"
  479. :key="deptId"
  480. :label="name"
  481. :value="deptId">{{ name }}
  482. </a-select-option>
  483. </a-select>
  484. </a-form-item>
  485. </a-col>
  486. <a-col :lg="12" :md="24" :sm="24">
  487. <a-form-item
  488. label="所属部门"
  489. :labelCol="BaseTool.Constant.labelCol"
  490. :wrapperCol="BaseTool.Constant.wrapperCol"
  491. >
  492. <a-select @change="handleDeptChange" v-decorator="['useDept', {rules: [{required: true, message: '所属公司不能为空'}]}]" placeholder="请选择">
  493. <a-select-option
  494. v-for="({deptId, name}) in deptList"
  495. :key="deptId"
  496. :label="name"
  497. :value="deptId">{{ name }}
  498. </a-select-option>
  499. </a-select>
  500. </a-form-item>
  501. </a-col>
  502. </a-row>-->
  503. <!--<a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  504. <a-col :lg="12" :md="24" :sm="24">
  505. <a-form-item
  506. label="所属班组"
  507. :labelCol="BaseTool.Constant.labelCol"
  508. :wrapperCol="BaseTool.Constant.wrapperCol"
  509. >
  510. <a-select @change="handleGroupChange" v-decorator="['useGroup', {rules: [{required: true, message: '项目部不能为空'}]}]" placeholder="请选择">
  511. <a-select-option
  512. v-for="({deptId, name}) in groupList"
  513. :key="deptId"
  514. :label="name"
  515. :value="deptId">{{ name }}
  516. </a-select-option>
  517. </a-select>
  518. </a-form-item>
  519. </a-col>
  520. <a-col :lg="12" :md="24" :sm="24">
  521. <a-form-item
  522. label="维修人"
  523. :labelCol="BaseTool.Constant.labelCol"
  524. :wrapperCol="BaseTool.Constant.wrapperCol"
  525. >
  526. <a-select v-decorator="['repairUser']" placeholder="请选择">
  527. <a-select-option
  528. v-for="({userId, realName}) in userList"
  529. :key="userId"
  530. :label="realName"
  531. :value="userId">{{ realName }}
  532. </a-select-option>
  533. </a-select>
  534. </a-form-item>
  535. </a-col>
  536. <a-col :lg="12" :md="24" :sm="24">
  537. <a-form-item
  538. label="第二维修人员"
  539. :labelCol="BaseTool.Constant.labelCol"
  540. :wrapperCol="BaseTool.Constant.wrapperCol"
  541. >
  542. <a-select v-decorator="['repairUserSecond']" placeholder="请选择">
  543. <a-select-option
  544. v-for="({userId, realName}) in userList"
  545. :key="userId"
  546. :label="realName"
  547. :value="userId">{{ realName }}
  548. </a-select-option>
  549. </a-select>
  550. </a-form-item>
  551. </a-col>
  552. </a-row>-->
  553. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  554. <a-col :lg="12" :md="24" :sm="24">
  555. <a-form-item
  556. label="购置日期"
  557. :labelCol="BaseTool.Constant.labelCol"
  558. :wrapperCol="BaseTool.Constant.wrapperCol"
  559. >
  560. <a-date-picker
  561. style="width: 100%"
  562. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  563. v-decorator="['buyDate']" />
  564. </a-form-item>
  565. </a-col>
  566. <a-col :lg="12" :md="24" :sm="24">
  567. <a-form-item
  568. label="投用日期"
  569. :labelCol="BaseTool.Constant.labelCol"
  570. :wrapperCol="BaseTool.Constant.wrapperCol"
  571. >
  572. <a-date-picker
  573. style="width: 100%"
  574. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  575. v-decorator="['startDate']" />
  576. </a-form-item>
  577. </a-col>
  578. </a-row>
  579. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  580. <a-col :lg="12" :md="24" :sm="24">
  581. <a-form-item
  582. label="使用寿命"
  583. :labelCol="BaseTool.Constant.labelCol"
  584. :wrapperCol="BaseTool.Constant.wrapperCol"
  585. >
  586. <a-input
  587. style="width: 100%"
  588. suffix="年"
  589. :formatter="BaseTool.Amount.formatter"
  590. :parser="BaseTool.Amount.parser"
  591. v-decorator="['workYear', {rules: [{required: true, message: '不能为空'}]}]" />
  592. </a-form-item>
  593. </a-col>
  594. <a-col :lg="12" :md="24" :sm="24">
  595. <a-form-item
  596. label="资产编号(财务编码)"
  597. :labelCol="BaseTool.Constant.labelCol"
  598. :wrapperCol="BaseTool.Constant.wrapperCol"
  599. >
  600. <a-input
  601. v-decorator="['financingNo']" />
  602. </a-form-item>
  603. </a-col>
  604. <!-- <a-col :lg="12" :md="24" :sm="24">
  605. <a-form-item
  606. label="关联维修部门"
  607. :labelCol="BaseTool.Constant.labelCol"
  608. :wrapperCol="BaseTool.Constant.wrapperCol"
  609. >
  610. <a-select v-decorator="['repairDeptId']" placeholder="请选择">
  611. <a-select-option
  612. v-for="(label,value) in repairDeptMap"
  613. :key="value"
  614. :label="label"
  615. :value="value">{{ label }}
  616. </a-select-option>
  617. </a-select>
  618. </a-form-item>
  619. </a-col>-->
  620. </a-row>
  621. <title-divider title="自定义参数" width="120px"></title-divider>
  622. <div class="table-operator" style="margin-bottom: 8px;">
  623. <a-button type="primary" @click="handleParam">
  624. <a-icon type="plus"/>
  625. 添加
  626. </a-button>
  627. </div>
  628. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  629. <a-col :key="index" v-for="(item, index) in paramList" :lg="12" :md="24" :sm="24">
  630. <a-form-item
  631. :label="item.name"
  632. :labelCol="BaseTool.Constant.labelCol"
  633. :wrapperCol="BaseTool.Constant.wrapperCol"
  634. >
  635. <a-input
  636. style="width: 70%"
  637. :defaultValue="item.content"
  638. disabled
  639. />
  640. <a-button style="width: 30%" type="primary" @click="handleDelParam(index)">删除</a-button>
  641. </a-form-item>
  642. </a-col>
  643. </a-row>
  644. <title-divider v-show="useType == 5" title="特种信息" width="90px"></title-divider>
  645. <div v-show="useType == 5" >
  646. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  647. <a-col :lg="12" :md="24" :sm="24">
  648. <a-form-item
  649. label="注册代码"
  650. :labelCol="BaseTool.Constant.labelCol"
  651. :wrapperCol="BaseTool.Constant.wrapperCol"
  652. >
  653. <a-input
  654. v-decorator="['registerNo']" />
  655. </a-form-item>
  656. </a-col>
  657. <a-col :lg="12" :md="24" :sm="24">
  658. <a-form-item
  659. label="介质属性"
  660. :labelCol="BaseTool.Constant.labelCol"
  661. :wrapperCol="BaseTool.Constant.wrapperCol"
  662. >
  663. <a-input
  664. v-decorator="['characterType']" />
  665. </a-form-item>
  666. </a-col>
  667. </a-row>
  668. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  669. <a-col :lg="12" :md="24" :sm="24">
  670. <a-form-item
  671. label="设备批号"
  672. :labelCol="BaseTool.Constant.labelCol"
  673. :wrapperCol="BaseTool.Constant.wrapperCol"
  674. >
  675. <a-input
  676. v-decorator="['batchNo']" />
  677. </a-form-item>
  678. </a-col>
  679. <a-col :lg="12" :md="24" :sm="24">
  680. <a-form-item
  681. label="使用登记证编号"
  682. :labelCol="BaseTool.Constant.labelCol"
  683. :wrapperCol="BaseTool.Constant.wrapperCol"
  684. >
  685. <a-input
  686. v-decorator="['usedNo']" />
  687. </a-form-item>
  688. </a-col>
  689. </a-row>
  690. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  691. <a-col :lg="12" :md="24" :sm="24">
  692. <a-form-item
  693. label="维护供应商"
  694. :labelCol="BaseTool.Constant.labelCol"
  695. :wrapperCol="BaseTool.Constant.wrapperCol"
  696. >
  697. <a-input
  698. v-decorator="['supplier']" />
  699. </a-form-item>
  700. </a-col>
  701. <a-col :lg="12" :md="24" :sm="24">
  702. <a-form-item
  703. label="登记日期"
  704. :labelCol="BaseTool.Constant.labelCol"
  705. :wrapperCol="BaseTool.Constant.wrapperCol"
  706. >
  707. <a-date-picker
  708. style="width: 100%"
  709. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  710. v-decorator="['registerDate']" />
  711. </a-form-item>
  712. </a-col>
  713. </a-row>
  714. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  715. <a-col :lg="12" :md="24" :sm="24">
  716. <a-form-item
  717. label="设计到期年限"
  718. :labelCol="BaseTool.Constant.labelCol"
  719. :wrapperCol="BaseTool.Constant.wrapperCol"
  720. >
  721. <a-date-picker
  722. style="width: 100%"
  723. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  724. v-decorator="['retirementDate']" />
  725. </a-form-item>
  726. </a-col>
  727. </a-row>
  728. </div>
  729. <title-divider title="检定周期信息" width="90px"></title-divider>
  730. <div>
  731. <!-- <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  732. <a-col :lg="12" :md="24" :sm="24">
  733. <a-form-item
  734. label="计量设备编号"
  735. :labelCol="BaseTool.Constant.labelCol"
  736. :wrapperCol="BaseTool.Constant.wrapperCol"
  737. >
  738. <a-input
  739. v-decorator="['cardNo']" />
  740. </a-form-item>
  741. </a-col>
  742. <a-col :lg="12" :md="24" :sm="24">
  743. <a-form-item
  744. label="准确度等级"
  745. :labelCol="BaseTool.Constant.labelCol"
  746. :wrapperCol="BaseTool.Constant.wrapperCol"
  747. >
  748. <a-input
  749. v-decorator="['fdjxh']" />
  750. </a-form-item>
  751. </a-col>
  752. </a-row>
  753. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  754. <a-col :lg="12" :md="24" :sm="24">
  755. <a-form-item
  756. label="检定单位"
  757. :labelCol="BaseTool.Constant.labelCol"
  758. :wrapperCol="BaseTool.Constant.wrapperCol"
  759. >
  760. <a-input
  761. v-decorator="['dph']" />
  762. </a-form-item>
  763. </a-col>
  764. <a-col :lg="12" :md="24" :sm="24">
  765. <a-form-item
  766. label="检定人"
  767. :labelCol="BaseTool.Constant.labelCol"
  768. :wrapperCol="BaseTool.Constant.wrapperCol"
  769. >
  770. <a-input
  771. v-decorator="['zaiz']" />
  772. </a-form-item>
  773. </a-col>
  774. </a-row>
  775. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  776. <a-col :lg="12" :md="24" :sm="24">
  777. <a-form-item
  778. label="检定结论"
  779. :labelCol="BaseTool.Constant.labelCol"
  780. :wrapperCol="BaseTool.Constant.wrapperCol"
  781. >
  782. <a-select v-decorator="['rlType']" placeholder="请选择">
  783. <a-select-option
  784. v-for="(label,value) in rlTypeMap"
  785. :key="value"
  786. :label="label"
  787. :value="parseInt(value)">{{ label }}
  788. </a-select-option>
  789. </a-select>
  790. </a-form-item>
  791. </a-col>
  792. <a-col :lg="12" :md="24" :sm="24">
  793. <a-form-item
  794. label="是否周检查"
  795. :labelCol="BaseTool.Constant.labelCol"
  796. :wrapperCol="BaseTool.Constant.wrapperCol"
  797. >
  798. <a-select v-decorator="['color']" placeholder="请选择">
  799. <a-select-option
  800. v-for="(label,value) in colorMap"
  801. :key="value"
  802. :label="label"
  803. :value="parseInt(value)">{{ label }}
  804. </a-select-option>
  805. </a-select>
  806. </a-form-item>
  807. </a-col>
  808. </a-row>
  809. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  810. <a-col :lg="12" :md="24" :sm="24">
  811. <a-form-item
  812. label="检定证书编号"
  813. :labelCol="BaseTool.Constant.labelCol"
  814. :wrapperCol="BaseTool.Constant.wrapperCol"
  815. >
  816. <a-input
  817. v-decorator="['sbdh']" />
  818. </a-form-item>
  819. </a-col>
  820. </a-row>-->
  821. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  822. <a-col :lg="12" :md="24" :sm="24">
  823. <a-form-item
  824. label="上次检定日期"
  825. :labelCol="BaseTool.Constant.labelCol"
  826. :wrapperCol="BaseTool.Constant.wrapperCol"
  827. >
  828. <a-date-picker
  829. style="width: 100%"
  830. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  831. v-decorator="['checkDate', {rules: [{required: useType == 4, message: '上次检定日期不能为空'}]}]" />
  832. </a-form-item>
  833. </a-col>
  834. <a-col :lg="12" :md="24" :sm="24">
  835. <a-form-item
  836. label="检定周期"
  837. :labelCol="BaseTool.Constant.labelCol"
  838. :wrapperCol="BaseTool.Constant.wrapperCol"
  839. >
  840. <a-input
  841. style="width: 100%"
  842. suffix="月"
  843. :formatter="BaseTool.Amount.formatter"
  844. :parser="BaseTool.Amount.parser"
  845. v-decorator="['checkPeriod']" />
  846. </a-form-item>
  847. </a-col>
  848. </a-row>
  849. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  850. <a-col :lg="12" :md="24" :sm="24">
  851. <a-form-item
  852. label="检定有效期至"
  853. :labelCol="BaseTool.Constant.labelCol"
  854. :wrapperCol="BaseTool.Constant.wrapperCol"
  855. >
  856. <a-date-picker
  857. style="width: 100%"
  858. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  859. v-decorator="['nextCheckDate']" />
  860. </a-form-item>
  861. </a-col>
  862. <a-col :lg="12" :md="24" :sm="24">
  863. <a-form-item
  864. label="预警天数"
  865. :labelCol="BaseTool.Constant.labelCol"
  866. :wrapperCol="BaseTool.Constant.wrapperCol"
  867. >
  868. <a-input-number
  869. style="width: 100%"
  870. :min="30"
  871. :step="1"
  872. :formatter="BaseTool.Amount.formatter"
  873. :parser="BaseTool.Amount.parser"
  874. v-decorator="['seatNumber']" />
  875. </a-form-item>
  876. </a-col>
  877. </a-row>
  878. <a-row>
  879. <a-col :lg="12" :md="24" :sm="24">
  880. <a-form-item
  881. label="检定单位"
  882. :labelCol="BaseTool.Constant.labelCol"
  883. :wrapperCol="BaseTool.Constant.wrapperCol"
  884. >
  885. <a-input
  886. v-decorator="['dph']" />
  887. </a-form-item>
  888. </a-col>
  889. <a-col :lg="12" :md="24" :sm="24">
  890. <a-form-item
  891. label="是否需要检定"
  892. :labelCol="BaseTool.Constant.labelCol"
  893. :wrapperCol="BaseTool.Constant.wrapperCol"
  894. >
  895. <a-select @change="isMeasureChange" v-decorator="['isMeasure', { rules: [{required: true, message: '是否需要检定不能为空'}]}]" placeholder="请选择">
  896. <a-select-option
  897. v-for="(label,value) in yesNoMap"
  898. :key="value"
  899. :label="label"
  900. :value="parseInt(value)">{{ label }}
  901. </a-select-option>
  902. </a-select>
  903. </a-form-item>
  904. </a-col>
  905. <a-col :lg="12" :md="24" :sm="24">
  906. <a-form-item
  907. label="是否自检"
  908. :labelCol="BaseTool.Constant.labelCol"
  909. :wrapperCol="BaseTool.Constant.wrapperCol"
  910. >
  911. <a-select v-decorator="['isSelf', { rules: [{required: isSelfRequired, message: '是否需要检定不能为空'}]}]" placeholder="请选择">
  912. <a-select-option
  913. v-for="(label,value) in yesNoMap"
  914. :key="value"
  915. :label="label"
  916. :value="parseInt(value)">{{ label }}
  917. </a-select-option>
  918. </a-select>
  919. </a-form-item>
  920. </a-col>
  921. </a-row>
  922. </div>
  923. <title-divider title="文件信息" width="90px"></title-divider>
  924. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  925. <a-col :lg="12" :md="24" :sm="24">
  926. <a-form-item
  927. label="维保手册"
  928. :labelCol="BaseTool.Constant.labelCol"
  929. :wrapperCol="BaseTool.Constant.wrapperCol"
  930. >
  931. <a-upload
  932. :action="uploadUrl"
  933. :multiple="true"
  934. :file-list="this.defaultRepairFileList"
  935. @change="handleRepairFileChange"
  936. :headers="headers"
  937. >
  938. <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
  939. </a-upload>
  940. </a-form-item>
  941. </a-col>
  942. <a-col :lg="12" :md="24" :sm="24">
  943. <a-form-item
  944. label="使用手册"
  945. :labelCol="BaseTool.Constant.labelCol"
  946. :wrapperCol="BaseTool.Constant.wrapperCol"
  947. >
  948. <a-upload
  949. :action="uploadUrl"
  950. :multiple="true"
  951. :file-list="this.defaultUseFileList"
  952. @change="handleUseFileChange"
  953. :headers="headers"
  954. >
  955. <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
  956. </a-upload>
  957. </a-form-item>
  958. </a-col>
  959. </a-row>
  960. <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
  961. <a-col :lg="12" :md="24" :sm="24">
  962. <a-form-item
  963. label="验收文件"
  964. :labelCol="BaseTool.Constant.labelCol"
  965. :wrapperCol="BaseTool.Constant.wrapperCol"
  966. >
  967. <a-upload
  968. :action="uploadUrl"
  969. :multiple="true"
  970. :file-list="this.defaultRecheckFileList"
  971. @change="handleRecheckFileChange"
  972. :headers="headers"
  973. >
  974. <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
  975. </a-upload>
  976. </a-form-item>
  977. </a-col>
  978. <a-col :lg="12" :md="24" :sm="24">
  979. <a-form-item
  980. label="设备图片"
  981. :labelCol="BaseTool.Constant.labelCol"
  982. :wrapperCol="BaseTool.Constant.wrapperCol"
  983. >
  984. <a-upload
  985. :action="uploadUrl"
  986. :multiple="false"
  987. list-type="picture"
  988. :file-list="this.defaultSbFileList"
  989. @change="handleSbFileChange"
  990. accept="image/*"
  991. :headers="headers"
  992. >
  993. <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
  994. </a-upload>
  995. </a-form-item>
  996. </a-col>
  997. </a-row>
  998. </a-form>
  999. <sb-model-select-modal ref="sbModelSelectModal" @selected="handleSbModelSelected"/>
  1000. <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd"/>
  1001. <firm-producer-select-modal ref="producerSelectModal" @selected="handleProducerSelected"/>
  1002. <param-form ref="paramForm" @ok="handleParamList" />
  1003. </a-card>
  1004. </template>
  1005. <script>
  1006. import pick from 'lodash.pick'
  1007. import { addSbInfo, updateSbInfo, fetchSbInfo, copySbInfo } from '@/api/sb/info'
  1008. import { fetchSbTypeTree } from '@/api/sb/type'
  1009. import { getSbPositionTree, querySbPosition } from '@/api/sb/position'
  1010. import FirmProducerSelectModal from '@/views/firm/producer/modules/FirmProducerSelectModal'
  1011. import SbGuigeSelectModal from '@/views/sb/guige/modules/SbGuigeSelectModal'
  1012. import SbModelSelectModal from '@/views/sb/model/modules/SbModelSelectModal'
  1013. import BaseTool from '../../../../utils/tool'
  1014. import { queryUserDeptByUserDeptId } from '@/api/upms/user-dept'
  1015. import { ACCESS_TOKEN } from '@/store/mutation-types'
  1016. import Vue from 'vue'
  1017. import { uploadUrl } from '@/api/upms/file'
  1018. import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
  1019. import { queryUser } from '@/api/upms/user'
  1020. import DetailList from '@/components/tools/DetailList'
  1021. import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
  1022. import ParamForm from './ParamForm'
  1023. import { queryFirmProducer } from '@/api/firm/producer'
  1024. const DetailListItem = DetailList.Item
  1025. export default {
  1026. name: 'BaseSbInfo',
  1027. components: {
  1028. FirmProducerSelectModal,
  1029. SbGuigeSelectModal,
  1030. SbModelSelectModal,
  1031. SbInfoSelectModal,
  1032. ParamForm,
  1033. DetailList,
  1034. DetailListItem
  1035. },
  1036. data () {
  1037. return {
  1038. confirmLoading: false,
  1039. modalTitle: null,
  1040. form: this.$form.createForm(this),
  1041. areaList: {},
  1042. companyList: {},
  1043. paramList: [],
  1044. projectList: {},
  1045. deptList: {},
  1046. groupList: {},
  1047. visible: false,
  1048. sbTypeTreeData: [],
  1049. sbPositionData: [],
  1050. // sbInfoTreeData: [],
  1051. // sourceSbInfoTreeData: [],
  1052. // sbPositionTreeData: [],
  1053. repairDeptMap: {},
  1054. depreciationTypeMap: {},
  1055. sourceTypeMap: {},
  1056. levelMap: {},
  1057. rlTypeMap: {},
  1058. colorMap: {},
  1059. useTypeMap: {},
  1060. statusMap: {},
  1061. checkTypeMap: {},
  1062. isChildMap: {},
  1063. isShowMap: {},
  1064. yesNoMap: {},
  1065. lineMap: {},
  1066. treeData: [],
  1067. isFinancingMap: {},
  1068. producerList: {},
  1069. userList: {},
  1070. unitMap: {},
  1071. sbInfoSelectType: null,
  1072. repairFileList: [], // 维修手册
  1073. defaultRepairFileList: [],
  1074. defaultUseFileList: [],
  1075. defaultRecheckFileList: [],
  1076. defaultSbFileList: [],
  1077. useFileList: [], // 使用手册
  1078. recheckFileList: [], // 验收手册
  1079. sbFileList: [], // 设备图片,
  1080. isSelfRequired: false, // 是否自检,
  1081. uploadUrl: uploadUrl,
  1082. qrcodesrc: null,
  1083. id: null,
  1084. fileList: [],
  1085. type: null,
  1086. headers: {
  1087. Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
  1088. }
  1089. }
  1090. },
  1091. props: {
  1092. useType: {
  1093. type: Number,
  1094. default: 3
  1095. },
  1096. parentId: {
  1097. type: String,
  1098. default: null
  1099. },
  1100. parentName: {
  1101. type: String,
  1102. default: null
  1103. }
  1104. },
  1105. created () {
  1106. this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
  1107. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
  1108. this.colorMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_COLOR)
  1109. this.rlTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.RANLIAO_TYPE)
  1110. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
  1111. this.checkTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_TYPE)
  1112. this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
  1113. this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
  1114. this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
  1115. this.isChildMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_CHILD)
  1116. this.isShowMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_SHOW)
  1117. this.yesNoMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  1118. this.isFinancingMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_FINANCING)
  1119. this.repairDeptMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_DEPT_CATEGORY)
  1120. this.lineMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_LINE)
  1121. queryFirmProducer({}).then(res => {
  1122. this.producerList = res.data
  1123. })
  1124. getSbPositionTree().then(res => {
  1125. this.treeData = res.data
  1126. })
  1127. },
  1128. methods: {
  1129. base (record, type) {
  1130. if (this.parentId) {
  1131. const { form: { setFieldsValue } } = this
  1132. // 日期处理
  1133. this.$nextTick(() => {
  1134. setFieldsValue(Object.assign({
  1135. 'parentId': this.parentId,
  1136. 'parentSbName': this.parentName,
  1137. 'isChild': this.BaseTool.Object.getField(this.isChildMap, this.DictCache.VALUE.SB_IS_CHILD.IS_CHILD)
  1138. }))
  1139. })
  1140. }
  1141. this.setTree(record)
  1142. // 清除文件列表
  1143. this.visible = true
  1144. // 选择框查询条件
  1145. // 如果是空标识添加
  1146. if (this.BaseTool.Object.isBlank(record)) {
  1147. this.qrcodesrc = null
  1148. this.modalTitle = '添加'
  1149. this.clearFileList()
  1150. return
  1151. }
  1152. this.useType = record.useType
  1153. this.modalTitle = '编辑'
  1154. this.id = record.id
  1155. this.qrcodesrc = record.qrCode
  1156. this.repairFileList = record.repairFileList
  1157. this.useFileList = record.useFileList
  1158. this.recheckFileList = record.recheckFileList
  1159. this.sbFileList = record.sbFileList
  1160. this.defaultRepairFileList = this.BaseTool.UPLOAD.transImg(this.repairFileList)
  1161. this.defaultUseFileList = this.BaseTool.UPLOAD.transImg(this.useFileList)
  1162. this.defaultRecheckFileList = this.BaseTool.UPLOAD.transImg(this.recheckFileList)
  1163. this.defaultSbFileList = this.BaseTool.UPLOAD.transImg(this.sbFileList)
  1164. this.paramList = JSON.parse(record.paramList)
  1165. if (type === 1) {
  1166. this.type = type
  1167. this.modalTitle = '复制'
  1168. this.qrcodesrc = null
  1169. record.no = null
  1170. this.clearFileList()
  1171. }
  1172. const { form: { setFieldsValue } } = this
  1173. // 日期处理
  1174. // record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1175. // record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1176. // record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1177. // record.guaranteeDate = this.BaseTool.Moment(record.guaranteeDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1178. // record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1179. // record.lastRepaireTime = this.BaseTool.Moment(record.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1180. // record.lastBaoyangTime = this.BaseTool.Moment(record.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1181. if (record.buyDate != null) {
  1182. record.buyDate = this.BaseTool.Moment(record.buyDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1183. this.$nextTick(() => {
  1184. setFieldsValue(Object.assign(pick(record, [
  1185. 'buyDate'
  1186. ])))
  1187. })
  1188. }
  1189. if (record.startDate != null) {
  1190. record.startDate = this.BaseTool.Moment(record.startDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1191. this.$nextTick(() => {
  1192. setFieldsValue(Object.assign(pick(record, [
  1193. 'startDate'
  1194. ])))
  1195. })
  1196. }
  1197. if (record.checkDate != null) {
  1198. record.checkDate = this.BaseTool.Moment(record.checkDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1199. this.$nextTick(() => {
  1200. setFieldsValue(Object.assign(pick(record, [
  1201. 'checkDate'
  1202. ])))
  1203. })
  1204. }
  1205. if (record.nextCheckDate != null) {
  1206. record.nextCheckDate = this.BaseTool.Moment(record.nextCheckDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1207. this.$nextTick(() => {
  1208. setFieldsValue(Object.assign(pick(record, [
  1209. 'nextCheckDate'
  1210. ])))
  1211. })
  1212. }
  1213. if (record.retirementDate != null) {
  1214. record.retirementDate = this.BaseTool.Moment(record.retirementDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1215. this.$nextTick(() => {
  1216. setFieldsValue(Object.assign(pick(record, [
  1217. 'retirementDate'
  1218. ])))
  1219. })
  1220. }
  1221. if (record.registerDate != null) {
  1222. record.registerDate = this.BaseTool.Moment(record.registerDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1223. this.$nextTick(() => {
  1224. setFieldsValue(Object.assign(pick(record, [
  1225. 'registerDate'
  1226. ])))
  1227. })
  1228. }
  1229. record.unitName = this.BaseTool.Object.getField(this.unitMap, record.unit)
  1230. record.useTypeName = this.BaseTool.Object.getField(this.useTypeMap, record.useType)
  1231. this.$nextTick(() => {
  1232. setFieldsValue(Object.assign(pick(record, [
  1233. 'id',
  1234. 'no',
  1235. 'checkType',
  1236. 'parentId',
  1237. 'positionNo',
  1238. 'ppNo',
  1239. 'parentSbName',
  1240. 'isChild',
  1241. 'isShow',
  1242. 'isFinancing',
  1243. 'financingNo',
  1244. 'financingNoTwo',
  1245. 'financingNoThird',
  1246. 'financingNoFour',
  1247. 'financingNoFive',
  1248. 'name',
  1249. 'baoyangTimes',
  1250. 'model',
  1251. 'cph',
  1252. 'isMeasure',
  1253. 'isSelf',
  1254. 'positionId',
  1255. 'producerName',
  1256. 'useArea',
  1257. 'useCompany',
  1258. 'useProject',
  1259. 'useDept',
  1260. 'saveUser',
  1261. 'repairUser',
  1262. 'useGroup',
  1263. 'typeId',
  1264. 'level',
  1265. 'initialValue',
  1266. // 'cutValue',
  1267. 'producerId',
  1268. // 'sourceType',
  1269. 'unit',
  1270. 'buyDate',
  1271. 'startDate',
  1272. 'zbh',
  1273. // 'wbFile',
  1274. // 'useFile',
  1275. // 'checkFile',
  1276. // 'sbImage',
  1277. 'status',
  1278. 'remark',
  1279. 'zzh',
  1280. 'zz',
  1281. 'zjm',
  1282. 'jbdh',
  1283. 'useType',
  1284. 'cardNo',
  1285. 'fdjxh',
  1286. 'checkDate',
  1287. 'checkPeriod',
  1288. 'nextCheckDate',
  1289. 'dph',
  1290. 'zaiz',
  1291. 'rlType',
  1292. 'color',
  1293. 'sbdh',
  1294. 'seatNumber',
  1295. 'registerNo',
  1296. 'characterType',
  1297. 'usedNo',
  1298. 'supplier',
  1299. 'repairUserSecond',
  1300. 'batchNo',
  1301. 'workYear',
  1302. 'retirementDate',
  1303. 'registerDate',
  1304. 'repairDeptId'
  1305. ])))
  1306. })
  1307. },
  1308. save () {
  1309. const { form: { validateFieldsAndScroll } } = this
  1310. this.confirmLoading = true
  1311. validateFieldsAndScroll((errors, values) => {
  1312. if (errors) {
  1313. this.confirmLoading = false
  1314. this.$message.error(errors)
  1315. return
  1316. }
  1317. // 日期数据的处理
  1318. values.buyDate = BaseTool.Date.formatter(values.buyDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1319. values.startDate = BaseTool.Date.formatter(values.startDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1320. values.checkDate = BaseTool.Date.formatter(values.checkDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1321. values.nextCheckDate = BaseTool.Date.formatter(values.nextCheckDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1322. values.guaranteeDate = BaseTool.Date.formatter(values.guaranteeDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1323. values.retirementDate = BaseTool.Date.formatter(values.retirementDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1324. if (values.registerDate != null) {
  1325. values.registerDate = BaseTool.Date.formatter(values.registerDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1326. }
  1327. values.lastRepaireTime = this.BaseTool.Date.formatter(values.lastRepaireTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1328. values.lastBaoyangTime = this.BaseTool.Date.formatter(values.lastBaoyangTime, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1329. values.spDate = this.BaseTool.Date.formatter(values.spDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1330. values.jbdDate = this.BaseTool.Date.formatter(values.jbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1331. values.sbdDate = this.BaseTool.Date.formatter(values.sbdDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1332. values.sbDate = this.BaseTool.Date.formatter(values.sbDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1333. // 上传文件
  1334. values.repairFileList = this.repairFileList
  1335. values.useFileList = this.useFileList
  1336. values.recheckFileList = this.recheckFileList
  1337. values.sbFileList = this.sbFileList
  1338. values.paramList = JSON.stringify(this.paramList)
  1339. values.useType = this.useType
  1340. if (values.isChild === '父设备') {
  1341. values.isChild = 0
  1342. } else if (values.isChild === '子设备') {
  1343. values.isChild = 1
  1344. }
  1345. if (this.BaseTool.String.isBlank(values.id)) {
  1346. addSbInfo(values)
  1347. .then(() => {
  1348. this.handleCancel(values)
  1349. }).catch(() => {
  1350. this.confirmLoading = false
  1351. })
  1352. } else {
  1353. if (this.type == null) {
  1354. updateSbInfo(values)
  1355. .then(() => {
  1356. this.handleCancel(values)
  1357. }).catch(() => {
  1358. this.confirmLoading = false
  1359. })
  1360. } else {
  1361. copySbInfo(values)
  1362. .then(() => {
  1363. this.handleCancel(values)
  1364. }).catch(() => {
  1365. this.confirmLoading = false
  1366. })
  1367. }
  1368. }
  1369. })
  1370. },
  1371. getQrcodeSrc () {
  1372. // console.log(111, 22)
  1373. },
  1374. handleCancel () {
  1375. this.visible = false
  1376. this.confirmLoading = false
  1377. this.form.resetFields()
  1378. this.$emit('ok')
  1379. },
  1380. handleFresh () {
  1381. fetchSbInfo({ id: this.id }).then(res => {
  1382. const { form: { setFieldsValue } } = this
  1383. const record = res.data
  1384. this.$nextTick(() => {
  1385. setFieldsValue(Object.assign(pick(record, [
  1386. 'zjm',
  1387. 'jbdh'
  1388. ])))
  1389. })
  1390. })
  1391. },
  1392. setTree (record = {}) {
  1393. fetchSbTypeTree().then(res => {
  1394. this.sbTypeTreeData = res.data
  1395. })
  1396. querySbPosition().then(res => {
  1397. this.sbPositionData = res.data
  1398. })
  1399. // getSbInfoTree({ id: record.id }).then(res => {
  1400. // this.sbInfoTreeData = res.data
  1401. // this.sourceSbInfoTreeData = res.data
  1402. // })
  1403. // getSbPositionTree().then(res => {
  1404. // this.sbPositionTreeData = res.data
  1405. // })
  1406. queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then(res => {
  1407. this.areaList = res.data
  1408. })
  1409. if (record.useArea != null) {
  1410. getDeptsAllByParentId({ deptId: record.useArea, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
  1411. this.companyList = res.data
  1412. })
  1413. getDeptsAllByParentId({ deptId: record.useCompany, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
  1414. this.projectList = res.data
  1415. })
  1416. getDeptsAllByParentId({ deptId: record.useProject, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then(res => {
  1417. this.deptList = res.data
  1418. })
  1419. getDeptsAllByParentId({ deptId: record.useDept, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then(res => {
  1420. this.groupList = res.data
  1421. })
  1422. queryUser({ }).then(res => {
  1423. this.userList = res.data
  1424. })
  1425. }
  1426. queryUser({ }).then(res => {
  1427. this.userList = res.data
  1428. })
  1429. },
  1430. handleSbModelSelect () {
  1431. const modal = this.$refs.sbModelSelectModal
  1432. modal.base()
  1433. },
  1434. handleSbModelSelected (keys, rows) {
  1435. const [ key ] = keys
  1436. const [ row ] = rows
  1437. const { form: { setFieldsValue } } = this
  1438. this.$nextTick(() => {
  1439. setFieldsValue({
  1440. 'modelId': key,
  1441. 'name': row.name,
  1442. 'model': row.model,
  1443. 'nameModel': row.nameModel,
  1444. 'typeId': row.typeId,
  1445. 'typeName': row.typeName,
  1446. 'level': row.level,
  1447. 'initialValue': row.value,
  1448. 'useType': row.useType,
  1449. 'useTypeName': this.BaseTool.Object.getField(this.useTypeMap, row.useType),
  1450. 'producerId': row.producerId,
  1451. 'producerName': row.producerName,
  1452. 'unit': row.unit,
  1453. 'unitName': this.BaseTool.Object.getField(this.unitMap, row.unit)
  1454. })
  1455. })
  1456. },
  1457. beforeRecheckFileListUpload (file) {
  1458. const reg = /\.(xls|xlsx)(\?.*)?$/
  1459. return new Promise((resolve, reject) => {
  1460. if (reg.test(file.name)) {
  1461. this.recheckFileList = [file]
  1462. return true
  1463. } else {
  1464. this.$message.error(`请上传正确的xls|xlsx文件`)
  1465. reject(new Error('请上传正确的xls|xlsx文件'))
  1466. return false
  1467. }
  1468. })
  1469. },
  1470. beforeUploadPic (file) {
  1471. const reg = /\.(jpg|jpeg|png)(\?.*)?$/
  1472. return new Promise((resolve, reject) => {
  1473. if (reg.test(file.name)) {
  1474. this.sbFileList = [file]
  1475. return true
  1476. } else {
  1477. this.$message.error(`请上传正确的jpg|jpeg|png文件`)
  1478. reject(new Error('请上传正确的jpg|jpeg|png文件'))
  1479. return false
  1480. }
  1481. })
  1482. },
  1483. clearFileList () {
  1484. this.repairFileList = []
  1485. this.useFileList = []
  1486. this.recheckFileList = []
  1487. this.sbFileList = []
  1488. },
  1489. handleRepairFileChange (info) {
  1490. this.defaultRepairFileList = info.fileList
  1491. this.repairFileList = this.setFileList(info, 1)
  1492. },
  1493. handleUseFileChange (info) {
  1494. this.defaultUseFileList = info.fileList
  1495. this.useFileList = this.setFileList(info, 2)
  1496. },
  1497. handleAreaChange (value) {
  1498. getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
  1499. this.companyList = res.data
  1500. })
  1501. },
  1502. handleCompanyChange (value) {
  1503. getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
  1504. this.projectList = res.data
  1505. })
  1506. },
  1507. handleProjectChange (value) {
  1508. getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then(res => {
  1509. this.deptList = res.data
  1510. })
  1511. },
  1512. handleDeptChange (value) {
  1513. getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then(res => {
  1514. this.groupList = res.data
  1515. })
  1516. },
  1517. handleGroupChange (value) {
  1518. queryUserDeptByUserDeptId({ deptId: value }).then(res => {
  1519. this.userList = res.data
  1520. })
  1521. },
  1522. handleRecheckFileChange (info) {
  1523. this.defaultRecheckFileList = info.fileList
  1524. this.recheckFileList = this.setFileList(info, 3)
  1525. },
  1526. handleSbFileChange (info) {
  1527. this.defaultSbFileList = info.fileList
  1528. this.sbFileList = this.setFileList(info, 4)
  1529. },
  1530. clearParent () {
  1531. const { form: { setFieldsValue } } = this
  1532. // 日期处理
  1533. this.$nextTick(() => {
  1534. setFieldsValue(Object.assign({
  1535. 'parentId': null,
  1536. 'parentSbName': null
  1537. }))
  1538. })
  1539. },
  1540. // 主子设备切换
  1541. childChange (value) {
  1542. if (value === this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT || value === this.DictCache.VALUE.SB_IS_CHILD.IS_NORMAL) {
  1543. const { form: { setFieldsValue } } = this
  1544. // 日期处理
  1545. this.$nextTick(() => {
  1546. setFieldsValue(Object.assign({
  1547. 'parentId': null,
  1548. 'parentSbName': null
  1549. }))
  1550. })
  1551. }
  1552. },
  1553. // 设置为需要检定的,是否自检也要设置
  1554. isMeasureChange (value) {
  1555. if (value === this.DictCache.VALUE.YES_NO.YES) {
  1556. this.isSelfRequired = true
  1557. } else {
  1558. this.isSelfRequired = false
  1559. }
  1560. },
  1561. handleSbSelect () {
  1562. this.$refs.sbInfoSelectModal.base({}, { isChild: this.DictCache.VALUE.SB_IS_CHILD.IS_PARENT })
  1563. },
  1564. handleSbSelectd (keys, rows) {
  1565. const [ key ] = keys
  1566. const [ row ] = rows
  1567. const { form: { setFieldsValue } } = this
  1568. // 日期处理
  1569. this.$nextTick(() => {
  1570. setFieldsValue(Object.assign({
  1571. 'parentId': key,
  1572. 'parentSbName': row.name,
  1573. 'ppNo': row.positionNo
  1574. }))
  1575. })
  1576. },
  1577. handleChange (value) {
  1578. this.useType = value
  1579. },
  1580. handleProducerSelect () {
  1581. const modal = this.$refs.producerSelectModal
  1582. modal.base({}, { type: 1 })
  1583. },
  1584. handleProducerSelected (record, selectedRowKeys, selectedRow) {
  1585. const { form: { setFieldsValue } } = this
  1586. const [ key ] = selectedRowKeys
  1587. const [ row ] = selectedRow
  1588. setFieldsValue({
  1589. 'producerId': key,
  1590. 'producerName': row.name
  1591. })
  1592. },
  1593. filterOptionProducer (input, option) {
  1594. return (
  1595. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  1596. )
  1597. },
  1598. setFileList (info, type) {
  1599. // { file, fileList }
  1600. const file = info.file
  1601. // console.log('file: ' + JSON.stringify(file))
  1602. const fileList = info.fileList
  1603. // fileList = fileList.slice(-2)
  1604. // console.log(111, this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type))
  1605. if (file.status === 'done') {
  1606. return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
  1607. } else if (file.status === 'removed') {
  1608. return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
  1609. } else if (file.status === 'error') {
  1610. this.$message.error('上传失败')
  1611. return null
  1612. }
  1613. },
  1614. handlePoint () {
  1615. const { form: { getFieldValue } } = this
  1616. const zjm = getFieldValue('zjm')
  1617. const jbdh = getFieldValue('jbdh')
  1618. const a = document.createElement('a')
  1619. a.href = '/hitch-screen/point.html?id=' + this.id + '&zjm=' + zjm + '&jbdh=' + jbdh
  1620. a.target = '_blank'
  1621. a.click()
  1622. },
  1623. handleParam () {
  1624. const modal = this.$refs.paramForm
  1625. modal.base(this.model)
  1626. },
  1627. handleParamList (values) {
  1628. // console.log(values)
  1629. if (this.paramList == null) {
  1630. this.paramList = []
  1631. }
  1632. this.paramList.push(values)
  1633. },
  1634. handleDelParam (index) {
  1635. // console.log(index)
  1636. this.paramList.splice(index, 1)
  1637. }
  1638. }
  1639. }
  1640. </script>