@@ -243,20 +240,22 @@
@on-current-change="wuziSelect" />
-
-
+
+
查询
-
+
+
+
@@ -265,27 +264,34 @@
save,
index,
show
- } from "@/api/system/baseForm.js"
- import {
- index as getContract
+ } from "@/api/system/baseForm.js"
+ import {
+ index as getContract
} from "@/api/contract.js"
import {
Message
} from 'element-ui'
- import isEqual from '@/utils/index.js'
- import detailContract from "../component/detailContract.vue"
+ import detailContract from "../component/detailContract.vue"
+ import imports from "@/views/component/imports.vue"
+ import {
+ index as fieldIndex
+ } from "@/api/system/customFormField";
export default {
- components:{
- detailContract
+ components: {
+ detailContract,
+ imports
},
data() {
return {
isShow: false,
type: 'add',
- id: '',
- rukuType:'',
- rukuTypeName:'盘点',
+ id: '',
+ rukuType: '',
+ rukuTypeName: '盘点',
tableName: 'stocks',
+ importstableName: 'stocks_items',
+ customFormId: 8,
+ importForm: [],
cangkuList: [],
lexingoptions: [{
label: '盘点',
@@ -296,11 +302,12 @@
}, {
label: '回库',
value: '回库'
- }],
- rukupiciList:[],
- form: {
- caigouhetong:'',
- rukushijian: '',
+ }],
+ rukupiciList: [],
+ form: {
+ caigouhetong: '',
+ gudingzichanbianhao: '',
+ rukushijian: '',
// caigouhetong:'',
rukuleixing: '',
rukucangku: '',
@@ -310,30 +317,30 @@
beizhu: '',
rukumingxi: ''
},
- rules: {
- rukushijian: [{
- required: true,
- message: '请选择入库时间'
- }],
- // caigouhetong: [{
- // required: true,
- // message: '请选择采购合同'
- // }],
- jingbanren: [{
- required: true,
- message: '请填写经办人'
- }],
- jilurenyuan: [{
- required: true,
- message: '请填写记录人员'
- }]
- },
- hetongoptions:[],
+ rules: {
+ rukushijian: [{
+ required: true,
+ message: '请选择入库时间'
+ }],
+ // caigouhetong: [{
+ // required: true,
+ // message: '请选择采购合同'
+ // }],
+ jingbanren: [{
+ required: true,
+ message: '请填写经办人'
+ }],
+ jilurenyuan: [{
+ required: true,
+ message: '请填写记录人员'
+ }]
+ },
+ hetongoptions: [],
isShowMingxi: false,
showLoading: true,
mingxiObj: {
- wuzibianma:'',
- rukushuliang:''
+ wuzibianma: '',
+ rukushuliang: ''
},
mingxiObjBefore: {},
mingxiList: [],
@@ -341,31 +348,40 @@
mingxiTable: [{
label: "物资编码",
prop: "wuzibianma",
- width: 200
+ width: 180
},
{
label: "资产名称",
prop: "zichanmingcheng",
- width: 200,
+ width: 180,
+ },
+ {
+ label: "规格型号",
+ prop: "guigexinghao",
+ width: 180,
},
{
label: "物资类型",
prop: "wuzileixing",
- width: 200
- },
-
+ width: 180
+ },
+ {
+ label: "计量单位",
+ prop: "jiliangdanwei",
+ width: 180
+ },
{
label: "入库数量",
prop: "rukushuliang",
- width: 200
+ width: 180
}, {
label: "入库批次",
prop: "rukupici",
- width: 200
+ width: 180
}, {
label: "在库数量",
prop: "zaikushuliang",
- width: 200
+ width: 180
},
],
// 物资
@@ -403,129 +419,136 @@
}, {
title: '名称',
key: 'names',
- },{
- title:'物资类型',
- key:'wuzileixing',
- }],
- // 合同
- isShowHt: false,
- htList: [],
- htPageIndex: 1,
- htkeyword: '',
- htTotal: 0,
- editHt:'',
- htColumns: [{
- width: 60,
- _isChecked: false,
- key: "isSelect",
- resizable: true,
- render: (h, params) => {
- return h('div', [
- h('Radio', {
- props: {
- value: params.row.isSelect
- },
- on: {
- 'on-change': (e) => {
- this.htList.forEach((items) => {
- this.$set(items, 'isSelect', false)
- });
- this.htList[params.index].isSelect = e;
- }
- }
- })
- ])
- }
- }, {
- title: '名称',
- key: 'name',
- },{
- title:'类型',
- key:'type_name',
- width:100
- },{
- title:'状态',
- key:'status_name',
- width:100
- },{
- title:'查看',
- key:'',
- width:100,
- render: (h, params) => {
- return h('span', {
- style: {
- color:'#0077CC',
- cursor:'pointer'
- },
- on: {
- 'click': (e) => {
- console.log("click",params.row.id)
- this.$refs['detailContract'].getDetail(params.row.id)
- this.$refs['detailContract'].isShowDetail = true
- // @click=","
- }
- }
- },'查看详情')
- }
- }]
+ }, {
+ title: '物资类型',
+ key: 'wuzileixing',
+ }],
+ // 合同
+ isShowHt: false,
+ htList: [],
+ htPageIndex: 1,
+ htkeyword: '',
+ htTotal: 0,
+ editHt: '',
+ htColumns: [{
+ width: 60,
+ _isChecked: false,
+ key: "isSelect",
+ resizable: true,
+ render: (h, params) => {
+ return h('div', [
+ h('Radio', {
+ props: {
+ value: params.row.isSelect
+ },
+ on: {
+ 'on-change': (e) => {
+ this.htList.forEach((items) => {
+ this.$set(items, 'isSelect', false)
+ });
+ this.htList[params.index].isSelect = e;
+ }
+ }
+ })
+ ])
+ }
+ }, {
+ title: '名称',
+ key: 'name',
+ }, {
+ title: '类型',
+ key: 'type_name',
+ width: 100
+ }, {
+ title: '状态',
+ key: 'status_name',
+ width: 100
+ }, {
+ title: '查看',
+ key: '',
+ width: 100,
+ render: (h, params) => {
+ return h('span', {
+ style: {
+ color: '#0077CC',
+ cursor: 'pointer'
+ },
+ on: {
+ 'click': (e) => {
+ console.log("click", params.row.id)
+ this.$refs['detailContract'].getDetail(params.row.id)
+ this.$refs['detailContract'].isShowDetail = true
+ // @click=","
+ }
+ }
+ }, '查看详情')
+ }
+ }]
}
},
created() {
- this.getCangku()
+ this.getCangku()
+ },
+ methods: {
+ // 导入入库明细
+ importsRuku() {
+ this.$refs['imports'].show()
+ this.getField()
+ },
+ getimportData(e) {
+ console.log("e", e)
+ this.mingxiList = e
+ },
+ // 获取采购合同
+ async getHt() {
+ let res = await getContract({
+ page_size: 10,
+ page: this.htPageIndex,
+ keyword: this.htkeyword,
+ type: 2,
+ status: 2
+ })
+ for (var m of res.list.data) {
+ m.isSelect = false
+ m.type_name = m.type == 1 ? '服务' : (m.type == 2 ? '货物' : (m.type == 3 ? '工程' : '其他'))
+ m.status_name = m.status == 1 ? '待签订' : (m.status == 2 ? '已签订' : '')
+ }
+ console.log(res.list.data)
+ this.htList = res.list.data
+ this.htTotal = res.total
+ // this.hetongoptions = res.data
+ },
+ htCancel() {
+ this.htList.forEach((items) => {
+ this.$set(items, 'isSelect', false)
+ });
+ this.form.caigouhetong = this.editHt
+ },
+ htSelect(e) {
+ this.htList.forEach((items) => {
+ this.$set(items, 'isSelect', false)
+ if (items.id == e.id) {
+ this.$set(items, 'isSelect', true)
+ }
+ });
- // this.getWuzi()
- // this.getKucun()
+ },
+ htComfirm() {
+ console.log("123")
+ this.htList.forEach((items) => {
+ if (items.isSelect == true) {
+ this.form.caigouhetong = items.name
+ this.editHt = items.name
+ }
+ });
- },
- methods: {
- async getHt(){
- let res = await getContract({
- page_size: 10,
- page: this.htPageIndex,
- keyword:this.htkeyword,
- type:2,
- status:2
- })
- for (var m of res.list.data) {
- m.isSelect = false
- m.type_name = m.type==1?'服务':(m.type==2?'货物':(m.type==3?'工程':'其他'))
- m.status_name = m.status==1?'待签订':(m.status==2?'已签订':'')
- }
- console.log(res.list.data)
- this.htList = res.list.data
- this.htTotal = res.total
- // this.hetongoptions = res.data
- },
- htCancel(){
- this.htList.forEach((items) => {
- this.$set(items, 'isSelect', false)
- });
- this.form.caigouhetong = this.editHt
- },
- htSelect(e) {
- this.htList.forEach((items) => {
- this.$set(items, 'isSelect', false)
- if(items.id==e.id){
- this.$set(items, 'isSelect', true)
- }
- });
-
- },
- htComfirm(){
- console.log("123")
- this.htList.forEach((items) => {
- if(items.isSelect==true){
- this.form.caigouhetong = items.name
- this.editHt = items.name
- }
- });
-
- },
- htPageChange(e) {
- console.log("e", e)
- this.htPageIndex = e
- this.getHt()
},
+ htPageChange(e) {
+ console.log("e", e)
+ this.htPageIndex = e
+ this.getHt()
+ },
+ // 物资明细 回库从库存中选 其他从物资档案
mingxiConfirm() {
setTimeout(() => {
this.showLoading = false
@@ -534,28 +557,22 @@
})
}, 500)
- if(this.mingxiObj.wuzibianma==''||this.mingxiObj.rukushuliang==''){
- Message({
- type:'warning',
- message:'请填写完整数据'
- })
- this.showLoading = false
- return
+ if (this.mingxiObj.wuzibianma == '' || this.mingxiObj.rukushuliang == '') {
+ Message({
+ type: 'warning',
+ message: '请填写完整数据'
+ })
+ this.showLoading = false
+ return
}
if (this.mingxiIndex != '') {
-
- // 比较是否改变了 数据 改变提交到明细
- // let isTrue = this.isEqual(this.mingxiObjBefore,this.mingxiObj)
- // if(this.type=='editor'&&!isTrue){
- // this.submitMingxi(this.mingxiObj)
- // }
this.mingxiList[this.mingxiIndex - 1] = this.mingxiObj
} else {
this.mingxiList.push(this.mingxiObj)
}
- this.mingxiObj = {
- wuzibianma:'',
- rukushuliang:''
+ this.mingxiObj = {
+ wuzibianma: '',
+ rukushuliang: ''
}
this.mingxiObjBefore = {}
this.mingxiIndex = ''
@@ -566,9 +583,9 @@
this.wuziPageIndex = 1
},
mingxiCancel() {
- this.mingxiObj = {
- wuzibianma:'',
- rukushuliang:''
+ this.mingxiObj = {
+ wuzibianma: '',
+ rukushuliang: ''
}
this.mingxiObjBefore = {}
this.mingxiIndex = ''
@@ -587,38 +604,21 @@
this.isShowMingxi = true
},
showWuzi(type) {
- // if (this.form.rukuleixing == '') {
- // Message({
- // type: 'warning',
- // message: '请先选择入库类型'
- // })
- // return
- // }
this.isShowWuzi = true
if (type == '回库') {
this.$nextTick(() => {
this.$refs.huikubianma.focus()
})
this.getKucun()
- // this.showList = this.kucunList
- // this.showTotal = this.kucunTotal
} else {
this.getWuzi()
- // this.showList = this.wuziList
- // this.showTotal = this.wuziTotal
}
-
-
},
getList() {
if (this.form.rukuleixing == '回库') {
this.getKucun()
- // this.showList = this.kucunList
- // this.showTotal = this.kucunTotal
} else {
this.getWuzi()
- // this.showList = this.wuziList
- // this.showTotal = this.wuziTotal
}
},
async getWuzi() {
@@ -665,62 +665,53 @@
this.$nextTick(() => {
this.$refs.huikubianma.blur()
})
-
} else {
return
}
const res = await show({
id: id,
table_name: "inventorys"
- })
- console.log(res)
+ })
this.mingxiObj.wuzibianma = res.wuzibianma
this.mingxiObj.zichanmingcheng = res.zichanmingcheng
+ this.mingxiObj.guigexinghao = res.guigexinghao
this.mingxiObj.wuzileixing = res.wuzileixing
this.mingxiObj.jiliangdanwei = res.jiliangdanwei
this.mingxiObj.zaikushuliang = res.zaikushuliang
- this.mingxiObj.rukupici = res.rukupici
- console.log("this.mingxiObj",this.mingxiObj)
+ this.mingxiObj.rukupici = res.rukupici
this.mingxiObj.id = res.id
- },
- async getPici(){
- let res = await index({
- page_size: 999,
- page: 1,
- table_name: 'inventorys',
- filter: [{
- "key": "wuzibianma",
- "op": "eq",
- "value": this.mingxiObj.wuzibianma
- }]
- })
- this.rukupiciList = []
- for(var m of res.data){
- this.rukupiciList.push({
- value:m.rukupici,
- label:m.rukupici
- })
- }
},
- async getCangku() {
+ async getPici() {
let res = await index({
page_size: 999,
page: 1,
- table_name: 'materialstorages',
+ table_name: 'inventorys',
+ filter: [{
+ "key": "wuzibianma",
+ "op": "eq",
+ "value": this.mingxiObj.wuzibianma
+ }]
})
- this.cangkuList = res.data
+ this.rukupiciList = []
+ for (var m of res.data) {
+ this.rukupiciList.push({
+ value: m.rukupici,
+ label: m.rukupici
+ })
+ }
},
- wuziSelect(e) {
- console.log(e)
- this.showList.forEach((items) => {
- this.$set(items, 'isSelect', false)
- if(items.id==e.id){
- this.$set(items, 'isSelect', true)
- }
+ wuziSelect(e) {
+ console.log(e)
+ this.showList.forEach((items) => {
+ this.$set(items, 'isSelect', false)
+ if (items.id == e.id) {
+ this.$set(items, 'isSelect', true)
+ }
});
if (this.form.rukuleixing == '回库') {
this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng
+ this.mingxiObj.guigexinghao = e.guigexinghao
this.mingxiObj.wuzileixing = e.wuzileixing
this.mingxiObj.jiliangdanwei = e.jiliangdanwei
this.mingxiObj.zaikushuliang = e.zaikushuliang
@@ -730,12 +721,13 @@
this.mingxiObj.wuzibianma = e.wuzibianma
this.mingxiObj.zichanmingcheng = e.zichanmingcheng
this.mingxiObj.wuzileixing = e.wuzileixing
- this.mingxiObj.jiliangdanwei = e.jiliangdanwei
- this.mingxiObj.fenlei = e.fenlei
- if(this.mingxiObj.wuzileixing=='一类一码'){
-
- this.getPici()
- }
+ this.mingxiObj.guigexinghao = e.guigexinghao
+ this.mingxiObj.jiliangdanwei = e.jiliangdanwei
+ this.mingxiObj.fenlei = e.fenlei
+ if (this.mingxiObj.wuzileixing == '一类一码') {
+
+ this.getPici()
+ }
}
@@ -745,52 +737,36 @@
this.wuziPageIndex = e
this.getList()
},
- showWuzimingxi() {
+ async getCangku() {
+ let res = await index({
+ page_size: 999,
+ page: 1,
+ table_name: 'materialstorages',
+ })
+ this.cangkuList = res.data
},
async getDetail() {
const res = await show({
id: this.id,
table_name: this.tableName
})
- this.form = {
- caigouhetong:res?.caigouhetong,
+ this.form = {
+ caigouhetong: res?.caigouhetong,
+ gudingzichanbianhao: res?.gudingzichanbianhao,
rukushijian: res?.rukushijian,
- rukuleixing: res?.rukuleixing,
- rukucangku:res.rukucangku,
+ rukuleixing: res?.rukuleixing,
+ rukucangku: res.rukucangku,
jingbanren: res?.jingbanren,
jilurenyuan: res?.jilurenyuan,
baoguanrenyuan: res?.baoguanrenyuan,
beizhu: res?.beizhu,
rukumingxi: ''
- }
+ }
this.editHt = res?.caigouhetong
this.mingxiList = res.id_stocks_items_stocks_id_relation
},
- // 获取物资编号
- async getindex() {
- const res = await index({
- rows: this.select.pageSize,
- page: this.select.pageIndex,
- table_name: this.tableName
- })
- this.list = res.data
- this.total = res.total
- },
- // 编辑入库管理时 单个提交更改的明细
- submitMingxi(params, callback) {
- save({
- table_name: 'stocks_items',
- ...params
- }).then(res => {
- Message({
- type: 'success',
- message: '编辑成功'
- })
- })
- },
- submit() {
-
+ submit() {
this.form.id_stocks_items_stocks_id_relation = this.mingxiList
// return
if (this.type === 'add') {
@@ -822,60 +798,56 @@
})
}
},
- isEqual(objA, objB) {
- //相等
- if (objA === objB) return objA !== 0 || 1 / objA === 1 / objB;
- //空判断
- if (objA == null || objB == null) return objA === objB;
- //类型判断
- if (Object.prototype.toString.call(objA) !== Object.prototype.toString.call(objB)) return false;
-
- switch (Object.prototype.toString.call(objA)) {
- case '[object RegExp]':
- case '[object String]':
- //字符串转换比较
- return '' + objA === '' + objB;
- case '[object Number]':
- //数字转换比较,判断是否为NaN
- if (+objA !== +objA) {
- return +objB !== +objB;
- }
-
- return +objA === 0 ? 1 / +objA === 1 / objB : +objA === +objB;
- case '[object Date]':
- case '[object Boolean]':
- return +objA === +objB;
- case '[object Array]':
- //判断数组
- for (let i = 0; i < objA.length; i++) {
- if (!this.isEqual(objA[i], objB[i])) return false;
- }
- return true;
- case '[object Object]':
- //判断对象
- let keys = Object.keys(objA);
- for (let i = 0; i < keys.length; i++) {
- if (!this.isEqual(objA[keys[i]], objB[keys[i]])) return false;
- }
-
- keys = Object.keys(objB);
- for (let i = 0; i < keys.length; i++) {
- if (!this.isEqual(objA[keys[i]], objB[keys[i]])) return false;
+ async getField() {
+ const res = await fieldIndex({
+ page: 1,
+ page_size: 999,
+ custom_form_id: this.customFormId,
+ sort_name: 'sort',
+ sort_type: 'asc',
+ })
+ if (res.data && res.data instanceof Array) {
+ res.data.forEach(i => {
+ if (i.field) {
+ if (
+ (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") &&
+ i.parameter_id
+ ) {
+ getparameter({
+ id: i.parameter_id
+ }).then((res) => {
+ i._paramters = res.detail ?? [];
+ });
+ }
+ if (
+ (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") &&
+ i.link_table_name
+ ) {
+ index({
+ page: 1,
+ page_size: 999,
+ table_name: i.link_table_name,
+ }).then((res) => {
+ i._paramters = res.data ?? [];
+ });
+ }
}
-
- return true;
- default:
- return false;
+ })
}
- }
+ this.importForm = res.data
+ ?.filter((i) => i.list_show)
+ .map((i) => {
+ return i
+ })
+ },
},
watch: {
isShow(newVal) {
- if (newVal) {
- this.form.rukuleixing = this.rukuType
- this.rukuTypeName = this.rukuType=='回库'?'归还':this.rukuType
- if(this.rukuType=='采购'){
- this.getHt()
+ if (newVal) {
+ this.form.rukuleixing = this.rukuType
+ this.rukuTypeName = this.rukuType == '回库' ? '归还' : this.rukuType
+ if (this.rukuType == '采购') {
+ this.getHt()
}
if (this.type === 'editor') {
this.getDetail()
diff --git a/src/views/stocks/index.vue b/src/views/stocks/index.vue
index 094b611..c50e14f 100644
--- a/src/views/stocks/index.vue
+++ b/src/views/stocks/index.vue
@@ -90,6 +90,12 @@
type: 'index',
fixed: 'left',
width:80
+ },
+ {
+ label: "固定资产编号",
+ width: 180,
+ prop: 'gudingzichanbianhao',
+ align: 'center'
},
{
label: "入库时间",
@@ -126,7 +132,7 @@
},
{
label: "备注",
- // width: 200,
+ width: 240,
prop: 'beizhu',
align: 'left'
}
@@ -159,7 +165,7 @@
pageChange(e) {
this.select.pageIndex = e
- this.getIndex()
+ this.getindex()
},
editorRuku(id, type) {
this.$refs['addRuku'].id = id
@@ -180,59 +186,6 @@
})
this.getindex()
})
- },
- // 获取表信息
- async getField() {
- console.log(this.$route.meta.params,"---",this.$route)
- return
- if (this.$route.meta.params?.custom_form) {
- let decode = decodeURIComponent(this.$route.meta.params?.custom_form)
- try {
- let custom_form = JSON.parse(decode)
- this.customForm.customFormId = custom_form.custom_form_id
- this.customForm.tableName = custom_form.table_name
- console.log("123", this.customForm)
- // this.select.table_name = custom_form.table_name
- } catch (err) {
- console.warn(err)
- }
- }
- const res = await fieldIndex({
- page: 1,
- page_size: 999,
- custom_form_id: this.customForm.customFormId,
- sort_name: 'sort',
- sort_type: 'asc',
- })
- if (res.data && res.data instanceof Array) {
- res.data.forEach(i => {
- if (i.field) {
- if (
- (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") &&
- i.parameter_id
- ) {
- getparameter({
- id: i.parameter_id
- }).then((res) => {
- i._paramters = res.detail ?? [];
- });
- }
- if (
- (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") &&
- i.link_table_name
- ) {
- index({
- page: 1,
- page_size: 999,
- table_name: i.link_table_name,
- }).then((res) => {
- i._paramters = res.data ?? [];
- });
- }
- }
- })
- }
- this.form = res.data
},
},
mounted() {
@@ -244,10 +197,7 @@
this.rukuType = this.rukuTypeList[k]
}
}
- // this.rukuType = path=='check'?'盘点':(path=='purchase'?'采购':'回库')
-
}
- this.getField()
this.getindex()
}