BaseForm.vue 59 KB

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