|
@@ -33,10 +33,11 @@
|
|
|
</el-upload>
|
|
|
<el-button type="primary" icon="el-icon-download" size="small" @click="downLoadTemplate()">模板</el-button>
|
|
|
<el-button type="primary" icon="el-icon-download" size="small" @click="downLoadData">导出</el-button>
|
|
|
- <el-button type="danger" icon="el-icon-delete" size="small" @click="removematter">删除</el-button>
|
|
|
+ <el-button type="danger" icon="el-icon-delete" size="small" @click="removematter" :disabled="removeDisabled">删除</el-button>
|
|
|
</div>
|
|
|
<div class="table-div">
|
|
|
<el-table ref="table" :data="tableData" style="width: 100%" :style="{width: '100%'}" height="100%" border
|
|
|
+ @selection-change="selectionChange"
|
|
|
:header-cell-style="{background:'rgba(250,250,250)',color:'rgb(50,59,65)',height:'39px',textAlign:'center'}">
|
|
|
<template slot="empty">
|
|
|
<img src="@/assets/icon/null.png" alt="">
|
|
@@ -67,7 +68,7 @@
|
|
|
<span>{{['设备类','车辆类','耗材类'][row.categoryType-1]}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="isAssets" label="是否为资产" align="center">
|
|
|
+ <el-table-column prop="isAssets" label="是否为资产" align="center" width="150">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-switch v-model="row.isAssets" :active-value="1" :inactive-value="0" active-text="是" inactive-text="否"
|
|
|
@change="rowChange(row)" :disabled="row.categoryType==2||row.categoryType==3"></el-switch>
|
|
@@ -122,11 +123,11 @@
|
|
|
style="width:100%" :disabled="opType2==2"></el-cascader>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <!-- <el-col :span="24">
|
|
|
<el-form-item label="物资类型编码" prop="matterNumber" :rules="[{ required: true, message: '请输入类型编码', trigger: 'blur' }]">
|
|
|
<el-input v-model="form.matterNumber" size="small" :readonly="opType2==2"></el-input>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="物资类型名称" prop="matterName" :rules="[{ required: true, message: '请输入类型名称', trigger: 'blur' }]">
|
|
|
<el-input v-model="form.matterName" size="small" :readonly="opType2==2"></el-input>
|
|
@@ -162,7 +163,7 @@
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="dialogFormVisible2 = false">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="submitTypeItem()">确 定</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="submitTypeItem()" v-show="opType2!=2">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -191,8 +192,12 @@ export default {
|
|
|
opType: 1,
|
|
|
disabled: false,
|
|
|
opType2: 1,
|
|
|
- upLoadDisabled: true
|
|
|
+ upLoadDisabled: true,
|
|
|
+ removeDisabled: true
|
|
|
};
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+
|
|
|
},
|
|
|
watch: {
|
|
|
filterText(val) {
|
|
@@ -200,7 +205,7 @@ export default {
|
|
|
},
|
|
|
'form.categoryType'(val, oldVal) {
|
|
|
if (val == 2) this.$set(this.form, 'isAssets', 1)
|
|
|
- else if(val==3) this.$set(this.form, 'isAssets', 0)
|
|
|
+ else if (val == 3) this.$set(this.form, 'isAssets', 0)
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -254,6 +259,9 @@ export default {
|
|
|
* 新增类型
|
|
|
*/
|
|
|
addBasetype() {
|
|
|
+ if (!this.typeForm.hasOwnProperty('isAssets')) {
|
|
|
+ this.$set(this.form, 'isAssets', 0)
|
|
|
+ }
|
|
|
addBasetype(this.typeForm).then(res => {
|
|
|
if (res.code == 1) {
|
|
|
this.getTypetree()
|
|
@@ -347,12 +355,19 @@ export default {
|
|
|
* 打开弹窗表单
|
|
|
*/
|
|
|
openForm(type, data = null) {
|
|
|
+
|
|
|
this.opType2 = type
|
|
|
if (type == 1) { // 新增
|
|
|
this.dialogFormVisible2 = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form2.clearValidate()// 清除表单验证
|
|
|
+ })
|
|
|
this.form = {}
|
|
|
} else { // 修改,详情
|
|
|
this.dialogFormVisible2 = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form2.clearValidate()// 清除表单验证
|
|
|
+ })
|
|
|
data['value'] = []
|
|
|
if (data.baseTypeSmallVOList.length - 1 >= 0)
|
|
|
data.value.push(data.baseTypeSmallVOList[data.baseTypeSmallVOList.length - 1].id)
|
|
@@ -471,6 +486,7 @@ export default {
|
|
|
* 编辑是否为资产
|
|
|
*/
|
|
|
rowChange(row) {
|
|
|
+ console.log('输出:change', row)
|
|
|
let data = JSON.parse(JSON.stringify(row))
|
|
|
data['value'] = []
|
|
|
if (data.baseTypeSmallVOList.length - 1 >= 0)
|
|
@@ -479,7 +495,34 @@ export default {
|
|
|
data.value.push(data.baseTypeSmallVOList[data.baseTypeSmallVOList.length - 2].id)
|
|
|
if (data.baseTypeSmallVOList.length - 3 >= 0)
|
|
|
data.value.push(data.baseTypeSmallVOList[data.baseTypeSmallVOList.length - 3].id)
|
|
|
- this.editormatter(data, true);
|
|
|
+ if (row.isAssets == 0) {
|
|
|
+ this.$confirm('该物资信息已同步到资产信息,是否确认修改?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.editormatter(data, true);
|
|
|
+ }).catch(() => {
|
|
|
+ this.getMatterTypes() // 取消修改
|
|
|
+ });
|
|
|
+ } else if (row.isAssets == 1) {
|
|
|
+ this.$confirm('该物资信息将同步到资产信息,是否确认修改?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.editormatter(data, true);
|
|
|
+ }).catch(() => {
|
|
|
+ this.getMatterTypes() // 取消修改
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 表格选择
|
|
|
+ */
|
|
|
+ selectionChange(selection) {
|
|
|
+ if (selection.length > 0) this.removeDisabled = false;
|
|
|
+ else this.removeDisabled = true;
|
|
|
},
|
|
|
/**
|
|
|
* 类型提交
|