index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <div id="MaterialClassDivision">
  3. <div v-if="isList">
  4. <el-form class="search_area" label-width="130px">
  5. <el-row :gutter="10">
  6. <el-col :span="1.5">
  7. <el-form-item label="物料一级大类编码">
  8. <el-input
  9. v-model="queryParams.materialClassifyOne"
  10. clearable
  11. size="mini"
  12. style="width: 200px"
  13. />
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="1.5">
  17. <el-form-item label="物料一级大类名称">
  18. <el-input
  19. v-model="queryParams.materialClassifyOneName"
  20. clearable
  21. size="mini"
  22. style="width: 200px"
  23. />
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="1.5">
  27. <el-form-item label="物料二级大类编码">
  28. <el-input
  29. v-model="queryParams.materialClassifyTwo"
  30. clearable
  31. size="mini"
  32. style="width: 200px"
  33. />
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-form-item label="物料二级大类名称">
  38. <el-input
  39. v-model="queryParams.materialClassifyTwoName"
  40. clearable
  41. size="mini"
  42. style="width: 200px"
  43. />
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-form-item label="" label-width="20px">
  48. <el-button type="primary" size="mini" icon="el-icon-search" plain @click="searchList">搜索</el-button>
  49. <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <CollapseTransition>
  54. <div v-show="expanded">
  55. <el-row :gutter="10">
  56. <el-col :span="1.5">
  57. <el-form-item label="物料三级大类编码">
  58. <el-input
  59. v-model="queryParams.materialClassifyThree"
  60. clearable
  61. size="mini"
  62. style="width: 200px"
  63. />
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-form-item label="物料三级大类名称">
  68. <el-input
  69. v-model="queryParams.materialClassifyThreeName"
  70. clearable
  71. size="mini"
  72. style="width: 200px"
  73. />
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-form-item label="物料四级大类编码">
  78. <el-input size="mini" style="width: 200px" readonly v-model="queryParams.materialClassifyFour">
  79. <el-button slot="append" icon="el-icon-more" @click="chooseFourClass"></el-button>
  80. </el-input>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="1.5">
  84. <el-form-item label="物料四级大类名称">
  85. <el-input
  86. v-model="queryParams.materialClassifyFourName"
  87. clearable
  88. size="mini"
  89. style="width: 200px"
  90. />
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <el-row :gutter="10">
  95. <el-col :span="1.5">
  96. <el-form-item label="物料编码">
  97. <el-input style="width: 200px" size="mini" readonly v-model="queryParams.materialCode">
  98. <el-button slot="append" icon="el-icon-more" @click="test01"></el-button>
  99. </el-input>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="1.5">
  103. <el-form-item label="物料名称">
  104. <el-input
  105. v-model="queryParams.materialName"
  106. clearable
  107. size="mini"
  108. style="width: 200px"
  109. />
  110. </el-form-item>
  111. </el-col>
  112. <el-col :span="1.5">
  113. <el-form-item label="订单员">
  114. <el-select
  115. ref="staffs"
  116. size="mini"
  117. style="width: 200px"
  118. v-model="queryParams.orderPersonal"
  119. clearable
  120. @focus="chooseRefer('CONTACTS_PARAM', true, '订单员')"
  121. >
  122. <el-option
  123. v-for="item in staffOptions"
  124. :key="item.id"
  125. :label="item.name"
  126. :value="item.code"
  127. />
  128. </el-select>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="1.5">
  132. <el-form-item label="采购员">
  133. <el-select
  134. ref="staffs2"
  135. size="mini"
  136. style="width: 200px"
  137. v-model="queryParams.buyer"
  138. clearable
  139. @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')"
  140. >
  141. <el-option
  142. v-for="item in staff2Options"
  143. :key="item.id"
  144. :label="item.name"
  145. :value="item.code"
  146. />
  147. </el-select>
  148. </el-form-item>
  149. </el-col>
  150. </el-row>
  151. <el-row :gutter="10">
  152. <el-col :span="1.5">
  153. <el-form-item label="生产厂家">
  154. <el-input
  155. v-model="queryParams.manufacturer"
  156. size="mini"
  157. placeholder=""
  158. clearable
  159. style="width: 200px"
  160. />
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="1.5">
  164. <el-form-item label="备注">
  165. <el-input
  166. v-model="queryParams.remark"
  167. size="mini"
  168. placeholder=""
  169. clearable
  170. style="width: 200px"
  171. />
  172. </el-form-item>
  173. </el-col>
  174. </el-row>
  175. </div>
  176. </CollapseTransition>
  177. </el-form>
  178. <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'" @click="drop"></i></el-divider>
  179. <el-card>
  180. <div class="btn_grooup">
  181. <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
  182. <el-dropdown size="mini" @command="handleCommand">
  183. <el-button size="mini" type="primary" style="margin-left: 10px;">
  184. 导入<i class="el-icon-arrow-down el-icon--right"></i>
  185. </el-button>
  186. <el-dropdown-menu slot="dropdown">
  187. <el-dropdown-item command="数据导入">数据导入</el-dropdown-item>
  188. <el-dropdown-item command="模板下载">模板下载</el-dropdown-item>
  189. </el-dropdown-menu>
  190. </el-dropdown>
  191. <el-dropdown size="mini" @command="handleCommand">
  192. <el-button size="mini" type="primary" style="margin: 0 10px;">
  193. 导出<i class="el-icon-arrow-down el-icon--right"></i>
  194. </el-button>
  195. <el-dropdown-menu slot="dropdown">
  196. <el-dropdown-item command="Excel导出">Excel导出</el-dropdown-item>
  197. <el-dropdown-item command="导出明细">导出明细</el-dropdown-item>
  198. </el-dropdown-menu>
  199. </el-dropdown>
  200. <el-button type="primary" size="mini">删除</el-button>
  201. </div>
  202. <el-table
  203. :data="tableList"
  204. fit
  205. max-height="480"
  206. style="font-size: 12px;"
  207. @selection-change="handleSelectionChange"
  208. >
  209. <el-table-column show-overflow-tooltip type="selection" width="55" />
  210. <el-table-column show-overflow-tooltip label="物料分类编码" align="center" width="150" prop="materialClassify"/>
  211. <el-table-column show-overflow-tooltip label="物料分类名称" align="center" width="200" prop="materialClassifyName" />
  212. <el-table-column show-overflow-tooltip label="一级分类名称" align="center" width="150" prop="materialClassifyOneName" />
  213. <el-table-column show-overflow-tooltip label="二级分类名称" align="center" width="150" prop="materialClassifyTwoName" />
  214. <el-table-column show-overflow-tooltip label="三级分类名称" align="center" width="150" prop="materialClassifyThreeName"/>
  215. <el-table-column show-overflow-tooltip label="四级分类名称" align="center" width="150" prop="materialClassifyFourName" />
  216. <el-table-column show-overflow-tooltip label="物料编码" align="center" width="150" prop="material" />
  217. <el-table-column show-overflow-tooltip label="物料名称" align="center" prop="materialName" />
  218. <el-table-column show-overflow-tooltip label="生产厂商" align="center" width="150" prop="manufacturer" />
  219. <el-table-column show-overflow-tooltip label="所属组织" align="center" width="120" prop="orgName"/>
  220. <el-table-column show-overflow-tooltip label="订单员" align="center" width="150" prop="orderPersonalName" />
  221. <el-table-column show-overflow-tooltip label="采购员" align="center" width="150" prop="buyerName" />
  222. <el-table-column show-overflow-tooltip label="订单部门" align="center" width="150" prop="orderDeptName" />
  223. <el-table-column show-overflow-tooltip label="部门" align="center" width="150" prop="puDeptName" />
  224. <el-table-column show-overflow-tooltip label="创建人" align="center" width="150" prop="createByName" />
  225. <el-table-column show-overflow-tooltip label="创建时间" align="center" width="150" prop="createTime" />
  226. <el-table-column show-overflow-tooltip label="修改人" align="center" width="150" prop="updateByName" />
  227. <el-table-column show-overflow-tooltip label="修改时间" align="center" width="150" prop="updateTime" />
  228. <el-table-column
  229. fixed="right"
  230. label="操作"
  231. align="center"
  232. width="150"
  233. >
  234. <template slot-scope="scope">
  235. <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
  236. <el-button type="text" size="mini" @click="edit(scope.row)">编辑</el-button>
  237. <el-button type="text" size="mini" @click="deleteids(scope.row)">删除</el-button>
  238. </template>
  239. </el-table-column>
  240. </el-table>
  241. <el-pagination
  242. background
  243. @size-change="handleSizeChange"
  244. @current-change="handleCurrentChange"
  245. :current-page="queryParams.pageNum"
  246. :page-sizes="[10, 15, 20]"
  247. :page-size="100"
  248. layout="total, sizes, prev, pager, next, jumper"
  249. :total=total>
  250. </el-pagination>
  251. </el-card>
  252. </div>
  253. <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="getList"/>
  254. <fourClass
  255. ref="fourClass"
  256. @doSubmit="acceptFourClass"
  257. :single="true"
  258. />
  259. <popDialog
  260. ref="contractSelect"
  261. @doSubmit="selectionsToInput"
  262. :single="true"
  263. />
  264. <Refers ref="refer" @doSubmit="selectionsRefer" :single="true"/>
  265. </div>
  266. </template>
  267. <script>
  268. import Add from './add.vue'
  269. import CollapseTransition from '@/components/MyCollapse/collapse.vue'
  270. import {getDivisionList, delDivision} from '@/api/purchase/basic.js'
  271. // 物料分类
  272. import fourClass from '@/components/PopDialog/fourClass.vue'
  273. // 物料编码
  274. import popDialog from '@/components/PopDialog/index.vue'
  275. import Refers from '@/components/Refers/refers.vue'
  276. export default {
  277. name: 'MaterialClassDivision',
  278. components: {
  279. Add,
  280. CollapseTransition,
  281. fourClass,
  282. popDialog,
  283. Refers
  284. },
  285. data() {
  286. return {
  287. expanded: false,
  288. // 页面配置
  289. isList: true,
  290. // 页面状态
  291. page: '',
  292. queryParams: {
  293. materialClassifyOne: '',
  294. materialClassifyOneName: '',
  295. materialClassifyTwo: '',
  296. materialClassifyTwoName: '',
  297. materialClassifyThree: '',
  298. materialClassifyThreeName: '',
  299. materialClassifyFour: '',
  300. materialClassifyFourName: '',
  301. materialCode: '',
  302. materialName: '',
  303. orderPersonal: '',
  304. buyer: '',
  305. manufacturer: '',
  306. remark: '',
  307. pageNum: 1,
  308. pageSize: 10
  309. },
  310. options: [{
  311. value: 'Y', label: '是',
  312. }, {
  313. value: 'N', label: '否'
  314. }],
  315. staffOptions: [],
  316. staff2Options: [],
  317. referCondition: {
  318. type: '',
  319. isPage: true,
  320. title: ''
  321. },
  322. tableList: [],
  323. total: 0,
  324. rowDetail: {},
  325. disable: false
  326. }
  327. },
  328. created() {
  329. this.getList(this.queryParams)
  330. },
  331. methods: {
  332. getList(params){
  333. getDivisionList(params).then(res => {
  334. if (res.code === 200) {
  335. this.tableList = res.rows
  336. this.total = res.total
  337. }
  338. })
  339. },
  340. searchList() {
  341. this.getList(this.queryParams)
  342. },
  343. resetList() {
  344. this.queryParams = {
  345. materialClassifyOne: '',
  346. materialClassifyOneName: '',
  347. materialClassifyTwo: '',
  348. materialClassifyTwoName: '',
  349. materialClassifyThree: '',
  350. materialClassifyThreeName: '',
  351. materialClassifyFour: '',
  352. materialClassifyFourName: '',
  353. materialCode: '',
  354. materialName: '',
  355. orderPersonal: '',
  356. buyer: '',
  357. manufacturer: '',
  358. remark: '',
  359. pageNum: 1,
  360. pageSize: 10
  361. }
  362. this.getList(this.queryParams)
  363. },
  364. handleSelectionChange() {},
  365. handleCommand(command) {
  366. alert(command)
  367. },
  368. addDivision() {
  369. this.isList = false
  370. this.page = 'add'
  371. this.disable = false
  372. },
  373. check(row) {
  374. this.isList = false
  375. this.page = 'check'
  376. this.rowDetail = row
  377. this.disable = true
  378. },
  379. edit(row) {
  380. this.isList = false
  381. this.page = 'edit'
  382. this.rowDetail = row
  383. this.disable = false
  384. },
  385. deleteids(row) {
  386. console.log('row', row)
  387. this.$modal.confirm('确认信息').then(() => {
  388. delDivision(row.id).then(res => {
  389. if (res.code === 200) {
  390. this.$modal.msgSuccess("删除成功");
  391. this.getList(this.queryParams)
  392. }
  393. })
  394. }).catch(() => {})
  395. },
  396. handleSizeChange(val) {
  397. console.log(`每页 ${val} 条`);
  398. this.queryParams.pageSize = val
  399. this.getList(this.queryParams)
  400. },
  401. handleCurrentChange(val) {
  402. console.log(`当前页: ${val}`);
  403. this.queryParams.pageNum = val
  404. this.getList(this.queryParams)
  405. },
  406. drop() {
  407. this.expanded = !this.expanded
  408. },
  409. // 物料分类显示列表
  410. chooseFourClass() {
  411. this.$refs.fourClass.init()
  412. },
  413. // 选择物料分类
  414. acceptFourClass(selections) {
  415. console.log('收到的四级分类', selections)
  416. this.queryParams.materialClassifyFour = selections.code
  417. },
  418. // 显示物料编码列表
  419. test01() {
  420. this.$refs.contractSelect.init()
  421. },
  422. selectionsToInput(selections) {
  423. this.queryParams.materialCode = selections[0].code
  424. },
  425. // 选择默认采购组织
  426. chooseRefer(type, isPage, title) {
  427. this.referCondition.type = type
  428. this.referCondition.isPage = isPage
  429. this.referCondition.title = title
  430. this.$refs.refer.init(this.referCondition)
  431. },
  432. selectionsRefer(selection) {
  433. if (this.referCondition.title == '订单员') {
  434. this.staffOptions = selection
  435. this.queryParams.orderPersonal = selection[0].code
  436. }
  437. if (this.referCondition.title == '采购员') {
  438. this.staff2Options = selection
  439. this.queryParams.buyer = selection[0].code
  440. }
  441. }
  442. }
  443. }
  444. </script>
  445. <style lang="scss" scoped>
  446. #MaterialClassDivision {
  447. height: calc(100vh - 84px);
  448. padding: 12px;
  449. box-sizing: border-box;
  450. overflow-y: scroll;
  451. }
  452. .btn_grooup {
  453. margin-bottom: 10px;
  454. display: flex;
  455. justify-content: flex-end;
  456. }
  457. .lines {
  458. margin-top: 0;
  459. }
  460. .el-pagination {
  461. margin-top: 10px;
  462. text-align: right;
  463. }
  464. </style>