list.vue 11 KB

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