list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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||row.state==2"
  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. :disabled="row.state==1||row.state==2"
  111. @click="handleSet(5,row,index)">提交</a>
  112. </template>
  113. </Table>
  114. <div class="arrival_order_content_page">
  115. <Page :page-size-opts="[10, 20, 30, 40,100]"
  116. @on-page-size-change='changeSize'
  117. @on-change='changePage'
  118. :current='pageIndex'
  119. show-total
  120. :total="total"
  121. show-sizer
  122. :page-size='pageSize' />
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. <script>
  129. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  130. // 例如:import 《组件名称》 from '《组件路径》';
  131. export default {
  132. name: '',
  133. components: {
  134. },
  135. props: {},
  136. // import引入的组件需要注入到对象中才能使用
  137. data () {
  138. // 这里存放数据
  139. return {
  140. searchData: {
  141. order_no: '',
  142. project_title: '',
  143. supply_title: '',
  144. type_id: '',
  145. user_id: '',
  146. lock: '',
  147. state: '',
  148. start_time: '',
  149. end_time: '',
  150. },
  151. tableColumns: [
  152. { title: '订单号', key: 'purchase_order_arrive_no', align: 'center', minWidth: 140 },
  153. // { title: '项目名称', key: 'client_name', align: 'center', minWidth: 140 },
  154. { title: '供应商名称', key: 'supply_title', align: 'center', minWidth: 140 },
  155. {
  156. title: '订单状态', key: 'lock', align: 'center', minWidth: 120,
  157. render: (h, params) => {
  158. const { row } = params
  159. const text = row.lock == 0 ? '正常' : '已关闭'
  160. return h('span', {}, text)
  161. }
  162. },
  163. { title: '提交人', key: 'nickname', align: 'center', minWidth: 100 },
  164. {
  165. title: '审批状态', key: 'state', align: 'center', minWidth: 140,
  166. render: (h, params) => {
  167. const { row } = params
  168. const text = row.state == 0 ? '未提交' : row.state == 1 ? '审核中' : row.state == 2 ? '通过' : '驳回'
  169. return h('span', {}, text)
  170. }
  171. },
  172. {
  173. title: '预计到货日期', key: 'arrive_time', align: 'center', minWidth: 140,
  174. render: (h, params) => {
  175. const { row } = params
  176. return h('span', {}, this.func.replaceDateNoHMS(row.arrive_time))
  177. }
  178. },
  179. {
  180. title: '制单日期', key: 'crt_time', align: 'center', minWidth: 140,
  181. render: (h, params) => {
  182. const { row } = params
  183. return h('span', {}, this.func.replaceDate(row.crt_time))
  184. }
  185. },
  186. { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
  187. ],
  188. tableData: [{}],
  189. pageIndex: 1,
  190. pageSize: 10,
  191. total: 0,
  192. userList: [],
  193. }
  194. },
  195. // 生命周期 - 创建完成(可以访问当前this实例)
  196. created () {
  197. // 获取操作员
  198. this.axios('/api/user').then(res => this.userList = res.data.data)
  199. },
  200. // 生命周期 - 挂载完成(可以访问DOM元素)
  201. mounted () {
  202. this.initData()
  203. },
  204. methods: {
  205. initData () {
  206. let obj = JSON.parse(JSON.stringify(this.searchData))
  207. obj.start_time = parseInt(new Date(obj.start_time).getTime() / 1000) || ''
  208. obj.end_time = parseInt(new Date(obj.end_time).getTime() / 1000) || ''
  209. this.axios({
  210. method: 'get',
  211. url: '/api/purchase_arrive_list',
  212. params: {
  213. ...obj,
  214. page_index: this.pageIndex,
  215. page_size: this.pageSize
  216. }
  217. }).then((res) => {
  218. this.tableData = res.data.data
  219. this.total = res.data.total
  220. }).catch((err) => { });
  221. },
  222. handleSet (type, row, index) {
  223. // 1新增 2详情 3编辑 4删除 5提交
  224. switch (type) {
  225. case 1:
  226. case 2:
  227. case 3:
  228. this.handleGoPage(type, row.purchase_order_arrive_no)
  229. break;
  230. case 4:
  231. this.$Modal.confirm({
  232. title: '确认删除?',
  233. content: '此操作无法恢复,请确认!',
  234. onOk: () => {
  235. this.axios({
  236. method: 'post',
  237. url: '/api/purchase_arrive_del',
  238. data: {
  239. purchase_order_arrive_no: row.purchase_order_arrive_no
  240. }
  241. }).then((res) => {
  242. this.$Message.success(res.msg)
  243. this.initData()
  244. }).catch((err) => { });
  245. },
  246. onCancel: () => { }
  247. })
  248. break;
  249. case 5:
  250. this.$Modal.confirm({
  251. title: '确认提交?',
  252. onOk: () => {
  253. this.axios({
  254. method: 'post',
  255. url: '/api/purchase_arrive_pull',
  256. data: {
  257. purchase_order_arrive_no: row.purchase_order_arrive_no,
  258. lock: row.lock,
  259. state: row.state + 1
  260. }
  261. }).then((res) => {
  262. this.$Message.success(res.msg)
  263. this.initData()
  264. }).catch((err) => { });
  265. },
  266. onCancel: () => { }
  267. })
  268. break;
  269. }
  270. },
  271. handleGoPage (type, purchase_order_arrive_no) {
  272. this.$router.push({
  273. path: '/cms/PurchasingManage/ArrivalOrder/edit',
  274. query: {
  275. type,
  276. purchase_order_arrive_no
  277. }
  278. })
  279. },
  280. changeSize (e) {
  281. this.pageSize = e;
  282. this.initData()
  283. },
  284. changePage (e) {
  285. this.pageIndex = e;
  286. this.initData()
  287. }
  288. },
  289. // 监听属性 类似于data概念
  290. computed: {},
  291. // 监控data中的数据变化
  292. watch: {},
  293. beforeCreate () { }, // 生命周期 - 创建之前
  294. beforeMount () { }, // 生命周期 - 挂载之前
  295. beforeUpdate () { }, // 生命周期 - 更新之前
  296. updated () { }, // 生命周期 - 更新之后
  297. beforeDestroy () { }, // 生命周期 - 销毁之前
  298. destroyed () { }, // 生命周期 - 销毁完成
  299. activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
  300. }
  301. </script>
  302. <style lang='scss' scoped>
  303. .arrival_order_search {
  304. padding-top: 20px;
  305. /deep/.ivu-form {
  306. display: flex;
  307. justify-content: flex-start;
  308. flex-wrap: wrap;
  309. }
  310. /deep/.ivu-form-item {
  311. display: inline-block;
  312. width: 250px;
  313. }
  314. }
  315. .arrival_order_content {
  316. border-top: 1px solid #f4f4f4;
  317. margin-top: 20px;
  318. .arrival_order_content_btn {
  319. display: flex;
  320. justify-content: flex-end;
  321. padding: 20px 0;
  322. }
  323. .arrival_order_content_page {
  324. display: flex;
  325. justify-content: center;
  326. padding-top: 20px;
  327. }
  328. }
  329. </style>