reserve_list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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="85px" size="mini" 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" @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 @click="resetScreenForm">清空</el-button>
  84. <el-button 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="mini" 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="left" 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="left" label="预留单号" prop="id" min-width="180" show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. <CopyButton :copyText="scope.row.id" />
  118. <span>{{scope.row.id}}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="left" label="预留日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  122. <el-table-column align="left" label="销售订单号" prop="mainOrderId" min-width="140" show-overflow-tooltip>
  123. <template slot-scope="scope">
  124. <CopyButton :copyText="scope.row.mainOrderId" />
  125. <span>{{scope.row.mainOrderId}}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="left" label="订单日期" prop="orderTime" min-width="120" show-overflow-tooltip>
  129. <template slot-scope="scope">
  130. {{scope.row.orderTime | dateToDayFilter}}
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  134. <template slot-scope="scope">
  135. <CopyButton :copyText="scope.row.materialCode" />
  136. <span>{{scope.row.materialCode}}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  140. <template slot-scope="scope">
  141. <CopyButton :copyText="scope.row.materialOldNumber" />
  142. <span>{{scope.row.materialOldNumber}}</span>
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  146. <template slot-scope="scope">
  147. <CopyButton :copyText="scope.row.materialName" />
  148. <span>{{scope.row.materialName}}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  152. <template slot-scope="scope">
  153. <CopyButton :copyText="scope.row.specification" />
  154. <span>{{scope.row.specification}}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  158. <el-table-column align="right" label="预留数量" prop="oldNum" min-width="100" show-overflow-tooltip></el-table-column>
  159. <el-table-column align="right" label="可发货数量" prop="reservedNum" min-width="100" show-overflow-tooltip></el-table-column>
  160. <el-table-column align="right" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
  161. <el-table-column align="left" label="预留仓库" prop="correspondName" min-width="100" show-overflow-tooltip></el-table-column>
  162. <el-table-column align="left" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  163. <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="100" show-overflow-tooltip>
  164. <template slot-scope="scope">
  165. <CopyButton :copyText="scope.row.customerNumber" />
  166. <span>{{scope.row.customerNumber}}</span>
  167. </template>
  168. </el-table-column>
  169. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  170. <template slot-scope="scope">
  171. <CopyButton :copyText="scope.row.customerName" />
  172. <span>{{scope.row.customerName}}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column align="left" label="制表人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  176. <el-table-column align="left" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  177. <el-table-column align="left" label="修改人" prop="updateBy" min-width="100" show-overflow-tooltip></el-table-column>
  178. <el-table-column align="left" label="修改日期" prop="updateTime" min-width="160" show-overflow-tooltip></el-table-column>
  179. <el-table-column align="left" label="关闭人" prop="closureBy" min-width="100" show-overflow-tooltip></el-table-column>
  180. <el-table-column align="left" label="关闭日期" prop="closureTime" min-width="160" show-overflow-tooltip></el-table-column>
  181. <el-table-column align="center" label="操作" width="160" fixed="right">
  182. <template slot-scope="scope">
  183. <el-button type="text" @click="toForm(scope.row)" v-if="$checkBtnRole('edit', $route.meta.roles)">编辑</el-button>
  184. <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
  185. <el-popconfirm
  186. style="margin-left: 10px;"
  187. title="确定关闭吗?"
  188. @onConfirm="handleClose(scope.row.itemId)"
  189. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.status === 1">
  190. <el-button slot="reference" type="text">关闭</el-button>
  191. </el-popconfirm>
  192. </template>
  193. </el-table-column>
  194. </el-table>
  195. </div>
  196. </div>
  197. <div class="pagination clearfix">
  198. <div class="fr">
  199. <el-pagination
  200. @size-change="handleSizeChange"
  201. @current-change="handleCurrentChange"
  202. :current-page="currentPage"
  203. :page-sizes="[10, 20, 30, 50]"
  204. :page-size="10"
  205. layout="total, sizes, prev, pager, next, jumper"
  206. :total="listTotal">
  207. </el-pagination>
  208. </div>
  209. </div>
  210. </div>
  211. <ReserveDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  212. <ReserveForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  213. </div>
  214. </template>
  215. <script>
  216. import { getList, closeData, getWarehouseList } from "@/api/supply/reserve";
  217. import ReserveDetail from "@/views/supply/reserve/components/reserve_detail";
  218. import ReserveForm from "@/views/supply/reserve/components/reserve_form";
  219. let that
  220. export default {
  221. components: {
  222. ReserveDetail,
  223. ReserveForm,
  224. },
  225. filters: {
  226. statusFilter(val) {
  227. let obj = that.statusList.find(o => o.value == val);
  228. return obj ? obj.label : ''
  229. }
  230. },
  231. data() {
  232. return {
  233. currentPage: 1, // 当前页码
  234. pageSize: 10, // 每页数量
  235. listTotal: 0, // 列表总数
  236. dataList: null, // 列表数据
  237. listLoading: false, // 列表加载loading
  238. screenForm: { // 筛选表单数据
  239. goodsName: '',
  240. goodsNum: '',
  241. orderNum: '',
  242. jxsName: '',
  243. jxsNum: '',
  244. date: '',
  245. createMan: '',
  246. updateMan: '',
  247. orderNum: '',
  248. saleNum: '',
  249. model: '',
  250. status: '',
  251. warehouse: '',
  252. },
  253. statusList: [
  254. { label: '执行中', value: 1 },
  255. { label: '已关闭', value: 0 },
  256. ],
  257. warehouseList: [],
  258. queryItem: {},
  259. isShowDetail: false,
  260. isShowForm: false,
  261. }
  262. },
  263. computed: {
  264. exParams() {
  265. return {
  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. },
  281. },
  282. beforeCreate() {
  283. that = this;
  284. },
  285. created() {
  286. this.getWarehouseList();
  287. this.getList();
  288. },
  289. methods: {
  290. // 获取仓库列表
  291. getWarehouseList() {
  292. getWarehouseList({
  293. pageNum: 1,
  294. pageSize: -1,
  295. }).then(res => {
  296. this.warehouseList = res.data.records;
  297. });
  298. },
  299. // 查询列表
  300. getList() {
  301. this.listLoading = true;
  302. let params = {
  303. pageNum: this.currentPage,
  304. pageSize: this.pageSize,
  305. materialName: this.screenForm.goodsName,
  306. materialCode: this.screenForm.goodsNum,
  307. customerNumber: this.screenForm.jxsNum,
  308. customerName: this.screenForm.jxsName,
  309. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  310. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  311. createBy: this.screenForm.createMan,
  312. updateBy: this.screenForm.updateMan,
  313. id: this.screenForm.orderNum,
  314. orderId: this.screenForm.saleNum,
  315. specification: this.screenForm.model,
  316. status: this.screenForm.status,
  317. correspondId: this.screenForm.warehouse,
  318. };
  319. getList(params).then((res) => {
  320. res.data.records.forEach(item => {
  321. item.sums1 = ['oldNum', 'reservedNum', 'qty'];
  322. item.sums2 = [];
  323. })
  324. this.dataList = res.data.records;
  325. this.listTotal = res.data.total;
  326. this.listLoading = false;
  327. })
  328. },
  329. // 提交筛选表单
  330. submitScreenForm() {
  331. this.currentPage = 1;
  332. this.getList();
  333. },
  334. // 重置筛选表单
  335. resetScreenForm() {
  336. this.$refs.screenForm.resetFields();
  337. this.currentPage = 1;
  338. this.getList();
  339. },
  340. // 更改每页数量
  341. handleSizeChange(val) {
  342. this.pageSize = val;
  343. this.currentPage = 1;
  344. this.getList();
  345. },
  346. // 更改当前页
  347. handleCurrentChange(val) {
  348. this.currentPage = val;
  349. this.getList();
  350. },
  351. // 进入表单
  352. toForm(item) {
  353. this.queryItem = item;
  354. this.isShowForm = true;
  355. },
  356. // 进入详情
  357. toDetail(item) {
  358. this.queryItem = item;
  359. this.isShowDetail = true;
  360. },
  361. backList() {
  362. this.queryItem = {};
  363. this.isShowDetail = false;
  364. this.isShowForm = false;
  365. },
  366. // 关闭
  367. handleClose(id) {
  368. closeData({itemId: id}).then(res => {
  369. this.$successMsg();
  370. this.getList();
  371. })
  372. }
  373. }
  374. }
  375. </script>
  376. <style lang="scss" scoped>
  377. </style>