LossReport.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <ContainerQuery>
  3. <div slot="left">
  4. <el-button
  5. v-if="$accessCheck($Access.LossReportAddLossReport)"
  6. type="primary"
  7. size="small"
  8. @click="
  9. $router.push({ path: '/stock/WarehouseManagement/AddLossReport' })
  10. "
  11. >
  12. 新建报损
  13. </el-button>
  14. <!-- <el-button size="small" type="primary">导出</el-button>-->
  15. </div>
  16. <div slot="more">
  17. <el-form :inline="true" size="small">
  18. <el-form-item>
  19. <el-input
  20. v-model="search_form.keyword"
  21. placeholder="报损单号"
  22. style="width: 220px"
  23. clearable
  24. @keyup.enter.native="pageChange(1)"
  25. @clear="pageChange(1)"
  26. >
  27. <el-button
  28. slot="append"
  29. icon="el-icon-search"
  30. @click="pageChange(1)"
  31. ></el-button>
  32. </el-input>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-select
  36. v-model="search_form.warehouseId"
  37. placeholder="报损仓库"
  38. clearable
  39. style="width: 150px"
  40. @change="pageChange(1)"
  41. >
  42. <el-option
  43. v-for="item in outWare"
  44. :key="item.id"
  45. :label="item.warehouseName"
  46. :value="item.id"
  47. ></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item>
  51. <el-select
  52. v-model="search_form.status"
  53. clearable
  54. style="width: 150px"
  55. placeholder="审核状态"
  56. @change="pageChange(1)"
  57. >
  58. <el-option
  59. v-for="item in order_status"
  60. :key="item.value"
  61. :label="item.label"
  62. :value="item.value"
  63. ></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item>
  67. <el-date-picker
  68. v-model="search_form.time"
  69. clearable
  70. type="daterange"
  71. value-format="timestamp"
  72. range-separator="-"
  73. start-placeholder="报损开始日期"
  74. end-placeholder="报损结束日期"
  75. @change="LocationFrom"
  76. ></el-date-picker>
  77. </el-form-item>
  78. </el-form>
  79. </div>
  80. <el-table :data="loss_list" style="width: 100%">
  81. <el-table-column prop="id" label="ID" min-width="80"></el-table-column>
  82. <el-table-column prop="name" label="单号" min-width="200">
  83. <template slot-scope="scope">
  84. <span
  85. v-if="$accessCheck($Access.LossReportDetailLossReport)"
  86. class="click-div"
  87. @click="goDetail(scope.row)"
  88. >
  89. {{ scope.row.no }}
  90. </span>
  91. <span v-else class="click-div">
  92. {{ scope.row.no }}
  93. </span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. v-if="calloutFlag"
  98. prop="warehouseName"
  99. label="仓库"
  100. min-width="140"
  101. ></el-table-column>
  102. <el-table-column
  103. v-if="quantityFlag"
  104. prop="skuNum"
  105. label="sku数量"
  106. min-width="100"
  107. ></el-table-column>
  108. <el-table-column
  109. v-if="moneyFlag"
  110. prop="amount"
  111. label="报损总金额"
  112. min-width="100"
  113. >
  114. <template slot-scope="scope">
  115. {{ $_common.formattedNumber(scope.row.amount) }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="createTime" label="制单日期" min-width="120">
  119. <template slot-scope="scope">
  120. {{ $_common.formatDate(scope.row.createTime, "yyyy-MM-dd") }}
  121. </template>
  122. </el-table-column>
  123. <el-table-column
  124. v-if="auditStatusFlag"
  125. prop="address"
  126. label="审核状态"
  127. min-width="100"
  128. >
  129. <template slot-scope="scope">
  130. <span v-if="scope.row.auditStatus === 2" class="success-status">
  131. 已审核
  132. </span>
  133. <span v-else class="info-status">待审核</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. v-if="operationFlag"
  138. prop="operatorName"
  139. label="操作人"
  140. min-width="100"
  141. ></el-table-column>
  142. <el-table-column
  143. header-align="left"
  144. align="left"
  145. fixed="right"
  146. label="操作"
  147. min-width="120"
  148. >
  149. <template slot="header" slot-scope="scope">
  150. <span v-if="false">{{ scope.$index }}</span>
  151. <span class="operation">操作</span>
  152. <el-popover popper-class="custom-table-checkbox" trigger="click">
  153. <el-checkbox-group v-model="checkList">
  154. <el-checkbox
  155. v-for="(item, index) in columns"
  156. :key="index"
  157. :label="item.label"
  158. @change="change"
  159. ></el-checkbox>
  160. </el-checkbox-group>
  161. <el-button
  162. slot="reference"
  163. icon="el-icon-setting"
  164. type="text"
  165. ></el-button>
  166. </el-popover>
  167. </template>
  168. <template slot-scope="scope">
  169. <el-button
  170. v-if="$accessCheck($Access.LossReportAuditLossReport)"
  171. type="text"
  172. :disabled="parseInt(scope.row.auditStatus) === 2"
  173. @click="updateAuditStatus(scope.row)"
  174. >
  175. 审核
  176. </el-button>
  177. <!-- <el-button-->
  178. <!-- type="text"-->
  179. <!-- @click="$router.push(`/stock/WarehouseManagement/EditLossReport`)"-->
  180. <!-- >-->
  181. <!-- 编辑-->
  182. <!-- </el-button>-->
  183. <el-button
  184. v-if="$accessCheck($Access.LossReportDeleteLossReport)"
  185. type="text"
  186. :disabled="parseInt(scope.row.auditStatus) === 2"
  187. @click="delData(scope.row.id)"
  188. >
  189. 删除
  190. </el-button>
  191. </template>
  192. </el-table-column>
  193. </el-table>
  194. <FooterPage
  195. :page-size="pageSize"
  196. :total-page.sync="total"
  197. :current-page.sync="page"
  198. @pageChange="pageChange"
  199. @sizeChange="sizeChange"
  200. ></FooterPage>
  201. </ContainerQuery>
  202. </template>
  203. <script>
  204. import {
  205. getAllWarehouse,
  206. getAllReportLoss,
  207. auditReportLoss,
  208. deleteReportLoss,
  209. } from "@/api/Stock";
  210. export default {
  211. name: "LossReport",
  212. data() {
  213. return {
  214. search_form: {
  215. keyword: "",
  216. warehouseId: "",
  217. status: "",
  218. time: [],
  219. start: "",
  220. end: "",
  221. },
  222. total: 0,
  223. page: 1,
  224. pageSize: 10,
  225. outWare: [],
  226. order_status: [
  227. {
  228. value: 1,
  229. label: "待审核",
  230. },
  231. { value: 2, label: "已审核" },
  232. ],
  233. loss_list: [],
  234. checkList: ["仓库", "sku数量", "报损总金额", "审核状态", "操作人"],
  235. columns: [
  236. {
  237. label: "仓库",
  238. },
  239. {
  240. label: "sku数量",
  241. },
  242. {
  243. label: "报损总金额",
  244. },
  245. {
  246. label: "操作人",
  247. },
  248. {
  249. label: "审核状态",
  250. },
  251. ],
  252. unitFlag: true,
  253. calloutFlag: true,
  254. foldFlag: true,
  255. quantityFlag: true,
  256. unitPriceFlag: true,
  257. moneyFlag: true,
  258. operationFlag: true,
  259. auditStatusFlag: true,
  260. };
  261. },
  262. created() {
  263. this.getAllReportLoss();
  264. this.getAllWarehouse();
  265. },
  266. activated() {
  267. if (this.$_isInit()) return;
  268. this.getAllReportLoss();
  269. },
  270. methods: {
  271. pageChange(val) {
  272. this.page = val;
  273. this.getAllReportLoss();
  274. },
  275. sizeChange(val) {
  276. this.pageSize = val;
  277. this.pageChange(1);
  278. },
  279. // 请求仓库列表
  280. async getAllWarehouse() {
  281. const data = await getAllWarehouse({
  282. page: 1,
  283. pageSize: 999,
  284. });
  285. this.outWare = data.data;
  286. },
  287. // 获取时间
  288. LocationFrom(val) {
  289. if (val && val.length) {
  290. this.search_form.start = val[0] / 1000;
  291. this.search_form.end = val[1] / 1000 + 86399;
  292. } else {
  293. this.search_form.start = "";
  294. this.search_form.end = "";
  295. }
  296. this.pageChange(1);
  297. },
  298. change() {
  299. this.calloutFlag = this.checkList.some((item) => item === "仓库");
  300. this.quantityFlag = this.checkList.some((item) => item === "sku数量");
  301. this.moneyFlag = this.checkList.some((item) => item === "报损总金额");
  302. this.operationFlag = this.checkList.some((item) => item === "操作人");
  303. this.auditStatusFlag = this.checkList.some(
  304. (item) => item === "审核状态"
  305. );
  306. },
  307. goDetail(row) {
  308. this.$router.push({
  309. path: `/stock/WarehouseManagement/LossReportInfo/${row.id}`,
  310. });
  311. },
  312. async getAllReportLoss() {
  313. const { data, pageTotal } = await getAllReportLoss({
  314. page: this.page,
  315. pageSize: this.pageSize,
  316. warehouseId: this.search_form.warehouseId,
  317. no: this.search_form.keyword,
  318. auditStatus: this.search_form.status,
  319. star: this.search_form.start,
  320. end: this.search_form.end,
  321. });
  322. this.loss_list = data;
  323. this.total = pageTotal;
  324. },
  325. // 审核
  326. async updateAuditStatus(row) {
  327. this.$confirm("确定要审核通过该单据吗?", "提示", {
  328. confirmButtonText: "确定",
  329. cancelButtonText: "取消",
  330. type: "warning",
  331. }).then(async () => {
  332. const data = await auditReportLoss(row.id, {
  333. auditName: this.userName,
  334. });
  335. this.$message({
  336. type: "success",
  337. message: "审核成功",
  338. });
  339. this.getAllReportLoss();
  340. });
  341. },
  342. delData(id) {
  343. this.$confirm("确定要删除该单据吗?", "提示", {
  344. confirmButtonText: "确定",
  345. cancelButtonText: "取消",
  346. type: "warning",
  347. }).then(async () => {
  348. const data = await deleteReportLoss(id);
  349. this.$message({
  350. type: "success",
  351. message: "删除成功!",
  352. });
  353. this.getAllReportLoss();
  354. });
  355. },
  356. },
  357. };
  358. </script>
  359. <style scoped lang="scss">
  360. .goods-img-div {
  361. background-color: #f4f4f4;
  362. width: 60px;
  363. height: 60px;
  364. margin-right: 10px;
  365. }
  366. .goods-img {
  367. width: 100%;
  368. height: 100%;
  369. object-fit: cover;
  370. }
  371. .goods-info {
  372. width: calc(100% - 84px);
  373. }
  374. .custom-table-checkbox {
  375. .el-checkbox {
  376. display: block !important;
  377. margin: 0 05px 0;
  378. }
  379. }
  380. </style>