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.

403 lines
12 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <script>
  2. import {getAllBuList} from "../../../api/factory/site";
  3. import {cancelPurchaseOrder, closePurchaseOrder, queryPurchaseOrder} from "../../../api/partspare/purchaseOrder";
  4. export default {
  5. name: "purchaseOrder",
  6. data(){
  7. return{
  8. span:3,
  9. queryParams: {
  10. site: this.$store.state.user.site,
  11. buNo: '',
  12. partNo: '',
  13. partDescription: '',
  14. status: '',
  15. startDate:null,
  16. endDate:null,
  17. no:1,
  18. size:50,
  19. },
  20. buList: [],
  21. dataList: [],
  22. queryLoading: false,
  23. total:0,
  24. columns:[
  25. {
  26. userId: this.$store.state.user.name,
  27. functionId: 200101107,
  28. serialNumber: '200101107Table1BuDesc',
  29. tableId: '200101107Table1',
  30. tableName: '备品备件采购表',
  31. columnProp: 'buDesc',
  32. headerAlign: 'center',
  33. align: 'center',
  34. columnLabel: 'BU',
  35. columnHidden: false,
  36. columnImage: false,
  37. columnSortable: false,
  38. sortLv: 0,
  39. status: true,
  40. fixed: '',
  41. columnWidth: 80
  42. },{
  43. userId: this.$store.state.user.name,
  44. functionId: 200101107,
  45. serialNumber: '200101107Table1PurchaseOrderNo',
  46. tableId: '200101107Table1',
  47. tableName: '备品备件采购表',
  48. columnProp: 'purchaseOrderNo',
  49. headerAlign: 'center',
  50. align: 'LEFT',
  51. columnLabel: '采购订单号',
  52. columnHidden: false,
  53. columnImage: false,
  54. columnSortable: false,
  55. sortLv: 0,
  56. status: true,
  57. fixed: '',
  58. columnWidth: 120
  59. },
  60. {
  61. userId: this.$store.state.user.name,
  62. functionId: 200101107,
  63. serialNumber: '200101107Table1PartNo',
  64. tableId: '200101107Table1',
  65. tableName: '备品备件采购表',
  66. columnProp: 'partNo',
  67. headerAlign: 'center',
  68. align: 'left',
  69. columnLabel: '备品备件编码',
  70. columnHidden: false,
  71. columnImage: false,
  72. columnSortable: false,
  73. sortLv: 0,
  74. status: true,
  75. fixed: '',
  76. columnWidth: 120
  77. },
  78. {
  79. userId: this.$store.state.user.name,
  80. functionId: 200101107,
  81. serialNumber: '200101107Table1PartDescription',
  82. tableId: '200101107Table1',
  83. tableName: '备品备件采购表',
  84. columnProp: 'partDescription',
  85. headerAlign: 'center',
  86. align: 'left',
  87. columnLabel: '备品备件名称',
  88. columnHidden: false,
  89. columnImage: false,
  90. columnSortable: false,
  91. sortLv: 0,
  92. status: true,
  93. fixed: '',
  94. columnWidth: 160
  95. },
  96. {
  97. userId: this.$store.state.user.name,
  98. functionId: 200101107,
  99. serialNumber: '200101107Table1Qty',
  100. tableId: '200101107Table1',
  101. tableName: '备品备件采购表',
  102. columnProp: 'qty',
  103. headerAlign: 'center',
  104. align: 'right',
  105. columnLabel: '采购数量',
  106. columnHidden: false,
  107. columnImage: false,
  108. columnSortable: false,
  109. sortLv: 0,
  110. status: true,
  111. fixed: '',
  112. columnWidth: 80
  113. },
  114. {
  115. userId: this.$store.state.user.name,
  116. functionId: 200101107,
  117. serialNumber: '200101107Table1QuantityOfArrival',
  118. tableId: '200101107Table1',
  119. tableName: '备品备件采购表',
  120. columnProp: 'quantityOfArrival',
  121. headerAlign: 'center',
  122. align: 'right',
  123. columnLabel: '到货数量',
  124. columnHidden: false,
  125. columnImage: false,
  126. columnSortable: false,
  127. sortLv: 0,
  128. status: true,
  129. fixed: '',
  130. columnWidth: 80
  131. },
  132. {
  133. userId: this.$store.state.user.name,
  134. functionId: 200101107,
  135. serialNumber: '200101107Table1UmId',
  136. tableId: '200101107Table1',
  137. tableName: '备品备件采购表',
  138. columnProp: 'umId',
  139. headerAlign: 'center',
  140. align: 'left',
  141. columnLabel: '单位',
  142. columnHidden: false,
  143. columnImage: false,
  144. columnSortable: false,
  145. sortLv: 0,
  146. status: true,
  147. fixed: '',
  148. columnWidth: 60
  149. },
  150. {
  151. userId: this.$store.state.user.name,
  152. functionId: 200101107,
  153. serialNumber: '200101107Table1Status',
  154. tableId: '200101107Table1',
  155. tableName: '备品备件采购表',
  156. columnProp: 'status',
  157. headerAlign: 'center',
  158. align: 'center',
  159. columnLabel: '状态',
  160. columnHidden: false,
  161. columnImage: false,
  162. columnSortable: false,
  163. sortLv: 0,
  164. status: true,
  165. fixed: '',
  166. columnWidth: 80
  167. },
  168. {
  169. userId: this.$store.state.user.name,
  170. functionId: 200101107,
  171. serialNumber: '200101107Table1CreateTime',
  172. tableId: '200101107Table1',
  173. tableName: '备品备件采购表',
  174. columnProp: 'createTime',
  175. headerAlign: 'center',
  176. align: 'center',
  177. columnLabel: '下单时间',
  178. columnHidden: false,
  179. columnImage: false,
  180. columnSortable: false,
  181. sortLv: 0,
  182. status: true,
  183. fixed: '',
  184. columnWidth: 140
  185. },
  186. {
  187. userId: this.$store.state.user.name,
  188. functionId: 200101107,
  189. serialNumber: '200101107Table1CreateBy',
  190. tableId: '200101107Table1',
  191. tableName: '备品备件采购表',
  192. columnProp: 'createBy',
  193. headerAlign: 'center',
  194. align: 'left',
  195. columnLabel: '下单人',
  196. columnHidden: false,
  197. columnImage: false,
  198. columnSortable: false,
  199. sortLv: 0,
  200. status: true,
  201. fixed: '',
  202. columnWidth: 80
  203. },
  204. ],
  205. }
  206. },
  207. methods:{
  208. getBuList() {
  209. let tempData = {
  210. username: this.$store.state.user.name,
  211. }
  212. getAllBuList(tempData).then(({data}) => {
  213. if (data && data.code === 0) {
  214. this.buList = data.rows
  215. }
  216. })
  217. },
  218. handleQuery(){
  219. this.queryLoading = true
  220. queryPurchaseOrder(this.queryParams).then(({data})=>{
  221. if (data && data.code === 0) {
  222. this.dataList = data.rows
  223. this.total = data.total
  224. }else {
  225. this.$message.warning(data.msg)
  226. }
  227. this.queryLoading = false
  228. }).catch((error)=>{
  229. this.$message.error(error)
  230. this.queryLoading = false
  231. })
  232. },
  233. handleQueryBySize(val){
  234. this.queryParams.size = val;
  235. this.handleQuery();
  236. },
  237. handleQueryByPage(val){
  238. this.queryParams.no = val;
  239. this.handleQuery();
  240. },
  241. handleCancel(row){
  242. this.$confirm('确定取消该采购订单吗?',{
  243. confirmButtonText: '确定',
  244. cancelButtonText: '取消',
  245. type: 'warning'
  246. }).then(()=>{
  247. cancelPurchaseOrder(row).then(({data})=>{
  248. if (data && data.code === 0) {
  249. this.$message.success(data.msg)
  250. this.handleQuery()
  251. }else {
  252. this.$message.warning(data.msg)
  253. }
  254. }).catch((error)=>{
  255. this.$message.error(error)
  256. })
  257. })
  258. },
  259. handleClose(row){
  260. this.$confirm('确定关闭该采购订单吗?',{
  261. confirmButtonText: '确定',
  262. cancelButtonText: '取消',
  263. type: 'warning'
  264. }).then(()=>{
  265. closePurchaseOrder(row).then(({data})=>{
  266. if (data && data.code === 0) {
  267. this.$message.success(data.msg)
  268. this.handleQuery()
  269. }else {
  270. this.$message.warning(data.msg)
  271. }
  272. }).catch((error)=>{
  273. this.$message.error(error)
  274. })
  275. })
  276. }
  277. },
  278. watch:{
  279. queryLoading(newVal,oldVal){
  280. if (newVal === true){
  281. setTimeout(()=>{
  282. this.queryLoading=false
  283. },3000)
  284. }
  285. }
  286. },
  287. created() {
  288. this.getBuList();
  289. this.handleQuery();
  290. console.log(this.$route.meta.menuId)
  291. }
  292. }
  293. </script>
  294. <template>
  295. <div class="box-container">
  296. <el-form label-position="top" :model="queryParams" style="max-width: 1200px">
  297. <el-row :gutter="10">
  298. <el-col :span="span">
  299. <el-form-item label="BU">
  300. <el-select v-model="queryParams.buNo" placeholder="请选择" style="width: 100%">
  301. <el-option label="全部" value=""> </el-option>
  302. <el-option
  303. v-for = "i in buList"
  304. :key = "i.buNo"
  305. :label = "i.buDesc"
  306. :value = "i.buNo">
  307. </el-option>
  308. </el-select>
  309. </el-form-item>
  310. </el-col>
  311. <el-col :span="span">
  312. <el-form-item label="备品备件编码">
  313. <el-input v-model="queryParams.partNo" clearable></el-input>
  314. </el-form-item>
  315. </el-col>
  316. <el-col :span="span">
  317. <el-form-item label="备品备件名称">
  318. <el-input v-model="queryParams.partDescription" clearable></el-input>
  319. </el-form-item>
  320. </el-col>
  321. <el-col :span="span*2">
  322. <el-form-item label="下单日期">
  323. <el-date-picker
  324. style="width: 47.5%"
  325. v-model="queryParams.startDate"
  326. type="date"
  327. format="yyyy-MM-dd"
  328. value-format="yyyy-MM-dd"
  329. placeholder="选择日期">
  330. </el-date-picker>
  331. <span style="text-align: center">-</span>
  332. <el-date-picker
  333. style="width: 47.5%"
  334. v-model="queryParams.endDate"
  335. type="date"
  336. format="yyyy-MM-dd"
  337. value-format="yyyy-MM-dd 23:59:59"
  338. placeholder="选择日期">
  339. </el-date-picker>
  340. </el-form-item>
  341. </el-col>
  342. <el-col :span="span">
  343. <el-form-item label="状态">
  344. <el-select v-model="queryParams.status" placeholder="请选择" style="width: 100%">
  345. <el-option label="全部" value=""> </el-option>
  346. <el-option label="已取消" value="已取消"> </el-option>
  347. <el-option label="已关闭" value="已关闭"> </el-option>
  348. <el-option label="进行中" value="进行中"> </el-option>
  349. </el-select>
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="span">
  353. <el-form-item label=" ">
  354. <el-button type="primary" @click="handleQuery">查询</el-button>
  355. </el-form-item>
  356. </el-col>
  357. </el-row>
  358. </el-form>
  359. <div style="height: calc(100% - 120px)">
  360. <el-table :data="dataList" border
  361. height="100%" ref="table"
  362. v-loading="queryLoading">
  363. <el-table-column
  364. v-for="(item,index) in columns" :key="index"
  365. :sortable="item.columnSortable"
  366. :prop="item.columnProp"
  367. :header-align="item.headerAlign"
  368. :show-overflow-tooltip="item.showOverflowTooltip"
  369. :align="item.align"
  370. :fixed="item.fixed===''?false:item.fixed"
  371. :min-width="item.columnWidth"
  372. :label="item.columnLabel">
  373. <template slot-scope="scope">
  374. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  375. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  376. </template>
  377. </el-table-column>
  378. <el-table-column label="操作" align="center" width="100">
  379. <template slot-scope="scope">
  380. <a v-if="scope.row.status === '进行中' && scope.row.quantityOfArrival === 0" @click="handleCancel(scope.row)">取消</a>
  381. <a v-if="scope.row.status === '进行中'" @click="handleClose(scope.row)">关闭</a>
  382. </template>
  383. </el-table-column>
  384. </el-table>
  385. </div>
  386. <el-pagination
  387. style="margin-top: 5px"
  388. @size-change="handleQueryBySize"
  389. @current-change="handleQueryByPage"
  390. :current-page="queryParams.page"
  391. :page-sizes="[50, 100, 500, 1000]"
  392. :page-size="queryParams.limit"
  393. :total="total"
  394. layout="total, sizes, prev, pager, next, jumper">
  395. </el-pagination>
  396. </div>
  397. </template>
  398. <style scoped>
  399. </style>