list.vue 11 KB

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