index.vue 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546
  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. <div class="filter-container">
  8. <el-select v-model="getdataListParm.parammaps.pastureName" style="width: 140px;" placeholder="牧场" class="filter-item" @change="changePastureName">
  9. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
  10. </el-select>
  11. <el-input v-model="getdataListParm.parammaps.orderNumber" placeholder="申购单号" style="width: 200px;" class="filter-item" />
  12. <el-select v-model="getdataListParm.parammaps.stuteSH" style="width: 140px;" clearable placeholder="审核状态" class="filter-item">
  13. <el-option v-for="item in statues" :key="item.id" :label="item.name" :value="item.id" />
  14. </el-select>
  15. <el-select v-model="getdataListParm.parammaps.departmentId" clearable style="width: 140px;" placeholder="申购部门" class="filter-item">
  16. <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.id" />
  17. </el-select>
  18. <el-select v-model="getdataListParm.parammaps.purchase_type" clearable style="width: 140px;" placeholder="申购状态" class="filter-item">
  19. <el-option v-for="item in subscriptionStatusList" :key="item.id" :label="item.name" :value="item.id" />
  20. </el-select>
  21. <el-input v-model="getdataListParm.parammaps.empName" placeholder="申购人" style="width: 200px;" class="filter-item" />
  22. <!-- <el-select v-model="getdataListParm.parammaps.empName " style="width: 140px;" placeholder="申购人" class="filter-item">
  23. <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
  24. </el-select> -->
  25. <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
  26. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
  27. <div>
  28. <el-button v-if="isSubscribeAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="apply_subscribe">新增</el-button>
  29. <el-button v-if="isSubscribeSpecial" class="filter-item" type="primary" icon="el-icon-edit" @click="handle_specialSubscription">特殊申购</el-button>
  30. <el-button v-if="isSubscribeExport" v-waves class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
  31. <el-radio-group v-model="radioAll" style="margin-top:-9px" @change="changeAll()">
  32. <el-radio-button label="全部" />
  33. <el-badge :value="pending.total" class="item">
  34. <el-radio-button label="待处理" />
  35. </el-badge>
  36. <el-radio-button label="已处理" />
  37. </el-radio-group>
  38. </div>
  39. </div>
  40. <div class="filter-button" />
  41. <el-table
  42. :key="tableKey"
  43. v-loading="listLoading"
  44. element-loading-text="给我一点时间"
  45. :data="list"
  46. border
  47. fit
  48. highlight-current-row
  49. style="width: 100%;"
  50. :row-style="rowStyle"
  51. :cell-style="cellStyle"
  52. class="elTable"
  53. :max-height="myHeight"
  54. >
  55. <el-table-column label="序号" align="center" type="index" width="50px">
  56. <template slot-scope="scope">
  57. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="申购单号" min-width="150px" align="center">
  61. <template slot-scope="scope">
  62. <span>{{ scope.row.orderNumber }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="牧场" min-width="90px" align="center">
  66. <template slot-scope="scope">
  67. <span>{{ scope.row.pastureName }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="申购部门" min-width="80px" align="center">
  71. <template slot-scope="scope">
  72. <span>{{ scope.row.departmentName }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="申购人" min-width="80px" align="center">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.empname }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="申购日期" sortable prop="inputTime" min-width="80px" align="center" />
  81. <el-table-column label="申购状态" min-width="80px" align="center">
  82. <template slot-scope="scope">
  83. <!-- <span v-if="scope.row.purchase_type == 1">暂估</span> -->
  84. <span v-if="scope.row.purchase_type == 3">赠品</span>
  85. <span v-else>正常</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="审核状态" min-width="80px" align="center" :formatter="statue" />
  89. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  90. <template slot-scope="{row}">
  91. <el-button v-if="isSubscribeSee" type="primary" size="mini" @click="form_see(row)">查看</el-button>
  92. <el-button v-if="row.statue == 4||row.statue == 6||row.statue == 8||row.statue == 10||row.statue == 12 ||row.statue == 14" style="display:inline-block" type="success" size="mini" @click="form_edit(row)">编辑</el-button>
  93. <el-button v-else style="display:none" type="success" size="mini" @click="form_edit(row)">编辑</el-button>
  94. <!-- 库管 -->
  95. <el-button v-if="isSubscribeExamineKG && row.statue == 2" style="display:inline-block" type="success" size="mini" @click="handleExamine1(row)">审核1</el-button>
  96. <!-- 设备 -->
  97. <el-button v-if="isSubscribeExamineSBZG && row.statue == 3" style="display:inline-block" type="success" size="mini" @click="handleExamine2(row)">审核2</el-button>
  98. <!-- 供应商主管 -->
  99. <el-button v-if="isSubscribeExamineZG && row.statue == 9" style="display:inline-block" type="success" size="mini" @click="handleExamine3(row)">审核3</el-button>
  100. <!-- 场长 -->
  101. <el-button v-if="sdchangzhangshenhe && (row.purchase_type < 0 || row.purchase_type == 0) && row.statue == 5" style="display:inline-block" type="success" size="mini" @click="handleExamine4(row)">审核4</el-button>
  102. <el-button v-if="sdchangzhangshenhe && row.purchase_type > 0 && row.statue == 13" style="display:inline-block" type="success" size="mini" @click="handleExamine4(row)">审核4</el-button>
  103. <!-- 采购 -->
  104. <el-button v-if="isSubscribeExamineCG && row.statue == 11 " style="display:inline-block" type="success" size="mini" @click="handleExamine5(row)">审核5</el-button>
  105. <!-- 财务 -->
  106. <el-button v-if="isSubscribeExamineCW && row.purchase_type > 0 && row.statue == 5 " style="display:inline-block" type="success" size="mini" @click="handleExamine6(row)">审核6</el-button>
  107. <el-button v-if="isSubscribeDelete && (row.statue == 4||row.statue == 6||row.statue == 8||row.statue == 12)" style="display:inline-block" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
  108. <el-button v-else style="display:none" type="danger" size="mini" @click="form_delete(row)">删除</el-button>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
  113. <!-- 弹出层新增or修改 -->
  114. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="90%">
  115. <div class="app-container">
  116. <el-form
  117. ref="createTemp"
  118. :rules="rules"
  119. :model="createTemp"
  120. label-position="right"
  121. label-width="100px"
  122. style="width: 90%;margin:0 auto;"
  123. >
  124. <el-row>
  125. <el-col :span="8">
  126. <el-form-item label="申购单号:" prop="orderNumber">
  127. <el-input ref="orderNumber" v-model="createTemp.orderNumber" disabled />
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="8">
  131. <el-form-item label="牧场:" prop="pastureId">
  132. <el-select v-model="createTemp.pastureId" placeholder="牧场" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'" @change="changePasture">
  133. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
  134. </el-select>
  135. </el-form-item>
  136. </el-col>
  137. <el-col :span="8">
  138. <el-form-item label="申购部门:" prop="departmentId">
  139. <el-select v-model="createTemp.departmentId" placeholder="申购部门" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'" @change="changeDepart">
  140. <el-option v-for="item in createDepartList" :key="item.id" :label="item.name" :value="item.id" />
  141. </el-select>
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. <el-row>
  146. <el-col :span="8">
  147. <el-form-item label="申购人:" prop="employeId">
  148. <el-select v-model="createTemp.employeId" placeholder="申购人" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'">
  149. <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
  150. </el-select>
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="8">
  154. <el-form-item label="申购日期:" prop="createTime">
  155. <el-date-picker v-model="createTemp.createTime" :picker-options="pickerOptions" type="date" placeholder="申购日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" :disabled="dialogStatus==='update'" />
  156. </el-form-item>
  157. </el-col>
  158. <el-col v-if="dialogStatus==='create'" :span="8">
  159. <el-form-item label="线上采购:" prop="providerId">
  160. <el-select v-model="createTemp.providerId" placeholder="线上采购" clearable class="filter-item" style="width:100%" @change="changeProvider">
  161. <el-option v-for="item in onlineSubscriptionList" :key="item.id" :label="item.providerName" :value="item.id" />
  162. </el-select>
  163. </el-form-item>
  164. </el-col>
  165. <el-col v-if="dialogStatus==='update'" :span="8">
  166. <el-form-item label="线上采购:" prop="providerName">
  167. <el-input ref="providerName" v-model="createTemp.providerName" disabled />
  168. </el-form-item>
  169. </el-col>
  170. </el-row>
  171. <el-row>
  172. <el-col :span="16">
  173. <el-form-item label="备件:" prop="partCode">
  174. <el-autocomplete
  175. v-model="createTemp.partCode"
  176. value-key="name"
  177. class="inline-input"
  178. :fetch-suggestions="sparePartSearch"
  179. placeholder="请输入备件编号或备件名称或备件规格"
  180. style="width:100%"
  181. ref="autocomplete"
  182. @select="handleSelectSparePart"
  183. >
  184. <template slot-scope="{ item }">
  185. <b>备件编号:</b><div class="name" style="display: inline;">{{ item.partCode }}</div>&nbsp;
  186. | &nbsp;<b>备件名称:</b><span class="addr">{{ item.partName }}</span>&nbsp;
  187. | &nbsp;<b>备件规格:</b><span class="addr">{{ item.specification }}</span>
  188. </template>
  189. </el-autocomplete>
  190. </el-form-item>
  191. </el-col>
  192. </el-row>
  193. </el-form>
  194. <el-table
  195. :key="tableKey"
  196. v-loading="listLoading"
  197. element-loading-text="给我一点时间"
  198. :data="listAdd"
  199. border
  200. fit
  201. highlight-current-row
  202. style="width: 100%;margin-bottom:30px"
  203. :row-style="rowStyle"
  204. :cell-style="cellStyle"
  205. class="elTable"
  206. >
  207. <!-- table表格 -->
  208. <el-table-column label="序号" align="center" type="index" width="50px" />
  209. <el-table-column label="备件编号" prop="partCode" align="center" min-width="90">
  210. <template slot-scope="scope">
  211. <span>{{ scope.row.partCode }}</span>
  212. </template>
  213. </el-table-column>
  214. <el-table-column label="备件名称" prop="partName" align="center" min-width="90">
  215. <template slot-scope="scope">
  216. <span>{{ scope.row.partName }}</span>
  217. </template>
  218. </el-table-column>
  219. <el-table-column label="备件规格" prop="specification" min-width="80px" align="center">
  220. <template slot-scope="scope">
  221. <span>{{ scope.row.specification }}</span>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="备件图片" prop="picpath" min-width="110px" align="center">
  225. <template slot-scope="scope">
  226. <el-popover placement="right" title="" trigger="hover">
  227. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  228. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  229. </el-popover>
  230. </template>
  231. </el-table-column>
  232. <el-table-column label="备件品牌" prop="brand" align="center" min-width="60">
  233. <template slot-scope="scope">
  234. <span v-if="dialogStatus==='create'">{{ scope.row.brandName }}</span>
  235. <span v-if="dialogStatus==='update'">{{ scope.row.brandName }}</span>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="计量单位" prop="unit" align="center" min-width="60">
  239. <template slot-scope="scope">
  240. <span>{{ scope.row.unit }}</span>
  241. </template>
  242. </el-table-column>
  243. <el-table-column label="现有库存" prop="reportery" align="center" min-width="60">
  244. <template slot-scope="scope">
  245. <span v-if="createTemp.providerId == '' || parseFloat(createTemp.purchaseType) > 0">{{ scope.row.reportery }}</span>
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="价格" prop="price" align="center" min-width="60">
  249. <template slot-scope="scope">
  250. <span v-if="createTemp.providerId == ''">{{ scope.row.price }}</span>
  251. <el-form v-else :model="scope.row" :rules="rules">
  252. <el-form-item prop="price">
  253. <el-input v-model="scope.row.price" style="margin-top:15px" />
  254. </el-form-item>
  255. </el-form>
  256. </template>
  257. </el-table-column>
  258. <el-table-column label="申购数量" min-width="120px" align="center" valign="middle">
  259. <template slot-scope="scope">
  260. <el-form :model="scope.row" :rules="rules">
  261. <el-form-item prop="amount">
  262. <el-input v-model="scope.row.amount" style="margin-top:15px" />
  263. </el-form-item>
  264. </el-form>
  265. </template>
  266. </el-table-column>
  267. <el-table-column label="备注" min-width="110px" align="center" valign="middle">
  268. <template slot-scope="scope">
  269. <el-input v-model="scope.row.purpose" />
  270. </template>
  271. </el-table-column>
  272. <!-- <el-table-column label="使用周期" min-width="120px" align="center" prop="lifeCycle" />
  273. <el-table-column label="合同差异项" min-width="120px" align="center" prop="contractVarianceItem" /> -->
  274. <el-table-column
  275. label="操作"
  276. align="center"
  277. width="100"
  278. class-name="small-padding fixed-width"
  279. fixed="right"
  280. >
  281. <template slot-scope="{row}">
  282. <a class="del" @click="partDelete(row)">删除</a>
  283. </template>
  284. </el-table-column>
  285. </el-table>
  286. <div slot="footer" class="dialog-footer" style="bottom:10px">
  287. <el-button type="primary" :disabled="isokDisable" v-if="dialogStatus==='create'" @click="add_dialog_save()">保存并关闭</el-button>
  288. <el-button type="primary" :disabled="isokDisable" v-else-if="dialogStatus==='update'" @click="edit_dialog_save()">保存并关闭</el-button>
  289. <el-button @click="dialogFormVisible = false;get_table_data()">取消并关闭</el-button>
  290. </div>
  291. </div>
  292. </el-dialog>
  293. <!-- 特殊申购 -->
  294. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible2" :close-on-click-modal="false" width="90%">
  295. <div class="app-container">
  296. <el-form
  297. ref="createTemp"
  298. :rules="rules"
  299. :model="createTemp"
  300. label-position="right"
  301. label-width="100px"
  302. style="width: 90%;margin:0 auto;"
  303. >
  304. <el-row>
  305. <el-col :span="8">
  306. <el-form-item label="申购单号:" prop="orderNumber">
  307. <el-input ref="orderNumber" v-model="createTemp.orderNumber" disabled />
  308. </el-form-item>
  309. </el-col>
  310. <el-col :span="8">
  311. <el-form-item label="牧场:" prop="pastureId">
  312. <el-select v-model="createTemp.pastureId" placeholder="牧场" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'" @change="changePasture">
  313. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
  314. </el-select>
  315. </el-form-item>
  316. </el-col>
  317. <el-col :span="8">
  318. <el-form-item label="申购部门:" prop="departmentId">
  319. <el-select v-model="createTemp.departmentId" placeholder="申购部门" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'" @change="changeDepart">
  320. <el-option v-for="item in createDepartList" :key="item.id" :label="item.name" :value="item.id" />
  321. </el-select>
  322. </el-form-item>
  323. </el-col>
  324. </el-row>
  325. <el-row>
  326. <el-col :span="8">
  327. <el-form-item label="申购人:" prop="employeId">
  328. <el-select v-model="createTemp.employeId" placeholder="申购人" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'">
  329. <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
  330. </el-select>
  331. </el-form-item>
  332. </el-col>
  333. <el-col :span="8">
  334. <el-form-item label="申购日期:" prop="createTime">
  335. <el-date-picker v-model="createTemp.createTime" :picker-options="pickerOptions" type="date" placeholder="申购日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" :disabled="dialogStatus==='update'" />
  336. </el-form-item>
  337. </el-col>
  338. <el-col v-if="dialogStatus==='update'" :span="8">
  339. <el-form-item label="线上采购:" prop="providerName">
  340. <el-input ref="providerName" v-model="createTemp.providerName" disabled />
  341. </el-form-item>
  342. </el-col>
  343. <el-col v-if="dialogStatus==='special' && createTemp.purchaseType == '1' || createTemp.purchaseType == '3'" :span="8">
  344. <el-form-item label="供应商:" prop="providerId">
  345. <el-select v-model="createTemp.providerId" placeholder="供应商" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'">
  346. <el-option v-for="item in providerList" :key="item.id" :label="item.providerName" :value="item.id" />
  347. </el-select>
  348. </el-form-item>
  349. </el-col>
  350. <el-col v-if="dialogStatus==='special' && createTemp.purchaseType == '2'" :span="8">
  351. <el-form-item label="供应商:" prop="providerId">
  352. <el-input ref="providerName" v-model="createTemp.providerName" />
  353. <!-- <el-select v-model="createTemp.providerId" placeholder="供应商" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'">
  354. <el-option v-for="item in providerList" :key="item.id" :label="item.providerName" :value="item.id" />
  355. </el-select> -->
  356. </el-form-item>
  357. </el-col>
  358. <el-col :span="8" v-if="dialogStatus==='special' && createTemp.purchaseType == '2'">
  359. <el-form-item label="垫付人:" prop="funderId">
  360. <el-select v-model="createTemp.funderId" filterable placeholder="垫付人" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'">
  361. <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
  362. </el-select>
  363. </el-form-item>
  364. </el-col>
  365. </el-row>
  366. <el-row v-if="dialogStatus==='special'">
  367. <el-col :span="24">
  368. <el-form-item label="申购类型:" prop="purchaseType">
  369. <!-- <el-radio v-model="createTemp.purchaseType" label="1" @change="changeType()">暂估</el-radio> -->
  370. <!-- <el-radio v-model="createTemp.purchaseType" label="2" @change="changeType()">垫付</el-radio> -->
  371. <el-radio v-model="createTemp.purchaseType" label="3" @change="changeType()">赠品</el-radio>
  372. </el-form-item>
  373. </el-col>
  374. </el-row>
  375. <el-row>
  376. <el-col :span="16">
  377. <el-form-item label="备件:" prop="partCode">
  378. <el-autocomplete
  379. v-model="createTemp.partCode"
  380. value-key="name"
  381. class="inline-input"
  382. :fetch-suggestions="sparePartSearch"
  383. placeholder="请输入备件编号或备件名称或备件规格"
  384. style="width:100%"
  385. ref="autocomplete"
  386. @select="handleSelectSparePart"
  387. >
  388. <template slot-scope="{ item }">
  389. <b>备件编号:</b><div class="name" style="display: inline;">{{ item.partCode }}</div>&nbsp;
  390. | &nbsp;<b>备件名称:</b><span class="addr">{{ item.partName }}</span>&nbsp;
  391. | &nbsp;<b>备件规格:</b><span class="addr">{{ item.specification }}</span>
  392. </template>
  393. </el-autocomplete>
  394. </el-form-item>
  395. </el-col>
  396. </el-row>
  397. </el-form>
  398. <el-table
  399. :key="tableKey"
  400. v-loading="listLoading"
  401. element-loading-text="给我一点时间"
  402. :data="listAdd"
  403. border
  404. fit
  405. highlight-current-row
  406. style="width: 100%;margin-bottom:30px"
  407. :row-style="rowStyle"
  408. :cell-style="cellStyle"
  409. class="elTable"
  410. >
  411. <!-- table表格 -->
  412. <el-table-column label="序号" align="center" type="index" width="50px" />
  413. <el-table-column label="备件编号" prop="partCode" align="center" min-width="90">
  414. <template slot-scope="scope">
  415. <span>{{ scope.row.partCode }}</span>
  416. </template>
  417. </el-table-column>
  418. <el-table-column label="备件名称" prop="partName" align="center" min-width="90">
  419. <template slot-scope="scope">
  420. <span>{{ scope.row.partName }}</span>
  421. </template>
  422. </el-table-column>
  423. <el-table-column label="备件规格" prop="specification" min-width="80px" align="center">
  424. <template slot-scope="scope">
  425. <span>{{ scope.row.specification }}</span>
  426. </template>
  427. </el-table-column>
  428. <el-table-column label="备件图片" prop="picpath" min-width="110px" align="center">
  429. <template slot-scope="scope">
  430. <el-popover placement="right" title="" trigger="hover">
  431. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  432. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  433. </el-popover>
  434. </template>
  435. </el-table-column>
  436. <el-table-column label="备件品牌" prop="brand" align="center" min-width="60">
  437. <template slot-scope="scope">
  438. <span v-if="dialogStatus==='create'">{{ scope.row.brandName }}</span>
  439. <span v-if="dialogStatus==='update'">{{ scope.row.brandName }}</span>
  440. <span v-if="dialogStatus==='special'">{{ scope.row.brandName }}</span>
  441. </template>
  442. </el-table-column>
  443. <el-table-column label="计量单位" prop="unit" align="center" min-width="60">
  444. <template slot-scope="scope">
  445. <span>{{ scope.row.unit }}</span>
  446. </template>
  447. </el-table-column>
  448. <el-table-column label="现有库存" prop="reportery" align="center" min-width="60">
  449. <template slot-scope="scope">
  450. <span v-if="createTemp.providerId == '' || parseFloat(createTemp.purchaseType) > 0">{{ scope.row.reportery }}</span>
  451. </template>
  452. </el-table-column>
  453. <el-table-column v-if="dialogStatus==='special'" label="价格" prop="price" align="center" min-width="60">
  454. <template slot-scope="scope">
  455. <span v-if="createTemp.purchaseType == '1'">{{ scope.row.price }}</span>
  456. <el-form v-else :model="scope.row" :rules="rules">
  457. <el-form-item prop="price">
  458. <el-input v-model="scope.row.price" style="margin-top:15px" />
  459. </el-form-item>
  460. </el-form>
  461. </template>
  462. </el-table-column>
  463. <el-table-column v-else label="价格" prop="price" align="center" min-width="60">
  464. <template slot-scope="scope">
  465. <span v-if="createTemp.providerId == ''">{{ scope.row.price }}</span>
  466. <el-form v-else :model="scope.row" :rules="rules">
  467. <el-form-item prop="price">
  468. <el-input v-model="scope.row.price" style="margin-top:15px" />
  469. </el-form-item>
  470. </el-form>
  471. </template>
  472. </el-table-column>
  473. <el-table-column label="申购数量" min-width="120px" align="center" valign="middle">
  474. <template slot-scope="scope">
  475. <el-form :model="scope.row" :rules="rules">
  476. <el-form-item prop="amount">
  477. <el-input v-model="scope.row.amount" style="margin-top:15px" />
  478. </el-form-item>
  479. </el-form>
  480. </template>
  481. </el-table-column>
  482. <el-table-column label="备注" min-width="110px" align="center" valign="middle">
  483. <template slot-scope="scope">
  484. <el-input v-model="scope.row.purpose" />
  485. </template>
  486. </el-table-column>
  487. <!-- <el-table-column label="使用周期" min-width="120px" align="center" prop="lifeCycle" />
  488. <el-table-column label="合同差异项" min-width="120px" align="center" prop="contractVarianceItem" /> -->
  489. <el-table-column
  490. label="操作"
  491. align="center"
  492. width="100"
  493. class-name="small-padding fixed-width"
  494. fixed="right"
  495. >
  496. <template slot-scope="{row}">
  497. <a class="del" @click="partDelete(row)">删除</a>
  498. </template>
  499. </el-table-column>
  500. </el-table>
  501. <div slot="footer" class="dialog-footer" style="bottom:10px">
  502. <el-button type="primary" :disabled="isokDisable" v-if="dialogStatus==='special'" @click="special_dialog_save()">保存并关闭</el-button>
  503. <el-button @click="dialogFormVisible2 = false;get_table_data()">取消并关闭</el-button>
  504. </div>
  505. </div>
  506. </el-dialog>
  507. <!-- 查看 -->
  508. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleSee" :close-on-click-modal="false" width="90%">
  509. <div class="app-containerSee">
  510. <el-form
  511. ref="seeTemp"
  512. :rules="rules"
  513. :model="seeTemp"
  514. label-position="right"
  515. label-width="100px"
  516. style="width: 90%;margin:0 auto;"
  517. >
  518. <el-row>
  519. <el-col :span="8">
  520. <el-form-item label="申购单号:" prop="orderNumber">
  521. <el-input ref="orderNumber" v-model="seeTemp.orderNumber" disabled />
  522. </el-form-item>
  523. </el-col>
  524. <el-col :span="8">
  525. <el-form-item label="牧场:" prop="pastureId">
  526. <el-select v-model="seeTemp.pastureId" placeholder="牧场" class="filter-item" disabled style="width:100%">
  527. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.id" />
  528. </el-select>
  529. </el-form-item>
  530. </el-col>
  531. <el-col :span="8">
  532. <el-form-item label="申购部门:" prop="departmentName">
  533. <el-input ref="departmentName" v-model="seeTemp.departmentName" disabled />
  534. </el-form-item>
  535. </el-col>
  536. </el-row>
  537. <el-row>
  538. <el-col :span="8">
  539. <el-form-item label="申购人:" prop="empname">
  540. <el-input ref="empname" v-model="seeTemp.empname" disabled />
  541. </el-form-item>
  542. </el-col>
  543. <el-col :span="8">
  544. <el-form-item label="申购日期:" prop="inputTime">
  545. <el-date-picker v-model="seeTemp.inputTime" :picker-options="pickerOptions" type="date" placeholder="申购日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%" disabled />
  546. </el-form-item>
  547. </el-col>
  548. <el-col :span="8" v-if="seeTemp.purchaseType == '2'">
  549. <el-form-item label="供应商:" prop="funderProviderName ">
  550. <el-input ref="funderProviderName " v-model="seeTemp.funderProviderName " disabled />
  551. </el-form-item>
  552. </el-col>
  553. <el-col :span="8" v-if="seeTemp.purchase_type > 0 && seeTemp.purchaseType !== '2'">
  554. <el-form-item label="供应商:" prop="providerName">
  555. <el-input ref="providerName" v-model="seeTemp.providerName" disabled />
  556. </el-form-item>
  557. </el-col>
  558. <el-col :span="8" v-if="seeTemp.purchaseType == '2'">
  559. <el-form-item label="垫付人:" prop="funder_name">
  560. <el-input ref="funder_name" v-model="seeTemp.funder_name" disabled />
  561. </el-form-item>
  562. </el-col>
  563. <el-col :span="8" v-if="seeTemp.purchase_type < 1">
  564. <el-form-item label="线上采购:" prop="providerName">
  565. <el-input ref="providerName" v-model="seeTemp.providerName" disabled />
  566. </el-form-item>
  567. </el-col>
  568. </el-row>
  569. <el-row v-if="seeTemp.purchase_type > 0">
  570. <el-col :span="24">
  571. <el-form-item label="申购类型:" prop="purchaseType">
  572. <!-- <el-radio v-model="seeTemp.purchaseType" disabled label="1">暂估</el-radio> -->
  573. <!-- <el-radio v-model="seeTemp.purchaseType" disabled label="2">垫付</el-radio> -->
  574. <el-radio v-model="seeTemp.purchaseType" disabled label="3">赠品</el-radio>
  575. </el-form-item>
  576. </el-col>
  577. </el-row>
  578. </el-form>
  579. <el-table
  580. :key="tableKey"
  581. v-loading="listLoadingSee"
  582. element-loading-text="给我一点时间"
  583. :data="listSee"
  584. border
  585. fit
  586. highlight-current-row
  587. style="width: 100%;margin-bottom:30px"
  588. :row-style="rowStyle"
  589. :cell-style="cellStyle"
  590. class="elTable"
  591. @sort-change="tableSort"
  592. >
  593. <el-table-column type="index" label="序号" align="center" width="50px" />
  594. <el-table-column label="备件编号" prop="partCode" align="center" min-width="90">
  595. <template slot-scope="scope">
  596. <span>{{ scope.row.partCode }}</span>
  597. </template>
  598. </el-table-column>
  599. <el-table-column label="备件名称" prop="partName" align="center" min-width="90">
  600. <template slot-scope="scope">
  601. <span>{{ scope.row.partName }}</span>
  602. </template>
  603. </el-table-column>
  604. <el-table-column label="备件规格" prop="specification" min-width="90px" align="center">
  605. <template slot-scope="scope">
  606. <span>{{ scope.row.specification }}</span>
  607. </template>
  608. </el-table-column>
  609. <el-table-column label="备件图片" prop="picpath" min-width="110px" align="center">
  610. <template slot-scope="scope">
  611. <el-popover placement="right" title="" trigger="hover">
  612. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  613. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  614. </el-popover>
  615. </template>
  616. </el-table-column>
  617. <el-table-column label="备件品牌" prop="brandName" align="center" min-width="60">
  618. <template slot-scope="scope">
  619. <span>{{ scope.row.brandName }}</span>
  620. </template>
  621. </el-table-column>
  622. <el-table-column label="计量单位" prop="unit" align="center" min-width="60">
  623. <template slot-scope="scope">
  624. <span>{{ scope.row.unit }}</span>
  625. </template>
  626. </el-table-column>
  627. <el-table-column label="现有库存" sortable prop="storageAmount" align="center" min-width="60" />
  628. <el-table-column label="价格" sortable prop="price" align="center" min-width="60" />
  629. <el-table-column label="申购数量" sortable prop="amount" align="center" min-width="60" />
  630. <!-- <el-table-column label="使用周期" min-width="120px" align="center" prop="lifeCycle" />
  631. <el-table-column label="合同差异项" min-width="120px" align="center" prop="contractVarianceItem" /> -->
  632. <el-table-column label="备注" min-width="110px" align="center" prop="purpose" />
  633. </el-table>
  634. <el-form
  635. ref="seeTemp"
  636. :rules="rules"
  637. :model="seeTemp"
  638. label-position="right"
  639. label-width="100px"
  640. style="width: 90%;margin:0 auto;"
  641. >
  642. <el-row>
  643. <el-col>
  644. <el-form-item label="流程进度" />
  645. <el-steps :active="active" align-center finish-status="success">
  646. <el-step
  647. v-for="(item,index) in activeList"
  648. :key="index"
  649. :title="item.title"
  650. :status="item.status"
  651. >
  652. <template slot="description">
  653. <div class="step-row">
  654. <div>{{ item.name }}&nbsp;&nbsp;{{ item.date }}</div>
  655. <div>{{ item.reason }}</div>
  656. </div>
  657. </template>
  658. </el-step>
  659. </el-steps>
  660. </el-col>
  661. </el-row>
  662. <el-row>
  663. <el-col>
  664. <el-form-item label="操作:">
  665. <!-- 库管 -->
  666. <el-button v-if="isSubscribeExamineKG && seeTemp.statue == 2" type="success" style="display:inline-block" @click="handleExamine1(row)">审核1</el-button>
  667. <!-- 设备 -->
  668. <el-button v-if="isSubscribeExamineSBZG && seeTemp.statue == 3" type="success" style="display:inline-block" @click="handleExamine2(row)">审核2</el-button>
  669. <!-- 供应商主管 -->
  670. <el-button v-if="isSubscribeExamineZG && seeTemp.statue == 9" type="success" style="display:inline-block" @click="handleExamine3(row)">审核3</el-button>
  671. <!-- 场长 -->
  672. <el-button v-if=" sdchangzhangshenhe && (seeTemp.purchase_type < 0 || seeTemp.purchase_type == 0) && seeTemp.statue == 5" type="success" style="display:inline-block" @click="handleExamine4(row)">审核4</el-button>
  673. <el-button v-if=" sdchangzhangshenhe && seeTemp.statue == 13" type="success" style="display:inline-block" @click="handleExamine4(row)">审核4</el-button>
  674. <!-- 采购 -->
  675. <el-button v-if="isSubscribeExamineCG && seeTemp.statue == 11 " type="success" style="display:inline-block" @click="handleExamine5(row)">审核5</el-button>
  676. <el-button v-if="isSubscribeExamineCW && seeTemp.purchase_type > 0 && seeTemp.statue == 5 " style="display:inline-block" type="success" size="mini" @click="handleExamine6(row)">审核6</el-button>
  677. </el-form-item>
  678. </el-col>
  679. </el-row>
  680. </el-form>
  681. <div slot="footer" class="dialog-footer" style="bottom:5px;">
  682. <el-button @click="dialogFormVisibleSee = false">关闭</el-button>
  683. </div>
  684. </div>
  685. </el-dialog>
  686. <!-- 审核 -->
  687. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_Examine" :close-on-click-modal="false" width="30%">
  688. <div class="app-examine">
  689. <h3 style="width: 100%;margin:0 0 0 5%;line-height:50px;">请确认审核结果:</h3>
  690. <el-form ref="examineTemp" :rules="rules" :model="examineTemp" label-position="right" style="width: 50%;margin:0 auto;">
  691. <el-row style="width:88%;height:150px;margin:0 auto;">
  692. <el-col :span="20">
  693. <el-form-item>
  694. <el-radio-group v-model="examineTemp.statue" @change="changeStatue">
  695. <el-radio :label="1" checked>通过</el-radio>
  696. <el-radio :label="2">不通过</el-radio>
  697. </el-radio-group>
  698. </el-form-item>
  699. </el-col>
  700. <el-col v-if="statueReason" :span="20">
  701. <el-input v-model="examineTemp.workflowNote" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入不通过原因" />
  702. </el-col>
  703. </el-row>
  704. </el-form>
  705. </div>
  706. <div slot="footer" class="dialog-footer">
  707. <el-button v-if="dialogStatus==='examine1'" type="primary" :disabled="isokDisable" @click="createExamineData1()">确认</el-button>
  708. <el-button v-if="dialogStatus==='examine2'" type="primary" :disabled="isokDisable" @click="createExamineData2()">确认</el-button>
  709. <el-button v-if="dialogStatus==='examine3'" type="primary" :disabled="isokDisable" @click="createExamineData3()">确认</el-button>
  710. <el-button v-if="dialogStatus==='examine4'" type="primary" :disabled="isokDisable" @click="createExamineData4()">确认</el-button>
  711. <el-button v-if="dialogStatus==='examine5'" type="primary" :disabled="isokDisable" @click="createExamineData5()">确认</el-button>
  712. <el-button v-if="dialogStatus==='examine6'" type="primary" :disabled="isokDisable" @click="createExamineData6()">确认</el-button>
  713. <el-button @click="dialogFormVisible_Examine = false;">关闭</el-button>
  714. </div>
  715. </el-dialog>
  716. <!-- 查看备件 -->
  717. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible_seepart" :close-on-click-modal="false" width="90%">
  718. <div>
  719. <el-input v-model="seepart.getdataListParm.parammaps.partName" placeholder="备件" style="width: 200px;" class="filter-item" />
  720. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="seepart_search">搜索</el-button>
  721. <h3 v-if="seepartList.length == 0" style="text-align: center;height: 300px;line-height:300px;">呆滞库存查询(如可调拨使用,请优先消耗)</h3>
  722. <div v-else>
  723. <el-table
  724. :key="seepart.tableKey"
  725. v-loading="seepart.listLoading"
  726. element-loading-text="给我一点时间"
  727. :data="seepartList"
  728. border
  729. fit
  730. highlight-current-row
  731. style="width: 100%;margin-bottom:30px;margin-top:20px;"
  732. :row-style="rowStyle"
  733. :cell-style="cellStyle"
  734. class="elTable"
  735. height="300"
  736. >
  737. <el-table-column label="序号" align="center" type="index" width="50px" />
  738. <el-table-column label="牧场名称" prop="pastureName" align="center" min-width="90" />
  739. <el-table-column label="备件编号" prop="partCode" align="center" min-width="90" />
  740. <el-table-column label="备件名称" prop="partName" align="center" min-width="90" />
  741. <el-table-column label="备件规格" prop="specification" align="center" min-width="90" />
  742. <el-table-column label="备件图片" prop="picpath" align="center" min-width="90">
  743. <template slot-scope="scope">
  744. <el-popover placement="right" title="" trigger="hover">
  745. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  746. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  747. </el-popover>
  748. </template>
  749. </el-table-column>
  750. <el-table-column label="备件品牌" prop="brand" align="center" min-width="90" />
  751. <el-table-column label="计量单位" prop="unit" align="center" min-width="90" />
  752. <el-table-column label="现有库存" sortable prop="reportery" align="center" min-width="60" />
  753. <el-table-column label="价格" sortable prop="price" align="center" min-width="60" />
  754. <el-table-column label="在库天数" sortable prop="daysInStorage" align="center" min-width="60" />
  755. <el-table-column label="负责人" prop="dutyPersonal" align="center" min-width="90" />
  756. <el-table-column label="联系方式" prop="telphone" align="center" min-width="90" />
  757. </el-table>
  758. <pagination v-show="seepart.total>0" :total="seepart.total" :page.sync="seepart.getdataListParm.offset" :limit.sync="seepart.getdataListParm.pagecount" @pagination="get_seepart_data" />
  759. </div>
  760. </div>
  761. <div slot="footer" class="dialog-footer">
  762. <el-button type="primary" :disabled="isokDisable" @click="form_add()">继续申购</el-button>
  763. <el-button @click="dialogFormVisible_seepart = false;">取消</el-button>
  764. </div>
  765. </el-dialog>
  766. </div>
  767. </template>
  768. <script>
  769. // / 引入
  770. import { GetDataByName,postJson, GetDataByNames, partslistSGv2, PostDataByName, ExecDataByConfig, checkButtons, failproccess, GetAccount } from '@/api/common'
  771. import waves from '@/directive/waves' // waves directive
  772. import { parseTime, sortChange, json2excel } from '@/utils/index.js'
  773. // eslint-disable-next-line no-unused-vars
  774. import { validateEMail } from '@/utils/validate.js'
  775. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  776. import { MessageBox } from 'element-ui'
  777. import Cookies from 'js-cookie'
  778. import { getToken } from '@/utils/auth'
  779. export default {
  780. name: 'Subscribe',
  781. components: { Pagination },
  782. directives: { waves },
  783. data() {
  784. return {
  785. isSubscribeAdd: [],isSubscribeSpecial:[], isSubscribeExamineSBZG:[],isSubscribeTemplate: [], isSubscribeImport: [], isSubscribeExport: [], isSubscribeSee: [], isSubscribeDelete: [], isSubscribeExamineKG: [], isSubscribeExamineCG: [],isSubscribeExamineCW:[], isSubscribeExamineZG: [],sdchangzhangshenhe: [],
  786. isokDisable: false,
  787. findAllProvider: [],
  788. findAllPasture: [],
  789. findAllDepart: [],
  790. findAllEmploye: [],
  791. subscriptionStatusList:[
  792. {id:0,name:'正常'},
  793. // {id:1,name:'暂估'},
  794. {id:3,name:'赠品'}],//申购状态
  795. onlineSubscriptionList: [], createDepartList: [], edit: 0,
  796. requestParams: [
  797. { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
  798. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  799. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  800. { name: 'getflexProviderList', offset: 0, pagecount: 0, parammaps: {}}
  801. ],
  802. getDepartParam: {
  803. name: 'findAllDepart', offset: 0, pagecount: 0,
  804. parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }
  805. },
  806. pickerOptions: {
  807. disabledDate(time) {
  808. return time.getTime() > Date.now()// 当天之前的时间可选
  809. }
  810. },
  811. textMap: {
  812. update: '编辑',
  813. create: '新增',
  814. see: '查看',
  815. examine1: '审核1',
  816. examine2: '审核2',
  817. examine3: '审核3',
  818. examine4: '审核4',
  819. examine5: '审核5',
  820. special: '特殊申购',
  821. seepart:'备件申购'
  822. },
  823. rules: {
  824. equipmentName: [{ required: true, message: '必填', trigger: 'blur' }]
  825. },
  826. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  827. cellStyle: { padding: 0 + 'px' },
  828. statues: [{ id: '0', name: '审核中' }, { id: '1', name: '已通过' }, { id: '2', name: '未通过' }],
  829. radioAll: '全部',
  830. getdataListParm: {
  831. name: 'getpartpurchaseList',
  832. page: 1,
  833. offset: 1,
  834. pagecount: 10,
  835. returntype: 'Map',
  836. parammaps: {
  837. pastureName: Cookies.get('pasturename'),
  838. empId: Cookies.get('employeid'),
  839. orderNumber: '',
  840. stuteSH: '',
  841. departmentId: '',
  842. inputDatetime: '',
  843. startTime: '',
  844. stopTime: '',
  845. loginId: Cookies.get('employeid'),
  846. menu: 'Subscribe',
  847. logindeptId: Cookies.get('departmentid'),
  848. loginpastureId: Cookies.get('pastureid'),
  849. purchase_type:''
  850. }
  851. },
  852. tableKey: 0,
  853. listLoading: true,
  854. total: 0,
  855. list: [],
  856. dialogStatus: '',
  857. dialogFormVisible: false,
  858. dialogFormVisible2: false,
  859. dialogFormVisibleSee: false,
  860. listLoadingSee: true,
  861. listSee: [],
  862. totalSee: 0,
  863. seeTemp: {},
  864. getdataListSee: {
  865. name: 'getpartpurchaseBybig',
  866. returntype: 'Map',
  867. parammaps: {}
  868. },
  869. createTemp: {
  870. pastureId: this.$store.state.user.pastureid,
  871. departmentId: this.$store.state.user.departmentid,
  872. employeId: this.$store.state.user.employeid,
  873. createTime: parseTime(new Date(), '{y}-{m}-{d}'),
  874. providerId: '',
  875. purchaseType:'1',
  876. funderId:''
  877. },
  878. requestSparePart: {
  879. name: 'getPartsListSG',
  880. page: 1,
  881. offset: 1,
  882. pagecount: 20,
  883. returntype: 'Map',
  884. parammaps: {
  885. pastureId: Cookies.get('pastureid')
  886. }
  887. },
  888. getParmCreateNumber: {
  889. name: 'autoCreatCode',
  890. page: 0,
  891. offset: 0,
  892. pagecount: 0,
  893. returntype: 'Map',
  894. parammaps: {
  895. pastureId: Cookies.get('pastureid'),
  896. codeType: 'SG'
  897. }
  898. },
  899. getParmCreateAmount: {
  900. name: 'getPartsListSGv2',
  901. page: 0,
  902. offset: 0,
  903. pagecount: 0,
  904. returntype: 'Map',
  905. parammaps: {
  906. pastureId: Cookies.get('pastureid'),
  907. pastureName: Cookies.get('pasturename')
  908. }
  909. },
  910. listAdd: [],
  911. postDataPramas: {},
  912. requestParam: {},
  913. dialogFormVisible_Examine: false,
  914. examineTemp: {
  915. statue: 1
  916. },
  917. statueReason: false,
  918. activeList: [],
  919. active: 3,
  920. buttons: [],
  921. downloadParam: {},
  922. isPercentage: false,
  923. percentage: 1,
  924. pending: {
  925. total: 0,
  926. getdataListParm: {
  927. name: 'getpartpurchaseWebListNO', page: 1, offset: 1, getTotal: 'total3', pagecount: 10, returntype: 'Map',
  928. parammaps: {
  929. loginId: Cookies.get('employeid'),
  930. menu: 'Subscribe', logindeptId: Cookies.get('departmentid'), loginpastureId: Cookies.get('pastureid'),
  931. empId: Cookies.get('employeid'), pastureId: Cookies.get('pastureid'), deptId: Cookies.get('departmentid')
  932. }
  933. }
  934. },
  935. providerList:[],
  936. dialogFormVisible_seepart:false,
  937. seepartList:[],
  938. seepart:{
  939. tableKey: 0,
  940. listLoading: true,
  941. total: 0,
  942. getdataListParm: {
  943. page: 1, offset: 1, pagecount: 10,
  944. name:'getIdleSpareParts',
  945. parammaps:{
  946. partName:''
  947. }
  948. }
  949. },
  950. apply_subscribeData:{},
  951. isApplyEx4:true,
  952. myHeight:document.documentElement.clientHeight - 85- 150
  953. }
  954. },
  955. created() {
  956. const that = this
  957. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  958. that.buttons = response.data.list
  959. that.get_auto_buttons()
  960. })
  961. this.get_select_list()
  962. this.get_table_data()
  963. this.getPendingList()
  964. this.getProviderList()
  965. },
  966. methods: {
  967. tableSort(column) {
  968. sortChange(column, this.listSee)
  969. },
  970. get_auto_buttons() {
  971. // 新增
  972. const SubscribeAdd = 'customs:subscribe:add'
  973. const isSubscribeAdd = checkButtons(this.$store.state.user.buttons, SubscribeAdd)
  974. this.isSubscribeAdd = isSubscribeAdd
  975. // isSubscribeSpecial
  976. // 特殊申购
  977. const SubscribeSpecial = 'customs:subscribe:special'
  978. const isSubscribeSpecial = checkButtons(this.$store.state.user.buttons, SubscribeSpecial)
  979. this.isSubscribeSpecial = isSubscribeSpecial
  980. // 模板
  981. // eslint-disable-next-line no-redeclare
  982. const SubscribeTemplate = 'customs:subscribe:template'
  983. const isSubscribeTemplate = checkButtons(this.$store.state.user.buttons, SubscribeTemplate)
  984. this.isSubscribeTemplate = isSubscribeTemplate
  985. // 导入
  986. // eslint-disable-next-line no-redeclare
  987. const SubscribeImport = 'customs:subscribe:import'
  988. const isSubscribeImport = checkButtons(this.$store.state.user.buttons, SubscribeImport)
  989. this.isSubscribeImport = isSubscribeImport
  990. // 导出
  991. // eslint-disable-next-line no-redeclare
  992. const SubscribeExport = 'customs:subscribe:export'
  993. const isSubscribeExport = checkButtons(this.$store.state.user.buttons, SubscribeExport)
  994. this.isSubscribeExport = isSubscribeExport
  995. // 查看
  996. // eslint-disable-next-line no-redeclare
  997. const SubscribeSee = 'customs:subscribe:see'
  998. const isSubscribeSee = checkButtons(this.$store.state.user.buttons, SubscribeSee)
  999. this.isSubscribeSee = isSubscribeSee
  1000. // 删除
  1001. // eslint-disable-next-line no-redeclare
  1002. const SubscribeDelete = 'customs:subscribe:delete'
  1003. const isSubscribeDelete = checkButtons(this.$store.state.user.buttons, SubscribeDelete)
  1004. this.isSubscribeDelete = isSubscribeDelete
  1005. // 库管审核
  1006. // eslint-disable-next-line no-redeclare
  1007. const SubscribeExamineKG = 'customs:subscribe:examineKG'
  1008. const isSubscribeExamineKG = checkButtons(this.$store.state.user.buttons, SubscribeExamineKG)
  1009. this.isSubscribeExamineKG = isSubscribeExamineKG
  1010. // 设备主管审核
  1011. const SubscribeExamineSBZG = 'customs:subscribe:examineSBZG'
  1012. const isSubscribeExamineSBZG = checkButtons(this.$store.state.user.buttons, SubscribeExamineSBZG)
  1013. this.isSubscribeExamineSBZG = isSubscribeExamineSBZG
  1014. // 主管审核
  1015. // eslint-disable-next-line no-redeclare
  1016. const SubscribeExamineZG = 'customs:subscribe:examineZG'
  1017. const isSubscribeExamineZG = checkButtons(this.$store.state.user.buttons, SubscribeExamineZG)
  1018. this.isSubscribeExamineZG = isSubscribeExamineZG
  1019. const changzhangshenhe = 'changzhangshenhe'
  1020. const sdchangzhangshenhe = checkButtons(this.$store.state.user.buttons, changzhangshenhe)
  1021. this.sdchangzhangshenhe = sdchangzhangshenhe
  1022. // 采购审核
  1023. // eslint-disable-next-line no-redeclare
  1024. const SubscribeExamineCG = 'customs:subscribe:examineCG'
  1025. const isSubscribeExamineCG = checkButtons(this.$store.state.user.buttons, SubscribeExamineCG)
  1026. this.isSubscribeExamineCG = isSubscribeExamineCG
  1027. // 财务审核
  1028. const SubscribeExamineCW = 'customs:subscribe:examineCW'
  1029. const isSubscribeExamineCW = checkButtons(this.$store.state.user.buttons, SubscribeExamineCW)
  1030. this.isSubscribeExamineCW = isSubscribeExamineCW
  1031. },
  1032. getPendingList() {
  1033. this.pending.getdataListParm.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  1034. this.pending.getdataListParm.parammaps.orderNumber = this.getdataListParm.parammaps.orderNumber
  1035. this.pending.getdataListParm.parammaps.stuteSH = this.getdataListParm.parammaps.stuteSH
  1036. this.pending.getdataListParm.parammaps.departmentId = this.getdataListParm.parammaps.departmentId
  1037. this.pending.getdataListParm.parammaps.inputDatetime = this.getdataListParm.parammaps.inputDatetime
  1038. this.pending.getdataListParm.parammaps.loginId = this.getdataListParm.parammaps.loginId
  1039. this.pending.getdataListParm.parammaps.menu = this.getdataListParm.parammaps.menu
  1040. this.pending.getdataListParm.parammaps.logindeptId = this.getdataListParm.parammaps.logindeptId
  1041. this.pending.getdataListParm.parammaps.loginpastureId = this.getdataListParm.parammaps.loginpastureId
  1042. this.pending.getdataListParm.parammaps.empId = this.getdataListParm.parammaps.empId
  1043. this.pending.getdataListParm.parammaps.pastureId = Cookies.get('pastureid')
  1044. this.pending.getdataListParm.parammaps.deptId = Cookies.get('departmentid')
  1045. GetDataByName(this.pending.getdataListParm).then(response => {
  1046. this.pending.total = response.data.total3
  1047. })
  1048. },
  1049. get_table_data() {
  1050. this.listLoading = true
  1051. if (this.$refs['inputDatetime'] !== undefined && this.$refs['inputDatetime'].value !== null) {
  1052. this.getdataListParm.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  1053. this.getdataListParm.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  1054. } else {
  1055. this.getdataListParm.parammaps.startTime = ''
  1056. this.getdataListParm.parammaps.stopTime = ''
  1057. }
  1058. GetDataByName(this.getdataListParm).then(response => {
  1059. if (response.data.list !== null) {
  1060. console.log('table数据', response.data.list)
  1061. this.list = response.data.list
  1062. this.pageNum = response.data.pageNum
  1063. this.pageSize = response.data.pageSize
  1064. } else {
  1065. this.list = []
  1066. }
  1067. this.total = response.data.total
  1068. setTimeout(() => {
  1069. this.listLoading = false
  1070. }, 100)
  1071. })
  1072. },
  1073. changeAll() {
  1074. console.log(this.radioAll)
  1075. if (this.radioAll === '全部') {
  1076. this.getdataListParm.name = 'getpartpurchaseList'
  1077. this.getdataListParm.offset = 1
  1078. this.getdataListParm.parammaps = {
  1079. pastureName: Cookies.get('pasturename'),
  1080. orderNumber: '',
  1081. departmentId: '',
  1082. inputDatetime: '',
  1083. startTime: '',
  1084. stopTime: '',
  1085. loginId: Cookies.get('employeid'),
  1086. menu: 'Subscribe',
  1087. logindeptId: Cookies.get('departmentid'),
  1088. loginpastureId: Cookies.get('pastureid')
  1089. }
  1090. this.get_table_data()
  1091. } else if (this.radioAll === '待处理') {
  1092. this.getdataListParm.name = 'getpartpurchaseWebListNO'
  1093. this.getdataListParm.offset = 1
  1094. this.getdataListParm.parammaps = {
  1095. pastureName: this.getdataListParm.parammaps.pastureName,
  1096. orderNumber: this.getdataListParm.parammaps.orderNumber,
  1097. stuteSH: this.getdataListParm.parammaps.stuteSH,
  1098. departmentId: this.getdataListParm.parammaps.departmentId,
  1099. inputDatetime: this.getdataListParm.parammaps.inputDatetime,
  1100. startTime: this.getdataListParm.parammaps.startTime,
  1101. stopTime: this.getdataListParm.parammaps.stopTime,
  1102. loginId: Cookies.get('employeid'),
  1103. menu: 'Subscribe',
  1104. logindeptId: Cookies.get('departmentid'),
  1105. loginpastureId: Cookies.get('pastureid'),
  1106. empId: Cookies.get('employeid'),
  1107. pastureId: Cookies.get('pastureid'),
  1108. deptId: Cookies.get('departmentid')
  1109. }
  1110. this.get_table_data()
  1111. } else if (this.radioAll === '已处理') {
  1112. this.getdataListParm.name = 'getpartpurchaseWebList'
  1113. this.getdataListParm.offset = 1
  1114. this.getdataListParm.parammaps = {
  1115. pastureName: this.getdataListParm.parammaps.pastureName,
  1116. orderNumber: this.getdataListParm.parammaps.orderNumber,
  1117. stuteSH: this.getdataListParm.parammaps.stuteSH,
  1118. departmentId: this.getdataListParm.parammaps.departmentId,
  1119. inputDatetime: this.getdataListParm.parammaps.inputDatetime,
  1120. startTime: this.getdataListParm.parammaps.startTime,
  1121. stopTime: this.getdataListParm.parammaps.stopTime,
  1122. loginId: Cookies.get('employeid'),
  1123. menu: 'Subscribe',
  1124. logindeptId: Cookies.get('departmentid'),
  1125. loginpastureId: Cookies.get('pastureid'),
  1126. empId: Cookies.get('employeid'),
  1127. pastureId: Cookies.get('pastureid'),
  1128. deptId: Cookies.get('departmentid')
  1129. }
  1130. this.get_table_data()
  1131. }
  1132. },
  1133. statue: function(cellValue) {
  1134. // console.log(cellValue.isZeroStock)
  1135. if (cellValue.statue == 2) {
  1136. return '审核中'
  1137. } else if (cellValue.statue == 3) {
  1138. return '审核中'
  1139. } else if (cellValue.statue == 4) {
  1140. return '未通过'
  1141. } else if (cellValue.statue == 5) {
  1142. return '审核中'
  1143. } else if (cellValue.statue == 6) {
  1144. return '未通过'
  1145. } else if (cellValue.statue == 7) {
  1146. return '已通过'
  1147. } else if (cellValue.statue == 8) {
  1148. return '未通过'
  1149. } else if (cellValue.statue == 9) {
  1150. return '审核中'
  1151. } else if (cellValue.statue == 10) {
  1152. return '未通过'
  1153. } else if (cellValue.statue == 11) {
  1154. return '审核中'
  1155. } else if (cellValue.statue == 12) {
  1156. return '未通过'
  1157. } else if (cellValue.statue == 13) {
  1158. return '审核中'
  1159. } else if (cellValue.statue == 14) {
  1160. return '未通过'
  1161. }
  1162. },
  1163. form_search() {
  1164. console.log('点击了table搜索')
  1165. if (this.getdataListParm.parammaps.inputDatetime === null) {
  1166. this.getdataListParm.parammaps.inputDatetime = ''
  1167. }
  1168. this.getdataListParm.offset = 1
  1169. this.listLoading = true
  1170. this.get_table_data()
  1171. this.getPendingList()
  1172. },
  1173. resetCreateTemp() {
  1174. this.createTemp.pastureId = parseInt(Cookies.get('pastureid'))
  1175. this.createTemp.departmentId = parseInt(Cookies.get('departmentid'))
  1176. this.createTemp.departmentName = Cookies.get('departmentname')
  1177. this.createTemp.employeId = parseInt(Cookies.get('employeid'))
  1178. this.createTemp.createTime = parseTime(new Date(), '{y}-{m}-{d}')
  1179. this.createTemp.orderNumber = ''
  1180. this.createTemp.providerId = ''
  1181. this.createTemp.funderId = ''
  1182. this.createTemp.purchaseType = '1'
  1183. this.listAdd = []
  1184. },
  1185. form_add() {
  1186. this.resetCreateTemp()
  1187. this.edit = 1
  1188. this.getDepartParam.parammaps.pastureId = this.createTemp.pastureId
  1189. this.getCreateDepartDownList()
  1190. this.dialogStatus = 'create'
  1191. this.dialogFormVisible = true
  1192. this.dialogFormVisible_seepart = false
  1193. this.$nextTick(() => {
  1194. this.$refs['createTemp'].clearValidate()
  1195. })
  1196. this.getCreateNumber()
  1197. },
  1198. getCreateNumber() {
  1199. GetDataByName(this.getParmCreateNumber).then(response => {
  1200. this.$nextTick(() => {
  1201. console.log('新增申购单号', response.data.list[0].orderCode)
  1202. this.createTemp.orderNumber = response.data.list[0].orderCode
  1203. this.$forceUpdate()
  1204. })
  1205. })
  1206. },
  1207. // getPartsListSG
  1208. changeProvider(item) {
  1209. if (item !== '') {
  1210. this.createTemp.providerName = this.onlineSubscriptionList.find(obj => obj.id == item).providerName
  1211. }
  1212. this.listAdd = []
  1213. },
  1214. sparePartSearch(queryString, cb) {
  1215. console.log('备件模糊查询输入值', queryString)
  1216. if(this.dialogStatus==='special'){
  1217. if(this.createTemp.purchaseType == 1 || this.createTemp.purchaseType == '3'){
  1218. if(this.createTemp.providerId == ''){
  1219. this.$message({ type: 'warning', message: '请选择供应商' })
  1220. return false;
  1221. }else{
  1222. if(this.createTemp.purchaseType == '3'){
  1223. this.requestSparePart.name = 'getStockListByGiveaway'
  1224. this.requestSparePart.parammaps['providerName'] = this.providerList.find(obj => obj.id == this.createTemp.providerId).providerName
  1225. this.requestSparePart.parammaps['providerId'] = this.createTemp.providerId
  1226. this.requestSparePart.parammaps['pastureId'] = this.createTemp.pastureId
  1227. }else{
  1228. this.requestSparePart.name = 'getPartsListSG'
  1229. this.requestSparePart.parammaps['providerId'] = this.createTemp.providerId
  1230. }
  1231. }
  1232. }
  1233. }else{
  1234. if (this.createTemp.providerId == '') {
  1235. this.requestSparePart.name = 'getPartsListSG'
  1236. } else {
  1237. this.requestSparePart.name = 'getPartsListSGFlex'
  1238. this.requestSparePart.parammaps.providerId = this.createTemp.providerId
  1239. this.requestSparePart.parammaps.providerName = this.createTemp.providerName
  1240. }
  1241. }
  1242. this.requestSparePart.parammaps['partCode'] = queryString
  1243. GetDataByName(this.requestSparePart).then(response => {
  1244. console.log('备件模糊查询搜索data', response.data.list)
  1245. if (response.data.list == null) {
  1246. cb([])
  1247. } else {
  1248. cb(response.data.list)
  1249. }
  1250. })
  1251. },
  1252. handleSelectSparePart(item) {
  1253. console.log('备件模糊查询选中值', item)
  1254. console.log('备件模糊查询选中值', item.partId)
  1255. console.log(this.listAdd)
  1256. if(this.dialogStatus==='special' && this.createTemp.purchaseType == '1' && this.createTemp.providerId == ''){
  1257. this.createTemp.providerId = item.providerId
  1258. }
  1259. this.public_select(item)
  1260. },
  1261. apply_subscribe(){
  1262. this.dialogStatus = 'seepart'
  1263. this.seepartList = []
  1264. console.log(this.seepartList.length,'===')
  1265. this.dialogFormVisible_seepart = true
  1266. // this.apply_subscribeData = item
  1267. },
  1268. seepart_search(){
  1269. this.get_seepart_data()
  1270. },
  1271. get_seepart_data() {
  1272. this.seepart.listLoading = true
  1273. GetDataByName(this.seepart.getdataListParm).then(response => {
  1274. if (response.data.list !== null) {
  1275. console.log('table数据', response.data.list)
  1276. this.seepartList = response.data.list
  1277. this.seepart.pageNum = response.data.pageNum
  1278. this.seepart.pageSize = response.data.pageSize
  1279. } else {
  1280. this.seepartList = []
  1281. }
  1282. this.seepart.total = response.data.total
  1283. setTimeout(() => {
  1284. this.seepart.listLoading = false
  1285. }, 100)
  1286. })
  1287. },
  1288. public_select(item){
  1289. if (this.createTemp.providerId == '') {
  1290. if (this.listAdd.length > 0) {
  1291. if (this.listAdd.find(obj => obj.partId == item.partId)) {
  1292. this.$message({ type: 'warning', message: '此备件已存在,请重新选择备件' })
  1293. } else {
  1294. this.getParmCreateAmount.parammaps.partCode = item.partCode
  1295. partslistSGv2(this.getParmCreateAmount).then(response => {
  1296. this.$nextTick(() => {
  1297. console.log('新增根据编号获取备件库存数量', response.data.list[0])
  1298. item = response.data.list[0]
  1299. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  1300. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  1301. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  1302. } else {
  1303. item.srcpath = ''
  1304. item.picpath = ''
  1305. }
  1306. this.$set(item, 'amount', '')
  1307. this.$set(item, 'purpose', '')
  1308. if(this.dialogStatus==='special' && this.createTemp.purchaseType == '2'){
  1309. this.$set(item,'price','')
  1310. }else if(this.dialogStatus==='special' && this.createTemp.purchaseType == '3'){
  1311. this.$set(item,'price','0')
  1312. this.$set(item,'amount','0')
  1313. }
  1314. this.listAdd.unshift(item)
  1315. this.$forceUpdate()
  1316. })
  1317. })
  1318. }
  1319. } else {
  1320. this.getParmCreateAmount.parammaps.partCode = item.partCode
  1321. partslistSGv2(this.getParmCreateAmount).then(response => {
  1322. this.$nextTick(() => {
  1323. console.log('新增根据编号获取备件库存数量', response.data.list[0])
  1324. item = response.data.list[0]
  1325. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  1326. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  1327. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  1328. } else {
  1329. item.srcpath = ''
  1330. item.picpath = ''
  1331. }
  1332. this.$set(item, 'amount', '')
  1333. this.$set(item, 'purpose', '')
  1334. if(this.dialogStatus==='special' && this.createTemp.purchaseType == '2'){
  1335. this.$set(item,'price','')
  1336. }else if(this.dialogStatus==='special' && this.createTemp.purchaseType == '3'){
  1337. this.$set(item,'price','0')
  1338. this.$set(item,'amount','0')
  1339. }
  1340. this.listAdd.unshift(item)
  1341. this.$forceUpdate()
  1342. })
  1343. })
  1344. }
  1345. this.$forceUpdate()
  1346. } else {
  1347. if (this.listAdd.length > 0) {
  1348. if (this.listAdd.find(obj => obj.partId == item.partId)) {
  1349. this.$message({ type: 'warning', message: '此备件已存在,请重新选择备件' })
  1350. } else {
  1351. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  1352. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  1353. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  1354. } else {
  1355. item.srcpath = ''
  1356. item.picpath = ''
  1357. }
  1358. this.$set(item, 'amount', '')
  1359. this.$set(item, 'purpose', '')
  1360. if(this.dialogStatus==='special' && this.createTemp.purchaseType == '3'){
  1361. this.$set(item,'price','0')
  1362. this.$set(item,'amount','0')
  1363. }
  1364. this.listAdd.unshift(item)
  1365. }
  1366. } else {
  1367. if (item.srcpath !== null && item.picpath !== null && item.srcpath !== undefined && item.picpath !== undefined) {
  1368. this.$set(item, 'srcpath', process.env.VUE_APP_BASE_API + item.srcpath)
  1369. this.$set(item, 'picpath', process.env.VUE_APP_BASE_API + item.picpath)
  1370. } else {
  1371. item.srcpath = ''
  1372. item.picpath = ''
  1373. }
  1374. this.$set(item, 'amount', '')
  1375. this.$set(item, 'purpose', '')
  1376. if(this.dialogStatus==='special' && this.createTemp.purchaseType == '3'){
  1377. this.$set(item,'price','0')
  1378. this.$set(item,'amount','0')
  1379. }
  1380. this.listAdd.unshift(item)
  1381. this.$forceUpdate()
  1382. }
  1383. this.$forceUpdate()
  1384. }
  1385. },
  1386. add_dialog_save() {
  1387. this.isokDisable = true
  1388. setTimeout(() => {
  1389. this.isokDisable = false
  1390. }, 1000)
  1391. this.$refs['createTemp'].validate(valid => {
  1392. if (valid) {
  1393. console.log(this.listAdd)
  1394. if (this.createTemp.orderNumber == '' || this.createTemp.orderNumber == null || this.createTemp.orderNumber == undefined) {
  1395. GetDataByName(this.getParmCreateNumber).then(response => {
  1396. this.$nextTick(() => {
  1397. console.log('新增申购单号', response.data.list[0].orderCode)
  1398. this.createTemp.orderNumber = response.data.list[0].orderCode
  1399. this.$forceUpdate()
  1400. this.add_dialog_saveSave()
  1401. })
  1402. })
  1403. } else {
  1404. this.add_dialog_saveSave()
  1405. }
  1406. }
  1407. })
  1408. },
  1409. add_dialog_saveSave() {
  1410. if (this.listAdd.length !== 0) {
  1411. for (var j = 0; j < this.listAdd.length; j++) {
  1412. console.log(this.listAdd[j].amount)
  1413. if (this.listAdd[j].amount == null || this.listAdd[j].amount === '') {
  1414. this.$message({ type: 'warning', message: '请检查申购数量是否未填写', duration: 2000 })
  1415. return false
  1416. } else {
  1417. var rulesAmount = /^[1-9]\d*$/
  1418. if (!rulesAmount.test(this.listAdd[j].amount)) {
  1419. this.$message({ type: 'error', message: '申购数量请输入正整数', duration: 2000 })
  1420. return false
  1421. }
  1422. }
  1423. if (this.createTemp.providerId !== '') {
  1424. if (this.listAdd[j].price == '') {
  1425. this.$message({ type: 'warning', message: '请检查单价是否为空', duration: 2000 })
  1426. return false
  1427. } else {
  1428. if (parseFloat(this.listAdd[j].price) == 0) {
  1429. this.$message({ type: 'warning', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
  1430. return false
  1431. } else {
  1432. // var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/
  1433. var rulesPrice = /(^[1-9](\d+)?(\.\d{1,5})?$)|(^\d\.\d{1,5}$)/
  1434. if (rulesPrice.test(this.listAdd[j].price) == false) {
  1435. this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
  1436. return false
  1437. }
  1438. }
  1439. }
  1440. }
  1441. }
  1442. this.postDataPramas.common = { 'returnmap': '0' }
  1443. this.postDataPramas.data = []
  1444. this.postDataPramas.data[0] = { 'name': 'insertBigPartpurchase', 'type': 'e', 'parammaps': {
  1445. pastureId: this.createTemp.pastureId,
  1446. departmentId: this.createTemp.departmentId,
  1447. orderNumber: this.createTemp.orderNumber,
  1448. useType: this.createTemp.useType,
  1449. createTime: this.createTemp.createTime,
  1450. employeId: this.createTemp.employeId,
  1451. providerId: this.createTemp.providerId
  1452. }}
  1453. // eslint-disable-next-line no-irregular-whitespace
  1454. this.postDataPramas.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
  1455. this.postDataPramas.data[1].children = []
  1456. this.postDataPramas.data[1].children[0] = { 'name': 'insertPartpurchase', 'type': 'e', 'parammaps': {
  1457. bigId: '@insertBigPartpurchase.LastInsertId',
  1458. pastureId: '@insertSpotList.pastureId',
  1459. partId: '@insertSpotList.partId',
  1460. partCode: '@insertSpotList.partCode',
  1461. partName: '@insertSpotList.partName',
  1462. specification: '@insertSpotList.specification',
  1463. unit: '@insertSpotList.unit',
  1464. brandId: '@insertSpotList.brandId',
  1465. storageAmount: '@insertSpotList.reportery',
  1466. purpose: '@insertSpotList.purpose',
  1467. amount: '@insertSpotList.amount',
  1468. price: '@insertSpotList.price',
  1469. contractId: '@insertSpotList.contractId'
  1470. }}
  1471. ExecDataByConfig(this.postDataPramas).then(response => {
  1472. console.log('新增保存发送参数', this.postDataPramas)
  1473. if (response.msg === 'fail') {
  1474. this.$notify({
  1475. title: '保存失败',
  1476. message: response.data,
  1477. type: 'warning',
  1478. duration: 2000
  1479. })
  1480. } else {
  1481. this.dialogFormVisible = false
  1482. this.getdataListParm.parammaps.inputDatetime = ''
  1483. this.get_table_data()
  1484. this.getPendingList()
  1485. this.$notify({
  1486. title: '',
  1487. message: '保存成功',
  1488. type: 'success',
  1489. duration: 2000
  1490. })
  1491. }
  1492. })
  1493. return true
  1494. } else {
  1495. this.$message({
  1496. title: '',
  1497. message: '请选择备件',
  1498. type: 'warning',
  1499. duration: 2000
  1500. })
  1501. return false
  1502. }
  1503. },
  1504. partDelete(row) {
  1505. console.log(this.listAdd)
  1506. MessageBox.confirm('设备名称:' + row.partName, '确认删除?', {
  1507. confirmButtonText: '确认',
  1508. cancelButtonText: '取消',
  1509. type: 'warning'
  1510. }).then(() => {
  1511. // console.log(this.list2)
  1512. for (var i = 0; i < this.listAdd.length; i++) {
  1513. console.log(this.listAdd[i])
  1514. if (this.listAdd[i].id === row.id) {
  1515. var listAddIndex = this.listAdd.indexOf(this.listAdd[i])
  1516. }
  1517. if (listAddIndex > -1) {
  1518. this.listAdd.splice(listAddIndex, 1)
  1519. return
  1520. }
  1521. }
  1522. })
  1523. },
  1524. // 查看
  1525. form_see(row) {
  1526. // 查看/特殊申购
  1527. if(row.purchase_type == 1 || row.purchase_type == 3){
  1528. this.textMap.see = '特殊申购'
  1529. }else{
  1530. this.textMap.see = '查看'
  1531. }
  1532. this.dialogStatus = 'see'
  1533. this.dialogFormVisibleSee = true
  1534. this.seeTemp = Object.assign({}, row)
  1535. this.seeTemp.purchaseType = String(row.purchase_type)
  1536. console.log('查看上方数据(从table读取)', this.seeTemp)
  1537. this.listSee = []
  1538. this.getdataListSee.parammaps.id = this.seeTemp.id
  1539. this.isApplyEx4 = false
  1540. this.getSeeList()
  1541. },
  1542. getFlowPath(){
  1543. // 流程图
  1544. var reason = '未通过原因:' + this.seeTemp.workflowNote
  1545. if (this.seeTemp.purchase_type < 0 || this.seeTemp.purchase_type == 0 ) {
  1546. if(this.isApplyEx4 == true){
  1547. if (this.seeTemp.statue === 2) {
  1548. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核' },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '场长审核' },{ title: '采购审核' }]
  1549. this.active = 1
  1550. } else if (this.seeTemp.statue === 3) {
  1551. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '场长审核' }, { title: '采购审核' }]
  1552. this.active = 2
  1553. } else if (this.seeTemp.statue === 4) {
  1554. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson, status: 'error', reason: reason },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '场长审核' },{ title: '采购审核' }]
  1555. this.active = 2
  1556. } else if (this.seeTemp.statue === 9) {
  1557. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson },{ title: '供应主管审核' }, { title: '场长审核' },{ title: '采购审核' }]
  1558. this.active = 3
  1559. } else if (this.seeTemp.statue === 10) {
  1560. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson, status: 'error', reason: reason }, { title: '供应主管审核' }, { title: '场长审核' },{ title: '采购审核' }]
  1561. this.active = 3
  1562. } else if (this.seeTemp.statue === 5) {
  1563. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '场长审核' }, { title: '采购审核' }]
  1564. this.active = 4
  1565. } else if (this.seeTemp.statue === 6) {
  1566. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }, { title: '场长审核' }, { title: '采购审核' }]
  1567. this.active = 4
  1568. } else if (this.seeTemp.statue === 11) {
  1569. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '场长审核', date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson }, { title: '采购审核' }]
  1570. this.active = 5
  1571. } else if (this.seeTemp.statue === 12) {
  1572. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '场长审核' , date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson, status: 'error', reason: reason }, { title: '采购审核' }]
  1573. this.active = 5
  1574. } else if (this.seeTemp.statue === 7) {
  1575. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '场长审核', date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson }, { title: '采购审核', date: this.seeTemp.CGChargedate, name: this.seeTemp.CGChargePerson }]
  1576. this.active = 6
  1577. } else if (this.seeTemp.statue === 8) {
  1578. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '场长审核', date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson },{ title: '采购审核', date: this.seeTemp.CGChargedate, name: this.seeTemp.CGChargePerson, status: 'error', reason: reason }]
  1579. this.active = 6
  1580. }
  1581. }else{
  1582. if (this.seeTemp.statue === 2) {
  1583. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核' },{ title: '设备主管审核' }, { title: '供应主管审核' },{ title: '采购审核' }]
  1584. this.active = 1
  1585. } else if (this.seeTemp.statue === 3) {
  1586. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '采购审核' }]
  1587. this.active = 2
  1588. } else if (this.seeTemp.statue === 4) {
  1589. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson, status: 'error', reason: reason },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '采购审核' }]
  1590. this.active = 2
  1591. } else if (this.seeTemp.statue === 9) {
  1592. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson },{ title: '供应主管审核' }, { title: '采购审核' }]
  1593. this.active = 3
  1594. } else if (this.seeTemp.statue === 10) {
  1595. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson, status: 'error', reason: reason }, { title: '供应主管审核' }, { title: '采购审核' }]
  1596. this.active = 3
  1597. } else if (this.seeTemp.statue === 5) {
  1598. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '采购审核' }]
  1599. this.active = 4
  1600. } else if (this.seeTemp.statue === 6) {
  1601. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }, { title: '采购审核' }]
  1602. this.active = 4
  1603. } else if (this.seeTemp.statue === 11) {
  1604. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '采购审核' }]
  1605. this.active = 4
  1606. } else if (this.seeTemp.statue === 12) {
  1607. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '采购审核' }]
  1608. this.active = 4
  1609. } else if (this.seeTemp.statue === 7) {
  1610. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '采购审核', date: this.seeTemp.CGChargedate, name: this.seeTemp.CGChargePerson }]
  1611. this.active = 6
  1612. } else if (this.seeTemp.statue === 8) {
  1613. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '采购审核', date: this.seeTemp.CGChargedate, name: this.seeTemp.CGChargePerson, status: 'error', reason: reason }]
  1614. this.active = 6
  1615. }
  1616. }
  1617. } else if(this.seeTemp.purchase_type == 3){
  1618. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }]
  1619. this.active = 1
  1620. }else {
  1621. if (this.seeTemp.statue === 2) {
  1622. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核' },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '财务审核' },{ title: '场长审核' },{ title: '采购审核' }]
  1623. this.active = 1
  1624. } else if (this.seeTemp.statue === 3) {
  1625. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '财务审核' }, { title: '场长审核' }, { title: '采购审核' }]
  1626. this.active = 2
  1627. } else if (this.seeTemp.statue === 4) {
  1628. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson, status: 'error', reason: reason },{ title: '设备主管审核' }, { title: '供应主管审核' }, { title: '财务审核' }, { title: '场长审核' },{ title: '采购审核' }]
  1629. this.active = 2
  1630. } else if (this.seeTemp.statue === 9) {
  1631. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson },{ title: '供应主管审核' }, { title: '财务审核' },{ title: '场长审核' },{ title: '采购审核' }]
  1632. this.active = 3
  1633. } else if (this.seeTemp.statue === 10) {
  1634. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson, status: 'error', reason: reason }, { title: '供应主管审核' }, { title: '财务审核' }, { title: '场长审核' },{ title: '采购审核' }]
  1635. this.active = 3
  1636. } else if (this.seeTemp.statue === 5) {
  1637. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核' },{ title: '场长审核' }, { title: '采购审核' }]
  1638. this.active = 4
  1639. } else if (this.seeTemp.statue === 6) {
  1640. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson, status: 'error', reason: reason }, { title: '财务审核' },{ title: '场长审核' }, { title: '采购审核' }]
  1641. this.active = 4
  1642. } else if (this.seeTemp.statue === 13) {
  1643. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核', date: this.seeTemp.financedate, name: this.seeTemp.financeName },{ title: '场长审核',}, { title: '采购审核' }]
  1644. this.active = 5
  1645. } else if (this.seeTemp.statue === 14) {
  1646. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核',date: this.seeTemp.financedate, name: this.seeTemp.financeName, status: 'error', reason: reason },{ title: '场长审核' }, { title: '采购审核' }]
  1647. this.active = 5
  1648. } else if (this.seeTemp.statue === 11) {
  1649. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核', date: this.seeTemp.financedate, name: this.seeTemp.financeName },{ title: '场长审核', date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson }, { title: '采购审核' }]
  1650. this.active = 6
  1651. } else if (this.seeTemp.statue === 12) {
  1652. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核', date: this.seeTemp.financedate, name: this.seeTemp.financeName },{ title: '场长审核' , date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson, status: 'error', reason: reason }, { title: '采购审核' }]
  1653. this.active = 6
  1654. } else if (this.seeTemp.statue === 7) {
  1655. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核', date: this.seeTemp.financedate, name: this.seeTemp.financeName }, { title: '场长审核', date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson }, { title: '采购审核', date: this.seeTemp.CGChargedate, name: this.seeTemp.CGChargePerson }]
  1656. this.active = 7
  1657. } else if (this.seeTemp.statue === 8) {
  1658. this.activeList = [{ title: '备件申购', date: this.seeTemp.inputTime, name: this.seeTemp.empname }, { title: '库管审核', date: this.seeTemp.KGChargedate, name: this.seeTemp.KGChargePerson }, { title: '设备主管审核', date: this.seeTemp.equipmentdate, name: this.seeTemp.equipmentPerson }, { title: '供应主管审核', date: this.seeTemp.chargeDate, name: this.seeTemp.chargePerson }, { title: '财务审核', date: this.seeTemp.financedate, name: this.seeTemp.financeName },{ title: '场长审核', date: this.seeTemp.fielddate, name: this.seeTemp.fieldPerson },{ title: '采购审核', date: this.seeTemp.CGChargedate, name: this.seeTemp.CGChargePerson, status: 'error', reason: reason }]
  1659. this.active = 7
  1660. }
  1661. }
  1662. },
  1663. getSeeList() {
  1664. this.listLoadingSee = true
  1665. GetDataByName(this.getdataListSee).then(response => {
  1666. if (response.data.list !== null) {
  1667. console.log('查看下方table数据', response.data.list)
  1668. this.listSee = response.data.list
  1669. this.listAdd = response.data.list
  1670. var sumPrices = 0
  1671. response.data.list.forEach(function(i,j){
  1672. sumPrices = sumPrices + (parseFloat(i.price1) *parseFloat(i.amount) )
  1673. })
  1674. console.log("总价sumPrices",sumPrices)
  1675. var priceObj = false
  1676. var priceArr = []
  1677. response.data.list.forEach(function(i,j){
  1678. if(parseFloat(i.price1) >= 500){
  1679. priceArr.push(true)
  1680. }else{
  1681. priceArr.push(false)
  1682. }
  1683. })
  1684. if (priceArr.includes(true)) {
  1685. priceObj = true
  1686. } else {
  1687. priceObj = false
  1688. }
  1689. console.log("priceObj",priceObj)
  1690. //总价大于2000 或单价>500
  1691. if(sumPrices >= 2000 || priceObj){
  1692. this.isApplyEx4 = true
  1693. this.getFlowPath()
  1694. } else {
  1695. this.isApplyEx4 = false
  1696. this.getFlowPath()
  1697. }
  1698. for (let i = 0; i < response.data.list.length; i++) {
  1699. 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) {
  1700. console.log(process.env.VUE_APP_BASE_API + response.data.list[i].srcpath, '=======1')
  1701. this.listSee[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  1702. this.listSee[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  1703. this.listAdd[i].srcpath = this.listSee[i].srcpath
  1704. this.listAdd[i].picpath = this.listSee[i].picpath
  1705. // this.seeTemp.providerName = response.data.list.providerName
  1706. this.pageNumSee = response.data.pageNum
  1707. this.pageSizeSee = response.data.pageSize
  1708. } else {
  1709. this.listSee[i].srcpath = ''
  1710. this.listSee[i].picpath = ''
  1711. this.listAdd[i].srcpath = ''
  1712. this.listAdd[i].picpath = ''
  1713. }
  1714. }
  1715. }
  1716. if (response.data.total) {
  1717. this.totalSee = response.data.total
  1718. }
  1719. setTimeout(() => {
  1720. this.listLoadingSee = false
  1721. }, 100)
  1722. })
  1723. },
  1724. form_edit(row) {
  1725. this.edit = 0
  1726. this.getDepartParam.parammaps.pastureId = row.pastureId
  1727. this.getCreateDepartDownList()
  1728. if (row.providerId == undefined) {
  1729. row.providerId = ''
  1730. row.providerName = ''
  1731. }
  1732. this.createTemp = Object.assign({}, row) // copy obj
  1733. this.dialogStatus = 'update'
  1734. this.dialogFormVisible = true
  1735. this.$nextTick(() => {
  1736. this.$refs['createTemp'].clearValidate()
  1737. })
  1738. this.getdataListSee.parammaps.id = this.createTemp.id
  1739. this.getSeeList()
  1740. },
  1741. edit_dialog_save() {
  1742. this.isokDisable = true
  1743. setTimeout(() => {
  1744. this.isokDisable = false
  1745. }, 1000)
  1746. this.$refs['createTemp'].validate(valid => {
  1747. if (valid) {
  1748. this.edit_dialog_saveSave()
  1749. }
  1750. })
  1751. },
  1752. edit_dialog_saveSave() {
  1753. if (this.listAdd.length !== 0) {
  1754. for (var j = 0; j < this.listAdd.length; j++) {
  1755. console.log(this.listAdd[j].amount)
  1756. // eslint-disable-next-line use-isnan
  1757. if (this.listAdd[j].amount == null || this.listAdd[j].amount === '') {
  1758. this.$message({ type: 'warning', message: '请检查申购数量是否未填写', duration: 2000 })
  1759. return false
  1760. } else {
  1761. var rulesAmount = /^[1-9]\d*$/
  1762. if (!rulesAmount.test(this.listAdd[j].amount)) {
  1763. this.$message({ type: 'error', message: '申购数量请输入正整数', duration: 2000 })
  1764. return false
  1765. }
  1766. }
  1767. if (this.createTemp.providerId !== '') {
  1768. if (this.listAdd[j].price == '') {
  1769. this.$message({ type: 'warning', message: '请检查单价是否为空', duration: 2000 })
  1770. return false
  1771. } else {
  1772. if (parseFloat(this.listAdd[j].price) == 0) {
  1773. this.$message({ type: 'warning', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
  1774. return false
  1775. } else {
  1776. // var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/
  1777. var rulesPrice = /(^[1-9](\d+)?(\.\d{1,5})?$)|(^\d\.\d{1,5}$)/
  1778. if (rulesPrice.test(this.listAdd[j].price) == false) {
  1779. this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
  1780. return false
  1781. }
  1782. }
  1783. }
  1784. }
  1785. }
  1786. this.postDataPramas.common = { 'returnmap': '0' }
  1787. this.postDataPramas.data = []
  1788. this.postDataPramas.data[0] = { 'name': 'updatepartpurchaseCharge', 'type': 'e', 'parammaps': {
  1789. id: this.createTemp.id
  1790. }}
  1791. this.postDataPramas.data[1] = { 'name': 'deletePartpurchase', 'type': 'e', 'parammaps': {
  1792. bigId: this.createTemp.id
  1793. }}
  1794. // eslint-disable-next-line no-irregular-whitespace
  1795. this.postDataPramas.data[2] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
  1796. this.postDataPramas.data[2].children = []
  1797. this.postDataPramas.data[2].children[0] = { 'name': 'insertPartpurchase', 'type': 'e', 'parammaps': {
  1798. bigId: this.createTemp.id,
  1799. pastureId: '@insertSpotList.pastureId',
  1800. partId: '@insertSpotList.partId',
  1801. partCode: '@insertSpotList.partCode',
  1802. partName: '@insertSpotList.partName',
  1803. specification: '@insertSpotList.specification',
  1804. unit: '@insertSpotList.unit',
  1805. brandId: '@insertSpotList.brandId',
  1806. storageAmount: '@insertSpotList.reportery',
  1807. purpose: '@insertSpotList.purpose',
  1808. amount: '@insertSpotList.amount',
  1809. price: '@insertSpotList.price',
  1810. contractId: '@insertSpotList.contractId'
  1811. }}
  1812. ExecDataByConfig(this.postDataPramas).then(response => {
  1813. console.log('新增保存发送参数', this.postDataPramas)
  1814. if (response.msg === 'fail') {
  1815. this.$notify({
  1816. title: '保存失败',
  1817. message: response.data,
  1818. type: 'warning',
  1819. duration: 2000
  1820. })
  1821. } else {
  1822. this.dialogFormVisible = false
  1823. this.getdataListParm.parammaps.inputDatetime = ''
  1824. this.get_table_data()
  1825. this.$notify({
  1826. title: '',
  1827. message: '保存成功',
  1828. type: 'success',
  1829. duration: 2000
  1830. })
  1831. }
  1832. })
  1833. return true
  1834. } else {
  1835. this.$message({
  1836. title: '',
  1837. message: '请选择备件',
  1838. type: 'warning',
  1839. duration: 2000
  1840. })
  1841. return false
  1842. }
  1843. },
  1844. get_select_list() {
  1845. GetDataByNames(this.requestParams).then(response => {
  1846. this.findAllProvider = response.data.findAllProvider.list
  1847. this.findAllPasture = response.data.findAllPasture.list
  1848. this.findAllEmploye = response.data.findAllEmploye.list
  1849. this.onlineSubscriptionList = response.data.getflexProviderList.list
  1850. this.getDepartDownList()
  1851. })
  1852. },
  1853. getDepartDownList() {
  1854. GetDataByName(this.getDepartParam).then(response => {
  1855. this.findAllDepart = response.data.list
  1856. })
  1857. },
  1858. changePastureName(item) {
  1859. this.getDepartParam.parammaps.pastureId = this.findAllPasture.find(obj => obj.name == item).id
  1860. this.getdataListParm.parammaps.departmentId = ''
  1861. this.getDepartDownList()
  1862. },
  1863. getCreateDepartDownList() {
  1864. GetDataByName(this.getDepartParam).then(response => {
  1865. this.createDepartList = response.data.list
  1866. if (this.edit == 1) {
  1867. if (this.createDepartList.find(obj => obj.id == Cookies.get('departmentid'))) {
  1868. this.createTemp.departmentId = parseInt(Cookies.get('departmentid'))
  1869. this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == Cookies.get('departmentid')).name
  1870. } else {
  1871. this.createTemp.departmentId = response.data.list[0].id
  1872. this.createTemp.departmentName = response.data.list[0].name
  1873. }
  1874. }
  1875. })
  1876. },
  1877. changePasture(item) {
  1878. this.getDepartParam.parammaps.pastureId = item
  1879. this.edit = 1
  1880. this.getCreateDepartDownList()
  1881. },
  1882. changeDepart(item) {
  1883. this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == item).name
  1884. },
  1885. handleDownload() {
  1886. console.log('点击了下载')
  1887. this.$alert('备件申购正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  1888. this.isPercentage = true
  1889. this.percentage = 1
  1890. var timer = setInterval(() => {
  1891. this.percentage += 5
  1892. if (this.percentage > 95) {
  1893. this.percentage = 99
  1894. clearInterval(timer)
  1895. }
  1896. this.percentage = this.percentage
  1897. }, 1000)
  1898. this.downloadParam.name = 'downloadPartpurchaseList'
  1899. this.downloadParam.parammaps = this.getdataListParm.parammaps
  1900. GetAccount(this.downloadParam).then(response => {
  1901. if (response.data.list !== '') {
  1902. this.percentage = 99
  1903. setTimeout(() => {
  1904. this.isPercentage = false
  1905. }, 2000)
  1906. }
  1907. this.$nextTick(() => {
  1908. const ExcelDatas = [
  1909. {
  1910. tHeader: ['牧场', '申购单号', '申购时间', '备件编号', '备件名称', '规格型号', '品牌', '单位', '申购数量', '申购部门', '申购人', '备注'],
  1911. filterVal: ['pastureName', 'orderNumber', 'inputTime', 'partCode', 'partName', 'specification', 'brandName', 'unit', 'amount', 'departmentName', 'empname', 'purpose'],
  1912. tableDatas: response.data.list,
  1913. sheetName: '备件申购'
  1914. }
  1915. ]
  1916. json2excel(ExcelDatas, '备件申购', true, 'xlsx')
  1917. })
  1918. })
  1919. },
  1920. form_delete(row) {
  1921. console.log('点击了删除')
  1922. MessageBox.confirm('确认删除此条信息?', {
  1923. confirmButtonText: '确认',
  1924. cancelButtonText: '取消',
  1925. type: 'warning'
  1926. }).then(() => {
  1927. this.postDataPramas.common = { 'returnmap': '0' }
  1928. this.postDataPramas.data = []
  1929. this.postDataPramas.data[0] = { 'name': 'deleteBigPartpurchase', 'type': 'e', 'parammaps': {
  1930. id: row.id
  1931. }}
  1932. this.postDataPramas.data[1] = { 'name': 'deletePartpurchase', 'type': 'e', 'parammaps': {
  1933. bigId: row.id
  1934. }}
  1935. ExecDataByConfig(this.postDataPramas).then(response => {
  1936. this.get_table_data()
  1937. this.$notify({
  1938. title: '成功',
  1939. message: '删除成功',
  1940. type: 'success',
  1941. duration: 2000
  1942. })
  1943. })
  1944. }).catch(() => {
  1945. this.$message({
  1946. type: 'info',
  1947. message: '已取消删除'
  1948. })
  1949. })
  1950. },
  1951. handleExamine1(row) {
  1952. console.log('点击了库管审核')
  1953. if (row == undefined) {
  1954. this.examineTemp = this.seeTemp
  1955. this.$set(this.seeTemp, 'statue', 1)
  1956. this.$set(this.seeTemp, 'workflowNote', '')
  1957. } else {
  1958. this.examineTemp = Object.assign({}, row)
  1959. this.$set(this.examineTemp, 'statue', 1)
  1960. this.$set(this.examineTemp, 'workflowNote', '')
  1961. }
  1962. this.dialogStatus = 'examine1'
  1963. this.dialogFormVisible_Examine = true
  1964. this.statueReason = false
  1965. },
  1966. changeStatue(val) {
  1967. if (val == 2) {
  1968. this.statueReason = true
  1969. } else {
  1970. this.statueReason = false
  1971. }
  1972. },
  1973. createExamineData1() {
  1974. console.log('点击了库管审核')
  1975. this.isokDisable = true
  1976. setTimeout(() => {
  1977. this.isokDisable = false
  1978. }, 1000)
  1979. this.$refs['examineTemp'].validate(valid => {
  1980. if (valid) {
  1981. this.requestParam = {}
  1982. this.requestParam.name = 'partpurchaseCharge'
  1983. this.requestParam.parammaps = {}
  1984. this.requestParam.parammaps.id = this.examineTemp.id
  1985. if (this.examineTemp.statue == 1) {
  1986. this.requestParam.parammaps.statue = 3
  1987. } else if (this.examineTemp.statue == 2) {
  1988. this.requestParam.parammaps.statue = 4
  1989. }
  1990. this.requestParam.parammaps.empId = Cookies.get('employeid')
  1991. this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
  1992. PostDataByName(this.requestParam).then(response => {
  1993. console.log('审核确认发送参数', this.requestParam)
  1994. this.isokDisable = false
  1995. if (response.msg !== 'fail') {
  1996. this.get_table_data()
  1997. this.dialogFormVisible_Examine = false
  1998. this.dialogFormVisible_See = false
  1999. this.statueReason = false
  2000. this.$notify({
  2001. title: '成功',
  2002. message: '审核成功',
  2003. type: 'success',
  2004. duration: 2000
  2005. })
  2006. } else {
  2007. failproccess(response, this.$notify)
  2008. }
  2009. })
  2010. }
  2011. })
  2012. },
  2013. handleExamine2(row) {
  2014. console.log('点击了设备主管审核')
  2015. if (row == undefined) {
  2016. this.examineTemp = this.seeTemp
  2017. this.$set(this.seeTemp, 'statue', 1)
  2018. this.$set(this.seeTemp, 'workflowNote', '')
  2019. } else {
  2020. this.examineTemp = Object.assign({}, row)
  2021. this.$set(this.examineTemp, 'statue', 1)
  2022. this.$set(this.examineTemp, 'workflowNote', '')
  2023. }
  2024. this.dialogStatus = 'examine2'
  2025. this.dialogFormVisible_Examine = true
  2026. this.statueReason = false
  2027. },
  2028. createExamineData2() {
  2029. console.log('点击了设备主管审核')
  2030. this.isokDisable = true
  2031. setTimeout(() => {
  2032. this.isokDisable = false
  2033. }, 1000)
  2034. this.$refs['examineTemp'].validate(valid => {
  2035. if (valid) {
  2036. this.requestParam = {}
  2037. this.requestParam.name = 'partpurchaseEquipment'
  2038. this.requestParam.parammaps = {}
  2039. this.requestParam.parammaps.id = this.examineTemp.id
  2040. if (this.examineTemp.statue == 1) {
  2041. this.requestParam.parammaps.statue = 9
  2042. } else if (this.examineTemp.statue == 2) {
  2043. this.requestParam.parammaps.statue = 10
  2044. }
  2045. this.requestParam.parammaps.empId = Cookies.get('employeid')
  2046. this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
  2047. PostDataByName(this.requestParam).then(response => {
  2048. this.isokDisable = false
  2049. console.log('审核确认发送参数', this.requestParam)
  2050. if (response.msg !== 'fail') {
  2051. this.get_table_data()
  2052. this.dialogFormVisible_Examine = false
  2053. this.dialogFormVisible_See = false
  2054. this.statueReason = false
  2055. this.$notify({
  2056. title: '成功',
  2057. message: '审核成功',
  2058. type: 'success',
  2059. duration: 2000
  2060. })
  2061. } else {
  2062. failproccess(response, this.$notify)
  2063. }
  2064. })
  2065. }
  2066. })
  2067. },
  2068. handleExamine3(row) {
  2069. console.log('点击了供应主管审核')
  2070. if (row == undefined) {
  2071. this.examineTemp = this.seeTemp
  2072. this.$set(this.seeTemp, 'statue', 1)
  2073. this.$set(this.seeTemp, 'workflowNote', '')
  2074. this.getdataListSee.parammaps.id = this.seeTemp.id
  2075. } else {
  2076. this.examineTemp = Object.assign({}, row)
  2077. this.getdataListSee.parammaps.id = this.examineTemp.id
  2078. this.$set(this.examineTemp, 'statue', 1)
  2079. this.$set(this.examineTemp, 'workflowNote', '')
  2080. }
  2081. this.getSeeList()
  2082. this.dialogStatus = 'examine3'
  2083. this.dialogFormVisible_Examine = true
  2084. this.statueReason = false
  2085. },
  2086. createExamineData3() {
  2087. console.log('点击了供应主管审核')
  2088. console.log(this.isApplyEx4,'=====')
  2089. this.isokDisable = true
  2090. setTimeout(() => {
  2091. this.isokDisable = false
  2092. }, 1000)
  2093. this.$refs['examineTemp'].validate(valid => {
  2094. if (valid) {
  2095. this.requestParam = {}
  2096. this.requestParam.name = 'partpurchaseCharge3'
  2097. this.requestParam.parammaps = {}
  2098. this.requestParam.parammaps.id = this.examineTemp.id
  2099. if (this.examineTemp.statue == 1) {
  2100. if(this.examineTemp.purchase_type !== 1 && this.examineTemp.purchase_type !== 3){
  2101. console.log(this.isApplyEx4,'=====')
  2102. if(this.isApplyEx4 == true){
  2103. this.requestParam.parammaps.statue = 5
  2104. }else{
  2105. this.requestParam.parammaps.statue = 11
  2106. }
  2107. }else{
  2108. this.requestParam.parammaps.statue = 5
  2109. }
  2110. } else if (this.examineTemp.statue == 2) {
  2111. if(this.examineTemp.purchase_type !== 1 && this.examineTemp.purchase_type !== 3){
  2112. if(this.isApplyEx4 == true){
  2113. this.requestParam.parammaps.statue = 6
  2114. }else{
  2115. this.requestParam.parammaps.statue = 12
  2116. }
  2117. }else{
  2118. this.requestParam.parammaps.statue = 6
  2119. }
  2120. }
  2121. this.requestParam.parammaps.empId = Cookies.get('employeid')
  2122. this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
  2123. // return false
  2124. PostDataByName(this.requestParam).then(response => {
  2125. console.log('审核确认发送参数', this.requestParam)
  2126. this.isokDisable = false
  2127. if (response.msg !== 'fail') {
  2128. this.get_table_data()
  2129. this.dialogFormVisible_Examine = false
  2130. this.dialogFormVisible_See = false
  2131. this.statueReason = false
  2132. this.$notify({
  2133. title: '成功',
  2134. message: '审核成功',
  2135. type: 'success',
  2136. duration: 2000
  2137. })
  2138. } else {
  2139. failproccess(response, this.$notify)
  2140. }
  2141. })
  2142. }
  2143. })
  2144. },
  2145. handleExamine4(row) {
  2146. console.log('点击了场长审核')
  2147. if (row == undefined) {
  2148. this.examineTemp = this.seeTemp
  2149. this.$set(this.seeTemp, 'statue', 1)
  2150. this.$set(this.seeTemp, 'workflowNote', '')
  2151. } else {
  2152. this.examineTemp = Object.assign({}, row)
  2153. this.$set(this.examineTemp, 'workflowNote', '')
  2154. this.$set(this.examineTemp, 'statue', 1)
  2155. }
  2156. this.dialogStatus = 'examine4'
  2157. this.dialogFormVisible_Examine = true
  2158. this.statueReason = false
  2159. },
  2160. createExamineData4() {
  2161. console.log('点击了场长审核')
  2162. this.isokDisable = true
  2163. setTimeout(() => {
  2164. this.isokDisable = false
  2165. }, 1000)
  2166. this.$refs['examineTemp'].validate(valid => {
  2167. if (valid) {
  2168. this.requestParam = {}
  2169. this.requestParam.parammaps = {}
  2170. this.requestParam.common = { 'returnmap': '0' }
  2171. this.requestParam.data = []
  2172. // 通过
  2173. if (this.examineTemp.statue == 1) {
  2174. this.requestParam.data[0] = { 'name': 'partpurchaseField', 'type': 'e', 'parammaps': {
  2175. id: this.examineTemp.id,
  2176. statue: 11,
  2177. field: Cookies.get('employeid'),
  2178. workflowNote: this.examineTemp.workflowNote
  2179. }}
  2180. this.requestParam.data[1] = { 'name': 'createBuydetailBySG', 'type': 'e', 'parammaps': {
  2181. id: this.examineTemp.id,
  2182. pastureId: this.examineTemp.pastureId
  2183. }}
  2184. //不通过
  2185. } else if (this.examineTemp.statue == 2) {
  2186. this.requestParam.data[0] = { 'name': 'partpurchaseField', 'type': 'e', 'parammaps': {
  2187. id: this.examineTemp.id,
  2188. statue: 12,
  2189. field: Cookies.get('employeid'),
  2190. workflowNote: this.examineTemp.workflowNote
  2191. }}
  2192. }
  2193. ExecDataByConfig(this.requestParam).then(response => {
  2194. this.isokDisable = false
  2195. if (response.msg !== 'fail') {
  2196. this.get_table_data()
  2197. this.dialogFormVisible_Examine = false
  2198. this.dialogFormVisible_See = false
  2199. this.statueReason = false
  2200. this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
  2201. } else {
  2202. failproccess(response, this.$notify)
  2203. }
  2204. })
  2205. }
  2206. })
  2207. },
  2208. handleExamine5(row) {
  2209. console.log('点击了采购审核')
  2210. if (row == undefined) {
  2211. this.examineTemp = this.seeTemp
  2212. this.$set(this.seeTemp, 'statue', 1)
  2213. this.$set(this.seeTemp, 'workflowNote', '')
  2214. } else {
  2215. this.examineTemp = Object.assign({}, row)
  2216. this.$set(this.examineTemp, 'workflowNote', '')
  2217. this.$set(this.examineTemp, 'statue', 1)
  2218. }
  2219. this.dialogStatus = 'examine5'
  2220. this.dialogFormVisible_Examine = true
  2221. this.statueReason = false
  2222. },
  2223. createExamineData5() {
  2224. console.log('点击了采购审核')
  2225. this.isokDisable = true
  2226. setTimeout(() => {
  2227. this.isokDisable = false
  2228. }, 10000)
  2229. this.$refs['examineTemp'].validate(valid => {
  2230. if (valid) {
  2231. this.requestParam = {}
  2232. this.requestParam.parammaps = {}
  2233. this.requestParam.common = { 'returnmap': '0' }
  2234. this.requestParam.data = []
  2235. if (this.examineTemp.statue == 1) {
  2236. this.requestParam.data[0] = { 'name': 'partpurchaseCharge1', 'type': 'e', 'parammaps': {
  2237. id: this.examineTemp.id,
  2238. statue: 7,
  2239. empId: Cookies.get('employeid'),
  2240. workflowNote: this.examineTemp.workflowNote
  2241. }}
  2242. this.requestParam.data[1] = { 'name': 'createBuydetailBySG', 'type': 'e', 'parammaps': {
  2243. id: this.examineTemp.id,
  2244. pastureId: this.examineTemp.pastureId
  2245. }}
  2246. } else if (this.examineTemp.statue == 2) {
  2247. this.requestParam.data[0] = { 'name': 'partpurchaseCharge1', 'type': 'e', 'parammaps': {
  2248. id: this.examineTemp.id,
  2249. statue: 8,
  2250. empId: Cookies.get('employeid'),
  2251. workflowNote: this.examineTemp.workflowNote
  2252. }}
  2253. }
  2254. ExecDataByConfig(this.requestParam).then(response => {
  2255. this.isokDisable = false
  2256. if (response.msg !== 'fail') {
  2257. this.get_table_data()
  2258. this.dialogFormVisible_Examine = false
  2259. this.dialogFormVisible_See = false
  2260. this.statueReason = false
  2261. this.$notify({ title: '成功', message: '审核成功', type: 'success', duration: 2000 })
  2262. } else {
  2263. failproccess(response, this.$notify)
  2264. }
  2265. })
  2266. }
  2267. })
  2268. },
  2269. handleExamine6(row) {
  2270. console.log('点击了财务审核')
  2271. if (row == undefined) {
  2272. this.examineTemp = this.seeTemp
  2273. this.$set(this.seeTemp, 'statue', 1)
  2274. this.$set(this.seeTemp, 'workflowNote', '')
  2275. } else {
  2276. this.examineTemp = Object.assign({}, row)
  2277. this.$set(this.examineTemp, 'workflowNote', '')
  2278. this.$set(this.examineTemp, 'statue', 1)
  2279. }
  2280. this.dialogStatus = 'examine6'
  2281. this.dialogFormVisible_Examine = true
  2282. this.statueReason = false
  2283. },
  2284. createExamineData6() {
  2285. console.log('点击了财务审核')
  2286. this.isokDisable = true
  2287. setTimeout(() => {
  2288. this.isokDisable = false
  2289. }, 10000)
  2290. this.$refs['examineTemp'].validate(valid => {
  2291. if (valid) {
  2292. this.requestParam = {}
  2293. this.requestParam.name = 'partpurchaseFinanceId'
  2294. this.requestParam.parammaps = {}
  2295. this.requestParam.parammaps.id = this.examineTemp.id
  2296. if (this.examineTemp.statue == 1) {
  2297. this.requestParam.parammaps.statue = 13
  2298. } else if (this.examineTemp.statue == 2) {
  2299. this.requestParam.parammaps.statue = 14
  2300. }
  2301. this.requestParam.parammaps.financeId = Cookies.get('employeid')
  2302. this.requestParam.parammaps.workflowNote = this.examineTemp.workflowNote
  2303. PostDataByName(this.requestParam).then(response => {
  2304. console.log('审核确认发送参数', this.requestParam)
  2305. this.isokDisable = false
  2306. if (response.msg !== 'fail') {
  2307. this.get_table_data()
  2308. this.dialogFormVisible_Examine = false
  2309. this.dialogFormVisible_See = false
  2310. this.statueReason = false
  2311. this.$notify({
  2312. title: '成功',
  2313. message: '审核成功',
  2314. type: 'success',
  2315. duration: 2000
  2316. })
  2317. } else {
  2318. failproccess(response, this.$notify)
  2319. }
  2320. })
  2321. }
  2322. })
  2323. },
  2324. handle_specialSubscription(){
  2325. this.resetCreateTemp()
  2326. this.edit = 1
  2327. this.getDepartParam.parammaps.pastureId = this.createTemp.pastureId
  2328. this.getCreateDepartDownList()
  2329. this.dialogStatus = 'special'
  2330. this.dialogFormVisible2 = true
  2331. this.$nextTick(() => {
  2332. this.$refs['createTemp'].clearValidate()
  2333. })
  2334. this.getCreateNumber()
  2335. },
  2336. getProviderList(){
  2337. let data = {
  2338. "name":"getProviderList",
  2339. "page":1,"offset":1,"pagecount":100,
  2340. "returntype":"Map","parammaps":{"providerName":""}
  2341. }
  2342. GetDataByName(data).then(response => {
  2343. if (response.data.list !== null) {
  2344. this.providerList = response.data.list
  2345. }else{
  2346. this.providerList = []
  2347. }
  2348. })
  2349. },
  2350. changeType(){
  2351. this.listAdd = []
  2352. this.$set(this.createTemp,'providerId','')
  2353. this.$set(this.createTemp,'providerName','')
  2354. },
  2355. special_dialog_save(){
  2356. console.log('特殊申购保存')
  2357. this.isokDisable = true
  2358. setTimeout(() => {
  2359. this.isokDisable = false
  2360. }, 1000)
  2361. this.$refs['createTemp'].validate(valid => {
  2362. if (valid) {
  2363. console.log(this.listAdd)
  2364. if (this.createTemp.orderNumber == '' || this.createTemp.orderNumber == null || this.createTemp.orderNumber == undefined) {
  2365. GetDataByName(this.getParmCreateNumber).then(response => {
  2366. this.$nextTick(() => {
  2367. console.log('新增申购单号', response.data.list[0].orderCode)
  2368. this.createTemp.orderNumber = response.data.list[0].orderCode
  2369. this.$forceUpdate()
  2370. this.special_dialog_saveSave()
  2371. })
  2372. })
  2373. } else {
  2374. this.special_dialog_saveSave()
  2375. }
  2376. }
  2377. })
  2378. },
  2379. special_dialog_saveSave(){
  2380. if (this.listAdd.length !== 0) {
  2381. for (var j = 0; j < this.listAdd.length; j++) {
  2382. console.log(this.listAdd[j].amount)
  2383. if (this.listAdd[j].amount == null || this.listAdd[j].amount === '') {
  2384. this.$message({ type: 'warning', message: '请检查申购数量是否未填写', duration: 2000 })
  2385. return false
  2386. } else {
  2387. var rulesAmount = /^[1-9]\d*$/
  2388. if (!rulesAmount.test(this.listAdd[j].amount)) {
  2389. this.$message({ type: 'error', message: '申购数量请输入正整数', duration: 2000 })
  2390. return false
  2391. }
  2392. }
  2393. if(this.createTemp.purchaseType == '2'){
  2394. if (this.createTemp.providerId !== '') {
  2395. if (this.listAdd[j].price == '') {
  2396. this.$message({ type: 'warning', message: '请检查单价是否为空', duration: 2000 })
  2397. return false
  2398. } else {
  2399. if (parseFloat(this.listAdd[j].price) == 0) {
  2400. this.$message({ type: 'warning', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
  2401. return false
  2402. } else {
  2403. // var rulesPrice = /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/
  2404. var rulesPrice = /(^[1-9](\d+)?(\.\d{1,5})?$)|(^\d\.\d{1,5}$)/
  2405. if (rulesPrice.test(this.listAdd[j].price) == false) {
  2406. this.$message({ type: 'error', message: '价格请输入正数,最多保留小数点后五位', duration: 2000 })
  2407. return false
  2408. }
  2409. }
  2410. }
  2411. }
  2412. }
  2413. }
  2414. if(this.createTemp.purchaseType == '1' || this.createTemp.purchaseType == '3' ){
  2415. if(this.createTemp.providerId == ''){
  2416. this.$message({ type: 'error', message: '请选择供应商', duration: 2000 })
  2417. return false
  2418. }
  2419. }else{
  2420. // if(this.createTemp.providerId == ''){
  2421. // this.$message({ type: 'error', message: '请选择供应商', duration: 2000 })
  2422. // return false
  2423. // }
  2424. if(this.createTemp.funderId == ''){
  2425. this.$message({ type: 'error', message: '请选择垫付人', duration: 2000 })
  2426. return false
  2427. }
  2428. }
  2429. let url = 'authdata/spare/parts/requisitions'
  2430. for(let i=0;i<this.listAdd.length;i++){
  2431. this.$set(this.listAdd[i],'contractId',String(this.listAdd[i].contractId))
  2432. }
  2433. let data = {
  2434. "pastureId": parseInt(this.createTemp.pastureId),
  2435. "departmentId": parseInt(this.createTemp.departmentId),
  2436. 'departmentName':this.createTemp.departmentName,
  2437. "orderNumber": this.createTemp.orderNumber,
  2438. "createTime": this.createTemp.createTime,
  2439. "employeId": this.createTemp.employeId,
  2440. "providerName": this.createTemp.providerName,
  2441. "purchaseType": parseInt(this.createTemp.purchaseType),
  2442. "spot_list":this.listAdd
  2443. }
  2444. if(this.createTemp.purchaseType == '1' || this.createTemp.purchaseType == '3'){
  2445. data.providerId = this.createTemp.providerId
  2446. data.providerName = this.providerList.find(obj => obj.id == this.createTemp.providerId).providerName
  2447. }
  2448. if(this.createTemp.funderId){
  2449. data.funderId = this.createTemp.funderId
  2450. }
  2451. postJson(url, data).then(response => {
  2452. if (response.msg !== 'fail') {
  2453. this.get_table_data()
  2454. this.dialogFormVisible = false
  2455. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2456. } else {
  2457. failproccess(response, this.$notify)
  2458. }
  2459. })
  2460. return true
  2461. } else {
  2462. this.$message({
  2463. title: '',
  2464. message: '请选择备件',
  2465. type: 'warning',
  2466. duration: 2000
  2467. })
  2468. return false
  2469. }
  2470. },
  2471. }
  2472. }
  2473. </script>
  2474. <style lang="scss" scoped>
  2475. .pagination-container{
  2476. display: block !important;
  2477. }
  2478. /deep/ .el-badge__content.is-fixed{
  2479. z-index: 1;
  2480. }
  2481. </style>
  2482. <style lang="scss">
  2483. .el-step__head.is-success {
  2484. color: #409EFF;
  2485. border-color: #409EFF;
  2486. }
  2487. .el-step__title.is-success{
  2488. color: #409EFF;
  2489. }
  2490. .el-step__head.is-process{
  2491. color: #409EFF;
  2492. border-color: #409EFF;
  2493. .el-step__icon.is-text{
  2494. background: #409EFF;
  2495. color: #fff;
  2496. }
  2497. }
  2498. .step-row{
  2499. color: #000;
  2500. }
  2501. </style>