reserve_list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowForm">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="90px" size="small" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="24" :lg="24">
  9. <el-form-item prop="status" label-width="0">
  10. <el-radio-group v-model="screenForm.status" size="medium" @change="getList()">
  11. <el-radio-button label="">全部</el-radio-button>
  12. <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
  13. </el-radio-group>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :xs="24" :sm="12" :lg="6">
  17. <el-form-item label="产品名称" prop="goodsName">
  18. <el-input v-model="screenForm.goodsName" placeholder="请输入产品名称"></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="6">
  22. <el-form-item label="产品编码" prop="goodsNum">
  23. <el-input v-model="screenForm.goodsNum" placeholder="请输入产品编码"></el-input>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :xs="24" :sm="12" :lg="6">
  27. <el-form-item label="规格型号" prop="model">
  28. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :lg="6">
  32. <el-form-item label="销售订单号" prop="saleNum">
  33. <el-input v-model="screenForm.saleNum" placeholder="请输入销售订单号"></el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :xs="24" :sm="12" :lg="6">
  37. <el-form-item label="经销商名称" prop="jxsName">
  38. <el-input v-model="screenForm.jxsName" placeholder="请输入经销商名称"></el-input>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="6">
  42. <el-form-item label="经销商编号" prop="jxsNum">
  43. <el-input v-model="screenForm.jxsNum" placeholder="请输入经销商编号"></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="12" :lg="6">
  47. <el-form-item label="预留日期" prop="date">
  48. <el-date-picker
  49. v-model="screenForm.date"
  50. type="datetimerange"
  51. range-separator="至"
  52. style="width: 100%;"
  53. value-format="yyyy-MM-dd HH:mm:ss"
  54. start-placeholder="开始日期"
  55. end-placeholder="结束日期">
  56. </el-date-picker>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="6">
  60. <el-form-item label="制表人" prop="createMan">
  61. <el-input v-model="screenForm.createMan" placeholder="请输入制表人"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="6">
  65. <el-form-item label="修改人" prop="updateMan">
  66. <el-input v-model="screenForm.updateMan" placeholder="请输入修改人"></el-input>
  67. </el-form-item>
  68. </el-col>
  69. <el-col :xs="24" :sm="12" :lg="6">
  70. <el-form-item label="预留单号" prop="orderNum">
  71. <el-input v-model="screenForm.orderNum" placeholder="请输入预留单号"></el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :xs="24" :sm="12" :lg="6">
  75. <el-form-item label="预留仓库" prop="warehouse">
  76. <el-select v-model="screenForm.warehouse" placeholder="选择预留仓库" clearable>
  77. <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
  78. </el-select>
  79. </el-form-item>
  80. </el-col>
  81. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  82. <el-form-item label="">
  83. <el-button size="small" @click="resetScreenForm">清空</el-button>
  84. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. </el-form>
  89. </div>
  90. <div class="mymain-container">
  91. <div class="btn-group clearfix">
  92. <div class="fl">
  93. <el-button size="small" type="primary" icon="el-icon-plus" @click="toForm()" v-if="$checkBtnRole('add', $route.meta.roles)">新增</el-button>
  94. </div>
  95. <div class="fr">
  96. <ExportButton :exUrl="'reserve/export'" :exParams="exParams" />
  97. </div>
  98. </div>
  99. <div class="table">
  100. <el-table
  101. v-loading="listLoading"
  102. :data="dataList"
  103. element-loading-text="Loading"
  104. border
  105. fit
  106. highlight-current-row
  107. stripe
  108. show-summary
  109. :summary-method="$getSummaries">
  110. <el-table-column align="center" label="状态" prop="status" min-width="100" show-overflow-tooltip>
  111. <template slot-scope="scope">
  112. {{scope.row.status | statusFilter}}
  113. </template>
  114. </el-table-column>
  115. <el-table-column align="center" label="预留单号" prop="id" min-width="180" show-overflow-tooltip></el-table-column>
  116. <el-table-column align="center" label="预留日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  117. <el-table-column align="center" label="销售订单号" prop="mainOrderId" min-width="140" show-overflow-tooltip></el-table-column>
  118. <el-table-column align="center" label="订单日期" prop="orderTime" min-width="120" show-overflow-tooltip>
  119. <template slot-scope="scope">
  120. {{scope.row.orderTime | dateToDayFilter}}
  121. </template>
  122. </el-table-column>
  123. <!-- <el-table-column align="center" label="产品大类" prop="mainName" min-width="160" show-overflow-tooltip></el-table-column> -->
  124. <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
  125. <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
  126. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  127. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  128. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  129. <el-table-column align="right" label="原预留数量" prop="oldNum" min-width="100" show-overflow-tooltip></el-table-column>
  130. <el-table-column align="right" label="预留数量" prop="reservedNum" min-width="100" show-overflow-tooltip></el-table-column>
  131. <el-table-column align="right" label="开单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
  132. <el-table-column align="center" label="预留仓库" prop="correspondName" min-width="100" show-overflow-tooltip></el-table-column>
  133. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  134. <el-table-column align="center" label="经销商编码" prop="customerNumber" min-width="140" show-overflow-tooltip></el-table-column>
  135. <el-table-column align="center" label="经销商名称" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
  136. <el-table-column align="center" label="制表人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  137. <el-table-column align="center" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  138. <el-table-column align="center" label="修改人" prop="updateBy" min-width="100" show-overflow-tooltip></el-table-column>
  139. <el-table-column align="center" label="修改日期" prop="updateTime" min-width="160" show-overflow-tooltip></el-table-column>
  140. <el-table-column align="center" label="关闭人" prop="closureBy" min-width="100" show-overflow-tooltip></el-table-column>
  141. <el-table-column align="center" label="关闭日期" prop="closureTime" min-width="160" show-overflow-tooltip></el-table-column>
  142. <el-table-column align="center" label="操作" width="160" fixed="right">
  143. <template slot-scope="scope">
  144. <el-button type="text" @click="toForm(scope.row)" v-if="$checkBtnRole('edit', $route.meta.roles)">编辑</el-button>
  145. <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
  146. <el-popconfirm
  147. style="margin-left: 10px;"
  148. title="确定关闭吗?"
  149. @onConfirm="handleClose(scope.row.itemId)"
  150. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.status === 1">
  151. <el-button slot="reference" type="text">关闭</el-button>
  152. </el-popconfirm>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. </div>
  157. </div>
  158. <div class="pagination clearfix">
  159. <div class="fr">
  160. <el-pagination
  161. @size-change="handleSizeChange"
  162. @current-change="handleCurrentChange"
  163. :current-page="currentPage"
  164. :page-sizes="[10, 20, 30, 50]"
  165. :page-size="10"
  166. layout="total, sizes, prev, pager, next, jumper"
  167. :total="listTotal">
  168. </el-pagination>
  169. </div>
  170. </div>
  171. </div>
  172. <ReserveDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  173. <ReserveForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  174. </div>
  175. </template>
  176. <script>
  177. import { getList, closeData, getWarehouseList } from "@/api/supply/reserve";
  178. import ReserveDetail from "@/views/supply/reserve/components/reserve_detail";
  179. import ReserveForm from "@/views/supply/reserve/components/reserve_form";
  180. let that
  181. export default {
  182. components: {
  183. ReserveDetail,
  184. ReserveForm,
  185. },
  186. filters: {
  187. statusFilter(val) {
  188. let obj = that.statusList.find(o => o.value == val);
  189. return obj ? obj.label : ''
  190. }
  191. },
  192. data() {
  193. return {
  194. currentPage: 1, // 当前页码
  195. pageSize: 10, // 每页数量
  196. listTotal: 0, // 列表总数
  197. dataList: null, // 列表数据
  198. listLoading: false, // 列表加载loading
  199. screenForm: { // 筛选表单数据
  200. goodsName: '',
  201. goodsNum: '',
  202. orderNum: '',
  203. jxsName: '',
  204. jxsNum: '',
  205. date: '',
  206. createMan: '',
  207. updateMan: '',
  208. orderNum: '',
  209. saleNum: '',
  210. model: '',
  211. status: '',
  212. warehouse: '',
  213. },
  214. statusList: [
  215. { label: '执行中', value: 1 },
  216. { label: '已关闭', value: 0 },
  217. ],
  218. warehouseList: [],
  219. queryItem: {},
  220. isShowDetail: false,
  221. isShowForm: false,
  222. }
  223. },
  224. computed: {
  225. exParams() {
  226. return {
  227. materialName: this.screenForm.goodsName,
  228. materialCode: this.screenForm.goodsNum,
  229. customerNumber: this.screenForm.jxsNum,
  230. customerName: this.screenForm.jxsName,
  231. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  232. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  233. createBy: this.screenForm.createMan,
  234. updateBy: this.screenForm.updateMan,
  235. id: this.screenForm.orderNum,
  236. orderId: this.screenForm.saleNum,
  237. specification: this.screenForm.model,
  238. status: this.screenForm.status,
  239. correspondId: this.screenForm.warehouse,
  240. }
  241. },
  242. },
  243. beforeCreate() {
  244. that = this;
  245. },
  246. created() {
  247. this.getWarehouseList();
  248. this.getList();
  249. },
  250. methods: {
  251. // 获取仓库列表
  252. getWarehouseList() {
  253. getWarehouseList({
  254. pageNum: 1,
  255. pageSize: -1,
  256. }).then(res => {
  257. this.warehouseList = res.data.records;
  258. });
  259. },
  260. // 查询列表
  261. getList() {
  262. this.listLoading = true;
  263. let params = {
  264. pageNum: this.currentPage,
  265. pageSize: this.pageSize,
  266. materialName: this.screenForm.goodsName,
  267. materialCode: this.screenForm.goodsNum,
  268. customerNumber: this.screenForm.jxsNum,
  269. customerName: this.screenForm.jxsName,
  270. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  271. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  272. createBy: this.screenForm.createMan,
  273. updateBy: this.screenForm.updateMan,
  274. id: this.screenForm.orderNum,
  275. orderId: this.screenForm.saleNum,
  276. specification: this.screenForm.model,
  277. status: this.screenForm.status,
  278. correspondId: this.screenForm.warehouse,
  279. };
  280. getList(params).then((res) => {
  281. res.data.records.forEach(item => {
  282. item.sums1 = ['oldNum', 'reservedNum', 'qty'];
  283. item.sums2 = [];
  284. })
  285. this.dataList = res.data.records;
  286. this.listTotal = res.data.total;
  287. this.listLoading = false;
  288. })
  289. },
  290. // 提交筛选表单
  291. submitScreenForm() {
  292. this.currentPage = 1;
  293. this.getList();
  294. },
  295. // 重置筛选表单
  296. resetScreenForm() {
  297. this.$refs.screenForm.resetFields();
  298. this.currentPage = 1;
  299. this.getList();
  300. },
  301. // 更改每页数量
  302. handleSizeChange(val) {
  303. this.pageSize = val;
  304. this.currentPage = 1;
  305. this.getList();
  306. },
  307. // 更改当前页
  308. handleCurrentChange(val) {
  309. this.currentPage = val;
  310. this.getList();
  311. },
  312. // 进入表单
  313. toForm(item) {
  314. this.queryItem = item;
  315. this.isShowForm = true;
  316. },
  317. // 进入详情
  318. toDetail(item) {
  319. this.queryItem = item;
  320. this.isShowDetail = true;
  321. },
  322. backList() {
  323. this.queryItem = {};
  324. this.isShowDetail = false;
  325. this.isShowForm = false;
  326. },
  327. // 关闭
  328. handleClose(id) {
  329. closeData({itemId: id}).then(res => {
  330. this.$successMsg();
  331. this.getList();
  332. })
  333. }
  334. }
  335. }
  336. </script>
  337. <style lang="scss" scoped>
  338. </style>