index.vue 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066
  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. @selection-change="handleSelectionChange2"
  66. :max-height="myHeight"
  67. >
  68. <el-table-column type="selection" width="55"></el-table-column>
  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. @selection-change="handleSelectionChange"
  188. :max-height="myHeight"
  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. ],
  745. isokDisable: false,
  746. disabled: false,
  747. activeName: 'first',
  748. tableKey: 0,
  749. total: 0,
  750. listLoading: true,
  751. list: [],
  752. getdataListParm: {
  753. name: 'getStockList',
  754. page: 1,
  755. offset: 1,
  756. pagecount: 10,
  757. returntype: 'Map',
  758. parammaps: {
  759. partCode: '',
  760. partName: '',
  761. partClass: '',
  762. inputDatetime: '',
  763. specification: '',
  764. easStatus: ''
  765. }
  766. },
  767. pickerOptions: {
  768. disabledDate(time) {
  769. return time.getTime() > Date.now()// 当天之前的时间可选
  770. }
  771. },
  772. createTemp: {
  773. partClass: '',
  774. partCode: '',
  775. tempPtypeCode: '',
  776. temptypeCode: '',
  777. partName: '',
  778. specification: '',
  779. unit: '',
  780. purpose: '',
  781. createPerson: this.$store.state.user.employeid,
  782. createTime: parseTime(new Date(), '{y}-{m}-{d}'),
  783. note: ''
  784. },
  785. placeholder: '请选择备件类别',
  786. partClassCreate: false,
  787. partClassUpdate: false,
  788. temptypeCode: true,
  789. temptypeCode1: false,
  790. listLoadingSee: true,
  791. dialogFormVisible_See: false,
  792. dialogStatusSee: '',
  793. listSee: [],
  794. seeTemp: {},
  795. getdataListSee: {
  796. name: 'getStockdetail',
  797. page: 1,
  798. offset: 1,
  799. pagecount: 10,
  800. returntype: 'Map',
  801. parammaps: {}
  802. },
  803. totalSee: 0,
  804. getRecuListParm: {
  805. name: 'getStockTypeList',
  806. idname: 'id',
  807. params: [-1]
  808. },
  809. requestParam: {},
  810. getDeptListParm: { name: 'getpart_classList_enable' },
  811. units: [],
  812. radio1: '全部',
  813. getdataListParmSH: {
  814. name: 'getStockListSH',
  815. page: 1,
  816. offset: 1,
  817. pagecount: 10,
  818. returntype: 'Map',
  819. parammaps: {
  820. partCode: '',
  821. partName: '',
  822. partClass: '',
  823. statue: '',
  824. inputDatetimeSH: '',
  825. specification: ''
  826. }
  827. },
  828. listSH: [],
  829. listLoadingSH: false,
  830. totalSH: 0,
  831. tabName: '',
  832. dialogFormVisible_Examine: false,
  833. dialogFormVisible_Examines: false,
  834. examineTemp: {
  835. SHstatue: 1
  836. },
  837. statueReason: false,
  838. activeList: [],
  839. active: 3,
  840. isFlowChart: false, // 流程图/操作
  841. isDisplayPasture: false, // 查看-牧场信息,
  842. buttons: [],
  843. isPercentage: false,
  844. percentage: 1,
  845. downloadParam: {},
  846. postDataPramas: {},
  847. Selection: 0,
  848. selectionList: [],
  849. width: 0,
  850. createExamineParm: { name: 'getPartCode', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: {}},
  851. // EAS同步
  852. easStatus: {
  853. easStatusList: [{ name: '同步成功', id: '1' }, { name: '同步失败', id: '0' }],
  854. dialogStatus: '',
  855. dialogFormVisible: false,
  856. tableKey: 0,
  857. total: 0,
  858. listLoading: true,
  859. list: [],
  860. getdataListParm: {
  861. name: 'getpartsSync',
  862. page: 1,
  863. offset: 1,
  864. pagecount: 10,
  865. returntype: 'Map',
  866. parammaps: {}
  867. }
  868. },
  869. myHeight:document.documentElement.clientHeight - 85- 250
  870. // fileList: [],
  871. // headers1: {
  872. // optname: 'insertcustompic',
  873. // id: 1,
  874. // token: getToken() // 从cookie里获取token,并赋值token
  875. // },
  876. // uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
  877. // showUpload: false
  878. }
  879. },
  880. computed: {
  881. // 设置请求头
  882. // headers() {
  883. // return {
  884. // token: getToken()
  885. // }
  886. // },
  887. uploadData() {
  888. return {
  889. name: 'importparts',
  890. importParams: '编码,品名,规格型号,品牌,计量单位,一级分类,二级分类,三级分类,建立人,建立时间',
  891. sheetname: 'SheetJS'
  892. }
  893. },
  894. // 设置上传地址
  895. uploadExcelUrl() {
  896. // process.env.VUE_APP_BASE_API是服务器的路径,也是axios的基本路径
  897. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  898. }
  899. },
  900. created() {
  901. const that = this
  902. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  903. that.buttons = response.data.list
  904. that.get_auto_buttons()
  905. })
  906. this.get_select_list()
  907. this.getDownClassList()
  908. this.get_table_data()
  909. this.getMaxCode()
  910. this.getTypeList()
  911. this.get_table_dataSH()
  912. if (this.$route.query.tabName == undefined) {
  913. this.tabName = 'first'
  914. } else {
  915. this.tabName = this.$route.query.tabName
  916. }
  917. if (this.isBasic === false) {
  918. this.tabName = 'second'
  919. }
  920. if (this.tabName == 'first') {
  921. this.isDisplayPasture = true
  922. this.isFlowChart = false
  923. } else {
  924. this.isDisplayPasture = false
  925. this.isFlowChart = true
  926. }
  927. },
  928. methods: {
  929. tableSort(column) {
  930. sortChange(column, this.list)
  931. },
  932. get_auto_buttons() {
  933. // 新增
  934. const BasicAdd = 'customs:basic:add'
  935. const isBasicAdd = checkButtons(this.$store.state.user.buttons, BasicAdd)
  936. this.isBasicAdd = isBasicAdd
  937. // 模板
  938. const BasicTemplate = 'customs:basic:template'
  939. const isBasicTemplate = checkButtons(this.$store.state.user.buttons, BasicTemplate)
  940. this.isBasicTemplate = isBasicTemplate
  941. // 导出
  942. const BasicExport = 'customs:basic:export'
  943. const isBasicExport = checkButtons(this.$store.state.user.buttons, BasicExport)
  944. this.isBasicExport = isBasicExport
  945. // 导入
  946. const BasicImport = 'customs:basic:import'
  947. const isBasicImport = checkButtons(this.$store.state.user.buttons, BasicImport)
  948. this.isBasicImport = isBasicImport
  949. // 查看
  950. const BasicSee = 'customs:basic:see'
  951. const isBasicSee = checkButtons(this.$store.state.user.buttons, BasicSee)
  952. this.isBasicSee = isBasicSee
  953. // 编辑
  954. const BasicEdit = 'customs:basic:update'
  955. const isBasicEdit = checkButtons(this.$store.state.user.buttons, BasicEdit)
  956. this.isBasicEdit = isBasicEdit
  957. // 备件基础信息-编辑
  958. const BasicEditTab1 = 'customs:basic:update2'
  959. const isBasicEditTab1 = checkButtons(this.$store.state.user.buttons, BasicEditTab1)
  960. this.isBasicEditTab1 = isBasicEditTab1
  961. // 备件基础信息-禁用
  962. const Disable = 'customs:basic:disable'
  963. const isDisable = checkButtons(this.$store.state.user.buttons, Disable)
  964. this.isDisable = isDisable
  965. // 备件基础信息-开启
  966. const Enable = 'customs:basic:enable'
  967. const isEnable = checkButtons(this.$store.state.user.buttons, Enable)
  968. this.isEnable = isEnable
  969. // 备件基础信息删除
  970. const BasicDelete1 = 'customs:basic:enable'
  971. const isBasicDelete1 = checkButtons(this.$store.state.user.buttons, BasicDelete1)
  972. this.isBasicDelete1 = isBasicDelete1
  973. // 删除
  974. const BasicDelete = 'customs:basic:delete'
  975. const isBasicDelete = checkButtons(this.$store.state.user.buttons, BasicDelete)
  976. this.isBasicDelete = isBasicDelete
  977. // 审核
  978. const BasicExamine = 'customs:basic:shenhe'
  979. const isBasicExamine = checkButtons(this.$store.state.user.buttons, BasicExamine)
  980. this.isBasicExamine = isBasicExamine
  981. // 备件基础信息
  982. const Basic = 'customs:basic:basic'
  983. const isBasic = checkButtons(this.$store.state.user.buttons, Basic)
  984. this.isBasic = isBasic
  985. // 备件审核
  986. const BasicSH = 'customs:basic:shjm'
  987. const isBasicSH = checkButtons(this.$store.state.user.buttons, BasicSH)
  988. this.isBasicSH = isBasicSH
  989. // EAS同步
  990. const EasSynchronization = 'customs:basic:easSynchronization'
  991. const isEasSynchronization = checkButtons(this.$store.state.user.buttons, EasSynchronization)
  992. this.isEasSynchronization = isEasSynchronization
  993. // 手动同步
  994. const ManualSynchronization = 'customs:basic:manualSynchronization'
  995. const isManualSynchronization = checkButtons(this.$store.state.user.buttons, ManualSynchronization)
  996. this.isManualSynchronization = isManualSynchronization
  997. // 忽略同步
  998. const IgnoreSynchronization = 'customs:basic:ignoreSynchronization'
  999. const isIgnoreSynchronization = checkButtons(this.$store.state.user.buttons, IgnoreSynchronization)
  1000. this.isIgnoreSynchronization = isIgnoreSynchronization
  1001. },
  1002. handleSelectionChange2(val) {
  1003. this.multipleSelection = val;
  1004. },
  1005. handleBatchDisable(){
  1006. if(this.multipleSelection.length > 0){
  1007. this.$confirm('是否确定批量禁用?', '提示', {
  1008. confirmButtonText: '确定',
  1009. cancelButtonText: '取消',
  1010. type: 'warning'
  1011. }).then(() => {
  1012. this.multipleSelection.forEach(row => {
  1013. console.log("批量禁用",row)
  1014. this.requestParam = {}
  1015. this.requestParam.name = 'updatepartsEnable'
  1016. this.requestParam.parammaps = {}
  1017. this.requestParam.parammaps.id = row.id
  1018. this.requestParam.parammaps.enable = 0
  1019. PostDataByName(this.requestParam).then(() => {
  1020. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  1021. })
  1022. });
  1023. this.get_table_data()
  1024. this.get_table_dataSH()
  1025. }).catch(() => {
  1026. this.$message({
  1027. type: 'info',
  1028. message: '已取消批量禁用'
  1029. });
  1030. });
  1031. }else{
  1032. this.$notify({ title: '提示', message: '请勾选禁用备件', type: 'error', duration: 2000 })
  1033. }
  1034. },
  1035. handleBatchEnable(){
  1036. if(this.multipleSelection.length > 0){
  1037. this.$confirm('是否确定批量启用?', '提示', {
  1038. confirmButtonText: '确定',
  1039. cancelButtonText: '取消',
  1040. type: 'warning'
  1041. }).then(() => {
  1042. this.multipleSelection.forEach(row => {
  1043. console.log("批量启用",row)
  1044. this.requestParam = {}
  1045. this.requestParam.name = 'updatepartsEnable'
  1046. this.requestParam.parammaps = {}
  1047. this.requestParam.parammaps.id = row.id
  1048. this.requestParam.parammaps.enable = 1
  1049. PostDataByName(this.requestParam).then(() => {
  1050. this.$notify({ title: '成功', message: '启用成功', type: 'success', duration: 2000 })
  1051. })
  1052. });
  1053. this.get_table_data()
  1054. this.get_table_dataSH()
  1055. }).catch(() => {
  1056. this.$message({
  1057. type: 'info',
  1058. message: '已取消批量启用'
  1059. });
  1060. });
  1061. }else{
  1062. this.$notify({ title: '提示', message: '请勾选启用备件', type: 'error', duration: 2000 })
  1063. }
  1064. },
  1065. get_select_list() {
  1066. GetDataByNames(this.requestParams).then(response => {
  1067. this.units = response.data.getDictByName.list
  1068. this.findAllProvider = response.data.findAllProvider.list
  1069. this.findAllAssetType = response.data.findAllAssetType.list
  1070. this.findAllPasture = response.data.findAllPasture.list
  1071. this.findAllDepart = response.data.findAllDepart.list
  1072. this.findAllEmploye = response.data.findAllEmploye.list
  1073. this.findAllCategory = response.data.findAllCategory.list
  1074. })
  1075. },
  1076. getDownClassList() {
  1077. getRecuData(this.getRecuListParm).then(response => {
  1078. this.parentClass = response.data
  1079. })
  1080. },
  1081. popoverHide(checkedIds, checkedData) {
  1082. console.log(checkedIds, checkedData)
  1083. if (checkedIds !== null) {
  1084. if (checkedData.childrens == 0) {
  1085. this.deptform.pid = checkedIds
  1086. console.log(checkedData)
  1087. if (checkedIds !== null) {
  1088. // this.deptform.partCode = checkedData.partClassCode
  1089. this.createTemp.partCode = checkedData.partClassCode
  1090. this.createTemp.partClass = checkedData.partClassCode
  1091. this.createTemp.partClassNameCode = checkedData.partClassNameCode
  1092. this.getMaxCode()
  1093. } else {
  1094. this.createTemp.pid = -1
  1095. }
  1096. this.getMaxCode()
  1097. } else {
  1098. this.defaultCheckedKeys = []
  1099. this.createTemp.tempPtypeCode = ''
  1100. this.createTemp.temptypeCode = ''
  1101. this.$message({
  1102. type: 'warning',
  1103. message: '请选择详细备件类别'
  1104. })
  1105. }
  1106. } else {
  1107. this.defaultCheckedKeys = []
  1108. this.createTemp.partCode = ''
  1109. this.createTemp.partClass = ''
  1110. this.createTemp.partClassNameCode = ''
  1111. }
  1112. },
  1113. getTypeList() {
  1114. // this.listLoading = true
  1115. this.getDeptListParm.parammaps = this.deptform
  1116. GetDataByName(this.getDeptListParm).then(response => {
  1117. this.listType = response.data
  1118. if (response.data.list !== null) {
  1119. this.listType = transData(response.data.list, 'id', 'pid', 'children')
  1120. console.log(this.listType,'11111')
  1121. }
  1122. this.parentDept = this.listType
  1123. })
  1124. },
  1125. getMaxCode() {
  1126. this.requestParam.name = 'getPartCode'
  1127. this.requestParam.parammaps = {}
  1128. this.requestParam.parammaps.partCode = this.createTemp.partCode
  1129. GetDataByName(this.requestParam).then(response => {
  1130. console.log('备件类别选中data', response.data.list)
  1131. if (response.data.list !== 0) {
  1132. if (response.data.list[0].preCode === '') {
  1133. this.createTemp.tempPtypeCode = this.deptform.typeCode + '.'
  1134. } else {
  1135. this.createTemp.tempPtypeCode = response.data.list[0].preCode
  1136. }
  1137. this.createTemp.temptypeCode = response.data.list[0].maxcode
  1138. this.$nextTick(() => {
  1139. // this.createTemp.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1140. console.log(this.createTemp.partCode)
  1141. this.$forceUpdate()
  1142. })
  1143. if (this.requestParam.parammaps.pid === -1) {
  1144. this.createTemp.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1145. }
  1146. }
  1147. })
  1148. },
  1149. get_table_data() {
  1150. this.listLoading = true
  1151. if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
  1152. this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  1153. this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  1154. } else {
  1155. this.getdataListParm.parammaps.startTime = ''
  1156. this.getdataListParm.parammaps.stopTime = ''
  1157. }
  1158. this.getdataListParm.parammaps.partClass = this.createTemp.partClass
  1159. GetDataByName(this.getdataListParm).then(response => {
  1160. console.log('table数据', response.data.list)
  1161. this.list = response.data.list
  1162. if (response.data.list !== null) {
  1163. for (var i = 0; i < response.data.list.length; i++) {
  1164. // console.log(response.data.list[i].srcpath)
  1165. 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) {
  1166. this.list[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  1167. this.list[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  1168. // console.log(111)
  1169. } else {
  1170. this.list[i].srcpath = ''
  1171. this.list[i].picpath = ''
  1172. }
  1173. }
  1174. }
  1175. this.pageNum = response.data.pageNum
  1176. this.pageSize = response.data.pageSize
  1177. if (response.data.total) {
  1178. this.total = response.data.total
  1179. }
  1180. // Just to simulate the time of the request
  1181. setTimeout(() => {
  1182. this.listLoading = false
  1183. }, 100)
  1184. })
  1185. },
  1186. statue: function(cellValue) {
  1187. // console.log(cellValue.isZeroStock)
  1188. if (cellValue.statue == 0) {
  1189. return '审核中'
  1190. } else if (cellValue.statue == 1) {
  1191. return '已通过'
  1192. } else if (cellValue.statue == 2) {
  1193. return '未通过'
  1194. } else if (cellValue.statue == 3) {
  1195. return '历史数据'
  1196. }
  1197. },
  1198. get_table_dataSH() {
  1199. this.listLoadingSH = true
  1200. if (this.$refs['inputDatetimeSH'] !== undefined && this.$refs['inputDatetimeSH'].value !== null) {
  1201. this.getdataListParmSH.parammaps.startTime = this.$refs['inputDatetimeSH'].value[0]
  1202. this.getdataListParmSH.parammaps.stopTime = this.$refs['inputDatetimeSH'].value[1]
  1203. } else {
  1204. this.getdataListParmSH.parammaps.startTime = ''
  1205. this.getdataListParmSH.parammaps.stopTime = ''
  1206. }
  1207. this.getdataListParmSH.parammaps.partClass = this.createTemp.partClass
  1208. GetDataByName(this.getdataListParmSH).then(response => {
  1209. console.log('table数据', response.data.list)
  1210. this.listSH = response.data.list
  1211. if (response.data.list !== null) {
  1212. for (var i = 0; i < response.data.list.length; i++) {
  1213. 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) {
  1214. this.listSH[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  1215. this.listSH[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  1216. } else {
  1217. this.listSH[i].srcpath = ''
  1218. this.listSH[i].picpath = ''
  1219. }
  1220. }
  1221. }
  1222. this.pageNumSH = response.data.pageNum
  1223. this.pageSizeSH = response.data.pageSize
  1224. if (response.data.total) {
  1225. this.totalSH = response.data.total
  1226. }
  1227. setTimeout(() => {
  1228. this.listLoadingSH = false
  1229. }, 100)
  1230. })
  1231. },
  1232. form_search() {
  1233. this.listLoading = true
  1234. if (this.getdataListParm.parammaps.inputDatetime === null) {
  1235. this.getdataListParm.parammaps.inputDatetime = ''
  1236. }
  1237. this.getdataListParm.parammaps.partClass = this.deptform.typeCode
  1238. this.getdataListParm.offset = 1
  1239. this.get_table_data()
  1240. },
  1241. form_searchSH() {
  1242. this.listLoadingSH = true
  1243. if (this.getdataListParmSH.parammaps.inputDatetimeSH === null) {
  1244. this.getdataListParmSH.parammaps.inputDatetimeSH = ''
  1245. }
  1246. this.getdataListParmSH.parammaps.partClass = this.deptform.typeCode
  1247. this.getdataListParmSH.offset = 1
  1248. this.get_table_dataSH()
  1249. },
  1250. form_see(row) {
  1251. this.activeName = 'first'
  1252. this.seeTemp = Object.assign({}, row) // copy obj
  1253. if (this.seeTemp.srcpath !== undefined) {
  1254. this.$set(this.seeTemp, 'srcpath', this.seeTemp.srcpath)
  1255. this.$set(this.seeTemp, 'picpath', this.seeTemp.picpath)
  1256. }
  1257. console.log('查看上方数据(从table读取)', this.seeTemp)
  1258. this.dialogStatus = 'see'
  1259. this.dialogFormVisible_See = true
  1260. this.getdataListSee.parammaps.partCode = row.partCode
  1261. this.getSeeList()
  1262. // 流程图
  1263. var reason = '未通过原因:' + this.seeTemp.workflowNote
  1264. if (this.seeTemp.statue === 0) {
  1265. this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核' }]
  1266. this.active = 1
  1267. } else if (this.seeTemp.statue === 1) {
  1268. this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }]
  1269. this.active = 2
  1270. } else if (this.seeTemp.statue === 2) {
  1271. this.activeList = [{ title: '提交信息', date: this.seeTemp.createTime, name: this.seeTemp.createPerson }, { title: '设备中心审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }]
  1272. this.active = 2
  1273. }
  1274. },
  1275. getSeeList() {
  1276. this.listLoadingSee = true
  1277. GetDataByName(this.getdataListSee).then(response => {
  1278. console.log('查看牧场信息table数据', response.data.list)
  1279. this.listSee = response.data.list
  1280. this.pageNumSee = response.data.pageNum
  1281. this.pageSizeSee = response.data.pageSize
  1282. if (response.data.total) {
  1283. this.totalSee = response.data.total
  1284. }
  1285. // Just to simulate the time of the request
  1286. setTimeout(() => {
  1287. this.listLoadingSee = false
  1288. }, 100)
  1289. })
  1290. },
  1291. handleClick(tab, event) {
  1292. console.log(tab, event)
  1293. },
  1294. resetCreateTemp() {
  1295. this.requestParam = { name: 'createAssetType', parammaps: {}}
  1296. this.defaultCheckedKeys = []
  1297. this.createTemp.partClassNameCode = ''
  1298. this.createTemp.tempPtypeCode = ''
  1299. this.createTemp.temptypeCode = ''
  1300. this.createTemp.partClass = ''
  1301. this.createTemp.partCode = ''
  1302. this.createTemp.partName = ''
  1303. this.createTemp.specification = ''
  1304. this.createTemp.purpose = ''
  1305. this.createTemp.unit = ''
  1306. this.createTemp.createTime = parseTime(new Date(), '{y}-{m}-{d}')
  1307. this.createTemp.note = ''
  1308. this.createTemp.picId = ''
  1309. this.createTemp.picpath = ''
  1310. },
  1311. form_add() {
  1312. this.resetCreateTemp()
  1313. this.createTemp.createPerson = this.$store.state.user.employeid
  1314. this.partClassCreate = true
  1315. this.partClassUpdate = false
  1316. this.$nextTick(() => {
  1317. this.$refs.upload.clearFiles()
  1318. this.showUpload = false
  1319. this.$refs['createTemp'].clearValidate()
  1320. })
  1321. this.dialogStatus = 'create'
  1322. this.dialogFormVisible = true
  1323. this.fileList = []
  1324. },
  1325. handlePicChange(file, fileList) {
  1326. // console.log(response, '文件状态改变时的钩子response')
  1327. console.log(file, '文件状态改变时的钩子file')
  1328. console.log(fileList, '文件状态改变时的钩子fileList')
  1329. console.log(this.createTemp, '文件状态改变时的钩子row')
  1330. console.log(this.showUpload, '文件状态改变时的钩子row')
  1331. if (fileList.length > 0) {
  1332. this.$nextTick(() => {
  1333. // this.$set(this.createTemp, 'showUpload', true)
  1334. this.showUpload = true
  1335. })
  1336. } else {
  1337. this.$nextTick(() => {
  1338. this.showUpload = false
  1339. })
  1340. }
  1341. console.log(this.createTemp)
  1342. },
  1343. handlePicSuccess(response, file, fileList) {
  1344. if (fileList.length > 0) {
  1345. this.$nextTick(() => {
  1346. this.showUpload = true
  1347. })
  1348. } else {
  1349. this.$nextTick(() => {
  1350. this.showUpload = false
  1351. })
  1352. }
  1353. if (this.createTemp.picpath === undefined || this.createTemp.picpath === '' || this.createTemp.picpath == -1) {
  1354. this.$set(this.createTemp, 'picpath', response.execresult.LastInsertId)
  1355. }
  1356. console.log(this.createTemp, '文件上传成功时的钩子row')
  1357. },
  1358. handlePicRemove(file, fileList) {
  1359. console.log(file, '文件列表移除文件时的钩子file---')
  1360. console.log(fileList, '文件列表移除文件时的钩子fileList--')
  1361. console.log(this.createTemp, '文件列表移除文件时的钩子row---')
  1362. // console.log(this.dialogStatus)update
  1363. if (this.dialogStatus === 'create') {
  1364. if (fileList.length < 1) {
  1365. this.showUpload = false
  1366. }
  1367. for (const key in this.createTemp) {
  1368. if (this.createTemp[key] === file.response.execresult.LastInsertId) {
  1369. this.$delete(this.createTemp, key)
  1370. }
  1371. }
  1372. } else {
  1373. if (fileList.length < 1) {
  1374. this.$nextTick(() => {
  1375. this.showUpload = false
  1376. })
  1377. }
  1378. const url = file.url
  1379. console.log(url, 'url')
  1380. for (const key in this.createTemp) {
  1381. console.log(this.createTemp[key], 'createTemp[key]')
  1382. if (this.createTemp[key] === url) {
  1383. console.log(key)
  1384. if (key === 'picpath') {
  1385. this.$delete(this.createTemp, 'picpath')
  1386. this.$delete(this.createTemp, 'picId')
  1387. }
  1388. }
  1389. }
  1390. }
  1391. console.log(this.createTemp, '文件列表移除文件时的钩子row')
  1392. },
  1393. handlePicPreview(file) {
  1394. this.dialogImageUrl = file.url
  1395. this.dialogVisible = true
  1396. },
  1397. onLoad(e) {
  1398. const img = e.target
  1399. let width = 0
  1400. if (img.fileSize > 0 || (img.width > 1 && img.height > 1)) {
  1401. width = img.width + 40
  1402. }
  1403. this.width = width + 'px'
  1404. },
  1405. beforeRemove(file, fileList) {
  1406. console.log(file.response, '删除文件之前的钩子,参数为上传的文件和文件列表')
  1407. return this.$confirm('删除当前图片, 是否继续?', '提示', {
  1408. confirmButtonText: '确定',
  1409. cancelButtonText: '取消',
  1410. type: 'warning'
  1411. })
  1412. },
  1413. add_dialog_save() {
  1414. this.isokDisable = true
  1415. setTimeout(() => {
  1416. this.isokDisable = false
  1417. }, 1000)
  1418. this.$refs['createTemp'].validate(valid => {
  1419. if (valid) {
  1420. if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
  1421. this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
  1422. return false
  1423. }
  1424. this.postDataPramas.common = { 'returnmap': '0' }
  1425. this.postDataPramas.data = []
  1426. this.postDataPramas.data[0] = { 'name': 'checkPartsns', 'type': 'v', 'parammaps': {
  1427. 'partName': this.createTemp.partName,
  1428. 'specification': this.createTemp.specification
  1429. }}
  1430. this.postDataPramas.data[1] = { 'name': 'insertStock', 'type': 'e', 'parammaps': {
  1431. 'picId': this.createTemp.picpath,
  1432. 'partClass': this.createTemp.partClass,
  1433. // this.requestParam.parammaps.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1434. 'partCode': this.createTemp.partCode,
  1435. 'partName': this.createTemp.partName,
  1436. 'specification': this.createTemp.specification,
  1437. 'unit': this.createTemp.unit,
  1438. 'purpose': this.createTemp.purpose,
  1439. 'createPerson': this.createTemp.createPerson,
  1440. 'createTime': this.createTemp.createTime,
  1441. 'note': this.createTemp.note
  1442. }}
  1443. ExecDataByConfig(this.postDataPramas).then(response => {
  1444. console.log('保存发送参数', this.postDataPramas)
  1445. if (response.msg !== 'fail') {
  1446. this.deptform.id = ''
  1447. this.deptform.typeName = ''
  1448. this.dialogFormVisible = false
  1449. this.defaultCheckedKeys = []
  1450. this.createTemp.partCode = ''
  1451. this.createTemp.partClass = ''
  1452. this.createTemp.partClassNameCode = ''
  1453. this.get_table_data()
  1454. this.getMaxCode()
  1455. this.$nextTick(() => {
  1456. this.$refs['createTemp'].clearValidate()
  1457. })
  1458. this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
  1459. } else {
  1460. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1461. }
  1462. })
  1463. }
  1464. })
  1465. },
  1466. add_dialog_save_again() {
  1467. this.isokDisable = true
  1468. setTimeout(() => {
  1469. this.isokDisable = false
  1470. }, 1000)
  1471. this.$refs['createTemp'].validate(valid => {
  1472. if (valid) {
  1473. if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
  1474. this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
  1475. return false
  1476. }
  1477. this.postDataPramas.common = { 'returnmap': '0' }
  1478. this.postDataPramas.data = []
  1479. this.postDataPramas.data[0] = { 'name': 'checkPartsns', 'type': 'v', 'parammaps': {
  1480. 'partName': this.createTemp.partName,
  1481. 'specification': this.createTemp.specification
  1482. }}
  1483. this.postDataPramas.data[1] = { 'name': 'insertStock', 'type': 'e', 'parammaps': {
  1484. 'picId': this.createTemp.picpath,
  1485. 'partClass': this.createTemp.partClass,
  1486. // this.requestParam.parammaps.partCode = this.createTemp.tempPtypeCode + this.createTemp.temptypeCode
  1487. 'partCode': this.createTemp.partCode,
  1488. 'partName': this.createTemp.partName,
  1489. 'specification': this.createTemp.specification,
  1490. 'unit': this.createTemp.unit,
  1491. 'purpose': this.createTemp.purpose,
  1492. 'createPerson': this.createTemp.createPerson,
  1493. 'createTime': this.createTemp.createTime,
  1494. 'note': this.createTemp.note
  1495. }}
  1496. ExecDataByConfig(this.postDataPramas).then(response => {
  1497. console.log('保存发送参数', this.postDataPramas)
  1498. if (response.msg !== 'fail') {
  1499. this.resetCreateTemp()
  1500. this.get_table_data()
  1501. this.$nextTick(() => {
  1502. this.$refs['createTemp'].clearValidate()
  1503. })
  1504. this.$notify({ title: '成功', message: '新增成功', type: 'success', duration: 2000 })
  1505. this.handlePicRemove()
  1506. } else {
  1507. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1508. }
  1509. })
  1510. }
  1511. })
  1512. },
  1513. handleDisable(row) {
  1514. MessageBox.confirm('禁用后备件不可使用,是否禁用?', {
  1515. confirmButtonText: '确认',
  1516. cancelButtonText: '取消',
  1517. type: 'warning'
  1518. }).then(() => {
  1519. this.requestParam.name = 'updatepartsEnable'
  1520. this.requestParam.parammaps = {}
  1521. this.requestParam.parammaps.id = row.id
  1522. this.requestParam.parammaps.enable = 0
  1523. PostDataByName(this.requestParam).then(() => {
  1524. this.get_table_data()
  1525. this.get_table_dataSH()
  1526. this.dialogFormVisible = false
  1527. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  1528. })
  1529. }).catch(() => {
  1530. this.$message({ type: 'info', message: '已取消禁用' })
  1531. })
  1532. },
  1533. handleEnable(row) {
  1534. this.requestParam.name = 'updatepartsEnable'
  1535. this.requestParam.parammaps = {}
  1536. this.requestParam.parammaps.id = row.id
  1537. this.requestParam.parammaps.enable = 1
  1538. PostDataByName(this.requestParam).then(() => {
  1539. this.get_table_data()
  1540. this.get_table_dataSH()
  1541. this.dialogFormVisible = false
  1542. this.$notify({ title: '成功', message: '启用成功', type: 'success', duration: 2000 })
  1543. })
  1544. },
  1545. form_edit(row) {
  1546. this.createTemp = Object.assign({}, row) // copy obj
  1547. this.createTemp.partClass = this.createTemp.eqClassName1 + '/' + this.createTemp.eqClassName2 + '/' + this.createTemp.eqClassName3
  1548. this.dialogStatus = 'update'
  1549. this.dialogFormVisible = true
  1550. this.partClassCreate = false
  1551. this.partClassUpdate = true
  1552. const urlArray = []
  1553. const fileList = []
  1554. if (row.picpath == undefined) {
  1555. urlArray.push()
  1556. } else if (row.picpath == '') {
  1557. urlArray.push()
  1558. } else {
  1559. urlArray.push(row.picpath)
  1560. }
  1561. for (let i = 0; i < urlArray.length; i++) {
  1562. const urlObj = {}
  1563. this.$set(urlObj, 'url', urlArray[i])
  1564. fileList.push(urlObj)
  1565. }
  1566. this.$set(this.createTemp, 'fileList', fileList)
  1567. console.log(this.createTemp)
  1568. if (this.createTemp.fileList.length >= 1) {
  1569. this.showUpload = true
  1570. } else {
  1571. this.showUpload = false
  1572. }
  1573. },
  1574. edit_dialog_save() {
  1575. this.$refs['createTemp'].validate(valid => {
  1576. if (valid) {
  1577. if (this.createTemp.picpath == '' || this.createTemp.picpath == undefined) {
  1578. this.$notify({ title: '', message: '请上传图片', type: 'warning', duration: 2000 })
  1579. return false
  1580. }
  1581. this.requestParam.name = 'updateParts'
  1582. this.requestParam.parammaps.partClass = this.createTemp.partClass
  1583. this.requestParam.parammaps.id = this.createTemp.id
  1584. this.requestParam.parammaps.partCode = this.createTemp.partCode
  1585. this.requestParam.parammaps.partName = this.createTemp.partName
  1586. this.requestParam.parammaps.specification = this.createTemp.specification
  1587. this.requestParam.parammaps.purpose = this.createTemp.purpose
  1588. this.requestParam.parammaps.unit = this.createTemp.unit
  1589. this.requestParam.parammaps.createPersonId = this.createTemp.createPersonId
  1590. this.requestParam.parammaps.createTime = this.createTemp.createTime
  1591. this.requestParam.parammaps.note = this.createTemp.note
  1592. this.requestParam.parammaps.statue = 0
  1593. const picpath = parseInt(this.createTemp.picpath)
  1594. if (isNaN(picpath) == false) {
  1595. this.requestParam.parammaps.picpath = this.createTemp.picpath
  1596. } else {
  1597. this.requestParam.parammaps.picpath = this.createTemp.picId
  1598. }
  1599. console.log('编辑保存发送data', this.requestParam.parammaps)
  1600. PostDataByName(this.requestParam).then(response => {
  1601. if (response.msg !== 'fail') {
  1602. this.defaultCheckedKeys = []
  1603. this.createTemp.partCode = ''
  1604. this.createTemp.partClass = ''
  1605. this.createTemp.partClassNameCode = ''
  1606. this.get_table_data()
  1607. this.get_table_dataSH()
  1608. this.getMaxCode()
  1609. this.dialogFormVisible = false
  1610. this.$nextTick(() => {
  1611. this.$refs['createTemp'].clearValidate()
  1612. })
  1613. this.$notify({
  1614. title: '成功',
  1615. message: '编辑成功',
  1616. type: 'success',
  1617. duration: 2000
  1618. })
  1619. } else {
  1620. failproccess(response, this.$notify)
  1621. }
  1622. })
  1623. }
  1624. })
  1625. },
  1626. handleDelate(row) {
  1627. MessageBox.confirm('备件编号:' + row.partCode + ' ,备件名称:' + row.partName, '确认删除?', {
  1628. confirmButtonText: '确认',
  1629. cancelButtonText: '取消',
  1630. type: 'warning'
  1631. }).then(() => {
  1632. this.requestParam.name = 'deleteStock'
  1633. this.requestParam.parammaps = {}
  1634. this.requestParam.parammaps['id'] = row.id
  1635. PostDataByName(this.requestParam).then(() => {
  1636. this.get_table_data()
  1637. this.get_table_dataSH()
  1638. this.dialogFormVisible = false
  1639. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1640. })
  1641. }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }) })
  1642. },
  1643. handleRemove(file, fileList) {
  1644. console.log(file, fileList)
  1645. this.dialogForm.imgList = fileList
  1646. if (fileList) {
  1647. this.$refs['uploadElement'].clearValidate()
  1648. }
  1649. },
  1650. handlePictureCardPreview(file) {
  1651. this.dialogImageUrl = file.url
  1652. this.dialogVisible = true
  1653. },
  1654. formatJson(filterVal, jsonData) {
  1655. return jsonData.map(v =>
  1656. filterVal.map(j => {
  1657. if (j === 'timestamp') {
  1658. return parseTime(v[j])
  1659. } else {
  1660. return v[j]
  1661. }
  1662. })
  1663. )
  1664. },
  1665. handleDownload() {
  1666. console.log('点击了基础信息导出')
  1667. console.log(this.tabName)
  1668. this.$alert('备件基础信息正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  1669. this.isPercentage = true
  1670. this.percentage = 1
  1671. var timer = setInterval(() => {
  1672. this.percentage += 5
  1673. if (this.percentage > 95) {
  1674. this.percentage = 99
  1675. clearInterval(timer)
  1676. }
  1677. this.percentage = this.percentage
  1678. }, 1000)
  1679. if (this.tabName == 'first') {
  1680. this.downloadParam.name = 'getStockList'
  1681. this.downloadParam.parammaps = {}
  1682. this.downloadParam.parammaps.partCode = this.getdataListParm.parammaps.partCode
  1683. this.downloadParam.parammaps.partName = this.getdataListParm.parammaps.partName
  1684. this.downloadParam.parammaps.partClass = this.getdataListParm.parammaps.partClass
  1685. this.downloadParam.parammaps.startTime = this.getdataListParm.parammaps.startTime
  1686. this.downloadParam.parammaps.stopTime = this.getdataListParm.parammaps.stopTime
  1687. this.downloadParam.parammaps.specification = this.getdataListParm.parammaps.specification
  1688. } else if (this.tabName == 'second') {
  1689. this.downloadParam.name = 'getStockListSH'
  1690. this.downloadParam.parammaps = {}
  1691. this.downloadParam.parammaps.partCode = this.getdataListParmSH.parammaps.partCode
  1692. this.downloadParam.parammaps.partName = this.getdataListParmSH.parammaps.partName
  1693. this.downloadParam.parammaps.partClass = this.getdataListParmSH.parammaps.partClass
  1694. this.downloadParam.parammaps.statue = this.getdataListParmSH.parammaps.statue
  1695. this.downloadParam.parammaps.startTime = this.getdataListParmSH.parammaps.startTime
  1696. this.downloadParam.parammaps.stopTime = this.getdataListParmSH.parammaps.stopTime
  1697. this.downloadParam.parammaps.specification = this.getdataListParmSH.parammaps.specification
  1698. }
  1699. GetAccount(this.downloadParam).then(response => {
  1700. if (response.data.list !== '') {
  1701. this.percentage = 99
  1702. setTimeout(() => {
  1703. this.isPercentage = false
  1704. }, 2000)
  1705. }
  1706. this.$nextTick(() => {
  1707. const ExcelDatas = [
  1708. {
  1709. tHeader: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
  1710. filterVal: ['partCode', 'partName', 'specification', 'unit', 'eqClassName1', 'eqClassName2', 'eqClassName3', 'createPerson', 'createTime'],
  1711. tableDatas: response.data.list,
  1712. sheetName: '备件基础信息'
  1713. }
  1714. ]
  1715. json2excel(ExcelDatas, '备件基础信息', true, 'xlsx')
  1716. })
  1717. })
  1718. },
  1719. handleDownloadTemp() {
  1720. this.requestParam.name = 'stockDownTemp'
  1721. GetDataByName(this.requestParam).then(response => {
  1722. this.$nextTick(() => {
  1723. const ExcelDatas = [
  1724. {
  1725. tHeader: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
  1726. filterVal: ['编码', '品名', '规格型号', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间'],
  1727. tableDatas: response.data.list,
  1728. sheetName: 'SheetJS'
  1729. }
  1730. ]
  1731. json2excel(ExcelDatas, '备件基础信息模板', true, 'xlsx')
  1732. })
  1733. })
  1734. },
  1735. // 导入
  1736. beforeImportExcel(file) {
  1737. const isLt2M = file.size / 1024 / 1024 < 10
  1738. if (!isLt2M) {
  1739. this.$message.error('上传文件大小不能超过 10MB!')
  1740. }
  1741. return isLt2M
  1742. },
  1743. handleImportExcelSuccess(res, file) {
  1744. if (res.msg === 'ok') {
  1745. this.$message({
  1746. title: '成功',
  1747. message: '导入成功:' + res.data.success + '条!',
  1748. type: 'success',
  1749. duration: 2000
  1750. })
  1751. if (res.data.err_count > 0) {
  1752. this.$notify({
  1753. title: '失败',
  1754. message: '导入失败:' + res.data.err_count + '条!',
  1755. type: 'danger',
  1756. duration: 2000
  1757. })
  1758. import('@/vendor/Export2Excel').then(excel => {
  1759. const list1 = res.data.result
  1760. const tHeader = [
  1761. '编码', '品名', '规格型号', '品牌', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间', 'error_msg'
  1762. ]
  1763. const filterVal = [
  1764. '编码', '品名', '规格型号', '品牌', '计量单位', '一级分类', '二级分类', '三级分类', '建立人', '建立时间', 'error_msg'
  1765. ]
  1766. const data1 = this.formatJson(filterVal, list1)
  1767. excel.export_json_to_excel({
  1768. header: tHeader,
  1769. data: data1,
  1770. filename: this.requestParam.parammaps.formType,
  1771. autoWidth: true,
  1772. bookType: 'xlsx'
  1773. })
  1774. })
  1775. }
  1776. } else {
  1777. this.$notify({
  1778. title: '失败',
  1779. message: '上传失败',
  1780. type: 'danger',
  1781. duration: 2000
  1782. })
  1783. }
  1784. },
  1785. handleTabClick(val) {
  1786. console.log('点击了基础信息/审核备件tab', val)
  1787. // isFlowChart
  1788. if (val.name == 'second') {
  1789. this.isFlowChart = true
  1790. this.isDisplayPasture = false
  1791. } else {
  1792. this.isFlowChart = false
  1793. this.isDisplayPasture = true
  1794. }
  1795. this.get_table_data()
  1796. this.get_table_dataSH()
  1797. },
  1798. handleExamine(row) {
  1799. if (row == undefined) {
  1800. this.examineTemp = this.seeTemp
  1801. this.$set(this.seeTemp, 'SHstatue', 1)
  1802. this.$set(this.seeTemp, 'workflowNote', '')
  1803. } else {
  1804. this.examineTemp = Object.assign({}, row)
  1805. this.$set(this.examineTemp, 'SHstatue', 1)
  1806. this.$set(this.examineTemp, 'workflowNote', '')
  1807. }
  1808. this.dialogStatus = 'examine'
  1809. this.dialogFormVisible_Examine = true
  1810. // this.examineTemp.statue = 1
  1811. this.statueReason = false
  1812. this.keyupSubmit()
  1813. },
  1814. changeStatue(val) {
  1815. if (val == 2) {
  1816. this.statueReason = true
  1817. } else {
  1818. this.statueReason = false
  1819. }
  1820. },
  1821. keyupSubmit() {
  1822. if (this.dialogStatus == 'examine' || this.dialogStatus == 'examines') {
  1823. document.onkeydown = e => {
  1824. const _key = window.event.keyCode
  1825. if (_key === 13) {
  1826. this.createExamineData()
  1827. }
  1828. }
  1829. }
  1830. },
  1831. createExamineData() {
  1832. this.isokDisable = true
  1833. setTimeout(() => {
  1834. this.isokDisable = false
  1835. }, 1000)
  1836. this.$refs['examineTemp'].validate(valid => {
  1837. if (valid) {
  1838. this.createExamineParm.parammaps.partCode = this.examineTemp.partCode
  1839. GetDataByName(this.createExamineParm).then(response => {
  1840. this.requestParam.name = 'partsCharge'
  1841. this.requestParam.parammaps = {}
  1842. this.requestParam.parammaps.id = this.examineTemp.id
  1843. if (this.examineTemp.SHstatue === 1) {
  1844. this.requestParam.parammaps.statue = 1
  1845. } else {
  1846. this.requestParam.parammaps.statue = 2
  1847. }
  1848. this.requestParam.parammaps.empId = Cookies.get('employeid')
  1849. this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
  1850. if (this.examineTemp.SHstatue === 1) {
  1851. this.requestParam.parammaps.partCode = response.data.list[0].preCode + response.data.list[0].maxcode
  1852. } else {
  1853. this.requestParam.parammaps.partCode = this.createExamineParm.parammaps.partCode
  1854. }
  1855. PostDataByName(this.requestParam).then(response => {
  1856. console.log('审核确认发送参数', this.requestParam)
  1857. if (response.msg !== 'fail') {
  1858. this.get_table_dataSH()
  1859. this.dialogFormVisible_Examine = false
  1860. this.dialogFormVisible_See = false
  1861. this.statueReason = false
  1862. this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
  1863. } else {
  1864. failproccess(response, this.$notify)
  1865. }
  1866. })
  1867. })
  1868. }
  1869. })
  1870. },
  1871. handleSelectionChange(val) {
  1872. console.log('选择', val.length)
  1873. this.Selection = val.length
  1874. this.selectionList = []
  1875. if (val.length > 0) {
  1876. for (let i = 0; i < val.length; i++) {
  1877. const selectionObj = {}
  1878. selectionObj.id = val[i].id
  1879. selectionObj.statue = val[i].statue
  1880. selectionObj.partCode = val[i].partCode
  1881. this.selectionList.push(selectionObj)
  1882. }
  1883. }
  1884. },
  1885. handleExamines() {
  1886. console.log('点击了批量审批', this.selectionList)
  1887. if (this.Selection > 0) {
  1888. // statue == 0
  1889. for (let i = 0; i < this.selectionList.length; i++) {
  1890. console.log(this.selectionList[i])
  1891. if (this.selectionList[i].statue !== 0) {
  1892. this.$message({ type: 'error', message: '通过审核的备件不可重复审核', duration: 2000 })
  1893. return false
  1894. }
  1895. }
  1896. this.dialogStatus = 'examines'
  1897. this.dialogFormVisible_Examines = true
  1898. this.keyupSubmit()
  1899. } else {
  1900. this.$message({ type: 'error', message: '请选择要审核的数据', duration: 2000 })
  1901. }
  1902. },
  1903. createExamineDatas() {
  1904. console.log(this.selectionList)
  1905. this.postDataPramas.common = { 'returnmap': '0' }
  1906. this.postDataPramas.data = []
  1907. this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectionList }}
  1908. this.postDataPramas.data[0].children = []
  1909. this.postDataPramas.data[0].children[0] = { 'name': 'batchPartsSH', 'type': 'e', 'parammaps': {
  1910. id: '@insertSpotList.id',
  1911. empId: Cookies.get('employeid'),
  1912. partCode: '@insertSpotList.partCode'
  1913. }}
  1914. ExecDataByConfig(this.postDataPramas).then(response => {
  1915. console.log('新增保存发送参数', this.postDataPramas)
  1916. if (response.msg === 'fail') {
  1917. this.$notify({
  1918. title: '保存失败',
  1919. message: response.data,
  1920. type: 'warning',
  1921. duration: 2000
  1922. })
  1923. } else {
  1924. this.dialogFormVisible_Examines = false
  1925. this.get_table_dataSH()
  1926. this.$notify({
  1927. title: '',
  1928. message: '保存成功',
  1929. type: 'success',
  1930. duration: 2000
  1931. })
  1932. }
  1933. })
  1934. },
  1935. handleEAS() {
  1936. this.easStatus.dialogStatus = 'easStatus'
  1937. this.easStatus.dialogFormVisible = true
  1938. this.get_table_dataEasStatusLst()
  1939. },
  1940. get_table_dataEasStatusLst() {
  1941. this.easStatus.listLoading = true
  1942. GetDataByName(this.easStatus.getdataListParm).then(response => {
  1943. if (response.data.list !== null) {
  1944. this.easStatus.list = response.data.list
  1945. } else {
  1946. this.easStatus.list = []
  1947. }
  1948. this.easStatus.pageNum = response.data.pageNum
  1949. this.easStatus.pageSize = response.data.pageSize
  1950. if (response.data.total) {
  1951. this.easStatus.total = response.data.total
  1952. }
  1953. })
  1954. setTimeout(() => {
  1955. this.easStatus.listLoading = false
  1956. }, 100)
  1957. },
  1958. handleManual(row) {
  1959. MessageBox.confirm('是否确认同步此数据至EAS?', {
  1960. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1961. }).then(() => {
  1962. this.requestParam = {}
  1963. this.requestParam.typeIn = row.typeIn
  1964. this.requestParam.billCode = row.billCode
  1965. EasSync(this.requestParam).then((response) => {
  1966. if (response.msg !== 'fail') {
  1967. this.$notify({ title: '成功', message: '手动同步成功', type: 'success', duration: 2000 })
  1968. this.get_table_dataEasStatusLst()
  1969. this.get_table_data()
  1970. } else {
  1971. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1972. this.get_table_dataEasStatusLst()
  1973. this.get_table_data()
  1974. }
  1975. })
  1976. }).catch(() => {
  1977. this.$message({ type: 'info', message: '已取消手动同步' })
  1978. })
  1979. },
  1980. handleIgnore(row) {
  1981. MessageBox.confirm('是否确认忽略同步此数据?', {
  1982. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1983. }).then(() => {
  1984. this.requestParam = {}
  1985. this.requestParam.name = 'updatepartsSync'
  1986. this.requestParam.parammaps = {}
  1987. this.requestParam.parammaps.issync = '3'
  1988. this.requestParam.parammaps.id = row.id
  1989. PostDataByName(this.requestParam).then((response) => {
  1990. if (response.msg !== 'fail') {
  1991. this.$notify({ title: '成功', message: '忽略同步成功', type: 'success', duration: 2000 })
  1992. this.get_table_dataEasStatusLst()
  1993. this.get_table_data()
  1994. } else {
  1995. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  1996. this.get_table_dataEasStatusLst()
  1997. this.get_table_data()
  1998. }
  1999. })
  2000. }).catch(() => {
  2001. this.$message({ type: 'info', message: '已取消忽略同步' })
  2002. })
  2003. }
  2004. }
  2005. }
  2006. </script>
  2007. <style lang="scss">
  2008. .typeSelect span .el-popover__reference .el-input--suffix {
  2009. top:-3px;
  2010. .el-input__inner{
  2011. height:40px !important;
  2012. }
  2013. }
  2014. .pasture-title{
  2015. height: 50px;
  2016. b{
  2017. line-height: 50px;
  2018. margin: 0 20px;
  2019. }
  2020. }
  2021. .el-step__head.is-success {
  2022. color: #409EFF;
  2023. border-color: #409EFF;
  2024. }
  2025. .el-step__title.is-success{
  2026. color: #409EFF;
  2027. }
  2028. .el-step__head.is-process{
  2029. color: #409EFF;
  2030. border-color: #409EFF;
  2031. .el-step__icon.is-text{
  2032. background: #409EFF;
  2033. color: #fff;
  2034. }
  2035. }
  2036. .step-row{
  2037. color: #000;
  2038. }
  2039. .hide .el-upload--picture-card {
  2040. display: none;
  2041. }
  2042. </style>