selfDisk.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div class="selfDisk-wrap">
  3. <a-page-header :ghost="false" @back="handleBack" class="selfDisk-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="selfDisk-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
  7. </template>
  8. </a-page-header>
  9. <!-- 选择产品 -->
  10. <a-card size="small" :bordered="false" class="selfDisk-cont">
  11. <a-collapse :activeKey="['1']">
  12. <a-collapse-panel key="1">
  13. <template slot="header">选择产品</template>
  14. <!-- 选择产品 -->
  15. <div>
  16. <!-- 搜索条件 -->
  17. <div class="table-page-search-wrapper">
  18. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  19. <a-row :gutter="15">
  20. <a-col :md="6" :sm="24">
  21. <a-form-item label="关键词">
  22. <a-input id="selfDisk-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="产品名称/产品编码/原厂编码"/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="产品品牌">
  27. <a-select
  28. placeholder="请选择"
  29. id="selfDisk-state"
  30. allowClear
  31. v-model="queryParam.dataSourceNo"
  32. :showSearch="true"
  33. option-filter-prop="children"
  34. :filter-option="filterOption">
  35. <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  36. </a-select>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="6" :sm="24">
  40. <a-form-item label="产品类别">
  41. <a-cascader :options="typeData" id="selfDisk-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
  42. </a-form-item>
  43. </a-col>
  44. <template v-if="advanced">
  45. <a-col :md="6" :sm="24">
  46. <a-form-item label="库存">
  47. <a-select
  48. placeholder="请选择"
  49. id="selfDisk-state"
  50. allowClear
  51. v-model="queryParam.dataSourceNo"
  52. :showSearch="true"
  53. option-filter-prop="children"
  54. :filter-option="filterOption">
  55. <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  56. </a-select>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :md="6" :sm="24">
  60. <a-form-item label="仓库">
  61. <a-select
  62. placeholder="请选择"
  63. id="selfDisk-state"
  64. allowClear
  65. v-model="queryParam.dataSourceNo"
  66. :showSearch="true"
  67. option-filter-prop="children"
  68. :filter-option="filterOption">
  69. <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  70. </a-select>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="24">
  74. <a-form-item label="仓位">
  75. <a-select
  76. placeholder="请选择"
  77. id="selfDisk-state"
  78. allowClear
  79. v-model="queryParam.dataSourceNo"
  80. :showSearch="true"
  81. option-filter-prop="children"
  82. :filter-option="filterOption">
  83. <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  84. </a-select>
  85. </a-form-item>
  86. </a-col>
  87. </template>
  88. <a-col :md="6" :sm="24">
  89. <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="selfDisk-refresh">查询</a-button>
  90. <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="selfDisk-reset">重置</a-button>
  91. <a @click="advanced=!advanced" style="margin-left: 8px">
  92. {{ advanced ? '收起' : '展开' }}
  93. <a-icon :type="advanced ? 'up' : 'down'"/>
  94. </a>
  95. </a-col>
  96. </a-row>
  97. </a-form>
  98. </div>
  99. <!-- 列表 -->
  100. <s-table
  101. class="sTable"
  102. ref="table"
  103. size="default"
  104. :rowKey="(record) => record.id"
  105. :columns="columns"
  106. :data="loadData"
  107. :scroll="{ x: 1420 }"
  108. bordered>
  109. <!-- 操作 -->
  110. <template slot="action" slot-scope="text, record">
  111. <a-button size="small" type="link" @click="handleAdd(record)" id="selfDisk-add-btn">添加</a-button>
  112. </template>
  113. </s-table>
  114. </div>
  115. </a-collapse-panel>
  116. </a-collapse>
  117. </a-card>
  118. <!-- 已选产品 -->
  119. <a-card size="small" :bordered="false" class="selfDisk-cont">
  120. <a-collapse :activeKey="['1']">
  121. <a-collapse-panel key="1">
  122. <template slot="header">
  123. 已选产品
  124. <a-button size="small" class="import-btn" id="selfDisk-import-btn" @click.stop="handleImport">导入明细</a-button>
  125. </template>
  126. <!-- 已选产品 -->
  127. <div>
  128. <!-- 总计 -->
  129. <a-alert type="info" showIcon style="margin-bottom:15px">
  130. <div slot="message">产品款数 <strong>6</strong> ,采购数量合计 <strong>6</strong> ,采购金额合计¥<strong>6.33</strong></div>
  131. </a-alert>
  132. <!-- 列表 -->
  133. <s-table
  134. class="sTable"
  135. ref="table"
  136. size="default"
  137. :rowKey="(record) => record.id"
  138. :columns="chooseColumns"
  139. :data="chooseLoadData"
  140. :scroll="{ x: 1420 }"
  141. bordered>
  142. <!-- 操作 -->
  143. <template slot="action" slot-scope="text, record">
  144. <a-button size="small" type="link" @click="handleDel(record)" id="selfDisk-del-btn">删除</a-button>
  145. </template>
  146. </s-table>
  147. </div>
  148. </a-collapse-panel>
  149. </a-collapse>
  150. </a-card>
  151. <a-affix :offset-bottom="0">
  152. <div style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
  153. <a-button type="primary" id="warehouseAllocationEdit-submit" size="large" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
  154. </div>
  155. </a-affix>
  156. </div>
  157. </template>
  158. <script>
  159. import { STable, VSelect } from '@/components'
  160. export default {
  161. components: { STable, VSelect },
  162. data () {
  163. return {
  164. queryParam: {
  165. },
  166. brandData: [], // 产品品牌 下拉数据
  167. typeData: [], // 产品类别 下拉数据
  168. advanced: false, // 高级搜索 展开/关闭
  169. disabled: false, // 查询、重置按钮是否可操作
  170. // 表头
  171. columns: [
  172. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  173. { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
  174. { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
  175. { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  176. { title: '产品品牌', dataIndex: 'custssName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  177. { title: '产品级别', dataIndex: 'custsdName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  178. { title: '仓库', dataIndex: 'totalNums', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  179. { title: '仓位', dataIndex: 'totalNsums', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  180. { title: '库存数量', dataIndex: 'storageQuantity', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  181. { title: '单位', scopedSlots: { customRender: 'outOfStockNum' }, width: 100, align: 'center' },
  182. { title: '最后入库时间', scopedSlots: { customRender: 'purchaseNum' }, width: 160, align: 'center' },
  183. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  184. ],
  185. // 加载数据方法 必须为 Promise 对象
  186. loadData: parameter => {
  187. this.disabled = true
  188. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  189. // const data = res.data
  190. // const no = (data.pageNo - 1) * data.pageSize
  191. // for (var i = 0; i < data.list.length; i++) {
  192. // data.list[i].no = no + i + 1
  193. // }
  194. // this.disabled = false
  195. // return data
  196. // })
  197. const _this = this
  198. return new Promise(function (resolve, reject) {
  199. const data = {
  200. pageNo: 1,
  201. pageSize: 10,
  202. list: [
  203. { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  204. ],
  205. count: 10
  206. }
  207. const no = (data.pageNo - 1) * data.pageSize
  208. for (var i = 0; i < data.list.length; i++) {
  209. data.list[i].no = no + i + 1
  210. }
  211. _this.disabled = false
  212. resolve(data)
  213. })
  214. },
  215. // 表头
  216. chooseColumns: [
  217. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  218. { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', sorter: true },
  219. { title: '产品名称', dataIndex: 'custName', align: 'center' },
  220. { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center' },
  221. { title: '产品品牌', dataIndex: 'custsNasme', width: 100, align: 'center' },
  222. { title: '产品级别', dataIndex: 'custsNdme', width: 100, align: 'center' },
  223. { title: '仓库', dataIndex: 'totalNums', width: 100, align: 'center' },
  224. { title: '仓位', dataIndex: 'totalNsums', width: 100, align: 'center' },
  225. { title: '库存数量', dataIndex: 'storageQuantity', width: 100, align: 'center' },
  226. { title: '单位', scopedSlots: { customRender: 'outOfStockNum' }, width: 100, align: 'center' },
  227. { title: '最后入库时间', scopedSlots: { customRender: 'purchaseNum' }, width: 160, align: 'center' },
  228. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  229. ],
  230. // 加载数据方法 必须为 Promise 对象
  231. chooseLoadData: parameter => {
  232. this.disabled = true
  233. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  234. // const data = res.data
  235. // const no = (data.pageNo - 1) * data.pageSize
  236. // for (var i = 0; i < data.list.length; i++) {
  237. // data.list[i].no = no + i + 1
  238. // }
  239. // this.disabled = false
  240. // return data
  241. // })
  242. const _this = this
  243. return new Promise(function (resolve, reject) {
  244. const data = {
  245. pageNo: 1,
  246. pageSize: 10,
  247. list: [
  248. { id: '1', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
  249. { id: '2', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
  250. { id: '3', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  251. ],
  252. count: 10
  253. }
  254. const no = (data.pageNo - 1) * data.pageSize
  255. for (var i = 0; i < data.list.length; i++) {
  256. data.list[i].no = no + i + 1
  257. }
  258. _this.disabled = false
  259. resolve(data)
  260. })
  261. },
  262. openModal: false // 选择基本信息弹框是否显示
  263. }
  264. },
  265. methods: {
  266. // 重置
  267. resetSearchForm () {
  268. this.queryParam.orderBundleNo = ''
  269. this.queryParam.orderBundle.custMobile = ''
  270. this.queryParam.bundleName = ''
  271. this.queryParam.itemName = ''
  272. this.oldTime = undefined
  273. this.newTime = undefined
  274. this.$refs.table.refresh(true)
  275. },
  276. // 提交
  277. handleSubmit () {},
  278. // 添加
  279. handleAdd (row) {},
  280. // 删除
  281. handleDel (row) {},
  282. // 编辑基本信息
  283. handleEditInfo () {
  284. this.openModal = true
  285. },
  286. // 基本信息 保存
  287. handleOk () {
  288. },
  289. // 导入明细
  290. handleImport () {
  291. console.log(333)
  292. },
  293. // 返回列表
  294. handleBack () {
  295. this.$router.push({ path: '/inventoryManagement/inventoryChecking/list' })
  296. },
  297. filterOption (input, option) {
  298. return (
  299. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  300. )
  301. }
  302. },
  303. beforeRouteEnter (to, from, next) {
  304. next(vm => {
  305. vm.openModal = false
  306. })
  307. }
  308. }
  309. </script>
  310. <style lang="less">
  311. .selfDisk-wrap{
  312. .selfDisk-back{
  313. margin-bottom: 15px;
  314. }
  315. .selfDisk-cont{
  316. margin-bottom: 15px;
  317. .import-btn{
  318. margin-left: 15px;
  319. }
  320. }
  321. }
  322. </style>