index.vue 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063
  1. <template>
  2. <div class="app-container">
  3. <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
  4. <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
  5. <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
  6. </div>
  7. <el-tabs v-model="tabName" @tab-click="handleTabClick">
  8. <el-tab-pane v-if="isBasic" label="备件基础信息" name="first">
  9. <div class="filter-container">
  10. <el-input v-model="getdataListParm.parammaps.partCode" placeholder="备件编号" style="width: 200px;" class="filter-item" />
  11. <el-input v-model="getdataListParm.parammaps.partName" placeholder="备件名称" style="width: 140px;" class="filter-item" />
  12. <el-input v-model="getdataListParm.parammaps.specification" placeholder="备件规格" style="width: 200px;" class="filter-item" />
  13. <tree-select
  14. class="typeSelect"
  15. :height="150"
  16. :width="250"
  17. size="small"
  18. clearable
  19. :data="parentDept"
  20. :disabled="disabled"
  21. :placeholder="placeholder"
  22. style="display:inline-block;"
  23. :default-props="defaultProps"
  24. :node-key="nodeKey"
  25. :checked-keys="defaultCheckedKeys"
  26. @popoverHide="popoverHide"
  27. />
  28. <el-date-picker
  29. ref="inputDatetime"
  30. v-model="getdataListParm.parammaps.inputDatetime"
  31. class="inputDatetime"
  32. type="datetimerange"
  33. style="width: 250px;top:-3px;"
  34. format="yyyy-MM-dd"
  35. value-format="yyyy-MM-dd"
  36. range-separator="至"
  37. start-placeholder="审批时间"
  38. end-placeholder="审批时间"
  39. />
  40. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
  41. <div>
  42. <el-button v-if="isBasicAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">新增</el-button>
  43. <el-button v-if="isBasicTemplate" v-waves class="filter-item" type="info" icon="el-icon-tickets" @click="handleDownloadTemp">模板</el-button>
  44. <el-button v-if="isDisable" v-waves class="filter-item" type="danger" icon="el-icon-remove-outline" @click="handleBatchDisable">批量禁用</el-button>
  45. <el-button v-if="isEnable" v-waves class="filter-item" type="danger" icon="el-icon-success" @click="handleBatchEnable">批量启用</el-button>
  46. <el-upload style="display: inline-block;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImportExcel" :on-success="handleImportExcelSuccess">
  47. <el-button v-if="isBasicImport" v-waves class="filter-item" type="warning" icon="el-icon-download" @click="form_search">导入</el-button>
  48. </el-upload>
  49. <el-button v-if="isBasicExport" v-waves class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
  50. <el-button v-if="isEasSynchronization" class="filter-item" type="primary" style="float: right;" @click="handleEAS">EAS同步</el-button>
  51. </div>
  52. </div>
  53. <el-table
  54. :key="tableKey"
  55. v-loading="listLoading"
  56. element-loading-text="给我一点时间"
  57. :data="list"
  58. border
  59. fit
  60. highlight-current-row
  61. style="width: 100%;"
  62. :row-style="rowStyle"
  63. :cell-style="cellStyle"
  64. class="elTable table-fixed"
  65. :max-height="myHeight"
  66. @selection-change="handleSelectionChange2"
  67. >
  68. <el-table-column type="selection" width="55" />
  69. <el-table-column label="序号" align="center" type="index" width="50px">
  70. <template slot-scope="scope">
  71. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="备件编号" min-width="110px" align="center">
  75. <template slot-scope="scope">
  76. <span>{{ scope.row.partCode }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="备件名称" min-width="110px" align="center">
  80. <template slot-scope="scope">
  81. <span>{{ scope.row.partName }}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="备件规格" min-width="110px" align="center">
  85. <template slot-scope="scope">
  86. <span>{{ scope.row.specification }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="计量单位" min-width="60px" align="center">
  90. <template slot-scope="scope">
  91. <span>{{ scope.row.unit }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="备件类别" min-width="110px" align="center">
  95. <template slot-scope="scope">
  96. <span>{{ scope.row.eqClassName1 }}/{{ scope.row.eqClassName2 }}/{{ scope.row.eqClassName3 }}</span>
  97. </template>
  98. </el-table-column>
  99. <!-- <el-table-column label="录入时间" min-width="110px" align="center">
  100. <template slot-scope="scope">
  101. <span>{{ scope.row.createTime }}</span>
  102. </template>
  103. </el-table-column> -->
  104. <el-table-column label="审批时间" sortable prop="chargeDate" min-width="110px" align="center" />
  105. <el-table-column label="录入人" min-width="110px" align="center">
  106. <template slot-scope="scope">
  107. <span>{{ scope.row.createPerson }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="备件图片" min-width="110px" align="center">
  111. <template slot-scope="scope">
  112. <el-popover placement="right" title="" trigger="hover">
  113. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  114. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  115. </el-popover>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="备件库存" min-width="120px" align="center">
  119. <template slot-scope="scope">
  120. <span>{{ scope.row.reportery }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="操作" align="center" width="350px" class-name="small-padding fixed-width" fixed="right">
  124. <template slot-scope="{row}">
  125. <el-button v-if="isBasicSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
  126. <el-button v-if="isBasicEditTab1 && row.enable == 1" type="success" size="mini" @click="form_edit(row)">编辑</el-button>
  127. <el-button v-if="isDisable && row.enable == 1" type="danger" size="mini" @click="handleDisable(row)">禁用</el-button>
  128. <el-button v-if="isEnable && row.enable == 0" type="danger" size="mini" @click="handleEnable(row)">启用</el-button>
  129. <el-button v-if="isBasicDelete1 && row.enable == 1" type="danger" size="mini" @click="handleDelate(row)">删除</el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
  134. </el-tab-pane>
  135. <el-tab-pane v-if="isBasicSH" label="审核备件" name="second">
  136. <div class="filter-container">
  137. <el-input v-model="getdataListParmSH.parammaps.partCode" placeholder="备件编号" style="width: 200px;" class="filter-item" />
  138. <el-input v-model="getdataListParmSH.parammaps.partName" placeholder="备件名称" style="width: 140px;" class="filter-item" />
  139. <el-input v-model="getdataListParmSH.parammaps.specification" placeholder="备件规格" style="width: 200px;" class="filter-item" />
  140. <tree-select
  141. class="typeSelect"
  142. :height="150"
  143. :width="250"
  144. size="small"
  145. clearable
  146. :data="parentDept"
  147. :disabled="disabled"
  148. :placeholder="placeholder"
  149. style="display:inline-block;"
  150. :default-props="defaultProps"
  151. :node-key="nodeKey"
  152. :checked-keys="defaultCheckedKeys"
  153. @popoverHide="popoverHide"
  154. />
  155. <el-select v-model="getdataListParmSH.parammaps.statue" style="width: 120px;" clearable placeholder="审核状态" class="filter-item">
  156. <el-option v-for="item in statues" :key="item.id" :label="item.name" :value="item.id" />
  157. </el-select>
  158. <el-date-picker
  159. ref="inputDatetimeSH"
  160. v-model="getdataListParmSH.parammaps.inputDatetimeSH"
  161. class="inputDatetime"
  162. type="datetimerange"
  163. style="width: 250px;top:-3px;"
  164. format="yyyy-MM-dd"
  165. value-format="yyyy-MM-dd"
  166. range-separator="至"
  167. start-placeholder="开始日期"
  168. end-placeholder="结束日期"
  169. />
  170. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchSH">搜索</el-button>
  171. <div>
  172. <el-button v-if="isBasicExamine" class="filter-item" type="primary" @click="handleExamines">批量审批</el-button>
  173. </div>
  174. </div>
  175. <el-table
  176. :key="tableKey"
  177. v-loading="listLoadingSH"
  178. element-loading-text="给我一点时间"
  179. :data="listSH"
  180. border
  181. fit
  182. highlight-current-row
  183. style="width: 100%;"
  184. :row-style="rowStyle"
  185. :cell-style="cellStyle"
  186. class="elTable table-fixed"
  187. :max-height="myHeight"
  188. @selection-change="handleSelectionChange"
  189. >
  190. <el-table-column type="selection" width="55" />
  191. <el-table-column label="序号" align="center" type="index" width="50px">
  192. <template slot-scope="scope">
  193. <span>{{ scope.$index + (pageNumSH-1) * pageSizeSH + 1 }}</span>
  194. </template>
  195. </el-table-column>
  196. <el-table-column label="备件编号" min-width="130px" align="center">
  197. <template slot-scope="scope">
  198. <span>{{ scope.row.partCode }}</span>
  199. </template>
  200. </el-table-column>
  201. <el-table-column label="备件名称" min-width="110px" align="center">
  202. <template slot-scope="scope">
  203. <span>{{ scope.row.partName }}</span>
  204. </template>
  205. </el-table-column>
  206. <el-table-column label="备件规格" min-width="110px" align="center">
  207. <template slot-scope="scope">
  208. <span>{{ scope.row.specification }}</span>
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="计量单位" min-width="60px" align="center">
  212. <template slot-scope="scope">
  213. <span>{{ scope.row.unit }}</span>
  214. </template>
  215. </el-table-column>
  216. <el-table-column label="备件类别" min-width="150px" align="center">
  217. <template slot-scope="scope">
  218. <span>{{ scope.row.eqClassName1 }}/{{ scope.row.eqClassName2 }}/{{ scope.row.eqClassName3 }}</span>
  219. </template>
  220. </el-table-column>
  221. <el-table-column label="审核状态" min-width="130px" align="center" :formatter="statue" />
  222. <el-table-column label="审批时间" sortable prop="chargeDate" min-width="110px" align="center" />
  223. <el-table-column label="备件图片" min-width="110px" align="center">
  224. <template slot-scope="scope">
  225. <el-popover placement="right" title="" trigger="hover">
  226. <img :src="scope.row.picpath">
  227. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  228. </el-popover>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="录入人" min-width="100px" align="center">
  232. <template slot-scope="scope">
  233. <span>{{ scope.row.createPerson }}</span>
  234. </template>
  235. </el-table-column>
  236. <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
  237. <template slot-scope="{row}">
  238. <el-button v-if="isBasicSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
  239. <!-- 编辑 -->
  240. <el-button v-if="isBasicEdit && row.statue==2" type="success" style="display:inline-block" size="mini" @click="form_edit(row)">编辑</el-button>
  241. <el-button v-else type="success" style="display:none" size="mini" @click="form_edit(row)">编辑</el-button>
  242. <el-button v-if="isBasicExamine && row.statue == 0" style="display:inline-block" type="success" size="mini" @click="handleExamine(row)">审核</el-button>
  243. <el-button v-else style="display:none" type="success" size="mini" @click="handleExamine(row)">审核</el-button>
  244. <el-button v-if="isBasicDelete && row.statue == 2" style="display:inline-block" type="danger" size="mini" @click="handleDelate(row)">删除</el-button>
  245. <el-button v-else style="display:none" type="danger" size="mini" @click="handleDelate(row)">删除</el-button>
  246. </template>
  247. </el-table-column>
  248. </el-table>
  249. <pagination v-show="totalSH>0" :total="totalSH" :page.sync="getdataListParmSH.offset" :limit.sync="getdataListParmSH.pagecount" @pagination="get_table_dataSH" />
  250. </el-tab-pane>
  251. </el-tabs>
  252. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="90%">
  253. <div class="app-add">
  254. <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="100px" style="width: 90%;margin:0 auto">
  255. <el-row>
  256. <el-col v-if="partClassCreate" :span="8">
  257. <el-form-item ref="partClass" label="备件类别:" prop="partClass">
  258. <tree-select
  259. class="typeSelect"
  260. :height="150"
  261. :width="230"
  262. size="small"
  263. :data="parentDept"
  264. :disabled="disabled"
  265. :default-props="defaultProps"
  266. :node-key="nodeKey"
  267. :checked-keys="defaultCheckedKeys"
  268. @popoverHide="popoverHide"
  269. />
  270. <!-- style="display:inline-block;width:100%" -->
  271. <!-- display -->
  272. </el-form-item>
  273. </el-col>
  274. <el-col v-if="partClassUpdate" :span="8">
  275. <el-form-item label="备件类别:" prop="partClass">
  276. <el-input ref="partClass" v-model="createTemp.partClass" disabled />
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="8">
  280. <el-form-item label="备件编号:" prop="partCode">
  281. <el-input ref="partCode" v-model="createTemp.partCode" disabled />
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="8">
  285. <el-form-item label="备件名称:" prop="partName">
  286. <el-input ref="partName" v-model="createTemp.partName" />
  287. </el-form-item>
  288. </el-col>
  289. </el-row>
  290. <el-row>
  291. <el-col :span="8">
  292. <el-form-item label="备件规格:" prop="specification">
  293. <el-input ref="specification" v-model="createTemp.specification" />
  294. </el-form-item>
  295. </el-col>
  296. <el-col :span="8">
  297. <el-form-item label="计量单位:" prop="unit">
  298. <el-select v-model="createTemp.unit" clearable placeholder="计量单位" class="filter-item" style="width:100%">
  299. <el-option
  300. v-for="item in units"
  301. :key="item.id"
  302. :label="item.label"
  303. :value="item.label"
  304. />
  305. </el-select>
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="8">
  309. <el-form-item label="用途:" prop="purpose">
  310. <el-input v-model="createTemp.purpose" type="textarea" placeholder="用途" autosize maxlength="100" show-word-limit />
  311. <!-- <el-input v-model="createTemp.purpose" :row="1" type="textarea" placeholder="用途" /> -->
  312. </el-form-item>
  313. </el-col>
  314. </el-row>
  315. <el-row>
  316. <el-col :span="8">
  317. <el-form-item label="录入日期:" prop="createTime">
  318. <el-date-picker
  319. v-model="createTemp.createTime"
  320. disabled
  321. :picker-options="pickerOptions"
  322. type="date"
  323. placeholder="录入日期"
  324. style="top:-3px;width:100%"
  325. format="yyyy-MM-dd"
  326. value-format="yyyy-MM-dd"
  327. />
  328. </el-form-item>
  329. </el-col>
  330. <el-col :span="8">
  331. <el-form-item label="录入人:" prop="createPerson">
  332. <el-select v-model="createTemp.createPerson" placeholder="录入人" class="filter-item" style="width:100%">
  333. <el-option
  334. v-for="item in findAllEmploye"
  335. :key="item.id"
  336. :label="item.name"
  337. :value="item.id"
  338. />
  339. </el-select>
  340. </el-form-item>
  341. </el-col>
  342. <el-col :span="8">
  343. <el-form-item label="备注:" prop="note">
  344. <el-input v-model="createTemp.note" type="textarea" placeholder="备注" autosize />
  345. </el-form-item>
  346. </el-col>
  347. </el-row>
  348. <el-row>
  349. <el-col>
  350. <el-form-item label="备件图片:" prop="picpath">
  351. <el-upload
  352. id="uploadPic"
  353. ref="upload"
  354. :limit="1"
  355. list-type="picture-card"
  356. :file-list="createTemp.fileList"
  357. :headers="headers"
  358. :action="uploadImageUrl"
  359. :auto-upload="true"
  360. :on-preview="handlePicPreview"
  361. :before-remove="beforeRemove"
  362. :class="{hide:showUpload}"
  363. :on-change="(file,fileList)=>{ return handlePicChange(file, fileList) }"
  364. :on-success="(response,file, fileList)=>{ return handlePicSuccess(response,file, fileList) }"
  365. :on-remove="(file, fileList)=>{ return handlePicRemove(file, fileList) }"
  366. >
  367. <i class="el-icon-plus" />
  368. </el-upload>
  369. <el-dialog :visible.sync="dialogVisible" append-to-body :width="width">
  370. <img :src="dialogImageUrl" alt="" @load="onLoad">
  371. </el-dialog>
  372. </el-form-item>
  373. </el-col>
  374. </el-row>
  375. </el-form>
  376. </div>
  377. <div slot="footer" class="dialog-footer">
  378. <el-button v-if="dialogStatus==='create'" ref="createb" type="success" :disabled="isokDisable" @click="add_dialog_save_again()">保存并新增</el-button>
  379. <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():edit_dialog_save()">保存并关闭</el-button>
  380. <el-button @click="dialogFormVisible = false;createTemp.partCode='';createTemp.partClass = '';createTemp.partClassNameCode = '';get_table_data();">取消并关闭</el-button>
  381. </div>
  382. </el-dialog>
  383. <!-- 查看 -->
  384. <el-dialog :title="textMap[dialogStatusSee]" :visible.sync="dialogFormVisible_See" :close-on-click-modal="false" width="90%">
  385. <el-tabs v-model="activeName" @tab-click="handleClick">
  386. <el-tab-pane label="备件基础信息" name="first">
  387. <el-form
  388. ref="seeTemp"
  389. :rules="rules"
  390. :model="seeTemp"
  391. label-position="right"
  392. label-width="100px"
  393. style="width: 90%;margin:0 auto"
  394. >
  395. <el-row>
  396. <el-col :span="8">
  397. <el-form-item ref="partClass" label="备件类别:" prop="partClass">
  398. <span>{{ seeTemp.eqClassName1 }}/{{ seeTemp.eqClassName3 }}/{{ seeTemp.eqClassName3 }}</span>
  399. </el-form-item>
  400. </el-col>
  401. <el-col :span="8">
  402. <el-form-item label="备件编号:" prop="partCode">
  403. <span>{{ seeTemp.partCode }}</span>
  404. </el-form-item>
  405. </el-col>
  406. <el-col :span="8">
  407. <el-form-item label="备件名称:" prop="partName">
  408. <span>{{ seeTemp.partName }}</span>
  409. </el-form-item>
  410. </el-col>
  411. </el-row>
  412. <el-row>
  413. <el-col :span="8">
  414. <el-form-item label="备件规格:" prop="specification">
  415. <span>{{ seeTemp.specification }}</span>
  416. </el-form-item>
  417. </el-col>
  418. <el-col :span="8">
  419. <el-form-item label="计量单位:" prop="unit">
  420. <span>{{ seeTemp.unit }}</span>
  421. </el-form-item>
  422. </el-col>
  423. <el-col :span="8">
  424. <el-form-item label="用途:" prop="purpose">
  425. <span>{{ seeTemp.purpose }}</span>
  426. </el-form-item>
  427. </el-col>
  428. </el-row>
  429. <el-row>
  430. <el-col :span="8">
  431. <el-form-item label="录入日期:" prop="createTime">
  432. <span>{{ seeTemp.createTime }}</span>
  433. </el-form-item>
  434. </el-col>
  435. <el-col :span="8">
  436. <el-form-item label="录入人:" prop="createPerson">
  437. <span>{{ seeTemp.createPerson }}</span>
  438. </el-form-item>
  439. </el-col>
  440. <el-col :span="8">
  441. <el-form-item label="备注:" prop="note">
  442. <span>{{ seeTemp.note }}</span>
  443. </el-form-item>
  444. </el-col>
  445. </el-row>
  446. <el-row>
  447. <el-col>
  448. <el-form-item label="备件图片:">
  449. <el-popover placement="right" title="" trigger="hover">
  450. <img v-if="seeTemp.picpath !== ''" :src="seeTemp.picpath">
  451. <img v-if="seeTemp.picpath !== ''" slot="reference" :src="seeTemp.picpath" :alt="seeTemp.srcpath" style="height: 100px;width:100px;">
  452. </el-popover>
  453. </el-form-item>
  454. </el-col>
  455. </el-row>
  456. <div v-if="isFlowChart">
  457. <el-row>
  458. <el-col>
  459. <el-form-item label="流程进度" />
  460. <el-steps :active="active" align-center finish-status="success">
  461. <el-step
  462. v-for="(item,index) in activeList"
  463. :key="index"
  464. :title="item.title"
  465. :status="item.status"
  466. >
  467. <template slot="description">
  468. <div class="step-row">
  469. <div>{{ item.name }}&nbsp;&nbsp;{{ item.date }}</div>
  470. <div>{{ item.reason }}</div>
  471. </div>
  472. </template>
  473. </el-step>
  474. </el-steps>
  475. </el-col>
  476. </el-row>
  477. <el-row>
  478. <el-col>
  479. <el-form-item label="操作:">
  480. <el-button v-if="isBasicExamine && seeTemp.statue == 0" type="success" style="display:inline-block" @click="handleExamine()">审核</el-button>
  481. <el-button v-else type="success" style="display:none" class="success" @click="handleExamine()">审核</el-button>
  482. </el-form-item>
  483. </el-col>
  484. </el-row>
  485. </div>
  486. </el-form>
  487. </el-tab-pane>
  488. <el-tab-pane v-if="isDisplayPasture" label="牧场信息" name="second">
  489. <div class="pasture-title">
  490. <b>备件类别:<span>{{ seeTemp.eqClassName1 }}/{{ seeTemp.eqClassName3 }}/{{ seeTemp.eqClassName3 }}</span></b>
  491. <b>备件编号:<span> {{ seeTemp.partCode }}</span></b>
  492. <b>备件编名称:<span>{{ seeTemp.partName }}</span></b>
  493. </div>
  494. <el-table
  495. :key="tableKey"
  496. v-loading="listLoadingSee"
  497. element-loading-text="给我一点时间"
  498. :data="listSee"
  499. border
  500. fit
  501. highlight-current-row
  502. style="width: 100%;"
  503. :row-style="rowStyle"
  504. :cell-style="cellStyle"
  505. class="elTable"
  506. @sort-change="tableSort"
  507. >
  508. <!-- table表格 -->
  509. <el-table-column label="序号" align="center" type="index" width="50px">
  510. <template slot-scope="scope">
  511. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  512. </template>
  513. </el-table-column>
  514. <el-table-column label="牧场" min-width="130px" align="center">
  515. <template slot-scope="scope">
  516. <span>{{ scope.row.pastureName }}</span>
  517. </template>
  518. </el-table-column>
  519. <el-table-column label="供应商" min-width="110px" align="center">
  520. <template slot-scope="scope">
  521. <span>{{ scope.row.providerName }}</span>
  522. </template>
  523. </el-table-column>
  524. <el-table-column label="当前库存" sortable prop="reportery" min-width="130px" align="center">
  525. <template slot-scope="scope">
  526. <span>{{ scope.row.reportery }}</span>
  527. </template>
  528. </el-table-column>
  529. <el-table-column label="最低库存" sortable prop="minRepertory" min-width="110px" align="center">
  530. <template slot-scope="scope">
  531. <span>{{ scope.row.minRepertory }}</span>
  532. </template>
  533. </el-table-column>
  534. <el-table-column label="最高库存" sortable prop="maxRepertory" min-width="110px" align="center">
  535. <template slot-scope="scope">
  536. <span>{{ scope.row.maxRepertory }}</span>
  537. </template>
  538. </el-table-column>
  539. <el-table-column label="单价" sortable prop="price" min-width="130px" align="center">
  540. <template slot-scope="scope">
  541. <span>{{ scope.row.price }}</span>
  542. </template>
  543. </el-table-column>
  544. <el-table-column label="库位" min-width="110px" align="center">
  545. <template slot-scope="scope">
  546. <span>{{ scope.row.location }}</span>
  547. </template>
  548. </el-table-column>
  549. </el-table>
  550. <pagination
  551. v-show="totalSee>0"
  552. :total="totalSee"
  553. :page.sync="getdataListSee.offset"
  554. :limit.sync="getdataListSee.pagecount"
  555. @pagination="getSeeList"
  556. />
  557. </el-tab-pane>
  558. </el-tabs>
  559. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
  560. <el-button @click="dialogFormVisible_See = false">关闭</el-button>
  561. </div>
  562. </el-dialog>
  563. <!-- 审核 -->
  564. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Examine" :close-on-click-modal="false" width="30%">
  565. <div class="app-examine">
  566. <h3 style="width: 100%;margin:0 0 0 5%;line-height:50px;">请确认审核结果:</h3>
  567. <el-form ref="examineTemp" :rules="rules" :model="examineTemp" label-position="right" style="width: 50%;margin:0 auto;">
  568. <el-row style="width:88%;height:150px;margin:0 auto;">
  569. <el-col :span="20">
  570. <el-form-item>
  571. <el-radio-group v-model="examineTemp.SHstatue" @change="changeStatue">
  572. <el-radio :label="1" checked>通过</el-radio>
  573. <el-radio :label="2">不通过</el-radio>
  574. </el-radio-group>
  575. </el-form-item>
  576. </el-col>
  577. <el-col v-if="statueReason" :span="20">
  578. <el-input v-model="examineTemp.workflowNote" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入不通过原因" />
  579. </el-col>
  580. </el-row>
  581. </el-form>
  582. </div>
  583. <div slot="footer" class="dialog-footer">
  584. <el-button type="primary" :disabled="isokDisable" @keyup.enter.native="createExamineData()" @click="createExamineData()">确认</el-button>
  585. <el-button @click="dialogFormVisible_Examine = false;">关闭</el-button>
  586. </div>
  587. </el-dialog>
  588. <!-- 批量审批 -->
  589. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Examines" :close-on-click-modal="false" width="40%">
  590. <div class="app-examine" style="text-align:center;font:600 20px/40px '';height:200px;margin-top:40px;">
  591. <div> 当前共选中备件:{{ Selection }}条 </div>
  592. <div> 是否确认批量通过审核 </div>
  593. </div>
  594. <div slot="footer" class="dialog-footer">
  595. <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='examine'?createExamineDatas():createExamineDatas()">确认</el-button>
  596. <el-button @click="dialogFormVisible_Examines = false;">关闭</el-button>
  597. </div>
  598. </el-dialog> <!-- EAS同步 -->
  599. <!-- EAS同步 -->
  600. <el-dialog :title="textMap[easStatus.dialogStatus]" :visible.sync="easStatus.dialogFormVisible" :close-on-click-modal="false" width="80%">
  601. <div class="easStatus">
  602. <el-table
  603. :key="easStatus.tableKey"
  604. v-loading="easStatus.listLoading"
  605. element-loading-text="给我一点时间"
  606. :data="easStatus.list"
  607. border
  608. fit
  609. highlight-current-row
  610. style="width: 100%;"
  611. :row-style="rowStyle"
  612. :cell-style="cellStyle"
  613. class="elTable table-fixed"
  614. >
  615. <el-table-column label="序号" align="center" type="index" width="50px">
  616. <template slot-scope="scope">
  617. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  618. </template>
  619. </el-table-column>
  620. <el-table-column label="备件编号" min-width="110px" align="center" prop="partCode" />
  621. <el-table-column label="备件编号" min-width="110px" align="center" prop="partName" />
  622. <el-table-column label="备件规格" min-width="110px" align="center" prop="specification" />
  623. <el-table-column label="录入时间" min-width="110px" align="center" prop="createTime" />
  624. <el-table-column label="失败原因" min-width="110px" align="center" prop="failReason" />
  625. <el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width" fixed="right">
  626. <template slot-scope="{row}">
  627. <el-button v-if="isManualSynchronization" type="primary" size="mini" style="width:70px;" @click="handleManual(row)">手动同步</el-button>
  628. <el-button v-if="isIgnoreSynchronization" type="danger" size="mini" style="width:70px;" @click="handleIgnore(row)">忽略同步</el-button>
  629. </template>
  630. </el-table-column>
  631. </el-table>
  632. <pagination v-show="easStatus.total>0" :total="easStatus.total" :page.sync="easStatus.getdataListParm.offset" :limit.sync="easStatus.getdataListParm.pagecount" @pagination="get_table_dataEasStatusLst" />
  633. </div>
  634. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  635. <el-button @click="easStatus.dialogFormVisible = false;get_table_data()">关闭</el-button>
  636. </div>
  637. </el-dialog>
  638. </div>
  639. </template>
  640. <script>
  641. // 引入
  642. import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, checkButtons, getRecuData, failproccess, transData, GetAccount, EasSync } from '@/api/common'
  643. import waves from '@/directive/waves' // waves directive
  644. import { parseTime, json2excel, sortChange } from '@/utils/index.js'
  645. // eslint-disable-next-line no-unused-vars
  646. import { validateEMail } from '@/utils/validate.js'
  647. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  648. import TreeSelect from '@/components/TreeSelect'
  649. import Cookies from 'js-cookie'
  650. import { MessageBox } from 'element-ui'
  651. import { getToken } from '@/utils/auth'
  652. export default {
  653. name: 'Basic',
  654. components: { Pagination, TreeSelect },
  655. directives: { waves },
  656. data() {
  657. return {
  658. isStyle: 'display:none',
  659. isBasicAdd: [],
  660. isBasicTemplate: [],
  661. isBasicExport: [],
  662. isBasicImport: [],
  663. isBasicSee: [],
  664. isBasicEdit: [],
  665. isBasicEditTab1: [],
  666. isDisable: [],
  667. isEnable: [],
  668. isBasicExamine: [],
  669. isBasicDelete: [],
  670. isBasicDelete1: [],
  671. isBasic: [],
  672. isBasicSH: [],
  673. isEasSynchronization: [],
  674. isManualSynchronization: [],
  675. isIgnoreSynchronization: [],
  676. multipleSelection: [],
  677. rules: {
  678. temptypeCode: [{ required: true, message: '必填', trigger: 'blur' }],
  679. partClass: [{ required: true, message: '必填', trigger: 'blur' }],
  680. partCode: [{ required: true, message: '必填', trigger: 'blur' }],
  681. partName: [{ required: true, message: '必填', trigger: 'blur' }],
  682. specification: [{ required: true, message: '必填', trigger: 'blur' }],
  683. providerId: [{ required: true, message: '必填', trigger: 'blur' }],
  684. unit: [{ required: true, message: '必填', trigger: 'blur' }],
  685. purpose: [{ required: true, message: '必填', trigger: 'blur' }]
  686. },
  687. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  688. cellStyle: { padding: 0 + 'px' },
  689. textMap: {
  690. see: '查看详情',
  691. create: '新增',
  692. update: '编辑',
  693. examine: '审核',
  694. examines: '批量审批',
  695. easStatus: 'EAS同步—同步失败数据'
  696. },
  697. dialogFormVisible: false,
  698. dialogStatus: '',
  699. dialogImageUrl: '',
  700. dialogVisible: false,
  701. fileList: [],
  702. showUpload: false,
  703. headers: {
  704. optname: 'insertcustompic',
  705. id: 1,
  706. token: getToken() // 从cookie里获取token,并赋值token
  707. },
  708. uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
  709. widht: '',
  710. listType: [],
  711. parentDept: [],
  712. defaultProps: {
  713. children: 'children',
  714. label: 'partClassNameCode'
  715. },
  716. nodeKey: 'id',
  717. defaultCheckedKeys: [],
  718. deptform: {
  719. id: '',
  720. tempPtypeCode: '',
  721. temptypeCode: '',
  722. typeName: '',
  723. typeCode: '',
  724. pid: '',
  725. sort: '',
  726. enable: ''
  727. },
  728. statues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
  729. findAllProvider: [],
  730. findAllAssetType: [],
  731. findAllPasture: [],
  732. findAllDepart: [],
  733. findAllEmploye: [],
  734. getDictByNameYuJing: [],
  735. findAllCategory: [],
  736. requestParams: [
  737. { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
  738. { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
  739. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  740. { name: 'findAllDepart', offset: 0, pagecount: 0, params: [] },
  741. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  742. { name: 'findAllCategory', offset: 0, pagecount: 0, params: [] },
  743. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['计量单位'] },
  744. { name: 'getPastureRoleList', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid'), empId: this.$store.state.user.employeid }}
  745. ],
  746. isokDisable: false,
  747. disabled: false,
  748. activeName: 'first',
  749. tableKey: 0,
  750. total: 0,
  751. listLoading: true,
  752. list: [],
  753. getdataListParm: {
  754. name: 'getStockList',
  755. page: 1,
  756. offset: 1,
  757. pagecount: 10,
  758. returntype: 'Map',
  759. parammaps: {
  760. partCode: '',
  761. partName: '',
  762. partClass: '',
  763. inputDatetime: '',
  764. specification: '',
  765. easStatus: ''
  766. }
  767. },
  768. pickerOptions: {
  769. disabledDate(time) {
  770. return time.getTime() > Date.now()// 当天之前的时间可选
  771. }
  772. },
  773. createTemp: {
  774. partClass: '',
  775. partCode: '',
  776. tempPtypeCode: '',
  777. temptypeCode: '',
  778. partName: '',
  779. specification: '',
  780. unit: '',
  781. purpose: '',
  782. createPerson: this.$store.state.user.employeid,
  783. createTime: parseTime(new Date(), '{y}-{m}-{d}'),
  784. note: ''
  785. },
  786. placeholder: '请选择备件类别',
  787. partClassCreate: false,
  788. partClassUpdate: false,
  789. temptypeCode: true,
  790. temptypeCode1: false,
  791. listLoadingSee: true,
  792. dialogFormVisible_See: false,
  793. dialogStatusSee: '',
  794. listSee: [],
  795. seeTemp: {},
  796. getdataListSee: {
  797. name: 'getStockdetail',
  798. page: 1,
  799. offset: 1,
  800. pagecount: 10,
  801. returntype: 'Map',
  802. parammaps: {}
  803. },
  804. totalSee: 0,
  805. getRecuListParm: {
  806. name: 'getStockTypeList',
  807. idname: 'id',
  808. params: [-1]
  809. },
  810. requestParam: {},
  811. getDeptListParm: { name: 'getpart_classList_enable' },
  812. units: [],
  813. radio1: '全部',
  814. getdataListParmSH: {
  815. name: 'getStockListSH',
  816. page: 1,
  817. offset: 1,
  818. pagecount: 10,
  819. returntype: 'Map',
  820. parammaps: {
  821. partCode: '',
  822. partName: '',
  823. partClass: '',
  824. statue: '',
  825. inputDatetimeSH: '',
  826. specification: ''
  827. }
  828. },
  829. listSH: [],
  830. listLoadingSH: false,
  831. totalSH: 0,
  832. tabName: '',
  833. dialogFormVisible_Examine: false,
  834. dialogFormVisible_Examines: false,
  835. examineTemp: {
  836. SHstatue: 1
  837. },
  838. statueReason: false,
  839. activeList: [],
  840. active: 3,
  841. isFlowChart: false, // 流程图/操作
  842. isDisplayPasture: false, // 查看-牧场信息,
  843. buttons: [],
  844. isPercentage: false,
  845. percentage: 1,
  846. downloadParam: {},
  847. postDataPramas: {},
  848. Selection: 0,
  849. selectionList: [],
  850. width: 0,
  851. createExamineParm: { name: 'getPartCode', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: {}},
  852. // EAS同步
  853. easStatus: {
  854. easStatusList: [{ name: '同步成功', id: '1' }, { name: '同步失败', id: '0' }],
  855. dialogStatus: '',
  856. dialogFormVisible: false,
  857. tableKey: 0,
  858. total: 0,
  859. listLoading: true,
  860. list: [],
  861. getdataListParm: {
  862. name: 'getpartsSync',
  863. page: 1,
  864. offset: 1,
  865. pagecount: 10,
  866. returntype: 'Map',
  867. parammaps: {}
  868. }
  869. },
  870. myHeight: document.documentElement.clientHeight - 85 - 250
  871. // fileList: [],
  872. // headers1: {
  873. // optname: 'insertcustompic',
  874. // id: 1,
  875. // token: getToken() // 从cookie里获取token,并赋值token
  876. // },
  877. // uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
  878. // showUpload: false
  879. }
  880. },
  881. computed: {
  882. // 设置请求头
  883. // headers() {
  884. // return {
  885. // token: getToken()
  886. // }
  887. // },
  888. uploadData() {
  889. return {
  890. name: 'importparts',
  891. importParams: '编码,品名,规格型号,品牌,计量单位,一级分类,二级分类,三级分类,建立人,建立时间',
  892. sheetname: 'SheetJS'
  893. }
  894. },
  895. // 设置上传地址
  896. uploadExcelUrl() {
  897. // process.env.VUE_APP_BASE_API是服务器的路径,也是axios的基本路径
  898. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  899. }
  900. },
  901. created() {
  902. const that = this
  903. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  904. that.buttons = response.data.list
  905. that.get_auto_buttons()
  906. })
  907. this.get_select_list()
  908. this.getDownClassList()
  909. this.get_table_data()
  910. this.getMaxCode()
  911. this.getTypeList()
  912. this.get_table_dataSH()
  913. if (this.$route.query.tabName == undefined) {
  914. this.tabName = 'first'
  915. } else {
  916. this.tabName = this.$route.query.tabName
  917. }
  918. if (this.isBasic === false) {
  919. this.tabName = 'second'
  920. }
  921. if (this.tabName == 'first') {
  922. this.isDisplayPasture = true
  923. this.isFlowChart = false
  924. } else {
  925. this.isDisplayPasture = false
  926. this.isFlowChart = true
  927. }
  928. },
  929. methods: {
  930. tableSort(column) {
  931. sortChange(column, this.list)
  932. },
  933. get_auto_buttons() {
  934. // 新增
  935. const BasicAdd = 'customs:basic:add'
  936. const isBasicAdd = checkButtons(this.$store.state.user.buttons, BasicAdd)
  937. this.isBasicAdd = isBasicAdd
  938. // 模板
  939. const BasicTemplate = 'customs:basic:template'
  940. const isBasicTemplate = checkButtons(this.$store.state.user.buttons, BasicTemplate)
  941. this.isBasicTemplate = isBasicTemplate
  942. // 导出
  943. const BasicExport = 'customs:basic:export'
  944. const isBasicExport = checkButtons(this.$store.state.user.buttons, BasicExport)
  945. this.isBasicExport = isBasicExport
  946. // 导入
  947. const BasicImport = 'customs:basic:import'
  948. const isBasicImport = checkButtons(this.$store.state.user.buttons, BasicImport)
  949. this.isBasicImport = isBasicImport
  950. // 查看
  951. const BasicSee = 'customs:basic:see'
  952. const isBasicSee = checkButtons(this.$store.state.user.buttons, BasicSee)
  953. this.isBasicSee = isBasicSee
  954. // 编辑
  955. const BasicEdit = 'customs:basic:update'
  956. const isBasicEdit = checkButtons(this.$store.state.user.buttons, BasicEdit)
  957. this.isBasicEdit = isBasicEdit
  958. // 备件基础信息-编辑
  959. const BasicEditTab1 = 'customs:basic:update2'
  960. const isBasicEditTab1 = checkButtons(this.$store.state.user.buttons, BasicEditTab1)
  961. this.isBasicEditTab1 = isBasicEditTab1
  962. // 备件基础信息-禁用
  963. const Disable = 'customs:basic:disable'
  964. const isDisable = checkButtons(this.$store.state.user.buttons, Disable)
  965. this.isDisable = isDisable
  966. // 备件基础信息-开启
  967. const Enable = 'customs:basic:enable'
  968. const isEnable = checkButtons(this.$store.state.user.buttons, Enable)
  969. this.isEnable = isEnable
  970. // 备件基础信息删除
  971. const BasicDelete1 = 'customs:basic:enable'
  972. const isBasicDelete1 = checkButtons(this.$store.state.user.buttons, BasicDelete1)
  973. this.isBasicDelete1 = isBasicDelete1
  974. // 删除
  975. const BasicDelete = 'customs:basic:delete'
  976. const isBasicDelete = checkButtons(this.$store.state.user.buttons, BasicDelete)
  977. this.isBasicDelete = isBasicDelete
  978. // 审核
  979. const BasicExamine = 'customs:basic:shenhe'
  980. const isBasicExamine = checkButtons(this.$store.state.user.buttons, BasicExamine)
  981. this.isBasicExamine = isBasicExamine
  982. // 备件基础信息
  983. const Basic = 'customs:basic:basic'
  984. const isBasic = checkButtons(this.$store.state.user.buttons, Basic)
  985. this.isBasic = isBasic
  986. // 备件审核
  987. const BasicSH = 'customs:basic:shjm'
  988. const isBasicSH = checkButtons(this.$store.state.user.buttons, BasicSH)
  989. this.isBasicSH = isBasicSH
  990. // EAS同步
  991. const EasSynchronization = 'customs:basic:easSynchronization'
  992. const isEasSynchronization = checkButtons(this.$store.state.user.buttons, EasSynchronization)
  993. this.isEasSynchronization = isEasSynchronization
  994. // 手动同步
  995. const ManualSynchronization = 'customs:basic:manualSynchronization'
  996. const isManualSynchronization = checkButtons(this.$store.state.user.buttons, ManualSynchronization)
  997. this.isManualSynchronization = isManualSynchronization
  998. // 忽略同步
  999. const IgnoreSynchronization = 'customs:basic:ignoreSynchronization'
  1000. const isIgnoreSynchronization = checkButtons(this.$store.state.user.buttons, IgnoreSynchronization)
  1001. this.isIgnoreSynchronization = isIgnoreSynchronization
  1002. },
  1003. handleSelectionChange2(val) {
  1004. this.multipleSelection = val
  1005. },
  1006. handleBatchDisable() {
  1007. if (this.multipleSelection.length > 0) {
  1008. this.$confirm('是否确定批量禁用?', '提示', {
  1009. confirmButtonText: '确定',
  1010. cancelButtonText: '取消',
  1011. type: 'warning'
  1012. }).then(() => {
  1013. this.multipleSelection.forEach(row => {
  1014. console.log('批量禁用', row)
  1015. this.requestParam = {}
  1016. this.requestParam.name = 'updatepartsEnable'
  1017. this.requestParam.parammaps = {}
  1018. this.requestParam.parammaps.id = row.id
  1019. this.requestParam.parammaps.enable = 0
  1020. PostDataByName(this.requestParam).then(() => {
  1021. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  1022. })
  1023. })
  1024. this.get_table_data()
  1025. this.get_table_dataSH()
  1026. }).catch(() => {
  1027. this.$message({
  1028. type: 'info',
  1029. message: '已取消批量禁用'
  1030. })
  1031. })
  1032. } else {
  1033. this.$notify({ title: '提示', message: '请勾选禁用备件', type: 'error', duration: 2000 })
  1034. }
  1035. },
  1036. handleBatchEnable() {
  1037. if (this.multipleSelection.length > 0) {
  1038. this.$confirm('是否确定批量启用?', '提示', {
  1039. confirmButtonText: '确定',
  1040. cancelButtonText: '取消',
  1041. type: 'warning'
  1042. }).then(() => {
  1043. this.multipleSelection.forEach(row => {
  1044. console.log('批量启用', row)
  1045. this.requestParam = {}
  1046. this.requestParam.name = 'updatepartsEnable'
  1047. this.requestParam.parammaps = {}
  1048. this.requestParam.parammaps.id = row.id
  1049. this.requestParam.parammaps.enable = 1
  1050. PostDataByName(this.requestParam).then(() => {
  1051. this.$notify({ title: '成功', message: '启用成功', type: 'success', duration: 2000 })
  1052. })
  1053. })
  1054. this.get_table_data()
  1055. this.get_table_dataSH()
  1056. }).catch(() => {
  1057. this.$message({
  1058. type: 'info',
  1059. message: '已取消批量启用'
  1060. })
  1061. })
  1062. } else {
  1063. this.$notify({ title: '提示', message: '请勾选启用备件', type: 'error', duration: 2000 })
  1064. }
  1065. },
  1066. get_select_list() {
  1067. GetDataByNames(this.requestParams).then(response => {
  1068. this.units = response.data.getDictByName.list
  1069. this.findAllProvider = response.data.findAllProvider.list
  1070. this.findAllAssetType = response.data.findAllAssetType.list
  1071. this.findAllPasture = response.data.getPastureRoleList.list // response.data.findAllPasture.list
  1072. this.findAllDepart = response.data.findAllDepart.list
  1073. this.findAllEmploye = response.data.findAllEmploye.list
  1074. this.findAllCategory = response.data.findAllCategory.list
  1075. })
  1076. },
  1077. getDownClassList() {
  1078. getRecuData(this.getRecuListParm).then(response => {
  1079. this.parentClass = response.data
  1080. })
  1081. },
  1082. popoverHide(checkedIds, checkedData) {
  1083. console.log(checkedIds, checkedData)
  1084. if (checkedIds !== null) {
  1085. if (checkedData.childrens == 0) {
  1086. this.deptform.pid = checkedIds
  1087. console.log(checkedData)
  1088. if (checkedIds !== null) {
  1089. // this.deptform.partCode = checkedData.partClassCode
  1090. this.createTemp.partCode = checkedData.partClassCode
  1091. this.createTemp.partClass = checkedData.partClassCode
  1092. this.createTemp.partClassNameCode = checkedData.partClassNameCode
  1093. this.getMaxCode()
  1094. } else {
  1095. this.createTemp.pid = -1
  1096. }
  1097. this.getMaxCode()
  1098. } else {
  1099. this.defaultCheckedKeys = []
  1100. this.createTemp.tempPtypeCode = ''
  1101. this.createTemp.temptypeCode = ''
  1102. this.$message({
  1103. type: 'warning',
  1104. message: '请选择详细备件类别'
  1105. })
  1106. }
  1107. } else {
  1108. this.defaultCheckedKeys = []
  1109. this.createTemp.partCode = ''
  1110. this.createTemp.partClass = ''
  1111. this.createTemp.partClassNameCode = ''
  1112. }
  1113. },
  1114. getTypeList() {
  1115. // this.listLoading = true
  1116. this.getDeptListParm.parammaps = this.deptform
  1117. GetDataByName(this.getDeptListParm).then(response => {
  1118. this.listType = response.data
  1119. if (response.data.list !== null) {
  1120. this.listType = transData(response.data.list, 'id', 'pid', 'children')
  1121. console.log(this.listType, '11111')
  1122. }
  1123. this.parentDept = this.listType
  1124. })
  1125. },
  1126. getMaxCode() {
  1127. this.requestParam.name = 'getPartCode'
  1128. this.requestParam.parammaps = {}
  1129. this.requestParam.parammaps.partCode = this.createTemp.partCode
  1130. GetDataByName(this.requestParam).then(response => {
  1131. console.log('备件类别选中data', response.data.list)
  1132. if (response.data.list !== 0) {
  1133. if (response.data.list[0].preCode === '') {
  1134. this.createTemp.tempPtypeCode = this.deptform.typeCode + '.'
  1135. } else {
  1136. this.createTemp.tempPtypeCode = response.data.list[0].preCode
  1137. }
  1138. this.createTemp.temptypeCode = response.data.list[0].maxcode
  1139. this.$nextTick(() => {
  1140. // this.createTemp.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1141. console.log(this.createTemp.partCode)
  1142. this.$forceUpdate()
  1143. })
  1144. if (this.requestParam.parammaps.pid === -1) {
  1145. this.createTemp.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1146. }
  1147. }
  1148. })
  1149. },
  1150. get_table_data() {
  1151. this.listLoading = true
  1152. if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
  1153. this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  1154. this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  1155. } else {
  1156. this.getdataListParm.parammaps.startTime = ''
  1157. this.getdataListParm.parammaps.stopTime = ''
  1158. }
  1159. this.getdataListParm.parammaps.partClass = this.createTemp.partClass
  1160. GetDataByName(this.getdataListParm).then(response => {
  1161. console.log('table数据', response.data.list)
  1162. this.list = response.data.list
  1163. if (response.data.list !== null) {
  1164. for (var i = 0; i < response.data.list.length; i++) {
  1165. // console.log(response.data.list[i].srcpath)
  1166. if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
  1167. this.list[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  1168. this.list[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  1169. // console.log(111)
  1170. } else {
  1171. this.list[i].srcpath = ''
  1172. this.list[i].picpath = ''
  1173. }
  1174. }
  1175. }
  1176. this.pageNum = response.data.pageNum
  1177. this.pageSize = response.data.pageSize
  1178. if (response.data.total) {
  1179. this.total = response.data.total
  1180. }
  1181. // Just to simulate the time of the request
  1182. setTimeout(() => {
  1183. this.listLoading = false
  1184. }, 100)
  1185. })
  1186. },
  1187. statue: function(cellValue) {
  1188. // console.log(cellValue.isZeroStock)
  1189. if (cellValue.statue == 0) {
  1190. return '审核中'
  1191. } else if (cellValue.statue == 1) {
  1192. return '已通过'
  1193. } else if (cellValue.statue == 2) {
  1194. return '未通过'
  1195. } else if (cellValue.statue == 3) {
  1196. return '历史数据'
  1197. }
  1198. },
  1199. get_table_dataSH() {
  1200. this.listLoadingSH = true
  1201. if (this.$refs['inputDatetimeSH'] !== undefined && this.$refs['inputDatetimeSH'].value !== null) {
  1202. this.getdataListParmSH.parammaps.startTime = this.$refs['inputDatetimeSH'].value[0]
  1203. this.getdataListParmSH.parammaps.stopTime = this.$refs['inputDatetimeSH'].value[1]
  1204. } else {
  1205. this.getdataListParmSH.parammaps.startTime = ''
  1206. this.getdataListParmSH.parammaps.stopTime = ''
  1207. }
  1208. this.getdataListParmSH.parammaps.partClass = this.createTemp.partClass
  1209. GetDataByName(this.getdataListParmSH).then(response => {
  1210. console.log('table数据', response.data.list)
  1211. this.listSH = response.data.list
  1212. if (response.data.list !== null) {
  1213. for (var i = 0; i < response.data.list.length; i++) {
  1214. if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
  1215. this.listSH[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  1216. this.listSH[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  1217. } else {
  1218. this.listSH[i].srcpath = ''
  1219. this.listSH[i].picpath = ''
  1220. }
  1221. }
  1222. }
  1223. this.pageNumSH = response.data.pageNum
  1224. this.pageSizeSH = response.data.pageSize
  1225. if (response.data.total) {
  1226. this.totalSH = response.data.total
  1227. }
  1228. setTimeout(() => {
  1229. this.listLoadingSH = false
  1230. }, 100)
  1231. })
  1232. },
  1233. form_search() {
  1234. this.listLoading = true
  1235. if (this.getdataListParm.parammaps.inputDatetime === null) {
  1236. this.getdataListParm.parammaps.inputDatetime = ''
  1237. }
  1238. this.getdataListParm.parammaps.partClass = this.deptform.typeCode
  1239. this.getdataListParm.offset = 1
  1240. this.get_table_data()
  1241. },
  1242. form_searchSH() {
  1243. this.listLoadingSH = true
  1244. if (this.getdataListParmSH.parammaps.inputDatetimeSH === null) {
  1245. this.getdataListParmSH.parammaps.inputDatetimeSH = ''
  1246. }
  1247. this.getdataListParmSH.parammaps.partClass = this.deptform.typeCode
  1248. this.getdataListParmSH.offset = 1
  1249. this.get_table_dataSH()
  1250. },
  1251. form_see(row) {
  1252. this.activeName = 'first'
  1253. this.seeTemp = Object.assign({}, row) // copy obj
  1254. if (this.seeTemp.srcpath !== undefined) {
  1255. this.$set(this.seeTemp, 'srcpath', this.seeTemp.srcpath)
  1256. this.$set(this.seeTemp, 'picpath', this.seeTemp.picpath)
  1257. }
  1258. console.log('查看上方数据(从table读取)', this.seeTemp)
  1259. this.dialogStatus = 'see'
  1260. this.dialogFormVisible_See = true
  1261. this.getdataListSee.parammaps.partCode = row.partCode
  1262. this.getSeeList()
  1263. // 流程图
  1264. var reason = '未通过原因:' + this.seeTemp.workflowNote
  1265. if (this.seeTemp.statue === 0) {
  1266. this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核' }]
  1267. this.active = 1
  1268. } else if (this.seeTemp.statue === 1) {
  1269. this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
  1270. this.active = 2
  1271. } else if (this.seeTemp.statue === 2) {
  1272. this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
  1273. this.active = 2
  1274. }
  1275. },
  1276. getSeeList() {
  1277. this.listLoadingSee = true
  1278. GetDataByName(this.getdataListSee).then(response => {
  1279. console.log('查看牧场信息table数据', response.data.list)
  1280. this.listSee = response.data.list
  1281. this.pageNumSee = response.data.pageNum
  1282. this.pageSizeSee = response.data.pageSize
  1283. if (response.data.total) {
  1284. this.totalSee = response.data.total
  1285. }
  1286. // Just to simulate the time of the request
  1287. setTimeout(() => {
  1288. this.listLoadingSee = false
  1289. }, 100)
  1290. })
  1291. },
  1292. handleClick(tab, event) {
  1293. console.log(tab, event)
  1294. },
  1295. resetCreateTemp() {
  1296. this.requestParam = { name: 'createAssetType', parammaps: {}}
  1297. this.defaultCheckedKeys = []
  1298. this.createTemp.partClassNameCode = ''
  1299. this.createTemp.tempPtypeCode = ''
  1300. this.createTemp.temptypeCode = ''
  1301. this.createTemp.partClass = ''
  1302. this.createTemp.partCode = ''
  1303. this.createTemp.partName = ''
  1304. this.createTemp.specification = ''
  1305. this.createTemp.purpose = ''
  1306. this.createTemp.unit = ''
  1307. this.createTemp.createTime = parseTime(new Date(), '{y}-{m}-{d}')
  1308. this.createTemp.note = ''
  1309. this.createTemp.picId = ''
  1310. this.createTemp.picpath = ''
  1311. },
  1312. form_add() {
  1313. this.resetCreateTemp()
  1314. this.createTemp.createPerson = this.$store.state.user.employeid
  1315. this.partClassCreate = true
  1316. this.partClassUpdate = false
  1317. this.$nextTick(() => {
  1318. this.$refs.upload.clearFiles()
  1319. this.showUpload = false
  1320. this.$refs['createTemp'].clearValidate()
  1321. })
  1322. this.dialogStatus = 'create'
  1323. this.dialogFormVisible = true
  1324. this.fileList = []
  1325. },
  1326. handlePicChange(file, fileList) {
  1327. // console.log(response, '文件状态改变时的钩子response')
  1328. console.log(file, '文件状态改变时的钩子file')
  1329. console.log(fileList, '文件状态改变时的钩子fileList')
  1330. console.log(this.createTemp, '文件状态改变时的钩子row')
  1331. console.log(this.showUpload, '文件状态改变时的钩子row')
  1332. if (fileList.length > 0) {
  1333. this.$nextTick(() => {
  1334. // this.$set(this.createTemp, 'showUpload', true)
  1335. this.showUpload = true
  1336. })
  1337. } else {
  1338. this.$nextTick(() => {
  1339. this.showUpload = false
  1340. })
  1341. }
  1342. console.log(this.createTemp)
  1343. },
  1344. handlePicSuccess(response, file, fileList) {
  1345. if (fileList.length > 0) {
  1346. this.$nextTick(() => {
  1347. this.showUpload = true
  1348. })
  1349. } else {
  1350. this.$nextTick(() => {
  1351. this.showUpload = false
  1352. })
  1353. }
  1354. if (this.createTemp.picpath === undefined || this.createTemp.picpath === '' || this.createTemp.picpath == -1) {
  1355. this.$set(this.createTemp, 'picpath', response.execresult.LastInsertId)
  1356. }
  1357. console.log(this.createTemp, '文件上传成功时的钩子row')
  1358. },
  1359. handlePicRemove(file, fileList) {
  1360. console.log(file, '文件列表移除文件时的钩子file---')
  1361. console.log(fileList, '文件列表移除文件时的钩子fileList--')
  1362. console.log(this.createTemp, '文件列表移除文件时的钩子row---')
  1363. // console.log(this.dialogStatus)update
  1364. if (this.dialogStatus === 'create') {
  1365. if (fileList.length < 1) {
  1366. this.showUpload = false
  1367. }
  1368. for (const key in this.createTemp) {
  1369. if (this.createTemp[key] === file.response.execresult.LastInsertId) {
  1370. this.$delete(this.createTemp, key)
  1371. }
  1372. }
  1373. } else {
  1374. if (fileList.length < 1) {
  1375. this.$nextTick(() => {
  1376. this.showUpload = false
  1377. })
  1378. }
  1379. const url = file.url
  1380. console.log(url, 'url')
  1381. for (const key in this.createTemp) {
  1382. console.log(this.createTemp[key], 'createTemp[key]')
  1383. if (this.createTemp[key] === url) {
  1384. console.log(key)
  1385. if (key === 'picpath') {
  1386. this.$delete(this.createTemp, 'picpath')
  1387. this.$delete(this.createTemp, 'picId')
  1388. }
  1389. }
  1390. }
  1391. }
  1392. console.log(this.createTemp, '文件列表移除文件时的钩子row')
  1393. },
  1394. handlePicPreview(file) {
  1395. this.dialogImageUrl = file.url
  1396. this.dialogVisible = true
  1397. },
  1398. onLoad(e) {
  1399. const img = e.target
  1400. let width = 0
  1401. if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
  1402. width = img.width + 40
  1403. }
  1404. this.width = width + 'px'
  1405. },
  1406. beforeRemove(file, fileList) {
  1407. console.log(file.response, '删除文件之前的钩子,参数为上传的文件和文件列表')
  1408. return this.$confirm('删除当前图片, 是否继续?', '提示', {
  1409. confirmButtonText: '确定',
  1410. cancelButtonText: '取消',
  1411. type: 'warning'
  1412. })
  1413. },
  1414. add_dialog_save() {
  1415. this.isokDisable = true
  1416. setTimeout(() => {
  1417. this.isokDisable = false
  1418. }, 1000)
  1419. this.$refs['createTemp'].validate(valid => {
  1420. if (valid) {
  1421. if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
  1422. this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
  1423. return false
  1424. }
  1425. this.postDataPramas.common = { 'returnmap': '0' }
  1426. this.postDataPramas.data = []
  1427. this.postDataPramas.data[0] = { 'name': 'checkPartsns', 'type': 'v', 'parammaps': {
  1428. 'partName': this.createTemp.partName,
  1429. 'specification': this.createTemp.specification
  1430. }}
  1431. this.postDataPramas.data[1] = { 'name': 'insertStock', 'type': 'e', 'parammaps': {
  1432. 'picId': this.createTemp.picpath,
  1433. 'partClass': this.createTemp.partClass,
  1434. // this.requestParam.parammaps.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1435. 'partCode': this.createTemp.partCode,
  1436. 'partName': this.createTemp.partName,
  1437. 'specification': this.createTemp.specification,
  1438. 'unit': this.createTemp.unit,
  1439. 'purpose': this.createTemp.purpose,
  1440. 'createPerson': this.createTemp.createPerson,
  1441. 'createTime': this.createTemp.createTime,
  1442. 'note': this.createTemp.note
  1443. }}
  1444. ExecDataByConfig(this.postDataPramas).then(response => {
  1445. console.log('保存发送参数', this.postDataPramas)
  1446. if (response.msg !== 'fail') {
  1447. this.deptform.id = ''
  1448. this.deptform.typeName = ''
  1449. this.dialogFormVisible = false
  1450. this.defaultCheckedKeys = []
  1451. this.createTemp.partCode = ''
  1452. this.createTemp.partClass = ''
  1453. this.createTemp.partClassNameCode = ''
  1454. this.get_table_data()
  1455. this.getMaxCode()
  1456. this.$nextTick(() => {
  1457. this.$refs['createTemp'].clearValidate()
  1458. })
  1459. this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
  1460. } else {
  1461. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1462. }
  1463. })
  1464. }
  1465. })
  1466. },
  1467. add_dialog_save_again() {
  1468. this.isokDisable = true
  1469. setTimeout(() => {
  1470. this.isokDisable = false
  1471. }, 1000)
  1472. this.$refs['createTemp'].validate(valid => {
  1473. if (valid) {
  1474. if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
  1475. this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
  1476. return false
  1477. }
  1478. this.postDataPramas.common = { 'returnmap': '0' }
  1479. this.postDataPramas.data = []
  1480. this.postDataPramas.data[0] = { 'name': 'checkPartsns', 'type': 'v', 'parammaps': {
  1481. 'partName': this.createTemp.partName,
  1482. 'specification': this.createTemp.specification
  1483. }}
  1484. this.postDataPramas.data[1] = { 'name': 'insertStock', 'type': 'e', 'parammaps': {
  1485. 'picId': this.createTemp.picpath,
  1486. 'partClass': this.createTemp.partClass,
  1487. // this.requestParam.parammaps.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1488. 'partCode': this.createTemp.partCode,
  1489. 'partName': this.createTemp.partName,
  1490. 'specification': this.createTemp.specification,
  1491. 'unit': this.createTemp.unit,
  1492. 'purpose': this.createTemp.purpose,
  1493. 'createPerson': this.createTemp.createPerson,
  1494. 'createTime': this.createTemp.createTime,
  1495. 'note': this.createTemp.note
  1496. }}
  1497. ExecDataByConfig(this.postDataPramas).then(response => {
  1498. console.log('保存发送参数', this.postDataPramas)
  1499. if (response.msg !== 'fail') {
  1500. this.resetCreateTemp()
  1501. this.get_table_data()
  1502. this.$nextTick(() => {
  1503. this.$refs['createTemp'].clearValidate()
  1504. })
  1505. this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
  1506. this.handlePicRemove()
  1507. } else {
  1508. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1509. }
  1510. })
  1511. }
  1512. })
  1513. },
  1514. handleDisable(row) {
  1515. MessageBox.confirm('禁用后备件不可使用,是否禁用?', {
  1516. confirmButtonText: '确认',
  1517. cancelButtonText: '取消',
  1518. type: 'warning'
  1519. }).then(() => {
  1520. this.requestParam.name = 'updatepartsEnable'
  1521. this.requestParam.parammaps = {}
  1522. this.requestParam.parammaps.id = row.id
  1523. this.requestParam.parammaps.enable = 0
  1524. PostDataByName(this.requestParam).then(() => {
  1525. this.get_table_data()
  1526. this.get_table_dataSH()
  1527. this.dialogFormVisible = false
  1528. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  1529. })
  1530. }).catch(() => {
  1531. this.$message({ type: 'info', message: '已取消禁用' })
  1532. })
  1533. },
  1534. handleEnable(row) {
  1535. this.requestParam.name = 'updatepartsEnable'
  1536. this.requestParam.parammaps = {}
  1537. this.requestParam.parammaps.id = row.id
  1538. this.requestParam.parammaps.enable = 1
  1539. PostDataByName(this.requestParam).then(() => {
  1540. this.get_table_data()
  1541. this.get_table_dataSH()
  1542. this.dialogFormVisible = false
  1543. this.$notify({ title: '成功', message: '启用成功', type: 'success', duration: 2000 })
  1544. })
  1545. },
  1546. form_edit(row) {
  1547. this.createTemp = Object.assign({}, row) // copy obj
  1548. this.createTemp.partClass = this.createTemp.eqClassName1 + '/' + this.createTemp.eqClassName2 + '/' + this.createTemp.eqClassName3
  1549. this.dialogStatus = 'update'
  1550. this.dialogFormVisible = true
  1551. this.partClassCreate = false
  1552. this.partClassUpdate = true
  1553. const urlArray = []
  1554. const fileList = []
  1555. if (row.picpath == undefined) {
  1556. urlArray.push()
  1557. } else if (row.picpath == '') {
  1558. urlArray.push()
  1559. } else {
  1560. urlArray.push(row.picpath)
  1561. }
  1562. for (let i = 0; i < urlArray.length; i++) {
  1563. const urlObj = {}
  1564. this.$set(urlObj, 'url', urlArray[i])
  1565. fileList.push(urlObj)
  1566. }
  1567. this.$set(this.createTemp, 'fileList', fileList)
  1568. console.log(this.createTemp)
  1569. if (this.createTemp.fileList.length >= 1) {
  1570. this.showUpload = true
  1571. } else {
  1572. this.showUpload = false
  1573. }
  1574. },
  1575. edit_dialog_save() {
  1576. this.$refs['createTemp'].validate(valid => {
  1577. if (valid) {
  1578. if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
  1579. this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
  1580. return false
  1581. }
  1582. this.requestParam.name = 'updateParts'
  1583. this.requestParam.parammaps.partClass = this.createTemp.partClass
  1584. this.requestParam.parammaps.id = this.createTemp.id
  1585. this.requestParam.parammaps.partCode = this.createTemp.partCode
  1586. this.requestParam.parammaps.partName = this.createTemp.partName
  1587. this.requestParam.parammaps.specification = this.createTemp.specification
  1588. this.requestParam.parammaps.purpose = this.createTemp.purpose
  1589. this.requestParam.parammaps.unit = this.createTemp.unit
  1590. this.requestParam.parammaps.createPersonId = this.createTemp.createPersonId
  1591. this.requestParam.parammaps.createTime = this.createTemp.createTime
  1592. this.requestParam.parammaps.note = this.createTemp.note
  1593. this.requestParam.parammaps.statue = 0
  1594. const picpath = parseInt(this.createTemp.picpath)
  1595. if (isNaN(picpath) == false) {
  1596. this.requestParam.parammaps.picpath = this.createTemp.picpath
  1597. } else {
  1598. this.requestParam.parammaps.picpath = this.createTemp.picId
  1599. }
  1600. console.log('编辑保存发送data', this.requestParam.parammaps)
  1601. PostDataByName(this.requestParam).then(response => {
  1602. if (response.msg !== 'fail') {
  1603. this.defaultCheckedKeys = []
  1604. this.createTemp.partCode = ''
  1605. this.createTemp.partClass = ''
  1606. this.createTemp.partClassNameCode = ''
  1607. this.get_table_data()
  1608. this.get_table_dataSH()
  1609. this.getMaxCode()
  1610. this.dialogFormVisible = false
  1611. this.$nextTick(() => {
  1612. this.$refs['createTemp'].clearValidate()
  1613. })
  1614. this.$notify({
  1615. title: '成功',
  1616. message: '编辑成功',
  1617. type: 'success',
  1618. duration: 2000
  1619. })
  1620. } else {
  1621. failproccess(response, this.$notify)
  1622. }
  1623. })
  1624. }
  1625. })
  1626. },
  1627. handleDelate(row) {
  1628. MessageBox.confirm('备件编号:' + row.partCode + ' ,备件名称:' + row.partName, '确认删除?', {
  1629. confirmButtonText: '确认',
  1630. cancelButtonText: '取消',
  1631. type: 'warning'
  1632. }).then(() => {
  1633. this.requestParam.name = 'deleteStock'
  1634. this.requestParam.parammaps = {}
  1635. this.requestParam.parammaps['id'] = row.id
  1636. PostDataByName(this.requestParam).then(() => {
  1637. this.get_table_data()
  1638. this.get_table_dataSH()
  1639. this.dialogFormVisible = false
  1640. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1641. })
  1642. }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }) })
  1643. },
  1644. handleRemove(file, fileList) {
  1645. console.log(file, fileList)
  1646. this.dialogForm.imgList = fileList
  1647. if (fileList) {
  1648. this.$refs['uploadElement'].clearValidate()
  1649. }
  1650. },
  1651. handlePictureCardPreview(file) {
  1652. this.dialogImageUrl = file.url
  1653. this.dialogVisible = true
  1654. },
  1655. formatJson(filterVal, jsonData) {
  1656. return jsonData.map(v =>
  1657. filterVal.map(j => {
  1658. if (j === 'timestamp') {
  1659. return parseTime(v[j])
  1660. } else {
  1661. return v[j]
  1662. }
  1663. })
  1664. )
  1665. },
  1666. handleDownload() {
  1667. console.log('点击了基础信息导出')
  1668. console.log(this.tabName)
  1669. this.$alert('备件基础信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  1670. this.isPercentage = true
  1671. this.percentage = 1
  1672. var timer = setInterval(() => {
  1673. this.percentage += 5
  1674. if (this.percentage > 95) {
  1675. this.percentage = 99
  1676. clearInterval(timer)
  1677. }
  1678. this.percentage = this.percentage
  1679. }, 1000)
  1680. if (this.tabName == 'first') {
  1681. this.downloadParam.name = 'getStockList'
  1682. this.downloadParam.parammaps = {}
  1683. this.downloadParam.parammaps.partCode = this.getdataListParm.parammaps.partCode
  1684. this.downloadParam.parammaps.partName = this.getdataListParm.parammaps.partName
  1685. this.downloadParam.parammaps.partClass = this.getdataListParm.parammaps.partClass
  1686. this.downloadParam.parammaps.startTime = this.getdataListParm.parammaps.startTime
  1687. this.downloadParam.parammaps.stopTime = this.getdataListParm.parammaps.stopTime
  1688. this.downloadParam.parammaps.specification = this.getdataListParm.parammaps.specification
  1689. } else if (this.tabName == 'second') {
  1690. this.downloadParam.name = 'getStockListSH'
  1691. this.downloadParam.parammaps = {}
  1692. this.downloadParam.parammaps.partCode = this.getdataListParmSH.parammaps.partCode
  1693. this.downloadParam.parammaps.partName = this.getdataListParmSH.parammaps.partName
  1694. this.downloadParam.parammaps.partClass = this.getdataListParmSH.parammaps.partClass
  1695. this.downloadParam.parammaps.statue = this.getdataListParmSH.parammaps.statue
  1696. this.downloadParam.parammaps.startTime = this.getdataListParmSH.parammaps.startTime
  1697. this.downloadParam.parammaps.stopTime = this.getdataListParmSH.parammaps.stopTime
  1698. this.downloadParam.parammaps.specification = this.getdataListParmSH.parammaps.specification
  1699. }
  1700. GetAccount(this.downloadParam).then(response => {
  1701. if (response.data.list !== '') {
  1702. this.percentage = 99
  1703. setTimeout(() => {
  1704. this.isPercentage = false
  1705. }, 2000)
  1706. }
  1707. this.$nextTick(() => {
  1708. const ExcelDatas = [
  1709. {
  1710. tHeader: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
  1711. filterVal: ['partCode', 'partName', 'specification', 'unit', 'eqClassName1', 'eqClassName2', 'eqClassName3', 'createPerson', 'createTime'],
  1712. tableDatas: response.data.list,
  1713. sheetName: '备件基础信息'
  1714. }
  1715. ]
  1716. json2excel(ExcelDatas, '备件基础信息', true, 'xlsx')
  1717. })
  1718. })
  1719. },
  1720. handleDownloadTemp() {
  1721. this.requestParam.name = 'stockDownTemp'
  1722. GetDataByName(this.requestParam).then(response => {
  1723. this.$nextTick(() => {
  1724. const ExcelDatas = [
  1725. {
  1726. tHeader: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
  1727. filterVal: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
  1728. tableDatas: response.data.list,
  1729. sheetName: 'SheetJS'
  1730. }
  1731. ]
  1732. json2excel(ExcelDatas, '备件基础信息模板', true, 'xlsx')
  1733. })
  1734. })
  1735. },
  1736. // 导入
  1737. beforeImportExcel(file) {
  1738. const isLt2M = file.size / 1024 / 1024 < 10
  1739. if (!isLt2M) {
  1740. this.$message.error('上传文件大小不能超过 10MB!')
  1741. }
  1742. return isLt2M
  1743. },
  1744. handleImportExcelSuccess(res, file) {
  1745. if (res.msg === 'ok') {
  1746. this.$message({
  1747. title: '成功',
  1748. message: '导入成功:' + res.data.success + '条!',
  1749. type: 'success',
  1750. duration: 2000
  1751. })
  1752. if (res.data.err_count > 0) {
  1753. this.$notify({
  1754. title: '失败',
  1755. message: '导入失败:' + res.data.err_count + '条!',
  1756. type: 'danger',
  1757. duration: 2000
  1758. })
  1759. import('@/vendor/Export2Excel').then(excel => {
  1760. const list1 = res.data.result
  1761. const tHeader = [
  1762. '编码', '品名', '规格型号', '品牌', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间', 'error_msg'
  1763. ]
  1764. const filterVal = [
  1765. '编码', '品名', '规格型号', '品牌', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间', 'error_msg'
  1766. ]
  1767. const data1 = this.formatJson(filterVal, list1)
  1768. excel.export_json_to_excel({
  1769. header: tHeader,
  1770. data: data1,
  1771. filename: this.requestParam.parammaps.formType,
  1772. autoWidth: true,
  1773. bookType: 'xlsx'
  1774. })
  1775. })
  1776. }
  1777. } else {
  1778. this.$notify({
  1779. title: '失败',
  1780. message: '上传失败',
  1781. type: 'danger',
  1782. duration: 2000
  1783. })
  1784. }
  1785. },
  1786. handleTabClick(val) {
  1787. console.log('点击了基础信息/审核备件tab', val)
  1788. // isFlowChart
  1789. if (val.name == 'second') {
  1790. this.isFlowChart = true
  1791. this.isDisplayPasture = false
  1792. } else {
  1793. this.isFlowChart = false
  1794. this.isDisplayPasture = true
  1795. }
  1796. this.get_table_data()
  1797. this.get_table_dataSH()
  1798. },
  1799. handleExamine(row) {
  1800. if (row == undefined) {
  1801. this.examineTemp = this.seeTemp
  1802. this.$set(this.seeTemp, 'SHstatue', 1)
  1803. this.$set(this.seeTemp, 'workflowNote', '')
  1804. } else {
  1805. this.examineTemp = Object.assign({}, row)
  1806. this.$set(this.examineTemp, 'SHstatue', 1)
  1807. this.$set(this.examineTemp, 'workflowNote', '')
  1808. }
  1809. this.dialogStatus = 'examine'
  1810. this.dialogFormVisible_Examine = true
  1811. // this.examineTemp.statue = 1
  1812. this.statueReason = false
  1813. this.keyupSubmit()
  1814. },
  1815. changeStatue(val) {
  1816. if (val == 2) {
  1817. this.statueReason = true
  1818. } else {
  1819. this.statueReason = false
  1820. }
  1821. },
  1822. keyupSubmit() {
  1823. if (this.dialogStatus == 'examine' || this.dialogStatus == 'examines') {
  1824. document.onkeydown = e => {
  1825. const _key = window.event.keyCode
  1826. if (_key === 13) {
  1827. this.createExamineData()
  1828. }
  1829. }
  1830. }
  1831. },
  1832. createExamineData() {
  1833. this.isokDisable = true
  1834. setTimeout(() => {
  1835. this.isokDisable = false
  1836. }, 1000)
  1837. this.$refs['examineTemp'].validate(valid => {
  1838. if (valid) {
  1839. this.createExamineParm.parammaps.partCode = this.examineTemp.partCode
  1840. GetDataByName(this.createExamineParm).then(response => {
  1841. this.requestParam.name = 'partsCharge'
  1842. this.requestParam.parammaps = {}
  1843. this.requestParam.parammaps.id = this.examineTemp.id
  1844. if (this.examineTemp.SHstatue === 1) {
  1845. this.requestParam.parammaps.statue = 1
  1846. } else {
  1847. this.requestParam.parammaps.statue = 2
  1848. }
  1849. this.requestParam.parammaps.empId = Cookies.get('employeid')
  1850. this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
  1851. if (this.examineTemp.SHstatue === 1) {
  1852. this.requestParam.parammaps.partCode = response.data.list[0].preCode + response.data.list[0].maxcode
  1853. } else {
  1854. this.requestParam.parammaps.partCode = this.createExamineParm.parammaps.partCode
  1855. }
  1856. PostDataByName(this.requestParam).then(response => {
  1857. console.log('审核确认发送参数', this.requestParam)
  1858. if (response.msg !== 'fail') {
  1859. this.get_table_dataSH()
  1860. this.dialogFormVisible_Examine = false
  1861. this.dialogFormVisible_See = false
  1862. this.statueReason = false
  1863. this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
  1864. } else {
  1865. failproccess(response, this.$notify)
  1866. }
  1867. })
  1868. })
  1869. }
  1870. })
  1871. },
  1872. handleSelectionChange(val) {
  1873. console.log('选择', val.length)
  1874. this.Selection = val.length
  1875. this.selectionList = []
  1876. if (val.length > 0) {
  1877. for (let i = 0; i < val.length; i++) {
  1878. const selectionObj = {}
  1879. selectionObj.id = val[i].id
  1880. selectionObj.statue = val[i].statue
  1881. selectionObj.partCode = val[i].partCode
  1882. this.selectionList.push(selectionObj)
  1883. }
  1884. }
  1885. },
  1886. handleExamines() {
  1887. console.log('点击了批量审批', this.selectionList)
  1888. if (this.Selection > 0) {
  1889. // statue == 0
  1890. for (let i = 0; i < this.selectionList.length; i++) {
  1891. console.log(this.selectionList[i])
  1892. if (this.selectionList[i].statue !== 0) {
  1893. this.$message({ type: 'error', message: '通过审核的备件不可重复审核', duration: 2000 })
  1894. return false
  1895. }
  1896. }
  1897. this.dialogStatus = 'examines'
  1898. this.dialogFormVisible_Examines = true
  1899. this.keyupSubmit()
  1900. } else {
  1901. this.$message({ type: 'error', message: '请选择要审核的数据', duration: 2000 })
  1902. }
  1903. },
  1904. createExamineDatas() {
  1905. console.log(this.selectionList)
  1906. this.postDataPramas.common = { 'returnmap': '0' }
  1907. this.postDataPramas.data = []
  1908. this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectionList }}
  1909. this.postDataPramas.data[0].children = []
  1910. this.postDataPramas.data[0].children[0] = { 'name': 'batchPartsSH', 'type': 'e', 'parammaps': {
  1911. id: '@insertSpotList.id',
  1912. empId: Cookies.get('employeid'),
  1913. partCode: '@insertSpotList.partCode'
  1914. }}
  1915. ExecDataByConfig(this.postDataPramas).then(response => {
  1916. console.log('新增保存发送参数', this.postDataPramas)
  1917. if (response.msg === 'fail') {
  1918. this.$notify({
  1919. title: '保存失败',
  1920. message: response.data,
  1921. type: 'warning',
  1922. duration: 2000
  1923. })
  1924. } else {
  1925. this.dialogFormVisible_Examines = false
  1926. this.get_table_dataSH()
  1927. this.$notify({
  1928. title: '',
  1929. message: '保存成功',
  1930. type: 'success',
  1931. duration: 2000
  1932. })
  1933. }
  1934. })
  1935. },
  1936. handleEAS() {
  1937. this.easStatus.dialogStatus = 'easStatus'
  1938. this.easStatus.dialogFormVisible = true
  1939. this.get_table_dataEasStatusLst()
  1940. },
  1941. get_table_dataEasStatusLst() {
  1942. this.easStatus.listLoading = true
  1943. GetDataByName(this.easStatus.getdataListParm).then(response => {
  1944. if (response.data.list !== null) {
  1945. this.easStatus.list = response.data.list
  1946. } else {
  1947. this.easStatus.list = []
  1948. }
  1949. this.easStatus.pageNum = response.data.pageNum
  1950. this.easStatus.pageSize = response.data.pageSize
  1951. if (response.data.total) {
  1952. this.easStatus.total = response.data.total
  1953. }
  1954. })
  1955. setTimeout(() => {
  1956. this.easStatus.listLoading = false
  1957. }, 100)
  1958. },
  1959. handleManual(row) {
  1960. MessageBox.confirm('是否确认同步此数据至EAS?', {
  1961. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1962. }).then(() => {
  1963. this.requestParam = {}
  1964. this.requestParam.typeIn = row.typeIn
  1965. this.requestParam.billCode = row.billCode
  1966. EasSync(this.requestParam).then((response) => {
  1967. if (response.msg !== 'fail') {
  1968. this.$notify({ title: '成功', message: '手动同步成功', type: 'success', duration: 2000 })
  1969. this.get_table_dataEasStatusLst()
  1970. this.get_table_data()
  1971. } else {
  1972. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1973. this.get_table_dataEasStatusLst()
  1974. this.get_table_data()
  1975. }
  1976. })
  1977. }).catch(() => {
  1978. this.$message({ type: 'info', message: '已取消手动同步' })
  1979. })
  1980. },
  1981. handleIgnore(row) {
  1982. MessageBox.confirm('是否确认忽略同步此数据?', {
  1983. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1984. }).then(() => {
  1985. this.requestParam = {}
  1986. this.requestParam.name = 'updatepartsSync'
  1987. this.requestParam.parammaps = {}
  1988. this.requestParam.parammaps.issync = '3'
  1989. this.requestParam.parammaps.id = row.id
  1990. PostDataByName(this.requestParam).then((response) => {
  1991. if (response.msg !== 'fail') {
  1992. this.$notify({ title: '成功', message: '忽略同步成功', type: 'success', duration: 2000 })
  1993. this.get_table_dataEasStatusLst()
  1994. this.get_table_data()
  1995. } else {
  1996. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1997. this.get_table_dataEasStatusLst()
  1998. this.get_table_data()
  1999. }
  2000. })
  2001. }).catch(() => {
  2002. this.$message({ type: 'info', message: '已取消忽略同步' })
  2003. })
  2004. }
  2005. }
  2006. }
  2007. </script>
  2008. <style lang="scss">
  2009. .typeSelect span .el-popover__reference .el-input--suffix {
  2010. top:-3px;
  2011. .el-input__inner{
  2012. height:40px !important;
  2013. }
  2014. }
  2015. .pasture-title{
  2016. height: 50px;
  2017. b{
  2018. line-height: 50px;
  2019. margin: 0 20px;
  2020. }
  2021. }
  2022. .el-step__head.is-success {
  2023. color: #409EFF;
  2024. border-color: #409EFF;
  2025. }
  2026. .el-step__title.is-success{
  2027. color: #409EFF;
  2028. }
  2029. .el-step__head.is-process{
  2030. color: #409EFF;
  2031. border-color: #409EFF;
  2032. .el-step__icon.is-text{
  2033. background: #409EFF;
  2034. color: #fff;
  2035. }
  2036. }
  2037. .step-row{
  2038. color: #000;
  2039. }
  2040. .hide .el-upload--picture-card {
  2041. display: none;
  2042. }
  2043. </style>