无线电资产管理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

969 lines
38 KiB

2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
4 weeks ago
1 month ago
2 months ago
1 month ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
4 weeks ago
2 months ago
4 weeks ago
2 months ago
4 weeks ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
1 month ago
1 month ago
2 months ago
2 months ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
  1. <template>
  2. <div class="app-container row-container">
  3. <div class="head-container">
  4. <div v-if="crud.props.searchToggle" class="head-search">
  5. <el-input v-model="query.billNo" clearable size="small" placeholder="输入盘点单号搜索" prefix-icon="el-icon-search" style="width: 225px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  6. <el-select v-model="query.warehouseId" clearable size="small" placeholder="所属仓库" class="filter-item" style="width: 120px" @change="crud.toQuery">
  7. <i slot="prefix" class="iconfont icon-zhuangtai" />
  8. <el-option
  9. v-for="(item,index) in warehouseOptions"
  10. :key="index"
  11. :label="item.warehouseName"
  12. :value="item.id"
  13. />
  14. </el-select>
  15. <el-select v-model="query.status" clearable size="small" placeholder="盘点状态" class="filter-item" style="width: 120px" @change="crud.toQuery">
  16. <i slot="prefix" class="iconfont icon-zhuangtai" />
  17. <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
  18. </el-select>
  19. <el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="crud.toQuery">搜索</el-button>
  20. <el-button class="filter-item filter-refresh" size="mini" type="warning" icon="el-icon-refresh-left" @click="resetQuery()">重置</el-button>
  21. </div>
  22. <crudOperation :permission="permission">
  23. <template v-slot:middle>
  24. <!-- <el-button :loading="addLoading" size="mini" @click="addStockTakeBill">
  25. <i class="iconfont icon-xinzeng" />
  26. 新增
  27. </el-button> -->
  28. <!-- <el-button slot="reference" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">
  29. <i class="iconfont icon-shanchu" />
  30. 删除
  31. </el-button> -->
  32. <!-- <el-button size="mini" :disabled="crud.selections.length === 0">
  33. <i class="iconfont icon-jiesuan" />
  34. 结算
  35. </el-button> -->
  36. <!-- <el-button :loading="crud.downloadLoading" size="mini" :disabled="crud.selections.length === 0" @click="doExport(crud.selections)">
  37. <i class="iconfont icon-daochu" />
  38. 导出
  39. </el-button> -->
  40. </template>
  41. <!-- <template v-slot:right>
  42. <el-button :loading="clearCacheLoading" size="mini" style="background-color: #ed4a41; border-color: #ed4a41; color: #fff;" @click="clearCacheDatas">
  43. <i class="iconfont icon-shanchu" />
  44. 清空缓存
  45. </el-button>
  46. </template> -->
  47. </crudOperation>
  48. </div>
  49. <div class="container-wrap">
  50. <span class="right-top-line" />
  51. <span class="left-bottom-line" />
  52. <el-table
  53. ref="table"
  54. v-loading="crud.loading"
  55. class="archives-table"
  56. highlight-current-row
  57. stripe
  58. style="width: 100%;"
  59. height="calc(100vh - 330px)"
  60. :data="crud.data"
  61. @selection-change="crud.selectionChangeHandler"
  62. @row-click="clickRowHandler"
  63. @row-dblclick="handleRowDblClick"
  64. >
  65. <el-table-column type="selection" align="center" width="55" />
  66. <el-table-column prop="billNo" label="任务编号" min-width="180px" :show-overflow-tooltip="true" />
  67. <!-- <el-table-column prop="stockName" label="任务名称" min-width="150px" />
  68. <el-table-column prop="stockManager" label="负责人" min-width="100px" /> -->
  69. <el-table-column prop="warehouseName" label="所属仓库" min-width="160px" :show-overflow-tooltip="true" />
  70. <!-- <el-table-column prop="stockExecutor" label="盘点执行人" min-width="120px" /> -->
  71. <el-table-column prop="stockNum" label="总数" min-width="80px" align="right" />
  72. <el-table-column prop="correctQty" label="账实相符数" min-width="120px" align="right" />
  73. <el-table-column prop="excessQty" label="盘盈数" min-width="80px" align="right" />
  74. <el-table-column prop="missingQty" label="盘亏数" min-width="80px" align="right" />
  75. <el-table-column prop="status" label="盘点状态" align="center" min-width="100px">
  76. <template slot-scope="scope">
  77. <span v-if="(scope.row.status || '').toString().trim() === '0'" class="row-state row-lending ">未盘点</span>
  78. <span v-if="(scope.row.status || '').toString().trim() === '-1'" class="row-state row-lending state-active">已终止</span>
  79. <span v-if="(scope.row.status || '').toString().trim() === '1'" class="row-state row-warehousing state-active">盘点中</span>
  80. <span v-if="(scope.row.status || '').toString().trim() === '2'" class="row-state row-binding state-active">已完成</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column prop="takeDate" label="发起时间" width="150px">
  84. <template slot-scope="scope">
  85. <div>{{ scope.row.takeDate | parseTime }}</div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="takeStart" label="盘点开始时间" width="150px">
  89. <template slot-scope="scope">
  90. <div>{{ scope.row.takeStart | parseTime }}</div>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="takeEnd" label="盘点结束时间" width="150px">
  94. <template slot-scope="scope">
  95. <div>{{ scope.row.takeEnd | parseTime }}</div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="操作" min-width="210px">
  99. <template slot-scope="scope">
  100. <el-button :loading="scope.row.deleteLoading" style="background-color: #F65163; border-color:#F65163; color: #fff;" @click="toDelete(scope.row)">
  101. 删除
  102. </el-button>
  103. <el-button :loading="scope.row.settleLoading" style="background-color: #1AAE93; border-color:#1AAE93; color: #fff;" @click="handleSettle(scope.row)">
  104. 结算
  105. </el-button>
  106. <el-button :loading="scope.row.exportLoading" @click="handleExport(scope.row)">
  107. 导出
  108. </el-button>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <!--分页组件-->
  113. <pagination v-if="crud.data.length!==0" />
  114. </div>
  115. <el-dialog width="1000px" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" class="group-form">
  116. <span class="dialog-right-top" />
  117. <span class="dialog-left-bottom" />
  118. <div class="setting-dialog">
  119. <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
  120. <el-form-item label="所属部门" prop="departmentname">
  121. <el-select v-model="form.departmentname" placeholder="请选择" style="width: 300px;" @change="handleDepartmentChange">
  122. <el-option
  123. v-for="(item,index) in departmentOptions"
  124. :key="index"
  125. :label="item"
  126. :value="item"
  127. />
  128. </el-select>
  129. </el-form-item>
  130. <!-- <el-form-item label="使用者" prop="user">
  131. <el-select v-model="form.user" placeholder="请选择" style="min-width: 200px;">
  132. <el-option
  133. v-for="(item,index) in userOptions"
  134. :key="index"
  135. :label="item.name"
  136. :value="item.id"
  137. />
  138. </el-select>
  139. </el-form-item> -->
  140. <el-button type="primary" size="small" :loading="fetchLoading" @click="fetchAssetsData(true)">查询</el-button>
  141. </el-form>
  142. <div v-if="showFilterList" class="filter-list">
  143. <!-- <div v-if="fetchLoading">
  144. <el-icon class="is-loading"><i class="el-icon-loading" /></el-icon> ...
  145. </div>
  146. <div v-else> -->
  147. <div><span>{{ totalAssets }}</span>项资产</div>
  148. <el-table v-loading="fetchLoading" stripe style="width: 100%; margin-top: 20px;" height="calc(100vh - 460px)" :data="listTable">
  149. <!-- <el-table-column type="index" label="序号" align="center" width="55" /> -->
  150. <el-table-column label="序号" align="center" width="55">
  151. <template slot-scope="scope">
  152. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  153. </template>
  154. </el-table-column>
  155. <!-- <el-table-column prop="result" label="结果">
  156. <template slot-scope="scope">
  157. <el-tag v-if="scope.row.result === 1" type="success">正常</el-tag>
  158. <el-tag v-if="scope.row.result === 2" type="error">盘亏</el-tag>
  159. <el-tag v-if="scope.row.result === 3">盘盈</el-tag>
  160. </template>
  161. </el-table-column> -->
  162. <el-table-column prop="mark" label="资产编码" min-width="220px" :show-overflow-tooltip="true" />
  163. <el-table-column prop="name" label="资产名称" min-width="220px" :show-overflow-tooltip="true" />
  164. <!-- <el-table-column prop="remark" label="盘点备注" min-width="100px" />
  165. <el-table-column prop="status" label="资产状态" min-width="100px" /> -->
  166. <el-table-column prop="capitaltyepname" label="资产类型" min-width="100px" />
  167. <el-table-column prop="departmentname" label="使用部门" min-width="260px" :show-overflow-tooltip="true" />
  168. <el-table-column prop="resourcename" label="使用人" min-width="120px" />
  169. <!-- <el-table-column prop="blongsubcompanyname" label="所属单位" min-width="180px" :show-overflow-tooltip="true" /> -->
  170. <el-table-column prop="blongdepartmentname" label="所属部门" min-width="180px" :show-overflow-tooltip="true" />
  171. <el-table-column prop="glrname" label="管理人" min-width="120px" />
  172. <el-table-column prop="cfd" label="存放地" min-width="260px" :show-overflow-tooltip="true" />
  173. </el-table>
  174. <div v-if="listTable.length !== 0" style="margin-top: 10px; display: flex; justify-content: flex-end;">
  175. <el-pagination
  176. style="margin: 10px 0 !important;"
  177. :current-page="currentPage"
  178. :page-sizes="[10, 20, 50, 100]"
  179. :page-size="pageSize"
  180. layout="total, sizes, prev, pager, next"
  181. :total="totalAssets"
  182. @size-change="handleSizeChange"
  183. @current-change="handleCurrentChange"
  184. />
  185. </div>
  186. <!-- </div> -->
  187. </div>
  188. <div slot="footer" class="dialog-footer">
  189. <el-button type="text" @click="crud.cancelCU">取消</el-button>
  190. <el-button style="width: 84px !important;" :loading="crud.status.cu === 2" type="primary" :disabled="!hasAssets" @click="crud.submitCU">生成盘点单</el-button>
  191. </div>
  192. </div>
  193. </el-dialog>
  194. <!-- 资产详情对话框 -->
  195. <el-dialog
  196. class="inventory-detail-dialog"
  197. :visible.sync="detailDialogVisible"
  198. title="盘点任务详情"
  199. width="1000px"
  200. append-to-body
  201. :close-on-click-modal="false"
  202. :modal-append-to-body="false"
  203. >
  204. <div v-if="selectedTask" class="task-detail">
  205. <!-- 任务基本信息 -->
  206. <el-table class="archives-table" stripe style="width: 100%;" :data="selectedTask">
  207. <el-table-column prop="billNo" label="任务编号" min-width="180px" :show-overflow-tooltip="true" />
  208. <!-- <el-table-column prop="stockName" label="任务名称" min-width="150px" />
  209. <el-table-column prop="stockManager" label="负责人" min-width="100px" /> -->
  210. <el-table-column prop="warehouseName" label="所属仓库" min-width="300px" :show-overflow-tooltip="true" />
  211. <!-- <el-table-column prop="stockExecutor" label="盘点执行人" min-width="120px" /> -->
  212. <el-table-column prop="takeDate" label="发起时间" width="180px">
  213. <template slot-scope="scope">
  214. <div>{{ scope.row.takeDate | parseTime }}</div>
  215. </template>
  216. </el-table-column>
  217. <el-table-column prop="takeStart" label="盘点开始时间" width="180px">
  218. <template slot-scope="scope">
  219. <div>{{ scope.row.takeStart | parseTime }}</div>
  220. </template>
  221. </el-table-column>
  222. <el-table-column prop="takeEnd" label="盘点结束时间" width="180px">
  223. <template slot-scope="scope">
  224. <div>{{ scope.row.takeEnd | parseTime }}</div>
  225. </template>
  226. </el-table-column>
  227. <el-table-column prop="stockNum" label="总数" min-width="80px" />
  228. <el-table-column prop="correctQty" label="账实相符数" min-width="120px" />
  229. <el-table-column prop="excessQty" label="盘盈数" min-width="80px" />
  230. <el-table-column prop="missingQty" label="盘亏数" min-width="80px" />
  231. <el-table-column prop="status" label="盘点状态" align="center" min-width="100px">
  232. <template slot-scope="scope">
  233. <span v-if="(scope.row.status || '').toString().trim() === '0'" class="row-state row-lending">未盘点</span>
  234. <span v-if="(scope.row.status || '').toString().trim() === '-1'" class="row-state row-lending state-active">已终止</span>
  235. <span v-if="(scope.row.status || '').toString().trim() === '1'" class="row-state row-warehousing state-active">盘点中</span>
  236. <span v-if="(scope.row.status || '').toString().trim() === '2'" class="row-state row-binding state-active">已完成</span>
  237. </template>
  238. </el-table-column>
  239. </el-table>
  240. <!-- 盘点清单 -->
  241. <div class="inventory-list">
  242. <div style="display: flex; justify-content: space-between; align-items: center;">
  243. <ul class="tab-nav">
  244. <li :class="{'active-tab-nav': tabIndex == 0}" @click="changeActiveTab(0)">盘点清单</li>
  245. <li :class="{'active-tab-nav': tabIndex == 1}" @click="changeActiveTab(1)">盘盈列表</li>
  246. </ul>
  247. <div>
  248. <el-select v-if="tabIndex===0" v-model="taskResult" clearable size="small" placeholder="状态" class="filter-item" style="width: 80px" @change="doSearch">
  249. <el-option v-for="item in taskResultOptions" :key="item.value" :label="item.label" :value="item.value" />
  250. </el-select>
  251. <el-input
  252. v-model="keyWord"
  253. size="small"
  254. clearable
  255. placeholder="请输入关键字搜索"
  256. style="width: 300px;"
  257. class="input-prepend filter-item"
  258. @keyup.enter.native="doSearch"
  259. @clear="doSearch"
  260. >
  261. <el-select slot="prepend" v-model="optionVal" style="width: 92px">
  262. <el-option
  263. v-for="item in options"
  264. :key="item.value"
  265. :label="item.label"
  266. :value="item.value"
  267. />
  268. </el-select>
  269. </el-input>
  270. <el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" @click="doSearch">搜索</el-button>
  271. </div>
  272. </div>
  273. <el-table v-loading="inventoryLoading" stripe style="width: 100%;" height="calc(100vh - 460px)" :data="inventoryList">
  274. <el-table-column label="序号" align="center" width="55">
  275. <template slot-scope="scope">
  276. {{ (inventoryPage - 1) * inventoryPageSize + scope.$index + 1 }}
  277. </template>
  278. </el-table-column>
  279. <el-table-column v-if="tabIndex === 0" prop="taskResult" label="结果">
  280. <template slot-scope="scope">
  281. <el-tag v-if="scope.row.taskResult === 0">未盘</el-tag>
  282. <el-tag v-if="scope.row.taskResult === 1" type="success">正常</el-tag>
  283. <el-tag v-if="scope.row.taskResult === 2" type="error">盘亏</el-tag>
  284. </template>
  285. </el-table-column>
  286. <el-table-column v-else prop="taskResult" label="结果">
  287. <template>
  288. <el-tag class="other-tag">盘盈</el-tag>
  289. </template>
  290. </el-table-column>
  291. <el-table-column prop="assetMark" label="资产编码" min-width="220px" :show-overflow-tooltip="true">
  292. <template slot-scope="scope">
  293. <span v-if="tabIndex === 0">{{ scope.row.assetMark }}</span>
  294. <span v-else>
  295. {{
  296. (scope.row.assetInfo && scope.row.assetInfo.mark)
  297. ? scope.row.assetInfo.mark
  298. : (scope.row.superfluous && scope.row.superfluous.mark) || '-'
  299. }}
  300. </span>
  301. </template>
  302. </el-table-column>
  303. <el-table-column prop="assetName" label="资产名称" min-width="180px" :show-overflow-tooltip="true">
  304. <template slot-scope="scope">
  305. <span v-if="tabIndex === 0">{{ scope.row.assetName }}</span>
  306. <span v-else>
  307. {{ scope.row.assetInfo ? scope.row.assetInfo.name : '' }}
  308. </span>
  309. </template>
  310. </el-table-column>
  311. <el-table-column prop="taskRemark" label="盘点备注" min-width="100px">
  312. <template slot-scope="scope">
  313. <span v-if="tabIndex === 0">{{ scope.row.taskRemark }}</span>
  314. <span v-else>
  315. {{ scope.row.assetInfo ? scope.row.assetInfo.remark : '' }}
  316. </span>
  317. </template>
  318. </el-table-column>
  319. <el-table-column prop="capitalStatus" label="资产状态" min-width="100px">
  320. <template slot-scope="scope">
  321. <span v-if="tabIndex === 0">{{ scope.row.capitalStatus }}</span>
  322. <span v-else>
  323. {{ scope.row.assetInfo ? scope.row.assetInfo.capitalStatus : '' }}
  324. </span>
  325. </template>
  326. </el-table-column>
  327. <el-table-column prop="capitaltypename" label="资产类型" min-width="100px">
  328. <template slot-scope="scope">
  329. <span v-if="tabIndex === 0">{{ scope.row.capitaltypename }}</span>
  330. <span v-else>
  331. {{ scope.row.assetInfo ? scope.row.assetInfo.capitaltypename : '' }}
  332. </span>
  333. </template>
  334. </el-table-column>
  335. <el-table-column prop="blongdepartmentname" label="所属部门" min-width="160px" :show-overflow-tooltip="true">
  336. <template slot-scope="scope">
  337. <span v-if="tabIndex === 0">{{ scope.row.blongdepartmentname }}</span>
  338. <span v-else>
  339. {{ scope.row.assetInfo ? scope.row.assetInfo.blongdepartmentname : '' }}
  340. </span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column prop="departmentname" label="使用部门" min-width="160px" :show-overflow-tooltip="true">
  344. <template slot-scope="scope">
  345. <span v-if="tabIndex === 0">{{ scope.row.departmentname }}</span>
  346. <span v-else>
  347. {{ scope.row.assetInfo ? scope.row.assetInfo.departmentname : '' }}
  348. </span>
  349. </template>
  350. </el-table-column>
  351. <el-table-column prop="resourcename" label="使用人" min-width="100px" :show-overflow-tooltip="true">
  352. <template slot-scope="scope">
  353. <span v-if="tabIndex === 0">{{ scope.row.resourcename }}</span>
  354. <span v-else>
  355. {{ scope.row.assetInfo ? scope.row.assetInfo.resourcename : '' }}
  356. </span>
  357. </template>
  358. </el-table-column>
  359. <!-- <el-table-column prop="blongsubcompanyname" label="所属单位" min-width="180px" :show-overflow-tooltip="true" />
  360. <el-table-column prop="blongdepartmentname" label="所属部门" min-width="180px" :show-overflow-tooltip="true" /> -->
  361. <el-table-column prop="glrname" label="管理人" min-width="100px" :show-overflow-tooltip="true">
  362. <template slot-scope="scope">
  363. <span v-if="tabIndex === 0">{{ scope.row.glrname }}</span>
  364. <span v-else>
  365. {{ scope.row.assetInfo ? scope.row.assetInfo.glrname : '' }}
  366. </span>
  367. </template>
  368. </el-table-column>
  369. <el-table-column prop="cfd" label="存放地" min-width="260px" :show-overflow-tooltip="true">
  370. <template slot-scope="scope">
  371. <span v-if="tabIndex === 0">{{ scope.row.cfd }}</span>
  372. <span v-else>
  373. {{ scope.row.assetInfo ? scope.row.assetInfo.cfd : '' }}
  374. </span>
  375. </template>
  376. </el-table-column>
  377. <el-table-column v-if="tabIndex === 1" prop="taskTime" label="盘点时间" width="160px">
  378. <template slot-scope="scope">
  379. <!-- 有资产信息 显示 - -->
  380. <span v-if="scope.row.assetInfo"> - </span>
  381. <!-- 没有资产信息 安全显示时间没有时间也显示 - -->
  382. <span v-else-if="scope.row.superfluous && scope.row.superfluous.taskTime">
  383. {{ scope.row.superfluous.taskTime | parseTime }}
  384. </span>
  385. <!-- 都没有 显示 - -->
  386. <span v-else> - </span>
  387. </template>
  388. </el-table-column>
  389. </el-table>
  390. <div style="margin-top: 10px; display: flex; justify-content: flex-end;">
  391. <el-pagination
  392. :key="`tab-${tabIndex}-${inventoryTotal}`"
  393. :current-page="inventoryPage"
  394. :page-sizes="[10, 20, 50, 100]"
  395. :page-size="inventoryPageSize"
  396. layout="total, sizes, prev, pager, next"
  397. :total="inventoryTotal"
  398. style="margin: 20px 0 !important;"
  399. @size-change="handleInventorySizeChange"
  400. @current-change="handleInventoryCurrentChange"
  401. />
  402. </div>
  403. </div>
  404. </div>
  405. <div v-else>
  406. 暂无数据
  407. </div>
  408. </el-dialog>
  409. </div>
  410. </template>
  411. <script>
  412. // import { getAssetDeptTree } from '@/api/system/dept'
  413. import crudAsset, { FetchInitAssetInfo, FetchStockTakeDetailsByTaskId, FetchStockTakeSuperfluousByTaskId, FetchStockSettle, FetchDeleteStockTake, add } from '@/api/asset/index'
  414. import { FetchWarehouseTree } from '@/api/assetDevice/index'
  415. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  416. import crudOperation from '@crud/CRUD.operation'
  417. import pagination from '@crud/Pagination'
  418. // import { exportFile } from '@/utils/index'
  419. import qs from 'qs'
  420. import { mapGetters } from 'vuex'
  421. // user: null, id: null, departmentname: null
  422. const defaultForm = { }
  423. export default {
  424. name: 'Stocktaking',
  425. components: { pagination, crudOperation },
  426. cruds() {
  427. return CRUD({ title: '资产盘点', url: 'api/stocktake/initStockTakeBill', crudMethod: { ...crudAsset }, optShow: {
  428. add: false,
  429. edit: false,
  430. del: false,
  431. reset: true,
  432. download: false,
  433. group: false
  434. }})
  435. },
  436. mixins: [presenter(), header(), form(defaultForm), crud()],
  437. data() {
  438. return {
  439. clearCacheLoading: false,
  440. addLoading: false,
  441. settleLoading: false,
  442. permission: {
  443. add: [],
  444. edit: [],
  445. del: []
  446. },
  447. departmentOptions: [],
  448. userOptions: [
  449. { id: 1, name: '张三' },
  450. { id: 2, name: '李四' },
  451. { id: 3, name: '王五' }
  452. ],
  453. rules: {
  454. departmentname: [
  455. { required: true, message: '请选择所属部门', trigger: 'change' }
  456. ]
  457. // user: [
  458. // { required: true, message: '请选择使用者', trigger: 'change' }
  459. // ]
  460. },
  461. keyWord: '',
  462. optionVal: 'assetMark',
  463. options: [
  464. { value: 'assetMark', label: '资产编号' },
  465. { value: 'assetName', label: '资产名称' }
  466. ],
  467. fetchLoading: false,
  468. showFilterList: false,
  469. listTable: [],
  470. totalAssets: 0,
  471. currentPage: 1,
  472. pageSize: 10,
  473. detailDialogVisible: false,
  474. selectedTask: [],
  475. inventoryList: [],
  476. inventoryLoading: false,
  477. inventoryPage: 1,
  478. inventoryPageSize: 10,
  479. inventoryTotal: 0,
  480. statusOptions: [
  481. { value: 0, label: '未盘点' },
  482. { value: 1, label: '盘点中' },
  483. // { value: -1, label: '已终止' },
  484. { value: 2, label: '已完成' }
  485. ],
  486. warehouseOptions: [],
  487. query: {
  488. billNo: '',
  489. warehouseId: '',
  490. status: ''
  491. },
  492. tabIndex: 0,
  493. taskResult: '',
  494. taskResultOptions: [
  495. { value: 0, label: '未盘' },
  496. { value: 1, label: '正常' },
  497. { value: 2, label: '盘亏' }
  498. ],
  499. assetMark: '',
  500. assetName: ''
  501. }
  502. },
  503. computed: {
  504. ...mapGetters([
  505. 'baseApi',
  506. 'user'
  507. ]),
  508. hasAssets() {
  509. return this.totalAssets > 0
  510. }
  511. },
  512. created() {
  513. // this.getAssetDeptTree()
  514. FetchWarehouseTree().then(res => {
  515. this.warehouseOptions = res
  516. }).catch(() => {
  517. })
  518. },
  519. mounted() {
  520. },
  521. methods: {
  522. [CRUD.HOOK.beforeRefresh]() {
  523. // 传递搜索参数
  524. console.log('this.user', this.user)
  525. this.crud.params.billNo = this.query.billNo
  526. this.crud.params.warehouseId = this.query.warehouseId
  527. this.crud.params.status = this.query.status
  528. this.crud.query.userId = this.user.id
  529. // 保存原始参数
  530. this.originalPage = this.crud.page.page
  531. this.originalSize = this.crud.page.size
  532. // 添加pageNo和pageSize参数
  533. this.crud.params.pageNo = this.crud.page.page
  534. this.crud.params.pageSize = this.crud.page.size
  535. // 清空page和size参数
  536. this.crud.params.page = undefined
  537. this.crud.params.size = undefined
  538. },
  539. [CRUD.HOOK.afterRefresh]() {
  540. // 恢复原始参数
  541. if (this.originalPage !== undefined) {
  542. this.crud.page.page = this.originalPage
  543. this.crud.page.size = this.originalSize
  544. // 移除pageNo和pageSize参数
  545. delete this.crud.params.pageNo
  546. delete this.crud.params.pageSize
  547. delete this.crud.params.page
  548. delete this.crud.params.size
  549. }
  550. // 为每一行数据添加loading状态
  551. this.crud.data.forEach(item => {
  552. if (!item.deleteLoading) {
  553. this.$set(item, 'deleteLoading', false)
  554. }
  555. if (!item.settleLoading) {
  556. this.$set(item, 'settleLoading', false)
  557. }
  558. if (!item.exportLoading) {
  559. this.$set(item, 'exportLoading', false)
  560. }
  561. })
  562. },
  563. // 新增前
  564. [CRUD.HOOK.beforeToAdd](crud, form) {
  565. // 重置表单数据
  566. crud.form.departmentname = null
  567. // crud.form.user = null
  568. // 重置相关状态
  569. this.showFilterList = false
  570. this.listTable = []
  571. this.totalAssets = 0
  572. this.currentPage = 1
  573. this.pageSize = 10
  574. // 重置表单验证状态
  575. if (this.$refs.form) {
  576. this.$refs.form.resetFields()
  577. }
  578. },
  579. // 编辑前
  580. [CRUD.HOOK.beforeToEdit](crud, form) {
  581. },
  582. // 提交前做的操作
  583. [CRUD.HOOK.afterValidateCU](crud) {
  584. console.log(crud.form)
  585. return true
  586. },
  587. // 关闭弹框前的操作
  588. [CRUD.HOOK.beforeAddCancel](crud) {
  589. // 重置表单数据
  590. crud.form.departmentname = null
  591. // crud.form.user = null
  592. // 重置相关状态
  593. this.showFilterList = false
  594. this.listTable = []
  595. this.totalAssets = 0
  596. this.currentPage = 1
  597. this.pageSize = 10
  598. // 重置表单验证状态
  599. if (this.$refs.form) {
  600. this.$refs.form.resetFields()
  601. }
  602. },
  603. // getAssetDeptTree() {
  604. // getAssetDeptTree().then(res => {
  605. // this.departmentOptions = res
  606. // })
  607. // },
  608. searchChange(val) {
  609. if (val) {
  610. this.keyWord = ''
  611. }
  612. },
  613. resetQuery() {
  614. // 重置查询参数
  615. this.query.billNo = ''
  616. this.query.warehouseId = ''
  617. this.query.status = ''
  618. this.crud.toQuery()
  619. },
  620. // 触发单选
  621. clickRowHandler(row) {
  622. this.$refs.table.clearSelection()
  623. this.$refs.table.toggleRowSelection(row)
  624. },
  625. handleSettle(row) {
  626. // if ((row.status || '').toString().trim() !== '1') {
  627. // this.$message({ message: '当前任务不在盘点中,不可结算', type: 'error', offset: 8 })
  628. // return
  629. // }
  630. row.settleLoading = true
  631. FetchStockSettle(row.id).then(res => {
  632. row.settleLoading = false
  633. if (res.data === null) {
  634. this.$message({ message: res.message, type: 'error', offset: 8 })
  635. } else {
  636. this.$message({ message: '结算操作成功', type: 'success', offset: 8 })
  637. this.crud.refresh()
  638. }
  639. }).catch(err => {
  640. row.settleLoading = false
  641. console.log(err)
  642. this.$message({ message: '结算操作失败', type: 'error', offset: 8 })
  643. })
  644. },
  645. handleExport(row) {
  646. row.exportLoading = true
  647. let loadingClosed = false
  648. const params = { id: row.id }
  649. const exportUrl = this.baseApi + '/api/stocktake/exportStockTakeData?' + qs.stringify(params, { indices: false })
  650. const link = document.createElement('a')
  651. link.style.display = 'none'
  652. link.href = exportUrl
  653. document.body.appendChild(link)
  654. link.click()
  655. // 正常关闭
  656. const timer = setTimeout(() => {
  657. if (!loadingClosed) {
  658. loadingClosed = true
  659. row.exportLoading = false
  660. document.body.removeChild(link)
  661. }
  662. }, 1500)
  663. // 兜底最长等待3秒
  664. setTimeout(() => {
  665. if (!loadingClosed) {
  666. clearTimeout(timer)
  667. row.exportLoading = false
  668. }
  669. }, 3000)
  670. },
  671. doSearch() {
  672. if (this.optionVal === 'assetMark') {
  673. this.assetMark = this.keyWord
  674. this.assetName = ''
  675. } else {
  676. this.assetName = this.keyWord
  677. this.assetMark = ''
  678. }
  679. this.inventoryPage = 1
  680. this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
  681. },
  682. toDelete(datas) {
  683. this.$confirm('此操作将删除当前所选盘点任务' + '<span>你是否还要继续?</span>', '提示', {
  684. confirmButtonText: '继续',
  685. cancelButtonText: '取消',
  686. type: 'warning',
  687. dangerouslyUseHTMLString: true
  688. }).then(() => {
  689. datas.deleteLoading = true
  690. FetchDeleteStockTake(datas.id).then((res) => {
  691. datas.deleteLoading = false
  692. if (res.data === null) {
  693. this.$message({ message: res.message, type: 'error', offset: 8 })
  694. } else {
  695. this.$message({ message: '删除成功', type: 'success', offset: 8 })
  696. }
  697. this.crud.refresh()
  698. }).catch(err => {
  699. datas.deleteLoading = false
  700. console.log(err)
  701. })
  702. }).catch(() => {
  703. })
  704. },
  705. // 清空缓存
  706. // clearCacheDatas(datas) {
  707. // this.$confirm('此操作将清空盘点缓存数据' + '<span>你是否还要继续?</span>', '提示', {
  708. // confirmButtonText: '继续',
  709. // cancelButtonText: '取消',
  710. // type: 'warning',
  711. // dangerouslyUseHTMLString: true
  712. // }).then(() => {
  713. // this.clearCacheLoading = true
  714. // }).catch(() => {
  715. // this.clearCacheLoading = false
  716. // })
  717. // },
  718. // 获取资产数据
  719. fetchAssetsData(isBtn) {
  720. this.$refs.form.validate((valid) => {
  721. if (valid) {
  722. if (isBtn) {
  723. this.fetchLoading = true
  724. }
  725. this.showFilterList = true
  726. const params = {
  727. 'departmentname': this.crud.form.departmentname,
  728. 'pageNo': this.currentPage,
  729. 'pageSize': this.pageSize
  730. }
  731. FetchInitAssetInfo(params).then(res => {
  732. console.log('res', res)
  733. this.listTable = res.records
  734. this.totalAssets = res.total
  735. this.fetchLoading = false
  736. }).catch(err => {
  737. console.log(err)
  738. this.$message({ message: '获取数据失败', type: 'error', offset: 8 })
  739. this.fetchLoading = false
  740. })
  741. }
  742. })
  743. },
  744. // 处理分页大小变化
  745. handleSizeChange(size) {
  746. this.pageSize = size
  747. this.fetchAssetsData()
  748. },
  749. // 处理当前页码变化
  750. handleCurrentChange(current) {
  751. this.currentPage = current
  752. this.fetchAssetsData()
  753. },
  754. // 处理部门选择变化
  755. handleDepartmentChange() {
  756. this.currentPage = 1
  757. this.fetchAssetsData()
  758. },
  759. // 处理双击行事件
  760. handleRowDblClick(row) {
  761. this.tabIndex = 0
  762. this.selectedTask = [row]
  763. this.detailDialogVisible = true
  764. this.taskResult = ''
  765. this.assetMark = ''
  766. this.assetName = ''
  767. this.keyWord = ''
  768. this.inventoryPage = 1
  769. this.fetchInventoryList()
  770. },
  771. changeActiveTab(index) {
  772. this.tabIndex = index
  773. this.inventoryPage = 1
  774. this.taskResult = ''
  775. this.assetMark = ''
  776. this.assetName = ''
  777. this.keyWord = ''
  778. this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
  779. },
  780. // 获取盘点清单数据
  781. fetchInventoryList() {
  782. if (!this.selectedTask) return
  783. this.inventoryLoading = true
  784. const params = {
  785. taskId: this.selectedTask[0].id,
  786. pageNo: this.inventoryPage,
  787. pageSize: this.inventoryPageSize,
  788. taskResult: this.taskResult,
  789. assetMark: this.assetMark,
  790. assetName: this.assetName
  791. }
  792. FetchStockTakeDetailsByTaskId(params).then(res => {
  793. this.inventoryList = res.records
  794. this.inventoryTotal = res.total
  795. this.inventoryLoading = false
  796. }).catch(err => {
  797. console.log(err)
  798. this.$message({ message: '获取数据失败', type: 'error', offset: 8 })
  799. this.inventoryLoading = false
  800. })
  801. },
  802. // 获取盘盈列表数据
  803. getStockTakeSuperfluousByTaskId() {
  804. if (!this.selectedTask) return
  805. this.inventoryLoading = true
  806. const params = {
  807. taskId: this.selectedTask[0].id,
  808. pageNo: this.inventoryPage,
  809. pageSize: this.inventoryPageSize,
  810. assetMark: this.assetMark,
  811. assetName: this.assetName
  812. }
  813. FetchStockTakeSuperfluousByTaskId(params).then(res => {
  814. this.inventoryList = res.data.records
  815. this.inventoryTotal = res.data.total
  816. this.inventoryLoading = false
  817. }).catch(err => {
  818. console.log(err)
  819. this.$message({ message: '获取数据失败', type: 'error', offset: 8 })
  820. this.inventoryLoading = false
  821. })
  822. },
  823. // 处理盘点清单分页大小变化
  824. handleInventorySizeChange(size) {
  825. this.inventoryPage = 1
  826. this.inventoryPageSize = size
  827. this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
  828. },
  829. // 处理盘点清单当前页码变化
  830. handleInventoryCurrentChange(current) {
  831. this.inventoryPage = current
  832. this.tabIndex === 1 ? this.getStockTakeSuperfluousByTaskId() : this.fetchInventoryList()
  833. },
  834. // 直接触发新增接口
  835. addStockTakeBill() {
  836. this.addLoading = true
  837. add({}).then(res => {
  838. if (res.data === null) {
  839. this.$message({ message: res.message, type: 'error', offset: 8 })
  840. } else {
  841. this.$message({ message: '新增成功', type: 'success', offset: 8 })
  842. this.crud.refresh()
  843. }
  844. this.addLoading = false
  845. }).catch(err => {
  846. console.log(err)
  847. this.$message({ message: '新增失败', type: 'error', offset: 8 })
  848. this.addLoading = false
  849. })
  850. }
  851. }
  852. }
  853. </script>
  854. <style lang="scss" scoped>
  855. .group-form{
  856. .el-form-item{
  857. &:nth-child(odd){
  858. margin-right: 0;
  859. }
  860. &.form-item-style{
  861. margin-right: 40px;
  862. }
  863. ::v-deep .el-form-item__content{
  864. width: 300px !important;
  865. }
  866. }
  867. }
  868. ::v-deep .input-prepend .el-input__inner{
  869. padding-left: 100px;
  870. }
  871. ::v-deep .el-tag{
  872. &.el-tag--small{
  873. color: #0348f3 !important;
  874. background-color: #eef5fe !important;
  875. border-color: #c1dbfc !important;
  876. }
  877. &.el-tag--success {
  878. background-color: #e7faf0 !important;
  879. border-color: #d0f5e0!important;
  880. color: #13ce66!important;
  881. }
  882. &.el-tag--info {
  883. background-color: #f4f4f5 !important;
  884. border-color: #f4f4f5!important;
  885. color: #909399!important;
  886. }
  887. &.el-tag--error {
  888. background-color: #fbc0b5 !important;
  889. border-color: #fcab9d !important;
  890. color: #ed4a41!important;
  891. }
  892. &.other-tag{
  893. color: #FF8329 !important;
  894. background-color: #FFF3E5 !important;
  895. border-color: #FEBD98 !important;
  896. }
  897. }
  898. .task-detail {
  899. padding: 10px 0;
  900. }
  901. .task-info {
  902. margin-bottom: 20px;
  903. }
  904. .task-info h3,
  905. .inventory-list h3 {
  906. margin-bottom: 10px;
  907. font-size: 16px;
  908. font-weight: bold;
  909. color: #333;
  910. }
  911. .inventory-list {
  912. margin-top: 30px;
  913. }
  914. .inventory-list .el-table {
  915. margin-top: 10px;
  916. }
  917. .inventory-detail-dialog{
  918. ::v-deep .el-dialog__body{
  919. padding: 0 !important;
  920. }
  921. }
  922. .el-table .el-button{
  923. padding: 7px 10px !important;
  924. }
  925. .tab-nav{
  926. display: flex;
  927. justify-content: flex-start;
  928. margin: 25px 0 18px 0;
  929. font-size: 16px;
  930. font-weight: bold;
  931. color: #333;
  932. // padding: 0 0 0 20px;
  933. border-bottom: 1px solid #EDEFF3;
  934. li{
  935. margin-right: 30px;
  936. cursor: default;
  937. &.active-tab-nav{
  938. padding-bottom: 10px;
  939. color: #0348F3;
  940. border-bottom: 3px solid #0348F3;
  941. }
  942. }
  943. }
  944. </style>