AssetInDetailList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. <a-input placeholder="请输入资产编号" v-model="queryParam.assetNumber"></a-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. <a-input placeholder="请输入资产名称" v-model="queryParam.assetName"></a-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. <a-input placeholder="请输入资产类别" v-model="queryParam.assetsCategory"></a-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. <a-input placeholder="请输入品牌" v-model="queryParam.brand"></a-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. <a-input placeholder="请输入单位名称" v-model="queryParam.unitName"></a-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. <a-input placeholder="请输入规格型号" v-model="queryParam.model"></a-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. <a-input placeholder="请输入使用人" v-model="queryParam.user"></a-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. <a-input placeholder="请输入使用部门" v-model="queryParam.userDept"></a-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. <a-input placeholder="请输入入库人" v-model="queryParam.operator"></a-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. <a-input placeholder="请输入入库部门" v-model="queryParam.operatorDept"></a-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.operatorDate_begin"></j-date>
  61. <span class="query-group-split-cust"></span>
  62. <j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.operatorDate_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. @change="handleTableChange">
  111. <template slot="htmlSlot" slot-scope="text">
  112. <div v-html="text"></div>
  113. </template>
  114. <template slot="imgSlot" slot-scope="text">
  115. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此图片</span>
  116. <img v-else :src="getImgView(text)" height="25px" alt="图片不存在" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  117. </template>
  118. <template slot="fileSlot" slot-scope="text">
  119. <span v-if="!text" style="font-size: 12px;font-style: italic;">无此文件</span>
  120. <a-button
  121. v-else
  122. :ghost="true"
  123. type="primary"
  124. icon="download"
  125. size="small"
  126. @click="uploadFile(text)">
  127. 下载
  128. </a-button>
  129. </template>
  130. <span slot="action" slot-scope="text, record">
  131. <a @click="handleEdit(record)">编辑</a>
  132. <a-divider type="vertical" />
  133. <a-dropdown>
  134. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  135. <a-menu slot="overlay">
  136. <a-menu-item>
  137. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  138. <a>删除</a>
  139. </a-popconfirm>
  140. </a-menu-item>
  141. </a-menu>
  142. </a-dropdown>
  143. </span>
  144. </a-table>
  145. </div>
  146. <assetInDetail-modal ref="modalForm" @ok="modalFormOk"></assetInDetail-modal>
  147. <assetIn-modal ref="multiAddModalForm" @ok="modalFormOk"></assetIn-modal>
  148. </a-card>
  149. </template>
  150. <script>
  151. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  152. import AssetInDetailModal from './modules/AssetInDetailModal'
  153. import AssetInModal from './modules/AssetInModal'
  154. import { getAction } from '@api/manage'
  155. import JDate from '@/components/jeecg/JDate'
  156. export default {
  157. name: "AssetInDetailList",
  158. mixins:[JeecgListMixin],
  159. components: {
  160. AssetInDetailModal,
  161. AssetInModal,
  162. JDate
  163. },
  164. data () {
  165. return {
  166. description: '固定资产入库管理页面',
  167. // 表头
  168. columns: [
  169. {
  170. title: '#',
  171. dataIndex: '',
  172. key:'rowIndex',
  173. width:60,
  174. align:"center",
  175. // customRender: (value, row, index) => {
  176. // const obj = {
  177. // children: parseInt(index)+1,
  178. // attrs: {},
  179. // };
  180. // obj.attrs.rowSpan = this.myArray[index];
  181. // return obj
  182. // }
  183. customRender:function (t,r,index) {
  184. return parseInt(index)+1;
  185. }
  186. },
  187. {
  188. title:'资产编号',
  189. align:"center",
  190. dataIndex: 'assetNumber'
  191. },
  192. {
  193. title:'资产名称',
  194. align:"center",
  195. dataIndex: 'assetName'
  196. },
  197. {
  198. title:'资产类别',
  199. align:"center",
  200. dataIndex: 'assetsCategory'
  201. },
  202. {
  203. title:'品牌',
  204. align:"center",
  205. dataIndex: 'brand'
  206. },
  207. {
  208. title:'单位名称',
  209. align:"center",
  210. dataIndex: 'unitName'
  211. },
  212. {
  213. title:'规格型号',
  214. align:"center",
  215. dataIndex: 'model'
  216. },
  217. {
  218. title:'计量单位',
  219. align:"center",
  220. dataIndex: 'unit'
  221. },
  222. {
  223. title:'数量',
  224. align:"center",
  225. dataIndex: 'quantity'
  226. },
  227. {
  228. title:'金额',
  229. align:"center",
  230. dataIndex: 'amount'
  231. },
  232. {
  233. title:'使用年限',
  234. align:"center",
  235. dataIndex: 'exp'
  236. },
  237. {
  238. title:'购置日期',
  239. align:"center",
  240. dataIndex: 'purhcaseDate',
  241. customRender:function (text) {
  242. return !text?"":(text.length>10?text.substr(0,10):text)
  243. }
  244. },
  245. {
  246. title:'入库日期',
  247. align:"center",
  248. dataIndex: 'inDate',
  249. customRender:function (text) {
  250. return !text?"":(text.length>10?text.substr(0,10):text)
  251. }
  252. },
  253. {
  254. title:'存放地点',
  255. align:"center",
  256. dataIndex: 'place'
  257. },
  258. {
  259. title:'使用人',
  260. align:"center",
  261. dataIndex: 'user'
  262. },
  263. {
  264. title:'使用部门',
  265. align:"center",
  266. dataIndex: 'userDept'
  267. },
  268. {
  269. title:'资产状态',
  270. align:"center",
  271. dataIndex: 'state'
  272. },
  273. {
  274. title:'入库人',
  275. align:"center",
  276. dataIndex: 'operator',
  277. // customRender: (value, row, index) => {
  278. // const obj = {
  279. // children: value,
  280. // attrs: {},
  281. // };
  282. // obj.attrs.rowSpan = this.myArray[index];
  283. // return obj
  284. // }
  285. },
  286. {
  287. title:'入库部门',
  288. align:"center",
  289. dataIndex: 'operatorDept',
  290. // customRender: (value, row, index) => {
  291. // const obj = {
  292. // children: value,
  293. // attrs: {},
  294. // };
  295. // obj.attrs.rowSpan = this.myArray[index];
  296. // return obj
  297. // }
  298. },
  299. {
  300. title:'入库日期',
  301. align:"center",
  302. dataIndex: 'operatorDate',
  303. // customRender: (value, row, index) => {
  304. // const obj = {
  305. // children: value,
  306. // attrs: {},
  307. // };
  308. // obj.attrs.rowSpan = this.myArray[index];
  309. // return obj
  310. // }
  311. },
  312. {
  313. title: '操作',
  314. dataIndex: 'action',
  315. align:"center",
  316. customRender: (value, row, index) => {
  317. const obj = {
  318. children:
  319. (
  320. <span>
  321. <a id="btn" onClick={() => this.handleEdit(row.cdAssetInId)}>编辑 </a>
  322. <a-divider type="vertical" />
  323. <a-popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(row.cdAssetInId)} placement="topRight">
  324. <a>删除</a>
  325. </a-popconfirm>
  326. </span> ),
  327. attrs: {},
  328. };
  329. obj.attrs.rowSpan = this.myArray[index];
  330. return obj
  331. }
  332. }
  333. ],
  334. url: {
  335. list: "/oa/assetInDetail/list",
  336. delete: "/oa/assetIn/delete",
  337. deleteBatch: "/oa/assetIn/deleteBatch",
  338. queryById: "/oa/assetIn/queryById",
  339. },
  340. dictOptions:{},
  341. myArray:[],
  342. }
  343. },
  344. computed: {
  345. importExcelUrl: function(){
  346. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  347. }
  348. },
  349. methods: {
  350. initDictConfig(){
  351. },
  352. handleMultiAdd: function () {
  353. this.$refs.multiAddModalForm.add();
  354. this.$refs.multiAddModalForm.title = "新增";
  355. this.$refs.multiAddModalForm.disableSubmit = false;
  356. this.$refs.multiAddModalForm.init();
  357. },
  358. loadData(arg) {
  359. if(!this.url.list){
  360. this.$message.error("请设置url.list属性!")
  361. return
  362. }
  363. //加载数据 若传入参数1则加载第一页的内容
  364. if (arg === 1) {
  365. this.ipagination.current = 1;
  366. }
  367. var params = this.getQueryParams();//查询条件
  368. this.loading = true;
  369. getAction(this.url.list, params).then((res) => {
  370. if (res.success) {
  371. this.dataSource = res.result.records;
  372. this.setRowSpan(this.dataSource)
  373. this.ipagination.total = res.result.total;
  374. }
  375. if(res.code===510){
  376. this.$message.warning(res.message)
  377. }
  378. this.loading = false;
  379. })
  380. },
  381. // 设置每一行的rowSpan
  382. setRowSpan(data){
  383. //保存上一个name
  384. var x = "";
  385. //相同name出现的次数
  386. var count = 0;
  387. //该name第一次出现的位置
  388. var startindex=0;
  389. for(var i = 0;i<data.length;i++){
  390. console.log(data[i].cdAssetInId);
  391. //这里是合并name列,根据各自情况大家可以自己完善
  392. var val = data[(i)].cdAssetInId;
  393. if(i==0){
  394. x=val;
  395. count=1;
  396. this.myArray[0]=1
  397. }else{
  398. if(val==x){
  399. count++;
  400. this.myArray[startindex]=count;
  401. this.myArray[i]=0
  402. }else{
  403. count = 1;
  404. x=val;
  405. startindex=i;
  406. this.myArray[i]=1
  407. }
  408. }
  409. }
  410. console.log(this.myArray);
  411. },
  412. handleEdit: function (id) {
  413. getAction(this.url.queryById, {id:id}).then((res) => {
  414. if (res.success) {
  415. let record = res.result;
  416. this.$refs.multiAddModalForm.edit(record);
  417. this.$refs.multiAddModalForm.title = "编辑";
  418. this.$refs.multiAddModalForm.disableSubmit = false;
  419. }
  420. if(res.code===510){
  421. this.$message.warning(res.message)
  422. }
  423. this.loading = false;
  424. })
  425. },
  426. }
  427. }
  428. </script>
  429. <style scoped lang="less">
  430. // @import '~@assets/less/common.less';
  431. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item>.ant-form-item-label{
  432. width: 26% ;
  433. }
  434. /deep/.ant-col-xl-10>.ant-form-item>.ant-form-item-label {
  435. width: 16% !important;
  436. }
  437. </style>