edit.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <div class="chainTransferOutEdit-wrap">
  3. <a-page-header :ghost="false" @back="handleBack" class="chainTransferOutEdit-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="chainTransferOutEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
  7. </template>
  8. <!-- 操作区,位于 title 行的行尾 -->
  9. <template slot="extra">
  10. <a-button key="2" id="chainTransferOutEdit-preview-btn">打印预览</a-button>
  11. <a-button key="1" type="primary" id="chainTransferOutEdit-print-btn">快速打印</a-button>
  12. </template>
  13. </a-page-header>
  14. <!-- 基础信息 -->
  15. <a-card size="small" :bordered="false" class="chainTransferOutEdit-cont">
  16. <a-collapse :activeKey="['1']">
  17. <a-collapse-panel key="1">
  18. <template slot="header">
  19. 基础信息
  20. <a-button
  21. type="primary"
  22. shape="circle"
  23. size="small"
  24. icon="edit"
  25. class="edit-circle-btn"
  26. id="chainTransferOutEdit-circle-btn"
  27. @click.stop="handleEditInfo" />
  28. </template>
  29. <a-descriptions :column="3">
  30. <a-descriptions-item label="调往对象">箭冠营销中心</a-descriptions-item>
  31. </a-descriptions>
  32. </a-collapse-panel>
  33. </a-collapse>
  34. </a-card>
  35. <!-- 选择产品 -->
  36. <a-card size="small" :bordered="false" class="chainTransferOutEdit-cont">
  37. <a-collapse :activeKey="['1']">
  38. <a-collapse-panel key="1" header="选择产品">
  39. <!-- 筛选条件 -->
  40. <div class="table-page-search-wrapper">
  41. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  42. <a-row :gutter="15">
  43. <a-col :md="6" :sm="24">
  44. <a-form-item label="产品编码" prop="name">
  45. <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品编码" allowClear />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="24">
  49. <a-form-item label="产品名称" prop="name">
  50. <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品名称" allowClear />
  51. </a-form-item>
  52. </a-col>
  53. <a-col :md="6" :sm="24">
  54. <a-form-item label="原厂编码" prop="name">
  55. <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入原厂编码" allowClear />
  56. </a-form-item>
  57. </a-col>
  58. <template v-if="advanced">
  59. <a-col :md="6" :sm="24">
  60. <a-form-item label="产品品牌">
  61. <a-select
  62. placeholder="请选择"
  63. id="chainTransferOutEdit-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-cascader :options="typeData" id="chainTransferOutEdit-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-item label="仓库">
  80. <v-select
  81. v-model="queryParam.billStatus"
  82. ref="billStatus"
  83. id="chainTransferOutEdit-billStatus"
  84. code="PAYMENT_TYPE"
  85. placeholder="请选择仓库"
  86. allowClear></v-select>
  87. </a-form-item>
  88. </a-col>
  89. </template>
  90. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  91. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferOutEdit-refresh">查询</a-button>
  92. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutEdit-reset">重置</a-button>
  93. <a @click="advanced=!advanced" style="margin-left: 8px">
  94. {{ advanced ? '收起' : '展开' }}
  95. <a-icon :type="advanced ? 'up' : 'down'"/>
  96. </a>
  97. </a-col>
  98. </a-row>
  99. </a-form>
  100. </div>
  101. <!-- 列表 -->
  102. <s-table
  103. class="sTable"
  104. ref="table"
  105. size="default"
  106. :rowKey="(record) => record.id"
  107. :columns="columns"
  108. :data="loadData"
  109. :scroll="{ x: 1530 }"
  110. bordered>
  111. <!-- 调出数量 -->
  112. <template slot="transferOutQuantity" slot-scope="text, record">
  113. <a-input-number
  114. id="chainTransferOutEdit-storageQuantity"
  115. :value="record.storageQuantity"
  116. :precision="0"
  117. :min="0"
  118. :max="999999"
  119. placeholder="请输入" />
  120. </template>
  121. <!-- 操作 -->
  122. <template slot="action" slot-scope="text, record">
  123. <a-button size="small" type="link" @click="handleAdd(record)" id="chainTransferOutEdit-add-btn">添加</a-button>
  124. </template>
  125. </s-table>
  126. </a-collapse-panel>
  127. </a-collapse>
  128. </a-card>
  129. <!-- 已选产品 -->
  130. <a-card size="small" :bordered="false" class="chainTransferOutEdit-cont">
  131. <a-collapse :activeKey="['1']">
  132. <a-collapse-panel key="1" header="已选产品">
  133. <!-- 总计 -->
  134. <a-alert type="info" showIcon style="margin-bottom:15px">
  135. <div slot="message">总成本:¥<strong>6.33</strong>,总数量: <strong>6</strong> ,总款数: <strong>6</strong> </div>
  136. </a-alert>
  137. <!-- 筛选条件 -->
  138. <a-row :gutter="15" justify="space-between">
  139. <a-col :span="17">
  140. <div class="table-page-search-wrapper">
  141. <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
  142. <a-row :gutter="15">
  143. <a-col :md="9" :sm="24">
  144. <a-form-item label="产品编码" prop="name">
  145. <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品编码" allowClear />
  146. </a-form-item>
  147. </a-col>
  148. <a-col :md="9" :sm="24">
  149. <a-form-item label="产品名称" prop="name">
  150. <a-input id="chainTransferOutEdit-name" v-model="queryParam.name" placeholder="请输入产品名称" allowClear />
  151. </a-form-item>
  152. </a-col>
  153. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  154. <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="disabled" id="chainTransferOutList-refresh">查询</a-button>
  155. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-reset">重置</a-button>
  156. </a-col>
  157. </a-row>
  158. </a-form>
  159. </div>
  160. </a-col>
  161. <a-col :span="7">
  162. <a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button>
  163. <a-button size="small" type="danger" style="margin-left: 8px" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
  164. </a-col>
  165. </a-row>
  166. <!-- 列表 -->
  167. <s-table
  168. class="sTable"
  169. ref="chooseTable"
  170. size="default"
  171. :rowKey="(record) => record.id"
  172. :columns="chooseColumns"
  173. :data="chooseLoadData"
  174. :scroll="{ x: 1545 }"
  175. bordered>
  176. <!-- 调出数量 -->
  177. <template slot="transferOutQuantity" slot-scope="text, record">
  178. <a-input-number
  179. id="chainTransferOutEdit-storageQuantity"
  180. :value="record.storageQuantity"
  181. :precision="0"
  182. :min="0"
  183. :max="999999"
  184. placeholder="请输入" />
  185. </template>
  186. <!-- 操作 -->
  187. <template slot="action" slot-scope="text, record">
  188. <a-button size="small" type="link" @click="handleDel(record)" id="chainTransferOutEdit-del-btn">删除</a-button>
  189. </template>
  190. </s-table>
  191. </a-collapse-panel>
  192. </a-collapse>
  193. </a-card>
  194. <a-affix :offset-bottom="0">
  195. <div style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
  196. <a-button type="primary" id="chainTransferOutEdit-submit" size="large" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
  197. </div>
  198. </a-affix>
  199. <!-- 选择基本信息弹框 -->
  200. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  201. </div>
  202. </template>
  203. <script>
  204. import { STable, VSelect } from '@/components'
  205. import basicInfoModal from './basicInfoModal.vue'
  206. export default {
  207. components: { STable, VSelect, basicInfoModal },
  208. data () {
  209. return {
  210. queryParam: {
  211. },
  212. brandData: [], // 产品品牌 下拉数据
  213. typeData: [], // 产品类别 下拉数据
  214. disabled: false, // 查询、重置按钮是否可操作
  215. advanced: false, // 高级搜索 展开/关闭
  216. // 表头
  217. columns: [
  218. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  219. { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center' },
  220. { title: '产品名称', dataIndex: 'custNahme', align: 'center', ellipsis: true },
  221. { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  222. { title: '品牌', dataIndex: 'custsNsame', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  223. { title: '仓库', dataIndex: 'custsNdame', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  224. { title: '仓位', dataIndex: 'custsNafme', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  225. { title: '成本价(¥)', dataIndex: 'storageQuantity', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  226. { title: '库存数量', dataIndex: 'custsNagme', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  227. { title: '单位', dataIndex: 'custsNsagme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  228. { title: '调出数量', scopedSlots: { customRender: 'transferOutQuantity' }, width: 150, align: 'center' },
  229. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  230. ],
  231. // 加载数据方法 必须为 Promise 对象
  232. loadData: parameter => {
  233. this.disabled = true
  234. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  235. // const data = res.data
  236. // const no = (data.pageNo - 1) * data.pageSize
  237. // for (var i = 0; i < data.list.length; i++) {
  238. // data.list[i].no = no + i + 1
  239. // }
  240. // this.disabled = false
  241. // return data
  242. // })
  243. const _this = this
  244. return new Promise(function (resolve, reject) {
  245. const data = {
  246. pageNo: 1,
  247. pageSize: 10,
  248. list: [
  249. { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  250. ],
  251. count: 10
  252. }
  253. const no = (data.pageNo - 1) * data.pageSize
  254. for (var i = 0; i < data.list.length; i++) {
  255. data.list[i].no = no + i + 1
  256. }
  257. _this.disabled = false
  258. resolve(data)
  259. })
  260. },
  261. // 表头
  262. chooseColumns: [
  263. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  264. { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  265. { title: '产品名称', dataIndex: 'custNahme', align: 'center', ellipsis: true },
  266. { title: '原厂编码', dataIndex: 'totalP', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  267. { title: '品牌', dataIndex: 'custsNsame', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  268. { title: '仓库', dataIndex: 'custsNdame', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  269. { title: '仓位', dataIndex: 'custsNafme', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  270. { title: '成本价(¥)', dataIndex: 'storageQuantity', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  271. { title: '单位', dataIndex: 'custsNsagme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  272. { title: '调出数量', scopedSlots: { customRender: 'transferOutQuantity' }, width: 150, align: 'center' },
  273. { title: '成本小计(¥)', dataIndex: 'custsNagme', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  274. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  275. ],
  276. // 加载数据方法 必须为 Promise 对象
  277. chooseLoadData: parameter => {
  278. this.disabled = true
  279. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  280. // const data = res.data
  281. // const no = (data.pageNo - 1) * data.pageSize
  282. // for (var i = 0; i < data.list.length; i++) {
  283. // data.list[i].no = no + i + 1
  284. // }
  285. // this.disabled = false
  286. // return data
  287. // })
  288. const _this = this
  289. return new Promise(function (resolve, reject) {
  290. const data = {
  291. pageNo: 1,
  292. pageSize: 10,
  293. list: [
  294. { id: '1', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  295. ],
  296. count: 10
  297. }
  298. const no = (data.pageNo - 1) * data.pageSize
  299. for (var i = 0; i < data.list.length; i++) {
  300. data.list[i].no = no + i + 1
  301. }
  302. _this.disabled = false
  303. resolve(data)
  304. })
  305. },
  306. openModal: false // 选择基本信息弹框是否显示
  307. }
  308. },
  309. methods: {
  310. // 重置
  311. resetSearchForm () {
  312. this.queryParam.orderBundleNo = ''
  313. this.queryParam.orderBundle.custMobile = ''
  314. this.queryParam.bundleName = ''
  315. this.queryParam.itemName = ''
  316. this.oldTime = undefined
  317. this.newTime = undefined
  318. this.$refs.table.refresh(true)
  319. },
  320. // 添加
  321. handleAdd (row) {},
  322. // 删除
  323. handleDel (row) {},
  324. // 编辑基本信息
  325. handleEditInfo () {
  326. this.openModal = true
  327. },
  328. // 基本信息 保存
  329. handleOk () {
  330. },
  331. // 提交
  332. handleSubmit () {},
  333. // 导入明细
  334. handleImport () {
  335. console.log(333)
  336. },
  337. // 返回列表
  338. handleBack () {
  339. this.$router.push({ path: '/allocationManagement/chainTransferOut/list' })
  340. },
  341. filterOption (input, option) {
  342. return (
  343. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  344. )
  345. }
  346. },
  347. beforeRouteEnter (to, from, next) {
  348. next(vm => {
  349. vm.openModal = false
  350. })
  351. }
  352. }
  353. </script>
  354. <style lang="less">
  355. .chainTransferOutEdit-wrap{
  356. .chainTransferOutEdit-back{
  357. margin-bottom: 15px;
  358. }
  359. .chainTransferOutEdit-cont{
  360. margin-bottom: 15px;
  361. .sub-title{
  362. font-size: 12px;
  363. color: #808695;
  364. margin-left: 10px;
  365. }
  366. .tag-txt{
  367. font-size: 12px;
  368. color: #ed1c24;
  369. }
  370. .edit-circle-btn{
  371. margin-left: 15px;
  372. i{
  373. vertical-align: text-bottom;
  374. }
  375. }
  376. .import-btn{
  377. margin-left: 15px;
  378. }
  379. }
  380. }
  381. </style>