You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
15 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  4. <el-button @click="getData()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'查询'}}</el-button>
  5. <el-button @click="addModal()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增'}}</el-button>
  6. <download-excel
  7. :fields="fields()"
  8. :data="exportData"
  9. type="xls"
  10. :name="exportName"
  11. :header="exportHeader"
  12. :footer="exportFooter"
  13. :fetch="createExportData"
  14. :before-generate="startDownload"
  15. :before-finish="finishDownload"
  16. worksheet="导出信息"
  17. class="el-button el-button--primary el-button--medium">
  18. {{ buttons.download }}
  19. </download-excel>
  20. </el-form>
  21. <el-table
  22. :height="height"
  23. :data="dataList"
  24. border
  25. v-loading="dataListLoading"
  26. style="width: 100%;">
  27. <el-table-column
  28. header-align="center"
  29. align="center"
  30. width="150"
  31. label="操作">
  32. <template slot-scope="scope">
  33. <a type="text" size="small" @click="editData(scope.row)">修改</a>
  34. <a type="text" size="small" @click="deleteData(scope.row)">删除</a>
  35. <a type="text" size="small" @click="getFactory(scope.row)">工厂信息</a>
  36. </template>
  37. </el-table-column>
  38. <el-table-column
  39. v-for="(item,index) in columnList" :key="index"
  40. :sortable="item.columnSortable"
  41. :prop="item.columnProp"
  42. :header-align="item.headerAlign"
  43. :show-overflow-tooltip="item.showOverflowTooltip"
  44. :align="item.align"
  45. :fixed="item.fixed"
  46. :min-width="item.columnWidth"
  47. :label="item.columnLabel">
  48. <template slot-scope="scope">
  49. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  50. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  51. style="width: 100px; height: 80px"/></span>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <el-dialog title="数据维护" :close-on-click-modal="false" v-drag :visible.sync="modelFlag" width="480px" >
  56. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  57. <el-form-item :label="'会计单位编号:'">
  58. <el-input v-model="modelData.companyID" :disabled="modelInputFlag" style="width: 130px"></el-input>
  59. </el-form-item>
  60. <el-form-item :label="'会计单位名称:'">
  61. <el-input v-model="modelData.companyName" style="width: 130px"></el-input>
  62. </el-form-item>
  63. <el-form-item :label="'税号:'">
  64. <el-input v-model="modelData.taxNo" style="width: 130px"></el-input>
  65. </el-form-item>
  66. </el-form>
  67. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  68. <el-form-item :label="'开户行名称:'">
  69. <el-input v-model="modelData.bankName" style="width: 204px"></el-input>
  70. </el-form-item>
  71. <el-form-item :label="'开户行账号:'">
  72. <el-input v-model="modelData.bankAccount" style="width: 200px"></el-input>
  73. </el-form-item>
  74. </el-form>
  75. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  76. <el-form-item :label="'月结日期:'">
  77. <el-select filterable v-model="modelData.cutoffDate" style="width: 130px">
  78. <el-option label="自然月月底" value="自然月月底"></el-option>
  79. <el-option label="每月固定日" value="每月固定日"></el-option>
  80. <el-option label="不固定" value="不固定"></el-option>
  81. </el-select>
  82. </el-form-item>
  83. <el-form-item :label="'每月几号:'">
  84. <el-input v-model="modelData.cutoffDateFixDate" style="width: 130px" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input>
  85. </el-form-item>
  86. <el-form-item :label="'在用:'">
  87. <el-select filterable v-model="modelData.active" style="width: 130px">
  88. <el-option label="Y" value="Y"></el-option>
  89. <el-option label="N" value="N"></el-option>
  90. </el-select>
  91. </el-form-item>
  92. </el-form>
  93. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  94. <el-button type="primary" @click="saveData()">保存</el-button>
  95. <el-button type="primary" @click="modelFlag = false">关闭</el-button>
  96. </el-footer>
  97. </el-dialog>
  98. </div>
  99. </template>
  100. <script>
  101. import {
  102. getCompanyInformation,
  103. saveCompanyInformation,
  104. deleteCompanyInformation,
  105. } from "@/api/base/site.js"
  106. export default {
  107. name: "companyInformation",
  108. data() {
  109. return {
  110. // 导出 start
  111. exportData: [],
  112. exportName: "会计单位信息"+this.dayjs().format('YYYYMMDDHHmmss'),
  113. exportHeader: ["会计单位信息"],
  114. exportFooter: [],
  115. // 导出 end
  116. height: 200,
  117. modelFlag:false,
  118. modelInputFlag:true,
  119. selectList:[],
  120. modelData: {
  121. add:'',
  122. companyID:'',
  123. companyName:'',
  124. active:'',
  125. taxNo:'',
  126. bankName:'',
  127. bankAccount:'',
  128. cutoffDate:'',
  129. cutoffDateFixDate:'',
  130. },
  131. dataList:[],
  132. dataListLoading: false,
  133. buttons:{
  134. download:'导出',
  135. },
  136. columnList: [
  137. {
  138. userId: this.$store.state.user.name,
  139. functionId: 6037,
  140. serialNumber: '6037TableCompanyId',
  141. tableId: "6037Table",
  142. tableName: "会计单位信息表",
  143. columnProp: "companyID",
  144. headerAlign: "center",
  145. align: "left",
  146. columnLabel: "会计单位编码",
  147. columnHidden: false,
  148. columnImage: false,
  149. columnSortable: false,
  150. sortLv: 0,
  151. status: true,
  152. fixed: false,
  153. columnWidth: 120
  154. },
  155. {
  156. userId: this.$store.state.user.name,
  157. functionId: 6037,
  158. serialNumber: '6037TableCompanyName',
  159. tableId: "6037Table",
  160. tableName: "会计单位信息表",
  161. columnProp: "companyName",
  162. headerAlign: "center",
  163. align: "left",
  164. columnLabel: "会计单位名称",
  165. columnHidden: false,
  166. columnImage: false,
  167. columnSortable: false,
  168. sortLv: 0,
  169. status: true,
  170. fixed: false,
  171. columnWidth: 200
  172. },
  173. {
  174. userId: this.$store.state.user.name,
  175. functionId: 6037,
  176. serialNumber: '6037TableTaxNo',
  177. tableId: "6037Table",
  178. tableName: "会计单位信息表",
  179. columnProp: "taxNo",
  180. headerAlign: "center",
  181. align: "left",
  182. columnLabel: "税号",
  183. columnHidden: false,
  184. columnImage: false,
  185. columnSortable: false,
  186. sortLv: 0,
  187. status: true,
  188. fixed: false,
  189. columnWidth: 200
  190. },
  191. {
  192. userId: this.$store.state.user.name,
  193. functionId: 6037,
  194. serialNumber: '6037TableBankName',
  195. tableId: "6037Table",
  196. tableName: "会计单位信息表",
  197. columnProp: "bankName",
  198. headerAlign: "center",
  199. align: "left",
  200. columnLabel: "开户行名称",
  201. columnHidden: false,
  202. columnImage: false,
  203. columnSortable: false,
  204. sortLv: 0,
  205. status: true,
  206. fixed: false,
  207. columnWidth: 160
  208. },
  209. {
  210. userId: this.$store.state.user.name,
  211. functionId: 6037,
  212. serialNumber: '6037TableBankAccount',
  213. tableId: "6037Table",
  214. tableName: "会计单位信息表",
  215. columnProp: "bankAccount",
  216. headerAlign: "center",
  217. align: "left",
  218. columnLabel: "开户行账号",
  219. columnHidden: false,
  220. columnImage: false,
  221. columnSortable: false,
  222. sortLv: 0,
  223. status: true,
  224. fixed: false,
  225. columnWidth: 200
  226. },
  227. {
  228. userId: this.$store.state.user.name,
  229. functionId: 6037,
  230. serialNumber: '6037TableActive',
  231. tableId: "6037Table",
  232. tableName: "会计单位信息表",
  233. columnProp: "active",
  234. headerAlign: "center",
  235. align: "left",
  236. columnLabel: "在用",
  237. columnHidden: false,
  238. columnImage: false,
  239. columnSortable: false,
  240. sortLv: 0,
  241. status: true,
  242. fixed: false,
  243. columnWidth: 40
  244. },
  245. {
  246. userId: this.$store.state.user.name,
  247. functionId: 6037,
  248. serialNumber: '6037TableCutoffDate',
  249. tableId: "6037Table",
  250. tableName: "会计单位信息表",
  251. columnProp: "cutoffDate",
  252. headerAlign: "center",
  253. align: "left",
  254. columnLabel: "月结日期",
  255. columnHidden: false,
  256. columnImage: false,
  257. columnSortable: false,
  258. sortLv: 0,
  259. status: true,
  260. fixed: false,
  261. columnWidth: 100
  262. },
  263. {
  264. userId: this.$store.state.user.name,
  265. functionId: 6037,
  266. serialNumber: '6037TableCutoffDateFixDate',
  267. tableId: "6037Table",
  268. tableName: "会计单位信息表",
  269. columnProp: "cutoffDateFixDate",
  270. headerAlign: "center",
  271. align: "right",
  272. columnLabel: "每月几号",
  273. columnHidden: false,
  274. columnImage: false,
  275. columnSortable: false,
  276. sortLv: 0,
  277. status: true,
  278. fixed: false,
  279. columnWidth: 80
  280. }
  281. ],
  282. }
  283. },
  284. mounted() {
  285. this.$nextTick(() => {
  286. this.height = window.innerHeight - 140;
  287. })
  288. },
  289. watch: {
  290. '$route' (to, from) {
  291. if(localStorage.getItem('companyInformation')!=undefined){
  292. this.getData()
  293. }
  294. }
  295. },
  296. methods: {
  297. getData(){
  298. let data={};
  299. if(localStorage.getItem('companyInformation')!=undefined){
  300. data=JSON.parse(localStorage.getItem('companyInformation'));
  301. }
  302. localStorage.removeItem('companyInformation');
  303. getCompanyInformation(data).then(({data}) => {
  304. this.dataList = data.rows
  305. })
  306. },
  307. addModal(){
  308. this.modelData={};
  309. this.modelData.add=0;
  310. this.modelInputFlag=false;
  311. this.modelData.active='Y';
  312. this.modelFlag=true;
  313. },
  314. editData(row){
  315. this.modelData=JSON.parse(JSON.stringify(row));
  316. this.modelData.add=1;
  317. this.modelInputFlag=true;
  318. this.modelFlag=true;
  319. },
  320. deleteData(row){
  321. this.$confirm(`是否删除此条会计单位记录?`, '提示', {
  322. confirmButtonText: '确定',
  323. cancelButtonText: '取消',
  324. type: 'warning'
  325. }).then(() => {
  326. this.modelData=JSON.parse(JSON.stringify(row));
  327. deleteCompanyInformation(this.modelData).then(({data}) => {
  328. if (data && data.code == 200) {
  329. this.modelFlag = false
  330. this.getData();
  331. this.$message({
  332. message: '操作成功',
  333. type: 'success',
  334. duration: 1500,
  335. onClose: () => {
  336. }
  337. })
  338. } else {
  339. this.$alert(data.msg, '错误', {
  340. confirmButtonText: '确定'
  341. })
  342. }
  343. })
  344. })
  345. },
  346. saveData(){
  347. if(this.modelData.companyID==''||this.modelData.companyID==null){
  348. this.$alert("请输入会计单位编号!",'错误',{
  349. confirmButtonText:'确定'
  350. })
  351. return false;
  352. }
  353. if(this.modelData.companyName==''||this.modelData.companyName==null){
  354. this.$alert("请输入会计单位名称!",'错误',{
  355. confirmButtonText:'确定'
  356. })
  357. return false;
  358. }
  359. if(this.modelData.active==''||this.modelData.active==null){
  360. this.$alert("请选择是否在用!",'错误',{
  361. confirmButtonText:'确定'
  362. })
  363. return false;
  364. }
  365. if(this.modelData.cutoffDate==''||this.modelData.cutoffDate==null){
  366. this.$alert("请选择月结日期!",'错误',{
  367. confirmButtonText:'确定'
  368. })
  369. return false;
  370. }
  371. if(this.modelData.cutoffDateFixDate==''||this.modelData.cutoffDateFixDate==null){
  372. this.modelData.cutoffDateFixDate=0;
  373. }
  374. if(this.modelData.cutoffDateFixDate>31){
  375. this.$alert("请输入正确的每月几号!",'错误',{
  376. confirmButtonText:'确定'
  377. })
  378. return false;
  379. }
  380. saveCompanyInformation(this.modelData).then(({data}) => {
  381. if (data && data.code == 200) {
  382. this.modelFlag = false
  383. this.getData();
  384. this.$message({
  385. message: '操作成功',
  386. type: 'success',
  387. duration: 1500,
  388. onClose: () => {
  389. }
  390. })
  391. } else {
  392. this.$alert(data.msg, '错误', {
  393. confirmButtonText: '确定'
  394. })
  395. }
  396. })
  397. },
  398. //导出excel
  399. createExportData() {
  400. return this.dataList;
  401. },
  402. startDownload() {
  403. // this.exportData = this.dataList
  404. },
  405. finishDownload() {
  406. },
  407. fields() {
  408. let json = "{"
  409. this.columnList.forEach((item, index) => {
  410. if (index == this.columnList.length - 1) {
  411. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  412. } else {
  413. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  414. }
  415. })
  416. json += "}"
  417. let s = eval("(" + json + ")")
  418. return s
  419. },
  420. // 导出 end
  421. getFactory(row){
  422. let inData={companyID:row.companyID,companyName:row.companyName};
  423. localStorage.setItem('factoryInformation', JSON.stringify(inData))
  424. this.$router.replace('base-factoryInformation')
  425. }
  426. },
  427. created() {
  428. this.getData();
  429. }
  430. }
  431. </script>
  432. <style >
  433. .el-textarea__inner {
  434. padding: 5px 5px;
  435. }
  436. </style>