AssetInDetailList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="资产编号">
  9. <j-input placeholder="请输入资产编号" v-model="queryParam.assetNumber"></j-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="资产名称">
  14. <j-input placeholder="请输入资产名称" v-model="queryParam.assetName"></j-input>
  15. </a-form-item>
  16. </a-col>
  17. <template v-if="toggleSearchStatus">
  18. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19. <a-form-item label="资产类别">
  20. <j-input placeholder="请输入资产类别" v-model="queryParam.assetsCategory"></j-input>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24. <a-form-item label="品牌">
  25. <j-input placeholder="请输入品牌" v-model="queryParam.brand"></j-input>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  29. <a-form-item label="供应商名称">
  30. <j-input placeholder="供应商名称" v-model="queryParam.unitName"></j-input>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  34. <a-form-item label="规格型号">
  35. <j-input placeholder="请输入规格型号" v-model="queryParam.model"></j-input>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  39. <a-form-item label="使用人">
  40. <j-input placeholder="请输入使用人" v-model="queryParam.user"></j-input>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  44. <a-form-item label="使用部门">
  45. <j-input placeholder="请输入使用部门" v-model="queryParam.userDept"></j-input>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  49. <a-form-item label="入库人">
  50. <j-input placeholder="请输入入库人" v-model="queryParam.operator"></j-input>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  54. <a-form-item label="入库部门">
  55. <j-input placeholder="请输入入库部门" v-model="queryParam.operatorDept"></j-input>
  56. </a-form-item>
  57. </a-col>
  58. <a-col :xl="10" :lg="11" :md="12" :sm="24">
  59. <a-form-item label="入库日期">
  60. <j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.inDate_begin"></j-date>
  61. <span class="query-group-split-cust"></span>
  62. <j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.inDate_end"></j-date>
  63. </a-form-item>
  64. </a-col>
  65. </template>
  66. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  67. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  68. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  69. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  70. <a @click="handleToggleSearch" style="margin-left: 8px">
  71. {{ toggleSearchStatus ? '收起' : '展开' }}
  72. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  73. </a>
  74. </span>
  75. </a-col>
  76. </a-row>
  77. </a-form>
  78. </div>
  79. <!-- 查询区域-END -->
  80. <!-- 操作按钮区域 -->
  81. <div class="table-operator">
  82. <a-button @click="handleMultiAdd" type="primary" icon="plus">新增</a-button>
  83. <!-- <a-button type="primary" icon="download" @click="handleExportXls('固定资产入库明细')">导出</a-button>
  84. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  85. <a-button type="primary" icon="import">导入</a-button>
  86. </a-upload> -->
  87. <a-dropdown v-if="selectedRowKeys.length > 0">
  88. <a-menu slot="overlay">
  89. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  90. </a-menu>
  91. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  92. </a-dropdown>
  93. </div>
  94. <!-- table区域-begin -->
  95. <div>
  96. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  97. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  98. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  99. </div>
  100. <a-table
  101. ref="table"
  102. size="middle"
  103. bordered
  104. rowKey="cdAssetInId"
  105. :columns="columns"
  106. :dataSource="dataSource"
  107. :pagination="ipagination"
  108. :loading="loading"
  109. :rowSelection="{fixed:true,selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  110. :scroll="{ x: 1500 }"
  111. @change="handleTableChange">
  112. <template slot="htmlSlot" slot-scope="text">
  113. <div v-html="text"></div>
  114. </template>
  115. <template slot="imgSlot" slot-scope="text">
  116. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
  117. <img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  118. </template>
  119. <template slot="fileSlot" slot-scope="text">
  120. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
  121. <a-button
  122. v-else
  123. :ghost="true"
  124. type="primary"
  125. icon="download"
  126. size="small"
  127. @click="uploadFile(text)">
  128. 下载
  129. </a-button>
  130. </template>
  131. <span slot="action" slot-scope="text, record">
  132. <a @click="handleEdit(record.cdAssetInId)">编辑</a>
  133. <a-divider type="vertical" />
  134. <a @click="print(record)">打印</a>
  135. <a-divider type="vertical" />
  136. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.cdAssetInId)">
  137. <a>删除</a>
  138. </a-popconfirm>
  139. </span>
  140. </a-table>
  141. </div>
  142. <assetInDetail-modal ref="modalForm" @ok="modalFormOk"></assetInDetail-modal>
  143. <assetIn-modal ref="multiAddModalForm" @ok="modalFormOk"></assetIn-modal>
  144. </a-card>
  145. </template>
  146. <script>
  147. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  148. import AssetInDetailModal from './modules/AssetInDetailModal'
  149. import AssetInModal from './modules/AssetInModal'
  150. import { getAction } from '@api/manage'
  151. import JDate from '@/components/jeecg/JDate'
  152. import JInput from '@/components/jeecg/JInput'
  153. export default {
  154. name: "AssetInDetailList",
  155. mixins:[JeecgListMixin],
  156. components: {
  157. AssetInDetailModal,
  158. AssetInModal,
  159. JDate,
  160. JInput
  161. },
  162. data () {
  163. return {
  164. description: '固定资产入库管理页面',
  165. // 表头
  166. columns: [
  167. {
  168. title: '#',
  169. dataIndex: '',
  170. key:'rowIndex',
  171. width:60,
  172. align:"center",
  173. // customRender: (value, row, index) => {
  174. // const obj = {
  175. // children: parseInt(index)+1,
  176. // attrs: {},
  177. // };
  178. // obj.attrs.rowSpan = this.myArray[index];
  179. // return obj
  180. // }
  181. customRender:function (t,r,index) {
  182. return parseInt(index)+1;
  183. }
  184. },
  185. {
  186. title:'资产编号',
  187. align:"center",
  188. width:100,
  189. dataIndex: 'assetNumber'
  190. },
  191. {
  192. title:'资产名称',
  193. align:"center",
  194. dataIndex: 'assetName',
  195. width:100,
  196. },
  197. {
  198. title:'资产类别',
  199. align:"center",
  200. dataIndex: 'assetsCategory',
  201. width:100,
  202. },
  203. {
  204. title:'品牌',
  205. align:"center",
  206. dataIndex: 'brand',
  207. width:80,
  208. },
  209. {
  210. title:'供应商名称',
  211. align:"center",
  212. dataIndex: 'unitName',
  213. width:100,
  214. },
  215. {
  216. title:'规格型号',
  217. align:"center",
  218. dataIndex: 'model',
  219. width:100,
  220. },
  221. {
  222. title:'计量单位',
  223. align:"center",
  224. dataIndex: 'unit',
  225. width:100,
  226. },
  227. {
  228. title:'数量',
  229. align:"center",
  230. dataIndex: 'quantity',
  231. width:80,
  232. },
  233. {
  234. title:'金额',
  235. align:"center",
  236. dataIndex: 'amount',
  237. width:80,
  238. },
  239. {
  240. title:'使用年限',
  241. align:"center",
  242. dataIndex: 'exp',
  243. width:100,
  244. },
  245. {
  246. title:'购置日期',
  247. align:"center",
  248. dataIndex: 'purhcaseDate',
  249. width:100,
  250. customRender:function (text) {
  251. return !text?"":(text.length>10?text.substr(0,10):text)
  252. }
  253. },
  254. {
  255. title:'入库日期',
  256. align:"center",
  257. dataIndex: 'inDate',
  258. width:100,
  259. customRender:function (text) {
  260. return !text?"":(text.length>10?text.substr(0,10):text)
  261. }
  262. },
  263. {
  264. title:'存放地点',
  265. align:"center",
  266. dataIndex: 'place',
  267. width:100,
  268. },
  269. {
  270. title:'使用人',
  271. align:"center",
  272. dataIndex: 'user',
  273. width:90,
  274. },
  275. {
  276. title:'使用部门',
  277. align:"center",
  278. dataIndex: 'userDept',
  279. width:100,
  280. },
  281. {
  282. title:'资产状态',
  283. align:"center",
  284. dataIndex: 'state',
  285. width:100,
  286. },
  287. {
  288. title:'入库人',
  289. align:"center",
  290. dataIndex: 'operator',
  291. width:90,
  292. // customRender: (value, row, index) => {
  293. // const obj = {
  294. // children: value,
  295. // attrs: {},
  296. // };
  297. // obj.attrs.rowSpan = this.myArray[index];
  298. // return obj
  299. // }
  300. },
  301. {
  302. title:'入库部门',
  303. align:"center",
  304. dataIndex: 'operatorDept',
  305. width:100,
  306. // customRender: (value, row, index) => {
  307. // const obj = {
  308. // children: value,
  309. // attrs: {},
  310. // };
  311. // obj.attrs.rowSpan = this.myArray[index];
  312. // return obj
  313. // }
  314. },
  315. // {
  316. // title:'入库日期',
  317. // align:"center",
  318. // dataIndex: 'operatorDate',
  319. // width:100,
  320. // // customRender: (value, row, index) => {
  321. // // const obj = {
  322. // // children: value,
  323. // // attrs: {},
  324. // // };
  325. // // obj.attrs.rowSpan = this.myArray[index];
  326. // // return obj
  327. // // }
  328. // },
  329. {
  330. title: '操作',
  331. dataIndex: 'action',
  332. align:"center",
  333. width:160,
  334. fixed: 'right',
  335. scopedSlots: { customRender: 'action' },
  336. // customRender: (value, row, index) => {
  337. // const obj = {
  338. // children:
  339. // (
  340. // <span>
  341. // <a id="btn" onClick={() => this.handleEdit(row.cdAssetInId)}>编辑 </a>
  342. // <a-divider type="vertical" />
  343. // <a id="btn" onClick={() => this.print(row)}>打印</a>
  344. // <a-divider type="vertical" />
  345. // <a-popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(row.cdAssetInId)} placement="topRight">
  346. // <a>删除</a>
  347. // </a-popconfirm>
  348. // </span> ),
  349. // attrs: {},
  350. // };
  351. // obj.attrs.rowSpan = this.myArray[index];
  352. // return obj
  353. // }
  354. }
  355. ],
  356. url: {
  357. list: "/oa/assetInDetail/list",
  358. delete: "/oa/assetIn/delete",
  359. deleteBatch: "/oa/assetIn/deleteBatch",
  360. queryById: "/oa/assetIn/queryById",
  361. },
  362. dictOptions:{},
  363. myArray:[],
  364. }
  365. },
  366. computed: {
  367. importExcelUrl: function(){
  368. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  369. }
  370. },
  371. methods: {
  372. initDictConfig(){
  373. },
  374. handleMultiAdd: function () {
  375. this.$refs.multiAddModalForm.add();
  376. this.$refs.multiAddModalForm.title = "新增";
  377. this.$refs.multiAddModalForm.disableSubmit = false;
  378. this.$refs.multiAddModalForm.init();
  379. },
  380. loadData(arg) {
  381. if(!this.url.list){
  382. this.$message.error("请设置url.list属性!")
  383. return
  384. }
  385. //加载数据 若传入参数1则加载第一页的内容
  386. if (arg === 1) {
  387. this.ipagination.current = 1;
  388. }
  389. var params = this.getQueryParams();//查询条件
  390. this.loading = true;
  391. getAction(this.url.list, params).then((res) => {
  392. if (res.success) {
  393. this.dataSource = res.result.records;
  394. this.setRowSpan(this.dataSource)
  395. this.ipagination.total = res.result.total;
  396. }
  397. if(res.code===510){
  398. this.$message.warning(res.message)
  399. }
  400. this.loading = false;
  401. })
  402. },
  403. // 设置每一行的rowSpan
  404. setRowSpan(data){
  405. //保存上一个name
  406. var x = "";
  407. //相同name出现的次数
  408. var count = 0;
  409. //该name第一次出现的位置
  410. var startindex=0;
  411. for(var i = 0;i<data.length;i++){
  412. console.log(data[i].cdAssetInId);
  413. //这里是合并name列,根据各自情况大家可以自己完善
  414. var val = data[(i)].cdAssetInId;
  415. if(i==0){
  416. x=val;
  417. count=1;
  418. this.myArray[0]=1
  419. }else{
  420. if(val==x){
  421. count++;
  422. this.myArray[startindex]=count;
  423. this.myArray[i]=0
  424. }else{
  425. count = 1;
  426. x=val;
  427. startindex=i;
  428. this.myArray[i]=1
  429. }
  430. }
  431. }
  432. console.log(this.myArray);
  433. },
  434. handleEdit: function (id) {
  435. getAction(this.url.queryById, {id:id}).then((res) => {
  436. if (res.success) {
  437. let record = res.result;
  438. this.$refs.multiAddModalForm.edit(record);
  439. this.$refs.multiAddModalForm.title = "编辑";
  440. this.$refs.multiAddModalForm.disableSubmit = false;
  441. }
  442. if(res.code===510){
  443. this.$message.warning(res.message)
  444. }
  445. this.loading = false;
  446. })
  447. },
  448. print(record){
  449. var printMouldUrl = window._CONFIG['domianURL']+'/jmreport/shareView/834580385717637120'+'?id='+record.cdAssetInId
  450. window.open(printMouldUrl)
  451. }
  452. }
  453. }
  454. </script>
  455. <style scoped lang="less">
  456. // @import '~@assets/less/common.less';
  457. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  458. width: 26% ;
  459. }
  460. /deep/.ant-col-xl-10>.ant-form-item>.ant-form-item-label {
  461. width: 16% !important;
  462. }
  463. </style>