【前端】智能库房综合管理系统前端项目
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.

330 lines
11 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="app-container">
  3. <div class="head-container" style="padding:0 0 20px 0">
  4. <div>
  5. <el-button size="mini" class="iconfont icon-xinzengpandian-fanbai" @click="handleAdd">新增</el-button>
  6. <el-button
  7. icon="el-icon-delete"
  8. size="mini"
  9. style="margin:0 0 0 10px"
  10. :disabled="!(selections.length) "
  11. @click="handleDel"
  12. >删除</el-button>
  13. <el-button size="mini" icon="el-icon-tickets" :disabled="!(selections.length===1 && selections[0].checkState === 1) " @click="handleCalc">结算</el-button>
  14. <el-button :loading="btnLoading" size="mini" :disabled="!(selections.length ===1)" icon="el-icon-download" @click="handleExport">导出</el-button>
  15. <el-select v-model="stateVal" class="filter-item" style="width: 90px;height:30px;margin:0 10px 0 10px" @change="crud.toQuery">
  16. <el-option v-for="item in stateOptions" :key="item.value" :label="item.label" :value="item.value" />
  17. </el-select>
  18. <el-input
  19. v-model="keyWord"
  20. size="small"
  21. clearable
  22. placeholder="请输入关键词"
  23. style="width: 300px;margin-right:10px"
  24. class="input-prepend filter-item"
  25. @keyup.enter.native="crud.toQuery"
  26. >
  27. <el-select slot="prepend" v-model="cateSearch" style="width: 100px;">
  28. <el-option
  29. v-for="item in cateSearchOptions"
  30. :key="item.value"
  31. :label="item.label"
  32. :value="item.value"
  33. />
  34. </el-select>
  35. </el-input>
  36. <rrOperation />
  37. </div>
  38. <div>
  39. <el-button size="mini" icon="el-icon-brush" @click="handleClear">清空缓存</el-button>
  40. </div>
  41. <!-- <crudOperation :permission="permission" /> -->
  42. </div>
  43. <div class="container-wrap" style="min-height: calc(100vh - 242px)">
  44. <span class="right-top-line" />
  45. <span class="left-bottom-line" />
  46. <!--表格渲染-->
  47. <el-table
  48. ref="table"
  49. :data="crud.data"
  50. :cell-class-name="cell"
  51. style="min-width: 100%"
  52. height="calc(100vh - 315px)"
  53. @selection-change="selectionChangeHandler"
  54. @row-click="clickRowHandler"
  55. @row-dblclick="handleDbClick"
  56. >
  57. <el-table-column type="selection" width="55" />
  58. <el-table-column type="index" align="center" label="序号" width="55" />
  59. <el-table-column prop="id" align="center" label="盘点单号" min-width="100" />
  60. <el-table-column prop="region" align="center" label="包含位置" min-width="140" />
  61. <el-table-column prop="checkState" align="center" label="盘点状态" min-width="60">
  62. <template slot-scope="scope">
  63. <!-- 已执行 / 待执行/执行中 -->
  64. <span class="clear">{{ scope.row.checkState | checkState }}</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="correct" align="center" label="在库档案" min-width="60" />
  68. <el-table-column prop="checked" align="center" label="已盘档案" min-width="60" />
  69. <el-table-column prop="abnormal" align="center" label="异常档案" min-width="60" />
  70. <el-table-column prop="noCheck" align="center" label="未盘档案" min-width="60" />
  71. <el-table-column prop="borrowed" align="center" label="已借档案" min-width="60" />
  72. <el-table-column prop="dislocation" align="center" label="错位档案" min-width="60" />
  73. <el-table-column prop="others" align="center" label="多余档案" min-width="60" />
  74. <el-table-column prop="create_time" align="center" label="创建时间" min-width="100">
  75. <template slot-scope="scope">
  76. <div>{{ scope.row.create_time | parseTime }}</div>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <!--分页组件-->
  81. <pagination />
  82. </div>
  83. <!-- 删除模态框 -->
  84. <el-dialog title="确认删除" :visible.sync="deleteVisible" :before-close="handleClose">
  85. <span class="dialog-right-top" />
  86. <span class="dialog-left-bottom" />
  87. <div class="setting-dialog">
  88. <div class="dialog-delt">
  89. <p><span style="font-size:16px">确定删除当前盘点任务</span></p>
  90. <p class="delt-tip"><span>提示确定删除后,该数据将无法找回!</span></p>
  91. </div>
  92. <div slot="footer" class="dialog-footer">
  93. <el-button type="primary" @click.native="handleDelConfirm">确定</el-button>
  94. </div>
  95. </div>
  96. </el-dialog>
  97. <!-- 新增模态框 -->
  98. <addCheck ref="addCheckDom" />
  99. <!-- 盘点详情 -->
  100. <checkDetail ref="checkDetailDom" />
  101. <!-- 结算 -->
  102. <CalcSteps ref="calcDom" />
  103. </div>
  104. </template>
  105. <script>
  106. import rrOperation from '@crud/RR.operation'
  107. import CRUD, { presenter } from '@crud/crud'
  108. import pagination from '@crud/Pagination'
  109. import addCheck from './module/addCheck.vue'
  110. import checkDetail from './module/checkDetail.vue'
  111. import { getArrange, getArrangeDetailes, checkDel, settlement, arrangeClean } from '@/api/archivesManage/archivesCheck'
  112. import { exportFile } from '@/utils/index'
  113. import qs from 'qs'
  114. import { mapGetters } from 'vuex'
  115. import CalcSteps from './module/calcSteps.vue'
  116. export default {
  117. name: 'ArchivesCheck',
  118. components: { pagination, rrOperation, addCheck, checkDetail, CalcSteps },
  119. filters: {
  120. checkState(val) {
  121. switch (val) {
  122. case 0:
  123. return '待执行'
  124. case 1:
  125. return '执行中'
  126. case 2:
  127. return '已执行'
  128. }
  129. }
  130. },
  131. mixins: [presenter()],
  132. cruds() {
  133. return CRUD({
  134. url: 'api/arrange/initArrangeList',
  135. // url: 'api/case/initCaseList',
  136. // crudMethod: caseCrudMethod,
  137. title: '档案盒',
  138. optShow: {
  139. add: false,
  140. edit: false,
  141. del: false,
  142. download: false,
  143. group: false
  144. }
  145. })
  146. },
  147. // dicts: ['job_status'],
  148. data() {
  149. return {
  150. btnLoading: false,
  151. // tableData: [],
  152. selections: [],
  153. keyWord: '',
  154. stateVal: -1,
  155. stateOptions: [
  156. { value: -1, label: '全部' },
  157. { value: 0, label: '待执行' },
  158. { value: 1, label: '执行中' },
  159. { value: 2, label: '已执行' }
  160. ],
  161. cateSearch: 'region',
  162. cateSearchOptions: [
  163. { value: 'region', label: '区域' },
  164. { value: 'id', label: '盘点单号' }
  165. ],
  166. deleteVisible: false
  167. }
  168. },
  169. computed: {
  170. ...mapGetters([
  171. 'baseApi'
  172. ])
  173. },
  174. methods: {
  175. // 获取数据前的处理
  176. [CRUD.HOOK.beforeRefresh]() {
  177. this.crud.downloadLoading = true
  178. this.crud.query.checkState = null
  179. this.crud.query.id = null
  180. this.crud.query.region = null
  181. if (this.stateVal > -1) {
  182. this.crud.query.checkState = this.stateVal
  183. }
  184. // todo
  185. if (this.cateSearch === 'region') {
  186. this.crud.query.region = this.keyWord
  187. } else {
  188. this.crud.query.id = this.keyWord
  189. console.log(this.crud.query.id)
  190. // this.crud.data = this.crud.data.filter(item => item.id.includes(this.keyWord))
  191. console.log(this.crud.data)
  192. }
  193. this.crud.downloadLoading = false
  194. },
  195. // 删除
  196. handleDel() {
  197. const bool = this.selections.every(item => item.checkState === 0)
  198. if (bool) {
  199. this.deleteVisible = true
  200. } else {
  201. this.$message({
  202. message: '只能删除待执行的档案',
  203. type: 'warning'
  204. })
  205. }
  206. },
  207. handleDelConfirm() {
  208. const ids = this.selections.map(item => { return item.id })
  209. checkDel(ids).then(res => {
  210. if (res) {
  211. this.crud.refresh()
  212. this.$message({
  213. message: '删除成功',
  214. type: 'success'
  215. })
  216. this.deleteVisible = false
  217. } else {
  218. this.$message.error('删除失败')
  219. }
  220. })
  221. },
  222. // 结算
  223. handleCalc() {
  224. const calcDom = this.$refs.calcDom
  225. calcDom.calcVisible = true
  226. calcDom.stepActive = 2
  227. const params = {
  228. 'orderId': this.selections[0].id
  229. }
  230. settlement(params).then(res => {
  231. if (res) {
  232. calcDom.stepActive = 3
  233. calcDom.res = 1
  234. calcDom.source = this.source
  235. // calcDom.calcVisible = false
  236. this.crud.refresh()
  237. } else {
  238. calcDom.stepActive = 3
  239. calcDom.res = 0
  240. }
  241. })
  242. },
  243. // 清空缓存
  244. handleClear() {
  245. arrangeClean().then(res => {
  246. // this.crud.refresh()
  247. this.$message({
  248. message: '清空成功',
  249. type: 'success'
  250. })
  251. })
  252. },
  253. // 新增盘点
  254. handleAdd() {
  255. this.$refs.addCheckDom.addFormVisible = true
  256. },
  257. handleClose() {
  258. this.deleteVisible = false
  259. },
  260. cell({ row, columnIndex }) {
  261. if (row.checkState === 2 && columnIndex === 4) {
  262. return 'have-clear'
  263. } else if (row.checkState === 0 && columnIndex === 4) {
  264. return 'fail-clear'
  265. } else if (row.checkState === 1 && columnIndex === 4) {
  266. return 'no-clear'
  267. }
  268. },
  269. selectionChangeHandler(val) {
  270. this.selections = val
  271. },
  272. clickRowHandler(row) {
  273. this.$refs.table.toggleRowSelection(row)
  274. },
  275. // 双击详情
  276. handleDbClick(row) {
  277. const checkDetailDom = this.$refs.checkDetailDom
  278. const params = {
  279. orderNo: row.id
  280. }
  281. getArrange(params).then(res => {
  282. checkDetailDom.rowData.push(res)
  283. })
  284. getArrangeDetailes(params).then(res => {
  285. checkDetailDom.tableData = res.content
  286. })
  287. checkDetailDom.detailVisible = true
  288. },
  289. // 导出
  290. handleExport() {
  291. this.btnLoading = true
  292. const id = this.selections[0].id
  293. const params = {
  294. 'orderNo': id
  295. }
  296. exportFile(this.baseApi + '/api/arrange/exportArrange?' + qs.stringify(params, { indices: false }))
  297. this.btnLoading = false
  298. }
  299. }
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. @import '~@/assets/styles/lend-manage.scss';
  304. @import "~@/assets/styles/archives-manage.scss";
  305. .head-container {
  306. color: #fff;
  307. display: flex;
  308. justify-content: space-between;
  309. }
  310. ::v-deep .el-dialog__footer {
  311. background-color: #031435;
  312. }
  313. .el-dialog .dialog-footer {
  314. padding: 0;
  315. margin: 0;
  316. }
  317. .svg-style{
  318. margin-right: 5px;
  319. }
  320. ::v-deep .input-prepend .el-input__inner{
  321. padding-left: 94px;
  322. }
  323. </style>