list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <div class="arrival_order">
  3. <Toptitle title="到货列表">
  4. <slot name="titleButton">
  5. <!-- <Button @click="handleCodeRule"
  6. type="primary"
  7. ghost
  8. style="margin-right:10px;">编码规则</Button> -->
  9. <Button type="primary"
  10. @click="handleGoPage(1,'')"
  11. style="margin-right:10px;">新增</Button>
  12. </slot>
  13. </Toptitle>
  14. <div class="arrival_order_search">
  15. <Form :label-width="90"
  16. :model="searchData">
  17. <FormItem label="订单号:">
  18. <Input type="text"
  19. size="small"
  20. v-model="searchData.order_no"
  21. style="width: 150px"
  22. placeholder="订单号" />
  23. </FormItem>
  24. <!-- <FormItem label="项目名称:">
  25. <Input type="text"
  26. size="small"
  27. v-model="searchData.project_title"
  28. style="width: 150px"
  29. placeholder="项目名称" />
  30. </FormItem> -->
  31. <FormItem label="提交人:">
  32. <Select v-model="searchData.user_id"
  33. size="small"
  34. clearable
  35. style="width: 150px">
  36. <Option v-for="(sitem) in userList"
  37. :key="sitem.id"
  38. :label="sitem.nickname"
  39. :value="sitem.id">
  40. </Option>
  41. </Select>
  42. </FormItem>
  43. <!-- <FormItem label="订单状态:">
  44. <Select v-model="searchData.lock"
  45. size="small"
  46. clearable
  47. style="width: 150px">
  48. <Option label='正常'
  49. :value=0 />
  50. <Option label='已关闭'
  51. :value=1 />
  52. </Select>
  53. </FormItem> -->
  54. <FormItem label="审批状态:">
  55. <Select v-model="searchData.state"
  56. size="small"
  57. clearable
  58. style="width: 150px">
  59. <Option label='未提交'
  60. :value=0 />
  61. <Option label='审核中'
  62. :value=1 />
  63. <Option label='通过'
  64. :value=2 />
  65. <Option label='驳回'
  66. :value=3 />
  67. </Select>
  68. </FormItem>
  69. <FormItem label="制单时间:">
  70. <DatePicker type="date"
  71. size="small"
  72. style="width: 150px"
  73. placeholder="年/月/日"
  74. v-model="searchData.start_time"></DatePicker>
  75. </FormItem>
  76. <FormItem label="~">
  77. <DatePicker type="date"
  78. size="small"
  79. style="width: 150px"
  80. placeholder="年/月/日"
  81. v-model="searchData.end_time"></DatePicker>
  82. </FormItem>
  83. <FormItem>
  84. <Button type="primary"
  85. size="small"
  86. @click="initData(searchData)"
  87. style="margin-right:10px;">搜索</Button>
  88. </FormItem>
  89. </Form>
  90. <div class="content_right_topfrom_btn">
  91. </div>
  92. </div>
  93. <div class="arrival_order_content">
  94. <div class="arrival_order_content_table">
  95. <Table :columns="tableColumns"
  96. border
  97. :max-height="500"
  98. :data="tableData">
  99. <template slot="setSlot"
  100. slot-scope="{row,index}">
  101. <a style="margin:0 5px"
  102. @click="handleSet(2,row,index)">详情</a>
  103. <a style="margin:0 5px"
  104. :disabled="row.state==1"
  105. @click="handleSet(3,row,index)">编辑</a>
  106. <a style="margin:0 5px"
  107. :disabled="row.state==1||row.state==2"
  108. @click="handleSet(4,row,index)">删除</a>
  109. <a style="margin:0 5px"
  110. @click="handleSet(5,row,index)">提交</a>
  111. </template>
  112. </Table>
  113. <div class="arrival_order_content_page">
  114. <Page :page-size-opts="[10, 20, 30, 40,100]"
  115. @on-page-size-change='changeSize'
  116. @on-change='changePage'
  117. :current='pageIndex'
  118. show-total
  119. :total="total"
  120. show-sizer
  121. :page-size='pageSize' />
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </template>
  127. <script>
  128. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  129. // 例如:import 《组件名称》 from '《组件路径》';
  130. export default {
  131. name: '',
  132. components: {
  133. },
  134. props: {},
  135. // import引入的组件需要注入到对象中才能使用
  136. data () {
  137. // 这里存放数据
  138. return {
  139. searchData: {
  140. order_no: '',
  141. project_title: '',
  142. supply_title: '',
  143. type_id: '',
  144. user_id: '',
  145. lock: '',
  146. state: '',
  147. start_time: '',
  148. end_time: '',
  149. },
  150. tableColumns: [
  151. { title: '订单号', key: 'purchase_order_arrive_no', align: 'center', minWidth: 140 },
  152. // { title: '项目名称', key: 'client_name', align: 'center', minWidth: 140 },
  153. { title: '供应商名称', key: 'supply_title', align: 'center', minWidth: 140 },
  154. {
  155. title: '订单状态', key: 'lock', align: 'center', minWidth: 120,
  156. render: (h, params) => {
  157. const { row } = params
  158. const text = row.lock == 0 ? '正常' : '已关闭'
  159. return h('span', {}, text)
  160. }
  161. },
  162. { title: '提交人', key: 'nickname', align: 'center', minWidth: 100 },
  163. {
  164. title: '审批状态', key: 'state', align: 'center', minWidth: 140,
  165. render: (h, params) => {
  166. const { row } = params
  167. const text = row.state == 0 ? '未提交' : row.state == 1 ? '审核中' : row.state == 2 ? '通过' : '驳回'
  168. return h('span', {}, text)
  169. }
  170. },
  171. {
  172. title: '预计到货日期', key: 'arrive_time', align: 'center', minWidth: 140,
  173. render: (h, params) => {
  174. const { row } = params
  175. return h('span', {}, this.func.replaceDateNoHMS(row.arrive_time))
  176. }
  177. },
  178. {
  179. title: '制单日期', key: 'crt_time', align: 'center', minWidth: 140,
  180. render: (h, params) => {
  181. const { row } = params
  182. return h('span', {}, this.func.replaceDate(row.crt_time))
  183. }
  184. },
  185. { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
  186. ],
  187. tableData: [{}],
  188. pageIndex: 1,
  189. pageSize: 10,
  190. total: 0,
  191. userList: [],
  192. }
  193. },
  194. // 生命周期 - 创建完成(可以访问当前this实例)
  195. created () {
  196. // 获取操作员
  197. this.axios('/api/user').then(res => this.userList = res.data.data)
  198. },
  199. // 生命周期 - 挂载完成(可以访问DOM元素)
  200. mounted () {
  201. this.initData()
  202. },
  203. methods: {
  204. initData () {
  205. let obj = JSON.parse(JSON.stringify(this.searchData))
  206. obj.start_time = parseInt(new Date(obj.start_time).getTime() / 1000) || ''
  207. obj.end_time = parseInt(new Date(obj.end_time).getTime() / 1000) || ''
  208. this.axios({
  209. method: 'get',
  210. url: '/api/purchase_arrive_list',
  211. params: {
  212. ...obj,
  213. }
  214. }).then((res) => {
  215. this.tableData = res.data.data
  216. this.total = res.data.total
  217. }).catch((err) => { });
  218. },
  219. handleSet (type, row, index) {
  220. // 1新增 2详情 3编辑 4删除 5提交
  221. switch (type) {
  222. case 1:
  223. case 2:
  224. case 3:
  225. this.handleGoPage(type, row.purchase_order_arrive_no)
  226. break;
  227. case 4:
  228. this.$Modal.confirm({
  229. title: '确认删除?',
  230. content: '此操作无法恢复,请确认!',
  231. onOk: () => {
  232. this.axios({
  233. method: 'post',
  234. url: '/api/purchase_arrive_del',
  235. data: {
  236. purchase_order_arrive_no: row.purchase_order_arrive_no
  237. }
  238. }).then((res) => {
  239. this.$Message.success(res.msg)
  240. this.initData()
  241. }).catch((err) => { });
  242. },
  243. onCancel: () => { }
  244. })
  245. break;
  246. case 5:
  247. this.$Modal.confirm({
  248. title: '确认提交?',
  249. onOk: () => {
  250. this.axios({
  251. method: 'post',
  252. url: '/api/purchase_arrive_pull',
  253. data: {
  254. purchase_order_arrive_no: row.purchase_order_arrive_no,
  255. lock: row.lock,
  256. state: row.state + 1
  257. }
  258. }).then((res) => {
  259. this.$Message.success(res.msg)
  260. this.initData()
  261. }).catch((err) => { });
  262. },
  263. onCancel: () => { }
  264. })
  265. break;
  266. }
  267. },
  268. handleGoPage (type, purchase_order_arrive_no) {
  269. this.$router.push({
  270. path: '/cms/PurchasingManage/ArrivalOrder/edit',
  271. query: {
  272. type,
  273. purchase_order_arrive_no
  274. }
  275. })
  276. },
  277. changeSize (e) {
  278. this.pageSize = e;
  279. this.initData()
  280. },
  281. changePage (e) {
  282. this.pageIndex = e;
  283. this.initData()
  284. }
  285. },
  286. // 监听属性 类似于data概念
  287. computed: {},
  288. // 监控data中的数据变化
  289. watch: {},
  290. beforeCreate () { }, // 生命周期 - 创建之前
  291. beforeMount () { }, // 生命周期 - 挂载之前
  292. beforeUpdate () { }, // 生命周期 - 更新之前
  293. updated () { }, // 生命周期 - 更新之后
  294. beforeDestroy () { }, // 生命周期 - 销毁之前
  295. destroyed () { }, // 生命周期 - 销毁完成
  296. activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
  297. }
  298. </script>
  299. <style lang='scss' scoped>
  300. .arrival_order_search {
  301. padding-top: 20px;
  302. /deep/.ivu-form {
  303. display: flex;
  304. justify-content: flex-start;
  305. flex-wrap: wrap;
  306. }
  307. /deep/.ivu-form-item {
  308. display: inline-block;
  309. width: 250px;
  310. }
  311. }
  312. .arrival_order_content {
  313. border-top: 1px solid #f4f4f4;
  314. margin-top: 20px;
  315. .arrival_order_content_btn {
  316. display: flex;
  317. justify-content: flex-end;
  318. padding: 20px 0;
  319. }
  320. .arrival_order_content_page {
  321. display: flex;
  322. justify-content: center;
  323. padding-top: 20px;
  324. }
  325. }
  326. </style>