SippliersStockPriceList.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div class="SippliersStockPriceList">
  3. <Toptitle title="供应商存货价格表">
  4. <slot name="titleButton">
  5. </slot>
  6. </Toptitle>
  7. <div class="content">
  8. <div class="content_top">
  9. <div class="content_top_form">
  10. <Form :label-width="120"
  11. :model="searchData">
  12. <FormItem label="供应商分类编码:">
  13. <Input type="text"
  14. size="small"
  15. v-model="searchData.type_code"
  16. style="width: 150px"
  17. placeholder="供应商分类编码" />
  18. </FormItem>
  19. <FormItem label="供应商分类名称:">
  20. <Input type="text"
  21. size="small"
  22. v-model="searchData.type_title"
  23. style="width: 150px"
  24. placeholder="供应商分类名称" />
  25. </FormItem>
  26. <FormItem label="供应商编码:">
  27. <Input type="text"
  28. size="small"
  29. v-model="searchData.code"
  30. style="width: 150px"
  31. placeholder="供应商编码" />
  32. </FormItem>
  33. <FormItem label="供应商名称:">
  34. <Input type="text"
  35. size="small"
  36. v-model="searchData.title"
  37. style="width: 150px"
  38. placeholder="供应商名称" />
  39. </FormItem>
  40. <FormItem label="审核状态:">
  41. <Select v-model="searchData.state"
  42. size="small"
  43. clearable
  44. style="width: 150px">
  45. <Option label='已审核'
  46. :value=1 />
  47. <Option label='未审核'
  48. :value=0 />
  49. </Select>
  50. </FormItem>
  51. </Form>
  52. <div class="content_top_btn">
  53. <Button type="primary"
  54. @click="initData"
  55. size="small">搜索</Button>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="content_body">
  60. <div class="content_body_btn">
  61. <Button type="primary"
  62. style="margin-right:10px;">导入</Button>
  63. <Button @click="exportData()" type="primary" style="margin-right: 10px">导出</Button>
  64. <Button type="primary"
  65. @click="handleSet(1,'')">新增</Button>
  66. </div>
  67. <Table :columns="tableColumns"
  68. border
  69. :data="tableData">
  70. <template slot="setSlot"
  71. slot-scope="{row,index}">
  72. <a style="margin:0 5px;color:orange"
  73. @click="handleSet(2,row,index)">{{row.state==0?"审核":"弃审"}}</a>
  74. <a style="margin:0 5px"
  75. @click="handleSet(3,row,index)">查看</a>
  76. <a style="margin:0 5px"
  77. :disabled="row.state==1"
  78. @click="handleSet(4,row,index)">编辑</a>
  79. <a style="margin:0 5px;color:#00FF00"
  80. :disabled="row.state==0"
  81. @click="handleSet(5,row,index)">变更</a>
  82. <a style="margin:0 5px;color:#FFBB00 "
  83. @click="handleSet(6,row,index)">变更记录</a>
  84. <a style="margin:0 5px;color:red"
  85. @click="handleSet(7,row,index)">删除</a>
  86. </template>
  87. </Table>
  88. <div class="content_body_page">
  89. <Page :page-size-opts="[10, 20, 30, 40,100]"
  90. @on-page-size-change='changeSize'
  91. @on-change='changePage'
  92. :current='pageIndex'
  93. show-total
  94. show-elevator
  95. :total="total"
  96. show-sizer
  97. :page-size='pageSize' />
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  105. // 例如:import 《组件名称》 from '《组件路径》';
  106. export default {
  107. name: 'SippliersStockPriceList',
  108. components: {
  109. },
  110. props: {},
  111. // import引入的组件需要注入到对象中才能使用
  112. data () {
  113. // 这里存放数据
  114. return {
  115. searchData: {
  116. type_code:'',
  117. code: '',
  118. title: '',
  119. state: '',
  120. type_title:'',
  121. },
  122. tableColumns: [
  123. { title: '供应商分类编码', key: 'type_code', align: 'center', minWidth: 140 },
  124. { title: '供应商分类名称', key: 'type_title', align: 'center', minWidth: 140 },
  125. { title: '供应商编码', key: 'code', align: 'center', minWidth: 120 },
  126. { title: '供应商名称', key: 'title', align: 'center', minWidth: 120 },
  127. { title: '审核人', key: 'nickname', align: 'center', minWidth: 120 },
  128. {
  129. title: '审核状态', key: 'state', align: 'center', minWidth: 120,
  130. render: (h, params) => {
  131. const { row } = params
  132. return h('span', {}, row.state == 0 ? '未审核' : '已审核')
  133. }
  134. },
  135. { title: '操作', key: 'code', align: 'center', minWidth: 250, slot: 'setSlot' },
  136. ],
  137. tableData: [{}],
  138. pageIndex: 1,
  139. pageSize: 10,
  140. total: 0,
  141. }
  142. },
  143. // 生命周期 - 创建完成(可以访问当前this实例)
  144. created () {
  145. },
  146. // 生命周期 - 挂载完成(可以访问DOM元素)
  147. mounted () {
  148. this.initData()
  149. },
  150. methods: {
  151. initData () {
  152. this.axios({
  153. method: 'get',
  154. url: '/api/supply_material_list',
  155. params: {
  156. ...this.searchData
  157. }
  158. }).then((res) => {
  159. console.log(res);
  160. this.tableData = res.data.data
  161. this.total = res.data.total
  162. }).catch((err) => { });
  163. },
  164. // 1新增 2审核 3查看 4编辑 5变更 6变更记录 7删除
  165. handleSet (type, row, index) {
  166. switch (type) {
  167. case 1:
  168. this.handleGoPage(type, '')
  169. break;
  170. case 2:
  171. this.$Modal.confirm({
  172. title: row.state == 0 ?'确认审核?':'确认弃审?',
  173. content: row.state == 0 ?'此操作将审核订单,请确认!':'此操作将弃审订单,请确认!',
  174. onOk: () => {
  175. this.axios({
  176. method: 'post',
  177. url: '/api/supply_material_pull',
  178. data: {
  179. supply_id: row.supply_id,
  180. state: row.state == 0 ? 1 : 0
  181. }
  182. }).then((res) => {
  183. this.$Message.success(res.msg)
  184. this.initData()
  185. }).catch((err) => { });
  186. },
  187. onCancel: () => { }
  188. })
  189. break;
  190. case 3:
  191. case 4:
  192. case 5:
  193. this.handleGoPage(type, row.supply_id,row.state)
  194. break;
  195. case 6:
  196. break;
  197. case 7:
  198. this.$Modal.confirm({
  199. title: '确认删除?',
  200. content: '此操作无法恢复,请确认!',
  201. onOk: () => {
  202. this.axios({
  203. method: 'get',
  204. url: '/api/supply_material_del',
  205. params: {
  206. supply_id: row.supply_id
  207. }
  208. }).then((res) => {
  209. this.$Message.success(res.msg)
  210. this.initData()
  211. }).catch((err) => { });
  212. },
  213. onCancel: () => { }
  214. })
  215. break;
  216. }
  217. },
  218. handleGoPage (type, supply_id,state) {
  219. this.$router.push({
  220. path: '/cms/BasicSettings/SuppliersManage/SippliersStockPriceListEdit',
  221. query: {
  222. type,
  223. supply_id,
  224. state,
  225. }
  226. })
  227. },
  228. changeSize (e) {
  229. this.pageSize = e;
  230. this.initData()
  231. },
  232. changePage (e) {
  233. this.pageIndex = e;
  234. this.initData()
  235. },
  236. async exportData(){
  237. const res = await this.axios('/api/supply_material_export')
  238. if(res.code == 200){
  239. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`
  240. location.href = url
  241. }
  242. }
  243. },
  244. // 监听属性 类似于data概念
  245. computed: {},
  246. // 监控data中的数据变化
  247. watch: {},
  248. beforeCreate () { }, // 生命周期 - 创建之前
  249. beforeMount () { }, // 生命周期 - 挂载之前
  250. beforeUpdate () { }, // 生命周期 - 更新之前
  251. updated () { }, // 生命周期 - 更新之后
  252. beforeDestroy () { }, // 生命周期 - 销毁之前
  253. destroyed () { }, // 生命周期 - 销毁完成
  254. activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
  255. }
  256. </script>
  257. <style lang='scss' scoped>
  258. .content {
  259. .content_top {
  260. border-bottom: 1px solid #e8eaec;
  261. .content_top_form {
  262. margin-top: 20px;
  263. /deep/.ivu-form {
  264. display: flex;
  265. justify-content: flex-start;
  266. flex-wrap: wrap;
  267. }
  268. /deep/.ivu-form-item {
  269. display: inline-block;
  270. width: 280px;
  271. }
  272. }
  273. .content_top_btn {
  274. display: flex;
  275. justify-content: flex-end;
  276. padding-bottom: 10px;
  277. }
  278. }
  279. .content_body {
  280. margin-top: 20px;
  281. .content_body_btn {
  282. display: flex;
  283. justify-content: flex-end;
  284. padding: 10px 0;
  285. }
  286. .content_body_page {
  287. display: flex;
  288. justify-content: center;
  289. padding-top: 20px;
  290. }
  291. }
  292. }
  293. </style>