index.vue 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" class="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
  4. <el-form-item label="资产名称" prop="name">
  5. <el-input v-model="queryParams.name" placeholder="请输入资产名称" clearable @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="资产条码" prop="code">
  8. <el-input v-model="queryParams.code" placeholder="请输入资产条码" clearable @keyup.enter.native="handleQuery" />
  9. </el-form-item>
  10. <el-form-item label="资产编号" prop="number">
  11. <el-input v-model="queryParams.number" placeholder="请输入资产编号" clearable @keyup.enter.native="handleQuery" />
  12. </el-form-item>
  13. <el-form-item label="资产分类" prop="categoryNumber">
  14. <el-select v-model="queryParams.categoryNumber" clearable placeholder="请选择资产分类">
  15. <el-option v-for="item in categoryList" :key="item.number" :label="item.name" :value="item.number"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="所在位置" prop="locationNumber">
  19. <treeselect v-model="queryParams.locationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="选择位置" />
  20. </el-form-item>
  21. <el-form-item v-if="isExist('使用部门')" label="使用部门" prop="userDepartment">
  22. <div style="display: inline-block; width: 183px">
  23. <treeselect v-model="queryParams.userDepartment" :options="deptOptions" :normalizer="normalizer" placeholder="选择使用部门" />
  24. </div>
  25. </el-form-item>
  26. <el-form-item label="EPC" prop="epc" v-if="isExist('epc')">
  27. <el-input
  28. v-model="queryParams.epc"
  29. placeholder="请输入EPC"
  30. clearable
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="开始使用日期" prop="startDate" v-if="isExist('开始使用日期')">
  35. <el-input
  36. v-model="queryParams.startDate"
  37. placeholder="请输入开始使用日期"
  38. clearable
  39. @keyup.enter.native="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item v-if="isExist('责任人')" label="责任人" prop="responsiblePerson">
  43. <el-input v-model="queryParams.responsiblePerson" placeholder="请输入责任人" clearable @keyup.enter.native="handleQuery" />
  44. </el-form-item>
  45. <el-form-item v-if="isExist('所属公司')" label="所属公司" prop="corporation">
  46. <div style="display: inline-block; width: 183px">
  47. <treeselect v-model="queryParams.corporation" :options="deptOptions" :normalizer="normalizer" placeholder="选择所属公司" />
  48. </div>
  49. </el-form-item>
  50. <el-form-item v-if="isExist('管理部门')" label="管理部门" prop="department">
  51. <div style="display: inline-block; width: 183px">
  52. <treeselect v-model="queryParams.department" :options="deptOptions" :normalizer="normalizer" placeholder="选择管理部门" />
  53. </div>
  54. </el-form-item>
  55. <el-form-item v-if="isExist('规格型号')" label="规格型号" prop="specificationsModel">
  56. <el-input v-model="queryParams.specificationsModel" placeholder="请输入规格型号" clearable @keyup.enter.native="handleQuery" />
  57. </el-form-item>
  58. <el-form-item v-if="isExist('ABC分类')" label="ABC分类" prop="abcCategory">
  59. <el-input v-model="queryParams.abcCategory" placeholder="请输入ABC分类" clearable @keyup.enter.native="handleQuery" />
  60. </el-form-item>
  61. <el-form-item v-if="isExist('资产性质')" label="资产性质" prop="property">
  62. <el-select v-model="queryParams.property" placeholder="请选择资产性质" clearable>
  63. <el-option v-for="dict in dict.type.sys_asset_property" :key="dict.value" :label="dict.label" :value="dict.value" />
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item v-if="isExist('管理状态')" label="管理状态" prop="manageStatus">
  67. <el-select v-model="queryParams.manageStatus" placeholder="请选择管理状态" clearable>
  68. <el-option v-for="dict in dict.type.sys_manage_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  69. </el-select>
  70. </el-form-item>
  71. <el-form-item v-if="isExist('入账时间')" label="入账时间" prop="paymentReceivingTime">
  72. <el-date-picker clearable v-model="queryParams.paymentReceivingTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择入账时间"> </el-date-picker>
  73. </el-form-item>
  74. <el-form-item v-if="isExist('购置日期')" label="购置日期" prop="purchaseDate">
  75. <el-date-picker clearable v-model="queryParams.purchaseDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择购置日期"> </el-date-picker>
  76. </el-form-item>
  77. <el-form-item v-if="isExist('启用日期')" label="启用日期" prop="commissioningDate">
  78. <el-date-picker clearable v-model="queryParams.commissioningDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择启用日期"> </el-date-picker>
  79. </el-form-item>
  80. <el-form-item v-if="isExist('使用年限')" label="使用年限" prop="durableYears">
  81. <el-input v-model="queryParams.durableYears" placeholder="请输入使用年限" clearable @keyup.enter.native="handleQuery" />
  82. </el-form-item>
  83. <el-form-item v-if="isExist('原值')" label="原值" prop="originalValue">
  84. <el-input v-model="queryParams.originalValue" placeholder="请输入原值" clearable @keyup.enter.native="handleQuery" />
  85. </el-form-item>
  86. <el-form-item v-if="isExist('净值')" label="净值" prop="netValue">
  87. <el-input v-model="queryParams.netValue" placeholder="请输入净值" clearable @keyup.enter.native="handleQuery" />
  88. </el-form-item>
  89. <el-form-item v-if="isExist('残值')" label="残值" prop="residualValue">
  90. <el-input v-model="queryParams.residualValue" placeholder="请输入残值" clearable @keyup.enter.native="handleQuery" />
  91. </el-form-item>
  92. <el-form-item v-if="isExist('折旧方式')" label="折旧方式" prop="depreciationMethod">
  93. <el-input v-model="queryParams.depreciationMethod" placeholder="请输入折旧方式" clearable @keyup.enter.native="handleQuery" />
  94. </el-form-item>
  95. <el-form-item v-if="isExist('累计折旧')" label="累计折旧" prop="accumulatedDepreciation">
  96. <el-input v-model="queryParams.accumulatedDepreciation" placeholder="请输入累计折旧" clearable @keyup.enter.native="handleQuery" />
  97. </el-form-item>
  98. <el-form-item v-if="isExist('最近折旧日期')" label="最近折旧日期" prop="lastDepreciationDate">
  99. <el-date-picker clearable v-model="queryParams.lastDepreciationDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择最近折旧日期"> </el-date-picker>
  100. </el-form-item>
  101. <el-form-item v-if="isExist('合同编号')" label="合同编号" prop="contractNumber">
  102. <el-input v-model="queryParams.contractNumber" placeholder="请输入合同编号" clearable @keyup.enter.native="handleQuery" />
  103. </el-form-item>
  104. <el-form-item v-if="isExist('出厂编号')" label="出厂编号" prop="factoryNumber">
  105. <el-input v-model="queryParams.factoryNumber" placeholder="请输入出厂编号" clearable @keyup.enter.native="handleQuery" />
  106. </el-form-item>
  107. <el-form-item v-if="isExist('制造商')" label="制造商" prop="manufacturer">
  108. <el-input v-model="queryParams.manufacturer" placeholder="请输入制造商" clearable @keyup.enter.native="handleQuery" />
  109. </el-form-item>
  110. <el-form-item v-if="isExist('供应商')" label="供应商" prop="supplier">
  111. <el-input v-model="queryParams.supplier" placeholder="请输入供应商" clearable @keyup.enter.native="handleQuery" />
  112. </el-form-item>
  113. <el-form-item v-if="isExist('维保到期日期')" label="维保到期日期" prop="maintenanceDate">
  114. <el-date-picker clearable v-model="queryParams.maintenanceDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择维保到期日期"> </el-date-picker>
  115. </el-form-item>
  116. <el-form-item v-if="isExist('维修电话')" label="维修电话" prop="maintenanceTel">
  117. <el-input v-model="queryParams.maintenanceTel" placeholder="请输入维修电话" clearable @keyup.enter.native="handleQuery" />
  118. </el-form-item>
  119. <el-form-item v-if="isExist('维修人员')" label="维修人员" prop="maintenanceUser">
  120. <el-input v-model="queryParams.maintenanceUser" placeholder="请输入维修人员" clearable @keyup.enter.native="handleQuery" />
  121. </el-form-item>
  122. <el-form-item v-if="isExist('记录状态')" label="记录状态" prop="recordStatus">
  123. <el-select v-model="queryParams.recordStatus" placeholder="请选择记录状态" clearable>
  124. <el-option v-for="dict in dict.type.asset_record_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  125. </el-select>
  126. </el-form-item>
  127. <el-form-item v-if="isExist('是否白名单')" label="是否白名单" prop="isWhitelist">
  128. <el-select v-model="queryParams.isWhitelist" placeholder="请选择是否白名单" clearable>
  129. <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
  130. </el-select>
  131. </el-form-item>
  132. <!-- <el-form-item label="数量" prop="quantity">
  133. <el-input
  134. v-model="queryParams.quantity"
  135. placeholder="请输入数量"
  136. clearable
  137. @keyup.enter.native="handleQuery"
  138. />
  139. </el-form-item>
  140. <el-form-item label="计量单位" prop="units">
  141. <el-input
  142. v-model="queryParams.units"
  143. placeholder="请输入计量单位"
  144. clearable
  145. @keyup.enter.native="handleQuery"
  146. />
  147. </el-form-item> -->
  148. <!-- <el-form-item label="epc补充长度" prop="epcReplenishLength">
  149. <el-input
  150. v-model="queryParams.epcReplenishLength"
  151. placeholder="请输入EPC补充长度"
  152. clearable
  153. @keyup.enter.native="handleQuery"
  154. />
  155. </el-form-item> -->
  156. <!-- <el-form-item label="预计使用期限" prop="lifeExpectancy">
  157. <el-input
  158. v-model="queryParams.lifeExpectancy"
  159. placeholder="请输入预计使用期限"
  160. clearable
  161. @keyup.enter.native="handleQuery"
  162. />
  163. </el-form-item>
  164. <el-form-item label="预计使用期限单位" prop="lifeUnits">
  165. <el-input
  166. v-model="queryParams.lifeUnits"
  167. placeholder="请输入预计使用期限单位"
  168. clearable
  169. @keyup.enter.native="handleQuery"
  170. />
  171. </el-form-item> -->
  172. <!-- <el-form-item label="预留字段j" prop="reservedColumnJ">
  173. <el-input
  174. v-model="queryParams.reservedColumnJ"
  175. placeholder="请输入预留字段j"
  176. clearable
  177. @keyup.enter.native="handleQuery"
  178. />
  179. </el-form-item> -->
  180. <el-form-item style="padding-left: 30px">
  181. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  182. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  183. </el-form-item>
  184. </el-form>
  185. <el-row :gutter="10" class="mb8">
  186. <el-col :span="1.5">
  187. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['asset:information:add']">新增</el-button>
  188. </el-col>
  189. <el-col :span="1.5">
  190. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['asset:information:edit']">修改</el-button>
  191. </el-col>
  192. <el-col :span="1.5">
  193. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['asset:information:remove']">删除</el-button>
  194. </el-col>
  195. <!-- <el-col :span="1.5">
  196. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['asset:information:export']">导出</el-button>
  197. </el-col>
  198. <el-col :span="1.5">
  199. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleAllExport" v-hasPermi="['asset:information:export']">全部导出</el-button>
  200. </el-col> -->
  201. <el-col :span="1.5">
  202. <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['asset:information:import']">导入</el-button>
  203. <!-- v-hasPermi="['collegeManage:studentBase:import']" -->
  204. </el-col>
  205. <el-col :span="1.5">
  206. <el-dropdown @command="handleCommand" split-button type="warning" trigger="click" placement="bottom-start" size="mini" v-hasPermi="['asset:information:export']">
  207. <span class="el-dropdown-link" @click="handleExport">
  208. <i class="el-icon-download"></i>&nbsp;导出
  209. </span>
  210. <el-dropdown-menu slot="dropdown">
  211. <el-dropdown-item command="batch"><span style="padding:8px;font-size: 13px;letter-spacing: 2px;">批量导出</span></el-dropdown-item>
  212. <el-dropdown-item command="all" divided><span style="padding:8px;font-size: 13px;letter-spacing: 2px;">全部导出</span></el-dropdown-item>
  213. </el-dropdown-menu>
  214. </el-dropdown>
  215. </el-col>
  216. <el-col :span="1.5">
  217. <el-button type="success" plain icon="el-icon-printer" size="mini" :disabled="multiple" @click="handPrinter" v-hasPermi="['asset:information:query']">打印标签</el-button>
  218. </el-col>
  219. <el-col :span="1.5">
  220. <el-button type="primary" plain icon="el-icon-menu" size="mini" @click="handleDIY" v-hasPermi="['asset:information:query']">自定义字段</el-button>
  221. </el-col>
  222. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  223. </el-row>
  224. <el-table v-loading="loading" :data="informationList" @selection-change="handleSelectionChange">
  225. <el-table-column type="selection" width="55" align="center" />
  226. <!-- <el-table-column label="编号" align="center" prop="id" /> -->
  227. <el-table-column label="资产编号" align="center" prop="number" />
  228. <el-table-column label="照片" align="center" prop="imageUrl" width="100">
  229. <template slot-scope="scope">
  230. <image-preview :src="scope.row.imageUrl" :width="50" :height="50" v-show="scope.row.imageUrl === '' || scope.row.imageUrl == null ? false : true" />
  231. </template>
  232. </el-table-column>
  233. <el-table-column label="资产名称" align="center" prop="name" />
  234. <el-table-column label="数量" align="center" prop="quantity" />
  235. <el-table-column label="计量" align="center" prop="units" />
  236. <el-table-column label="资产分类" align="center" prop="categoryName">
  237. <!-- <template slot-scope="scope">
  238. <span>{{ scope.row.categoryNumber != null ? categoryName(scope.row.categoryNumber) : '' }}</span>
  239. </template> -->
  240. </el-table-column>
  241. <el-table-column label="所在位置" align="center" prop="locationName" width="120">
  242. <template slot-scope="scope">
  243. <span>{{ (scope.row.ancestorLocationName ? scope.row.ancestorLocationName + "-" : "") + (scope.row.parentLocationName ? scope.row.parentLocationName + "-" : "") + scope.row.locationName }}</span>
  244. </template>
  245. </el-table-column>
  246. <el-table-column v-if="isExist('使用部门')" label="使用部门" align="center" prop="userDepartmentName">
  247. <!-- <template slot-scope="scope">
  248. <span>{{ scope.row.userDepartment != null ? companyName(scope.row.userDepartment) : '' }}</span>
  249. </template> -->
  250. </el-table-column>
  251. <el-table-column label="资产条码" v-if="isExist('资产条码')" align="center" prop="code" />
  252. <el-table-column label="EPC" align="center" prop="epc" v-if="isExist('epc')" width="180">
  253. <template slot-scope="scope">
  254. <div>{{scope.row.epc}}<br/>&lceil;补位:{{scope.row.epcReplenishLength}}&rfloor;</div>
  255. </template>
  256. </el-table-column>
  257. <el-table-column v-if="isExist('管理部门')" label="管理部门" align="center">
  258. <template slot-scope="scope">
  259. <span>{{ scope.row.departmentName }}</span>
  260. </template>
  261. </el-table-column>
  262. <el-table-column v-if="isExist('所属公司')" label="所属公司" align="center" prop="corporationName">
  263. <!-- <template slot-scope="scope">
  264. <span>{{ scope.row.corporation != null ? companyName(scope.row.corporation) : '' }}</span>
  265. </template> -->
  266. </el-table-column>
  267. <el-table-column v-if="isExist('入账时间')" label="入账时间" align="center" prop="paymentReceivingTime" />
  268. <el-table-column v-if="isExist('备注')" label="备注" align="center" prop="remark" />
  269. <el-table-column v-if="isExist('管理状态')" label="管理状态" align="center" prop="manageStatus">
  270. <template slot-scope="scope">
  271. <dict-tag :options="dict.type.sys_manage_status" :value="scope.row.manageStatus" />
  272. </template>
  273. </el-table-column>
  274. <el-table-column v-if="isExist('资产性质')" label="资产性质" align="center" prop="property">
  275. <template slot-scope="scope">
  276. <dict-tag :options="dict.type.sys_asset_property" :value="scope.row.property" />
  277. </template>
  278. </el-table-column>
  279. <el-table-column v-if="isExist('规格型号')" label="规格型号" align="center" prop="specificationsModel" />
  280. <el-table-column v-if="isExist('ABC分类')" label="ABC分类" align="center" prop="abcCategory" />
  281. <el-table-column v-if="isExist('责任人')" label="责任人" align="center" prop="responsiblePerson" />
  282. <el-table-column v-if="isExist('购置日期')" label="购置日期" align="center" prop="purchaseDate" width="180">
  283. <template slot-scope="scope">
  284. <span>{{ parseTime(scope.row.purchaseDate, '{y}-{m}-{d}') }}</span>
  285. </template>
  286. </el-table-column>
  287. <el-table-column v-if="isExist('启用日期')" label="启用日期" align="center" prop="commissioningDate" width="180">
  288. <template slot-scope="scope">
  289. <span>{{ parseTime(scope.row.commissioningDate, '{y}-{m}-{d}') }}</span>
  290. </template>
  291. </el-table-column>
  292. <el-table-column v-if="isExist('原值')" label="原值" align="center" prop="originalValue" />
  293. <el-table-column v-if="isExist('使用年限')" label="使用年限" align="center" prop="durableYears" />
  294. <el-table-column v-if="isExist('净值')" label="净值" align="center" prop="netValue" />
  295. <el-table-column v-if="isExist('残值')" label="残值" align="center" prop="residualValue" />
  296. <el-table-column v-if="isExist('累计折旧')" label="累计折旧" align="center" prop="accumulatedDepreciation" />
  297. <el-table-column v-if="isExist('最近折旧日期')" label="最近折旧日期" align="center" prop="lastDepreciationDate" width="180">
  298. <template slot-scope="scope">
  299. <span>{{ parseTime(scope.row.lastDepreciationDate, '{y}-{m}-{d}') }}</span>
  300. </template>
  301. </el-table-column>
  302. <el-table-column v-if="isExist('折旧方式')" label="折旧方式" align="center" prop="depreciationMethod" />
  303. <el-table-column v-if="isExist('合同编号')" label="合同编号" align="center" prop="contractNumber" />
  304. <el-table-column v-if="isExist('出厂编号')" label="出厂编号" align="center" prop="factoryNumber" />
  305. <el-table-column v-if="isExist('制造商')" label="制造商" align="center" prop="manufacturer" />
  306. <el-table-column v-if="isExist('供应商')" label="供应商" align="center" prop="supplier" />
  307. <el-table-column v-if="isExist('资产用途')" label="资产用途" align="center" prop="purpose" />
  308. <el-table-column v-if="isExist('维保到期日期')" label="维保到期日期" align="center" prop="maintenanceDate" width="180">
  309. <template slot-scope="scope">
  310. <span>{{ parseTime(scope.row.maintenanceDate, '{y}-{m}-{d}') }}</span>
  311. </template>
  312. </el-table-column>
  313. <el-table-column v-if="isExist('维修电话')" label="维修电话" align="center" prop="maintenanceTel" />
  314. <el-table-column v-if="isExist('维修人员')" label="维修人员" align="center" prop="maintenanceUser" />
  315. <el-table-column v-if="isExist('记录状态')" label="记录状态" align="center" prop="recordStatus">
  316. <template slot-scope="scope">
  317. <dict-tag :options="dict.type.asset_record_status" :value="scope.row.recordStatus" />
  318. </template>
  319. </el-table-column>
  320. <el-table-column v-if="isExist('是否白名单')" label="是否白名单" align="center" prop="isWhitelist">
  321. <template slot-scope="scope">
  322. <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isWhitelist" />
  323. </template>
  324. </el-table-column>
  325. <!-- <el-table-column label="epc补充长度" align="center" prop="epcReplenishLength"/> -->
  326. <el-table-column v-if="isExist('开始使用日期')" label="开始使用日期" align="center" prop="startDate" width="180">
  327. <template slot-scope="scope">
  328. <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
  329. </template>
  330. </el-table-column>
  331. <el-table-column label="预计使用期限" v-if="isExist('预计使用期限')" align="center" prop="lifeExpectancy" />
  332. <el-table-column label="预计使用期限单位" v-if="isExist('预计使用期限单位')" align="center" prop="lifeUnits" />
  333. <!-- <el-table-column label="预留字段j" align="center" prop="reservedColumnJ" /> -->
  334. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  335. <template slot-scope="scope">
  336. <el-button size="mini" type="text" icon="el-icon-printer" @click="handPrinter(scope.row)" v-hasPermi="['asset:information:query']">打印</el-button>
  337. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['asset:information:edit']">修改</el-button>
  338. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['asset:information:remove']">删除</el-button>
  339. </template>
  340. </el-table-column>
  341. </el-table>
  342. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  343. <!-- 添加或修改资产信息对话框 -->
  344. <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
  345. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  346. <el-row :gutter="10">
  347. <el-col :span="8">
  348. <el-form-item label="资产编号" prop="number">
  349. <el-input v-model="form.number" placeholder="请输入资产编号" />
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="8">
  353. <el-form-item label="资产名称" prop="name">
  354. <el-input v-model="form.name" placeholder="请输入资产名称" />
  355. </el-form-item>
  356. </el-col>
  357. <el-col :span="8">
  358. <el-form-item label="资产分类" prop="categoryNumber">
  359. <el-select v-model="form.categoryNumber" placeholder="请选择资产分类">
  360. <el-option v-for="item in categoryList" :key="item.number" :label="item.name" :value="item.number"></el-option>
  361. </el-select>
  362. </el-form-item>
  363. </el-col>
  364. </el-row>
  365. <el-row :gutter="10">
  366. <el-col :span="8">
  367. <el-form-item label="所在位置" prop="locationNumber">
  368. <treeselect v-model="form.locationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="选择位置" />
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="8">
  372. <el-form-item label="数量" prop="quantity">
  373. <el-input v-model="form.quantity" placeholder="请输入数量" />
  374. </el-form-item>
  375. </el-col>
  376. <el-col :span="8">
  377. <el-form-item label="计量" prop="units">
  378. <el-input v-model="form.units" placeholder="请输入计量单位" />
  379. </el-form-item>
  380. </el-col>
  381. </el-row>
  382. <el-row :gutter="10">
  383. <el-col :span="8">
  384. <el-form-item label="使用部门" prop="userDepartment">
  385. <treeselect v-model="form.userDepartment" :options="deptOptions" :normalizer="normalizer" placeholder="选择使用部门" />
  386. </el-form-item>
  387. </el-col>
  388. </el-row>
  389. <el-row :gutter="10">
  390. <el-col :span="24">
  391. <el-form-item label="照片">
  392. <image-upload-temp v-model="form.imageUrl" :limit="1" />
  393. </el-form-item>
  394. </el-col>
  395. </el-row>
  396. <el-row :gutter="10">
  397. <el-col :span="8">
  398. <el-form-item v-if="isExist('原值')" label="原值" prop="originalValue">
  399. <el-input v-model="form.originalValue" placeholder="请输入原值" />
  400. </el-form-item>
  401. </el-col>
  402. <el-col :span="8">
  403. <el-form-item v-if="isExist('净值')" label="净值" prop="netValue">
  404. <el-input v-model="form.netValue" placeholder="请输入净值" />
  405. </el-form-item>
  406. </el-col>
  407. <el-col :span="8">
  408. <el-form-item v-if="isExist('残值')" label="残值" prop="residualValue">
  409. <el-input v-model="form.residualValue" placeholder="请输入残值" />
  410. </el-form-item>
  411. </el-col>
  412. </el-row>
  413. <el-row :gutter="10">
  414. <el-col :span="8">
  415. <el-form-item v-if="isExist('规格型号')" label="规格型号" prop="specificationsModel">
  416. <el-input v-model="form.specificationsModel" placeholder="请输入规格型号" />
  417. </el-form-item>
  418. </el-col>
  419. <el-col :span="8">
  420. <el-form-item v-if="isExist('资产用途')" label="资产用途" prop="purpose">
  421. <el-input v-model="form.purpose" type="textarea" placeholder="请输入内容" />
  422. </el-form-item>
  423. </el-col>
  424. <el-col :span="8">
  425. <el-form-item v-if="isExist('资产性质')" label="资产性质" prop="property">
  426. <el-select v-model="form.property" placeholder="请选择资产性质" clearable>
  427. <el-option v-for="dict in dict.type.sys_asset_property" :key="dict.value" :label="dict.label" :value="dict.value" />
  428. </el-select>
  429. </el-form-item>
  430. </el-col>
  431. </el-row>
  432. <el-row :gutter="10">
  433. <el-col :span="8">
  434. <el-form-item v-if="isExist('所属公司')" label="所属公司" prop="corporation">
  435. <treeselect v-model="form.corporation" :options="deptOptions" :normalizer="normalizer" placeholder="选择所属公司" />
  436. </el-form-item>
  437. </el-col>
  438. <el-col :span="8">
  439. <el-form-item v-if="isExist('管理部门')" label="管理部门" prop="department">
  440. <treeselect v-model="form.department" :options="deptOptions" :normalizer="normalizer" placeholder="选择管理部门" />
  441. </el-form-item>
  442. </el-col>
  443. <el-col :span="8">
  444. <el-form-item v-if="isExist('责任人')" label="责任人" prop="responsiblePerson">
  445. <el-input v-model="form.responsiblePerson" placeholder="请输入责任人" />
  446. </el-form-item>
  447. </el-col>
  448. </el-row>
  449. <el-row :gutter="10">
  450. <el-col :span="8">
  451. <el-form-item v-if="isExist('开始使用日期')" label="开始使用日期" prop="startDate">
  452. <el-date-picker clearable v-model="form.startDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择开始使用日期"> </el-date-picker>
  453. </el-form-item>
  454. </el-col>
  455. <el-col :span="8">
  456. <el-form-item v-if="isExist('预计使用期限')" label="预计使用期限" prop="lifeExpectancy">
  457. <el-input v-model="form.lifeExpectancy" placeholder="请输入预计使用期限" />
  458. </el-form-item>
  459. </el-col>
  460. <el-col :span="8">
  461. <el-form-item v-if="isExist('预计使用期限')" label="预计使用期限单位" prop="lifeUnits">
  462. <el-input v-model="form.lifeUnits" placeholder="请输入预计使用期限单位" />
  463. </el-form-item>
  464. </el-col>
  465. </el-row>
  466. <el-row :gutter="10">
  467. <el-col :span="8">
  468. <el-form-item v-if="isExist('ABC分类')" label="ABC分类" prop="abcCategory">
  469. <el-input v-model="form.abcCategory" placeholder="请输入ABC分类" />
  470. </el-form-item>
  471. </el-col>
  472. <el-col :span="8">
  473. <el-form-item v-if="isExist('启用日期')" label="启用日期" prop="commissioningDate">
  474. <el-date-picker clearable v-model="form.commissioningDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择启用日期"> </el-date-picker>
  475. </el-form-item>
  476. </el-col>
  477. <el-col :span="8">
  478. <el-form-item v-if="isExist('入账时间')" label="入账时间" prop="paymentReceivingTime">
  479. <el-date-picker clearable v-model="form.paymentReceivingTime" type="date" value-format="yyyy-MM-dd" placeholder="请输入入账时间"> </el-date-picker>
  480. </el-form-item>
  481. </el-col>
  482. </el-row>
  483. <el-row :gutter="10">
  484. <el-col :span="8">
  485. <el-form-item v-if="isExist('折旧方式')" label="折旧方式" prop="depreciationMethod">
  486. <el-input v-model="form.depreciationMethod" placeholder="请输入折旧方式" />
  487. </el-form-item>
  488. </el-col>
  489. <el-col :span="8">
  490. <el-form-item v-if="isExist('累计折旧')" label="累计折旧" prop="accumulatedDepreciation">
  491. <el-input v-model="form.accumulatedDepreciation" placeholder="请输入累计折旧" />
  492. </el-form-item>
  493. </el-col>
  494. <el-col :span="8">
  495. <el-form-item v-if="isExist('最近折旧日期')" label="最近折旧日期" prop="lastDepreciationDate">
  496. <el-date-picker clearable v-model="form.lastDepreciationDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择最近折旧日期"> </el-date-picker>
  497. </el-form-item>
  498. </el-col>
  499. </el-row>
  500. <el-row :gutter="10">
  501. <el-col :span="8">
  502. <el-form-item v-if="isExist('使用年限')" label="使用年限" prop="durableYears">
  503. <el-input v-model="form.durableYears" placeholder="请输入使用年限" />
  504. </el-form-item>
  505. </el-col>
  506. <el-col :span="8">
  507. <el-form-item v-if="isExist('购置日期')" label="购置日期" prop="purchaseDate">
  508. <el-date-picker clearable v-model="form.purchaseDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择购置日期"> </el-date-picker>
  509. </el-form-item>
  510. </el-col>
  511. <el-col :span="8">
  512. <el-form-item v-if="isExist('记录状态')" label="记录状态" prop="recordStatus">
  513. <el-select v-model="form.recordStatus" placeholder="请选择记录状态">
  514. <el-option v-for="dict in dict.type.asset_record_status" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
  515. </el-select>
  516. </el-form-item>
  517. </el-col>
  518. </el-row>
  519. <el-row :gutter="10">
  520. <el-col :span="8">
  521. <el-form-item v-if="isExist('维保到期日期')" label="维保到期日期" prop="maintenanceDate">
  522. <el-date-picker clearable v-model="form.maintenanceDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择维保到期日期"> </el-date-picker>
  523. </el-form-item>
  524. </el-col>
  525. <el-col :span="8">
  526. <el-form-item v-if="isExist('维修电话')" label="维修电话" prop="maintenanceTel">
  527. <el-input v-model="form.maintenanceTel" placeholder="请输入维修电话" />
  528. </el-form-item>
  529. </el-col>
  530. <el-col :span="8">
  531. <el-form-item v-if="isExist('维修人员')" label="维修人员" prop="maintenanceUser">
  532. <el-input v-model="form.maintenanceUser" placeholder="请输入维修人员" />
  533. </el-form-item>
  534. </el-col>
  535. </el-row>
  536. <el-row :gutter="10">
  537. <el-col :span="8">
  538. <el-form-item v-if="isExist('制造商')" label="制造商" prop="manufacturer">
  539. <el-input v-model="form.manufacturer" placeholder="请输入制造商" />
  540. </el-form-item>
  541. </el-col>
  542. <el-col :span="8">
  543. <el-form-item v-if="isExist('供应商')" label="供应商" prop="supplier">
  544. <el-input v-model="form.supplier" placeholder="请输入供应商" />
  545. </el-form-item>
  546. </el-col>
  547. <el-col :span="8">
  548. <el-form-item v-if="isExist('出厂编号')" label="出厂编号" prop="factoryNumber">
  549. <el-input v-model="form.factoryNumber" placeholder="请输入出厂编号" />
  550. </el-form-item>
  551. </el-col>
  552. </el-row>
  553. <el-row :gutter="10">
  554. <el-col :span="16">
  555. <el-form-item v-if="isExist('合同编号')" label="合同编号" prop="contractNumber">
  556. <el-input v-model="form.contractNumber" placeholder="请输入合同编号" />
  557. </el-form-item>
  558. </el-col>
  559. <el-col :span="8">
  560. <el-form-item v-if="isExist('是否白名单')" label="是否白名单" prop="isWhitelist">
  561. <el-select v-model="form.isWhitelist" placeholder="请输入是否白名单">
  562. <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
  563. </el-select>
  564. </el-form-item>
  565. </el-col>
  566. </el-row>
  567. <el-row :gutter="10">
  568. <el-col :span="24">
  569. <el-form-item v-if="isExist('备注')" label="备注" prop="remark">
  570. <el-input type="textarea" v-model="form.remark" placeholder="请输入备注" />
  571. </el-form-item>
  572. </el-col>
  573. </el-row>
  574. <!-- <el-form-item label="资产条码" prop="code">
  575. <el-input v-model="form.code" placeholder="请输入资产条码" />
  576. </el-form-item> -->
  577. <!-- <el-form-item label="epc" prop="epc">
  578. <el-input v-model="form.epc" placeholder="请输入EPC" />
  579. </el-form-item>
  580. <el-form-item label="epc补充长度" prop="epcReplenishLength">
  581. <el-input v-model="form.epcReplenishLength" placeholder="请输入EPC补充长度" />
  582. </el-form-item> -->
  583. <!-- <el-form-item label="预留字段j" prop="reservedColumnJ">
  584. <el-input v-model="form.reservedColumnJ" placeholder="请输入预留字段j" />
  585. </el-form-item> -->
  586. </el-form>
  587. <div slot="footer" class="dialog-footer">
  588. <el-button type="primary" @click="submitForm">确 定</el-button>
  589. <el-button @click="cancel">取 消</el-button>
  590. </div>
  591. </el-dialog>
  592. <el-dialog :title="title" :visible.sync="diyOpen" width="700px" append-to-body>
  593. <template>
  594. <div>
  595. <el-checkbox-group v-model="checkList" mini>
  596. <el-checkbox label="epc" border></el-checkbox>
  597. <el-checkbox label="使用部门" border></el-checkbox>
  598. <el-checkbox label="资产条码" border></el-checkbox>
  599. <el-checkbox label="资产性质" border></el-checkbox>
  600. <el-checkbox label="规格型号" border></el-checkbox>
  601. <el-checkbox label="ABC分类" border></el-checkbox>
  602. <el-checkbox label="责任人" border></el-checkbox>
  603. <el-checkbox label="购置日期" border></el-checkbox>
  604. <el-checkbox label="启用日期" border></el-checkbox>
  605. <el-checkbox label="使用年限" border></el-checkbox>
  606. <el-checkbox label="原值" border></el-checkbox>
  607. <el-checkbox label="净值" border></el-checkbox>
  608. <el-checkbox label="残值" border></el-checkbox>
  609. <el-checkbox label="折旧方式" border></el-checkbox>
  610. <el-checkbox label="累计折旧" border></el-checkbox>
  611. <el-checkbox label="最近折旧日期" border></el-checkbox>
  612. <el-checkbox label="合同编号" border></el-checkbox>
  613. <el-checkbox label="出厂编号" border></el-checkbox>
  614. <el-checkbox label="制造商" border></el-checkbox>
  615. <el-checkbox label="供应商" border></el-checkbox>
  616. <el-checkbox label="维保到期日期" border></el-checkbox>
  617. <el-checkbox label="维修电话" border></el-checkbox>
  618. <el-checkbox label="维修人员" border></el-checkbox>
  619. <el-checkbox label="入账时间" border></el-checkbox>
  620. <el-checkbox label="开始使用日期" border></el-checkbox>
  621. <el-checkbox label="预计使用期限" border></el-checkbox>
  622. <el-checkbox label="预计使用期限单位" border></el-checkbox>
  623. <el-checkbox label="所属公司" border></el-checkbox>
  624. <el-checkbox label="管理部门" border></el-checkbox>
  625. <el-checkbox label="记录状态" border></el-checkbox>
  626. <el-checkbox label="是否白名单" border></el-checkbox>
  627. <el-checkbox label="管理状态" border></el-checkbox>
  628. <el-checkbox label="备注" border></el-checkbox>
  629. </el-checkbox-group>
  630. </div>
  631. </template>
  632. <div slot="footer" class="dialog-footer">
  633. <el-button type="primary" @click="submitDIY">确 定</el-button>
  634. <el-button @click="cancelDIY">取 消</el-button>
  635. </div>
  636. </el-dialog>
  637. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  638. <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  639. <i class="el-icon-upload"></i>
  640. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  641. <div class="el-upload__tip text-center" slot="tip">
  642. <div class="el-upload__tip" slot="tip"><el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据</div>
  643. <span>仅允许导入xls、xlsx格式文件。</span>
  644. <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
  645. </div>
  646. </el-upload>
  647. <div slot="footer" class="dialog-footer">
  648. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  649. <el-button @click="upload.open = false">取 消</el-button>
  650. </div>
  651. </el-dialog>
  652. <el-dialog title="标签打印" :visible.sync="isPrinter" width="400px" append-to-body>
  653. <el-form ref="printForm" :model="printForm" :rules="printRules" label-width="80px">
  654. <el-form-item label="资产编号" prop="ids">
  655. {{ printForm.ids }}
  656. </el-form-item>
  657. <el-form-item label="标签编码" prop="labelCode">
  658. <el-select v-model="printForm.labelCode" placeholder="请选择标签编码">
  659. <el-option v-for="item in labelCodes" :key="item.value" :label="item.label" :value="item.value">
  660. <span style="float: left">{{ item.label }}</span>
  661. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  662. </el-option>
  663. </el-select>
  664. </el-form-item>
  665. </el-form>
  666. <div slot="footer" class="dialog-footer">
  667. <el-button type="primary" @click="onSubmitPrint">确 定</el-button>
  668. <el-button @click="cancel">取 消</el-button>
  669. </div>
  670. </el-dialog>
  671. </div>
  672. </template>
  673. <script>
  674. import { listInformation, getInformation, delInformation, addInformation, updateInformation, setDiy, getDiy, printLabel } from '@/api/asset/information'
  675. import { listCategory } from '@/api/asset/category'
  676. import { treeSelect } from '@/api/asset/location'
  677. import ImageUploadTemp from '@/components/ImageUploadTemp'
  678. import { listDept } from '@/api/system/dept'
  679. import { select } from '@/api/label/labelModel'
  680. import Treeselect from '@riophae/vue-treeselect'
  681. import { getToken } from '@/utils/auth'
  682. import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  683. export default {
  684. name: 'Information',
  685. dicts: ['asset_record_status', 'sys_yes_no', 'sys_manage_status', 'sys_asset_property'],
  686. components: {
  687. ImageUploadTemp,
  688. Treeselect,
  689. },
  690. computed: {
  691. isExist() {
  692. return (label) => {
  693. if (!this.checkList.length) {
  694. return false
  695. }
  696. return this.checkList.some((item) => item === label)
  697. }
  698. },
  699. },
  700. data() {
  701. return {
  702. // 遮罩层
  703. loading: true,
  704. // 选中数组
  705. ids: [],
  706. // 非单个禁用
  707. single: true,
  708. // 非多个禁用
  709. multiple: true,
  710. // 显示搜索条件
  711. showSearch: true,
  712. // 总条数
  713. total: 0,
  714. arr: [],
  715. // 所属位置表格数据
  716. locationList: [],
  717. // 资产分类表格数据
  718. categoryList: [],
  719. // 资产信息表格数据
  720. informationList: [],
  721. // 部门树选项
  722. deptOptions: [],
  723. // 弹出层标题
  724. title: '',
  725. // 是否显示弹出层
  726. open: false,
  727. //字段自定义弹出层
  728. diyOpen: false,
  729. //自定义字段列表
  730. checkList: [],
  731. // 查询参数
  732. queryParams: {
  733. pageNum: 1,
  734. pageSize: 10,
  735. code: null,
  736. name: null,
  737. number: null,
  738. imageUrl: null,
  739. categoryNumber: null,
  740. specificationsModel: null,
  741. abcCategory: null,
  742. manageStatus: null,
  743. userDepartment: null,
  744. department: null,
  745. responsiblePerson: null,
  746. locationNumber: null,
  747. property: null,
  748. purchaseDate: null,
  749. commissioningDate: null,
  750. originalValue: null,
  751. durableYears: null,
  752. netValue: null,
  753. residualValue: null,
  754. accumulatedDepreciation: null,
  755. lastDepreciationDate: null,
  756. depreciationMethod: null,
  757. contractNumber: null,
  758. factoryNumber: null,
  759. manufacturer: null,
  760. supplier: null,
  761. purpose: null,
  762. maintenanceDate: null,
  763. maintenanceTel: null,
  764. maintenanceUser: null,
  765. corporation: null,
  766. recordStatus: null,
  767. isWhitelist: null,
  768. quantity: null,
  769. units: null,
  770. paymentReceivingTime: null,
  771. epc: null,
  772. epcReplenishLength: null,
  773. lifeExpectancy: null,
  774. lifeUnits: null,
  775. startDate: null,
  776. reservedColumnJ: null,
  777. },
  778. // 表单参数
  779. form: {},
  780. // 表单校验
  781. rules: {
  782. number: [{ required: true, message: '资产编号不能为空', trigger: 'blur' }],
  783. specificationsModel: [{ required: true, message: '规格型号不能为空', trigger: 'blur' }],
  784. manageStatus: [{ required: true, message: '管理状态不能为空', trigger: 'change' }],
  785. recordStatus: [{ required: true, message: '记录状态不能为空', trigger: 'change' }],
  786. },
  787. upload: {
  788. // 是否显示弹出层(用户导入)
  789. open: false,
  790. // 弹出层标题(用户导入)
  791. title: '',
  792. // 是否禁用上传
  793. isUploading: false,
  794. // 是否更新已经存在的用户数据
  795. updateSupport: 1,
  796. // 设置上传的请求头部
  797. headers: { Authorization: 'Bearer ' + getToken() },
  798. // 上传的地址
  799. url: process.env.VUE_APP_BASE_API + '/asset/information/importData', // todo
  800. },
  801. labelCodes: [
  802. {
  803. label: '',
  804. value: '',
  805. },
  806. ],
  807. printForm: {
  808. ids: null,
  809. labelCode: null,
  810. },
  811. printRules: {
  812. ids: [{ required: true, message: '资产编码不能为空', trigger: 'blur' }],
  813. labelCode: [{ required: true, message: '标签编码不能为空', trigger: 'change' }],
  814. },
  815. isPrinter: false,
  816. }
  817. },
  818. created() {
  819. select().then((res) => {
  820. this.labelCodes = res.data
  821. })
  822. this.getList()
  823. },
  824. methods: {
  825. /** 查询资产信息列表 */
  826. getList() {
  827. this.loading = true
  828. getDiy().then((response) => {
  829. this.checkList = response.data
  830. })
  831. listDept().then((response) => {
  832. this.deptOptions = this.handleTree(response.data, 'deptId')
  833. this.arr = response.data
  834. })
  835. listCategory().then((response) => {
  836. this.categoryList = response.rows
  837. })
  838. treeSelect().then((response) => {
  839. this.locationList = response.data
  840. })
  841. listInformation(this.queryParams).then((response) => {
  842. this.informationList = response.rows
  843. this.total = response.total
  844. this.loading = false
  845. })
  846. },
  847. /** 转换部门数据结构 */
  848. normalizer(node) {
  849. if (node.children && !node.children.length) {
  850. delete node.children
  851. }
  852. return {
  853. id: node.deptId,
  854. label: node.deptName,
  855. children: node.children,
  856. }
  857. },
  858. tenantIdnormalizer(node) {
  859. return {
  860. id: node.number,
  861. label: node.label,
  862. children: node.children,
  863. }
  864. },
  865. //获取公司名
  866. // companyName(val) {
  867. // let num = parseInt(val)
  868. // let arr2 = this.arr.filter((item) => item.deptId === num)
  869. // return arr2[0].deptName
  870. // },
  871. //获取资产分类名
  872. // categoryName(val) {
  873. // //let num = parseInt(val)
  874. // let arr2 = this.categoryList.filter((item) => item.number === val)
  875. // return arr2[0].name
  876. // },
  877. //获取所在位置名
  878. // locationName(number) {
  879. // let name = '未知'
  880. // for (let item of this.locationList) {
  881. // if (item.number === number) {
  882. // name = item.label
  883. // break
  884. // }
  885. // if (item.children) {
  886. // let label = this.findLocation(number, item.children)
  887. // if (label != null) {
  888. // name = label
  889. // break
  890. // }
  891. // }
  892. // }
  893. // return name
  894. // },
  895. findLocation(number, children) {
  896. let name = null
  897. for (let item of children) {
  898. if (item.number === number) {
  899. name = item.label
  900. break
  901. }
  902. if (item.children) {
  903. let label = this.findLocation(number, item.children)
  904. if (label != null) {
  905. name = label
  906. break
  907. }
  908. }
  909. }
  910. return name
  911. },
  912. // 取消按钮
  913. cancel() {
  914. this.open = false
  915. this.isPrinter = false
  916. this.reset()
  917. },
  918. // 表单重置
  919. reset() {
  920. this.form = {
  921. id: null,
  922. code: null,
  923. name: null,
  924. number: null,
  925. imageUrl: null,
  926. categoryNumber: null,
  927. specificationsModel: null,
  928. abcCategory: null,
  929. manageStatus: null,
  930. userDepartment: null,
  931. department: null,
  932. responsiblePerson: null,
  933. locationNumber: null,
  934. property: null,
  935. purchaseDate: null,
  936. commissioningDate: null,
  937. originalValue: null,
  938. durableYears: null,
  939. netValue: null,
  940. residualValue: null,
  941. accumulatedDepreciation: null,
  942. lastDepreciationDate: null,
  943. depreciationMethod: null,
  944. contractNumber: null,
  945. factoryNumber: null,
  946. manufacturer: null,
  947. supplier: null,
  948. purpose: null,
  949. maintenanceDate: null,
  950. maintenanceTel: null,
  951. maintenanceUser: null,
  952. corporation: null,
  953. recordStatus: null,
  954. remark: null,
  955. createBy: null,
  956. createTime: null,
  957. updateBy: null,
  958. updateTime: null,
  959. isWhitelist: null,
  960. quantity: null,
  961. units: null,
  962. paymentReceivingTime: null,
  963. epc: null,
  964. epcReplenishLength: null,
  965. lifeExpectancy: null,
  966. lifeUnits: null,
  967. startDate: null,
  968. reservedColumnJ: null,
  969. }
  970. this.printForm = {
  971. ids: null,
  972. labelCode: null,
  973. }
  974. this.resetForm('form')
  975. this.resetForm('printForm')
  976. },
  977. /** 搜索按钮操作 */
  978. handleQuery() {
  979. this.queryParams.pageNum = 1
  980. this.getList()
  981. },
  982. /** 重置按钮操作 */
  983. resetQuery() {
  984. this.resetForm('queryForm')
  985. this.handleQuery()
  986. },
  987. // 多选框选中数据
  988. handleSelectionChange(selection) {
  989. this.ids = selection.map((item) => item.id)
  990. this.single = selection.length !== 1
  991. this.multiple = !selection.length
  992. },
  993. /** 新增按钮操作 */
  994. handleAdd(row) {
  995. this.reset()
  996. if (row != undefined) {
  997. this.form.parentId = row.deptId
  998. }
  999. this.open = true
  1000. this.title = '添加资产信息'
  1001. listDept().then((response) => {
  1002. this.deptOptions = this.handleTree(response.data, 'deptId')
  1003. })
  1004. },
  1005. /** 修改按钮操作 */
  1006. handleUpdate(row) {
  1007. this.reset()
  1008. const id = row.id || this.ids
  1009. getInformation(id).then((response) => {
  1010. this.form = response.data
  1011. this.open = true
  1012. this.title = '修改资产信息'
  1013. })
  1014. },
  1015. /** 标签打印操作 */
  1016. handPrinter(row) {
  1017. const ids = row.id || this.ids
  1018. if (Object.prototype.toString.call(ids) === '[object Array]') {
  1019. this.printForm.ids = ids
  1020. } else {
  1021. this.printForm.ids = [ids]
  1022. }
  1023. this.isPrinter = true
  1024. },
  1025. onSubmitPrint() {
  1026. this.$refs.printForm.validate((valid) => {
  1027. if (valid) {
  1028. printLabel(this.printForm).then((res) => {
  1029. this.$modal.msgSuccess('操作成功,等待打印...')
  1030. this.cancel()
  1031. })
  1032. } else {
  1033. return false
  1034. }
  1035. })
  1036. printLabel(this.printForm)
  1037. },
  1038. /** 自定义字段按钮 */
  1039. handleDIY() {
  1040. this.diyOpen = true
  1041. this.title = '自定义字段'
  1042. },
  1043. submitDIY() {
  1044. setDiy(this.checkList).then((response) => {
  1045. this.diyOpen = false
  1046. this.$modal.msgSuccess('修改成功')
  1047. })
  1048. },
  1049. cancelDIY() {
  1050. this.diyOpen = false
  1051. },
  1052. /** 提交按钮 */
  1053. submitForm() {
  1054. this.$refs['form'].validate((valid) => {
  1055. if (valid) {
  1056. if (this.form.id != null) {
  1057. updateInformation(this.form).then((response) => {
  1058. this.$modal.msgSuccess('修改成功')
  1059. this.open = false
  1060. this.getList()
  1061. })
  1062. } else {
  1063. addInformation(this.form).then((response) => {
  1064. this.$modal.msgSuccess('新增成功')
  1065. this.open = false
  1066. this.getList()
  1067. })
  1068. }
  1069. }
  1070. })
  1071. },
  1072. /** 导入按钮操作 */
  1073. handleImport() {
  1074. this.upload.title = '资产信息导入' // todo
  1075. this.upload.open = true
  1076. },
  1077. /** 下载模板操作 */
  1078. importTemplate() {
  1079. this.download('/asset/information/importTemplate', {}, `stu_base_template_${new Date().getTime()}.xlsx`) // todo
  1080. },
  1081. // 文件上传中处理
  1082. handleFileUploadProgress(event, file, fileList) {
  1083. this.upload.isUploading = true
  1084. },
  1085. // 文件上传成功处理
  1086. handleFileSuccess(response, file, fileList) {
  1087. this.upload.open = false
  1088. this.upload.isUploading = false
  1089. this.$refs.upload.clearFiles()
  1090. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
  1091. this.getList()
  1092. },
  1093. // 提交上传文件
  1094. submitFileForm() {
  1095. this.$refs.upload.submit()
  1096. },
  1097. /** 删除按钮操作 */
  1098. handleDelete(row) {
  1099. const ids = row.id || this.ids
  1100. this.$modal
  1101. .confirm('是否确认删除资产信息编号为"' + ids + '"的数据项?')
  1102. .then(function () {
  1103. return delInformation(ids)
  1104. })
  1105. .then(() => {
  1106. this.getList()
  1107. this.$modal.msgSuccess('删除成功')
  1108. })
  1109. .catch(() => {})
  1110. },
  1111. /** 导出按钮操作 */
  1112. handleExport() {
  1113. this.download(
  1114. 'asset/information/export',
  1115. {
  1116. ...this.queryParams,
  1117. },
  1118. `information_${new Date().getTime()}.xlsx`
  1119. )
  1120. },
  1121. handleAllExport() {
  1122. this.download(
  1123. 'asset/information/allExport',
  1124. {
  1125. },
  1126. `information_${new Date().getTime()}.xlsx`
  1127. )
  1128. },
  1129. handleCommand(command) {
  1130. if (command === 'batch') {
  1131. this.handleExport()
  1132. }
  1133. if (command === 'all') {
  1134. this.handleAllExport()
  1135. }
  1136. }
  1137. },
  1138. }
  1139. </script>
  1140. <style lang="less" scoped>
  1141. /deep/ .el-checkbox-group {
  1142. display: flex;
  1143. align-items: center;
  1144. flex-wrap: wrap;
  1145. .el-checkbox {
  1146. flex-basis: 25%;
  1147. margin-bottom: 10px; /* 调整间距 */
  1148. &:nth-child(1) {
  1149. margin-left: 10px;
  1150. }
  1151. }
  1152. }
  1153. /deep/ .vue-treeselect {
  1154. display: inline-block;
  1155. }
  1156. .queryForm {
  1157. /deep/ .vue-treeselect {
  1158. width: 205px;
  1159. height: 32px;
  1160. }
  1161. }
  1162. </style>